From b824fd328a997e06038aaa8627e06303031f270e Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Wed, 31 Jul 2024 08:41:25 -0600 Subject: [PATCH 1/4] Display fixes by default (#7352) Use the existing `printer::Flags::SHOW_FIX_DIFF` to enable printing fixable diffs in `check` mode automatically. Enable it whenever the output format is `Full`, but keep a distinct flag for it (a) because output format and whether to print diffs are really separate concerns, (b) because it makes it easy to make changes to what sets the flag to true if/as that is needful, and (c) because it minimally perturbs the rest of the code. This does not introduce *new* tests, but does update the existing tests to account for the new default output. --- crates/ruff/src/lib.rs | 3 + crates/ruff/tests/integration_test.rs | 187 +++++++++++++ crates/ruff_linter/src/message/diff.rs | 19 +- ...s__eradicate__tests__ERA001_ERA001.py.snap | 68 +++-- ...i-non-annotated-dependency_FAST002.py.snap | 36 ++- ...i-redundant-response-model_FAST001.py.snap | 38 ++- ..._annotations__tests__auto_return_type.snap | 148 ++++++++--- ...tations__tests__auto_return_type_py38.snap | 148 ++++++++--- ...__flake8_annotations__tests__defaults.snap | 26 +- ...otations__tests__ignore_fully_untyped.snap | 12 +- ..._annotations__tests__mypy_init_return.snap | 16 +- ...otations__tests__simple_magic_methods.snap | 56 ++-- ...tions__tests__suppress_none_returning.snap | 10 +- ...e8_async__tests__ASYNC105_ASYNC105.py.snap | 96 +++++-- ...e8_async__tests__ASYNC115_ASYNC115.py.snap | 24 +- ...e8_async__tests__ASYNC116_ASYNC116.py.snap | 28 +- ..._tests__preview__ASYNC115_ASYNC115.py.snap | 40 ++- ..._tests__preview__ASYNC116_ASYNC116.py.snap | 56 +++- ...__flake8_bugbear__tests__B004_B004.py.snap | 14 +- ...flake8_bugbear__tests__B006_B006_1.py.snap | 4 +- ...flake8_bugbear__tests__B006_B006_2.py.snap | 6 +- ...flake8_bugbear__tests__B006_B006_3.py.snap | 4 +- ...flake8_bugbear__tests__B006_B006_4.py.snap | 4 +- ...flake8_bugbear__tests__B006_B006_5.py.snap | 54 ++-- ...flake8_bugbear__tests__B006_B006_6.py.snap | 4 +- ...flake8_bugbear__tests__B006_B006_7.py.snap | 4 +- ...flake8_bugbear__tests__B006_B006_8.py.snap | 20 +- ...ke8_bugbear__tests__B006_B006_B008.py.snap | 92 +++++-- ...__flake8_bugbear__tests__B007_B007.py.snap | 18 +- ...ke8_bugbear__tests__B009_B009_B010.py.snap | 72 +++-- ...ke8_bugbear__tests__B010_B009_B010.py.snap | 24 +- ...__flake8_bugbear__tests__B011_B011.py.snap | 8 +- ...__flake8_bugbear__tests__B013_B013.py.snap | 8 +- ...__flake8_bugbear__tests__B014_B014.py.snap | 20 +- ...__flake8_bugbear__tests__B033_B033.py.snap | 32 ++- ...rules__flake8_bugbear__tests__B905.py.snap | 40 ++- ...extend_immutable_calls_arg_annotation.snap | 4 +- ...rules__flake8_commas__tests__COM81.py.snap | 180 +++++++++---- ...8_comprehensions__tests__C400_C400.py.snap | 28 +- ...8_comprehensions__tests__C401_C401.py.snap | 48 +++- ...8_comprehensions__tests__C402_C402.py.snap | 52 +++- ...8_comprehensions__tests__C403_C403.py.snap | 44 +++- ...8_comprehensions__tests__C404_C404.py.snap | 40 ++- ...8_comprehensions__tests__C405_C405.py.snap | 80 ++++-- ...8_comprehensions__tests__C406_C406.py.snap | 16 +- ...8_comprehensions__tests__C408_C408.py.snap | 72 +++-- ...low_dict_calls_with_keyword_arguments.snap | 28 +- ...8_comprehensions__tests__C409_C409.py.snap | 44 +++- ...8_comprehensions__tests__C410_C410.py.snap | 24 +- ...8_comprehensions__tests__C411_C411.py.snap | 4 +- ...8_comprehensions__tests__C413_C413.py.snap | 52 +++- ...8_comprehensions__tests__C414_C414.py.snap | 96 +++++-- ...8_comprehensions__tests__C416_C416.py.snap | 28 +- ...8_comprehensions__tests__C417_C417.py.snap | 72 +++-- ...8_comprehensions__tests__C418_C418.py.snap | 16 +- ...8_comprehensions__tests__C419_C419.py.snap | 28 +- ...sions__tests__preview__C419_C419_1.py.snap | 20 +- ...__rules__flake8_errmsg__tests__custom.snap | 48 +++- ...rules__flake8_errmsg__tests__defaults.snap | 60 +++-- ...flake8_executable__tests__EXE004_1.py.snap | 4 +- ...flake8_executable__tests__EXE004_4.py.snap | 4 +- ...02_no_future_import_uses_lowercase.py.snap | 4 +- ..._fa102_no_future_import_uses_union.py.snap | 8 +- ..._no_future_import_uses_union_inner.py.snap | 8 +- ...icit_str_concat__tests__ISC001_ISC.py.snap | 48 +++- ...oncat__tests__multiline_ISC001_ISC.py.snap | 48 +++- ...8_import_conventions__tests__defaults.snap | 52 +++- ..._import_conventions__tests__same_name.snap | 4 +- ...ke8_import_conventions__tests__tricky.snap | 4 +- ...ake8_logging__tests__LOG001_LOG001.py.snap | 8 +- ...ake8_logging__tests__LOG002_LOG002.py.snap | 16 +- ...ake8_logging__tests__LOG009_LOG009.py.snap | 8 +- ...flake8_logging_format__tests__G010.py.snap | 16 +- ...__flake8_pie__tests__PIE790_PIE790.py.snap | 144 +++++++--- ...__flake8_pie__tests__PIE794_PIE794.py.snap | 24 +- ...__flake8_pie__tests__PIE800_PIE800.py.snap | 24 +- ...__flake8_pie__tests__PIE804_PIE804.py.snap | 40 ++- ...__flake8_pie__tests__PIE807_PIE807.py.snap | 24 +- ...__flake8_pie__tests__PIE808_PIE808.py.snap | 8 +- ...__flake8_pie__tests__PIE810_PIE810.py.snap | 28 +- ...es__flake8_print__tests__T201_T201.py.snap | 16 +- ...es__flake8_print__tests__T203_T203.py.snap | 8 +- ..._flake8_pyi__tests__PYI009_PYI009.pyi.snap | 8 +- ..._flake8_pyi__tests__PYI010_PYI010.pyi.snap | 12 +- ..._flake8_pyi__tests__PYI011_PYI011.pyi.snap | 72 +++-- ..._flake8_pyi__tests__PYI012_PYI012.pyi.snap | 24 +- ...__flake8_pyi__tests__PYI013_PYI013.py.snap | 32 ++- ..._flake8_pyi__tests__PYI013_PYI013.pyi.snap | 36 ++- ..._flake8_pyi__tests__PYI014_PYI014.pyi.snap | 52 +++- ..._flake8_pyi__tests__PYI015_PYI015.pyi.snap | 44 +++- ...__flake8_pyi__tests__PYI016_PYI016.py.snap | 92 +++++-- ..._flake8_pyi__tests__PYI016_PYI016.pyi.snap | 92 +++++-- ..._flake8_pyi__tests__PYI020_PYI020.pyi.snap | 36 ++- ...flake8_pyi__tests__PYI025_PYI025_1.py.snap | 8 +- ...lake8_pyi__tests__PYI025_PYI025_1.pyi.snap | 20 +- ...flake8_pyi__tests__PYI025_PYI025_2.py.snap | 4 +- ...lake8_pyi__tests__PYI025_PYI025_2.pyi.snap | 4 +- ...flake8_pyi__tests__PYI025_PYI025_3.py.snap | 4 +- ...lake8_pyi__tests__PYI025_PYI025_3.pyi.snap | 4 +- ..._flake8_pyi__tests__PYI026_PYI026.pyi.snap | 24 +- ..._flake8_pyi__tests__PYI029_PYI029.pyi.snap | 12 +- ...__flake8_pyi__tests__PYI030_PYI030.py.snap | 104 ++++++-- ..._flake8_pyi__tests__PYI030_PYI030.pyi.snap | 104 ++++++-- ...__flake8_pyi__tests__PYI032_PYI032.py.snap | 8 +- ..._flake8_pyi__tests__PYI032_PYI032.pyi.snap | 8 +- ...__flake8_pyi__tests__PYI036_PYI036.py.snap | 12 +- ..._flake8_pyi__tests__PYI036_PYI036.pyi.snap | 12 +- ..._flake8_pyi__tests__PYI053_PYI053.pyi.snap | 32 ++- ..._flake8_pyi__tests__PYI054_PYI054.pyi.snap | 32 ++- ...__flake8_pyi__tests__PYI055_PYI055.py.snap | 28 +- ..._flake8_pyi__tests__PYI055_PYI055.pyi.snap | 36 ++- ...__flake8_pyi__tests__PYI058_PYI058.py.snap | 32 ++- ..._flake8_pyi__tests__PYI058_PYI058.pyi.snap | 36 ++- ...__flake8_pyi__tests__PYI059_PYI059.py.snap | 16 +- ..._flake8_pyi__tests__PYI059_PYI059.pyi.snap | 16 +- ...__flake8_pyi__tests__PYI064_PYI064.py.snap | 16 +- ..._flake8_pyi__tests__PYI064_PYI064.pyi.snap | 16 +- ...e8_pyi__tests__py38_PYI026_PYI026.pyi.snap | 24 +- ...e8_pytest_style__tests__PT001_default.snap | 12 +- ...st_style__tests__PT001_no_parentheses.snap | 24 +- ...es__flake8_pytest_style__tests__PT003.snap | 32 ++- ...flake8_pytest_style__tests__PT006_csv.snap | 16 +- ...e8_pytest_style__tests__PT006_default.snap | 48 +++- ...lake8_pytest_style__tests__PT006_list.snap | 40 ++- ...est_style__tests__PT007_list_of_lists.snap | 40 ++- ...st_style__tests__PT007_list_of_tuples.snap | 40 ++- ...st_style__tests__PT007_tuple_of_lists.snap | 60 +++-- ...t_style__tests__PT007_tuple_of_tuples.snap | 60 +++-- ...es__flake8_pytest_style__tests__PT009.snap | 116 +++++--- ...es__flake8_pytest_style__tests__PT014.snap | 36 ++- ...es__flake8_pytest_style__tests__PT018.snap | 60 +++-- ...es__flake8_pytest_style__tests__PT022.snap | 12 +- ...e8_pytest_style__tests__PT023_default.snap | 20 +- ...st_style__tests__PT023_no_parentheses.snap | 20 +- ...es__flake8_pytest_style__tests__PT024.snap | 16 +- ...es__flake8_pytest_style__tests__PT025.snap | 8 +- ...es__flake8_pytest_style__tests__PT026.snap | 8 +- ...__flake8_pytest_style__tests__PT027_0.snap | 34 ++- ...__flake8_pytest_style__tests__PT027_1.snap | 4 +- ..._tests__only_docstring_doubles_all.py.snap | 6 +- ...es__tests__only_inline_doubles_all.py.snap | 4 +- ..._tests__only_multiline_doubles_all.py.snap | 4 +- ...ing_doubles_over_docstring_doubles.py.snap | 20 +- ...ubles_over_docstring_doubles_class.py.snap | 8 +- ...es_over_docstring_doubles_function.py.snap | 20 +- ...docstring_doubles_module_multiline.py.snap | 8 +- ...ocstring_doubles_module_singleline.py.snap | 8 +- ...ing_doubles_over_docstring_singles.py.snap | 12 +- ...ubles_over_docstring_singles_class.py.snap | 12 +- ...es_over_docstring_singles_function.py.snap | 12 +- ...g_singles_mixed_quotes_class_var_1.py.snap | 12 +- ...g_singles_mixed_quotes_class_var_2.py.snap | 24 +- ...xed_quotes_module_singleline_var_1.py.snap | 8 +- ...xed_quotes_module_singleline_var_2.py.snap | 12 +- ...docstring_singles_module_multiline.py.snap | 4 +- ...ocstring_singles_module_singleline.py.snap | 4 +- ...ing_singles_over_docstring_doubles.py.snap | 12 +- ...ngles_over_docstring_doubles_class.py.snap | 12 +- ...es_over_docstring_doubles_function.py.snap | 12 +- ...g_doubles_mixed_quotes_class_var_2.py.snap | 12 +- ...xed_quotes_module_singleline_var_2.py.snap | 4 +- ...docstring_doubles_module_multiline.py.snap | 4 +- ...ocstring_doubles_module_singleline.py.snap | 4 +- ...ing_singles_over_docstring_singles.py.snap | 24 +- ...ngles_over_docstring_singles_class.py.snap | 8 +- ...es_over_docstring_singles_function.py.snap | 20 +- ...docstring_singles_module_multiline.py.snap | 8 +- ...ocstring_singles_module_singleline.py.snap | 8 +- ...ests__require_doubles_over_singles.py.snap | 12 +- ...quire_doubles_over_singles_escaped.py.snap | 44 +++- ...re_doubles_over_singles_escaped_py311.snap | 16 +- ...s_over_singles_escaped_unnecessary.py.snap | 72 +++-- ...uire_doubles_over_singles_implicit.py.snap | 28 +- ...bles_over_singles_multiline_string.py.snap | 4 +- ...ver_singles_would_be_triple_quotes.py.snap | 12 +- ...ests__require_singles_over_doubles.py.snap | 12 +- ...quire_singles_over_doubles_escaped.py.snap | 52 +++- ...re_singles_over_doubles_escaped_py311.snap | 24 +- ...s_over_doubles_escaped_unnecessary.py.snap | 76 ++++-- ...uire_singles_over_doubles_implicit.py.snap | 28 +- ...gles_over_doubles_multiline_string.py.snap | 4 +- ...ver_doubles_would_be_triple_quotes.py.snap | 4 +- ...ry-paren-on-raise-exception_RSE102.py.snap | 56 +++- ...lake8_return__tests__RET501_RET501.py.snap | 8 +- ...lake8_return__tests__RET502_RET502.py.snap | 4 +- ...lake8_return__tests__RET503_RET503.py.snap | 92 +++++-- ...lake8_return__tests__RET504_RET504.py.snap | 52 +++- ...urn__tests__preview__RET505_RET505.py.snap | 80 ++++-- ...urn__tests__preview__RET506_RET506.py.snap | 28 +- ...urn__tests__preview__RET507_RET507.py.snap | 28 +- ...urn__tests__preview__RET508_RET508.py.snap | 32 ++- ...ke8_simplify__tests__SIM101_SIM101.py.snap | 36 ++- ...ke8_simplify__tests__SIM102_SIM102.py.snap | 48 +++- ...ke8_simplify__tests__SIM103_SIM103.py.snap | 40 ++- ...8_simplify__tests__SIM105_SIM105_0.py.snap | 36 ++- ...8_simplify__tests__SIM105_SIM105_1.py.snap | 4 +- ...8_simplify__tests__SIM105_SIM105_2.py.snap | 4 +- ...8_simplify__tests__SIM105_SIM105_4.py.snap | 4 +- ...ke8_simplify__tests__SIM108_SIM108.py.snap | 14 +- ...ke8_simplify__tests__SIM109_SIM109.py.snap | 16 +- ...ke8_simplify__tests__SIM110_SIM110.py.snap | 48 +++- ...ke8_simplify__tests__SIM110_SIM111.py.snap | 48 +++- ...ke8_simplify__tests__SIM112_SIM112.py.snap | 12 +- ...ke8_simplify__tests__SIM114_SIM114.py.snap | 68 +++-- ...ke8_simplify__tests__SIM117_SIM117.py.snap | 44 +++- ...ke8_simplify__tests__SIM118_SIM118.py.snap | 80 ++++-- ...ke8_simplify__tests__SIM201_SIM201.py.snap | 12 +- ...ke8_simplify__tests__SIM202_SIM202.py.snap | 12 +- ...ke8_simplify__tests__SIM208_SIM208.py.snap | 20 +- ...ke8_simplify__tests__SIM210_SIM210.py.snap | 16 +- ...ke8_simplify__tests__SIM211_SIM211.py.snap | 12 +- ...ke8_simplify__tests__SIM212_SIM212.py.snap | 8 +- ...ke8_simplify__tests__SIM220_SIM220.py.snap | 12 +- ...ke8_simplify__tests__SIM221_SIM221.py.snap | 12 +- ...ke8_simplify__tests__SIM222_SIM222.py.snap | 208 +++++++++++---- ...ke8_simplify__tests__SIM223_SIM223.py.snap | 200 ++++++++++---- ...ke8_simplify__tests__SIM300_SIM300.py.snap | 68 +++-- ...ke8_simplify__tests__SIM401_SIM401.py.snap | 32 ++- ...ke8_simplify__tests__SIM910_SIM910.py.snap | 24 +- ...ts__tests__ban_parent_imports_package.snap | 24 +- ..._invalid-todo-capitalization_TD006.py.snap | 12 +- ...__empty-type-checking-block_TCH005.py.snap | 24 +- ..._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 | 48 +++- ...rt-in-type-checking-block_TCH004_1.py.snap | 4 +- ...t-in-type-checking-block_TCH004_11.py.snap | 4 +- ...t-in-type-checking-block_TCH004_12.py.snap | 4 +- ...t-in-type-checking-block_TCH004_17.py.snap | 4 +- ...rt-in-type-checking-block_TCH004_2.py.snap | 4 +- ...rt-in-type-checking-block_TCH004_4.py.snap | 4 +- ...rt-in-type-checking-block_TCH004_5.py.snap | 12 +- ...rt-in-type-checking-block_TCH004_9.py.snap | 8 +- ...mport-in-type-checking-block_quote.py.snap | 4 +- ...k_runtime_evaluated_base_classes_1.py.snap | 12 +- ...ock_runtime_evaluated_decorators_1.py.snap | 12 +- ...y-standard-library-import_init_var.py.snap | 8 +- ...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_TCH001.py.snap | 4 +- ...nly-standard-library-import_TCH003.py.snap | 4 +- ...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 | 4 +- ...ort_runtime_evaluated_decorators_3.py.snap | 4 +- ...ing-only-third-party-import_TCH002.py.snap | 36 ++- ...t_runtime_evaluated_base_classes_2.py.snap | 8 +- ...ort_runtime_evaluated_decorators_2.py.snap | 4 +- ...-third-party-import_singledispatch.py.snap | 6 +- ...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 +- ...__typing_import_before_package_import.snap | 4 +- ..._use_pathlib__tests__PTH201_PTH201.py.snap | 16 +- ...rules__flynt__tests__FLY002_FLY002.py.snap | 28 +- ...kage_first_and_third_party_imports.py.snap | 4 +- ...kage_first_and_third_party_imports.py.snap | 4 +- ...tests__add_newline_before_comments.py.snap | 4 +- ..._isort__tests__as_imports_comments.py.snap | 4 +- ..._rules__isort__tests__bom_unsorted.py.snap | 4 +- ...sts__case_sensitive_case_sensitive.py.snap | 4 +- ...to_furthest_relative_imports_order.py.snap | 4 +- ...__isort__tests__combine_as_imports.py.snap | 4 +- ...bine_as_imports_combine_as_imports.py.snap | 4 +- ..._isort__tests__combine_import_from.py.snap | 4 +- ...ter__rules__isort__tests__comments.py.snap | 4 +- ..._isort__tests__deduplicate_imports.py.snap | 4 +- ...es__isort__tests__detect_same_package.snap | 4 +- ...les__isort__tests__fit_line_length.py.snap | 4 +- ...rt__tests__fit_line_length_comment.py.snap | 4 +- ...orce_single_line_force_single_line.py.snap | 4 +- ..._tests__force_sort_within_sections.py.snap | 4 +- ...ections_force_sort_within_sections.py.snap | 4 +- ..._force_sort_within_sections_future.py.snap | 4 +- ...sort_within_sections_with_as_names.py.snap | 4 +- ..._rules__isort__tests__force_to_top.py.snap | 4 +- ...__tests__force_to_top_force_to_top.py.snap | 4 +- ...__isort__tests__force_wrap_aliases.py.snap | 4 +- ...ce_wrap_aliases_force_wrap_aliases.py.snap | 4 +- ...les__isort__tests__forced_separate.py.snap | 4 +- ...__rules__isort__tests__future_from.py.snap | 4 +- ...kage_first_and_third_party_imports.py.snap | 4 +- ..._rules__isort__tests__if_elif_else.py.snap | 4 +- ...t__tests__import_from_after_import.py.snap | 4 +- ...les__isort__tests__inline_comments.py.snap | 4 +- ...__isort__tests__insert_empty_lines.py.snap | 16 +- ..._isort__tests__insert_empty_lines.pyi.snap | 12 +- ...sest_separate_local_folder_imports.py.snap | 4 +- ...lder_separate_local_folder_imports.py.snap | 4 +- ...gth_sort__length_sort_from_imports.py.snap | 4 +- ...ort__length_sort_non_ascii_members.py.snap | 4 +- ...ort__length_sort_non_ascii_modules.py.snap | 4 +- ...gth_sort_straight_and_from_imports.py.snap | 4 +- ...sort__length_sort_straight_imports.py.snap | 4 +- ..._length_sort_with_relative_imports.py.snap | 4 +- ...straight__length_sort_from_imports.py.snap | 4 +- ...gth_sort_straight_and_from_imports.py.snap | 4 +- ...ight__length_sort_straight_imports.py.snap | 4 +- ...es__isort__tests__line_ending_crlf.py.snap | 4 +- ...ules__isort__tests__line_ending_lf.py.snap | 4 +- ...isort__tests__lines_after_imports.pyi.snap | 4 +- ...s__lines_after_imports_class_after.py.snap | 4 +- ...ts__lines_after_imports_func_after.py.snap | 4 +- ...after_imports_lines_after_imports.pyi.snap | 4 +- ...ts_lines_after_imports_class_after.py.snap | 4 +- ...rts_lines_after_imports_func_after.py.snap | 4 +- ..._lines_after_imports_nothing_after.py.snap | 4 +- ...s_between_typeslines_between_types.py.snap | 4 +- ...isort__tests__magic_trailing_comma.py.snap | 4 +- ...r__rules__isort__tests__match_case.py.snap | 8 +- ...rules__isort__tests__natural_order.py.snap | 4 +- ..._isort__tests__no_detect_same_package.snap | 4 +- ...les__isort__tests__no_lines_before.py.snap | 4 +- ...no_lines_before.py_no_lines_before.py.snap | 4 +- ...o_lines_before_with_empty_sections.py.snap | 4 +- ...andard_library_no_standard_library.py.snap | 4 +- ..._rules__isort__tests__no_wrap_star.py.snap | 4 +- ...rules__isort__tests__order_by_type.py.snap | 4 +- ..._order_by_type_false_order_by_type.py.snap | 4 +- ..._order_by_type_with_custom_classes.py.snap | 4 +- ..._order_by_type_with_custom_classes.py.snap | 4 +- ...rder_by_type_with_custom_constants.py.snap | 4 +- ...rder_by_type_with_custom_constants.py.snap | 4 +- ...rder_by_type_with_custom_variables.py.snap | 4 +- ...rder_by_type_with_custom_variables.py.snap | 4 +- ...s__order_relative_imports_by_level.py.snap | 4 +- ...ort__tests__preserve_comment_order.py.snap | 4 +- ...isort__tests__preserve_import_star.py.snap | 4 +- ...isort__tests__preserve_indentation.py.snap | 8 +- ...comments_propagate_inline_comments.py.snap | 4 +- ...ort__tests__reorder_within_section.py.snap | 4 +- ...rt__tests__required_import_comment.py.snap | 4 +- ...uired_import_comments_and_newlines.py.snap | 4 +- ...__tests__required_import_docstring.py.snap | 4 +- ...import_docstring_with_continuation.py.snap | 4 +- ...ed_import_docstring_with_semicolon.py.snap | 4 +- ...s__required_import_existing_import.py.snap | 4 +- ...equired_import_multiline_docstring.py.snap | 4 +- ..._isort__tests__required_import_off.py.snap | 4 +- ...required_import_with_alias_comment.py.snap | 4 +- ...t_with_alias_comments_and_newlines.py.snap | 4 +- ...quired_import_with_alias_docstring.py.snap | 4 +- ..._alias_docstring_with_continuation.py.snap | 4 +- ...ith_alias_docstring_with_semicolon.py.snap | 4 +- ..._import_with_alias_existing_import.py.snap | 4 +- ...ort_with_alias_multiline_docstring.py.snap | 4 +- ...ts__required_import_with_alias_off.py.snap | 4 +- ..._tests__required_imports_docstring.py.snap | 8 +- ...ort__tests__section_order_sections.py.snap | 4 +- ...__tests__sections_main_first_party.py.snap | 4 +- ...s__isort__tests__sections_sections.py.snap | 4 +- ...ests__separate_first_party_imports.py.snap | 4 +- ...rt__tests__separate_future_imports.py.snap | 4 +- ...sts__separate_local_folder_imports.py.snap | 4 +- ...ests__separate_third_party_imports.py.snap | 4 +- ..._linter__rules__isort__tests__skip.py.snap | 12 +- ...isort__tests__sort_similar_imports.py.snap | 4 +- ...linter__rules__isort__tests__split.py.snap | 12 +- ...railing_comma_magic_trailing_comma.py.snap | 4 +- ...__isort__tests__star_before_others.py.snap | 4 +- ...straight_required_import_docstring.py.snap | 4 +- ...traight_required_import_docstring.pyi.snap | 4 +- ...es__isort__tests__trailing_comment.py.snap | 20 +- ...er__rules__isort__tests__two_space.py.snap | 4 +- ...nter__rules__isort__tests__unicode.py.snap | 4 +- ...__numpy-deprecated-function_NPY003.py.snap | 40 ++- ...numpy-deprecated-type-alias_NPY001.py.snap | 32 ++- ...__tests__numpy2-deprecation_NPY201.py.snap | 80 ++++-- ...tests__numpy2-deprecation_NPY201_2.py.snap | 84 ++++-- ...tests__numpy2-deprecation_NPY201_3.py.snap | 28 +- ...es__pandas_vet__tests__PD002_PD002.py.snap | 28 +- ..._rules__pandas_vet__tests__PD002_fail.snap | 4 +- ...les__pep8_naming__tests__N804_N804.py.snap | 20 +- ...les__pep8_naming__tests__N805_N805.py.snap | 48 +++- ...naming__tests__classmethod_decorators.snap | 36 ++- ...ing__tests__ignore_names_N804_N804.py.snap | 20 +- ...ing__tests__ignore_names_N805_N805.py.snap | 32 ++- ...aming__tests__staticmethod_decorators.snap | 44 +++- ...__perflint__tests__PERF101_PERF101.py.snap | 44 +++- ...__perflint__tests__PERF102_PERF102.py.snap | 48 +++- ...ules__pycodestyle__tests__E201_E20.py.snap | 36 ++- ...ules__pycodestyle__tests__E202_E20.py.snap | 32 ++- ...ules__pycodestyle__tests__E203_E20.py.snap | 68 +++-- ...les__pycodestyle__tests__E204_E204.py.snap | 12 +- ...ules__pycodestyle__tests__E211_E21.py.snap | 28 +- ...ules__pycodestyle__tests__E221_E22.py.snap | 32 ++- ...ules__pycodestyle__tests__E222_E22.py.snap | 20 +- ...ules__pycodestyle__tests__E223_E22.py.snap | 4 +- ...ules__pycodestyle__tests__E224_E22.py.snap | 4 +- ...ules__pycodestyle__tests__E225_E22.py.snap | 48 +++- ...ules__pycodestyle__tests__E226_E22.py.snap | 104 ++++++-- ...ules__pycodestyle__tests__E227_E22.py.snap | 32 ++- ...ules__pycodestyle__tests__E228_E22.py.snap | 12 +- ...ules__pycodestyle__tests__E231_E23.py.snap | 92 +++++-- ...ules__pycodestyle__tests__E241_E24.py.snap | 16 +- ...ules__pycodestyle__tests__E242_E24.py.snap | 4 +- ...ules__pycodestyle__tests__E251_E25.py.snap | 44 +++- ...ules__pycodestyle__tests__E252_E25.py.snap | 16 +- ...ules__pycodestyle__tests__E261_E26.py.snap | 4 +- ...ules__pycodestyle__tests__E262_E26.py.snap | 28 +- ...ules__pycodestyle__tests__E265_E26.py.snap | 24 +- ...ules__pycodestyle__tests__E266_E26.py.snap | 20 +- ...ules__pycodestyle__tests__E271_E27.py.snap | 40 ++- ...ules__pycodestyle__tests__E272_E27.py.snap | 12 +- ...ules__pycodestyle__tests__E273_E27.py.snap | 24 +- ...ules__pycodestyle__tests__E274_E27.py.snap | 8 +- ...ules__pycodestyle__tests__E275_E27.py.snap | 28 +- ...ules__pycodestyle__tests__E301_E30.py.snap | 20 +- ...ules__pycodestyle__tests__E302_E30.py.snap | 44 +++- ...ts__E302_E302_first_line_docstring.py.snap | 4 +- ...s__E302_E302_first_line_expression.py.snap | 4 +- ...sts__E302_E302_first_line_function.py.snap | 4 +- ...ts__E302_E302_first_line_statement.py.snap | 4 +- ...ules__pycodestyle__tests__E303_E30.py.snap | 58 ++-- ...ests__E303_E303_first_line_comment.py.snap | 4 +- ...ts__E303_E303_first_line_docstring.py.snap | 4 +- ...s__E303_E303_first_line_expression.py.snap | 4 +- ...ts__E303_E303_first_line_statement.py.snap | 4 +- ...ules__pycodestyle__tests__E304_E30.py.snap | 12 +- ...ules__pycodestyle__tests__E305_E30.py.snap | 20 +- ...ules__pycodestyle__tests__E306_E30.py.snap | 44 +++- ...ules__pycodestyle__tests__E401_E40.py.snap | 36 ++- ...ules__pycodestyle__tests__E703_E70.py.snap | 20 +- ...__pycodestyle__tests__E703_E703.ipynb.snap | 8 +- ...les__pycodestyle__tests__E711_E711.py.snap | 40 ++- ...les__pycodestyle__tests__E712_E712.py.snap | 52 +++- ...les__pycodestyle__tests__E713_E713.py.snap | 24 +- ...les__pycodestyle__tests__E714_E714.py.snap | 12 +- ...les__pycodestyle__tests__E731_E731.py.snap | 72 +++-- ...ules__pycodestyle__tests__W291_W29.py.snap | 12 +- ...les__pycodestyle__tests__W291_W291.py.snap | 16 +- ...s__pycodestyle__tests__W292_W292_0.py.snap | 4 +- ...ules__pycodestyle__tests__W293_W29.py.snap | 4 +- ...les__pycodestyle__tests__W293_W293.py.snap | 16 +- ...s__pycodestyle__tests__W605_W605_0.py.snap | 44 +++- ...s__pycodestyle__tests__W605_W605_1.py.snap | 56 +++- ...yle__tests__blank_lines_E301_notebook.snap | 4 +- ...yle__tests__blank_lines_E302_notebook.snap | 4 +- ...yle__tests__blank_lines_E303_notebook.snap | 8 +- ...__tests__blank_lines_E303_typing_stub.snap | 16 +- ...yle__tests__blank_lines_E304_notebook.snap | 4 +- ...__tests__blank_lines_E304_typing_stub.snap | 6 +- ...yle__tests__blank_lines_E305_notebook.snap | 4 +- ...yle__tests__blank_lines_E306_notebook.snap | 4 +- ...patibility-lines-after(-1)-between(0).snap | 28 +- ...mpatibility-lines-after(0)-between(0).snap | 24 +- ...mpatibility-lines-after(1)-between(1).snap | 22 +- ...mpatibility-lines-after(4)-between(4).snap | 32 ++- ..._tests__blank_lines_typing_stub_isort.snap | 60 +++-- ...pycodestyle__tests__constant_literals.snap | 108 ++++++-- ...destyle__tests__preview__E502_E502.py.snap | 56 +++- ...style__tests__preview__W391_W391_0.py.snap | 4 +- ...style__tests__preview__W391_W391_2.py.snap | 4 +- ...r__rules__pycodestyle__tests__shebang.snap | 4 +- ...patibility-lines-after(-1)-between(0).snap | 28 +- ...mpatibility-lines-after(0)-between(0).snap | 36 ++- ...mpatibility-lines-after(1)-between(1).snap | 28 +- ...mpatibility-lines-after(4)-between(4).snap | 20 +- ...er__rules__pycodestyle__tests__w292_4.snap | 4 +- ...__rules__pydocstyle__tests__D200_D.py.snap | 14 +- ...ules__pydocstyle__tests__D200_D200.py.snap | 6 +- ...__rules__pydocstyle__tests__D201_D.py.snap | 16 +- ...__rules__pydocstyle__tests__D202_D.py.snap | 16 +- ...ules__pydocstyle__tests__D202_D202.py.snap | 12 +- ...__rules__pydocstyle__tests__D203_D.py.snap | 24 +- ...__rules__pydocstyle__tests__D204_D.py.snap | 20 +- ...__rules__pydocstyle__tests__D205_D.py.snap | 4 +- ...__rules__pydocstyle__tests__D207_D.py.snap | 16 +- ...__rules__pydocstyle__tests__D208_D.py.snap | 84 ++++-- ...ules__pydocstyle__tests__D208_D208.py.snap | 16 +- ...__rules__pydocstyle__tests__D209_D.py.snap | 8 +- ...__rules__pydocstyle__tests__D210_D.py.snap | 14 +- ...__rules__pydocstyle__tests__D211_D.py.snap | 8 +- ...__rules__pydocstyle__tests__D212_D.py.snap | 12 +- ...__rules__pydocstyle__tests__D213_D.py.snap | 112 ++++++-- ...ydocstyle__tests__D214_D214_module.py.snap | 8 +- ...__pydocstyle__tests__D214_sections.py.snap | 10 +- ...ules__pydocstyle__tests__D215_D215.py.snap | 4 +- ...__pydocstyle__tests__D215_sections.py.snap | 10 +- ...__rules__pydocstyle__tests__D300_D.py.snap | 40 ++- ...ules__pydocstyle__tests__D300_D300.py.snap | 4 +- ...__rules__pydocstyle__tests__D301_D.py.snap | 4 +- ...ules__pydocstyle__tests__D301_D301.py.snap | 12 +- ...__rules__pydocstyle__tests__D400_D.py.snap | 68 +++-- ...ules__pydocstyle__tests__D400_D400.py.snap | 52 +++- ...ules__pydocstyle__tests__D403_D403.py.snap | 12 +- ...__pydocstyle__tests__D405_sections.py.snap | 8 +- ...__pydocstyle__tests__D406_sections.py.snap | 12 +- ...__pydocstyle__tests__D407_sections.py.snap | 92 +++++-- ...__pydocstyle__tests__D408_sections.py.snap | 6 +- ...__pydocstyle__tests__D409_sections.py.snap | 12 +- ...ules__pydocstyle__tests__D410_D410.py.snap | 8 +- ...__pydocstyle__tests__D410_sections.py.snap | 10 +- ...__pydocstyle__tests__D411_sections.py.snap | 14 +- ...__pydocstyle__tests__D412_sections.py.snap | 6 +- ...es__pydocstyle__tests__D412_sphinx.py.snap | 16 +- ...ules__pydocstyle__tests__D413_D413.py.snap | 16 +- ...__pydocstyle__tests__D413_sections.py.snap | 34 ++- ...__rules__pydocstyle__tests__D415_D.py.snap | 64 +++-- ...linter__rules__pydocstyle__tests__bom.snap | 4 +- ...__rules__pydocstyle__tests__d209_d400.snap | 8 +- ...ules__pyflakes__tests__F401_F401_0.py.snap | 60 +++-- ...les__pyflakes__tests__F401_F401_11.py.snap | 4 +- ...les__pyflakes__tests__F401_F401_15.py.snap | 4 +- ...les__pyflakes__tests__F401_F401_17.py.snap | 8 +- ...les__pyflakes__tests__F401_F401_18.py.snap | 4 +- ...les__pyflakes__tests__F401_F401_23.py.snap | 4 +- ...ules__pyflakes__tests__F401_F401_5.py.snap | 16 +- ...ules__pyflakes__tests__F401_F401_6.py.snap | 16 +- ...ules__pyflakes__tests__F401_F401_7.py.snap | 12 +- ...ules__pyflakes__tests__F401_F401_9.py.snap | 4 +- ...eprecated_option_F401_24____init__.py.snap | 12 +- ...on_F401_25__all_nonempty____init__.py.snap | 12 +- ...ption_F401_26__all_empty____init__.py.snap | 8 +- ...on_F401_27__all_mistyped____init__.py.snap | 8 +- ...on_F401_28__all_multiple____init__.py.snap | 8 +- ...F401_29__all_conditional____init__.py.snap | 8 +- ..._rules__pyflakes__tests__F504_F504.py.snap | 20 +- ..._rules__pyflakes__tests__F504_F50x.py.snap | 4 +- ..._rules__pyflakes__tests__F522_F522.py.snap | 16 +- ..._rules__pyflakes__tests__F523_F523.py.snap | 40 ++- ..._rules__pyflakes__tests__F541_F541.py.snap | 80 ++++-- ..._rules__pyflakes__tests__F601_F601.py.snap | 32 ++- ..._rules__pyflakes__tests__F602_F602.py.snap | 24 +- ..._rules__pyflakes__tests__F632_F632.py.snap | 48 +++- ...les__pyflakes__tests__F811_F811_17.py.snap | 6 +- ...les__pyflakes__tests__F811_F811_21.py.snap | 4 +- ...ules__pyflakes__tests__F811_F811_6.py.snap | 4 +- ...ules__pyflakes__tests__F811_F811_8.py.snap | 4 +- ...ules__pyflakes__tests__F841_F841_0.py.snap | 46 +++- ...ules__pyflakes__tests__F841_F841_1.py.snap | 32 ++- ...ules__pyflakes__tests__F841_F841_3.py.snap | 136 +++++++--- ...ules__pyflakes__tests__F841_F841_4.py.snap | 4 +- ..._rules__pyflakes__tests__F901_F901.py.snap | 12 +- ...hadowed_global_import_in_global_scope.snap | 4 +- ...shadowed_global_import_in_local_scope.snap | 8 +- ...shadowed_import_shadow_in_local_scope.snap | 6 +- ..._shadowed_local_import_in_local_scope.snap | 4 +- ...lakes__tests__f841_dummy_variable_rgx.snap | 48 +++- ...__pyflakes__tests__future_annotations.snap | 6 +- ...er_multiple_unbinds_from_module_scope.snap | 8 +- ...s__load_after_unbind_from_class_scope.snap | 6 +- ...__load_after_unbind_from_module_scope.snap | 4 +- ...after_unbind_from_nested_module_scope.snap | 8 +- ...yflakes__tests__multi_statement_lines.snap | 64 +++-- ...s__preview__F401_F401_24____init__.py.snap | 8 +- ...01_F401_25__all_nonempty____init__.py.snap | 12 +- ..._F401_F401_26__all_empty____init__.py.snap | 8 +- ...01_F401_28__all_multiple____init__.py.snap | 8 +- ...kes__tests__preview__F401___init__.py.snap | 6 +- ...lakes__tests__preview__F841_F841_4.py.snap | 12 +- ...in_body_after_double_shadowing_except.snap | 8 +- ..._print_in_body_after_shadowing_except.snap | 4 +- ...grep_hooks__tests__PGH004_PGH004_0.py.snap | 20 +- ..._tests__PLC0208_iteration_over_set.py.snap | 32 ++- ...nt__tests__PLC0414_import_aliasing.py.snap | 32 ++- ...s__PLC2801_unnecessary_dunder_call.py.snap | 202 ++++++++++---- ...nt__tests__PLE0241_duplicate_bases.py.snap | 32 ++- ...s__PLE1141_dict_iter_missing_items.py.snap | 8 +- ...sts__PLE1519_singledispatch_method.py.snap | 12 +- ...1520_singledispatchmethod_function.py.snap | 6 +- ..._tests__PLE2510_invalid_characters.py.snap | 12 +- ..._tests__PLE2512_invalid_characters.py.snap | 16 +- ..._tests__PLE2513_invalid_characters.py.snap | 16 +- ..._tests__PLE2514_invalid_characters.py.snap | Bin 809 -> 905 bytes ..._tests__PLE2515_invalid_characters.py.snap | 34 ++- ...ts__PLE4703_modified_iterating_set.py.snap | 26 +- ...tests__PLR0202_no_method_decorator.py.snap | 8 +- ...tests__PLR0203_no_method_decorator.py.snap | 10 +- ...nt__tests__PLR0402_import_aliasing.py.snap | 10 +- ...int__tests__PLR1711_useless_return.py.snap | 24 +- ...R1714_repeated_equality_comparison.py.snap | 72 +++-- ...t__tests__PLR1722_sys_exit_alias_0.py.snap | 16 +- ...t__tests__PLR1722_sys_exit_alias_1.py.snap | 18 +- ...__tests__PLR1722_sys_exit_alias_11.py.snap | 4 +- ...__tests__PLR1722_sys_exit_alias_12.py.snap | 4 +- ...t__tests__PLR1722_sys_exit_alias_2.py.snap | 16 +- ...t__tests__PLR1722_sys_exit_alias_3.py.snap | 10 +- ...t__tests__PLR1722_sys_exit_alias_4.py.snap | 16 +- ...t__tests__PLR1722_sys_exit_alias_5.py.snap | 16 +- ...t__tests__PLR1722_sys_exit_alias_6.py.snap | 8 +- ...t__tests__PLR1722_sys_exit_alias_7.py.snap | 4 +- ...t__tests__PLR1722_sys_exit_alias_8.py.snap | 4 +- ...t__tests__PLR1722_sys_exit_alias_9.py.snap | 4 +- ...nt__tests__PLR1730_if_stmt_min_max.py.snap | 84 ++++-- ...1733_unnecessary_dict_index_lookup.py.snap | 24 +- ...1736_unnecessary_list_index_lookup.py.snap | 36 ++- ...lint__tests__PLR2044_empty_comment.py.snap | 28 +- ...tests__PLR5501_collapsible_else_if.py.snap | 28 +- ...__PLR6104_non_augmented_assignment.py.snap | 104 ++++++-- ..._tests__PLR6201_literal_membership.py.snap | 16 +- ..._tests__PLW0108_unnecessary_lambda.py.snap | 32 ++- ...ests__PLW0120_useless_else_on_loop.py.snap | 32 ++- ...LW0133_useless_exception_statement.py.snap | 44 +++- ...ts__PLW0245_super_without_brackets.py.snap | 4 +- ...W1510_subprocess_run_without_check.py.snap | 16 +- ...ests__PLW1514_unspecified_encoding.py.snap | 84 ++++-- ...int__tests__PLW3301_nested_min_max.py.snap | 60 +++-- ...er__rules__pyupgrade__tests__UP001.py.snap | 8 +- ...er__rules__pyupgrade__tests__UP003.py.snap | 24 +- ...er__rules__pyupgrade__tests__UP004.py.snap | 96 +++++-- ...er__rules__pyupgrade__tests__UP005.py.snap | 16 +- ...__rules__pyupgrade__tests__UP006_0.py.snap | 52 +++- ...__rules__pyupgrade__tests__UP006_1.py.snap | 4 +- ...__rules__pyupgrade__tests__UP006_3.py.snap | 4 +- ...er__rules__pyupgrade__tests__UP007.py.snap | 72 +++-- ...__rules__pyupgrade__tests__UP009_0.py.snap | 4 +- ...__rules__pyupgrade__tests__UP009_1.py.snap | 4 +- ...__rules__pyupgrade__tests__UP009_6.py.snap | 4 +- ...__rules__pyupgrade__tests__UP009_7.py.snap | 4 +- ...er__rules__pyupgrade__tests__UP010.py.snap | 40 ++- ...er__rules__pyupgrade__tests__UP011.py.snap | 16 +- ...er__rules__pyupgrade__tests__UP012.py.snap | 108 ++++++-- ...er__rules__pyupgrade__tests__UP013.py.snap | 48 +++- ...er__rules__pyupgrade__tests__UP014.py.snap | 20 +- ...er__rules__pyupgrade__tests__UP015.py.snap | 176 +++++++++---- ...__rules__pyupgrade__tests__UP015_1.py.snap | 6 +- ...er__rules__pyupgrade__tests__UP018.py.snap | 76 ++++-- ...er__rules__pyupgrade__tests__UP019.py.snap | 16 +- ...er__rules__pyupgrade__tests__UP020.py.snap | 8 +- ...er__rules__pyupgrade__tests__UP021.py.snap | 12 +- ...er__rules__pyupgrade__tests__UP022.py.snap | 30 ++- ...er__rules__pyupgrade__tests__UP023.py.snap | 40 ++- ...__rules__pyupgrade__tests__UP024_0.py.snap | 60 +++-- ...__rules__pyupgrade__tests__UP024_1.py.snap | 12 +- ...__rules__pyupgrade__tests__UP024_2.py.snap | 80 ++++-- ...__rules__pyupgrade__tests__UP024_4.py.snap | 4 +- ...er__rules__pyupgrade__tests__UP025.py.snap | 60 +++-- ...er__rules__pyupgrade__tests__UP026.py.snap | 104 ++++++-- ...er__rules__pyupgrade__tests__UP027.py.snap | 20 +- ...__rules__pyupgrade__tests__UP028_0.py.snap | 52 +++- ...er__rules__pyupgrade__tests__UP029.py.snap | 16 +- ...__rules__pyupgrade__tests__UP030_0.py.snap | 92 +++++-- ...__rules__pyupgrade__tests__UP032_0.py.snap | 248 +++++++++++++----- ...__rules__pyupgrade__tests__UP032_1.py.snap | 4 +- ...__rules__pyupgrade__tests__UP032_2.py.snap | 88 +++++-- ...__rules__pyupgrade__tests__UP033_0.py.snap | 12 +- ...__rules__pyupgrade__tests__UP033_1.py.snap | 12 +- ...er__rules__pyupgrade__tests__UP034.py.snap | 40 ++- ...er__rules__pyupgrade__tests__UP035.py.snap | 216 +++++++++++---- ...__rules__pyupgrade__tests__UP036_0.py.snap | 132 +++++++--- ...__rules__pyupgrade__tests__UP036_1.py.snap | 52 +++- ...__rules__pyupgrade__tests__UP036_2.py.snap | 48 +++- ...__rules__pyupgrade__tests__UP036_3.py.snap | 12 +- ...__rules__pyupgrade__tests__UP036_4.py.snap | 32 ++- ...__rules__pyupgrade__tests__UP036_5.py.snap | 8 +- ...__rules__pyupgrade__tests__UP037_0.py.snap | 114 ++++++-- ...__rules__pyupgrade__tests__UP037_1.py.snap | 6 +- ...er__rules__pyupgrade__tests__UP038.py.snap | 8 +- ...er__rules__pyupgrade__tests__UP039.py.snap | 20 +- ...er__rules__pyupgrade__tests__UP040.py.snap | 68 +++-- ...r__rules__pyupgrade__tests__UP040.pyi.snap | 8 +- ...er__rules__pyupgrade__tests__UP041.py.snap | 28 +- ...er__rules__pyupgrade__tests__UP042.py.snap | 8 +- ...er__rules__pyupgrade__tests__UP043.py.snap | 18 +- ...timeout_error_alias_not_applied_py310.snap | 16 +- ...rade__tests__datetime_utc_alias_py311.snap | 16 +- ..._annotations_keep_runtime_typing_p310.snap | 16 +- ...tests__future_annotations_pep_585_p37.snap | 4 +- ...sts__future_annotations_pep_585_py310.snap | 16 +- ...tests__future_annotations_pep_604_p37.snap | 4 +- ...sts__future_annotations_pep_604_py310.snap | 8 +- ...es__refurb__tests__FURB105_FURB105.py.snap | 68 +++-- ...es__refurb__tests__FURB110_FURB110.py.snap | 32 ++- ...es__refurb__tests__FURB113_FURB113.py.snap | 50 +++- ...es__refurb__tests__FURB116_FURB116.py.snap | 24 +- ...es__refurb__tests__FURB118_FURB118.py.snap | 128 ++++++--- ...es__refurb__tests__FURB129_FURB129.py.snap | 50 +++- ...es__refurb__tests__FURB131_FURB131.py.snap | 34 ++- ...es__refurb__tests__FURB132_FURB132.py.snap | 16 +- ...es__refurb__tests__FURB136_FURB136.py.snap | 36 ++- ...es__refurb__tests__FURB140_FURB140.py.snap | 36 ++- ...es__refurb__tests__FURB142_FURB142.py.snap | 38 ++- ...es__refurb__tests__FURB145_FURB145.py.snap | 24 +- ...es__refurb__tests__FURB148_FURB148.py.snap | 80 ++++-- ...es__refurb__tests__FURB152_FURB152.py.snap | 60 +++-- ...es__refurb__tests__FURB154_FURB154.py.snap | 48 +++- ...es__refurb__tests__FURB157_FURB157.py.snap | 32 ++- ...es__refurb__tests__FURB161_FURB161.py.snap | 36 ++- ...es__refurb__tests__FURB163_FURB163.py.snap | 32 ++- ...es__refurb__tests__FURB164_FURB164.py.snap | 68 +++-- ...es__refurb__tests__FURB166_FURB166.py.snap | 30 ++- ...es__refurb__tests__FURB167_FURB167.py.snap | 8 +- ...es__refurb__tests__FURB168_FURB168.py.snap | 32 ++- ...es__refurb__tests__FURB169_FURB169.py.snap | 48 +++- ...es__refurb__tests__FURB171_FURB171.py.snap | 24 +- ...es__refurb__tests__FURB180_FURB180.py.snap | 16 +- ...es__refurb__tests__FURB181_FURB181.py.snap | 60 +++-- ...es__refurb__tests__FURB187_FURB187.py.snap | 12 +- ...es__refurb__tests__FURB192_FURB192.py.snap | 38 ++- ..._ruff__tests__PY39_RUF013_RUF013_0.py.snap | 78 ++++-- ..._ruff__tests__PY39_RUF013_RUF013_1.py.snap | 4 +- ..._rules__ruff__tests__RUF005_RUF005.py.snap | 60 +++-- ..._rules__ruff__tests__RUF010_RUF010.py.snap | 48 +++- ...ules__ruff__tests__RUF013_RUF013_0.py.snap | 78 ++++-- ...ules__ruff__tests__RUF013_RUF013_1.py.snap | 4 +- ...ules__ruff__tests__RUF013_RUF013_3.py.snap | 12 +- ..._rules__ruff__tests__RUF015_RUF015.py.snap | 92 +++++-- ...ules__ruff__tests__RUF017_RUF017_0.py.snap | 28 +- ...ules__ruff__tests__RUF017_RUF017_1.py.snap | 4 +- ..._rules__ruff__tests__RUF019_RUF019.py.snap | 24 +- ..._rules__ruff__tests__RUF020_RUF020.py.snap | 28 +- ..._rules__ruff__tests__RUF021_RUF021.py.snap | 48 +++- ..._rules__ruff__tests__RUF022_RUF022.py.snap | 128 ++++++--- ..._rules__ruff__tests__RUF023_RUF023.py.snap | 80 ++++-- ..._rules__ruff__tests__RUF024_RUF024.py.snap | 28 +- ..._rules__ruff__tests__RUF025_RUF025.py.snap | 44 +++- ..._rules__ruff__tests__RUF026_RUF026.py.snap | 56 ++-- ...ules__ruff__tests__RUF027_RUF027_0.py.snap | 64 +++-- ..._rules__ruff__tests__RUF028_RUF028.py.snap | 44 +++- ..._rules__ruff__tests__RUF030_RUF030.py.snap | 76 ++++-- ..._rules__ruff__tests__RUF101_RUF101.py.snap | 28 +- ...ruff_linter__rules__ruff__tests__noqa.snap | 4 +- ..._linter__rules__ruff__tests__ruf100_0.snap | 92 +++++-- ...__rules__ruff__tests__ruf100_0_prefix.snap | 88 +++++-- ..._linter__rules__ruff__tests__ruf100_1.snap | 32 ++- ..._linter__rules__ruff__tests__ruf100_2.snap | 4 +- ..._linter__rules__ruff__tests__ruf100_3.snap | 84 ++++-- ..._linter__rules__ruff__tests__ruf100_5.snap | 12 +- ...__rules__ruff__tests__ruff_noqa_codes.snap | 4 +- ...rules__ruff__tests__ruff_noqa_invalid.snap | 8 +- ..._error-instead-of-exception_TRY400.py.snap | 44 +++- ...atops__tests__verbose-raise_TRY201.py.snap | 12 +- ...linter__linter__tests__import_sorting.snap | 16 +- ...er__linter__tests__ipy_escape_command.snap | 8 +- ...inter__linter__tests__unused_variable.snap | 16 +- 739 files changed, 13797 insertions(+), 5202 deletions(-) diff --git a/crates/ruff/src/lib.rs b/crates/ruff/src/lib.rs index 8ba057cefc2bd..c8a056a6dc7ea 100644 --- a/crates/ruff/src/lib.rs +++ b/crates/ruff/src/lib.rs @@ -287,6 +287,9 @@ pub fn check(args: CheckCommand, global_options: GlobalConfigArgs) -> Result Result<()> { | = help: Remove unused import: `os` + Suggested fix: + 1 |-import os + + Run `ruff check --fix` to apply this fix. + Found 1 error. [*] 1 fixable with the `--fix` option. @@ -1523,7 +1581,17 @@ fn check_hints_hidden_unsafe_fixes() { exit_code: 1 ----- stdout ----- -:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-safe-fix + + Run `ruff check --fix` to apply this fix. + -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-unsafe-fix + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + Found 2 errors. [*] 1 fixable with the `--fix` option (1 hidden fix can be enabled with the `--unsafe-fixes` option). @@ -1541,6 +1609,12 @@ fn check_hints_hidden_unsafe_fixes_with_no_safe_fixes() { exit_code: 1 ----- stdout ----- -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-unsafe-fix + 1 2 | x = {'a': 1, 'a': 1} + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + Found 1 error. No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option). @@ -1559,7 +1633,17 @@ fn check_no_hint_for_hidden_unsafe_fixes_when_disabled() { exit_code: 1 ----- stdout ----- -:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-safe-fix + + Run `ruff check --fix` to apply this fix. + -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-unsafe-fix + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + Found 2 errors. [*] 1 fixable with the --fix option. @@ -1579,6 +1663,12 @@ fn check_no_hint_for_hidden_unsafe_fixes_with_no_safe_fixes_when_disabled() { exit_code: 1 ----- stdout ----- -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-unsafe-fix + 1 2 | x = {'a': 1, 'a': 1} + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + Found 1 error. ----- stderr ----- @@ -1596,7 +1686,17 @@ fn check_shows_unsafe_fixes_with_opt_in() { exit_code: 1 ----- stdout ----- -:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-safe-fix + + Run `ruff check --fix` to apply this fix. + -:1:1: RUF902 [*] Hey this is a stable test rule with an unsafe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-unsafe-fix + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + Found 2 errors. [*] 2 fixable with the --fix option. @@ -1618,6 +1718,12 @@ fn fix_applies_safe_fixes_by_default() { ----- stderr ----- -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-unsafe-fix + 1 2 | # fix from stable-test-rule-safe-fix + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + Found 2 errors (1 fixed, 1 remaining). No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option). "###); @@ -1655,6 +1761,12 @@ fn fix_does_not_apply_display_only_fixes() { def add_to_list(item, some_list=[]): ... ----- stderr ----- -:1:1: RUF903 Hey this is a stable test rule with a display only fix. + Suggested fix: + 1 |+# fix from stable-test-rule-display-only-fix + 1 2 | def add_to_list(item, some_list=[]): ... + + Ruff cannot safely apply this fix. + Found 1 error. "###); } @@ -1673,6 +1785,12 @@ fn fix_does_not_apply_display_only_fixes_with_unsafe_fixes_enabled() { def add_to_list(item, some_list=[]): ... ----- stderr ----- -:1:1: RUF903 Hey this is a stable test rule with a display only fix. + Suggested fix: + 1 |+# fix from stable-test-rule-display-only-fix + 1 2 | def add_to_list(item, some_list=[]): ... + + Ruff cannot safely apply this fix. + Found 1 error. "###); } @@ -1690,6 +1808,11 @@ fn fix_only_unsafe_fixes_available() { ----- stderr ----- -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-unsafe-fix + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + Found 1 error. No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option). "###); @@ -1826,7 +1949,17 @@ extend-unsafe-fixes = ["RUF901"] exit_code: 1 ----- stdout ----- -:1:1: RUF901 Hey this is a stable test rule with a safe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-safe-fix + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-unsafe-fix + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + Found 2 errors. No fixes available (2 hidden fixes can be enabled with the `--unsafe-fixes` option). @@ -1858,7 +1991,17 @@ extend-safe-fixes = ["RUF902"] exit_code: 1 ----- stdout ----- -:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-safe-fix + + Run `ruff check --fix` to apply this fix. + -:1:1: RUF902 [*] Hey this is a stable test rule with an unsafe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-unsafe-fix + + Run `ruff check --fix` to apply this fix. + Found 2 errors. [*] 2 fixable with the `--fix` option. @@ -1892,7 +2035,17 @@ extend-safe-fixes = ["RUF902"] exit_code: 1 ----- stdout ----- -:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-safe-fix + + Run `ruff check --fix` to apply this fix. + -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-unsafe-fix + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + Found 2 errors. [*] 1 fixable with the `--fix` option (1 hidden fix can be enabled with the `--unsafe-fixes` option). @@ -1929,8 +2082,32 @@ extend-safe-fixes = ["RUF9"] ----- stdout ----- -:1:1: RUF900 Hey this is a stable test rule. -:1:1: RUF901 Hey this is a stable test rule with a safe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-safe-fix + 1 2 | x = {'a': 1, 'a': 1} + 2 3 | print(('foo')) + 3 4 | print(str('foo')) + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + -:1:1: RUF902 [*] Hey this is a stable test rule with an unsafe fix. + Suggested fix: + 1 |+# fix from stable-test-rule-unsafe-fix + 1 2 | x = {'a': 1, 'a': 1} + 2 3 | print(('foo')) + 3 4 | print(str('foo')) + + Run `ruff check --fix` to apply this fix. + -:1:1: RUF903 Hey this is a stable test rule with a display only fix. + Suggested fix: + 1 |+# fix from stable-test-rule-display-only-fix + 1 2 | x = {'a': 1, 'a': 1} + 2 3 | print(('foo')) + 3 4 | print(str('foo')) + + Ruff cannot safely apply this fix. + -:1:1: RUF920 Hey this is a deprecated test rule. -:1:1: RUF921 Hey this is another deprecated test rule. -:1:1: RUF950 Hey this is a test rule that was redirected from another. @@ -2039,6 +2216,16 @@ select = ["RUF017"] | = help: Replace with `functools.reduce` + Suggested fix: + 1 |+import functools + 2 |+import operator + 1 3 | x = [1, 2, 3] + 2 4 | y = [4, 5, 6] + 3 |-sum([x, y], []) + 5 |+functools.reduce(operator.iadd, [x, y], []) + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + Found 1 error. No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option). diff --git a/crates/ruff_linter/src/message/diff.rs b/crates/ruff_linter/src/message/diff.rs index e3b3d99290c82..3f3e58aa76b1f 100644 --- a/crates/ruff_linter/src/message/diff.rs +++ b/crates/ruff_linter/src/message/diff.rs @@ -53,14 +53,6 @@ impl Display for Diff<'_> { let diff = TextDiff::from_lines(self.source_code.source_text(), &output); - let message = match self.fix.applicability() { - // TODO(zanieb): Adjust this messaging once it's user-facing - Applicability::Safe => "Safe fix", - Applicability::Unsafe => "Unsafe fix", - Applicability::DisplayOnly => "Display-only fix", - }; - writeln!(f, "ℹ {}", message.blue())?; - let (largest_old, largest_new) = diff .ops() .last() @@ -70,6 +62,8 @@ impl Display for Diff<'_> { let digit_with = calculate_print_width(OneIndexed::from_zero_indexed(largest_new.max(largest_old))); + writeln!(f, "{}", "Suggested fix:".blue())?; + for (idx, group) in diff.grouped_ops(3).iter().enumerate() { if idx > 0 { writeln!(f, "{:-^1$}", "-", 80)?; @@ -116,6 +110,15 @@ impl Display for Diff<'_> { } } + let action_message = match self.fix.applicability() { + Applicability::Safe => "Run `ruff check --fix` to apply this fix.", + Applicability::Unsafe => { + "Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix." + } + Applicability::DisplayOnly => "Ruff cannot safely apply this fix.", + }; + writeln!(f, "\n {action_message}")?; + Ok(()) } } diff --git a/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap b/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap index 7dc46d961fda6..fb4de78455d6b 100644 --- a/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap +++ b/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap @@ -10,12 +10,14 @@ ERA001.py:1:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 1 |-#import os 2 1 | # from foo import junk 3 2 | #a = 3 4 3 | a = 4 + Ruff cannot safely apply this fix. + ERA001.py:2:1: ERA001 Found commented-out code | 1 | #import os @@ -26,13 +28,15 @@ ERA001.py:2:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 1 1 | #import os 2 |-# from foo import junk 3 2 | #a = 3 4 3 | a = 4 5 4 | #foo(1, 2, 3) + Ruff cannot safely apply this fix. + ERA001.py:3:1: ERA001 Found commented-out code | 1 | #import os @@ -44,7 +48,7 @@ ERA001.py:3:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 1 1 | #import os 2 2 | # from foo import junk 3 |-#a = 3 @@ -52,6 +56,8 @@ ERA001.py:3:1: ERA001 Found commented-out code 5 4 | #foo(1, 2, 3) 6 5 | + Ruff cannot safely apply this fix. + ERA001.py:5:1: ERA001 Found commented-out code | 3 | #a = 3 @@ -63,7 +69,7 @@ ERA001.py:5:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 2 2 | # from foo import junk 3 3 | #a = 3 4 4 | a = 4 @@ -72,6 +78,8 @@ ERA001.py:5:1: ERA001 Found commented-out code 7 6 | def foo(x, y, z): 8 7 | content = 1 # print('hello') + Ruff cannot safely apply this fix. + ERA001.py:13:5: ERA001 Found commented-out code | 11 | # This is a real comment. @@ -82,7 +90,7 @@ ERA001.py:13:5: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 10 10 | 11 11 | # This is a real comment. 12 12 | # # This is a (nested) comment. @@ -91,6 +99,8 @@ ERA001.py:13:5: ERA001 Found commented-out code 15 14 | 16 15 | #import os # noqa: ERA001 + Ruff cannot safely apply this fix. + ERA001.py:21:5: ERA001 Found commented-out code | 19 | class A(): @@ -100,7 +110,7 @@ ERA001.py:21:5: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 18 18 | 19 19 | class A(): 20 20 | pass @@ -109,6 +119,8 @@ ERA001.py:21:5: ERA001 Found commented-out code 23 22 | 24 23 | dictionary = { + Ruff cannot safely apply this fix. + ERA001.py:26:5: ERA001 Found commented-out code | 24 | dictionary = { @@ -120,7 +132,7 @@ ERA001.py:26:5: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 23 23 | 24 24 | dictionary = { 25 25 | # "key1": 123, # noqa: ERA001 @@ -129,6 +141,8 @@ ERA001.py:26:5: ERA001 Found commented-out code 28 27 | } 29 28 | + Ruff cannot safely apply this fix. + ERA001.py:27:5: ERA001 Found commented-out code | 25 | # "key1": 123, # noqa: ERA001 @@ -139,7 +153,7 @@ ERA001.py:27:5: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 24 24 | dictionary = { 25 25 | # "key1": 123, # noqa: ERA001 26 26 | # "key2": 456, @@ -148,6 +162,8 @@ ERA001.py:27:5: ERA001 Found commented-out code 29 28 | 30 29 | #import os # noqa + Ruff cannot safely apply this fix. + ERA001.py:32:1: ERA001 Found commented-out code | 30 | #import os # noqa @@ -159,7 +175,7 @@ ERA001.py:32:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 29 29 | 30 30 | #import os # noqa 31 31 | @@ -168,6 +184,8 @@ ERA001.py:32:1: ERA001 Found commented-out code 34 33 | # try: # with comment 35 34 | # try: print() + Ruff cannot safely apply this fix. + ERA001.py:33:1: ERA001 Found commented-out code | 32 | # case 1: @@ -178,7 +196,7 @@ ERA001.py:33:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 30 30 | #import os # noqa 31 31 | 32 32 | # case 1: @@ -187,6 +205,8 @@ ERA001.py:33:1: ERA001 Found commented-out code 35 34 | # try: print() 36 35 | # except: + Ruff cannot safely apply this fix. + ERA001.py:34:1: ERA001 Found commented-out code | 32 | # case 1: @@ -198,7 +218,7 @@ ERA001.py:34:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 31 31 | 32 32 | # case 1: 33 33 | # try: @@ -207,6 +227,8 @@ ERA001.py:34:1: ERA001 Found commented-out code 36 35 | # except: 37 36 | # except Foo: + Ruff cannot safely apply this fix. + ERA001.py:35:1: ERA001 Found commented-out code | 33 | # try: @@ -218,7 +240,7 @@ ERA001.py:35:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 32 32 | # case 1: 33 33 | # try: 34 34 | # try: # with comment @@ -227,6 +249,8 @@ ERA001.py:35:1: ERA001 Found commented-out code 37 36 | # except Foo: 38 37 | # except Exception as e: print(e) + Ruff cannot safely apply this fix. + ERA001.py:36:1: ERA001 Found commented-out code | 34 | # try: # with comment @@ -238,7 +262,7 @@ ERA001.py:36:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 33 33 | # try: 34 34 | # try: # with comment 35 35 | # try: print() @@ -247,6 +271,8 @@ ERA001.py:36:1: ERA001 Found commented-out code 38 37 | # except Exception as e: print(e) 39 38 | + Ruff cannot safely apply this fix. + ERA001.py:37:1: ERA001 Found commented-out code | 35 | # try: print() @@ -257,7 +283,7 @@ ERA001.py:37:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 34 34 | # try: # with comment 35 35 | # try: print() 36 36 | # except: @@ -266,6 +292,8 @@ ERA001.py:37:1: ERA001 Found commented-out code 39 38 | 40 39 | + Ruff cannot safely apply this fix. + ERA001.py:38:1: ERA001 Found commented-out code | 36 | # except: @@ -275,7 +303,7 @@ ERA001.py:38:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 35 35 | # try: print() 36 36 | # except: 37 37 | # except Foo: @@ -284,6 +312,8 @@ ERA001.py:38:1: ERA001 Found commented-out code 40 39 | 41 40 | # Script tag without an opening tag (Error) + Ruff cannot safely apply this fix. + ERA001.py:44:1: ERA001 Found commented-out code | 43 | # requires-python = ">=3.11" @@ -294,7 +324,7 @@ ERA001.py:44:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 41 41 | # Script tag without an opening tag (Error) 42 42 | 43 43 | # requires-python = ">=3.11" @@ -303,6 +333,8 @@ ERA001.py:44:1: ERA001 Found commented-out code 46 45 | # "rich", 47 46 | # ] + Ruff cannot safely apply this fix. + ERA001.py:47:1: ERA001 Found commented-out code | 45 | # "requests<3", @@ -313,7 +345,7 @@ ERA001.py:47:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 44 44 | # dependencies = [ 45 45 | # "requests<3", 46 46 | # "rich", @@ -321,3 +353,5 @@ ERA001.py:47:1: ERA001 Found commented-out code 48 47 | # /// 49 48 | 50 49 | # Script tag (OK) + + Ruff cannot safely apply this fix. diff --git a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-non-annotated-dependency_FAST002.py.snap b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-non-annotated-dependency_FAST002.py.snap index 0651f5f7005c4..fb1bbd4eae746 100644 --- a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-non-annotated-dependency_FAST002.py.snap +++ b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-non-annotated-dependency_FAST002.py.snap @@ -12,7 +12,7 @@ FAST002.py:24:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -ℹ Unsafe fix +Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel @@ -30,6 +30,8 @@ FAST002.py:24:5: FAST002 [*] FastAPI dependency without `Annotated` 26 27 | ): 27 28 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FAST002.py:25:5: FAST002 [*] FastAPI dependency without `Annotated` | 23 | def get_items( @@ -41,7 +43,7 @@ FAST002.py:25:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -ℹ Unsafe fix +Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel @@ -59,6 +61,8 @@ FAST002.py:25:5: FAST002 [*] FastAPI dependency without `Annotated` 27 28 | pass 28 29 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FAST002.py:32:5: FAST002 [*] FastAPI dependency without `Annotated` | 30 | @app.post("/stuff/") @@ -70,7 +74,7 @@ FAST002.py:32:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -ℹ Unsafe fix +Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel @@ -88,6 +92,8 @@ FAST002.py:32:5: FAST002 [*] FastAPI dependency without `Annotated` 34 35 | some_body_param: str = Body("foo"), 35 36 | some_cookie_param: str = Cookie(), + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FAST002.py:33:5: FAST002 [*] FastAPI dependency without `Annotated` | 31 | def do_stuff( @@ -99,7 +105,7 @@ FAST002.py:33:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -ℹ Unsafe fix +Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel @@ -117,6 +123,8 @@ FAST002.py:33:5: FAST002 [*] FastAPI dependency without `Annotated` 35 36 | some_cookie_param: str = Cookie(), 36 37 | some_header_param: int = Header(default=5), + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FAST002.py:34:5: FAST002 [*] FastAPI dependency without `Annotated` | 32 | some_query_param: str | None = Query(default=None), @@ -128,7 +136,7 @@ FAST002.py:34:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -ℹ Unsafe fix +Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel @@ -146,6 +154,8 @@ FAST002.py:34:5: FAST002 [*] FastAPI dependency without `Annotated` 36 37 | some_header_param: int = Header(default=5), 37 38 | some_file_param: UploadFile = File(), + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FAST002.py:35:5: FAST002 [*] FastAPI dependency without `Annotated` | 33 | some_path_param: str = Path(), @@ -157,7 +167,7 @@ FAST002.py:35:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -ℹ Unsafe fix +Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel @@ -175,6 +185,8 @@ FAST002.py:35:5: FAST002 [*] FastAPI dependency without `Annotated` 37 38 | some_file_param: UploadFile = File(), 38 39 | some_form_param: str = Form(), + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FAST002.py:36:5: FAST002 [*] FastAPI dependency without `Annotated` | 34 | some_body_param: str = Body("foo"), @@ -186,7 +198,7 @@ FAST002.py:36:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -ℹ Unsafe fix +Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel @@ -204,6 +216,8 @@ FAST002.py:36:5: FAST002 [*] FastAPI dependency without `Annotated` 38 39 | some_form_param: str = Form(), 39 40 | ): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FAST002.py:37:5: FAST002 [*] FastAPI dependency without `Annotated` | 35 | some_cookie_param: str = Cookie(), @@ -215,7 +229,7 @@ FAST002.py:37:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -ℹ Unsafe fix +Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel @@ -233,6 +247,8 @@ FAST002.py:37:5: FAST002 [*] FastAPI dependency without `Annotated` 39 40 | ): 40 41 | # do stuff + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FAST002.py:38:5: FAST002 [*] FastAPI dependency without `Annotated` | 36 | some_header_param: int = Header(default=5), @@ -244,7 +260,7 @@ FAST002.py:38:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -ℹ Unsafe fix +Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel @@ -261,3 +277,5 @@ FAST002.py:38:5: FAST002 [*] FastAPI dependency without `Annotated` 39 40 | ): 40 41 | # do stuff 41 42 | pass + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-redundant-response-model_FAST001.py.snap b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-redundant-response-model_FAST001.py.snap index 84b582e502da7..143163f8228fc 100644 --- a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-redundant-response-model_FAST001.py.snap +++ b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-redundant-response-model_FAST001.py.snap @@ -10,7 +10,7 @@ FAST001.py:17:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -ℹ Unsafe fix +Suggested fix: 14 14 | # Errors 15 15 | 16 16 | @@ -20,6 +20,8 @@ FAST001.py:17:22: FAST001 [*] FastAPI route with redundant `response_model` argu 19 19 | return item 20 20 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FAST001.py:22:22: FAST001 [*] FastAPI route with redundant `response_model` argument | 22 | @app.post("/items/", response_model=list[Item]) @@ -29,7 +31,7 @@ FAST001.py:22:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -ℹ Unsafe fix +Suggested fix: 19 19 | return item 20 20 | 21 21 | @@ -39,6 +41,8 @@ FAST001.py:22:22: FAST001 [*] FastAPI route with redundant `response_model` argu 24 24 | return item 25 25 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FAST001.py:27:22: FAST001 [*] FastAPI route with redundant `response_model` argument | 27 | @app.post("/items/", response_model=List[Item]) @@ -48,7 +52,7 @@ FAST001.py:27:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -ℹ Unsafe fix +Suggested fix: 24 24 | return item 25 25 | 26 26 | @@ -58,6 +62,8 @@ FAST001.py:27:22: FAST001 [*] FastAPI route with redundant `response_model` argu 29 29 | return item 30 30 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FAST001.py:32:22: FAST001 [*] FastAPI route with redundant `response_model` argument | 32 | @app.post("/items/", response_model=Dict[str, Item]) @@ -67,7 +73,7 @@ FAST001.py:32:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -ℹ Unsafe fix +Suggested fix: 29 29 | return item 30 30 | 31 31 | @@ -77,6 +83,8 @@ FAST001.py:32:22: FAST001 [*] FastAPI route with redundant `response_model` argu 34 34 | return item 35 35 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FAST001.py:37:22: FAST001 [*] FastAPI route with redundant `response_model` argument | 37 | @app.post("/items/", response_model=str) @@ -86,7 +94,7 @@ FAST001.py:37:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -ℹ Unsafe fix +Suggested fix: 34 34 | return item 35 35 | 36 36 | @@ -96,6 +104,8 @@ FAST001.py:37:22: FAST001 [*] FastAPI route with redundant `response_model` argu 39 39 | return item 40 40 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FAST001.py:42:21: FAST001 [*] FastAPI route with redundant `response_model` argument | 42 | @app.get("/items/", response_model=Item) @@ -105,7 +115,7 @@ FAST001.py:42:21: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -ℹ Unsafe fix +Suggested fix: 39 39 | return item 40 40 | 41 41 | @@ -115,6 +125,8 @@ FAST001.py:42:21: FAST001 [*] FastAPI route with redundant `response_model` argu 44 44 | return item 45 45 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FAST001.py:47:21: FAST001 [*] FastAPI route with redundant `response_model` argument | 47 | @app.get("/items/", response_model=Item) @@ -124,7 +136,7 @@ FAST001.py:47:21: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -ℹ Unsafe fix +Suggested fix: 44 44 | return item 45 45 | 46 46 | @@ -134,6 +146,8 @@ FAST001.py:47:21: FAST001 [*] FastAPI route with redundant `response_model` argu 49 49 | async def create_item(item: Item) -> Item: 50 50 | return item + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FAST001.py:48:22: FAST001 [*] FastAPI route with redundant `response_model` argument | 47 | @app.get("/items/", response_model=Item) @@ -144,7 +158,7 @@ FAST001.py:48:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -ℹ Unsafe fix +Suggested fix: 45 45 | 46 46 | 47 47 | @app.get("/items/", response_model=Item) @@ -154,6 +168,8 @@ FAST001.py:48:22: FAST001 [*] FastAPI route with redundant `response_model` argu 50 50 | return item 51 51 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FAST001.py:53:24: FAST001 [*] FastAPI route with redundant `response_model` argument | 53 | @router.get("/items/", response_model=Item) @@ -163,7 +179,7 @@ FAST001.py:53:24: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -ℹ Unsafe fix +Suggested fix: 50 50 | return item 51 51 | 52 52 | @@ -171,4 +187,6 @@ FAST001.py:53:24: FAST001 [*] FastAPI route with redundant `response_model` argu 53 |+@router.get("/items/") 54 54 | async def create_item(item: Item) -> Item: 55 55 | return item -56 56 | +56 56 | + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type.snap index c2be32c1fa995..10e83b3d158f4 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type.snap @@ -9,13 +9,15 @@ auto_return_type.py:1:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 1 |-def func(): 1 |+def func() -> int: 2 2 | return 1 3 3 | 4 4 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:5:5: ANN201 [*] Missing return type annotation for public function `func` | 5 | def func(): @@ -24,7 +26,7 @@ auto_return_type.py:5:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `float` -ℹ Unsafe fix +Suggested fix: 2 2 | return 1 3 3 | 4 4 | @@ -34,6 +36,8 @@ auto_return_type.py:5:5: ANN201 [*] Missing return type annotation for public fu 7 7 | 8 8 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:9:5: ANN201 [*] Missing return type annotation for public function `func` | 9 | def func(x: int): @@ -43,7 +47,7 @@ auto_return_type.py:9:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `float` -ℹ Unsafe fix +Suggested fix: 6 6 | return 1.5 7 7 | 8 8 | @@ -53,6 +57,8 @@ auto_return_type.py:9:5: ANN201 [*] Missing return type annotation for public fu 11 11 | return 1 12 12 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:16:5: ANN201 [*] Missing return type annotation for public function `func` | 16 | def func(): @@ -61,7 +67,7 @@ auto_return_type.py:16:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `bool` -ℹ Unsafe fix +Suggested fix: 13 13 | return 1.5 14 14 | 15 15 | @@ -71,6 +77,8 @@ auto_return_type.py:16:5: ANN201 [*] Missing return type annotation for public f 18 18 | 19 19 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:20:5: ANN201 [*] Missing return type annotation for public function `func` | 20 | def func(x: int): @@ -80,7 +88,7 @@ auto_return_type.py:20:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 17 17 | return True 18 18 | 19 19 | @@ -90,6 +98,8 @@ auto_return_type.py:20:5: ANN201 [*] Missing return type annotation for public f 22 22 | return None 23 23 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:27:5: ANN201 [*] Missing return type annotation for public function `func` | 27 | def func(x: int): @@ -98,7 +108,7 @@ auto_return_type.py:27:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `str | float` -ℹ Unsafe fix +Suggested fix: 24 24 | return 25 25 | 26 26 | @@ -108,6 +118,8 @@ auto_return_type.py:27:5: ANN201 [*] Missing return type annotation for public f 29 29 | 30 30 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:31:5: ANN201 [*] Missing return type annotation for public function `func` | 31 | def func(x: int): @@ -116,7 +128,7 @@ auto_return_type.py:31:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `str | float` -ℹ Unsafe fix +Suggested fix: 28 28 | return 1 or 2.5 if x > 0 else 1.5 or "str" 29 29 | 30 30 | @@ -126,6 +138,8 @@ auto_return_type.py:31:5: ANN201 [*] Missing return type annotation for public f 33 33 | 34 34 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:35:5: ANN201 Missing return type annotation for public function `func` | 35 | def func(x: int): @@ -152,7 +166,7 @@ auto_return_type.py:45:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 42 42 | return {"foo": 1} 43 43 | 44 44 | @@ -162,6 +176,8 @@ auto_return_type.py:45:5: ANN201 [*] Missing return type annotation for public f 47 47 | return 1 48 48 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:52:5: ANN201 [*] Missing return type annotation for public function `func` | 52 | def func(x: int): @@ -171,7 +187,7 @@ auto_return_type.py:52:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int | None` -ℹ Unsafe fix +Suggested fix: 49 49 | return True 50 50 | 51 51 | @@ -181,6 +197,8 @@ auto_return_type.py:52:5: ANN201 [*] Missing return type annotation for public f 54 54 | return 1 55 55 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:59:5: ANN201 [*] Missing return type annotation for public function `func` | 59 | def func(x: int): @@ -190,7 +208,7 @@ auto_return_type.py:59:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `str | int | None` -ℹ Unsafe fix +Suggested fix: 56 56 | return None 57 57 | 58 58 | @@ -200,6 +218,8 @@ auto_return_type.py:59:5: ANN201 [*] Missing return type annotation for public f 61 61 | return 1 62 62 | elif x > 5: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:68:5: ANN201 [*] Missing return type annotation for public function `func` | 68 | def func(x: int): @@ -209,7 +229,7 @@ auto_return_type.py:68:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int | None` -ℹ Unsafe fix +Suggested fix: 65 65 | return None 66 66 | 67 67 | @@ -219,6 +239,8 @@ auto_return_type.py:68:5: ANN201 [*] Missing return type annotation for public f 70 70 | return 1 71 71 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:73:5: ANN201 [*] Missing return type annotation for public function `func` | 73 | def func(): @@ -227,7 +249,7 @@ auto_return_type.py:73:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 70 70 | return 1 71 71 | 72 72 | @@ -237,6 +259,8 @@ auto_return_type.py:73:5: ANN201 [*] Missing return type annotation for public f 75 75 | 76 76 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:77:5: ANN201 [*] Missing return type annotation for public function `func` | 77 | def func(x: int): @@ -246,7 +270,7 @@ auto_return_type.py:77:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int | None` -ℹ Unsafe fix +Suggested fix: 74 74 | x = 1 75 75 | 76 76 | @@ -256,6 +280,8 @@ auto_return_type.py:77:5: ANN201 [*] Missing return type annotation for public f 79 79 | return 1 80 80 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:82:5: ANN201 [*] Missing return type annotation for public function `func` | 82 | def func(x: int): @@ -265,7 +291,7 @@ auto_return_type.py:82:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `str | int | None` -ℹ Unsafe fix +Suggested fix: 79 79 | return 1 80 80 | 81 81 | @@ -275,6 +301,8 @@ auto_return_type.py:82:5: ANN201 [*] Missing return type annotation for public f 84 84 | case [1, 2, 3]: 85 85 | return 1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:90:5: ANN201 [*] Missing return type annotation for public function `func` | 90 | def func(x: int): @@ -284,7 +312,7 @@ auto_return_type.py:90:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int | None` -ℹ Unsafe fix +Suggested fix: 87 87 | return "foo" 88 88 | 89 89 | @@ -294,6 +322,8 @@ auto_return_type.py:90:5: ANN201 [*] Missing return type annotation for public f 92 92 | if i > 0: 93 93 | return 1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:96:5: ANN201 [*] Missing return type annotation for public function `func` | 96 | def func(x: int): @@ -303,7 +333,7 @@ auto_return_type.py:96:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 93 93 | return 1 94 94 | 95 95 | @@ -313,6 +343,8 @@ auto_return_type.py:96:5: ANN201 [*] Missing return type annotation for public f 98 98 | if i > 0: 99 99 | return 1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:104:5: ANN201 [*] Missing return type annotation for public function `func` | 104 | def func(x: int): @@ -322,7 +354,7 @@ auto_return_type.py:104:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -ℹ Unsafe fix +Suggested fix: 101 101 | return 4 102 102 | 103 103 | @@ -332,6 +364,8 @@ auto_return_type.py:104:5: ANN201 [*] Missing return type annotation for public 106 106 | if i > 0: 107 107 | break + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:112:5: ANN201 [*] Missing return type annotation for public function `func` | 112 | def func(x: int): @@ -341,7 +375,7 @@ auto_return_type.py:112:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -ℹ Unsafe fix +Suggested fix: 109 109 | return 4 110 110 | 111 111 | @@ -351,6 +385,8 @@ auto_return_type.py:112:5: ANN201 [*] Missing return type annotation for public 114 114 | pass 115 115 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:119:5: ANN201 [*] Missing return type annotation for public function `func` | 119 | def func(x: int): @@ -360,7 +396,7 @@ auto_return_type.py:119:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 116 116 | return 1 117 117 | 118 118 | @@ -370,6 +406,8 @@ auto_return_type.py:119:5: ANN201 [*] Missing return type annotation for public 121 121 | pass 122 122 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:128:5: ANN201 [*] Missing return type annotation for public function `func` | 128 | def func(x: int): @@ -379,7 +417,7 @@ auto_return_type.py:128:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 125 125 | return 2 126 126 | 127 127 | @@ -389,6 +427,8 @@ auto_return_type.py:128:5: ANN201 [*] Missing return type annotation for public 130 130 | pass 131 131 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:137:5: ANN201 [*] Missing return type annotation for public function `func` | 137 | def func(x: int): @@ -398,7 +438,7 @@ auto_return_type.py:137:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -ℹ Unsafe fix +Suggested fix: 134 134 | return 2 135 135 | 136 136 | @@ -408,6 +448,8 @@ auto_return_type.py:137:5: ANN201 [*] Missing return type annotation for public 139 139 | return 1 140 140 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:146:5: ANN201 [*] Missing return type annotation for public function `func` | 146 | def func(x: int): @@ -417,7 +459,7 @@ auto_return_type.py:146:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -ℹ Unsafe fix +Suggested fix: 143 143 | pass 144 144 | 145 145 | @@ -427,6 +469,8 @@ auto_return_type.py:146:5: ANN201 [*] Missing return type annotation for public 148 148 | break 149 149 | return 1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:158:9: ANN201 Missing return type annotation for public function `method` | 156 | class Foo(abc.ABC): @@ -485,7 +529,7 @@ auto_return_type.py:180:9: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `float` -ℹ Unsafe fix +Suggested fix: 177 177 | pass 178 178 | 179 179 | @abstractmethod @@ -495,6 +539,8 @@ auto_return_type.py:180:9: ANN201 [*] Missing return type annotation for public 182 182 | return 1 183 183 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:187:5: ANN201 [*] Missing return type annotation for public function `func` | 187 | def func(x: int): @@ -504,7 +550,7 @@ auto_return_type.py:187:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -ℹ Unsafe fix +Suggested fix: 184 184 | return 1.5 185 185 | 186 186 | @@ -514,6 +560,8 @@ auto_return_type.py:187:5: ANN201 [*] Missing return type annotation for public 189 189 | pass 190 190 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:194:5: ANN201 [*] Missing return type annotation for public function `func` | 194 | def func(x: int): @@ -523,7 +571,7 @@ auto_return_type.py:194:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 191 191 | return 2 192 192 | 193 193 | @@ -533,6 +581,8 @@ auto_return_type.py:194:5: ANN201 [*] Missing return type annotation for public 196 196 | pass 197 197 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:203:5: ANN201 [*] Missing return type annotation for public function `func` | 203 | def func(x: int): @@ -542,7 +592,7 @@ auto_return_type.py:203:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Never` -ℹ Unsafe fix +Suggested fix: 151 151 | 152 152 | import abc 153 153 | from abc import abstractmethod @@ -560,6 +610,8 @@ auto_return_type.py:203:5: ANN201 [*] Missing return type annotation for public 205 206 | raise ValueError 206 207 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:210:5: ANN201 [*] Missing return type annotation for public function `func` | 210 | def func(x: int): @@ -569,7 +621,7 @@ auto_return_type.py:210:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 207 207 | raise TypeError 208 208 | 209 209 | @@ -579,6 +631,8 @@ auto_return_type.py:210:5: ANN201 [*] Missing return type annotation for public 212 212 | raise ValueError 213 213 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:234:5: ANN201 [*] Missing return type annotation for public function `func` | 234 | def func(x: int): @@ -588,7 +642,7 @@ auto_return_type.py:234:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 231 231 | return i 232 232 | 233 233 | @@ -598,6 +652,8 @@ auto_return_type.py:234:5: ANN201 [*] Missing return type annotation for public 236 236 | return 1 237 237 | raise ValueError + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:240:5: ANN201 [*] Missing return type annotation for public function `func` | 240 | def func(x: int): @@ -607,7 +663,7 @@ auto_return_type.py:240:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 237 237 | raise ValueError 238 238 | 239 239 | @@ -617,6 +673,8 @@ auto_return_type.py:240:5: ANN201 [*] Missing return type annotation for public 242 242 | return 1 243 243 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:248:5: ANN201 [*] Missing return type annotation for public function `func` | 248 | def func(): @@ -626,7 +684,7 @@ auto_return_type.py:248:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -ℹ Unsafe fix +Suggested fix: 245 245 | raise ValueError 246 246 | 247 247 | @@ -636,6 +694,8 @@ auto_return_type.py:248:5: ANN201 [*] Missing return type annotation for public 250 250 | raise ValueError 251 251 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:255:5: ANN201 [*] Missing return type annotation for public function `func` | 255 | def func(): @@ -645,7 +705,7 @@ auto_return_type.py:255:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -ℹ Unsafe fix +Suggested fix: 252 252 | return 2 253 253 | 254 254 | @@ -655,6 +715,8 @@ auto_return_type.py:255:5: ANN201 [*] Missing return type annotation for public 257 257 | return 1 258 258 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:262:5: ANN201 [*] Missing return type annotation for public function `func` | 262 | def func(x: int): @@ -664,7 +726,7 @@ auto_return_type.py:262:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 259 259 | pass 260 260 | 261 261 | @@ -674,6 +736,8 @@ auto_return_type.py:262:5: ANN201 [*] Missing return type annotation for public 264 264 | if x > 0: 265 265 | return 1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:269:5: ANN201 [*] Missing return type annotation for public function `func` | 269 | def func(x: int): @@ -683,7 +747,7 @@ auto_return_type.py:269:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 266 266 | raise ValueError 267 267 | 268 268 | @@ -693,6 +757,8 @@ auto_return_type.py:269:5: ANN201 [*] Missing return type annotation for public 271 271 | raise ValueError 272 272 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:276:5: ANN201 [*] Missing return type annotation for public function `func` | 276 | def func(x: int): @@ -702,7 +768,7 @@ auto_return_type.py:276:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 273 273 | pass 274 274 | 275 275 | @@ -712,6 +778,8 @@ auto_return_type.py:276:5: ANN201 [*] Missing return type annotation for public 278 278 | raise ValueError 279 279 | elif x > 10: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:283:5: ANN201 [*] Missing return type annotation for public function `func` | 283 | def func(x: int): @@ -721,7 +789,7 @@ auto_return_type.py:283:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -ℹ Unsafe fix +Suggested fix: 280 280 | pass 281 281 | 282 282 | @@ -731,6 +799,8 @@ auto_return_type.py:283:5: ANN201 [*] Missing return type annotation for public 285 285 | raise ValueError 286 286 | elif x > 10: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:290:5: ANN201 [*] Missing return type annotation for public function `func` | 290 | def func(): @@ -740,7 +810,7 @@ auto_return_type.py:290:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 287 287 | return 5 288 288 | 289 289 | @@ -750,6 +820,8 @@ auto_return_type.py:290:5: ANN201 [*] Missing return type annotation for public 292 292 | return 5 293 293 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public function `func` | 299 | def func(x: int): @@ -759,7 +831,7 @@ auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `str | int` -ℹ Unsafe fix +Suggested fix: 296 296 | raise ValueError 297 297 | 298 298 | @@ -769,4 +841,4 @@ auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public 301 301 | case [1, 2, 3]: 302 302 | return 1 - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type_py38.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type_py38.snap index 4cb5bbfb615fa..0f7ad20532ec3 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type_py38.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type_py38.snap @@ -9,13 +9,15 @@ auto_return_type.py:1:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 1 |-def func(): 1 |+def func() -> int: 2 2 | return 1 3 3 | 4 4 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:5:5: ANN201 [*] Missing return type annotation for public function `func` | 5 | def func(): @@ -24,7 +26,7 @@ auto_return_type.py:5:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `float` -ℹ Unsafe fix +Suggested fix: 2 2 | return 1 3 3 | 4 4 | @@ -34,6 +36,8 @@ auto_return_type.py:5:5: ANN201 [*] Missing return type annotation for public fu 7 7 | 8 8 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:9:5: ANN201 [*] Missing return type annotation for public function `func` | 9 | def func(x: int): @@ -43,7 +47,7 @@ auto_return_type.py:9:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `float` -ℹ Unsafe fix +Suggested fix: 6 6 | return 1.5 7 7 | 8 8 | @@ -53,6 +57,8 @@ auto_return_type.py:9:5: ANN201 [*] Missing return type annotation for public fu 11 11 | return 1 12 12 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:16:5: ANN201 [*] Missing return type annotation for public function `func` | 16 | def func(): @@ -61,7 +67,7 @@ auto_return_type.py:16:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `bool` -ℹ Unsafe fix +Suggested fix: 13 13 | return 1.5 14 14 | 15 15 | @@ -71,6 +77,8 @@ auto_return_type.py:16:5: ANN201 [*] Missing return type annotation for public f 18 18 | 19 19 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:20:5: ANN201 [*] Missing return type annotation for public function `func` | 20 | def func(x: int): @@ -80,7 +88,7 @@ auto_return_type.py:20:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 17 17 | return True 18 18 | 19 19 | @@ -90,6 +98,8 @@ auto_return_type.py:20:5: ANN201 [*] Missing return type annotation for public f 22 22 | return None 23 23 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:27:5: ANN201 [*] Missing return type annotation for public function `func` | 27 | def func(x: int): @@ -98,7 +108,7 @@ auto_return_type.py:27:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Union[str | float]` -ℹ Unsafe fix +Suggested fix: 1 |+from typing import Union 1 2 | def func(): 2 3 | return 1 @@ -113,6 +123,8 @@ auto_return_type.py:27:5: ANN201 [*] Missing return type annotation for public f 29 30 | 30 31 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:31:5: ANN201 [*] Missing return type annotation for public function `func` | 31 | def func(x: int): @@ -121,7 +133,7 @@ auto_return_type.py:31:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Union[str | float]` -ℹ Unsafe fix +Suggested fix: 1 |+from typing import Union 1 2 | def func(): 2 3 | return 1 @@ -136,6 +148,8 @@ auto_return_type.py:31:5: ANN201 [*] Missing return type annotation for public f 33 34 | 34 35 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:35:5: ANN201 Missing return type annotation for public function `func` | 35 | def func(x: int): @@ -162,7 +176,7 @@ auto_return_type.py:45:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 42 42 | return {"foo": 1} 43 43 | 44 44 | @@ -172,6 +186,8 @@ auto_return_type.py:45:5: ANN201 [*] Missing return type annotation for public f 47 47 | return 1 48 48 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:52:5: ANN201 [*] Missing return type annotation for public function `func` | 52 | def func(x: int): @@ -181,7 +197,7 @@ auto_return_type.py:52:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Optional[int]` -ℹ Unsafe fix +Suggested fix: 1 |+from typing import Optional 1 2 | def func(): 2 3 | return 1 @@ -196,6 +212,8 @@ auto_return_type.py:52:5: ANN201 [*] Missing return type annotation for public f 54 55 | return 1 55 56 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:59:5: ANN201 [*] Missing return type annotation for public function `func` | 59 | def func(x: int): @@ -205,7 +223,7 @@ auto_return_type.py:59:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Union[str | int | None]` -ℹ Unsafe fix +Suggested fix: 1 |+from typing import Union 1 2 | def func(): 2 3 | return 1 @@ -220,6 +238,8 @@ auto_return_type.py:59:5: ANN201 [*] Missing return type annotation for public f 61 62 | return 1 62 63 | elif x > 5: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:68:5: ANN201 [*] Missing return type annotation for public function `func` | 68 | def func(x: int): @@ -229,7 +249,7 @@ auto_return_type.py:68:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Optional[int]` -ℹ Unsafe fix +Suggested fix: 1 |+from typing import Optional 1 2 | def func(): 2 3 | return 1 @@ -244,6 +264,8 @@ auto_return_type.py:68:5: ANN201 [*] Missing return type annotation for public f 70 71 | return 1 71 72 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:73:5: ANN201 [*] Missing return type annotation for public function `func` | 73 | def func(): @@ -252,7 +274,7 @@ auto_return_type.py:73:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 70 70 | return 1 71 71 | 72 72 | @@ -262,6 +284,8 @@ auto_return_type.py:73:5: ANN201 [*] Missing return type annotation for public f 75 75 | 76 76 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:77:5: ANN201 [*] Missing return type annotation for public function `func` | 77 | def func(x: int): @@ -271,7 +295,7 @@ auto_return_type.py:77:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Optional[int]` -ℹ Unsafe fix +Suggested fix: 1 |+from typing import Optional 1 2 | def func(): 2 3 | return 1 @@ -286,6 +310,8 @@ auto_return_type.py:77:5: ANN201 [*] Missing return type annotation for public f 79 80 | return 1 80 81 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:82:5: ANN201 [*] Missing return type annotation for public function `func` | 82 | def func(x: int): @@ -295,7 +321,7 @@ auto_return_type.py:82:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Union[str | int | None]` -ℹ Unsafe fix +Suggested fix: 1 |+from typing import Union 1 2 | def func(): 2 3 | return 1 @@ -310,6 +336,8 @@ auto_return_type.py:82:5: ANN201 [*] Missing return type annotation for public f 84 85 | case [1, 2, 3]: 85 86 | return 1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:90:5: ANN201 [*] Missing return type annotation for public function `func` | 90 | def func(x: int): @@ -319,7 +347,7 @@ auto_return_type.py:90:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Optional[int]` -ℹ Unsafe fix +Suggested fix: 1 |+from typing import Optional 1 2 | def func(): 2 3 | return 1 @@ -334,6 +362,8 @@ auto_return_type.py:90:5: ANN201 [*] Missing return type annotation for public f 92 93 | if i > 0: 93 94 | return 1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:96:5: ANN201 [*] Missing return type annotation for public function `func` | 96 | def func(x: int): @@ -343,7 +373,7 @@ auto_return_type.py:96:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 93 93 | return 1 94 94 | 95 95 | @@ -353,6 +383,8 @@ auto_return_type.py:96:5: ANN201 [*] Missing return type annotation for public f 98 98 | if i > 0: 99 99 | return 1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:104:5: ANN201 [*] Missing return type annotation for public function `func` | 104 | def func(x: int): @@ -362,7 +394,7 @@ auto_return_type.py:104:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -ℹ Unsafe fix +Suggested fix: 1 |+from typing import Optional 1 2 | def func(): 2 3 | return 1 @@ -377,6 +409,8 @@ auto_return_type.py:104:5: ANN201 [*] Missing return type annotation for public 106 107 | if i > 0: 107 108 | break + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:112:5: ANN201 [*] Missing return type annotation for public function `func` | 112 | def func(x: int): @@ -386,7 +420,7 @@ auto_return_type.py:112:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -ℹ Unsafe fix +Suggested fix: 1 |+from typing import Optional 1 2 | def func(): 2 3 | return 1 @@ -401,6 +435,8 @@ auto_return_type.py:112:5: ANN201 [*] Missing return type annotation for public 114 115 | pass 115 116 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:119:5: ANN201 [*] Missing return type annotation for public function `func` | 119 | def func(x: int): @@ -410,7 +446,7 @@ auto_return_type.py:119:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 116 116 | return 1 117 117 | 118 118 | @@ -420,6 +456,8 @@ auto_return_type.py:119:5: ANN201 [*] Missing return type annotation for public 121 121 | pass 122 122 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:128:5: ANN201 [*] Missing return type annotation for public function `func` | 128 | def func(x: int): @@ -429,7 +467,7 @@ auto_return_type.py:128:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 125 125 | return 2 126 126 | 127 127 | @@ -439,6 +477,8 @@ auto_return_type.py:128:5: ANN201 [*] Missing return type annotation for public 130 130 | pass 131 131 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:137:5: ANN201 [*] Missing return type annotation for public function `func` | 137 | def func(x: int): @@ -448,7 +488,7 @@ auto_return_type.py:137:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -ℹ Unsafe fix +Suggested fix: 1 |+from typing import Optional 1 2 | def func(): 2 3 | return 1 @@ -463,6 +503,8 @@ auto_return_type.py:137:5: ANN201 [*] Missing return type annotation for public 139 140 | return 1 140 141 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:146:5: ANN201 [*] Missing return type annotation for public function `func` | 146 | def func(x: int): @@ -472,7 +514,7 @@ auto_return_type.py:146:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -ℹ Unsafe fix +Suggested fix: 1 |+from typing import Optional 1 2 | def func(): 2 3 | return 1 @@ -487,6 +529,8 @@ auto_return_type.py:146:5: ANN201 [*] Missing return type annotation for public 148 149 | break 149 150 | return 1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:158:9: ANN201 Missing return type annotation for public function `method` | 156 | class Foo(abc.ABC): @@ -545,7 +589,7 @@ auto_return_type.py:180:9: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `float` -ℹ Unsafe fix +Suggested fix: 177 177 | pass 178 178 | 179 179 | @abstractmethod @@ -555,6 +599,8 @@ auto_return_type.py:180:9: ANN201 [*] Missing return type annotation for public 182 182 | return 1 183 183 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:187:5: ANN201 [*] Missing return type annotation for public function `func` | 187 | def func(x: int): @@ -564,7 +610,7 @@ auto_return_type.py:187:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -ℹ Unsafe fix +Suggested fix: 151 151 | 152 152 | import abc 153 153 | from abc import abstractmethod @@ -582,6 +628,8 @@ auto_return_type.py:187:5: ANN201 [*] Missing return type annotation for public 189 190 | pass 190 191 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:194:5: ANN201 [*] Missing return type annotation for public function `func` | 194 | def func(x: int): @@ -591,7 +639,7 @@ auto_return_type.py:194:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 191 191 | return 2 192 192 | 193 193 | @@ -601,6 +649,8 @@ auto_return_type.py:194:5: ANN201 [*] Missing return type annotation for public 196 196 | pass 197 197 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:203:5: ANN201 [*] Missing return type annotation for public function `func` | 203 | def func(x: int): @@ -610,7 +660,7 @@ auto_return_type.py:203:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `NoReturn` -ℹ Unsafe fix +Suggested fix: 151 151 | 152 152 | import abc 153 153 | from abc import abstractmethod @@ -628,6 +678,8 @@ auto_return_type.py:203:5: ANN201 [*] Missing return type annotation for public 205 206 | raise ValueError 206 207 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:210:5: ANN201 [*] Missing return type annotation for public function `func` | 210 | def func(x: int): @@ -637,7 +689,7 @@ auto_return_type.py:210:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 207 207 | raise TypeError 208 208 | 209 209 | @@ -647,6 +699,8 @@ auto_return_type.py:210:5: ANN201 [*] Missing return type annotation for public 212 212 | raise ValueError 213 213 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:234:5: ANN201 [*] Missing return type annotation for public function `func` | 234 | def func(x: int): @@ -656,7 +710,7 @@ auto_return_type.py:234:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 231 231 | return i 232 232 | 233 233 | @@ -666,6 +720,8 @@ auto_return_type.py:234:5: ANN201 [*] Missing return type annotation for public 236 236 | return 1 237 237 | raise ValueError + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:240:5: ANN201 [*] Missing return type annotation for public function `func` | 240 | def func(x: int): @@ -675,7 +731,7 @@ auto_return_type.py:240:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 237 237 | raise ValueError 238 238 | 239 239 | @@ -685,6 +741,8 @@ auto_return_type.py:240:5: ANN201 [*] Missing return type annotation for public 242 242 | return 1 243 243 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:248:5: ANN201 [*] Missing return type annotation for public function `func` | 248 | def func(): @@ -694,7 +752,7 @@ auto_return_type.py:248:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -ℹ Unsafe fix +Suggested fix: 214 214 | return 1 215 215 | 216 216 | @@ -713,6 +771,8 @@ auto_return_type.py:248:5: ANN201 [*] Missing return type annotation for public 250 250 | raise ValueError 251 251 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:255:5: ANN201 [*] Missing return type annotation for public function `func` | 255 | def func(): @@ -722,7 +782,7 @@ auto_return_type.py:255:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -ℹ Unsafe fix +Suggested fix: 214 214 | return 1 215 215 | 216 216 | @@ -741,6 +801,8 @@ auto_return_type.py:255:5: ANN201 [*] Missing return type annotation for public 257 257 | return 1 258 258 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:262:5: ANN201 [*] Missing return type annotation for public function `func` | 262 | def func(x: int): @@ -750,7 +812,7 @@ auto_return_type.py:262:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 259 259 | pass 260 260 | 261 261 | @@ -760,6 +822,8 @@ auto_return_type.py:262:5: ANN201 [*] Missing return type annotation for public 264 264 | if x > 0: 265 265 | return 1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:269:5: ANN201 [*] Missing return type annotation for public function `func` | 269 | def func(x: int): @@ -769,7 +833,7 @@ auto_return_type.py:269:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 266 266 | raise ValueError 267 267 | 268 268 | @@ -779,6 +843,8 @@ auto_return_type.py:269:5: ANN201 [*] Missing return type annotation for public 271 271 | raise ValueError 272 272 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:276:5: ANN201 [*] Missing return type annotation for public function `func` | 276 | def func(x: int): @@ -788,7 +854,7 @@ auto_return_type.py:276:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 273 273 | pass 274 274 | 275 275 | @@ -798,6 +864,8 @@ auto_return_type.py:276:5: ANN201 [*] Missing return type annotation for public 278 278 | raise ValueError 279 279 | elif x > 10: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:283:5: ANN201 [*] Missing return type annotation for public function `func` | 283 | def func(x: int): @@ -807,7 +875,7 @@ auto_return_type.py:283:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -ℹ Unsafe fix +Suggested fix: 214 214 | return 1 215 215 | 216 216 | @@ -826,6 +894,8 @@ auto_return_type.py:283:5: ANN201 [*] Missing return type annotation for public 285 285 | raise ValueError 286 286 | elif x > 10: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:290:5: ANN201 [*] Missing return type annotation for public function `func` | 290 | def func(): @@ -835,7 +905,7 @@ auto_return_type.py:290:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 287 287 | return 5 288 288 | 289 289 | @@ -845,6 +915,8 @@ auto_return_type.py:290:5: ANN201 [*] Missing return type annotation for public 292 292 | return 5 293 293 | except: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public function `func` | 299 | def func(x: int): @@ -854,7 +926,7 @@ auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Union[str | int]` -ℹ Unsafe fix +Suggested fix: 214 214 | return 1 215 215 | 216 216 | @@ -873,4 +945,4 @@ auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public 301 301 | case [1, 2, 3]: 302 302 | return 1 - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap index 9be33117659ce..af2ffa3cb365c 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap @@ -10,7 +10,7 @@ annotation_presence.py:5:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 2 2 | from typing_extensions import override 3 3 | 4 4 | # Error @@ -20,6 +20,8 @@ annotation_presence.py:5:5: ANN201 [*] Missing return type annotation for public 7 7 | 8 8 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + annotation_presence.py:5:9: ANN001 Missing type annotation for function argument `a` | 4 | # Error @@ -45,7 +47,7 @@ annotation_presence.py:10:5: ANN201 [*] Missing return type annotation for publi | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 7 7 | 8 8 | 9 9 | # Error @@ -55,6 +57,8 @@ annotation_presence.py:10:5: ANN201 [*] Missing return type annotation for publi 12 12 | 13 13 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + annotation_presence.py:10:17: ANN001 Missing type annotation for function argument `b` | 9 | # Error @@ -80,7 +84,7 @@ annotation_presence.py:20:5: ANN201 [*] Missing return type annotation for publi | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 17 17 | 18 18 | 19 19 | # Error @@ -90,6 +94,8 @@ annotation_presence.py:20:5: ANN201 [*] Missing return type annotation for publi 22 22 | 23 23 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + annotation_presence.py:25:5: ANN201 [*] Missing return type annotation for public function `foo` | 24 | # Error @@ -99,7 +105,7 @@ annotation_presence.py:25:5: ANN201 [*] Missing return type annotation for publi | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 22 22 | 23 23 | 24 24 | # Error @@ -109,6 +115,8 @@ annotation_presence.py:25:5: ANN201 [*] Missing return type annotation for publi 27 27 | 28 28 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + annotation_presence.py:45:12: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a` | 44 | # ANN401 @@ -296,7 +304,7 @@ annotation_presence.py:159:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 156 156 | 157 157 | class Foo: 158 158 | @decorator() @@ -306,6 +314,8 @@ annotation_presence.py:159:9: ANN204 [*] Missing return type annotation for spec 161 161 | 162 162 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + annotation_presence.py:165:9: ANN204 [*] Missing return type annotation for special method `__init__` | 163 | # Regression test for: https://github.com/astral-sh/ruff/issues/7711 @@ -316,7 +326,7 @@ annotation_presence.py:165:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 162 162 | 163 163 | # Regression test for: https://github.com/astral-sh/ruff/issues/7711 164 164 | class Class: @@ -324,6 +334,8 @@ annotation_presence.py:165:9: ANN204 [*] Missing return type annotation for spec 165 |+ def __init__(self) -> None: 166 166 | print(f"{self.attr=}") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + annotation_presence.py:165:18: ANN101 Missing type annotation for `self` in method | 163 | # Regression test for: https://github.com/astral-sh/ruff/issues/7711 @@ -332,5 +344,3 @@ annotation_presence.py:165:18: ANN101 Missing type annotation for `self` in meth | ^^^^ ANN101 166 | print(f"{self.attr=}") | - - diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap index d806d641b4caa..a12d3149045d2 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap @@ -9,7 +9,7 @@ ignore_fully_untyped.py:24:5: ANN201 [*] Missing return type annotation for publ | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 21 21 | pass 22 22 | 23 23 | @@ -19,6 +19,8 @@ ignore_fully_untyped.py:24:5: ANN201 [*] Missing return type annotation for publ 26 26 | 27 27 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ignore_fully_untyped.py:24:37: ANN001 Missing type annotation for function argument `b` | 24 | def error_partially_typed_1(a: int, b): @@ -41,7 +43,7 @@ ignore_fully_untyped.py:32:5: ANN201 [*] Missing return type annotation for publ | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 29 29 | pass 30 30 | 31 31 | @@ -51,6 +53,8 @@ ignore_fully_untyped.py:32:5: ANN201 [*] Missing return type annotation for publ 34 34 | 35 35 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ignore_fully_untyped.py:43:9: ANN201 [*] Missing return type annotation for public function `error_typed_self` | 41 | pass @@ -61,7 +65,7 @@ ignore_fully_untyped.py:43:9: ANN201 [*] Missing return type annotation for publ | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 40 40 | def ok_untyped_method(self): 41 41 | pass 42 42 | @@ -69,4 +73,4 @@ ignore_fully_untyped.py:43:9: ANN201 [*] Missing return type annotation for publ 43 |+ def error_typed_self(self: X) -> None: 44 44 | pass - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap index f25fc530bc8cf..bcf11f8ea5c36 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap @@ -11,7 +11,7 @@ mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special m | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | # Error 4 4 | class Foo: @@ -21,6 +21,8 @@ mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special m 7 7 | 8 8 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special method `__init__` | 9 | # Error @@ -31,7 +33,7 @@ mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 8 8 | 9 9 | # Error 10 10 | class Foo: @@ -41,6 +43,8 @@ mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special 13 13 | 14 14 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + mypy_init_return.py:40:5: ANN202 [*] Missing return type annotation for private function `__init__` | 39 | # Error @@ -50,7 +54,7 @@ mypy_init_return.py:40:5: ANN202 [*] Missing return type annotation for private | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 37 37 | 38 38 | 39 39 | # Error @@ -60,6 +64,8 @@ mypy_init_return.py:40:5: ANN202 [*] Missing return type annotation for private 42 42 | 43 43 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + mypy_init_return.py:47:9: ANN204 [*] Missing return type annotation for special method `__init__` | 45 | # of a vararg falsely indicated that the function has a typed argument. @@ -70,7 +76,7 @@ mypy_init_return.py:47:9: ANN204 [*] Missing return type annotation for special | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 44 44 | # Error – used to be ok for a moment since the mere presence 45 45 | # of a vararg falsely indicated that the function has a typed argument. 46 46 | class Foo: @@ -78,4 +84,4 @@ mypy_init_return.py:47:9: ANN204 [*] Missing return type annotation for special 47 |+ def __init__(self, *arg) -> None: 48 48 | ... - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap index 29f85e2af8423..5c0f2defaf783 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap @@ -10,7 +10,7 @@ simple_magic_methods.py:2:9: ANN204 [*] Missing return type annotation for speci | = help: Add return type annotation: `str` -ℹ Unsafe fix +Suggested fix: 1 1 | class Foo: 2 |- def __str__(self): 2 |+ def __str__(self) -> str: @@ -18,6 +18,8 @@ simple_magic_methods.py:2:9: ANN204 [*] Missing return type annotation for speci 4 4 | 5 5 | def __repr__(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for special method `__repr__` | 3 | ... @@ -28,7 +30,7 @@ simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for speci | = help: Add return type annotation: `str` -ℹ Unsafe fix +Suggested fix: 2 2 | def __str__(self): 3 3 | ... 4 4 | @@ -38,6 +40,8 @@ simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for speci 7 7 | 8 8 | def __len__(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for special method `__len__` | 6 | ... @@ -48,7 +52,7 @@ simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for speci | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 5 5 | def __repr__(self): 6 6 | ... 7 7 | @@ -58,6 +62,8 @@ simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for speci 10 10 | 11 11 | def __length_hint__(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for special method `__length_hint__` | 9 | ... @@ -68,7 +74,7 @@ simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 8 8 | def __len__(self): 9 9 | ... 10 10 | @@ -78,6 +84,8 @@ simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for spec 13 13 | 14 14 | def __init__(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for special method `__init__` | 12 | ... @@ -88,7 +96,7 @@ simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 11 11 | def __length_hint__(self): 12 12 | ... 13 13 | @@ -98,6 +106,8 @@ simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for spec 16 16 | 17 17 | def __del__(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for special method `__del__` | 15 | ... @@ -108,7 +118,7 @@ simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `None` -ℹ Unsafe fix +Suggested fix: 14 14 | def __init__(self): 15 15 | ... 16 16 | @@ -118,6 +128,8 @@ simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for spec 19 19 | 20 20 | def __bool__(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for special method `__bool__` | 18 | ... @@ -128,7 +140,7 @@ simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `bool` -ℹ Unsafe fix +Suggested fix: 17 17 | def __del__(self): 18 18 | ... 19 19 | @@ -138,6 +150,8 @@ simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for spec 22 22 | 23 23 | def __bytes__(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for special method `__bytes__` | 21 | ... @@ -148,7 +162,7 @@ simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `bytes` -ℹ Unsafe fix +Suggested fix: 20 20 | def __bool__(self): 21 21 | ... 22 22 | @@ -158,6 +172,8 @@ simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for spec 25 25 | 26 26 | def __format__(self, format_spec): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for special method `__format__` | 24 | ... @@ -168,7 +184,7 @@ simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `str` -ℹ Unsafe fix +Suggested fix: 23 23 | def __bytes__(self): 24 24 | ... 25 25 | @@ -178,6 +194,8 @@ simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for spec 28 28 | 29 29 | def __contains__(self, item): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for special method `__contains__` | 27 | ... @@ -188,7 +206,7 @@ simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `bool` -ℹ Unsafe fix +Suggested fix: 26 26 | def __format__(self, format_spec): 27 27 | ... 28 28 | @@ -198,6 +216,8 @@ simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for spec 31 31 | 32 32 | def __complex__(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for special method `__complex__` | 30 | ... @@ -208,7 +228,7 @@ simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `complex` -ℹ Unsafe fix +Suggested fix: 29 29 | def __contains__(self, item): 30 30 | ... 31 31 | @@ -218,6 +238,8 @@ simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for spec 34 34 | 35 35 | def __int__(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for special method `__int__` | 33 | ... @@ -228,7 +250,7 @@ simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 32 32 | def __complex__(self): 33 33 | ... 34 34 | @@ -238,6 +260,8 @@ simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for spec 37 37 | 38 38 | def __float__(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for special method `__float__` | 36 | ... @@ -248,7 +272,7 @@ simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `float` -ℹ Unsafe fix +Suggested fix: 35 35 | def __int__(self): 36 36 | ... 37 37 | @@ -258,6 +282,8 @@ simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for spec 40 40 | 41 41 | def __index__(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + simple_magic_methods.py:41:9: ANN204 [*] Missing return type annotation for special method `__index__` | 39 | ... @@ -268,7 +294,7 @@ simple_magic_methods.py:41:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `int` -ℹ Unsafe fix +Suggested fix: 38 38 | def __float__(self): 39 39 | ... 40 40 | @@ -276,4 +302,4 @@ simple_magic_methods.py:41:9: ANN204 [*] Missing return type annotation for spec 41 |+ def __index__(self) -> int: 42 42 | ... - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__suppress_none_returning.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__suppress_none_returning.snap index 07d875aa50649..a2643c13073ad 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__suppress_none_returning.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__suppress_none_returning.snap @@ -10,7 +10,7 @@ suppress_none_returning.py:45:5: ANN201 [*] Missing return type annotation for p | = help: Add return type annotation: `bool` -ℹ Unsafe fix +Suggested fix: 42 42 | 43 43 | 44 44 | # Error @@ -20,6 +20,8 @@ suppress_none_returning.py:45:5: ANN201 [*] Missing return type annotation for p 47 47 | 48 48 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + suppress_none_returning.py:50:5: ANN201 [*] Missing return type annotation for public function `foo` | 49 | # Error @@ -30,7 +32,7 @@ suppress_none_returning.py:50:5: ANN201 [*] Missing return type annotation for p | = help: Add return type annotation: `bool | None` -ℹ Unsafe fix +Suggested fix: 47 47 | 48 48 | 49 49 | # Error @@ -40,6 +42,8 @@ suppress_none_returning.py:50:5: ANN201 [*] Missing return type annotation for p 52 52 | if a == 4: 53 53 | return True + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + suppress_none_returning.py:59:9: ANN001 Missing type annotation for function argument `a` | 58 | # Error (on the argument, but not the return type) @@ -47,5 +51,3 @@ suppress_none_returning.py:59:9: ANN001 Missing type annotation for function arg | ^ ANN001 60 | a = 2 + 2 | - - diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap index 1595cdc008549..c9f4d3f93d3f8 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap @@ -11,7 +11,7 @@ ASYNC105.py:30:5: ASYNC105 [*] Call to `trio.aclose_forcefully` is not immediate | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 27 27 | await trio.lowlevel.wait_writable(foo) 28 28 | 29 29 | # ASYNC105 @@ -21,6 +21,8 @@ ASYNC105.py:30:5: ASYNC105 [*] Call to `trio.aclose_forcefully` is not immediate 32 32 | trio.open_ssl_over_tcp_listeners(foo, foo) 33 33 | trio.open_ssl_over_tcp_stream(foo, foo) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:31:5: ASYNC105 [*] Call to `trio.open_file` is not immediately awaited | 29 | # ASYNC105 @@ -32,7 +34,7 @@ ASYNC105.py:31:5: ASYNC105 [*] Call to `trio.open_file` is not immediately await | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 28 28 | 29 29 | # ASYNC105 30 30 | trio.aclose_forcefully(foo) @@ -42,6 +44,8 @@ ASYNC105.py:31:5: ASYNC105 [*] Call to `trio.open_file` is not immediately await 33 33 | trio.open_ssl_over_tcp_stream(foo, foo) 34 34 | trio.open_tcp_listeners(foo) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:32:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_listeners` is not immediately awaited | 30 | trio.aclose_forcefully(foo) @@ -53,7 +57,7 @@ ASYNC105.py:32:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_listeners` is not | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 29 29 | # ASYNC105 30 30 | trio.aclose_forcefully(foo) 31 31 | trio.open_file(foo) @@ -63,6 +67,8 @@ ASYNC105.py:32:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_listeners` is not 34 34 | trio.open_tcp_listeners(foo) 35 35 | trio.open_tcp_stream(foo, foo) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:33:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_stream` is not immediately awaited | 31 | trio.open_file(foo) @@ -74,7 +80,7 @@ ASYNC105.py:33:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_stream` is not im | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 30 30 | trio.aclose_forcefully(foo) 31 31 | trio.open_file(foo) 32 32 | trio.open_ssl_over_tcp_listeners(foo, foo) @@ -84,6 +90,8 @@ ASYNC105.py:33:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_stream` is not im 35 35 | trio.open_tcp_stream(foo, foo) 36 36 | trio.open_unix_socket(foo) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:34:5: ASYNC105 [*] Call to `trio.open_tcp_listeners` is not immediately awaited | 32 | trio.open_ssl_over_tcp_listeners(foo, foo) @@ -95,7 +103,7 @@ ASYNC105.py:34:5: ASYNC105 [*] Call to `trio.open_tcp_listeners` is not immediat | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 31 31 | trio.open_file(foo) 32 32 | trio.open_ssl_over_tcp_listeners(foo, foo) 33 33 | trio.open_ssl_over_tcp_stream(foo, foo) @@ -105,6 +113,8 @@ ASYNC105.py:34:5: ASYNC105 [*] Call to `trio.open_tcp_listeners` is not immediat 36 36 | trio.open_unix_socket(foo) 37 37 | trio.run_process(foo) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:35:5: ASYNC105 [*] Call to `trio.open_tcp_stream` is not immediately awaited | 33 | trio.open_ssl_over_tcp_stream(foo, foo) @@ -116,7 +126,7 @@ ASYNC105.py:35:5: ASYNC105 [*] Call to `trio.open_tcp_stream` is not immediately | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 32 32 | trio.open_ssl_over_tcp_listeners(foo, foo) 33 33 | trio.open_ssl_over_tcp_stream(foo, foo) 34 34 | trio.open_tcp_listeners(foo) @@ -126,6 +136,8 @@ ASYNC105.py:35:5: ASYNC105 [*] Call to `trio.open_tcp_stream` is not immediately 37 37 | trio.run_process(foo) 38 38 | trio.serve_listeners(foo, foo) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:36:5: ASYNC105 [*] Call to `trio.open_unix_socket` is not immediately awaited | 34 | trio.open_tcp_listeners(foo) @@ -137,7 +149,7 @@ ASYNC105.py:36:5: ASYNC105 [*] Call to `trio.open_unix_socket` is not immediatel | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 33 33 | trio.open_ssl_over_tcp_stream(foo, foo) 34 34 | trio.open_tcp_listeners(foo) 35 35 | trio.open_tcp_stream(foo, foo) @@ -147,6 +159,8 @@ ASYNC105.py:36:5: ASYNC105 [*] Call to `trio.open_unix_socket` is not immediatel 38 38 | trio.serve_listeners(foo, foo) 39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:37:5: ASYNC105 [*] Call to `trio.run_process` is not immediately awaited | 35 | trio.open_tcp_stream(foo, foo) @@ -158,7 +172,7 @@ ASYNC105.py:37:5: ASYNC105 [*] Call to `trio.run_process` is not immediately awa | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 34 34 | trio.open_tcp_listeners(foo) 35 35 | trio.open_tcp_stream(foo, foo) 36 36 | trio.open_unix_socket(foo) @@ -168,6 +182,8 @@ ASYNC105.py:37:5: ASYNC105 [*] Call to `trio.run_process` is not immediately awa 39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) 40 40 | trio.serve_tcp(foo, foo) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:38:5: ASYNC105 [*] Call to `trio.serve_listeners` is not immediately awaited | 36 | trio.open_unix_socket(foo) @@ -179,7 +195,7 @@ ASYNC105.py:38:5: ASYNC105 [*] Call to `trio.serve_listeners` is not immediately | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 35 35 | trio.open_tcp_stream(foo, foo) 36 36 | trio.open_unix_socket(foo) 37 37 | trio.run_process(foo) @@ -189,6 +205,8 @@ ASYNC105.py:38:5: ASYNC105 [*] Call to `trio.serve_listeners` is not immediately 40 40 | trio.serve_tcp(foo, foo) 41 41 | trio.sleep(foo) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:39:5: ASYNC105 [*] Call to `trio.serve_ssl_over_tcp` is not immediately awaited | 37 | trio.run_process(foo) @@ -200,7 +218,7 @@ ASYNC105.py:39:5: ASYNC105 [*] Call to `trio.serve_ssl_over_tcp` is not immediat | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 36 36 | trio.open_unix_socket(foo) 37 37 | trio.run_process(foo) 38 38 | trio.serve_listeners(foo, foo) @@ -210,6 +228,8 @@ ASYNC105.py:39:5: ASYNC105 [*] Call to `trio.serve_ssl_over_tcp` is not immediat 41 41 | trio.sleep(foo) 42 42 | trio.sleep_forever() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:40:5: ASYNC105 [*] Call to `trio.serve_tcp` is not immediately awaited | 38 | trio.serve_listeners(foo, foo) @@ -221,7 +241,7 @@ ASYNC105.py:40:5: ASYNC105 [*] Call to `trio.serve_tcp` is not immediately await | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 37 37 | trio.run_process(foo) 38 38 | trio.serve_listeners(foo, foo) 39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) @@ -231,6 +251,8 @@ ASYNC105.py:40:5: ASYNC105 [*] Call to `trio.serve_tcp` is not immediately await 42 42 | trio.sleep_forever() 43 43 | trio.sleep_until(foo) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:41:5: ASYNC105 [*] Call to `trio.sleep` is not immediately awaited | 39 | trio.serve_ssl_over_tcp(foo, foo, foo) @@ -242,7 +264,7 @@ ASYNC105.py:41:5: ASYNC105 [*] Call to `trio.sleep` is not immediately awaited | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 38 38 | trio.serve_listeners(foo, foo) 39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) 40 40 | trio.serve_tcp(foo, foo) @@ -252,6 +274,8 @@ ASYNC105.py:41:5: ASYNC105 [*] Call to `trio.sleep` is not immediately awaited 43 43 | trio.sleep_until(foo) 44 44 | trio.lowlevel.cancel_shielded_checkpoint() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:42:5: ASYNC105 [*] Call to `trio.sleep_forever` is not immediately awaited | 40 | trio.serve_tcp(foo, foo) @@ -263,7 +287,7 @@ ASYNC105.py:42:5: ASYNC105 [*] Call to `trio.sleep_forever` is not immediately a | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) 40 40 | trio.serve_tcp(foo, foo) 41 41 | trio.sleep(foo) @@ -273,6 +297,8 @@ ASYNC105.py:42:5: ASYNC105 [*] Call to `trio.sleep_forever` is not immediately a 44 44 | trio.lowlevel.cancel_shielded_checkpoint() 45 45 | trio.lowlevel.checkpoint() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:44:5: ASYNC105 [*] Call to `trio.lowlevel.cancel_shielded_checkpoint` is not immediately awaited | 42 | trio.sleep_forever() @@ -284,7 +310,7 @@ ASYNC105.py:44:5: ASYNC105 [*] Call to `trio.lowlevel.cancel_shielded_checkpoint | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 41 41 | trio.sleep(foo) 42 42 | trio.sleep_forever() 43 43 | trio.sleep_until(foo) @@ -294,6 +320,8 @@ ASYNC105.py:44:5: ASYNC105 [*] Call to `trio.lowlevel.cancel_shielded_checkpoint 46 46 | trio.lowlevel.checkpoint_if_cancelled() 47 47 | trio.lowlevel.open_process() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:45:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint` is not immediately awaited | 43 | trio.sleep_until(foo) @@ -305,7 +333,7 @@ ASYNC105.py:45:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint` is not immedia | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 42 42 | trio.sleep_forever() 43 43 | trio.sleep_until(foo) 44 44 | trio.lowlevel.cancel_shielded_checkpoint() @@ -315,6 +343,8 @@ ASYNC105.py:45:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint` is not immedia 47 47 | trio.lowlevel.open_process() 48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:46:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint_if_cancelled` is not immediately awaited | 44 | trio.lowlevel.cancel_shielded_checkpoint() @@ -326,7 +356,7 @@ ASYNC105.py:46:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint_if_cancelled` i | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 43 43 | trio.sleep_until(foo) 44 44 | trio.lowlevel.cancel_shielded_checkpoint() 45 45 | trio.lowlevel.checkpoint() @@ -336,6 +366,8 @@ ASYNC105.py:46:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint_if_cancelled` i 48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) 49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:47:5: ASYNC105 [*] Call to `trio.lowlevel.open_process` is not immediately awaited | 45 | trio.lowlevel.checkpoint() @@ -347,7 +379,7 @@ ASYNC105.py:47:5: ASYNC105 [*] Call to `trio.lowlevel.open_process` is not immed | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 44 44 | trio.lowlevel.cancel_shielded_checkpoint() 45 45 | trio.lowlevel.checkpoint() 46 46 | trio.lowlevel.checkpoint_if_cancelled() @@ -357,6 +389,8 @@ ASYNC105.py:47:5: ASYNC105 [*] Call to `trio.lowlevel.open_process` is not immed 49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) 50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:48:5: ASYNC105 [*] Call to `trio.lowlevel.permanently_detach_coroutine_object` is not immediately awaited | 46 | trio.lowlevel.checkpoint_if_cancelled() @@ -368,7 +402,7 @@ ASYNC105.py:48:5: ASYNC105 [*] Call to `trio.lowlevel.permanently_detach_corouti | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 45 45 | trio.lowlevel.checkpoint() 46 46 | trio.lowlevel.checkpoint_if_cancelled() 47 47 | trio.lowlevel.open_process() @@ -378,6 +412,8 @@ ASYNC105.py:48:5: ASYNC105 [*] Call to `trio.lowlevel.permanently_detach_corouti 50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) 51 51 | trio.lowlevel.wait_readable(foo) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:49:5: ASYNC105 [*] Call to `trio.lowlevel.reattach_detached_coroutine_object` is not immediately awaited | 47 | trio.lowlevel.open_process() @@ -389,7 +425,7 @@ ASYNC105.py:49:5: ASYNC105 [*] Call to `trio.lowlevel.reattach_detached_coroutin | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 46 46 | trio.lowlevel.checkpoint_if_cancelled() 47 47 | trio.lowlevel.open_process() 48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) @@ -399,6 +435,8 @@ ASYNC105.py:49:5: ASYNC105 [*] Call to `trio.lowlevel.reattach_detached_coroutin 51 51 | trio.lowlevel.wait_readable(foo) 52 52 | trio.lowlevel.wait_task_rescheduled(foo) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:50:5: ASYNC105 [*] Call to `trio.lowlevel.temporarily_detach_coroutine_object` is not immediately awaited | 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) @@ -410,7 +448,7 @@ ASYNC105.py:50:5: ASYNC105 [*] Call to `trio.lowlevel.temporarily_detach_corouti | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 47 47 | trio.lowlevel.open_process() 48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) 49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) @@ -420,6 +458,8 @@ ASYNC105.py:50:5: ASYNC105 [*] Call to `trio.lowlevel.temporarily_detach_corouti 52 52 | trio.lowlevel.wait_task_rescheduled(foo) 53 53 | trio.lowlevel.wait_writable(foo) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:51:5: ASYNC105 [*] Call to `trio.lowlevel.wait_readable` is not immediately awaited | 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) @@ -431,7 +471,7 @@ ASYNC105.py:51:5: ASYNC105 [*] Call to `trio.lowlevel.wait_readable` is not imme | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) 49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) 50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) @@ -441,6 +481,8 @@ ASYNC105.py:51:5: ASYNC105 [*] Call to `trio.lowlevel.wait_readable` is not imme 53 53 | trio.lowlevel.wait_writable(foo) 54 54 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:52:5: ASYNC105 [*] Call to `trio.lowlevel.wait_task_rescheduled` is not immediately awaited | 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) @@ -451,7 +493,7 @@ ASYNC105.py:52:5: ASYNC105 [*] Call to `trio.lowlevel.wait_task_rescheduled` is | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) 50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) 51 51 | trio.lowlevel.wait_readable(foo) @@ -461,6 +503,8 @@ ASYNC105.py:52:5: ASYNC105 [*] Call to `trio.lowlevel.wait_task_rescheduled` is 54 54 | 55 55 | async with await trio.open_file(foo): # Ok + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:53:5: ASYNC105 [*] Call to `trio.lowlevel.wait_writable` is not immediately awaited | 51 | trio.lowlevel.wait_readable(foo) @@ -472,7 +516,7 @@ ASYNC105.py:53:5: ASYNC105 [*] Call to `trio.lowlevel.wait_writable` is not imme | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) 51 51 | trio.lowlevel.wait_readable(foo) 52 52 | trio.lowlevel.wait_task_rescheduled(foo) @@ -482,6 +526,8 @@ ASYNC105.py:53:5: ASYNC105 [*] Call to `trio.lowlevel.wait_writable` is not imme 55 55 | async with await trio.open_file(foo): # Ok 56 56 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:58:16: ASYNC105 [*] Call to `trio.open_file` is not immediately awaited | 56 | pass @@ -492,7 +538,7 @@ ASYNC105.py:58:16: ASYNC105 [*] Call to `trio.open_file` is not immediately awai | = help: Add `await` -ℹ Unsafe fix +Suggested fix: 55 55 | async with await trio.open_file(foo): # Ok 56 56 | pass 57 57 | @@ -502,6 +548,8 @@ ASYNC105.py:58:16: ASYNC105 [*] Call to `trio.open_file` is not immediately awai 60 60 | 61 61 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC105.py:64:5: ASYNC105 Call to `trio.open_file` is not immediately awaited | 62 | def func() -> None: diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap index 71d341d400af1..4061b60b4e001 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap @@ -12,7 +12,7 @@ ASYNC115.py:5:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio | = help: Replace with `trio.lowlevel.checkpoint()` -ℹ Safe fix +Suggested fix: 2 2 | import trio 3 3 | from trio import sleep 4 4 | @@ -22,6 +22,8 @@ ASYNC115.py:5:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 7 7 | await trio.sleep(0, 1) # OK 8 8 | await trio.sleep(...) # OK + Run `ruff check --fix` to apply this fix. + ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 9 | await trio.sleep() # OK @@ -33,7 +35,7 @@ ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio | = help: Replace with `trio.lowlevel.checkpoint()` -ℹ Safe fix +Suggested fix: 8 8 | await trio.sleep(...) # OK 9 9 | await trio.sleep() # OK 10 10 | @@ -43,6 +45,8 @@ ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 13 13 | trio.sleep(foo) # OK 14 14 | trio.sleep(1) # OK + Run `ruff check --fix` to apply this fix. + ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 15 | time.sleep(0) # OK @@ -54,7 +58,7 @@ ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio | = help: Replace with `trio.lowlevel.checkpoint()` -ℹ Safe fix +Suggested fix: 14 14 | trio.sleep(1) # OK 15 15 | time.sleep(0) # OK 16 16 | @@ -64,6 +68,8 @@ ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 19 19 | bar = "bar" 20 20 | trio.sleep(bar) + Run `ruff check --fix` to apply this fix. + ASYNC115.py:48:14: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 46 | import trio @@ -73,7 +79,7 @@ ASYNC115.py:48:14: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri | = help: Replace with `trio.lowlevel.checkpoint()` -ℹ Safe fix +Suggested fix: 45 45 | def func(): 46 46 | import trio 47 47 | @@ -83,6 +89,8 @@ ASYNC115.py:48:14: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri 50 50 | 51 51 | from trio import Event, sleep + Run `ruff check --fix` to apply this fix. + ASYNC115.py:55:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 54 | def func(): @@ -91,7 +99,7 @@ ASYNC115.py:55:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio | = help: Replace with `trio.lowlevel.checkpoint()` -ℹ Safe fix +Suggested fix: 48 48 | trio.run(trio.sleep(0)) # ASYNC115 49 49 | 50 50 | @@ -106,6 +114,8 @@ ASYNC115.py:55:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 57 57 | 58 58 | async def func(): + Run `ruff check --fix` to apply this fix. + ASYNC115.py:59:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 58 | async def func(): @@ -114,7 +124,7 @@ ASYNC115.py:59:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri | = help: Replace with `trio.lowlevel.checkpoint()` -ℹ Safe fix +Suggested fix: 48 48 | trio.run(trio.sleep(0)) # ASYNC115 49 49 | 50 50 | @@ -132,3 +142,5 @@ ASYNC115.py:59:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri 60 60 | 61 61 | 62 62 | def func(): + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap index 83b6209e1dfd1..69b286e59012a 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap @@ -11,7 +11,7 @@ ASYNC116.py:11:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 8 8 | import trio 9 9 | 10 10 | # These examples are probably not meant to ever wake up: @@ -21,6 +21,8 @@ ASYNC116.py:11:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu 13 13 | # 'inf literal' overflow trick 14 14 | await trio.sleep(1e999) # error: 116, "async" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:14:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | 13 | # 'inf literal' overflow trick @@ -31,7 +33,7 @@ ASYNC116.py:14:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 11 11 | await trio.sleep(100000) # error: 116, "async" 12 12 | 13 13 | # 'inf literal' overflow trick @@ -41,6 +43,8 @@ ASYNC116.py:14:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu 16 16 | await trio.sleep(86399) 17 17 | await trio.sleep(86400) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:18:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | 16 | await trio.sleep(86399) @@ -51,7 +55,7 @@ ASYNC116.py:18:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 15 15 | 16 16 | await trio.sleep(86399) 17 17 | await trio.sleep(86400) @@ -61,6 +65,8 @@ ASYNC116.py:18:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu 20 20 | 21 21 | await trio.sleep(-1) # will raise a runtime error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:19:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | 17 | await trio.sleep(86400) @@ -72,7 +78,7 @@ ASYNC116.py:19:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 16 16 | await trio.sleep(86399) 17 17 | await trio.sleep(86400) 18 18 | await trio.sleep(86400.01) # error: 116, "async" @@ -82,6 +88,8 @@ ASYNC116.py:19:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu 21 21 | await trio.sleep(-1) # will raise a runtime error 22 22 | await trio.sleep(0) # handled by different check + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:48:5: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | 47 | # does not require the call to be awaited, nor in an async fun @@ -92,7 +100,7 @@ ASYNC116.py:48:5: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usua | = help: Replace with `trio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 45 45 | import trio 46 46 | 47 47 | # does not require the call to be awaited, nor in an async fun @@ -102,6 +110,8 @@ ASYNC116.py:48:5: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usua 50 50 | trio.run(trio.sleep(86401)) # error: 116, "async" 51 51 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:50:14: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | 48 | trio.sleep(86401) # error: 116, "async" @@ -111,7 +121,7 @@ ASYNC116.py:50:14: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 47 47 | # does not require the call to be awaited, nor in an async fun 48 48 | trio.sleep(86401) # error: 116, "async" 49 49 | # also checks that we don't break visit_Call @@ -121,6 +131,8 @@ ASYNC116.py:50:14: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu 52 52 | 53 53 | async def import_from_trio(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:57:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | 56 | # catch from import @@ -129,7 +141,7 @@ ASYNC116.py:57:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf @@ -146,3 +158,5 @@ ASYNC116.py:57:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu 58 59 | 59 60 | 60 61 | async def import_anyio(): + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC115_ASYNC115.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC115_ASYNC115.py.snap index 3e40da955dd3e..2322ee4508926 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC115_ASYNC115.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC115_ASYNC115.py.snap @@ -12,7 +12,7 @@ ASYNC115.py:5:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio | = help: Replace with `trio.lowlevel.checkpoint()` -ℹ Safe fix +Suggested fix: 2 2 | import trio 3 3 | from trio import sleep 4 4 | @@ -22,6 +22,8 @@ ASYNC115.py:5:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 7 7 | await trio.sleep(0, 1) # OK 8 8 | await trio.sleep(...) # OK + Run `ruff check --fix` to apply this fix. + ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 9 | await trio.sleep() # OK @@ -33,7 +35,7 @@ ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio | = help: Replace with `trio.lowlevel.checkpoint()` -ℹ Safe fix +Suggested fix: 8 8 | await trio.sleep(...) # OK 9 9 | await trio.sleep() # OK 10 10 | @@ -43,6 +45,8 @@ ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 13 13 | trio.sleep(foo) # OK 14 14 | trio.sleep(1) # OK + Run `ruff check --fix` to apply this fix. + ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 15 | time.sleep(0) # OK @@ -54,7 +58,7 @@ ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio | = help: Replace with `trio.lowlevel.checkpoint()` -ℹ Safe fix +Suggested fix: 14 14 | trio.sleep(1) # OK 15 15 | time.sleep(0) # OK 16 16 | @@ -64,6 +68,8 @@ ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 19 19 | bar = "bar" 20 20 | trio.sleep(bar) + Run `ruff check --fix` to apply this fix. + ASYNC115.py:48:14: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 46 | import trio @@ -73,7 +79,7 @@ ASYNC115.py:48:14: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri | = help: Replace with `trio.lowlevel.checkpoint()` -ℹ Safe fix +Suggested fix: 45 45 | def func(): 46 46 | import trio 47 47 | @@ -83,6 +89,8 @@ ASYNC115.py:48:14: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri 50 50 | 51 51 | from trio import Event, sleep + Run `ruff check --fix` to apply this fix. + ASYNC115.py:55:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 54 | def func(): @@ -91,7 +99,7 @@ ASYNC115.py:55:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio | = help: Replace with `trio.lowlevel.checkpoint()` -ℹ Safe fix +Suggested fix: 48 48 | trio.run(trio.sleep(0)) # ASYNC115 49 49 | 50 50 | @@ -106,6 +114,8 @@ ASYNC115.py:55:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 57 57 | 58 58 | async def func(): + Run `ruff check --fix` to apply this fix. + ASYNC115.py:59:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 58 | async def func(): @@ -114,7 +124,7 @@ ASYNC115.py:59:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri | = help: Replace with `trio.lowlevel.checkpoint()` -ℹ Safe fix +Suggested fix: 48 48 | trio.run(trio.sleep(0)) # ASYNC115 49 49 | 50 50 | @@ -133,6 +143,8 @@ ASYNC115.py:59:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri 61 61 | 62 62 | def func(): + Run `ruff check --fix` to apply this fix. + ASYNC115.py:85:11: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` | 83 | from anyio import sleep @@ -144,7 +156,7 @@ ASYNC115.py:85:11: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of ` | = help: Replace with `asyncio.lowlevel.checkpoint()` -ℹ Safe fix +Suggested fix: 49 49 | 50 50 | 51 51 | from trio import Event, sleep @@ -162,6 +174,8 @@ ASYNC115.py:85:11: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of ` 87 88 | await anyio.sleep(0, 1) # OK 88 89 | await anyio.sleep(...) # OK + Run `ruff check --fix` to apply this fix. + ASYNC115.py:91:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` | 89 | await anyio.sleep() # OK @@ -173,7 +187,7 @@ ASYNC115.py:91:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `a | = help: Replace with `asyncio.lowlevel.checkpoint()` -ℹ Safe fix +Suggested fix: 49 49 | 50 50 | 51 51 | from trio import Event, sleep @@ -191,6 +205,8 @@ ASYNC115.py:91:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `a 93 94 | anyio.sleep(foo) # OK 94 95 | anyio.sleep(1) # OK + Run `ruff check --fix` to apply this fix. + ASYNC115.py:97:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` | 95 | time.sleep(0) # OK @@ -202,7 +218,7 @@ ASYNC115.py:97:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `a | = help: Replace with `asyncio.lowlevel.checkpoint()` -ℹ Safe fix +Suggested fix: 49 49 | 50 50 | 51 51 | from trio import Event, sleep @@ -220,6 +236,8 @@ ASYNC115.py:97:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `a 99 100 | bar = "bar" 100 101 | anyio.sleep(bar) + Run `ruff check --fix` to apply this fix. + ASYNC115.py:128:15: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` | 126 | import anyio @@ -229,7 +247,7 @@ ASYNC115.py:128:15: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of | = help: Replace with `asyncio.lowlevel.checkpoint()` -ℹ Safe fix +Suggested fix: 49 49 | 50 50 | 51 51 | from trio import Event, sleep @@ -246,3 +264,5 @@ ASYNC115.py:128:15: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of 129 130 | 130 131 | 131 132 | def func(): + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC116_ASYNC116.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC116_ASYNC116.py.snap index 3421bd0105a7d..052673fcb2fd4 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC116_ASYNC116.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC116_ASYNC116.py.snap @@ -11,7 +11,7 @@ ASYNC116.py:11:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 8 8 | import trio 9 9 | 10 10 | # These examples are probably not meant to ever wake up: @@ -21,6 +21,8 @@ ASYNC116.py:11:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu 13 13 | # 'inf literal' overflow trick 14 14 | await trio.sleep(1e999) # error: 116, "async" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:14:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | 13 | # 'inf literal' overflow trick @@ -31,7 +33,7 @@ ASYNC116.py:14:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 11 11 | await trio.sleep(100000) # error: 116, "async" 12 12 | 13 13 | # 'inf literal' overflow trick @@ -41,6 +43,8 @@ ASYNC116.py:14:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu 16 16 | await trio.sleep(86399) 17 17 | await trio.sleep(86400) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:18:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | 16 | await trio.sleep(86399) @@ -51,7 +55,7 @@ ASYNC116.py:18:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 15 15 | 16 16 | await trio.sleep(86399) 17 17 | await trio.sleep(86400) @@ -61,6 +65,8 @@ ASYNC116.py:18:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu 20 20 | 21 21 | await trio.sleep(-1) # will raise a runtime error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:19:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | 17 | await trio.sleep(86400) @@ -72,7 +78,7 @@ ASYNC116.py:19:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 16 16 | await trio.sleep(86399) 17 17 | await trio.sleep(86400) 18 18 | await trio.sleep(86400.01) # error: 116, "async" @@ -82,6 +88,8 @@ ASYNC116.py:19:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu 21 21 | await trio.sleep(-1) # will raise a runtime error 22 22 | await trio.sleep(0) # handled by different check + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:48:5: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | 47 | # does not require the call to be awaited, nor in an async fun @@ -92,7 +100,7 @@ ASYNC116.py:48:5: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usua | = help: Replace with `trio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 45 45 | import trio 46 46 | 47 47 | # does not require the call to be awaited, nor in an async fun @@ -102,6 +110,8 @@ ASYNC116.py:48:5: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usua 50 50 | trio.run(trio.sleep(86401)) # error: 116, "async" 51 51 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:50:14: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | 48 | trio.sleep(86401) # error: 116, "async" @@ -111,7 +121,7 @@ ASYNC116.py:50:14: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 47 47 | # does not require the call to be awaited, nor in an async fun 48 48 | trio.sleep(86401) # error: 116, "async" 49 49 | # also checks that we don't break visit_Call @@ -121,6 +131,8 @@ ASYNC116.py:50:14: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu 52 52 | 53 53 | async def import_from_trio(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:57:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | 56 | # catch from import @@ -129,7 +141,7 @@ ASYNC116.py:57:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf @@ -147,6 +159,8 @@ ASYNC116.py:57:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu 59 60 | 60 61 | async def import_anyio(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:64:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` | 63 | # These examples are probably not meant to ever wake up: @@ -157,7 +171,7 @@ ASYNC116.py:64:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf @@ -175,6 +189,8 @@ ASYNC116.py:64:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should 66 67 | # 'inf literal' overflow trick 67 68 | await anyio.sleep(1e999) # error: 116, "async" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:67:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` | 66 | # 'inf literal' overflow trick @@ -185,7 +201,7 @@ ASYNC116.py:67:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf @@ -203,6 +219,8 @@ ASYNC116.py:67:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should 69 70 | await anyio.sleep(86399) 70 71 | await anyio.sleep(86400) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:71:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` | 69 | await anyio.sleep(86399) @@ -213,7 +231,7 @@ ASYNC116.py:71:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf @@ -231,6 +249,8 @@ ASYNC116.py:71:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should 73 74 | 74 75 | await anyio.sleep(-1) # will raise a runtime error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:72:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` | 70 | await anyio.sleep(86400) @@ -242,7 +262,7 @@ ASYNC116.py:72:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf @@ -260,6 +280,8 @@ ASYNC116.py:72:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should 74 75 | await anyio.sleep(-1) # will raise a runtime error 75 76 | await anyio.sleep(0) # handled by different check + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:101:5: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` | 100 | # does not require the call to be awaited, nor in an async fun @@ -270,7 +292,7 @@ ASYNC116.py:101:5: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf @@ -288,6 +310,8 @@ ASYNC116.py:101:5: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should 103 104 | anyio.run(anyio.sleep(86401)) # error: 116, "async" 104 105 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:103:15: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` | 101 | anyio.sleep(86401) # error: 116, "async" @@ -297,7 +321,7 @@ ASYNC116.py:103:15: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf @@ -315,6 +339,8 @@ ASYNC116.py:103:15: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should 105 106 | 106 107 | async def import_from_anyio(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + ASYNC116.py:110:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` | 109 | # catch from import @@ -323,7 +349,7 @@ ASYNC116.py:110:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -ℹ Unsafe fix +Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf @@ -337,3 +363,5 @@ ASYNC116.py:110:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should 109 110 | # catch from import 110 |- await sleep(86401) # error: 116, "async" 111 |+ await sleep_forever() # error: 116, "async" + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B004_B004.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B004_B004.py.snap index da4177d024b9f..4aa58646ed94e 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B004_B004.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B004_B004.py.snap @@ -12,7 +12,7 @@ B004.py:3:8: B004 [*] Using `hasattr(x, "__call__")` to test if x is callable is | = help: Replace with `callable()` -ℹ Safe fix +Suggested fix: 1 1 | def this_is_a_bug(): 2 2 | o = object() 3 |- if hasattr(o, "__call__"): @@ -21,6 +21,8 @@ B004.py:3:8: B004 [*] Using `hasattr(x, "__call__")` to test if x is callable is 5 5 | if getattr(o, "__call__", False): 6 6 | print("Ooh, callable! Or is it?") + Run `ruff check --fix` to apply this fix. + B004.py:5:8: B004 Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results. | 3 | if hasattr(o, "__call__"): @@ -42,7 +44,7 @@ B004.py:12:8: B004 [*] Using `hasattr(x, "__call__")` to test if x is callable i | = help: Replace with `callable()` -ℹ Safe fix +Suggested fix: 9 9 | def still_a_bug(): 10 10 | import builtins 11 11 | o = object() @@ -52,6 +54,8 @@ B004.py:12:8: B004 [*] Using `hasattr(x, "__call__")` to test if x is callable i 14 14 | if builtins.getattr(o, "__call__", False): 15 15 | print("B U G") + Run `ruff check --fix` to apply this fix. + B004.py:14:8: B004 Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results. | 12 | if builtins.hasattr(o, "__call__"): @@ -72,7 +76,7 @@ B004.py:24:8: B004 [*] Using `hasattr(x, "__call__")` to test if x is callable i | = help: Replace with `callable()` -ℹ Safe fix +Suggested fix: 1 |+import builtins 1 2 | def this_is_a_bug(): 2 3 | o = object() @@ -85,4 +89,6 @@ B004.py:24:8: B004 [*] Using `hasattr(x, "__call__")` to test if x is callable i 25 |+ if builtins.callable(o): 25 26 | print("STILL a bug!") 26 27 | -27 28 | +27 28 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap index 1456ef463102a..6407011a0e16d 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap @@ -12,10 +12,12 @@ B006_1.py:3:22: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 1 1 | # Docstring followed by a newline 2 2 | 3 |-def foobar(foor, bar={}): 3 |+def foobar(foor, bar=None): 4 4 | """ 5 5 | """ + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap index c050ac73b7212..453ae719c0b6e 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap @@ -12,11 +12,13 @@ B006_2.py:4:22: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 1 1 | # Docstring followed by whitespace with no newline 2 2 | # Regression test for https://github.com/astral-sh/ruff/issues/7155 3 3 | 4 |-def foobar(foor, bar={}): 4 |+def foobar(foor, bar=None): 5 5 | """ -6 6 | """ +6 6 | """ + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap index 583e51b5a7cd7..c6f48a23e6432 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap @@ -10,7 +10,7 @@ B006_3.py:4:22: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 1 1 | # Docstring with no newline 2 2 | 3 3 | @@ -18,3 +18,5 @@ B006_3.py:4:22: B006 [*] Do not use mutable data structures for argument default 4 |+def foobar(foor, bar=None): 5 5 | """ 6 6 | """ + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap index 2494c15ac42ef..e8dc1edc4c304 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap @@ -10,7 +10,7 @@ B006_4.py:7:26: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 4 4 | 5 5 | 6 6 | class FormFeedIndent: @@ -21,4 +21,4 @@ B006_4.py:7:26: B006 [*] Do not use mutable data structures for argument default 8 10 | print(a) 9 11 | - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap index 24ad24f06b524..e2522cae40874 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap @@ -9,7 +9,7 @@ B006_5.py:5:49: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 2 2 | # https://github.com/astral-sh/ruff/issues/7616 3 3 | 4 4 | @@ -22,6 +22,8 @@ B006_5.py:5:49: B006 [*] Do not use mutable data structures for argument default 8 10 | 9 11 | def import_module_with_values_wrong(value: dict[str, str] = {}): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_5.py:9:61: B006 [*] Do not use mutable data structures for argument defaults | 9 | def import_module_with_values_wrong(value: dict[str, str] = {}): @@ -30,7 +32,7 @@ B006_5.py:9:61: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 6 6 | import os 7 7 | 8 8 | @@ -44,6 +46,8 @@ B006_5.py:9:61: B006 [*] Do not use mutable data structures for argument default 13 15 | 14 16 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_5.py:15:50: B006 [*] Do not use mutable data structures for argument defaults | 15 | def import_modules_wrong(value: dict[str, str] = {}): @@ -53,7 +57,7 @@ B006_5.py:15:50: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 12 12 | return 2 13 13 | 14 14 | @@ -68,6 +72,8 @@ B006_5.py:15:50: B006 [*] Do not use mutable data structures for argument defaul 20 22 | 21 23 | def from_import_module_wrong(value: dict[str, str] = {}): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_5.py:21:54: B006 [*] Do not use mutable data structures for argument defaults | 21 | def from_import_module_wrong(value: dict[str, str] = {}): @@ -76,7 +82,7 @@ B006_5.py:21:54: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 18 18 | import itertools 19 19 | 20 20 | @@ -89,6 +95,8 @@ B006_5.py:21:54: B006 [*] Do not use mutable data structures for argument defaul 24 26 | 25 27 | def from_imports_module_wrong(value: dict[str, str] = {}): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_5.py:25:55: B006 [*] Do not use mutable data structures for argument defaults | 25 | def from_imports_module_wrong(value: dict[str, str] = {}): @@ -98,7 +106,7 @@ B006_5.py:25:55: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 22 22 | from os import path 23 23 | 24 24 | @@ -112,6 +120,8 @@ B006_5.py:25:55: B006 [*] Do not use mutable data structures for argument defaul 29 31 | 30 32 | def import_and_from_imports_module_wrong(value: dict[str, str] = {}): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_5.py:30:66: B006 [*] Do not use mutable data structures for argument defaults | 30 | def import_and_from_imports_module_wrong(value: dict[str, str] = {}): @@ -121,7 +131,7 @@ B006_5.py:30:66: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 27 27 | from sys import version_info 28 28 | 29 29 | @@ -135,6 +145,8 @@ B006_5.py:30:66: B006 [*] Do not use mutable data structures for argument defaul 34 36 | 35 37 | def import_docstring_module_wrong(value: dict[str, str] = {}): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_5.py:35:59: B006 [*] Do not use mutable data structures for argument defaults | 35 | def import_docstring_module_wrong(value: dict[str, str] = {}): @@ -144,7 +156,7 @@ B006_5.py:35:59: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 32 32 | from sys import version_info 33 33 | 34 34 | @@ -158,6 +170,8 @@ B006_5.py:35:59: B006 [*] Do not use mutable data structures for argument defaul 39 41 | 40 42 | def import_module_wrong(value: dict[str, str] = {}): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_5.py:40:49: B006 [*] Do not use mutable data structures for argument defaults | 40 | def import_module_wrong(value: dict[str, str] = {}): @@ -167,7 +181,7 @@ B006_5.py:40:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 37 37 | import os 38 38 | 39 39 | @@ -181,6 +195,8 @@ B006_5.py:40:49: B006 [*] Do not use mutable data structures for argument defaul 44 46 | 45 47 | def import_module_wrong(value: dict[str, str] = {}): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_5.py:45:49: B006 [*] Do not use mutable data structures for argument defaults | 45 | def import_module_wrong(value: dict[str, str] = {}): @@ -190,7 +206,7 @@ B006_5.py:45:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 42 42 | import os; import sys 43 43 | 44 44 | @@ -203,6 +219,8 @@ B006_5.py:45:49: B006 [*] Do not use mutable data structures for argument defaul 48 50 | 49 51 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_5.py:50:49: B006 [*] Do not use mutable data structures for argument defaults | 50 | def import_module_wrong(value: dict[str, str] = {}): @@ -212,7 +230,7 @@ B006_5.py:50:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 47 47 | import os; import sys; x = 1 48 48 | 49 49 | @@ -226,6 +244,8 @@ B006_5.py:50:49: B006 [*] Do not use mutable data structures for argument defaul 54 56 | 55 57 | def import_module_wrong(value: dict[str, str] = {}): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_5.py:55:49: B006 [*] Do not use mutable data structures for argument defaults | 55 | def import_module_wrong(value: dict[str, str] = {}): @@ -234,7 +254,7 @@ B006_5.py:55:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 52 52 | import os; import sys 53 53 | 54 54 | @@ -247,6 +267,8 @@ B006_5.py:55:49: B006 [*] Do not use mutable data structures for argument defaul 58 60 | 59 61 | def import_module_wrong(value: dict[str, str] = {}): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_5.py:59:49: B006 [*] Do not use mutable data structures for argument defaults | 59 | def import_module_wrong(value: dict[str, str] = {}): @@ -255,7 +277,7 @@ B006_5.py:59:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 56 56 | import os; import sys 57 57 | 58 58 | @@ -267,6 +289,8 @@ B006_5.py:59:49: B006 [*] Do not use mutable data structures for argument defaul 61 63 | 62 64 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_5.py:63:49: B006 [*] Do not use mutable data structures for argument defaults | 63 | def import_module_wrong(value: dict[str, str] = {}): @@ -275,7 +299,7 @@ B006_5.py:63:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 60 60 | import os; import sys; x = 1 61 61 | 62 62 | @@ -288,6 +312,8 @@ B006_5.py:63:49: B006 [*] Do not use mutable data structures for argument defaul 66 68 | 67 69 | def import_module_wrong(value: dict[str, str] = {}): import os + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_5.py:67:49: B006 Do not use mutable data structures for argument defaults | 67 | def import_module_wrong(value: dict[str, str] = {}): import os @@ -309,5 +335,3 @@ B006_5.py:73:49: B006 Do not use mutable data structures for argument defaults 74 | import os | = help: Replace with `None`; initialize within function - - diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap index 032ad0e13259d..551e22d66699d 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap @@ -11,7 +11,7 @@ B006_6.py:4:22: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 1 1 | # Import followed by whitespace with no newline 2 2 | # Same as B006_2.py, but import instead of docstring 3 3 | @@ -22,4 +22,4 @@ B006_6.py:4:22: B006 [*] Do not use mutable data structures for argument default 6 |+ if bar is None: 7 |+ bar = {} - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap index 05fdbd20f189d..e763933a54f9a 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap @@ -11,7 +11,7 @@ B006_7.py:4:22: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 1 1 | # Import with no newline 2 2 | # Same as B006_3.py, but import instead of docstring 3 3 | @@ -22,4 +22,4 @@ B006_7.py:4:22: B006 [*] Do not use mutable data structures for argument default 6 |+ if bar is None: 7 |+ bar = {} - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_8.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_8.py.snap index 866643aa45474..8a8f30fc6ebd1 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_8.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_8.py.snap @@ -9,13 +9,15 @@ B006_8.py:1:19: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 1 |-def foo(a: list = []): 1 |+def foo(a: list = None): 2 2 | raise NotImplementedError("") 3 3 | 4 4 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_8.py:5:19: B006 [*] Do not use mutable data structures for argument defaults | 5 | def bar(a: dict = {}): @@ -25,7 +27,7 @@ B006_8.py:5:19: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 2 2 | raise NotImplementedError("") 3 3 | 4 4 | @@ -35,6 +37,8 @@ B006_8.py:5:19: B006 [*] Do not use mutable data structures for argument default 7 7 | raise NotImplementedError("and has some text in here") 8 8 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_8.py:10:19: B006 [*] Do not use mutable data structures for argument defaults | 10 | def baz(a: list = []): @@ -44,7 +48,7 @@ B006_8.py:10:19: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 7 7 | raise NotImplementedError("and has some text in here") 8 8 | 9 9 | @@ -57,6 +61,8 @@ B006_8.py:10:19: B006 [*] Do not use mutable data structures for argument defaul 13 15 | 14 16 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_8.py:15:19: B006 [*] Do not use mutable data structures for argument defaults | 15 | def qux(a: list = []): @@ -65,7 +71,7 @@ B006_8.py:15:19: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 12 12 | raise IndexError() 13 13 | 14 14 | @@ -75,6 +81,8 @@ B006_8.py:15:19: B006 [*] Do not use mutable data structures for argument defaul 17 17 | 18 18 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_8.py:19:20: B006 [*] Do not use mutable data structures for argument defaults | 19 | def quux(a: list = []): @@ -83,10 +91,12 @@ B006_8.py:19:20: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 16 16 | raise NotImplementedError 17 17 | 18 18 | 19 |-def quux(a: list = []): 19 |+def quux(a: list = None): 20 20 | raise NotImplemented + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap index 5627954be4cd2..06982176f119b 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap @@ -9,7 +9,7 @@ B006_B008.py:63:25: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 60 60 | # Flag mutable literals/comprehensions 61 61 | 62 62 | @@ -19,6 +19,8 @@ B006_B008.py:63:25: B006 [*] Do not use mutable data structures for argument def 65 65 | 66 66 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:67:30: B006 [*] Do not use mutable data structures for argument defaults | 67 | def this_is_also_wrong(value={}): @@ -27,7 +29,7 @@ B006_B008.py:67:30: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 64 64 | ... 65 65 | 66 66 | @@ -37,6 +39,8 @@ B006_B008.py:67:30: B006 [*] Do not use mutable data structures for argument def 69 69 | 70 70 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:73:52: B006 [*] Do not use mutable data structures for argument defaults | 71 | class Foo: @@ -47,7 +51,7 @@ B006_B008.py:73:52: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 70 70 | 71 71 | class Foo: 72 72 | @staticmethod @@ -57,6 +61,8 @@ B006_B008.py:73:52: B006 [*] Do not use mutable data structures for argument def 75 75 | 76 76 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:77:31: B006 [*] Do not use mutable data structures for argument defaults | 77 | def multiline_arg_wrong(value={ @@ -68,7 +74,7 @@ B006_B008.py:77:31: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 74 74 | pass 75 75 | 76 76 | @@ -80,6 +86,8 @@ B006_B008.py:77:31: B006 [*] Do not use mutable data structures for argument def 81 79 | 82 80 | def single_line_func_wrong(value = {}): ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:82:36: B006 Do not use mutable data structures for argument defaults | 80 | ... @@ -97,7 +105,7 @@ B006_B008.py:85:20: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 82 82 | def single_line_func_wrong(value = {}): ... 83 83 | 84 84 | @@ -107,6 +115,8 @@ B006_B008.py:85:20: B006 [*] Do not use mutable data structures for argument def 87 87 | 88 88 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:89:20: B006 [*] Do not use mutable data structures for argument defaults | 89 | def this_too(value=collections.OrderedDict()): @@ -115,7 +125,7 @@ B006_B008.py:89:20: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 86 86 | ... 87 87 | 88 88 | @@ -125,6 +135,8 @@ B006_B008.py:89:20: B006 [*] Do not use mutable data structures for argument def 91 91 | 92 92 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:93:32: B006 [*] Do not use mutable data structures for argument defaults | 93 | async def async_this_too(value=collections.defaultdict()): @@ -133,7 +145,7 @@ B006_B008.py:93:32: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 90 90 | ... 91 91 | 92 92 | @@ -143,6 +155,8 @@ B006_B008.py:93:32: B006 [*] Do not use mutable data structures for argument def 95 95 | 96 96 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:97:26: B006 [*] Do not use mutable data structures for argument defaults | 97 | def dont_forget_me(value=collections.deque()): @@ -151,7 +165,7 @@ B006_B008.py:97:26: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 94 94 | ... 95 95 | 96 96 | @@ -161,6 +175,8 @@ B006_B008.py:97:26: B006 [*] Do not use mutable data structures for argument def 99 99 | 100 100 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:102:46: B006 [*] Do not use mutable data structures for argument defaults | 101 | # N.B. we're also flagging the function call in the comprehension @@ -170,7 +186,7 @@ B006_B008.py:102:46: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 99 99 | 100 100 | 101 101 | # N.B. we're also flagging the function call in the comprehension @@ -180,6 +196,8 @@ B006_B008.py:102:46: B006 [*] Do not use mutable data structures for argument de 104 104 | 105 105 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:106:46: B006 [*] Do not use mutable data structures for argument defaults | 106 | def dict_comprehension_also_not_okay(default={i: i**2 for i in range(3)}): @@ -188,7 +206,7 @@ B006_B008.py:106:46: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 103 103 | pass 104 104 | 105 105 | @@ -198,6 +216,8 @@ B006_B008.py:106:46: B006 [*] Do not use mutable data structures for argument de 108 108 | 109 109 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:110:45: B006 [*] Do not use mutable data structures for argument defaults | 110 | def set_comprehension_also_not_okay(default={i**2 for i in range(3)}): @@ -206,7 +226,7 @@ B006_B008.py:110:45: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 107 107 | pass 108 108 | 109 109 | @@ -216,6 +236,8 @@ B006_B008.py:110:45: B006 [*] Do not use mutable data structures for argument de 112 112 | 113 113 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:114:33: B006 [*] Do not use mutable data structures for argument defaults | 114 | def kwonlyargs_mutable(*, value=[]): @@ -224,7 +246,7 @@ B006_B008.py:114:33: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 111 111 | pass 112 112 | 113 113 | @@ -234,6 +256,8 @@ B006_B008.py:114:33: B006 [*] Do not use mutable data structures for argument de 116 116 | 117 117 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:239:20: B006 [*] Do not use mutable data structures for argument defaults | 237 | # B006 and B008 @@ -244,7 +268,7 @@ B006_B008.py:239:20: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 236 236 | 237 237 | # B006 and B008 238 238 | # We should handle arbitrary nesting of these B008. @@ -254,6 +278,8 @@ B006_B008.py:239:20: B006 [*] Do not use mutable data structures for argument de 241 241 | 242 242 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:276:27: B006 [*] Do not use mutable data structures for argument defaults | 275 | def mutable_annotations( @@ -264,7 +290,7 @@ B006_B008.py:276:27: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 273 273 | 274 274 | 275 275 | def mutable_annotations( @@ -274,6 +300,8 @@ B006_B008.py:276:27: B006 [*] Do not use mutable data structures for argument de 278 278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), 279 279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:277:35: B006 [*] Do not use mutable data structures for argument defaults | 275 | def mutable_annotations( @@ -285,7 +313,7 @@ B006_B008.py:277:35: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 274 274 | 275 275 | def mutable_annotations( 276 276 | a: list[int] | None = [], @@ -295,6 +323,8 @@ B006_B008.py:277:35: B006 [*] Do not use mutable data structures for argument de 279 279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), 280 280 | ): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:278:62: B006 [*] Do not use mutable data structures for argument defaults | 276 | a: list[int] | None = [], @@ -306,7 +336,7 @@ B006_B008.py:278:62: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 275 275 | def mutable_annotations( 276 276 | a: list[int] | None = [], 277 277 | b: Optional[Dict[int, int]] = {}, @@ -316,6 +346,8 @@ B006_B008.py:278:62: B006 [*] Do not use mutable data structures for argument de 280 280 | ): 281 281 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:279:80: B006 [*] Do not use mutable data structures for argument defaults | 277 | b: Optional[Dict[int, int]] = {}, @@ -327,7 +359,7 @@ B006_B008.py:279:80: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 276 276 | a: list[int] | None = [], 277 277 | b: Optional[Dict[int, int]] = {}, 278 278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), @@ -337,6 +369,8 @@ B006_B008.py:279:80: B006 [*] Do not use mutable data structures for argument de 281 281 | pass 282 282 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:284:52: B006 [*] Do not use mutable data structures for argument defaults | 284 | def single_line_func_wrong(value: dict[str, str] = {}): @@ -345,7 +379,7 @@ B006_B008.py:284:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 281 281 | pass 282 282 | 283 283 | @@ -355,6 +389,8 @@ B006_B008.py:284:52: B006 [*] Do not use mutable data structures for argument de 286 286 | 287 287 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:288:52: B006 [*] Do not use mutable data structures for argument defaults | 288 | def single_line_func_wrong(value: dict[str, str] = {}): @@ -364,7 +400,7 @@ B006_B008.py:288:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 285 285 | """Docstring""" 286 286 | 287 287 | @@ -374,6 +410,8 @@ B006_B008.py:288:52: B006 [*] Do not use mutable data structures for argument de 290 290 | ... 291 291 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:293:52: B006 [*] Do not use mutable data structures for argument defaults | 293 | def single_line_func_wrong(value: dict[str, str] = {}): @@ -382,7 +420,7 @@ B006_B008.py:293:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 290 290 | ... 291 291 | 292 292 | @@ -392,6 +430,8 @@ B006_B008.py:293:52: B006 [*] Do not use mutable data structures for argument de 295 295 | 296 296 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:297:52: B006 [*] Do not use mutable data structures for argument defaults | 297 | def single_line_func_wrong(value: dict[str, str] = {}): @@ -401,7 +441,7 @@ B006_B008.py:297:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 294 294 | """Docstring"""; ... 295 295 | 296 296 | @@ -411,6 +451,8 @@ B006_B008.py:297:52: B006 [*] Do not use mutable data structures for argument de 299 299 | ... 300 300 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:302:52: B006 [*] Do not use mutable data structures for argument defaults | 302 | def single_line_func_wrong(value: dict[str, str] = { @@ -422,7 +464,7 @@ B006_B008.py:302:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 299 299 | ... 300 300 | 301 301 | @@ -434,6 +476,8 @@ B006_B008.py:302:52: B006 [*] Do not use mutable data structures for argument de 306 304 | 307 305 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B006_B008.py:308:52: B006 Do not use mutable data structures for argument defaults | 308 | def single_line_func_wrong(value: dict[str, str] = {}) \ @@ -451,10 +495,12 @@ B006_B008.py:313:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 310 310 | """Docstring""" 311 311 | 312 312 | 313 |-def single_line_func_wrong(value: dict[str, str] = {}): 313 |+def single_line_func_wrong(value: dict[str, str] = None): 314 314 | """Docstring without newline""" + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap index 5f36888c89df6..ee2aa19375899 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap @@ -21,7 +21,7 @@ B007.py:18:13: B007 [*] Loop control variable `k` not used within loop body | = help: Rename unused `k` to `_k` -ℹ Unsafe fix +Suggested fix: 15 15 | 16 16 | for i in range(10): 17 17 | for j in range(10): @@ -31,6 +31,8 @@ B007.py:18:13: B007 [*] Loop control variable `k` not used within loop body 20 20 | 21 21 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B007.py:30:5: B007 Loop control variable `i` not used within loop body | 30 | for i, (j, (k, l)) in strange_generator(): # i, k not used @@ -47,7 +49,7 @@ B007.py:30:13: B007 [*] Loop control variable `k` not used within loop body | = help: Rename unused `k` to `_k` -ℹ Unsafe fix +Suggested fix: 27 27 | yield i, (j, (k, l)) 28 28 | 29 29 | @@ -57,6 +59,8 @@ B007.py:30:13: B007 [*] Loop control variable `k` not used within loop body 32 32 | 33 33 | FMT = "{foo} {bar}" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B007.py:34:10: B007 Loop control variable `bar` may not be used within loop body | 33 | FMT = "{foo} {bar}" @@ -110,7 +114,7 @@ B007.py:52:14: B007 [*] Loop control variable `bar` not used within loop body | = help: Rename unused `bar` to `_bar` -ℹ Unsafe fix +Suggested fix: 49 49 | 50 50 | def f(): 51 51 | # Fixable. @@ -120,6 +124,8 @@ B007.py:52:14: B007 [*] Loop control variable `bar` not used within loop body 54 54 | break 55 55 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B007.py:59:14: B007 Loop control variable `bar` not used within loop body | 57 | def f(): @@ -142,7 +148,7 @@ B007.py:68:14: B007 [*] Loop control variable `bar` not used within loop body | = help: Rename unused `bar` to `_bar` -ℹ Unsafe fix +Suggested fix: 65 65 | 66 66 | def f(): 67 67 | # Fixable. @@ -152,6 +158,8 @@ B007.py:68:14: B007 [*] Loop control variable `bar` not used within loop body 70 70 | break 71 71 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B007.py:77:14: B007 Loop control variable `bar` not used within loop body | 75 | def f(): @@ -182,5 +190,3 @@ B007.py:98:5: B007 Loop control variable `line_` not used within loop body | ^^^^^ B007 99 | fp.readline() | - - diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap index fc00bb4ef9792..a5b8a9a1b9c19 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap @@ -11,7 +11,7 @@ B009_B010.py:19:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 16 16 | getattr(foo, "__123abc") 17 17 | 18 18 | # Invalid usage @@ -21,6 +21,8 @@ B009_B010.py:19:1: B009 [*] Do not call `getattr` with a constant attribute valu 21 21 | getattr(foo, "__123abc__") 22 22 | getattr(foo, "abc123") + Run `ruff check --fix` to apply this fix. + B009_B010.py:20:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 18 | # Invalid usage @@ -32,7 +34,7 @@ B009_B010.py:20:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 17 17 | 18 18 | # Invalid usage 19 19 | getattr(foo, "bar") @@ -42,6 +44,8 @@ B009_B010.py:20:1: B009 [*] Do not call `getattr` with a constant attribute valu 22 22 | getattr(foo, "abc123") 23 23 | getattr(foo, r"abc123") + Run `ruff check --fix` to apply this fix. + B009_B010.py:21:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 19 | getattr(foo, "bar") @@ -53,7 +57,7 @@ B009_B010.py:21:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 18 18 | # Invalid usage 19 19 | getattr(foo, "bar") 20 20 | getattr(foo, "_123abc") @@ -63,6 +67,8 @@ B009_B010.py:21:1: B009 [*] Do not call `getattr` with a constant attribute valu 23 23 | getattr(foo, r"abc123") 24 24 | _ = lambda x: getattr(x, "bar") + Run `ruff check --fix` to apply this fix. + B009_B010.py:22:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 20 | getattr(foo, "_123abc") @@ -74,7 +80,7 @@ B009_B010.py:22:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 19 19 | getattr(foo, "bar") 20 20 | getattr(foo, "_123abc") 21 21 | getattr(foo, "__123abc__") @@ -84,6 +90,8 @@ B009_B010.py:22:1: B009 [*] Do not call `getattr` with a constant attribute valu 24 24 | _ = lambda x: getattr(x, "bar") 25 25 | if getattr(x, "bar"): + Run `ruff check --fix` to apply this fix. + B009_B010.py:23:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 21 | getattr(foo, "__123abc__") @@ -95,7 +103,7 @@ B009_B010.py:23:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 20 20 | getattr(foo, "_123abc") 21 21 | getattr(foo, "__123abc__") 22 22 | getattr(foo, "abc123") @@ -105,6 +113,8 @@ B009_B010.py:23:1: B009 [*] Do not call `getattr` with a constant attribute valu 25 25 | if getattr(x, "bar"): 26 26 | pass + Run `ruff check --fix` to apply this fix. + B009_B010.py:24:15: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 22 | getattr(foo, "abc123") @@ -116,7 +126,7 @@ B009_B010.py:24:15: B009 [*] Do not call `getattr` with a constant attribute val | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 21 21 | getattr(foo, "__123abc__") 22 22 | getattr(foo, "abc123") 23 23 | getattr(foo, r"abc123") @@ -126,6 +136,8 @@ B009_B010.py:24:15: B009 [*] Do not call `getattr` with a constant attribute val 26 26 | pass 27 27 | getattr(1, "real") + Run `ruff check --fix` to apply this fix. + B009_B010.py:25:4: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 23 | getattr(foo, r"abc123") @@ -137,7 +149,7 @@ B009_B010.py:25:4: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 22 22 | getattr(foo, "abc123") 23 23 | getattr(foo, r"abc123") 24 24 | _ = lambda x: getattr(x, "bar") @@ -147,6 +159,8 @@ B009_B010.py:25:4: B009 [*] Do not call `getattr` with a constant attribute valu 27 27 | getattr(1, "real") 28 28 | getattr(1., "real") + Run `ruff check --fix` to apply this fix. + B009_B010.py:27:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 25 | if getattr(x, "bar"): @@ -158,7 +172,7 @@ B009_B010.py:27:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 24 24 | _ = lambda x: getattr(x, "bar") 25 25 | if getattr(x, "bar"): 26 26 | pass @@ -168,6 +182,8 @@ B009_B010.py:27:1: B009 [*] Do not call `getattr` with a constant attribute valu 29 29 | getattr(1.0, "real") 30 30 | getattr(1j, "real") + Run `ruff check --fix` to apply this fix. + B009_B010.py:28:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 26 | pass @@ -179,7 +195,7 @@ B009_B010.py:28:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 25 25 | if getattr(x, "bar"): 26 26 | pass 27 27 | getattr(1, "real") @@ -189,6 +205,8 @@ B009_B010.py:28:1: B009 [*] Do not call `getattr` with a constant attribute valu 30 30 | getattr(1j, "real") 31 31 | getattr(True, "real") + Run `ruff check --fix` to apply this fix. + B009_B010.py:29:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 27 | getattr(1, "real") @@ -200,7 +218,7 @@ B009_B010.py:29:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 26 26 | pass 27 27 | getattr(1, "real") 28 28 | getattr(1., "real") @@ -210,6 +228,8 @@ B009_B010.py:29:1: B009 [*] Do not call `getattr` with a constant attribute valu 31 31 | getattr(True, "real") 32 32 | getattr(x := 1, "real") + Run `ruff check --fix` to apply this fix. + B009_B010.py:30:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 28 | getattr(1., "real") @@ -221,7 +241,7 @@ B009_B010.py:30:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 27 27 | getattr(1, "real") 28 28 | getattr(1., "real") 29 29 | getattr(1.0, "real") @@ -231,6 +251,8 @@ B009_B010.py:30:1: B009 [*] Do not call `getattr` with a constant attribute valu 32 32 | getattr(x := 1, "real") 33 33 | getattr(x + y, "real") + Run `ruff check --fix` to apply this fix. + B009_B010.py:31:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 29 | getattr(1.0, "real") @@ -242,7 +264,7 @@ B009_B010.py:31:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 28 28 | getattr(1., "real") 29 29 | getattr(1.0, "real") 30 30 | getattr(1j, "real") @@ -252,6 +274,8 @@ B009_B010.py:31:1: B009 [*] Do not call `getattr` with a constant attribute valu 33 33 | getattr(x + y, "real") 34 34 | getattr("foo" + Run `ruff check --fix` to apply this fix. + B009_B010.py:32:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 30 | getattr(1j, "real") @@ -263,7 +287,7 @@ B009_B010.py:32:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 29 29 | getattr(1.0, "real") 30 30 | getattr(1j, "real") 31 31 | getattr(True, "real") @@ -273,6 +297,8 @@ B009_B010.py:32:1: B009 [*] Do not call `getattr` with a constant attribute valu 34 34 | getattr("foo" 35 35 | "bar", "real") + Run `ruff check --fix` to apply this fix. + B009_B010.py:33:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 31 | getattr(True, "real") @@ -284,7 +310,7 @@ B009_B010.py:33:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 30 30 | getattr(1j, "real") 31 31 | getattr(True, "real") 32 32 | getattr(x := 1, "real") @@ -294,6 +320,8 @@ B009_B010.py:33:1: B009 [*] Do not call `getattr` with a constant attribute valu 35 35 | "bar", "real") 36 36 | + Run `ruff check --fix` to apply this fix. + B009_B010.py:34:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 32 | getattr(x := 1, "real") @@ -304,7 +332,7 @@ B009_B010.py:34:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 31 31 | getattr(True, "real") 32 32 | getattr(x := 1, "real") 33 33 | getattr(x + y, "real") @@ -316,6 +344,8 @@ B009_B010.py:34:1: B009 [*] Do not call `getattr` with a constant attribute valu 37 37 | 38 38 | # Valid setattr usage + Run `ruff check --fix` to apply this fix. + B009_B010.py:58:8: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885 @@ -326,7 +356,7 @@ B009_B010.py:58:8: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 55 55 | setattr(foo.bar, r"baz", None) 56 56 | 57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885 @@ -336,6 +366,8 @@ B009_B010.py:58:8: B009 [*] Do not call `getattr` with a constant attribute valu 60 60 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1732387247 61 61 | getattr(*foo, "bar") + Run `ruff check --fix` to apply this fix. + B009_B010.py:65:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 64 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1739800901 @@ -347,7 +379,7 @@ B009_B010.py:65:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 62 62 | setattr(*foo, "bar", None) 63 63 | 64 64 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1739800901 @@ -359,6 +391,8 @@ B009_B010.py:65:1: B009 [*] Do not call `getattr` with a constant attribute valu 68 68 | import builtins 69 69 | builtins.getattr(foo, "bar") + Run `ruff check --fix` to apply this fix. + B009_B010.py:69:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 68 | import builtins @@ -367,9 +401,11 @@ B009_B010.py:69:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Safe fix +Suggested fix: 66 66 | registration.registry, '__name__') 67 67 | 68 68 | import builtins 69 |-builtins.getattr(foo, "bar") 69 |+foo.bar + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap index cad3fc9306173..a80515fb62407 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap @@ -11,7 +11,7 @@ B009_B010.py:50:1: B010 [*] Do not call `setattr` with a constant attribute valu | = help: Replace `setattr` with assignment -ℹ Safe fix +Suggested fix: 47 47 | pass 48 48 | 49 49 | # Invalid usage @@ -21,6 +21,8 @@ B009_B010.py:50:1: B010 [*] Do not call `setattr` with a constant attribute valu 52 52 | setattr(foo, "__123abc__", None) 53 53 | setattr(foo, "abc123", None) + Run `ruff check --fix` to apply this fix. + B009_B010.py:51:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 49 | # Invalid usage @@ -32,7 +34,7 @@ B009_B010.py:51:1: B010 [*] Do not call `setattr` with a constant attribute valu | = help: Replace `setattr` with assignment -ℹ Safe fix +Suggested fix: 48 48 | 49 49 | # Invalid usage 50 50 | setattr(foo, "bar", None) @@ -42,6 +44,8 @@ B009_B010.py:51:1: B010 [*] Do not call `setattr` with a constant attribute valu 53 53 | setattr(foo, "abc123", None) 54 54 | setattr(foo, r"abc123", None) + Run `ruff check --fix` to apply this fix. + B009_B010.py:52:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 50 | setattr(foo, "bar", None) @@ -53,7 +57,7 @@ B009_B010.py:52:1: B010 [*] Do not call `setattr` with a constant attribute valu | = help: Replace `setattr` with assignment -ℹ Safe fix +Suggested fix: 49 49 | # Invalid usage 50 50 | setattr(foo, "bar", None) 51 51 | setattr(foo, "_123abc", None) @@ -63,6 +67,8 @@ B009_B010.py:52:1: B010 [*] Do not call `setattr` with a constant attribute valu 54 54 | setattr(foo, r"abc123", None) 55 55 | setattr(foo.bar, r"baz", None) + Run `ruff check --fix` to apply this fix. + B009_B010.py:53:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 51 | setattr(foo, "_123abc", None) @@ -74,7 +80,7 @@ B009_B010.py:53:1: B010 [*] Do not call `setattr` with a constant attribute valu | = help: Replace `setattr` with assignment -ℹ Safe fix +Suggested fix: 50 50 | setattr(foo, "bar", None) 51 51 | setattr(foo, "_123abc", None) 52 52 | setattr(foo, "__123abc__", None) @@ -84,6 +90,8 @@ B009_B010.py:53:1: B010 [*] Do not call `setattr` with a constant attribute valu 55 55 | setattr(foo.bar, r"baz", None) 56 56 | + Run `ruff check --fix` to apply this fix. + B009_B010.py:54:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 52 | setattr(foo, "__123abc__", None) @@ -94,7 +102,7 @@ B009_B010.py:54:1: B010 [*] Do not call `setattr` with a constant attribute valu | = help: Replace `setattr` with assignment -ℹ Safe fix +Suggested fix: 51 51 | setattr(foo, "_123abc", None) 52 52 | setattr(foo, "__123abc__", None) 53 53 | setattr(foo, "abc123", None) @@ -104,6 +112,8 @@ B009_B010.py:54:1: B010 [*] Do not call `setattr` with a constant attribute valu 56 56 | 57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885 + Run `ruff check --fix` to apply this fix. + B009_B010.py:55:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 53 | setattr(foo, "abc123", None) @@ -115,7 +125,7 @@ B009_B010.py:55:1: B010 [*] Do not call `setattr` with a constant attribute valu | = help: Replace `setattr` with assignment -ℹ Safe fix +Suggested fix: 52 52 | setattr(foo, "__123abc__", None) 53 53 | setattr(foo, "abc123", None) 54 54 | setattr(foo, r"abc123", None) @@ -125,4 +135,4 @@ B009_B010.py:55:1: B010 [*] Do not call `setattr` with a constant attribute valu 57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885 58 58 | assert getattr(func, '_rpc')is True - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap index 828397abcea25..26279768e9cfc 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap @@ -11,7 +11,7 @@ B011.py:8:8: B011 [*] Do not `assert False` (`python -O` removes these calls), r | = help: Replace `assert False` -ℹ Unsafe fix +Suggested fix: 5 5 | """ 6 6 | 7 7 | assert 1 != 2 @@ -20,6 +20,8 @@ B011.py:8:8: B011 [*] Do not `assert False` (`python -O` removes these calls), r 9 9 | assert 1 != 2, "message" 10 10 | assert False, "message" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + B011.py:10:8: B011 [*] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()` | 8 | assert False @@ -29,11 +31,11 @@ B011.py:10:8: B011 [*] Do not `assert False` (`python -O` removes these calls), | = help: Replace `assert False` -ℹ Unsafe fix +Suggested fix: 7 7 | assert 1 != 2 8 8 | assert False 9 9 | assert 1 != 2, "message" 10 |-assert False, "message" 10 |+raise AssertionError("message") - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B013_B013.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B013_B013.py.snap index 658dfd3c7a7c0..1ccff0f08bdea 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B013_B013.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B013_B013.py.snap @@ -12,7 +12,7 @@ B013.py:5:8: B013 [*] A length-one tuple literal is redundant in exception handl | = help: Replace with `except ValueError` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | try: 4 4 | pass @@ -22,6 +22,8 @@ B013.py:5:8: B013 [*] A length-one tuple literal is redundant in exception handl 7 7 | except AttributeError: 8 8 | pass + Run `ruff check --fix` to apply this fix. + B013.py:13:7: B013 [*] A length-one tuple literal is redundant in exception handlers | 11 | except (*retriable_exceptions,): @@ -32,7 +34,7 @@ B013.py:13:7: B013 [*] A length-one tuple literal is redundant in exception hand | = help: Replace with `except ValueError` -ℹ Safe fix +Suggested fix: 10 10 | pass 11 11 | except (*retriable_exceptions,): 12 12 | pass @@ -41,3 +43,5 @@ B013.py:13:7: B013 [*] A length-one tuple literal is redundant in exception hand 14 14 | pass 15 15 | 16 16 | list_exceptions = [FileExistsError, FileNotFoundError] + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B014_B014.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B014_B014.py.snap index c35fb2494dcd8..4825feb582fb2 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B014_B014.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B014_B014.py.snap @@ -12,7 +12,7 @@ B014.py:17:8: B014 [*] Exception handler with duplicate exception: `OSError` | = help: De-duplicate exceptions -ℹ Safe fix +Suggested fix: 14 14 | 15 15 | try: 16 16 | pass @@ -22,6 +22,8 @@ B014.py:17:8: B014 [*] Exception handler with duplicate exception: `OSError` 19 19 | pass 20 20 | + Run `ruff check --fix` to apply this fix. + B014.py:28:8: B014 [*] Exception handler with duplicate exception: `MyError` | 26 | try: @@ -33,7 +35,7 @@ B014.py:28:8: B014 [*] Exception handler with duplicate exception: `MyError` | = help: De-duplicate exceptions -ℹ Safe fix +Suggested fix: 25 25 | 26 26 | try: 27 27 | pass @@ -43,6 +45,8 @@ B014.py:28:8: B014 [*] Exception handler with duplicate exception: `MyError` 30 30 | pass 31 31 | + Run `ruff check --fix` to apply this fix. + B014.py:49:8: B014 [*] Exception handler with duplicate exception: `re.error` | 47 | try: @@ -54,7 +58,7 @@ B014.py:49:8: B014 [*] Exception handler with duplicate exception: `re.error` | = help: De-duplicate exceptions -ℹ Safe fix +Suggested fix: 46 46 | 47 47 | try: 48 48 | pass @@ -64,6 +68,8 @@ B014.py:49:8: B014 [*] Exception handler with duplicate exception: `re.error` 51 51 | pass 52 52 | + Run `ruff check --fix` to apply this fix. + B014.py:82:8: B014 [*] Exception handler with duplicate exception: `ValueError` | 80 | try: @@ -74,7 +80,7 @@ B014.py:82:8: B014 [*] Exception handler with duplicate exception: `ValueError` | = help: De-duplicate exceptions -ℹ Safe fix +Suggested fix: 79 79 | # Regression test for: https://github.com/astral-sh/ruff/issues/6412 80 80 | try: 81 81 | pass @@ -84,6 +90,8 @@ B014.py:82:8: B014 [*] Exception handler with duplicate exception: `ValueError` 84 84 | 85 85 | + Run `ruff check --fix` to apply this fix. + B014.py:89:7: B014 [*] Exception handler with duplicate exception: `re.error` | 87 | try: @@ -94,7 +102,7 @@ B014.py:89:7: B014 [*] Exception handler with duplicate exception: `re.error` | = help: De-duplicate exceptions -ℹ Safe fix +Suggested fix: 86 86 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1739801758 87 87 | try: 88 88 | pas @@ -102,4 +110,4 @@ B014.py:89:7: B014 [*] Exception handler with duplicate exception: `re.error` 89 |+except re.error: 90 90 | p - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap index 6d468e2683cd3..122c7fadc4f1e 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap @@ -12,7 +12,7 @@ B033.py:4:35: B033 [*] Sets should not contain duplicate item `"value1"` | = help: Remove duplicate item -ℹ Safe fix +Suggested fix: 1 1 | ### 2 2 | # Errors. 3 3 | ### @@ -22,6 +22,8 @@ B033.py:4:35: B033 [*] Sets should not contain duplicate item `"value1"` 6 6 | incorrect_set_multiline = { 7 7 | "value1", + Run `ruff check --fix` to apply this fix. + B033.py:5:21: B033 [*] Sets should not contain duplicate item `1` | 3 | ### @@ -33,7 +35,7 @@ B033.py:5:21: B033 [*] Sets should not contain duplicate item `1` | = help: Remove duplicate item -ℹ Safe fix +Suggested fix: 2 2 | # Errors. 3 3 | ### 4 4 | incorrect_set = {"value1", 23, 5, "value1"} @@ -43,6 +45,8 @@ B033.py:5:21: B033 [*] Sets should not contain duplicate item `1` 7 7 | "value1", 8 8 | 23, + Run `ruff check --fix` to apply this fix. + B033.py:10:5: B033 [*] Sets should not contain duplicate item `"value1"` | 8 | 23, @@ -54,7 +58,7 @@ B033.py:10:5: B033 [*] Sets should not contain duplicate item `"value1"` | = help: Remove duplicate item -ℹ Safe fix +Suggested fix: 7 7 | "value1", 8 8 | 23, 9 9 | 5, @@ -63,6 +67,8 @@ B033.py:10:5: B033 [*] Sets should not contain duplicate item `"value1"` 12 11 | } 13 12 | incorrect_set = {1, 1} + Run `ruff check --fix` to apply this fix. + B033.py:13:21: B033 [*] Sets should not contain duplicate item `1` | 11 | # B033 @@ -74,7 +80,7 @@ B033.py:13:21: B033 [*] Sets should not contain duplicate item `1` | = help: Remove duplicate item -ℹ Safe fix +Suggested fix: 10 10 | "value1", 11 11 | # B033 12 12 | } @@ -84,6 +90,8 @@ B033.py:13:21: B033 [*] Sets should not contain duplicate item `1` 15 15 | incorrect_set = {0, 1, 1,} 16 16 | incorrect_set = {0, 1, 1} + Run `ruff check --fix` to apply this fix. + B033.py:14:21: B033 [*] Sets should not contain duplicate item `1` | 12 | } @@ -95,7 +103,7 @@ B033.py:14:21: B033 [*] Sets should not contain duplicate item `1` | = help: Remove duplicate item -ℹ Safe fix +Suggested fix: 11 11 | # B033 12 12 | } 13 13 | incorrect_set = {1, 1} @@ -105,6 +113,8 @@ B033.py:14:21: B033 [*] Sets should not contain duplicate item `1` 16 16 | incorrect_set = {0, 1, 1} 17 17 | incorrect_set = { + Run `ruff check --fix` to apply this fix. + B033.py:15:24: B033 [*] Sets should not contain duplicate item `1` | 13 | incorrect_set = {1, 1} @@ -116,7 +126,7 @@ B033.py:15:24: B033 [*] Sets should not contain duplicate item `1` | = help: Remove duplicate item -ℹ Safe fix +Suggested fix: 12 12 | } 13 13 | incorrect_set = {1, 1} 14 14 | incorrect_set = {1, 1,} @@ -126,6 +136,8 @@ B033.py:15:24: B033 [*] Sets should not contain duplicate item `1` 17 17 | incorrect_set = { 18 18 | 0, + Run `ruff check --fix` to apply this fix. + B033.py:16:24: B033 [*] Sets should not contain duplicate item `1` | 14 | incorrect_set = {1, 1,} @@ -137,7 +149,7 @@ B033.py:16:24: B033 [*] Sets should not contain duplicate item `1` | = help: Remove duplicate item -ℹ Safe fix +Suggested fix: 13 13 | incorrect_set = {1, 1} 14 14 | incorrect_set = {1, 1,} 15 15 | incorrect_set = {0, 1, 1,} @@ -147,6 +159,8 @@ B033.py:16:24: B033 [*] Sets should not contain duplicate item `1` 18 18 | 0, 19 19 | 1, + Run `ruff check --fix` to apply this fix. + B033.py:20:5: B033 [*] Sets should not contain duplicate item `1` | 18 | 0, @@ -157,7 +171,7 @@ B033.py:20:5: B033 [*] Sets should not contain duplicate item `1` | = help: Remove duplicate item -ℹ Safe fix +Suggested fix: 17 17 | incorrect_set = { 18 18 | 0, 19 19 | 1, @@ -166,4 +180,4 @@ B033.py:20:5: B033 [*] Sets should not contain duplicate item `1` 22 21 | 23 22 | ### - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap index 2e0c24059003d..30df1b919fdcc 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap @@ -11,7 +11,7 @@ B905.py:4:1: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -ℹ Safe fix +Suggested fix: 1 1 | from itertools import count, cycle, repeat 2 2 | 3 3 | # Errors @@ -21,6 +21,8 @@ B905.py:4:1: B905 [*] `zip()` without an explicit `strict=` parameter 6 6 | zip("a", "b") 7 7 | zip("a", "b", *zip("c")) + Run `ruff check --fix` to apply this fix. + B905.py:5:1: B905 [*] `zip()` without an explicit `strict=` parameter | 3 | # Errors @@ -32,7 +34,7 @@ B905.py:5:1: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | # Errors 4 4 | zip() @@ -42,6 +44,8 @@ B905.py:5:1: B905 [*] `zip()` without an explicit `strict=` parameter 7 7 | zip("a", "b", *zip("c")) 8 8 | zip(zip("a"), strict=False) + Run `ruff check --fix` to apply this fix. + B905.py:6:1: B905 [*] `zip()` without an explicit `strict=` parameter | 4 | zip() @@ -53,7 +57,7 @@ B905.py:6:1: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -ℹ Safe fix +Suggested fix: 3 3 | # Errors 4 4 | zip() 5 5 | zip(range(3)) @@ -63,6 +67,8 @@ B905.py:6:1: B905 [*] `zip()` without an explicit `strict=` parameter 8 8 | zip(zip("a"), strict=False) 9 9 | zip(zip("a", strict=True)) + Run `ruff check --fix` to apply this fix. + B905.py:7:1: B905 [*] `zip()` without an explicit `strict=` parameter | 5 | zip(range(3)) @@ -74,7 +80,7 @@ B905.py:7:1: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -ℹ Safe fix +Suggested fix: 4 4 | zip() 5 5 | zip(range(3)) 6 6 | zip("a", "b") @@ -84,6 +90,8 @@ B905.py:7:1: B905 [*] `zip()` without an explicit `strict=` parameter 9 9 | zip(zip("a", strict=True)) 10 10 | + Run `ruff check --fix` to apply this fix. + B905.py:7:16: B905 [*] `zip()` without an explicit `strict=` parameter | 5 | zip(range(3)) @@ -95,7 +103,7 @@ B905.py:7:16: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -ℹ Safe fix +Suggested fix: 4 4 | zip() 5 5 | zip(range(3)) 6 6 | zip("a", "b") @@ -105,6 +113,8 @@ B905.py:7:16: B905 [*] `zip()` without an explicit `strict=` parameter 9 9 | zip(zip("a", strict=True)) 10 10 | + Run `ruff check --fix` to apply this fix. + B905.py:8:5: B905 [*] `zip()` without an explicit `strict=` parameter | 6 | zip("a", "b") @@ -115,7 +125,7 @@ B905.py:8:5: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -ℹ Safe fix +Suggested fix: 5 5 | zip(range(3)) 6 6 | zip("a", "b") 7 7 | zip("a", "b", *zip("c")) @@ -125,6 +135,8 @@ B905.py:8:5: B905 [*] `zip()` without an explicit `strict=` parameter 10 10 | 11 11 | # OK + Run `ruff check --fix` to apply this fix. + B905.py:9:1: B905 [*] `zip()` without an explicit `strict=` parameter | 7 | zip("a", "b", *zip("c")) @@ -136,7 +148,7 @@ B905.py:9:1: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -ℹ Safe fix +Suggested fix: 6 6 | zip("a", "b") 7 7 | zip("a", "b", *zip("c")) 8 8 | zip(zip("a"), strict=False) @@ -146,6 +158,8 @@ B905.py:9:1: B905 [*] `zip()` without an explicit `strict=` parameter 11 11 | # OK 12 12 | zip(range(3), strict=True) + Run `ruff check --fix` to apply this fix. + B905.py:24:1: B905 [*] `zip()` without an explicit `strict=` parameter | 23 | # Errors (limited iterators). @@ -155,7 +169,7 @@ B905.py:24:1: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -ℹ Safe fix +Suggested fix: 21 21 | zip([1, 2, 3], repeat(1, times=None)) 22 22 | 23 23 | # Errors (limited iterators). @@ -165,6 +179,8 @@ B905.py:24:1: B905 [*] `zip()` without an explicit `strict=` parameter 26 26 | 27 27 | import builtins + Run `ruff check --fix` to apply this fix. + B905.py:25:1: B905 [*] `zip()` without an explicit `strict=` parameter | 23 | # Errors (limited iterators). @@ -176,7 +192,7 @@ B905.py:25:1: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -ℹ Safe fix +Suggested fix: 22 22 | 23 23 | # Errors (limited iterators). 24 24 | zip([1, 2, 3], repeat(1, 1)) @@ -186,6 +202,8 @@ B905.py:25:1: B905 [*] `zip()` without an explicit `strict=` parameter 27 27 | import builtins 28 28 | # Still an error even though it uses the qualified name + Run `ruff check --fix` to apply this fix. + B905.py:29:1: B905 [*] `zip()` without an explicit `strict=` parameter | 27 | import builtins @@ -195,9 +213,11 @@ B905.py:29:1: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -ℹ Safe fix +Suggested fix: 26 26 | 27 27 | import builtins 28 28 | # Still an error even though it uses the qualified name 29 |-builtins.zip([1, 2, 3]) 29 |+builtins.zip([1, 2, 3], strict=False) + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap index ff069ea930445..147f66027f2dc 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap @@ -9,10 +9,12 @@ B006_extended.py:17:55: B006 [*] Do not use mutable data structures for argument | = help: Replace with `None`; initialize within function -ℹ Unsafe fix +Suggested fix: 14 14 | ... 15 15 | 16 16 | 17 |-def error_due_to_missing_import(foo: ImmutableTypeA = []): 17 |+def error_due_to_missing_import(foo: ImmutableTypeA = None): 18 18 | ... + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81.py.snap b/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81.py.snap index 1955cf08d063f..3a3b1563ed631 100644 --- a/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81.py.snap +++ b/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81.py.snap @@ -12,7 +12,7 @@ COM81.py:4:18: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 1 1 | # ==> bad_function_call.py <== 2 2 | bad_function_call( 3 3 | param1='test', @@ -22,6 +22,8 @@ COM81.py:4:18: COM812 [*] Trailing comma missing 6 6 | # ==> bad_list.py <== 7 7 | bad_list = [ + Run `ruff check --fix` to apply this fix. + COM81.py:10:6: COM812 [*] Trailing comma missing | 8 | 1, @@ -32,7 +34,7 @@ COM81.py:10:6: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 7 7 | bad_list = [ 8 8 | 1, 9 9 | 2, @@ -42,6 +44,8 @@ COM81.py:10:6: COM812 [*] Trailing comma missing 12 12 | 13 13 | bad_list_with_comment = [ + Run `ruff check --fix` to apply this fix. + COM81.py:16:6: COM812 [*] Trailing comma missing | 14 | 1, @@ -53,7 +57,7 @@ COM81.py:16:6: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 13 13 | bad_list_with_comment = [ 14 14 | 1, 15 15 | 2, @@ -63,6 +67,8 @@ COM81.py:16:6: COM812 [*] Trailing comma missing 18 18 | ] 19 19 | + Run `ruff check --fix` to apply this fix. + COM81.py:23:6: COM812 [*] Trailing comma missing | 21 | 1, @@ -72,7 +78,7 @@ COM81.py:23:6: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 20 20 | bad_list_with_extra_empty = [ 21 21 | 1, 22 22 | 2, @@ -82,6 +88,8 @@ COM81.py:23:6: COM812 [*] Trailing comma missing 25 25 | 26 26 | + Run `ruff check --fix` to apply this fix. + COM81.py:36:8: COM818 Trailing comma on bare tuple prohibited | 34 | foo = (1,) @@ -159,7 +167,7 @@ COM81.py:70:8: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 67 67 | pass 68 68 | 69 69 | {'foo': foo}['foo']( @@ -169,6 +177,8 @@ COM81.py:70:8: COM812 [*] Trailing comma missing 72 72 | 73 73 | {'foo': foo}['foo']( + Run `ruff check --fix` to apply this fix. + COM81.py:78:8: COM812 [*] Trailing comma missing | 77 | (foo)( @@ -178,7 +188,7 @@ COM81.py:78:8: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 75 75 | ) 76 76 | 77 77 | (foo)( @@ -188,6 +198,8 @@ COM81.py:78:8: COM812 [*] Trailing comma missing 80 80 | 81 81 | (foo)[0]( + Run `ruff check --fix` to apply this fix. + COM81.py:86:8: COM812 [*] Trailing comma missing | 85 | [foo][0]( @@ -197,7 +209,7 @@ COM81.py:86:8: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 83 83 | ) 84 84 | 85 85 | [foo][0]( @@ -207,6 +219,8 @@ COM81.py:86:8: COM812 [*] Trailing comma missing 88 88 | 89 89 | [foo][0]( + Run `ruff check --fix` to apply this fix. + COM81.py:152:6: COM812 [*] Trailing comma missing | 150 | # ==> keyword_before_parenth_form/base_bad.py <== @@ -217,7 +231,7 @@ COM81.py:152:6: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 149 149 | 150 150 | # ==> keyword_before_parenth_form/base_bad.py <== 151 151 | from x import ( @@ -227,6 +241,8 @@ COM81.py:152:6: COM812 [*] Trailing comma missing 154 154 | 155 155 | assert( + Run `ruff check --fix` to apply this fix. + COM81.py:158:11: COM812 [*] Trailing comma missing | 156 | SyntaxWarning, @@ -237,7 +253,7 @@ COM81.py:158:11: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 155 155 | assert( 156 156 | SyntaxWarning, 157 157 | ThrownHere, @@ -247,6 +263,8 @@ COM81.py:158:11: COM812 [*] Trailing comma missing 160 160 | 161 161 | # async await is fine outside an async def + Run `ruff check --fix` to apply this fix. + COM81.py:293:15: COM812 [*] Trailing comma missing | 291 | # ==> multiline_bad_dict.py <== @@ -258,7 +276,7 @@ COM81.py:293:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 290 290 | 291 291 | # ==> multiline_bad_dict.py <== 292 292 | multiline_bad_dict = { @@ -268,6 +286,8 @@ COM81.py:293:15: COM812 [*] Trailing comma missing 295 295 | # ==> multiline_bad_function_def.py <== 296 296 | def func_good( + Run `ruff check --fix` to apply this fix. + COM81.py:304:14: COM812 [*] Trailing comma missing | 302 | def func_bad( @@ -279,7 +299,7 @@ COM81.py:304:14: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 301 301 | 302 302 | def func_bad( 303 303 | a = 3, @@ -289,6 +309,8 @@ COM81.py:304:14: COM812 [*] Trailing comma missing 306 306 | pass 307 307 | + Run `ruff check --fix` to apply this fix. + COM81.py:310:14: COM812 [*] Trailing comma missing | 308 | # ==> multiline_bad_function_one_param.py <== @@ -300,7 +322,7 @@ COM81.py:310:14: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 307 307 | 308 308 | # ==> multiline_bad_function_one_param.py <== 309 309 | def func( @@ -310,6 +332,8 @@ COM81.py:310:14: COM812 [*] Trailing comma missing 312 312 | pass 313 313 | + Run `ruff check --fix` to apply this fix. + COM81.py:316:10: COM812 [*] Trailing comma missing | 315 | func( @@ -319,7 +343,7 @@ COM81.py:316:10: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 313 313 | 314 314 | 315 315 | func( @@ -329,6 +353,8 @@ COM81.py:316:10: COM812 [*] Trailing comma missing 318 318 | 319 319 | # ==> multiline_bad_or_dict.py <== + Run `ruff check --fix` to apply this fix. + COM81.py:322:15: COM812 [*] Trailing comma missing | 320 | multiline_bad_or_dict = { @@ -339,7 +365,7 @@ COM81.py:322:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 319 319 | # ==> multiline_bad_or_dict.py <== 320 320 | multiline_bad_or_dict = { 321 321 | "good": True or False, @@ -349,6 +375,8 @@ COM81.py:322:15: COM812 [*] Trailing comma missing 324 324 | 325 325 | # ==> multiline_good_dict.py <== + Run `ruff check --fix` to apply this fix. + COM81.py:368:15: COM812 [*] Trailing comma missing | 366 | multiline_index_access[ @@ -359,7 +387,7 @@ COM81.py:368:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 365 365 | 366 366 | multiline_index_access[ 367 367 | "probably fine", @@ -369,6 +397,8 @@ COM81.py:368:15: COM812 [*] Trailing comma missing 370 370 | 371 371 | multiline_index_access[ + Run `ruff check --fix` to apply this fix. + COM81.py:375:15: COM812 [*] Trailing comma missing | 373 | "fine", @@ -379,7 +409,7 @@ COM81.py:375:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 372 372 | "fine", 373 373 | "fine", 374 374 | : @@ -389,6 +419,8 @@ COM81.py:375:15: COM812 [*] Trailing comma missing 377 377 | 378 378 | # ==> multiline_string.py <== + Run `ruff check --fix` to apply this fix. + COM81.py:404:15: COM812 [*] Trailing comma missing | 402 | "fine" @@ -399,7 +431,7 @@ COM81.py:404:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 401 401 | "fine", 402 402 | "fine" 403 403 | : @@ -409,6 +441,8 @@ COM81.py:404:15: COM812 [*] Trailing comma missing 406 406 | 407 407 | multiline_index_access[ + Run `ruff check --fix` to apply this fix. + COM81.py:432:15: COM812 [*] Trailing comma missing | 430 | : @@ -419,7 +453,7 @@ COM81.py:432:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 429 429 | "fine" 430 430 | : 431 431 | "fine", @@ -429,6 +463,8 @@ COM81.py:432:15: COM812 [*] Trailing comma missing 434 434 | 435 435 | multiline_index_access[ + Run `ruff check --fix` to apply this fix. + COM81.py:485:21: COM819 [*] Trailing comma prohibited | 484 | # ==> prohibited.py <== @@ -439,7 +475,7 @@ COM81.py:485:21: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Safe fix +Suggested fix: 482 482 | ) 483 483 | 484 484 | # ==> prohibited.py <== @@ -449,6 +485,8 @@ COM81.py:485:21: COM819 [*] Trailing comma prohibited 487 487 | bar = { a: b,} 488 488 | + Run `ruff check --fix` to apply this fix. + COM81.py:487:13: COM819 [*] Trailing comma prohibited | 485 | foo = ['a', 'b', 'c',] @@ -460,7 +498,7 @@ COM81.py:487:13: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Safe fix +Suggested fix: 484 484 | # ==> prohibited.py <== 485 485 | foo = ['a', 'b', 'c',] 486 486 | @@ -470,6 +508,8 @@ COM81.py:487:13: COM819 [*] Trailing comma prohibited 489 489 | def bah(ham, spam,): 490 490 | pass + Run `ruff check --fix` to apply this fix. + COM81.py:489:18: COM819 [*] Trailing comma prohibited | 487 | bar = { a: b,} @@ -480,7 +520,7 @@ COM81.py:489:18: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Safe fix +Suggested fix: 486 486 | 487 487 | bar = { a: b,} 488 488 | @@ -490,6 +530,8 @@ COM81.py:489:18: COM819 [*] Trailing comma prohibited 491 491 | 492 492 | (0,) + Run `ruff check --fix` to apply this fix. + COM81.py:494:6: COM819 [*] Trailing comma prohibited | 492 | (0,) @@ -501,7 +543,7 @@ COM81.py:494:6: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Safe fix +Suggested fix: 491 491 | 492 492 | (0,) 493 493 | @@ -511,6 +553,8 @@ COM81.py:494:6: COM819 [*] Trailing comma prohibited 496 496 | foo = ['a', 'b', 'c', ] 497 497 | + Run `ruff check --fix` to apply this fix. + COM81.py:496:21: COM819 [*] Trailing comma prohibited | 494 | (0, 1,) @@ -522,7 +566,7 @@ COM81.py:496:21: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Safe fix +Suggested fix: 493 493 | 494 494 | (0, 1,) 495 495 | @@ -532,6 +576,8 @@ COM81.py:496:21: COM819 [*] Trailing comma prohibited 498 498 | bar = { a: b, } 499 499 | + Run `ruff check --fix` to apply this fix. + COM81.py:498:13: COM819 [*] Trailing comma prohibited | 496 | foo = ['a', 'b', 'c', ] @@ -543,7 +589,7 @@ COM81.py:498:13: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Safe fix +Suggested fix: 495 495 | 496 496 | foo = ['a', 'b', 'c', ] 497 497 | @@ -553,6 +599,8 @@ COM81.py:498:13: COM819 [*] Trailing comma prohibited 500 500 | def bah(ham, spam, ): 501 501 | pass + Run `ruff check --fix` to apply this fix. + COM81.py:500:18: COM819 [*] Trailing comma prohibited | 498 | bar = { a: b, } @@ -563,7 +611,7 @@ COM81.py:500:18: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Safe fix +Suggested fix: 497 497 | 498 498 | bar = { a: b, } 499 499 | @@ -573,6 +621,8 @@ COM81.py:500:18: COM819 [*] Trailing comma prohibited 502 502 | 503 503 | (0, ) + Run `ruff check --fix` to apply this fix. + COM81.py:505:6: COM819 [*] Trailing comma prohibited | 503 | (0, ) @@ -584,7 +634,7 @@ COM81.py:505:6: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Safe fix +Suggested fix: 502 502 | 503 503 | (0, ) 504 504 | @@ -594,6 +644,8 @@ COM81.py:505:6: COM819 [*] Trailing comma prohibited 507 507 | image[:, :, 0] 508 508 | + Run `ruff check --fix` to apply this fix. + COM81.py:511:10: COM819 [*] Trailing comma prohibited | 509 | image[:,] @@ -605,7 +657,7 @@ COM81.py:511:10: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Safe fix +Suggested fix: 508 508 | 509 509 | image[:,] 510 510 | @@ -615,6 +667,8 @@ COM81.py:511:10: COM819 [*] Trailing comma prohibited 513 513 | lambda x, : x 514 514 | + Run `ruff check --fix` to apply this fix. + COM81.py:513:9: COM819 [*] Trailing comma prohibited | 511 | image[:,:,] @@ -626,7 +680,7 @@ COM81.py:513:9: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Safe fix +Suggested fix: 510 510 | 511 511 | image[:,:,] 512 512 | @@ -636,6 +690,8 @@ COM81.py:513:9: COM819 [*] Trailing comma prohibited 515 515 | # ==> unpack.py <== 516 516 | def function( + Run `ruff check --fix` to apply this fix. + COM81.py:519:13: COM812 [*] Trailing comma missing | 517 | foo, @@ -647,7 +703,7 @@ COM81.py:519:13: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 516 516 | def function( 517 517 | foo, 518 518 | bar, @@ -657,6 +713,8 @@ COM81.py:519:13: COM812 [*] Trailing comma missing 521 521 | pass 522 522 | + Run `ruff check --fix` to apply this fix. + COM81.py:526:10: COM812 [*] Trailing comma missing | 524 | foo, @@ -668,7 +726,7 @@ COM81.py:526:10: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 523 523 | def function( 524 524 | foo, 525 525 | bar, @@ -678,6 +736,8 @@ COM81.py:526:10: COM812 [*] Trailing comma missing 528 528 | pass 529 529 | + Run `ruff check --fix` to apply this fix. + COM81.py:534:16: COM812 [*] Trailing comma missing | 532 | bar, @@ -689,7 +749,7 @@ COM81.py:534:16: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 531 531 | foo, 532 532 | bar, 533 533 | *args, @@ -699,6 +759,8 @@ COM81.py:534:16: COM812 [*] Trailing comma missing 536 536 | pass 537 537 | + Run `ruff check --fix` to apply this fix. + COM81.py:541:13: COM812 [*] Trailing comma missing | 539 | foo, @@ -709,7 +771,7 @@ COM81.py:541:13: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 538 538 | result = function( 539 539 | foo, 540 540 | bar, @@ -719,6 +781,8 @@ COM81.py:541:13: COM812 [*] Trailing comma missing 543 543 | 544 544 | result = function( + Run `ruff check --fix` to apply this fix. + COM81.py:547:24: COM812 [*] Trailing comma missing | 545 | foo, @@ -729,7 +793,7 @@ COM81.py:547:24: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 544 544 | result = function( 545 545 | foo, 546 546 | bar, @@ -739,6 +803,8 @@ COM81.py:547:24: COM812 [*] Trailing comma missing 549 549 | 550 550 | def foo( + Run `ruff check --fix` to apply this fix. + COM81.py:554:15: COM812 [*] Trailing comma missing | 552 | spam, @@ -750,7 +816,7 @@ COM81.py:554:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 551 551 | ham, 552 552 | spam, 553 553 | *args, @@ -760,6 +826,8 @@ COM81.py:554:15: COM812 [*] Trailing comma missing 556 556 | pass 557 557 | + Run `ruff check --fix` to apply this fix. + COM81.py:561:13: COM812 [*] Trailing comma missing | 560 | foo( @@ -769,7 +837,7 @@ COM81.py:561:13: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 558 558 | # In python 3.5 if it's not a function def, commas are mandatory. 559 559 | 560 560 | foo( @@ -779,6 +847,8 @@ COM81.py:561:13: COM812 [*] Trailing comma missing 563 563 | 564 564 | { + Run `ruff check --fix` to apply this fix. + COM81.py:565:13: COM812 [*] Trailing comma missing | 564 | { @@ -788,7 +858,7 @@ COM81.py:565:13: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 562 562 | ) 563 563 | 564 564 | { @@ -798,6 +868,8 @@ COM81.py:565:13: COM812 [*] Trailing comma missing 567 567 | 568 568 | { + Run `ruff check --fix` to apply this fix. + COM81.py:569:10: COM812 [*] Trailing comma missing | 568 | { @@ -807,7 +879,7 @@ COM81.py:569:10: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 566 566 | } 567 567 | 568 568 | { @@ -817,6 +889,8 @@ COM81.py:569:10: COM812 [*] Trailing comma missing 571 571 | 572 572 | [ + Run `ruff check --fix` to apply this fix. + COM81.py:573:10: COM812 [*] Trailing comma missing | 572 | [ @@ -826,7 +900,7 @@ COM81.py:573:10: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 570 570 | } 571 571 | 572 572 | [ @@ -836,6 +910,8 @@ COM81.py:573:10: COM812 [*] Trailing comma missing 575 575 | 576 576 | def foo( + Run `ruff check --fix` to apply this fix. + COM81.py:579:10: COM812 [*] Trailing comma missing | 577 | ham, @@ -847,7 +923,7 @@ COM81.py:579:10: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 576 576 | def foo( 577 577 | ham, 578 578 | spam, @@ -857,6 +933,8 @@ COM81.py:579:10: COM812 [*] Trailing comma missing 581 581 | pass 582 582 | + Run `ruff check --fix` to apply this fix. + COM81.py:586:13: COM812 [*] Trailing comma missing | 584 | ham, @@ -868,7 +946,7 @@ COM81.py:586:13: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 583 583 | def foo( 584 584 | ham, 585 585 | spam, @@ -878,6 +956,8 @@ COM81.py:586:13: COM812 [*] Trailing comma missing 588 588 | pass 589 589 | + Run `ruff check --fix` to apply this fix. + COM81.py:594:15: COM812 [*] Trailing comma missing | 592 | spam, @@ -889,7 +969,7 @@ COM81.py:594:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 591 591 | ham, 592 592 | spam, 593 593 | *args, @@ -899,6 +979,8 @@ COM81.py:594:15: COM812 [*] Trailing comma missing 596 596 | pass 597 597 | + Run `ruff check --fix` to apply this fix. + COM81.py:623:20: COM812 [*] Trailing comma missing | 621 | foo, @@ -909,7 +991,7 @@ COM81.py:623:20: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 620 620 | result = function( 621 621 | foo, 622 622 | bar, @@ -919,6 +1001,8 @@ COM81.py:623:20: COM812 [*] Trailing comma missing 625 625 | 626 626 | # Make sure the COM812 and UP034 rules don't fix simultaneously and cause a syntax error. + Run `ruff check --fix` to apply this fix. + COM81.py:628:42: COM812 [*] Trailing comma missing | 626 | # Make sure the COM812 and UP034 rules don't fix simultaneously and cause a syntax error. @@ -929,7 +1013,7 @@ COM81.py:628:42: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 625 625 | 626 626 | # Make sure the COM812 and UP034 rules don't fix simultaneously and cause a syntax error. 627 627 | the_first_one = next( @@ -939,6 +1023,8 @@ COM81.py:628:42: COM812 [*] Trailing comma missing 630 630 | 631 631 | foo = namedtuple( + Run `ruff check --fix` to apply this fix. + COM81.py:640:46: COM819 [*] Trailing comma prohibited | 639 | # F-strings @@ -949,7 +1035,7 @@ COM81.py:640:46: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Safe fix +Suggested fix: 637 637 | ) 638 638 | 639 639 | # F-strings @@ -959,6 +1045,8 @@ COM81.py:640:46: COM819 [*] Trailing comma prohibited 642 642 | raise Exception( 643 643 | "first", extra=f"Add trailing comma here ->" + Run `ruff check --fix` to apply this fix. + COM81.py:643:49: COM812 [*] Trailing comma missing | 642 | raise Exception( @@ -968,7 +1056,7 @@ COM81.py:643:49: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Safe fix +Suggested fix: 640 640 | kwargs.pop("remove", f"this {trailing_comma}",) 641 641 | 642 642 | raise Exception( @@ -977,3 +1065,5 @@ COM81.py:643:49: COM812 [*] Trailing comma missing 644 644 | ) 645 645 | 646 646 | assert False, f"<- This is not a trailing comma" + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap index d64116390469b..e72c94e4be5bd 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap @@ -11,7 +11,7 @@ C400.py:2:13: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | = help: Rewrite as a `list` comprehension -ℹ Unsafe fix +Suggested fix: 1 1 | # Cannot combine with C416. Should use list comprehension here. 2 |-even_nums = list(2 * x for x in range(3)) 2 |+even_nums = [2 * x for x in range(3)] @@ -19,6 +19,8 @@ C400.py:2:13: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) 4 4 | 2 * x + 1 for x in range(3) 5 5 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C400.py:3:12: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | 1 | # Cannot combine with C416. Should use list comprehension here. @@ -31,7 +33,7 @@ C400.py:3:12: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | = help: Rewrite as a `list` comprehension -ℹ Unsafe fix +Suggested fix: 1 1 | # Cannot combine with C416. Should use list comprehension here. 2 2 | even_nums = list(2 * x for x in range(3)) 3 |-odd_nums = list( @@ -43,6 +45,8 @@ C400.py:3:12: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) 7 7 | 8 8 | # Short-circuit case, combine with C416 and should produce x = list(range(3)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C400.py:9:5: C400 [*] Unnecessary generator (rewrite using `list()`) | 8 | # Short-circuit case, combine with C416 and should produce x = list(range(3)) @@ -53,7 +57,7 @@ C400.py:9:5: C400 [*] Unnecessary generator (rewrite using `list()`) | = help: Rewrite using `list()` -ℹ Unsafe fix +Suggested fix: 6 6 | 7 7 | 8 8 | # Short-circuit case, combine with C416 and should produce x = list(range(3)) @@ -63,6 +67,8 @@ C400.py:9:5: C400 [*] Unnecessary generator (rewrite using `list()`) 11 11 | x for x in range(3) 12 12 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C400.py:10:5: C400 [*] Unnecessary generator (rewrite using `list()`) | 8 | # Short-circuit case, combine with C416 and should produce x = list(range(3)) @@ -77,7 +83,7 @@ C400.py:10:5: C400 [*] Unnecessary generator (rewrite using `list()`) | = help: Rewrite using `list()` -ℹ Unsafe fix +Suggested fix: 7 7 | 8 8 | # Short-circuit case, combine with C416 and should produce x = list(range(3)) 9 9 | x = list(x for x in range(3)) @@ -89,6 +95,8 @@ C400.py:10:5: C400 [*] Unnecessary generator (rewrite using `list()`) 14 12 | # Strip parentheses from inner generators. 15 13 | list((2 * x for x in range(3))) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C400.py:15:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | 14 | # Strip parentheses from inner generators. @@ -99,7 +107,7 @@ C400.py:15:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | = help: Rewrite as a `list` comprehension -ℹ Unsafe fix +Suggested fix: 12 12 | ) 13 13 | 14 14 | # Strip parentheses from inner generators. @@ -109,6 +117,8 @@ C400.py:15:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) 17 17 | list((((2 * x for x in range(3))))) 18 18 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C400.py:16:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | 14 | # Strip parentheses from inner generators. @@ -119,7 +129,7 @@ C400.py:16:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | = help: Rewrite as a `list` comprehension -ℹ Unsafe fix +Suggested fix: 13 13 | 14 14 | # Strip parentheses from inner generators. 15 15 | list((2 * x for x in range(3))) @@ -129,6 +139,8 @@ C400.py:16:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) 18 18 | 19 19 | # Not built-in list. + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C400.py:17:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | 15 | list((2 * x for x in range(3))) @@ -140,7 +152,7 @@ C400.py:17:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | = help: Rewrite as a `list` comprehension -ℹ Unsafe fix +Suggested fix: 14 14 | # Strip parentheses from inner generators. 15 15 | list((2 * x for x in range(3))) 16 16 | list(((2 * x for x in range(3)))) @@ -149,3 +161,5 @@ C400.py:17:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) 18 18 | 19 19 | # Not built-in list. 20 20 | def list(*args, **kwargs): + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap index fdde5715682af..0ac41a3167dc4 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap @@ -11,7 +11,7 @@ C401.py:2:13: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Unsafe fix +Suggested fix: 1 1 | # Cannot conbime with C416. Should use set comprehension here. 2 |-even_nums = set(2 * x for x in range(3)) 2 |+even_nums = {2 * x for x in range(3)} @@ -19,6 +19,8 @@ C401.py:2:13: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) 4 4 | 2 * x + 1 for x in range(3) 5 5 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C401.py:3:12: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | 1 | # Cannot conbime with C416. Should use set comprehension here. @@ -32,7 +34,7 @@ C401.py:3:12: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Unsafe fix +Suggested fix: 1 1 | # Cannot conbime with C416. Should use set comprehension here. 2 2 | even_nums = set(2 * x for x in range(3)) 3 |-odd_nums = set( @@ -44,6 +46,8 @@ C401.py:3:12: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) 7 7 | 8 8 | def f(x): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C401.py:6:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | 4 | 2 * x + 1 for x in range(3) @@ -55,7 +59,7 @@ C401.py:6:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Unsafe fix +Suggested fix: 3 3 | odd_nums = set( 4 4 | 2 * x + 1 for x in range(3) 5 5 | ) @@ -65,6 +69,8 @@ C401.py:6:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) 8 8 | def f(x): 9 9 | return x + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C401.py:11:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | 9 | return x @@ -75,7 +81,7 @@ C401.py:11:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Unsafe fix +Suggested fix: 8 8 | def f(x): 9 9 | return x 10 10 | @@ -85,6 +91,8 @@ C401.py:11:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) 13 13 | 14 14 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C401.py:12:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | 11 | print(f"Hello {set(f(a) for a in 'abc')} World") @@ -93,7 +101,7 @@ C401.py:12:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Unsafe fix +Suggested fix: 9 9 | return x 10 10 | 11 11 | print(f"Hello {set(f(a) for a in 'abc')} World") @@ -103,6 +111,8 @@ C401.py:12:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) 14 14 | 15 15 | # Short-circuit case, combine with C416 and should produce x = set(range(3)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C401.py:16:5: C401 [*] Unnecessary generator (rewrite using `set()` | 15 | # Short-circuit case, combine with C416 and should produce x = set(range(3)) @@ -113,7 +123,7 @@ C401.py:16:5: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -ℹ Unsafe fix +Suggested fix: 13 13 | 14 14 | 15 15 | # Short-circuit case, combine with C416 and should produce x = set(range(3)) @@ -123,6 +133,8 @@ C401.py:16:5: C401 [*] Unnecessary generator (rewrite using `set()` 18 18 | x for x in range(3) 19 19 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C401.py:17:5: C401 [*] Unnecessary generator (rewrite using `set()` | 15 | # Short-circuit case, combine with C416 and should produce x = set(range(3)) @@ -137,7 +149,7 @@ C401.py:17:5: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -ℹ Unsafe fix +Suggested fix: 14 14 | 15 15 | # Short-circuit case, combine with C416 and should produce x = set(range(3)) 16 16 | x = set(x for x in range(3)) @@ -149,6 +161,8 @@ C401.py:17:5: C401 [*] Unnecessary generator (rewrite using `set()` 21 19 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") 22 20 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C401.py:20:16: C401 [*] Unnecessary generator (rewrite using `set()` | 18 | x for x in range(3) @@ -160,7 +174,7 @@ C401.py:20:16: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -ℹ Unsafe fix +Suggested fix: 17 17 | x = set( 18 18 | x for x in range(3) 19 19 | ) @@ -170,6 +184,8 @@ C401.py:20:16: C401 [*] Unnecessary generator (rewrite using `set()` 22 22 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }") 23 23 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C401.py:21:10: C401 [*] Unnecessary generator (rewrite using `set()` | 19 | ) @@ -180,7 +196,7 @@ C401.py:21:10: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -ℹ Unsafe fix +Suggested fix: 18 18 | x for x in range(3) 19 19 | ) 20 20 | print(f"Hello {set(a for a in range(3))} World") @@ -190,6 +206,8 @@ C401.py:21:10: C401 [*] Unnecessary generator (rewrite using `set()` 23 23 | 24 24 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C401.py:21:34: C401 [*] Unnecessary generator (rewrite using `set()` | 19 | ) @@ -200,7 +218,7 @@ C401.py:21:34: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -ℹ Unsafe fix +Suggested fix: 18 18 | x for x in range(3) 19 19 | ) 20 20 | print(f"Hello {set(a for a in range(3))} World") @@ -210,6 +228,8 @@ C401.py:21:34: C401 [*] Unnecessary generator (rewrite using `set()` 23 23 | 24 24 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C401.py:22:11: C401 [*] Unnecessary generator (rewrite using `set()` | 20 | print(f"Hello {set(a for a in range(3))} World") @@ -219,7 +239,7 @@ C401.py:22:11: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -ℹ Unsafe fix +Suggested fix: 19 19 | ) 20 20 | print(f"Hello {set(a for a in range(3))} World") 21 21 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") @@ -229,6 +249,8 @@ C401.py:22:11: C401 [*] Unnecessary generator (rewrite using `set()` 24 24 | 25 25 | # Not built-in set. + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C401.py:22:35: C401 [*] Unnecessary generator (rewrite using `set()` | 20 | print(f"Hello {set(a for a in range(3))} World") @@ -238,7 +260,7 @@ C401.py:22:35: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -ℹ Unsafe fix +Suggested fix: 19 19 | ) 20 20 | print(f"Hello {set(a for a in range(3))} World") 21 21 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") @@ -247,3 +269,5 @@ C401.py:22:35: C401 [*] Unnecessary generator (rewrite using `set()` 23 23 | 24 24 | 25 25 | # Not built-in set. + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap index 1a79ba66f5baa..14236e2a69ab2 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap @@ -10,13 +10,15 @@ C402.py:1:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 1 |-dict((x, x) for x in range(3)) 1 |+{x: x for x in range(3)} 2 2 | dict( 3 3 | (x, x) for x in range(3) 4 4 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C402.py:2:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 1 | dict((x, x) for x in range(3)) @@ -29,7 +31,7 @@ C402.py:2:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 1 1 | dict((x, x) for x in range(3)) 2 |-dict( 3 |- (x, x) for x in range(3) @@ -41,6 +43,8 @@ C402.py:2:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) 6 6 | y = f'{dict((x, x) for x in range(3))}' 7 7 | print(f'Hello {dict((x, x) for x in range(3))} World') + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C402.py:6:8: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 4 | ) @@ -52,7 +56,7 @@ C402.py:6:8: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 3 3 | (x, x) for x in range(3) 4 4 | ) 5 5 | dict(((x, x) for x in range(3)), z=3) @@ -62,6 +66,8 @@ C402.py:6:8: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) 8 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") 9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C402.py:7:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 5 | dict(((x, x) for x in range(3)), z=3) @@ -73,7 +79,7 @@ C402.py:7:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 4 4 | ) 5 5 | dict(((x, x) for x in range(3)), z=3) 6 6 | y = f'{dict((x, x) for x in range(3))}' @@ -83,6 +89,8 @@ C402.py:7:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) 9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') 10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C402.py:8:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 6 | y = f'{dict((x, x) for x in range(3))}' @@ -94,7 +102,7 @@ C402.py:8:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 5 5 | dict(((x, x) for x in range(3)), z=3) 6 6 | y = f'{dict((x, x) for x in range(3))}' 7 7 | print(f'Hello {dict((x, x) for x in range(3))} World') @@ -104,6 +112,8 @@ C402.py:8:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) 10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 11 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C402.py:9:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 7 | print(f'Hello {dict((x, x) for x in range(3))} World') @@ -114,7 +124,7 @@ C402.py:9:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 6 6 | y = f'{dict((x, x) for x in range(3))}' 7 7 | print(f'Hello {dict((x, x) for x in range(3))} World') 8 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") @@ -124,6 +134,8 @@ C402.py:9:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) 11 11 | 12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C402.py:10:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") @@ -135,7 +147,7 @@ C402.py:10:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 7 7 | print(f'Hello {dict((x, x) for x in range(3))} World') 8 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") 9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') @@ -145,6 +157,8 @@ C402.py:10:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension 12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' 13 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C402.py:12:4: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 10 | print(f'Hello {dict((x,x) for x in "abc")} World') @@ -155,7 +169,7 @@ C402.py:12:4: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') 10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 11 | @@ -165,6 +179,8 @@ C402.py:12:4: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) 14 14 | 15 15 | def f(x): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C402.py:12:37: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 10 | print(f'Hello {dict((x,x) for x in "abc")} World') @@ -175,7 +191,7 @@ C402.py:12:37: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') 10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 11 | @@ -185,6 +201,8 @@ C402.py:12:37: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension 14 14 | 15 15 | def f(x): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C402.py:13:5: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' @@ -195,7 +213,7 @@ C402.py:13:5: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 11 | 12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' @@ -205,6 +223,8 @@ C402.py:13:5: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) 15 15 | def f(x): 16 16 | return x + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C402.py:13:38: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' @@ -215,7 +235,7 @@ C402.py:13:38: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 11 | 12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' @@ -225,6 +245,8 @@ C402.py:13:38: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension 15 15 | def f(x): 16 16 | return x + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C402.py:18:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 16 | return x @@ -236,7 +258,7 @@ C402.py:18:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 15 15 | def f(x): 16 16 | return x 17 17 | @@ -246,6 +268,8 @@ C402.py:18:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension 20 20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086 21 21 | dict((k,v)for k,v in d.iteritems() if k in only_args) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C402.py:21:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086 @@ -256,7 +280,7 @@ C402.py:21:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 18 18 | print(f'Hello {dict((x,f(x)) for x in "abc")} World') 19 19 | 20 20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086 @@ -266,4 +290,4 @@ C402.py:21:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) 23 23 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458940 24 24 | dict((*v, k) for k, v in enumerate(calendar.month_abbr)) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap index 8b30f0a8e2537..d16e1dfd1daa4 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap @@ -10,13 +10,15 @@ C403.py:1:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr | = help: Rewrite as a `set` comprehension -ℹ Unsafe fix +Suggested fix: 1 |-s = set([x for x in range(3)]) 1 |+s = {x for x in range(3)} 2 2 | s = set( 3 3 | [x for x in range(3)] 4 4 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C403.py:2:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 1 | s = set([x for x in range(3)]) @@ -30,7 +32,7 @@ C403.py:2:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr | = help: Rewrite as a `set` comprehension -ℹ Unsafe fix +Suggested fix: 1 1 | s = set([x for x in range(3)]) 2 |-s = set( 3 |- [x for x in range(3)] @@ -42,6 +44,8 @@ C403.py:2:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr 6 6 | s = f"{set([x for x in 'ab'])}" 7 7 | s = f'{set([x for x in "ab"])}' + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C403.py:6:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 4 | ) @@ -52,7 +56,7 @@ C403.py:6:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr | = help: Rewrite as a `set` comprehension -ℹ Unsafe fix +Suggested fix: 3 3 | [x for x in range(3)] 4 4 | ) 5 5 | @@ -62,6 +66,8 @@ C403.py:6:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr 8 8 | 9 9 | def f(x): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C403.py:7:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 6 | s = f"{set([x for x in 'ab'])}" @@ -72,7 +78,7 @@ C403.py:7:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr | = help: Rewrite as a `set` comprehension -ℹ Unsafe fix +Suggested fix: 4 4 | ) 5 5 | 6 6 | s = f"{set([x for x in 'ab'])}" @@ -82,6 +88,8 @@ C403.py:7:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr 9 9 | def f(x): 10 10 | return x + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C403.py:12:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 10 | return x @@ -93,7 +101,7 @@ C403.py:12:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | = help: Rewrite as a `set` comprehension -ℹ Unsafe fix +Suggested fix: 9 9 | def f(x): 10 10 | return x 11 11 | @@ -103,6 +111,8 @@ C403.py:12:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp 14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" 15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C403.py:14:9: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 12 | s = f"{set([f(x) for x in 'ab'])}" @@ -113,7 +123,7 @@ C403.py:14:9: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | = help: Rewrite as a `set` comprehension -ℹ Unsafe fix +Suggested fix: 11 11 | 12 12 | s = f"{set([f(x) for x in 'ab'])}" 13 13 | @@ -123,6 +133,8 @@ C403.py:14:9: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp 16 16 | 17 17 | s = set( # comment + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C403.py:14:34: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 12 | s = f"{set([f(x) for x in 'ab'])}" @@ -133,7 +145,7 @@ C403.py:14:34: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` com | = help: Rewrite as a `set` comprehension -ℹ Unsafe fix +Suggested fix: 11 11 | 12 12 | s = f"{set([f(x) for x in 'ab'])}" 13 13 | @@ -143,6 +155,8 @@ C403.py:14:34: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` com 16 16 | 17 17 | s = set( # comment + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C403.py:15:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" @@ -153,7 +167,7 @@ C403.py:15:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | = help: Rewrite as a `set` comprehension -ℹ Unsafe fix +Suggested fix: 12 12 | s = f"{set([f(x) for x in 'ab'])}" 13 13 | 14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" @@ -163,6 +177,8 @@ C403.py:15:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp 17 17 | s = set( # comment 18 18 | [x for x in range(3)] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C403.py:15:33: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" @@ -173,7 +189,7 @@ C403.py:15:33: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` com | = help: Rewrite as a `set` comprehension -ℹ Unsafe fix +Suggested fix: 12 12 | s = f"{set([f(x) for x in 'ab'])}" 13 13 | 14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" @@ -183,6 +199,8 @@ C403.py:15:33: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` com 17 17 | s = set( # comment 18 18 | [x for x in range(3)] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C403.py:17:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" @@ -197,7 +215,7 @@ C403.py:17:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | = help: Rewrite as a `set` comprehension -ℹ Unsafe fix +Suggested fix: 14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" 15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" 16 16 | @@ -211,6 +229,8 @@ C403.py:17:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp 21 21 | s = set([ # comment 22 22 | x for x in range(3) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C403.py:21:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 19 | ) @@ -223,7 +243,7 @@ C403.py:21:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | = help: Rewrite as a `set` comprehension -ℹ Unsafe fix +Suggested fix: 18 18 | [x for x in range(3)] 19 19 | ) 20 20 | @@ -233,4 +253,4 @@ C403.py:21:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp 23 |-]) 23 |+} - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap index 6ee5af803d1de..cffe8558e7eac 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap @@ -9,13 +9,15 @@ C404.py:1:1: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 1 |-dict([(i, i) for i in range(3)]) 1 |+{i: i for i in range(3)} 2 2 | dict([(i, i) for i in range(3)], z=4) 3 3 | 4 4 | def f(x): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C404.py:7:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 5 | return x @@ -27,7 +29,7 @@ C404.py:7:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 4 4 | def f(x): 5 5 | return x 6 6 | @@ -37,6 +39,8 @@ C404.py:7:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp 9 9 | f"{dict([(s, s) for s in 'ab'])}" 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C404.py:8:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 7 | f'{dict([(s,s) for s in "ab"])}' @@ -47,7 +51,7 @@ C404.py:8:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 5 5 | return x 6 6 | 7 7 | f'{dict([(s,s) for s in "ab"])}' @@ -57,6 +61,8 @@ C404.py:8:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 11 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C404.py:9:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 7 | f'{dict([(s,s) for s in "ab"])}' @@ -67,7 +73,7 @@ C404.py:9:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 6 6 | 7 7 | f'{dict([(s,s) for s in "ab"])}' 8 8 | f"{dict([(s,s) for s in 'ab'])}" @@ -77,6 +83,8 @@ C404.py:9:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp 11 11 | 12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C404.py:10:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 8 | f"{dict([(s,s) for s in 'ab'])}" @@ -88,7 +96,7 @@ C404.py:10:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 7 7 | f'{dict([(s,s) for s in "ab"])}' 8 8 | f"{dict([(s,s) for s in 'ab'])}" 9 9 | f"{dict([(s, s) for s in 'ab'])}" @@ -98,6 +106,8 @@ C404.py:10:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com 12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' 13 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C404.py:12:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 10 | f"{dict([(s,f(s)) for s in 'ab'])}" @@ -108,7 +118,7 @@ C404.py:12:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 9 9 | f"{dict([(s, s) for s in 'ab'])}" 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 11 | @@ -118,6 +128,8 @@ C404.py:12:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com 14 14 | 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C404.py:12:34: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 10 | f"{dict([(s,f(s)) for s in 'ab'])}" @@ -128,7 +140,7 @@ C404.py:12:34: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 9 9 | f"{dict([(s, s) for s in 'ab'])}" 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 11 | @@ -138,6 +150,8 @@ C404.py:12:34: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co 14 14 | 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C404.py:13:5: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' @@ -148,7 +162,7 @@ C404.py:13:5: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 11 | 12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' @@ -158,6 +172,8 @@ C404.py:13:5: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 16 16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]])) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C404.py:13:35: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' @@ -168,7 +184,7 @@ C404.py:13:35: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 11 | 12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' @@ -178,6 +194,8 @@ C404.py:13:35: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 16 16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]])) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C404.py:16:14: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 @@ -186,11 +204,11 @@ C404.py:16:14: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co | = help: Rewrite as a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 13 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' 14 14 | 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 16 |-saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]])) 16 |+saved.append({k: v for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]}) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap index 1ab72fff86626..cd99e16e1a412 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap @@ -10,13 +10,15 @@ C405.py:1:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 1 |-set([1, 2]) 1 |+{1, 2} 2 2 | set((1, 2)) 3 3 | set([]) 4 4 | set(()) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:2:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | 1 | set([1, 2]) @@ -27,7 +29,7 @@ C405.py:2:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 1 1 | set([1, 2]) 2 |-set((1, 2)) 2 |+{1, 2} @@ -35,6 +37,8 @@ C405.py:2:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) 4 4 | set(()) 5 5 | set() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:3:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 1 | set([1, 2]) @@ -46,7 +50,7 @@ C405.py:3:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 1 1 | set([1, 2]) 2 2 | set((1, 2)) 3 |-set([]) @@ -55,6 +59,8 @@ C405.py:3:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 5 5 | set() 6 6 | set((1,)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:4:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | 2 | set((1, 2)) @@ -66,7 +72,7 @@ C405.py:4:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 1 1 | set([1, 2]) 2 2 | set((1, 2)) 3 3 | set([]) @@ -77,6 +83,8 @@ C405.py:4:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) 7 7 | set(( 8 8 | 1, + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:6:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | 4 | set(()) @@ -88,7 +96,7 @@ C405.py:6:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 3 3 | set([]) 4 4 | set(()) 5 5 | set() @@ -98,6 +106,8 @@ C405.py:6:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) 8 8 | 1, 9 9 | )) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:7:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | 5 | set() @@ -111,7 +121,7 @@ C405.py:7:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 4 4 | set(()) 5 5 | set() 6 6 | set((1,)) @@ -124,6 +134,8 @@ C405.py:7:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) 11 11 | 1, 12 12 | ]) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:10:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 8 | 1, @@ -137,7 +149,7 @@ C405.py:10:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 7 7 | set(( 8 8 | 1, 9 9 | )) @@ -150,6 +162,8 @@ C405.py:10:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 14 14 | (1,) 15 15 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:13:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | 11 | 1, @@ -163,7 +177,7 @@ C405.py:13:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 10 10 | set([ 11 11 | 1, 12 12 | ]) @@ -175,6 +189,8 @@ C405.py:13:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) 17 15 | [1,] 18 16 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:16:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 14 | (1,) @@ -188,7 +204,7 @@ C405.py:16:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 13 13 | set( 14 14 | (1,) 15 15 | ) @@ -200,6 +216,8 @@ C405.py:16:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 20 18 | f"{set(['a', 'b'])}" 21 19 | f'{set(["a", "b"])}' + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:19:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 17 | [1,] @@ -211,7 +229,7 @@ C405.py:19:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 16 16 | set( 17 17 | [1,] 18 18 | ) @@ -221,6 +239,8 @@ C405.py:19:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 21 21 | f'{set(["a", "b"])}' 22 22 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:20:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 18 | ) @@ -231,7 +251,7 @@ C405.py:20:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 17 17 | [1,] 18 18 | ) 19 19 | f"{set([1,2,3])}" @@ -241,6 +261,8 @@ C405.py:20:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 22 22 | 23 23 | f"{set(['a', 'b']) - set(['a'])}" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:21:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 19 | f"{set([1,2,3])}" @@ -252,7 +274,7 @@ C405.py:21:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 18 18 | ) 19 19 | f"{set([1,2,3])}" 20 20 | f"{set(['a', 'b'])}" @@ -262,6 +284,8 @@ C405.py:21:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 23 23 | f"{set(['a', 'b']) - set(['a'])}" 24 24 | f"{ set(['a', 'b']) - set(['a']) }" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:23:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 21 | f'{set(["a", "b"])}' @@ -273,7 +297,7 @@ C405.py:23:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 20 20 | f"{set(['a', 'b'])}" 21 21 | f'{set(["a", "b"])}' 22 22 | @@ -283,6 +307,8 @@ C405.py:23:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:23:22: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 21 | f'{set(["a", "b"])}' @@ -294,7 +320,7 @@ C405.py:23:22: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 20 20 | f"{set(['a', 'b'])}" 21 21 | f'{set(["a", "b"])}' 22 22 | @@ -304,6 +330,8 @@ C405.py:23:22: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:24:5: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 23 | f"{set(['a', 'b']) - set(['a'])}" @@ -314,7 +342,7 @@ C405.py:24:5: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 21 21 | f'{set(["a", "b"])}' 22 22 | 23 23 | f"{set(['a', 'b']) - set(['a'])}" @@ -323,6 +351,8 @@ C405.py:24:5: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:24:23: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 23 | f"{set(['a', 'b']) - set(['a'])}" @@ -333,7 +363,7 @@ C405.py:24:23: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 21 21 | f'{set(["a", "b"])}' 22 22 | 23 23 | f"{set(['a', 'b']) - set(['a'])}" @@ -342,6 +372,8 @@ C405.py:24:23: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:25:6: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 23 | f"{set(['a', 'b']) - set(['a'])}" @@ -352,7 +384,7 @@ C405.py:25:6: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 22 22 | 23 23 | f"{set(['a', 'b']) - set(['a'])}" 24 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -360,6 +392,8 @@ C405.py:25:6: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 25 |+f"a { {'a', 'b'} - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:25:24: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 23 | f"{set(['a', 'b']) - set(['a'])}" @@ -370,7 +404,7 @@ C405.py:25:24: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 22 22 | 23 23 | f"{set(['a', 'b']) - set(['a'])}" 24 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -378,6 +412,8 @@ C405.py:25:24: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 25 |+f"a {set(['a', 'b']) - {'a'} } b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:26:7: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -387,13 +423,15 @@ C405.py:26:7: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 23 23 | f"{set(['a', 'b']) - set(['a'])}" 24 24 | f"{ set(['a', 'b']) - set(['a']) }" 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 |-f"a { set(['a', 'b']) - set(['a']) } b" 26 |+f"a { {'a', 'b'} - set(['a']) } b" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C405.py:26:25: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -403,11 +441,11 @@ C405.py:26:25: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Unsafe fix +Suggested fix: 23 23 | f"{set(['a', 'b']) - set(['a'])}" 24 24 | f"{ set(['a', 'b']) - set(['a']) }" 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 |-f"a { set(['a', 'b']) - set(['a']) } b" 26 |+f"a { set(['a', 'b']) - {'a'} } b" - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap index d9847ec6c6178..d2a8de7a4a578 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap @@ -10,13 +10,15 @@ C406.py:1:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal) | = help: Rewrite as a `dict` literal -ℹ Unsafe fix +Suggested fix: 1 |-d1 = dict([(1, 2)]) 1 |+d1 = {1: 2} 2 2 | d2 = dict(((1, 2),)) 3 3 | d3 = dict([]) 4 4 | d4 = dict(()) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C406.py:2:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) | 1 | d1 = dict([(1, 2)]) @@ -27,7 +29,7 @@ C406.py:2:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) | = help: Rewrite as a `dict` literal -ℹ Unsafe fix +Suggested fix: 1 1 | d1 = dict([(1, 2)]) 2 |-d2 = dict(((1, 2),)) 2 |+d2 = {1: 2,} @@ -35,6 +37,8 @@ C406.py:2:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) 4 4 | d4 = dict(()) 5 5 | d5 = dict() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C406.py:3:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal) | 1 | d1 = dict([(1, 2)]) @@ -46,7 +50,7 @@ C406.py:3:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal) | = help: Rewrite as a `dict` literal -ℹ Unsafe fix +Suggested fix: 1 1 | d1 = dict([(1, 2)]) 2 2 | d2 = dict(((1, 2),)) 3 |-d3 = dict([]) @@ -54,6 +58,8 @@ C406.py:3:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal) 4 4 | d4 = dict(()) 5 5 | d5 = dict() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C406.py:4:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) | 2 | d2 = dict(((1, 2),)) @@ -64,7 +70,7 @@ C406.py:4:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) | = help: Rewrite as a `dict` literal -ℹ Unsafe fix +Suggested fix: 1 1 | d1 = dict([(1, 2)]) 2 2 | d2 = dict(((1, 2),)) 3 3 | d3 = dict([]) @@ -72,4 +78,4 @@ C406.py:4:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) 4 |+d4 = {} 5 5 | d5 = dict() - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap index 6b4414d1b4a87..c035876cc2687 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap @@ -10,13 +10,15 @@ C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 1 |-t = tuple() 1 |+t = () 2 2 | l = list() 3 3 | d1 = dict() 4 4 | d2 = dict(a=1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) | 1 | t = tuple() @@ -27,7 +29,7 @@ C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 1 1 | t = tuple() 2 |-l = list() 2 |+l = [] @@ -35,6 +37,8 @@ C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) 4 4 | d2 = dict(a=1) 5 5 | d3 = dict(**d2) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 1 | t = tuple() @@ -46,7 +50,7 @@ C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 1 1 | t = tuple() 2 2 | l = list() 3 |-d1 = dict() @@ -55,6 +59,8 @@ C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) 5 5 | d3 = dict(**d2) 6 6 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:4:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 2 | l = list() @@ -65,7 +71,7 @@ C408.py:4:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 1 1 | t = tuple() 2 2 | l = list() 3 3 | d1 = dict() @@ -75,6 +81,8 @@ C408.py:4:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) 6 6 | 7 7 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:14:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 12 | a = list() @@ -86,7 +94,7 @@ C408.py:14:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 11 11 | 12 12 | a = list() 13 13 | @@ -96,6 +104,8 @@ C408.py:14:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) 16 16 | f"{dict()}" 17 17 | f"a {dict()} b" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:15:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 14 | f"{dict(x='y')}" @@ -106,7 +116,7 @@ C408.py:15:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 12 12 | a = list() 13 13 | 14 14 | f"{dict(x='y')}" @@ -116,6 +126,8 @@ C408.py:15:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) 17 17 | f"a {dict()} b" 18 18 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 14 | f"{dict(x='y')}" @@ -126,7 +138,7 @@ C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 13 13 | 14 14 | f"{dict(x='y')}" 15 15 | f'{dict(x="y")}' @@ -136,6 +148,8 @@ C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 15 | f'{dict(x="y")}' @@ -147,7 +161,7 @@ C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 14 14 | f"{dict(x='y')}" 15 15 | f'{dict(x="y")}' 16 16 | f"{dict()}" @@ -157,6 +171,8 @@ C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) 19 19 | f"{dict(x='y') | dict(y='z')}" 20 20 | f"{ dict(x='y') | dict(y='z') }" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:19:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 17 | f"a {dict()} b" @@ -168,7 +184,7 @@ C408.py:19:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 16 16 | f"{dict()}" 17 17 | f"a {dict()} b" 18 18 | @@ -178,6 +194,8 @@ C408.py:19:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) 21 21 | f"a {dict(x='y') | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:19:18: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 17 | f"a {dict()} b" @@ -189,7 +207,7 @@ C408.py:19:18: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 16 16 | f"{dict()}" 17 17 | f"a {dict()} b" 18 18 | @@ -199,6 +217,8 @@ C408.py:19:18: C408 [*] Unnecessary `dict` call (rewrite as a literal) 21 21 | f"a {dict(x='y') | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:20:5: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 19 | f"{dict(x='y') | dict(y='z')}" @@ -209,7 +229,7 @@ C408.py:20:5: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 17 17 | f"a {dict()} b" 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" @@ -219,6 +239,8 @@ C408.py:20:5: C408 [*] Unnecessary `dict` call (rewrite as a literal) 22 22 | f"a { dict(x='y') | dict(y='z') } b" 23 23 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:20:19: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 19 | f"{dict(x='y') | dict(y='z')}" @@ -229,7 +251,7 @@ C408.py:20:19: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 17 17 | f"a {dict()} b" 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" @@ -239,6 +261,8 @@ C408.py:20:19: C408 [*] Unnecessary `dict` call (rewrite as a literal) 22 22 | f"a { dict(x='y') | dict(y='z') } b" 23 23 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:21:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 19 | f"{dict(x='y') | dict(y='z')}" @@ -249,7 +273,7 @@ C408.py:21:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" 20 20 | f"{ dict(x='y') | dict(y='z') }" @@ -259,6 +283,8 @@ C408.py:21:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) 23 23 | 24 24 | dict( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:21:20: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 19 | f"{dict(x='y') | dict(y='z')}" @@ -269,7 +295,7 @@ C408.py:21:20: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" 20 20 | f"{ dict(x='y') | dict(y='z') }" @@ -279,6 +305,8 @@ C408.py:21:20: C408 [*] Unnecessary `dict` call (rewrite as a literal) 23 23 | 24 24 | dict( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:22:7: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 20 | f"{ dict(x='y') | dict(y='z') }" @@ -290,7 +318,7 @@ C408.py:22:7: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 19 19 | f"{dict(x='y') | dict(y='z')}" 20 20 | f"{ dict(x='y') | dict(y='z') }" 21 21 | f"a {dict(x='y') | dict(y='z')} b" @@ -300,6 +328,8 @@ C408.py:22:7: C408 [*] Unnecessary `dict` call (rewrite as a literal) 24 24 | dict( 25 25 | # comment + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:22:21: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 20 | f"{ dict(x='y') | dict(y='z') }" @@ -311,7 +341,7 @@ C408.py:22:21: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 19 19 | f"{dict(x='y') | dict(y='z')}" 20 20 | f"{ dict(x='y') | dict(y='z') }" 21 21 | f"a {dict(x='y') | dict(y='z')} b" @@ -321,6 +351,8 @@ C408.py:22:21: C408 [*] Unnecessary `dict` call (rewrite as a literal) 24 24 | dict( 25 25 | # comment + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:24:1: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 22 | f"a { dict(x='y') | dict(y='z') } b" @@ -334,7 +366,7 @@ C408.py:24:1: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 21 21 | f"a {dict(x='y') | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" 23 23 | @@ -347,6 +379,8 @@ C408.py:24:1: C408 [*] Unnecessary `dict` call (rewrite as a literal) 28 28 | tuple( # comment 29 29 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:28:1: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | 26 | ) @@ -357,7 +391,7 @@ C408.py:28:1: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 25 25 | # comment 26 26 | ) 27 27 | @@ -365,4 +399,4 @@ C408.py:28:1: C408 [*] Unnecessary `tuple` call (rewrite as a literal) 28 |+( # comment 29 29 | ) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap index 59c761f4aa603..5fa0a099b439c 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap @@ -10,13 +10,15 @@ C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 1 |-t = tuple() 1 |+t = () 2 2 | l = list() 3 3 | d1 = dict() 4 4 | d2 = dict(a=1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) | 1 | t = tuple() @@ -27,7 +29,7 @@ C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 1 1 | t = tuple() 2 |-l = list() 2 |+l = [] @@ -35,6 +37,8 @@ C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) 4 4 | d2 = dict(a=1) 5 5 | d3 = dict(**d2) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 1 | t = tuple() @@ -46,7 +50,7 @@ C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 1 1 | t = tuple() 2 2 | l = list() 3 |-d1 = dict() @@ -55,6 +59,8 @@ C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) 5 5 | d3 = dict(**d2) 6 6 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 14 | f"{dict(x='y')}" @@ -65,7 +71,7 @@ C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 13 13 | 14 14 | f"{dict(x='y')}" 15 15 | f'{dict(x="y")}' @@ -75,6 +81,8 @@ C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 15 | f'{dict(x="y")}' @@ -86,7 +94,7 @@ C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 14 14 | f"{dict(x='y')}" 15 15 | f'{dict(x="y")}' 16 16 | f"{dict()}" @@ -96,6 +104,8 @@ C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) 19 19 | f"{dict(x='y') | dict(y='z')}" 20 20 | f"{ dict(x='y') | dict(y='z') }" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:24:1: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 22 | f"a { dict(x='y') | dict(y='z') } b" @@ -109,7 +119,7 @@ C408.py:24:1: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 21 21 | f"a {dict(x='y') | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" 23 23 | @@ -122,6 +132,8 @@ C408.py:24:1: C408 [*] Unnecessary `dict` call (rewrite as a literal) 28 28 | tuple( # comment 29 29 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C408.py:28:1: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | 26 | ) @@ -132,7 +144,7 @@ C408.py:28:1: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Unsafe fix +Suggested fix: 25 25 | # comment 26 26 | ) 27 27 | @@ -140,4 +152,4 @@ C408.py:28:1: C408 [*] Unnecessary `tuple` call (rewrite as a literal) 28 |+( # comment 29 29 | ) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap index e7feb37b081cd..8483a397be61e 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap @@ -10,13 +10,15 @@ C409.py:1:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as | = help: Rewrite as a `tuple` literal -ℹ Unsafe fix +Suggested fix: 1 |-t1 = tuple([]) 1 |+t1 = () 2 2 | t2 = tuple([1, 2]) 3 3 | t3 = tuple((1, 2)) 4 4 | t4 = tuple([ + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C409.py:2:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | 1 | t1 = tuple([]) @@ -27,7 +29,7 @@ C409.py:2:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as | = help: Rewrite as a `tuple` literal -ℹ Unsafe fix +Suggested fix: 1 1 | t1 = tuple([]) 2 |-t2 = tuple([1, 2]) 2 |+t2 = (1, 2) @@ -35,6 +37,8 @@ C409.py:2:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as 4 4 | t4 = tuple([ 5 5 | 1, + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C409.py:3:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) | 1 | t1 = tuple([]) @@ -46,7 +50,7 @@ C409.py:3:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th | = help: Remove outer `tuple` call -ℹ Unsafe fix +Suggested fix: 1 1 | t1 = tuple([]) 2 2 | t2 = tuple([1, 2]) 3 |-t3 = tuple((1, 2)) @@ -55,6 +59,8 @@ C409.py:3:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th 5 5 | 1, 6 6 | 2 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | 2 | t2 = tuple([1, 2]) @@ -70,7 +76,7 @@ C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as | = help: Rewrite as a `tuple` literal -ℹ Unsafe fix +Suggested fix: 1 1 | t1 = tuple([]) 2 2 | t2 = tuple([1, 2]) 3 3 | t3 = tuple((1, 2)) @@ -84,6 +90,8 @@ C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as 9 9 | (1, 2) 10 10 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C409.py:8:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) | 6 | 2 @@ -98,7 +106,7 @@ C409.py:8:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th | = help: Remove outer `tuple` call -ℹ Unsafe fix +Suggested fix: 5 5 | 1, 6 6 | 2 7 7 | ]) @@ -110,6 +118,8 @@ C409.py:8:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th 12 10 | tuple( # comment 13 11 | [1, 2] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C409.py:12:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | 10 | ) @@ -123,7 +133,7 @@ C409.py:12:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a | = help: Rewrite as a `tuple` literal -ℹ Unsafe fix +Suggested fix: 9 9 | (1, 2) 10 10 | ) 11 11 | @@ -135,6 +145,8 @@ C409.py:12:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a 16 14 | tuple([ # comment 17 15 | 1, 2 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C409.py:16:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | 14 | ) @@ -148,7 +160,7 @@ C409.py:16:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a | = help: Rewrite as a `tuple` literal -ℹ Unsafe fix +Suggested fix: 13 13 | [1, 2] 14 14 | ) 15 15 | @@ -161,6 +173,8 @@ C409.py:16:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a 20 20 | tuple(( 21 21 | 1, + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C409.py:20:1: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) | 18 | ]) @@ -174,7 +188,7 @@ C409.py:20:1: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove t | = help: Remove outer `tuple` call -ℹ Unsafe fix +Suggested fix: 17 17 | 1, 2 18 18 | ]) 19 19 | @@ -187,6 +201,8 @@ C409.py:20:1: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove t 24 24 | t6 = tuple([1]) 25 25 | t7 = tuple((1,)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C409.py:24:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | 22 | )) @@ -198,7 +214,7 @@ C409.py:24:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a | = help: Rewrite as a `tuple` literal -ℹ Unsafe fix +Suggested fix: 21 21 | 1, 22 22 | )) 23 23 | @@ -207,6 +223,8 @@ C409.py:24:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a 25 25 | t7 = tuple((1,)) 26 26 | t8 = tuple([1,]) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C409.py:25:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) | 24 | t6 = tuple([1]) @@ -216,7 +234,7 @@ C409.py:25:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove t | = help: Remove outer `tuple` call -ℹ Unsafe fix +Suggested fix: 22 22 | )) 23 23 | 24 24 | t6 = tuple([1]) @@ -224,6 +242,8 @@ C409.py:25:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove t 25 |+t7 = (1,) 26 26 | t8 = tuple([1,]) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C409.py:26:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | 24 | t6 = tuple([1]) @@ -233,9 +253,11 @@ C409.py:26:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a | = help: Rewrite as a `tuple` literal -ℹ Unsafe fix +Suggested fix: 23 23 | 24 24 | t6 = tuple([1]) 25 25 | t7 = tuple((1,)) 26 |-t8 = tuple([1,]) 26 |+t8 = (1,) + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap index 921547ca2dedc..0405f732193c6 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap @@ -10,13 +10,15 @@ C410.py:1:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the | = help: Remove outer `list` call -ℹ Unsafe fix +Suggested fix: 1 |-l1 = list([1, 2]) 1 |+l1 = [1, 2] 2 2 | l2 = list((1, 2)) 3 3 | l3 = list([]) 4 4 | l4 = list(()) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C410.py:2:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal) | 1 | l1 = list([1, 2]) @@ -27,7 +29,7 @@ C410.py:2:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as | = help: Rewrite as a `list` literal -ℹ Unsafe fix +Suggested fix: 1 1 | l1 = list([1, 2]) 2 |-l2 = list((1, 2)) 2 |+l2 = [1, 2] @@ -35,6 +37,8 @@ C410.py:2:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as 4 4 | l4 = list(()) 5 5 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C410.py:3:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) | 1 | l1 = list([1, 2]) @@ -45,7 +49,7 @@ C410.py:3:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the | = help: Remove outer `list` call -ℹ Unsafe fix +Suggested fix: 1 1 | l1 = list([1, 2]) 2 2 | l2 = list((1, 2)) 3 |-l3 = list([]) @@ -54,6 +58,8 @@ C410.py:3:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the 5 5 | 6 6 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C410.py:4:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal) | 2 | l2 = list((1, 2)) @@ -63,7 +69,7 @@ C410.py:4:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as | = help: Rewrite as a `list` literal -ℹ Unsafe fix +Suggested fix: 1 1 | l1 = list([1, 2]) 2 2 | l2 = list((1, 2)) 3 3 | l3 = list([]) @@ -73,6 +79,8 @@ C410.py:4:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as 6 6 | 7 7 | list( # comment + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C410.py:7:1: C410 [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) | 7 | / list( # comment @@ -84,7 +92,7 @@ C410.py:7:1: C410 [*] Unnecessary `list` literal passed to `list()` (remove the | = help: Remove outer `list` call -ℹ Unsafe fix +Suggested fix: 4 4 | l4 = list(()) 5 5 | 6 6 | @@ -96,6 +104,8 @@ C410.py:7:1: C410 [*] Unnecessary `list` literal passed to `list()` (remove the 11 9 | list([ # comment 12 10 | 1, 2 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C410.py:11:1: C410 [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) | 9 | ) @@ -107,7 +117,7 @@ C410.py:11:1: C410 [*] Unnecessary `list` literal passed to `list()` (remove the | = help: Remove outer `list` call -ℹ Unsafe fix +Suggested fix: 8 8 | [1, 2] 9 9 | ) 10 10 | @@ -117,4 +127,4 @@ C410.py:11:1: C410 [*] Unnecessary `list` literal passed to `list()` (remove the 13 |-]) 13 |+] - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap index 763f99136ea68..ce35b4c9f08ac 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap @@ -9,9 +9,9 @@ C411.py:2:1: C411 [*] Unnecessary `list` call (remove the outer call to `list()` | = help: Remove outer `list` call -ℹ Unsafe fix +Suggested fix: 1 1 | x = [1, 2, 3] 2 |-list([i for i in x]) 2 |+[i for i in x] - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap index def04f25aea8f..cd47b5229e10e 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap @@ -12,7 +12,7 @@ C413.py:3:1: C413 [*] Unnecessary `list` call around `sorted()` | = help: Remove unnecessary `list` call -ℹ Safe fix +Suggested fix: 1 1 | x = [2, 3, 1] 2 2 | list(x) 3 |-list(sorted(x)) @@ -21,6 +21,8 @@ C413.py:3:1: C413 [*] Unnecessary `list` call around `sorted()` 5 5 | reversed(sorted(x, key=lambda e: e)) 6 6 | reversed(sorted(x, reverse=True)) + Run `ruff check --fix` to apply this fix. + C413.py:4:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 2 | list(x) @@ -32,7 +34,7 @@ C413.py:4:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Unsafe fix +Suggested fix: 1 1 | x = [2, 3, 1] 2 2 | list(x) 3 3 | list(sorted(x)) @@ -42,6 +44,8 @@ C413.py:4:1: C413 [*] Unnecessary `reversed` call around `sorted()` 6 6 | reversed(sorted(x, reverse=True)) 7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C413.py:5:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 3 | list(sorted(x)) @@ -53,7 +57,7 @@ C413.py:5:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Unsafe fix +Suggested fix: 2 2 | list(x) 3 3 | list(sorted(x)) 4 4 | reversed(sorted(x)) @@ -63,6 +67,8 @@ C413.py:5:1: C413 [*] Unnecessary `reversed` call around `sorted()` 7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) 8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C413.py:6:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 4 | reversed(sorted(x)) @@ -74,7 +80,7 @@ C413.py:6:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Unsafe fix +Suggested fix: 3 3 | list(sorted(x)) 4 4 | reversed(sorted(x)) 5 5 | reversed(sorted(x, key=lambda e: e)) @@ -84,6 +90,8 @@ C413.py:6:1: C413 [*] Unnecessary `reversed` call around `sorted()` 8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) 9 9 | reversed(sorted(x, reverse=False)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C413.py:7:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 5 | reversed(sorted(x, key=lambda e: e)) @@ -95,7 +103,7 @@ C413.py:7:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Unsafe fix +Suggested fix: 4 4 | reversed(sorted(x)) 5 5 | reversed(sorted(x, key=lambda e: e)) 6 6 | reversed(sorted(x, reverse=True)) @@ -105,6 +113,8 @@ C413.py:7:1: C413 [*] Unnecessary `reversed` call around `sorted()` 9 9 | reversed(sorted(x, reverse=False)) 10 10 | reversed(sorted(x, reverse=x)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C413.py:8:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 6 | reversed(sorted(x, reverse=True)) @@ -116,7 +126,7 @@ C413.py:8:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Unsafe fix +Suggested fix: 5 5 | reversed(sorted(x, key=lambda e: e)) 6 6 | reversed(sorted(x, reverse=True)) 7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) @@ -126,6 +136,8 @@ C413.py:8:1: C413 [*] Unnecessary `reversed` call around `sorted()` 10 10 | reversed(sorted(x, reverse=x)) 11 11 | reversed(sorted(x, reverse=not x)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C413.py:9:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) @@ -137,7 +149,7 @@ C413.py:9:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Unsafe fix +Suggested fix: 6 6 | reversed(sorted(x, reverse=True)) 7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) 8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) @@ -147,6 +159,8 @@ C413.py:9:1: C413 [*] Unnecessary `reversed` call around `sorted()` 11 11 | reversed(sorted(x, reverse=not x)) 12 12 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C413.py:10:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) @@ -157,7 +171,7 @@ C413.py:10:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Unsafe fix +Suggested fix: 7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) 8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) 9 9 | reversed(sorted(x, reverse=False)) @@ -167,6 +181,8 @@ C413.py:10:1: C413 [*] Unnecessary `reversed` call around `sorted()` 12 12 | 13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C413.py:11:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 9 | reversed(sorted(x, reverse=False)) @@ -178,7 +194,7 @@ C413.py:11:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Unsafe fix +Suggested fix: 8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) 9 9 | reversed(sorted(x, reverse=False)) 10 10 | reversed(sorted(x, reverse=x)) @@ -188,6 +204,8 @@ C413.py:11:1: C413 [*] Unnecessary `reversed` call around `sorted()` 13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 14 14 | reversed(sorted(i for i in range(42))) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C413.py:14:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 @@ -197,7 +215,7 @@ C413.py:14:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Unsafe fix +Suggested fix: 11 11 | reversed(sorted(x, reverse=not x)) 12 12 | 13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 @@ -207,6 +225,8 @@ C413.py:14:1: C413 [*] Unnecessary `reversed` call around `sorted()` 16 16 | 17 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C413.py:15:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 @@ -218,7 +238,7 @@ C413.py:15:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Unsafe fix +Suggested fix: 12 12 | 13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 14 14 | reversed(sorted(i for i in range(42))) @@ -228,6 +248,8 @@ C413.py:15:1: C413 [*] Unnecessary `reversed` call around `sorted()` 17 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335 18 18 | reversed(sorted([1, 2, 3], reverse=False or True)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C413.py:18:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335 @@ -237,7 +259,7 @@ C413.py:18:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Unsafe fix +Suggested fix: 15 15 | reversed(sorted((i for i in range(42)), reverse=True)) 16 16 | 17 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335 @@ -245,6 +267,8 @@ C413.py:18:1: C413 [*] Unnecessary `reversed` call around `sorted()` 18 |+sorted([1, 2, 3], reverse=not (False or True)) 19 19 | reversed(sorted([1, 2, 3], reverse=(False or True))) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C413.py:19:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335 @@ -254,9 +278,11 @@ C413.py:19:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Unsafe fix +Suggested fix: 16 16 | 17 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335 18 18 | reversed(sorted([1, 2, 3], reverse=False or True)) 19 |-reversed(sorted([1, 2, 3], reverse=(False or True))) 19 |+sorted([1, 2, 3], reverse=not (False or True)) + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap index 1551f9ccec221..db3d510c9b599 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap @@ -11,7 +11,7 @@ C414.py:2:1: C414 [*] Unnecessary `list` call within `list()` | = help: Remove the inner `list` call -ℹ Unsafe fix +Suggested fix: 1 1 | x = [1, 2, 3] 2 |-list(list(x)) 2 |+list(x) @@ -19,6 +19,8 @@ C414.py:2:1: C414 [*] Unnecessary `list` call within `list()` 4 4 | tuple(list(x)) 5 5 | tuple(tuple(x)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:3:1: C414 [*] Unnecessary `tuple` call within `list()` | 1 | x = [1, 2, 3] @@ -30,7 +32,7 @@ C414.py:3:1: C414 [*] Unnecessary `tuple` call within `list()` | = help: Remove the inner `tuple` call -ℹ Unsafe fix +Suggested fix: 1 1 | x = [1, 2, 3] 2 2 | list(list(x)) 3 |-list(tuple(x)) @@ -39,6 +41,8 @@ C414.py:3:1: C414 [*] Unnecessary `tuple` call within `list()` 5 5 | tuple(tuple(x)) 6 6 | set(set(x)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:4:1: C414 [*] Unnecessary `list` call within `tuple()` | 2 | list(list(x)) @@ -50,7 +54,7 @@ C414.py:4:1: C414 [*] Unnecessary `list` call within `tuple()` | = help: Remove the inner `list` call -ℹ Unsafe fix +Suggested fix: 1 1 | x = [1, 2, 3] 2 2 | list(list(x)) 3 3 | list(tuple(x)) @@ -60,6 +64,8 @@ C414.py:4:1: C414 [*] Unnecessary `list` call within `tuple()` 6 6 | set(set(x)) 7 7 | set(list(x)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:5:1: C414 [*] Unnecessary `tuple` call within `tuple()` | 3 | list(tuple(x)) @@ -71,7 +77,7 @@ C414.py:5:1: C414 [*] Unnecessary `tuple` call within `tuple()` | = help: Remove the inner `tuple` call -ℹ Unsafe fix +Suggested fix: 2 2 | list(list(x)) 3 3 | list(tuple(x)) 4 4 | tuple(list(x)) @@ -81,6 +87,8 @@ C414.py:5:1: C414 [*] Unnecessary `tuple` call within `tuple()` 7 7 | set(list(x)) 8 8 | set(tuple(x)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:6:1: C414 [*] Unnecessary `set` call within `set()` | 4 | tuple(list(x)) @@ -92,7 +100,7 @@ C414.py:6:1: C414 [*] Unnecessary `set` call within `set()` | = help: Remove the inner `set` call -ℹ Unsafe fix +Suggested fix: 3 3 | list(tuple(x)) 4 4 | tuple(list(x)) 5 5 | tuple(tuple(x)) @@ -102,6 +110,8 @@ C414.py:6:1: C414 [*] Unnecessary `set` call within `set()` 8 8 | set(tuple(x)) 9 9 | set(sorted(x)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:7:1: C414 [*] Unnecessary `list` call within `set()` | 5 | tuple(tuple(x)) @@ -113,7 +123,7 @@ C414.py:7:1: C414 [*] Unnecessary `list` call within `set()` | = help: Remove the inner `list` call -ℹ Unsafe fix +Suggested fix: 4 4 | tuple(list(x)) 5 5 | tuple(tuple(x)) 6 6 | set(set(x)) @@ -123,6 +133,8 @@ C414.py:7:1: C414 [*] Unnecessary `list` call within `set()` 9 9 | set(sorted(x)) 10 10 | set(sorted(x, key=lambda y: y)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:8:1: C414 [*] Unnecessary `tuple` call within `set()` | 6 | set(set(x)) @@ -134,7 +146,7 @@ C414.py:8:1: C414 [*] Unnecessary `tuple` call within `set()` | = help: Remove the inner `tuple` call -ℹ Unsafe fix +Suggested fix: 5 5 | tuple(tuple(x)) 6 6 | set(set(x)) 7 7 | set(list(x)) @@ -144,6 +156,8 @@ C414.py:8:1: C414 [*] Unnecessary `tuple` call within `set()` 10 10 | set(sorted(x, key=lambda y: y)) 11 11 | set(reversed(x)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:9:1: C414 [*] Unnecessary `sorted` call within `set()` | 7 | set(list(x)) @@ -155,7 +169,7 @@ C414.py:9:1: C414 [*] Unnecessary `sorted` call within `set()` | = help: Remove the inner `sorted` call -ℹ Unsafe fix +Suggested fix: 6 6 | set(set(x)) 7 7 | set(list(x)) 8 8 | set(tuple(x)) @@ -165,6 +179,8 @@ C414.py:9:1: C414 [*] Unnecessary `sorted` call within `set()` 11 11 | set(reversed(x)) 12 12 | sorted(list(x)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:10:1: C414 [*] Unnecessary `sorted` call within `set()` | 8 | set(tuple(x)) @@ -176,7 +192,7 @@ C414.py:10:1: C414 [*] Unnecessary `sorted` call within `set()` | = help: Remove the inner `sorted` call -ℹ Unsafe fix +Suggested fix: 7 7 | set(list(x)) 8 8 | set(tuple(x)) 9 9 | set(sorted(x)) @@ -186,6 +202,8 @@ C414.py:10:1: C414 [*] Unnecessary `sorted` call within `set()` 12 12 | sorted(list(x)) 13 13 | sorted(tuple(x)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:11:1: C414 [*] Unnecessary `reversed` call within `set()` | 9 | set(sorted(x)) @@ -197,7 +215,7 @@ C414.py:11:1: C414 [*] Unnecessary `reversed` call within `set()` | = help: Remove the inner `reversed` call -ℹ Unsafe fix +Suggested fix: 8 8 | set(tuple(x)) 9 9 | set(sorted(x)) 10 10 | set(sorted(x, key=lambda y: y)) @@ -207,6 +225,8 @@ C414.py:11:1: C414 [*] Unnecessary `reversed` call within `set()` 13 13 | sorted(tuple(x)) 14 14 | sorted(sorted(x)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:12:1: C414 [*] Unnecessary `list` call within `sorted()` | 10 | set(sorted(x, key=lambda y: y)) @@ -218,7 +238,7 @@ C414.py:12:1: C414 [*] Unnecessary `list` call within `sorted()` | = help: Remove the inner `list` call -ℹ Unsafe fix +Suggested fix: 9 9 | set(sorted(x)) 10 10 | set(sorted(x, key=lambda y: y)) 11 11 | set(reversed(x)) @@ -228,6 +248,8 @@ C414.py:12:1: C414 [*] Unnecessary `list` call within `sorted()` 14 14 | sorted(sorted(x)) 15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:13:1: C414 [*] Unnecessary `tuple` call within `sorted()` | 11 | set(reversed(x)) @@ -239,7 +261,7 @@ C414.py:13:1: C414 [*] Unnecessary `tuple` call within `sorted()` | = help: Remove the inner `tuple` call -ℹ Unsafe fix +Suggested fix: 10 10 | set(sorted(x, key=lambda y: y)) 11 11 | set(reversed(x)) 12 12 | sorted(list(x)) @@ -249,6 +271,8 @@ C414.py:13:1: C414 [*] Unnecessary `tuple` call within `sorted()` 15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) 16 16 | sorted(sorted(x, reverse=True), reverse=True) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:14:1: C414 [*] Unnecessary `sorted` call within `sorted()` | 12 | sorted(list(x)) @@ -260,7 +284,7 @@ C414.py:14:1: C414 [*] Unnecessary `sorted` call within `sorted()` | = help: Remove the inner `sorted` call -ℹ Unsafe fix +Suggested fix: 11 11 | set(reversed(x)) 12 12 | sorted(list(x)) 13 13 | sorted(tuple(x)) @@ -270,6 +294,8 @@ C414.py:14:1: C414 [*] Unnecessary `sorted` call within `sorted()` 16 16 | sorted(sorted(x, reverse=True), reverse=True) 17 17 | sorted(reversed(x)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:15:1: C414 [*] Unnecessary `sorted` call within `sorted()` | 13 | sorted(tuple(x)) @@ -281,7 +307,7 @@ C414.py:15:1: C414 [*] Unnecessary `sorted` call within `sorted()` | = help: Remove the inner `sorted` call -ℹ Unsafe fix +Suggested fix: 12 12 | sorted(list(x)) 13 13 | sorted(tuple(x)) 14 14 | sorted(sorted(x)) @@ -291,6 +317,8 @@ C414.py:15:1: C414 [*] Unnecessary `sorted` call within `sorted()` 17 17 | sorted(reversed(x)) 18 18 | sorted(list(x), key=lambda y: y) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:16:1: C414 [*] Unnecessary `sorted` call within `sorted()` | 14 | sorted(sorted(x)) @@ -302,7 +330,7 @@ C414.py:16:1: C414 [*] Unnecessary `sorted` call within `sorted()` | = help: Remove the inner `sorted` call -ℹ Unsafe fix +Suggested fix: 13 13 | sorted(tuple(x)) 14 14 | sorted(sorted(x)) 15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) @@ -312,6 +340,8 @@ C414.py:16:1: C414 [*] Unnecessary `sorted` call within `sorted()` 18 18 | sorted(list(x), key=lambda y: y) 19 19 | tuple( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:17:1: C414 [*] Unnecessary `reversed` call within `sorted()` | 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) @@ -323,7 +353,7 @@ C414.py:17:1: C414 [*] Unnecessary `reversed` call within `sorted()` | = help: Remove the inner `reversed` call -ℹ Unsafe fix +Suggested fix: 14 14 | sorted(sorted(x)) 15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) 16 16 | sorted(sorted(x, reverse=True), reverse=True) @@ -333,6 +363,8 @@ C414.py:17:1: C414 [*] Unnecessary `reversed` call within `sorted()` 19 19 | tuple( 20 20 | list( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:18:1: C414 [*] Unnecessary `list` call within `sorted()` | 16 | sorted(sorted(x, reverse=True), reverse=True) @@ -344,7 +376,7 @@ C414.py:18:1: C414 [*] Unnecessary `list` call within `sorted()` | = help: Remove the inner `list` call -ℹ Unsafe fix +Suggested fix: 15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) 16 16 | sorted(sorted(x, reverse=True), reverse=True) 17 17 | sorted(reversed(x)) @@ -354,6 +386,8 @@ C414.py:18:1: C414 [*] Unnecessary `list` call within `sorted()` 20 20 | list( 21 21 | [x, 3, "hell"\ + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:19:1: C414 [*] Unnecessary `list` call within `tuple()` | 17 | sorted(reversed(x)) @@ -370,7 +404,7 @@ C414.py:19:1: C414 [*] Unnecessary `list` call within `tuple()` | = help: Remove the inner `list` call -ℹ Unsafe fix +Suggested fix: 17 17 | sorted(reversed(x)) 18 18 | sorted(list(x), key=lambda y: y) 19 19 | tuple( @@ -383,6 +417,8 @@ C414.py:19:1: C414 [*] Unnecessary `list` call within `tuple()` 25 23 | set(set()) 26 24 | set(list()) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:25:1: C414 [*] Unnecessary `set` call within `set()` | 23 | ) @@ -394,7 +430,7 @@ C414.py:25:1: C414 [*] Unnecessary `set` call within `set()` | = help: Remove the inner `set` call -ℹ Unsafe fix +Suggested fix: 22 22 | "o"] 23 23 | ) 24 24 | ) @@ -404,6 +440,8 @@ C414.py:25:1: C414 [*] Unnecessary `set` call within `set()` 27 27 | set(tuple()) 28 28 | sorted(reversed()) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:26:1: C414 [*] Unnecessary `list` call within `set()` | 24 | ) @@ -415,7 +453,7 @@ C414.py:26:1: C414 [*] Unnecessary `list` call within `set()` | = help: Remove the inner `list` call -ℹ Unsafe fix +Suggested fix: 23 23 | ) 24 24 | ) 25 25 | set(set()) @@ -425,6 +463,8 @@ C414.py:26:1: C414 [*] Unnecessary `list` call within `set()` 28 28 | sorted(reversed()) 29 29 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:27:1: C414 [*] Unnecessary `tuple` call within `set()` | 25 | set(set()) @@ -435,7 +475,7 @@ C414.py:27:1: C414 [*] Unnecessary `tuple` call within `set()` | = help: Remove the inner `tuple` call -ℹ Unsafe fix +Suggested fix: 24 24 | ) 25 25 | set(set()) 26 26 | set(list()) @@ -445,6 +485,8 @@ C414.py:27:1: C414 [*] Unnecessary `tuple` call within `set()` 29 29 | 30 30 | # Nested sorts with differing keyword arguments. Not flagged. + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:28:1: C414 [*] Unnecessary `reversed` call within `sorted()` | 26 | set(list()) @@ -456,7 +498,7 @@ C414.py:28:1: C414 [*] Unnecessary `reversed` call within `sorted()` | = help: Remove the inner `reversed` call -ℹ Unsafe fix +Suggested fix: 25 25 | set(set()) 26 26 | set(list()) 27 27 | set(tuple()) @@ -466,6 +508,8 @@ C414.py:28:1: C414 [*] Unnecessary `reversed` call within `sorted()` 30 30 | # Nested sorts with differing keyword arguments. Not flagged. 31 31 | sorted(sorted(x, key=lambda y: y)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:37:27: C414 [*] Unnecessary `list` call within `sorted()` | 36 | # Preserve trailing comments. @@ -482,7 +526,7 @@ C414.py:37:27: C414 [*] Unnecessary `list` call within `sorted()` | = help: Remove the inner `list` call -ℹ Unsafe fix +Suggested fix: 35 35 | 36 36 | # Preserve trailing comments. 37 37 | xxxxxxxxxxx_xxxxx_xxxxx = sorted( @@ -492,6 +536,8 @@ C414.py:37:27: C414 [*] Unnecessary `list` call within `sorted()` 40 40 | # xx xxxx xxxxxxx xxxx xxx xxxxxxxx Nxxx 41 41 | key=lambda xxxxx: xxxxx or "", + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C414.py:44:27: C414 [*] Unnecessary `list` call within `sorted()` | 42 | ) @@ -505,7 +551,7 @@ C414.py:44:27: C414 [*] Unnecessary `list` call within `sorted()` | = help: Remove the inner `list` call -ℹ Unsafe fix +Suggested fix: 42 42 | ) 43 43 | 44 44 | xxxxxxxxxxx_xxxxx_xxxxx = sorted( @@ -514,4 +560,4 @@ C414.py:44:27: C414 [*] Unnecessary `list` call within `sorted()` 46 46 | key=lambda xxxxx: xxxxx or "", 47 47 | ) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap index 4ffbb2c029cde..b0dda28d134f4 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap @@ -12,7 +12,7 @@ C416.py:6:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) | = help: Rewrite using `list()` -ℹ Unsafe fix +Suggested fix: 3 3 | z = [(1,), (2,), (3,)] 4 4 | d = {"a": 1, "b": 2, "c": 3} 5 5 | @@ -22,6 +22,8 @@ C416.py:6:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) 8 8 | {k: v for k, v in y} 9 9 | {k: v for k, v in d.items()} + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C416.py:7:1: C416 [*] Unnecessary `set` comprehension (rewrite using `set()`) | 6 | [i for i in x] @@ -32,7 +34,7 @@ C416.py:7:1: C416 [*] Unnecessary `set` comprehension (rewrite using `set()`) | = help: Rewrite using `set()` -ℹ Unsafe fix +Suggested fix: 4 4 | d = {"a": 1, "b": 2, "c": 3} 5 5 | 6 6 | [i for i in x] @@ -42,6 +44,8 @@ C416.py:7:1: C416 [*] Unnecessary `set` comprehension (rewrite using `set()`) 9 9 | {k: v for k, v in d.items()} 10 10 | [(k, v) for k, v in d.items()] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C416.py:8:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | 6 | [i for i in x] @@ -53,7 +57,7 @@ C416.py:8:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | = help: Rewrite using `dict()` -ℹ Unsafe fix +Suggested fix: 5 5 | 6 6 | [i for i in x] 7 7 | {i for i in x} @@ -63,6 +67,8 @@ C416.py:8:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) 10 10 | [(k, v) for k, v in d.items()] 11 11 | {k: (a, b) for k, (a, b) in d.items()} + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C416.py:9:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | 7 | {i for i in x} @@ -74,7 +80,7 @@ C416.py:9:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | = help: Rewrite using `dict()` -ℹ Unsafe fix +Suggested fix: 6 6 | [i for i in x] 7 7 | {i for i in x} 8 8 | {k: v for k, v in y} @@ -84,6 +90,8 @@ C416.py:9:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) 11 11 | {k: (a, b) for k, (a, b) in d.items()} 12 12 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C416.py:10:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) | 8 | {k: v for k, v in y} @@ -94,7 +102,7 @@ C416.py:10:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) | = help: Rewrite using `list()` -ℹ Unsafe fix +Suggested fix: 7 7 | {i for i in x} 8 8 | {k: v for k, v in y} 9 9 | {k: v for k, v in d.items()} @@ -104,6 +112,8 @@ C416.py:10:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) 12 12 | 13 13 | [i for i, in z] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C416.py:11:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | 9 | {k: v for k, v in d.items()} @@ -115,7 +125,7 @@ C416.py:11:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | = help: Rewrite using `dict()` -ℹ Unsafe fix +Suggested fix: 8 8 | {k: v for k, v in y} 9 9 | {k: v for k, v in d.items()} 10 10 | [(k, v) for k, v in d.items()] @@ -125,6 +135,8 @@ C416.py:11:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) 13 13 | [i for i, in z] 14 14 | [i for i, j in y] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C416.py:24:70: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) | 23 | # Regression test for: https://github.com/astral-sh/ruff/issues/7196 @@ -133,11 +145,11 @@ C416.py:24:70: C416 [*] Unnecessary `list` comprehension (rewrite using `list()` | = help: Rewrite using `list()` -ℹ Unsafe fix +Suggested fix: 21 21 | {k: v if v else None for k, v in y} 22 22 | 23 23 | # Regression test for: https://github.com/astral-sh/ruff/issues/7196 24 |-any(len(symbol_table.get_by_type(symbol_type)) > 0 for symbol_type in[t for t in SymbolType]) 24 |+any(len(symbol_table.get_by_type(symbol_type)) > 0 for symbol_type in list(SymbolType)) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap index fc37727a26d86..be27f679990fc 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap @@ -12,7 +12,7 @@ C417.py:3:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express | = help: Replace `map` with a generator expression -ℹ Unsafe fix +Suggested fix: 1 1 | # Errors. 2 2 | nums = [1, 2, 3] 3 |-map(lambda x: x + 1, nums) @@ -21,6 +21,8 @@ C417.py:3:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express 5 5 | list(map(lambda x: x * 2, nums)) 6 6 | set(map(lambda x: x % 2 == 0, nums)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C417.py:4:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 2 | nums = [1, 2, 3] @@ -32,7 +34,7 @@ C417.py:4:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express | = help: Replace `map` with a generator expression -ℹ Unsafe fix +Suggested fix: 1 1 | # Errors. 2 2 | nums = [1, 2, 3] 3 3 | map(lambda x: x + 1, nums) @@ -42,6 +44,8 @@ C417.py:4:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express 6 6 | set(map(lambda x: x % 2 == 0, nums)) 7 7 | dict(map(lambda v: (v, v**2), nums)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C417.py:5:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehension) | 3 | map(lambda x: x + 1, nums) @@ -53,7 +57,7 @@ C417.py:5:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehens | = help: Replace `map` with a `list` comprehension -ℹ Unsafe fix +Suggested fix: 2 2 | nums = [1, 2, 3] 3 3 | map(lambda x: x + 1, nums) 4 4 | map(lambda x: str(x), nums) @@ -63,6 +67,8 @@ C417.py:5:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehens 7 7 | dict(map(lambda v: (v, v**2), nums)) 8 8 | dict(map(lambda v: [v, v**2], nums)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C417.py:6:1: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehension) | 4 | map(lambda x: str(x), nums) @@ -74,7 +80,7 @@ C417.py:6:1: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehensi | = help: Replace `map` with a `set` comprehension -ℹ Unsafe fix +Suggested fix: 3 3 | map(lambda x: x + 1, nums) 4 4 | map(lambda x: str(x), nums) 5 5 | list(map(lambda x: x * 2, nums)) @@ -84,6 +90,8 @@ C417.py:6:1: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehensi 8 8 | dict(map(lambda v: [v, v**2], nums)) 9 9 | map(lambda: "const", nums) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C417.py:7:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) | 5 | list(map(lambda x: x * 2, nums)) @@ -95,7 +103,7 @@ C417.py:7:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehens | = help: Replace `map` with a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 4 4 | map(lambda x: str(x), nums) 5 5 | list(map(lambda x: x * 2, nums)) 6 6 | set(map(lambda x: x % 2 == 0, nums)) @@ -105,6 +113,8 @@ C417.py:7:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehens 9 9 | map(lambda: "const", nums) 10 10 | map(lambda _: 3.0, nums) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C417.py:8:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) | 6 | set(map(lambda x: x % 2 == 0, nums)) @@ -116,7 +126,7 @@ C417.py:8:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehens | = help: Replace `map` with a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 5 5 | list(map(lambda x: x * 2, nums)) 6 6 | set(map(lambda x: x % 2 == 0, nums)) 7 7 | dict(map(lambda v: (v, v**2), nums)) @@ -126,6 +136,8 @@ C417.py:8:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehens 10 10 | map(lambda _: 3.0, nums) 11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C417.py:9:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 7 | dict(map(lambda v: (v, v**2), nums)) @@ -137,7 +149,7 @@ C417.py:9:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express | = help: Replace `map` with a generator expression -ℹ Unsafe fix +Suggested fix: 6 6 | set(map(lambda x: x % 2 == 0, nums)) 7 7 | dict(map(lambda v: (v, v**2), nums)) 8 8 | dict(map(lambda v: [v, v**2], nums)) @@ -147,6 +159,8 @@ C417.py:9:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express 11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) 12 12 | all(map(lambda v: isinstance(v, dict), nums)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C417.py:10:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 8 | dict(map(lambda v: [v, v**2], nums)) @@ -158,7 +172,7 @@ C417.py:10:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -ℹ Unsafe fix +Suggested fix: 7 7 | dict(map(lambda v: (v, v**2), nums)) 8 8 | dict(map(lambda v: [v, v**2], nums)) 9 9 | map(lambda: "const", nums) @@ -168,6 +182,8 @@ C417.py:10:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres 12 12 | all(map(lambda v: isinstance(v, dict), nums)) 13 13 | filter(func, map(lambda v: v, nums)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C417.py:11:13: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 9 | map(lambda: "const", nums) @@ -179,7 +195,7 @@ C417.py:11:13: C417 [*] Unnecessary `map` usage (rewrite using a generator expre | = help: Replace `map` with a generator expression -ℹ Unsafe fix +Suggested fix: 8 8 | dict(map(lambda v: [v, v**2], nums)) 9 9 | map(lambda: "const", nums) 10 10 | map(lambda _: 3.0, nums) @@ -189,6 +205,8 @@ C417.py:11:13: C417 [*] Unnecessary `map` usage (rewrite using a generator expre 13 13 | filter(func, map(lambda v: v, nums)) 14 14 | list(map(lambda x, y: x * y, nums)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C417.py:12:5: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 10 | map(lambda _: 3.0, nums) @@ -200,7 +218,7 @@ C417.py:12:5: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -ℹ Unsafe fix +Suggested fix: 9 9 | map(lambda: "const", nums) 10 10 | map(lambda _: 3.0, nums) 11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) @@ -210,6 +228,8 @@ C417.py:12:5: C417 [*] Unnecessary `map` usage (rewrite using a generator expres 14 14 | list(map(lambda x, y: x * y, nums)) 15 15 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C417.py:13:14: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) @@ -220,7 +240,7 @@ C417.py:13:14: C417 [*] Unnecessary `map` usage (rewrite using a generator expre | = help: Replace `map` with a generator expression -ℹ Unsafe fix +Suggested fix: 10 10 | map(lambda _: 3.0, nums) 11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) 12 12 | all(map(lambda v: isinstance(v, dict), nums)) @@ -230,6 +250,8 @@ C417.py:13:14: C417 [*] Unnecessary `map` usage (rewrite using a generator expre 15 15 | 16 16 | # When inside f-string, then the fix should be surrounded by whitespace + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C417.py:14:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehension) | 12 | all(map(lambda v: isinstance(v, dict), nums)) @@ -241,7 +263,7 @@ C417.py:14:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehen | = help: Replace `map` with a `list` comprehension -ℹ Unsafe fix +Suggested fix: 11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) 12 12 | all(map(lambda v: isinstance(v, dict), nums)) 13 13 | filter(func, map(lambda v: v, nums)) @@ -251,6 +273,8 @@ C417.py:14:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehen 16 16 | # When inside f-string, then the fix should be surrounded by whitespace 17 17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C417.py:17:8: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehension) | 16 | # When inside f-string, then the fix should be surrounded by whitespace @@ -260,7 +284,7 @@ C417.py:17:8: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehens | = help: Replace `map` with a `set` comprehension -ℹ Unsafe fix +Suggested fix: 14 14 | list(map(lambda x, y: x * y, nums)) 15 15 | 16 16 | # When inside f-string, then the fix should be surrounded by whitespace @@ -270,6 +294,8 @@ C417.py:17:8: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehens 19 19 | 20 20 | # False negatives. + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C417.py:18:8: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) | 16 | # When inside f-string, then the fix should be surrounded by whitespace @@ -281,7 +307,7 @@ C417.py:18:8: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehen | = help: Replace `map` with a `dict` comprehension -ℹ Unsafe fix +Suggested fix: 15 15 | 16 16 | # When inside f-string, then the fix should be surrounded by whitespace 17 17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}" @@ -291,6 +317,8 @@ C417.py:18:8: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehen 20 20 | # False negatives. 21 21 | map(lambda x=2, y=1: x + y, nums, nums) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C417.py:36:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 35 | # Error: the `x` is overridden by the inner lambda. @@ -301,7 +329,7 @@ C417.py:36:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -ℹ Unsafe fix +Suggested fix: 33 33 | map(lambda x: lambda: x, range(4)) 34 34 | 35 35 | # Error: the `x` is overridden by the inner lambda. @@ -311,6 +339,8 @@ C417.py:36:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres 38 38 | # Ok because of the default parameters, and variadic arguments. 39 39 | map(lambda x=1: x, nums) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C417.py:47:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121 @@ -321,7 +351,7 @@ C417.py:47:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -ℹ Unsafe fix +Suggested fix: 44 44 | dict(map(lambda k, v: (k, v), keys, values)) 45 45 | 46 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121 @@ -330,6 +360,8 @@ C417.py:47:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres 48 48 | map(lambda x: x, (y if y else z)) 49 49 | map(lambda x: x, (x, y, z)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C417.py:48:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121 @@ -340,7 +372,7 @@ C417.py:48:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -ℹ Unsafe fix +Suggested fix: 45 45 | 46 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121 47 47 | map(lambda x: x, y if y else z) @@ -348,6 +380,8 @@ C417.py:48:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres 48 |+(x for x in (y if y else z)) 49 49 | map(lambda x: x, (x, y, z)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C417.py:49:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 47 | map(lambda x: x, y if y else z) @@ -357,11 +391,11 @@ C417.py:49:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -ℹ Unsafe fix +Suggested fix: 46 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121 47 47 | map(lambda x: x, y if y else z) 48 48 | map(lambda x: x, (y if y else z)) 49 |-map(lambda x: x, (x, y, z)) 49 |+(x for x in (x, y, z)) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap index f350adcdcec62..9a3e817984085 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap @@ -10,13 +10,15 @@ C418.py:1:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the | = help: Remove outer `dict` call -ℹ Unsafe fix +Suggested fix: 1 |-dict({}) 1 |+{} 2 2 | dict({'a': 1}) 3 3 | dict({'x': 1 for x in range(10)}) 4 4 | dict( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C418.py:2:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`) | 1 | dict({}) @@ -27,7 +29,7 @@ C418.py:2:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the | = help: Remove outer `dict` call -ℹ Unsafe fix +Suggested fix: 1 1 | dict({}) 2 |-dict({'a': 1}) 2 |+{'a': 1} @@ -35,6 +37,8 @@ C418.py:2:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the 4 4 | dict( 5 5 | {'x': 1 for x in range(10)} + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C418.py:3:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`) | 1 | dict({}) @@ -46,7 +50,7 @@ C418.py:3:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remov | = help: Remove outer `dict` call -ℹ Unsafe fix +Suggested fix: 1 1 | dict({}) 2 2 | dict({'a': 1}) 3 |-dict({'x': 1 for x in range(10)}) @@ -55,6 +59,8 @@ C418.py:3:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remov 5 5 | {'x': 1 for x in range(10)} 6 6 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C418.py:4:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`) | 2 | dict({'a': 1}) @@ -68,7 +74,7 @@ C418.py:4:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remov | = help: Remove outer `dict` call -ℹ Unsafe fix +Suggested fix: 1 1 | dict({}) 2 2 | dict({'a': 1}) 3 3 | dict({'x': 1 for x in range(10)}) @@ -80,4 +86,4 @@ C418.py:4:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remov 8 6 | dict({}, a=1) 9 7 | dict({x: 1 for x in range(1)}, a=1) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap index 4f47e3af10fe2..d9bdf19552c82 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap @@ -10,13 +10,15 @@ C419.py:1:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -ℹ Unsafe fix +Suggested fix: 1 |-any([x.id for x in bar]) 1 |+any(x.id for x in bar) 2 2 | all([x.id for x in bar]) 3 3 | any( # first comment 4 4 | [x.id for x in bar], # second comment + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C419.py:2:5: C419 [*] Unnecessary list comprehension | 1 | any([x.id for x in bar]) @@ -27,7 +29,7 @@ C419.py:2:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -ℹ Unsafe fix +Suggested fix: 1 1 | any([x.id for x in bar]) 2 |-all([x.id for x in bar]) 2 |+all(x.id for x in bar) @@ -35,6 +37,8 @@ C419.py:2:5: C419 [*] Unnecessary list comprehension 4 4 | [x.id for x in bar], # second comment 5 5 | ) # third comment + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C419.py:4:5: C419 [*] Unnecessary list comprehension | 2 | all([x.id for x in bar]) @@ -46,7 +50,7 @@ C419.py:4:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -ℹ Unsafe fix +Suggested fix: 1 1 | any([x.id for x in bar]) 2 2 | all([x.id for x in bar]) 3 3 | any( # first comment @@ -56,6 +60,8 @@ C419.py:4:5: C419 [*] Unnecessary list comprehension 6 6 | all( # first comment 7 7 | [x.id for x in bar], # second comment + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C419.py:7:5: C419 [*] Unnecessary list comprehension | 5 | ) # third comment @@ -67,7 +73,7 @@ C419.py:7:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -ℹ Unsafe fix +Suggested fix: 4 4 | [x.id for x in bar], # second comment 5 5 | ) # third comment 6 6 | all( # first comment @@ -77,6 +83,8 @@ C419.py:7:5: C419 [*] Unnecessary list comprehension 9 9 | any({x.id for x in bar}) 10 10 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C419.py:9:5: C419 [*] Unnecessary list comprehension | 7 | [x.id for x in bar], # second comment @@ -88,7 +96,7 @@ C419.py:9:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -ℹ Unsafe fix +Suggested fix: 6 6 | all( # first comment 7 7 | [x.id for x in bar], # second comment 8 8 | ) # third comment @@ -98,6 +106,8 @@ C419.py:9:5: C419 [*] Unnecessary list comprehension 11 11 | # OK 12 12 | all(x.id for x in bar) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C419.py:28:5: C419 [*] Unnecessary list comprehension | 26 | # Special comment handling @@ -115,7 +125,7 @@ C419.py:28:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -ℹ Unsafe fix +Suggested fix: 25 25 | 26 26 | # Special comment handling 27 27 | any( @@ -133,6 +143,8 @@ C419.py:28:5: C419 [*] Unnecessary list comprehension 35 34 | ) 36 35 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C419.py:39:5: C419 [*] Unnecessary list comprehension | 37 | # Weird case where the function call, opening bracket, and comment are all @@ -147,7 +159,7 @@ C419.py:39:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -ℹ Unsafe fix +Suggested fix: 36 36 | 37 37 | # Weird case where the function call, opening bracket, and comment are all 38 38 | # on the same line. @@ -160,3 +172,5 @@ C419.py:39:5: C419 [*] Unnecessary list comprehension 41 |+# second line comment 42 |+i.bit_count() for i in range(5) # rbracket comment # rpar comment 43 43 | ) + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C419_C419_1.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C419_C419_1.py.snap index 1c30178ac47d2..9ac29a51032ae 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C419_C419_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C419_C419_1.py.snap @@ -10,13 +10,15 @@ C419_1.py:1:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -ℹ Unsafe fix +Suggested fix: 1 |-sum([x.val for x in bar]) 1 |+sum(x.val for x in bar) 2 2 | min([x.val for x in bar]) 3 3 | max([x.val for x in bar]) 4 4 | sum([x.val for x in bar], 0) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C419_1.py:2:5: C419 [*] Unnecessary list comprehension | 1 | sum([x.val for x in bar]) @@ -27,7 +29,7 @@ C419_1.py:2:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -ℹ Unsafe fix +Suggested fix: 1 1 | sum([x.val for x in bar]) 2 |-min([x.val for x in bar]) 2 |+min(x.val for x in bar) @@ -35,6 +37,8 @@ C419_1.py:2:5: C419 [*] Unnecessary list comprehension 4 4 | sum([x.val for x in bar], 0) 5 5 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C419_1.py:3:5: C419 [*] Unnecessary list comprehension | 1 | sum([x.val for x in bar]) @@ -45,7 +49,7 @@ C419_1.py:3:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -ℹ Unsafe fix +Suggested fix: 1 1 | sum([x.val for x in bar]) 2 2 | min([x.val for x in bar]) 3 |-max([x.val for x in bar]) @@ -54,6 +58,8 @@ C419_1.py:3:5: C419 [*] Unnecessary list comprehension 5 5 | 6 6 | # OK + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C419_1.py:4:5: C419 [*] Unnecessary list comprehension | 2 | min([x.val for x in bar]) @@ -65,7 +71,7 @@ C419_1.py:4:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -ℹ Unsafe fix +Suggested fix: 1 1 | sum([x.val for x in bar]) 2 2 | min([x.val for x in bar]) 3 3 | max([x.val for x in bar]) @@ -75,6 +81,8 @@ C419_1.py:4:5: C419 [*] Unnecessary list comprehension 6 6 | # OK 7 7 | sum(x.val for x in bar) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + C419_1.py:14:5: C419 [*] Unnecessary list comprehension | 12 | # Multi-line @@ -91,7 +99,7 @@ C419_1.py:14:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -ℹ Unsafe fix +Suggested fix: 11 11 | 12 12 | # Multi-line 13 13 | sum( @@ -104,3 +112,5 @@ C419_1.py:14:5: C419 [*] Unnecessary list comprehension 18 |+ ), 19 19 | dt.timedelta(), 20 20 | ) + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap index d29e987d4952a..67b6b635aa9d8 100644 --- a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap +++ b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap @@ -9,7 +9,7 @@ EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variabl | = help: Assign to variable; remove string literal -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | 4 4 | def f_a(): @@ -20,6 +20,8 @@ EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variabl 7 8 | 8 9 | def f_a_short(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to variable first | 16 | def f_b(): @@ -29,7 +31,7 @@ EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -ℹ Unsafe fix +Suggested fix: 15 15 | 16 16 | def f_b(): 17 17 | example = "example" @@ -40,6 +42,8 @@ EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to var 20 21 | 21 22 | def f_c(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | 21 | def f_c(): @@ -48,7 +52,7 @@ EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, ass | = help: Assign to variable; remove `.format()` string -ℹ Unsafe fix +Suggested fix: 19 19 | 20 20 | 21 21 | def f_c(): @@ -59,6 +63,8 @@ EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, ass 24 25 | 25 26 | def f_ok(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:32:24: EM101 [*] Exception must not use a string literal, assign to variable first | 30 | def f_msg_defined(): @@ -68,7 +74,7 @@ EM.py:32:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -ℹ Unsafe fix +Suggested fix: 29 29 | 30 30 | def f_msg_defined(): 31 31 | msg = "hello" @@ -79,6 +85,8 @@ EM.py:32:24: EM101 [*] Exception must not use a string literal, assign to variab 34 35 | 35 36 | def f_msg_in_nested_scope(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variable first | 37 | msg = "hello" @@ -88,7 +96,7 @@ EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -ℹ Unsafe fix +Suggested fix: 36 36 | def nested(): 37 37 | msg = "hello" 38 38 | @@ -99,6 +107,8 @@ EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variab 41 42 | 42 43 | def f_msg_in_parent_scope(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:46:28: EM101 [*] Exception must not use a string literal, assign to variable first | 45 | def nested(): @@ -107,7 +117,7 @@ EM.py:46:28: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -ℹ Unsafe fix +Suggested fix: 43 43 | msg = "hello" 44 44 | 45 45 | def nested(): @@ -118,6 +128,8 @@ EM.py:46:28: EM101 [*] Exception must not use a string literal, assign to variab 48 49 | 49 50 | def f_fix_indentation_check(foo): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variable first | 49 | def f_fix_indentation_check(foo): @@ -129,7 +141,7 @@ EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -ℹ Unsafe fix +Suggested fix: 48 48 | 49 49 | def f_fix_indentation_check(foo): 50 50 | if foo: @@ -140,6 +152,8 @@ EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variab 53 54 | if foo == "foo": 54 55 | raise RuntimeError(f"This is an exception: {foo}") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to variable first | 52 | else: @@ -150,7 +164,7 @@ EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -ℹ Unsafe fix +Suggested fix: 51 51 | raise RuntimeError("This is an example exception") 52 52 | else: 53 53 | if foo == "foo": @@ -161,6 +175,8 @@ EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to var 56 57 | 57 58 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | 53 | if foo == "foo": @@ -170,7 +186,7 @@ EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, ass | = help: Assign to variable; remove `.format()` string -ℹ Unsafe fix +Suggested fix: 52 52 | else: 53 53 | if foo == "foo": 54 54 | raise RuntimeError(f"This is an exception: {foo}") @@ -181,6 +197,8 @@ EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, ass 57 58 | 58 59 | # Report these, but don't fix them + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:59:28: EM101 Exception must not use a string literal, assign to variable first | 58 | # Report these, but don't fix them @@ -207,7 +225,7 @@ EM.py:64:24: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -ℹ Unsafe fix +Suggested fix: 61 61 | 62 62 | 63 63 | def f_triple_quoted_string(): @@ -218,6 +236,8 @@ EM.py:64:24: EM102 [*] Exception must not use an f-string literal, assign to var 66 67 | 67 68 | def f_multi_line_string(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:76:9: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | 74 | def f_multi_line_string2(): @@ -231,7 +251,7 @@ EM.py:76:9: EM103 [*] Exception must not use a `.format()` string directly, assi | = help: Assign to variable; remove `.format()` string -ℹ Unsafe fix +Suggested fix: 72 72 | 73 73 | 74 74 | def f_multi_line_string2(): @@ -248,6 +268,8 @@ EM.py:76:9: EM103 [*] Exception must not use a `.format()` string directly, assi 81 84 | 82 85 | def f_multi_line_string2(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:84:9: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | 82 | def f_multi_line_string2(): @@ -264,7 +286,7 @@ EM.py:84:9: EM103 [*] Exception must not use a `.format()` string directly, assi | = help: Assign to variable; remove `.format()` string -ℹ Unsafe fix +Suggested fix: 80 80 | 81 81 | 82 82 | def f_multi_line_string2(): @@ -281,4 +303,4 @@ EM.py:84:9: EM103 [*] Exception must not use a `.format()` string directly, assi 92 |+ msg 93 |+ ) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap index 593d6b30dcc0e..f9c5c703c97f7 100644 --- a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap @@ -9,7 +9,7 @@ EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variabl | = help: Assign to variable; remove string literal -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | 4 4 | def f_a(): @@ -20,6 +20,8 @@ EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variabl 7 8 | 8 9 | def f_a_short(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:9:24: EM101 [*] Exception must not use a string literal, assign to variable first | 8 | def f_a_short(): @@ -28,7 +30,7 @@ EM.py:9:24: EM101 [*] Exception must not use a string literal, assign to variabl | = help: Assign to variable; remove string literal -ℹ Unsafe fix +Suggested fix: 6 6 | 7 7 | 8 8 | def f_a_short(): @@ -39,6 +41,8 @@ EM.py:9:24: EM101 [*] Exception must not use a string literal, assign to variabl 11 12 | 12 13 | def f_a_empty(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:13:24: EM101 [*] Exception must not use a string literal, assign to variable first | 12 | def f_a_empty(): @@ -47,7 +51,7 @@ EM.py:13:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -ℹ Unsafe fix +Suggested fix: 10 10 | 11 11 | 12 12 | def f_a_empty(): @@ -58,6 +62,8 @@ EM.py:13:24: EM101 [*] Exception must not use a string literal, assign to variab 15 16 | 16 17 | def f_b(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to variable first | 16 | def f_b(): @@ -67,7 +73,7 @@ EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -ℹ Unsafe fix +Suggested fix: 15 15 | 16 16 | def f_b(): 17 17 | example = "example" @@ -78,6 +84,8 @@ EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to var 20 21 | 21 22 | def f_c(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | 21 | def f_c(): @@ -86,7 +94,7 @@ EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, ass | = help: Assign to variable; remove `.format()` string -ℹ Unsafe fix +Suggested fix: 19 19 | 20 20 | 21 21 | def f_c(): @@ -97,6 +105,8 @@ EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, ass 24 25 | 25 26 | def f_ok(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:32:24: EM101 [*] Exception must not use a string literal, assign to variable first | 30 | def f_msg_defined(): @@ -106,7 +116,7 @@ EM.py:32:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -ℹ Unsafe fix +Suggested fix: 29 29 | 30 30 | def f_msg_defined(): 31 31 | msg = "hello" @@ -117,6 +127,8 @@ EM.py:32:24: EM101 [*] Exception must not use a string literal, assign to variab 34 35 | 35 36 | def f_msg_in_nested_scope(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variable first | 37 | msg = "hello" @@ -126,7 +138,7 @@ EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -ℹ Unsafe fix +Suggested fix: 36 36 | def nested(): 37 37 | msg = "hello" 38 38 | @@ -137,6 +149,8 @@ EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variab 41 42 | 42 43 | def f_msg_in_parent_scope(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:46:28: EM101 [*] Exception must not use a string literal, assign to variable first | 45 | def nested(): @@ -145,7 +159,7 @@ EM.py:46:28: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -ℹ Unsafe fix +Suggested fix: 43 43 | msg = "hello" 44 44 | 45 45 | def nested(): @@ -156,6 +170,8 @@ EM.py:46:28: EM101 [*] Exception must not use a string literal, assign to variab 48 49 | 49 50 | def f_fix_indentation_check(foo): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variable first | 49 | def f_fix_indentation_check(foo): @@ -167,7 +183,7 @@ EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -ℹ Unsafe fix +Suggested fix: 48 48 | 49 49 | def f_fix_indentation_check(foo): 50 50 | if foo: @@ -178,6 +194,8 @@ EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variab 53 54 | if foo == "foo": 54 55 | raise RuntimeError(f"This is an exception: {foo}") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to variable first | 52 | else: @@ -188,7 +206,7 @@ EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -ℹ Unsafe fix +Suggested fix: 51 51 | raise RuntimeError("This is an example exception") 52 52 | else: 53 53 | if foo == "foo": @@ -199,6 +217,8 @@ EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to var 56 57 | 57 58 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | 53 | if foo == "foo": @@ -208,7 +228,7 @@ EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, ass | = help: Assign to variable; remove `.format()` string -ℹ Unsafe fix +Suggested fix: 52 52 | else: 53 53 | if foo == "foo": 54 54 | raise RuntimeError(f"This is an exception: {foo}") @@ -219,6 +239,8 @@ EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, ass 57 58 | 58 59 | # Report these, but don't fix them + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:59:28: EM101 Exception must not use a string literal, assign to variable first | 58 | # Report these, but don't fix them @@ -245,7 +267,7 @@ EM.py:64:24: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -ℹ Unsafe fix +Suggested fix: 61 61 | 62 62 | 63 63 | def f_triple_quoted_string(): @@ -256,6 +278,8 @@ EM.py:64:24: EM102 [*] Exception must not use an f-string literal, assign to var 66 67 | 67 68 | def f_multi_line_string(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:69:9: EM101 [*] Exception must not use a string literal, assign to variable first | 67 | def f_multi_line_string(): @@ -268,7 +292,7 @@ EM.py:69:9: EM101 [*] Exception must not use a string literal, assign to variabl | = help: Assign to variable; remove string literal -ℹ Unsafe fix +Suggested fix: 65 65 | 66 66 | 67 67 | def f_multi_line_string(): @@ -284,6 +308,8 @@ EM.py:69:9: EM101 [*] Exception must not use a string literal, assign to variabl 73 76 | 74 77 | def f_multi_line_string2(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:76:9: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | 74 | def f_multi_line_string2(): @@ -297,7 +323,7 @@ EM.py:76:9: EM103 [*] Exception must not use a `.format()` string directly, assi | = help: Assign to variable; remove `.format()` string -ℹ Unsafe fix +Suggested fix: 72 72 | 73 73 | 74 74 | def f_multi_line_string2(): @@ -314,6 +340,8 @@ EM.py:76:9: EM103 [*] Exception must not use a `.format()` string directly, assi 81 84 | 82 85 | def f_multi_line_string2(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + EM.py:84:9: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | 82 | def f_multi_line_string2(): @@ -330,7 +358,7 @@ EM.py:84:9: EM103 [*] Exception must not use a `.format()` string directly, assi | = help: Assign to variable; remove `.format()` string -ℹ Unsafe fix +Suggested fix: 80 80 | 81 81 | 82 82 | def f_multi_line_string2(): @@ -347,4 +375,4 @@ EM.py:84:9: EM103 [*] Exception must not use a `.format()` string directly, assi 92 |+ msg 93 |+ ) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_1.py.snap b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_1.py.snap index 1c613ab1b1398..c85bb80baa1ce 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_1.py.snap @@ -8,8 +8,8 @@ EXE004_1.py:1:1: EXE004 [*] Avoid whitespace before shebang | = help: Remove whitespace before shebang -ℹ Safe fix +Suggested fix: 1 |- #!/usr/bin/python 1 |+#!/usr/bin/python - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_4.py.snap b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_4.py.snap index feff95aa86af5..b0423301ed57b 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_4.py.snap @@ -9,9 +9,9 @@ EXE004_4.py:1:1: EXE004 [*] Avoid whitespace before shebang | = help: Remove whitespace before shebang -ℹ Safe fix +Suggested fix: 1 |- 2 |- #!/usr/bin/env python 1 |+#!/usr/bin/env python - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_lowercase.py.snap b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_lowercase.py.snap index e9c8efa698a8f..82466963c9d6e 100644 --- a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_lowercase.py.snap +++ b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_lowercase.py.snap @@ -9,8 +9,10 @@ no_future_import_uses_lowercase.py:6:14: FA102 [*] Missing `from __future__ impo | = help: Add `from __future__ import annotations` -ℹ Unsafe fix +Suggested fix: 1 |+from __future__ import annotations 1 2 | def main() -> None: 2 3 | a_list: list[str] = [] 3 4 | a_list.append("hello") + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union.py.snap b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union.py.snap index 3631ff04335a3..f6de122621d20 100644 --- a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union.py.snap +++ b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union.py.snap @@ -9,12 +9,14 @@ no_future_import_uses_union.py:6:14: FA102 [*] Missing `from __future__ import a | = help: Add `from __future__ import annotations` -ℹ Unsafe fix +Suggested fix: 1 |+from __future__ import annotations 1 2 | def main() -> None: 2 3 | a_list: list[str] | None = [] 3 4 | a_list.append("hello") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + no_future_import_uses_union.py:6:14: FA102 [*] Missing `from __future__ import annotations`, but uses PEP 604 union | 6 | def hello(y: dict[str, int] | None) -> None: @@ -23,8 +25,10 @@ no_future_import_uses_union.py:6:14: FA102 [*] Missing `from __future__ import a | = help: Add `from __future__ import annotations` -ℹ Unsafe fix +Suggested fix: 1 |+from __future__ import annotations 1 2 | def main() -> None: 2 3 | a_list: list[str] | None = [] 3 4 | a_list.append("hello") + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union_inner.py.snap b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union_inner.py.snap index 2f2e6dbb0375a..f4f104377a2b3 100644 --- a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union_inner.py.snap +++ b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union_inner.py.snap @@ -10,12 +10,14 @@ no_future_import_uses_union_inner.py:6:14: FA102 [*] Missing `from __future__ im | = help: Add `from __future__ import annotations` -ℹ Unsafe fix +Suggested fix: 1 |+from __future__ import annotations 1 2 | def main() -> None: 2 3 | a_list: list[str | None] = [] 3 4 | a_list.append("hello") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + no_future_import_uses_union_inner.py:6:19: FA102 [*] Missing `from __future__ import annotations`, but uses PEP 604 union | 6 | def hello(y: dict[str | None, int]) -> None: @@ -25,8 +27,10 @@ no_future_import_uses_union_inner.py:6:19: FA102 [*] Missing `from __future__ im | = help: Add `from __future__ import annotations` -ℹ Unsafe fix +Suggested fix: 1 |+from __future__ import annotations 1 2 | def main() -> None: 2 3 | a_list: list[str | None] = [] 3 4 | a_list.append("hello") + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC.py.snap b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC.py.snap index c6a7536f7454c..eab6235d09de6 100644 --- a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC.py.snap +++ b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC.py.snap @@ -10,13 +10,15 @@ ISC.py:1:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 1 |-_ = "a" "b" "c" 1 |+_ = "ab" "c" 2 2 | 3 3 | _ = "abc" + "def" 4 4 | + Run `ruff check --fix` to apply this fix. + ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line | 1 | _ = "a" "b" "c" @@ -26,13 +28,15 @@ ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 1 |-_ = "a" "b" "c" 1 |+_ = "a" "bc" 2 2 | 3 3 | _ = "abc" + "def" 4 4 | + Run `ruff check --fix` to apply this fix. + ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line | 36 | ) @@ -44,7 +48,7 @@ ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 35 35 | b"def" 36 36 | ) 37 37 | @@ -54,6 +58,8 @@ ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line 40 40 | _ = """a 41 41 | b""" """c + Run `ruff check --fix` to apply this fix. + ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line | 38 | _ = """a""" """b""" @@ -68,7 +74,7 @@ ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 38 38 | _ = """a""" """b""" 39 39 | 40 40 | _ = """a @@ -78,6 +84,8 @@ ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line 43 43 | 44 44 | _ = f"""a""" f"""b""" + Run `ruff check --fix` to apply this fix. + ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line | 42 | d""" @@ -89,7 +97,7 @@ ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 41 41 | b""" """c 42 42 | d""" 43 43 | @@ -99,6 +107,8 @@ ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line 46 46 | _ = f"a" "b" 47 47 | + Run `ruff check --fix` to apply this fix. + ISC.py:46:5: ISC001 Implicitly concatenated string literals on one line | 44 | _ = f"""a""" f"""b""" @@ -143,7 +153,7 @@ ISC.py:52:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 49 49 | 50 50 | _ = 'a' "b" 51 51 | @@ -153,6 +163,8 @@ ISC.py:52:5: ISC001 [*] Implicitly concatenated string literals on one line 54 54 | # Single-line explicit concatenation should be ignored. 55 55 | _ = "abc" + "def" + "ghi" + Run `ruff check --fix` to apply this fix. + ISC.py:64:10: ISC001 [*] Implicitly concatenated string literals on one line | 63 | # Multiple strings nested inside a f-string @@ -163,7 +175,7 @@ ISC.py:64:10: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 61 61 | _ = foo + "abc" + bar 62 62 | 63 63 | # Multiple strings nested inside a f-string @@ -173,6 +185,8 @@ ISC.py:64:10: ISC001 [*] Implicitly concatenated string literals on one line 66 66 | _ = f"""abc { 67 67 | "def" + Run `ruff check --fix` to apply this fix. + ISC.py:64:14: ISC001 [*] Implicitly concatenated string literals on one line | 63 | # Multiple strings nested inside a f-string @@ -183,7 +197,7 @@ ISC.py:64:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 61 61 | _ = foo + "abc" + bar 62 62 | 63 63 | # Multiple strings nested inside a f-string @@ -193,6 +207,8 @@ ISC.py:64:14: ISC001 [*] Implicitly concatenated string literals on one line 66 66 | _ = f"""abc { 67 67 | "def" + Run `ruff check --fix` to apply this fix. + ISC.py:65:14: ISC001 [*] Implicitly concatenated string literals on one line | 63 | # Multiple strings nested inside a f-string @@ -204,7 +220,7 @@ ISC.py:65:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 62 62 | 63 63 | # Multiple strings nested inside a f-string 64 64 | _ = f"a {'b' 'c' 'd'} e" @@ -214,6 +230,8 @@ ISC.py:65:14: ISC001 [*] Implicitly concatenated string literals on one line 67 67 | "def" 68 68 | "ghi" + Run `ruff check --fix` to apply this fix. + ISC.py:72:5: ISC001 Implicitly concatenated string literals on one line | 71 | # Nested f-strings @@ -244,7 +262,7 @@ ISC.py:72:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 69 69 | } jkl""" 70 70 | 71 71 | # Nested f-strings @@ -254,6 +272,8 @@ ISC.py:72:14: ISC001 [*] Implicitly concatenated string literals on one line 74 74 | _ = f"b {f"abc" \ 75 75 | f"def"} g" + Run `ruff check --fix` to apply this fix. + ISC.py:73:10: ISC001 [*] Implicitly concatenated string literals on one line | 71 | # Nested f-strings @@ -265,7 +285,7 @@ ISC.py:73:10: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 70 70 | 71 71 | # Nested f-strings 72 72 | _ = "a" f"b {f"c" f"d"} e" "f" @@ -275,6 +295,8 @@ ISC.py:73:10: ISC001 [*] Implicitly concatenated string literals on one line 75 75 | f"def"} g" 76 76 | + Run `ruff check --fix` to apply this fix. + ISC.py:73:20: ISC001 [*] Implicitly concatenated string literals on one line | 71 | # Nested f-strings @@ -286,7 +308,7 @@ ISC.py:73:20: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 70 70 | 71 71 | # Nested f-strings 72 72 | _ = "a" f"b {f"c" f"d"} e" "f" @@ -296,4 +318,4 @@ ISC.py:73:20: ISC001 [*] Implicitly concatenated string literals on one line 75 75 | f"def"} g" 76 76 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC001_ISC.py.snap b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC001_ISC.py.snap index c6a7536f7454c..eab6235d09de6 100644 --- a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC001_ISC.py.snap +++ b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC001_ISC.py.snap @@ -10,13 +10,15 @@ ISC.py:1:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 1 |-_ = "a" "b" "c" 1 |+_ = "ab" "c" 2 2 | 3 3 | _ = "abc" + "def" 4 4 | + Run `ruff check --fix` to apply this fix. + ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line | 1 | _ = "a" "b" "c" @@ -26,13 +28,15 @@ ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 1 |-_ = "a" "b" "c" 1 |+_ = "a" "bc" 2 2 | 3 3 | _ = "abc" + "def" 4 4 | + Run `ruff check --fix` to apply this fix. + ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line | 36 | ) @@ -44,7 +48,7 @@ ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 35 35 | b"def" 36 36 | ) 37 37 | @@ -54,6 +58,8 @@ ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line 40 40 | _ = """a 41 41 | b""" """c + Run `ruff check --fix` to apply this fix. + ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line | 38 | _ = """a""" """b""" @@ -68,7 +74,7 @@ ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 38 38 | _ = """a""" """b""" 39 39 | 40 40 | _ = """a @@ -78,6 +84,8 @@ ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line 43 43 | 44 44 | _ = f"""a""" f"""b""" + Run `ruff check --fix` to apply this fix. + ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line | 42 | d""" @@ -89,7 +97,7 @@ ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 41 41 | b""" """c 42 42 | d""" 43 43 | @@ -99,6 +107,8 @@ ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line 46 46 | _ = f"a" "b" 47 47 | + Run `ruff check --fix` to apply this fix. + ISC.py:46:5: ISC001 Implicitly concatenated string literals on one line | 44 | _ = f"""a""" f"""b""" @@ -143,7 +153,7 @@ ISC.py:52:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 49 49 | 50 50 | _ = 'a' "b" 51 51 | @@ -153,6 +163,8 @@ ISC.py:52:5: ISC001 [*] Implicitly concatenated string literals on one line 54 54 | # Single-line explicit concatenation should be ignored. 55 55 | _ = "abc" + "def" + "ghi" + Run `ruff check --fix` to apply this fix. + ISC.py:64:10: ISC001 [*] Implicitly concatenated string literals on one line | 63 | # Multiple strings nested inside a f-string @@ -163,7 +175,7 @@ ISC.py:64:10: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 61 61 | _ = foo + "abc" + bar 62 62 | 63 63 | # Multiple strings nested inside a f-string @@ -173,6 +185,8 @@ ISC.py:64:10: ISC001 [*] Implicitly concatenated string literals on one line 66 66 | _ = f"""abc { 67 67 | "def" + Run `ruff check --fix` to apply this fix. + ISC.py:64:14: ISC001 [*] Implicitly concatenated string literals on one line | 63 | # Multiple strings nested inside a f-string @@ -183,7 +197,7 @@ ISC.py:64:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 61 61 | _ = foo + "abc" + bar 62 62 | 63 63 | # Multiple strings nested inside a f-string @@ -193,6 +207,8 @@ ISC.py:64:14: ISC001 [*] Implicitly concatenated string literals on one line 66 66 | _ = f"""abc { 67 67 | "def" + Run `ruff check --fix` to apply this fix. + ISC.py:65:14: ISC001 [*] Implicitly concatenated string literals on one line | 63 | # Multiple strings nested inside a f-string @@ -204,7 +220,7 @@ ISC.py:65:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 62 62 | 63 63 | # Multiple strings nested inside a f-string 64 64 | _ = f"a {'b' 'c' 'd'} e" @@ -214,6 +230,8 @@ ISC.py:65:14: ISC001 [*] Implicitly concatenated string literals on one line 67 67 | "def" 68 68 | "ghi" + Run `ruff check --fix` to apply this fix. + ISC.py:72:5: ISC001 Implicitly concatenated string literals on one line | 71 | # Nested f-strings @@ -244,7 +262,7 @@ ISC.py:72:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 69 69 | } jkl""" 70 70 | 71 71 | # Nested f-strings @@ -254,6 +272,8 @@ ISC.py:72:14: ISC001 [*] Implicitly concatenated string literals on one line 74 74 | _ = f"b {f"abc" \ 75 75 | f"def"} g" + Run `ruff check --fix` to apply this fix. + ISC.py:73:10: ISC001 [*] Implicitly concatenated string literals on one line | 71 | # Nested f-strings @@ -265,7 +285,7 @@ ISC.py:73:10: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 70 70 | 71 71 | # Nested f-strings 72 72 | _ = "a" f"b {f"c" f"d"} e" "f" @@ -275,6 +295,8 @@ ISC.py:73:10: ISC001 [*] Implicitly concatenated string literals on one line 75 75 | f"def"} g" 76 76 | + Run `ruff check --fix` to apply this fix. + ISC.py:73:20: ISC001 [*] Implicitly concatenated string literals on one line | 71 | # Nested f-strings @@ -286,7 +308,7 @@ ISC.py:73:20: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Safe fix +Suggested fix: 70 70 | 71 71 | # Nested f-strings 72 72 | _ = "a" f"b {f"c" f"d"} e" "f" @@ -296,4 +318,4 @@ ISC.py:73:20: ISC001 [*] Implicitly concatenated string literals on one line 75 75 | f"def"} g" 76 76 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap index d3f4b0a501404..be3f69a68ad6a 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap @@ -11,7 +11,7 @@ defaults.py:6:12: ICN001 [*] `altair` should be imported as `alt` | = help: Alias `altair` to `alt` -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | 5 5 | def unconventional(): @@ -21,6 +21,8 @@ defaults.py:6:12: ICN001 [*] `altair` should be imported as `alt` 8 8 | import numpy 9 9 | import pandas + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + defaults.py:7:12: ICN001 `matplotlib.pyplot` should be imported as `plt` | 5 | def unconventional(): @@ -43,7 +45,7 @@ defaults.py:8:12: ICN001 [*] `numpy` should be imported as `np` | = help: Alias `numpy` to `np` -ℹ Unsafe fix +Suggested fix: 5 5 | def unconventional(): 6 6 | import altair 7 7 | import matplotlib.pyplot @@ -53,6 +55,8 @@ defaults.py:8:12: ICN001 [*] `numpy` should be imported as `np` 10 10 | import seaborn 11 11 | import tkinter + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + defaults.py:9:12: ICN001 [*] `pandas` should be imported as `pd` | 7 | import matplotlib.pyplot @@ -64,7 +68,7 @@ defaults.py:9:12: ICN001 [*] `pandas` should be imported as `pd` | = help: Alias `pandas` to `pd` -ℹ Unsafe fix +Suggested fix: 6 6 | import altair 7 7 | import matplotlib.pyplot 8 8 | import numpy @@ -74,6 +78,8 @@ defaults.py:9:12: ICN001 [*] `pandas` should be imported as `pd` 11 11 | import tkinter 12 12 | import networkx + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + defaults.py:10:12: ICN001 [*] `seaborn` should be imported as `sns` | 8 | import numpy @@ -85,7 +91,7 @@ defaults.py:10:12: ICN001 [*] `seaborn` should be imported as `sns` | = help: Alias `seaborn` to `sns` -ℹ Unsafe fix +Suggested fix: 7 7 | import matplotlib.pyplot 8 8 | import numpy 9 9 | import pandas @@ -95,6 +101,8 @@ defaults.py:10:12: ICN001 [*] `seaborn` should be imported as `sns` 12 12 | import networkx 13 13 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + defaults.py:11:12: ICN001 [*] `tkinter` should be imported as `tk` | 9 | import pandas @@ -105,7 +113,7 @@ defaults.py:11:12: ICN001 [*] `tkinter` should be imported as `tk` | = help: Alias `tkinter` to `tk` -ℹ Unsafe fix +Suggested fix: 8 8 | import numpy 9 9 | import pandas 10 10 | import seaborn @@ -115,6 +123,8 @@ defaults.py:11:12: ICN001 [*] `tkinter` should be imported as `tk` 13 13 | 14 14 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + defaults.py:12:12: ICN001 [*] `networkx` should be imported as `nx` | 10 | import seaborn @@ -124,7 +134,7 @@ defaults.py:12:12: ICN001 [*] `networkx` should be imported as `nx` | = help: Alias `networkx` to `nx` -ℹ Unsafe fix +Suggested fix: 9 9 | import pandas 10 10 | import seaborn 11 11 | import tkinter @@ -134,6 +144,8 @@ defaults.py:12:12: ICN001 [*] `networkx` should be imported as `nx` 14 14 | 15 15 | def unconventional_aliases(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + defaults.py:16:22: ICN001 [*] `altair` should be imported as `alt` | 15 | def unconventional_aliases(): @@ -144,7 +156,7 @@ defaults.py:16:22: ICN001 [*] `altair` should be imported as `alt` | = help: Alias `altair` to `alt` -ℹ Unsafe fix +Suggested fix: 13 13 | 14 14 | 15 15 | def unconventional_aliases(): @@ -154,6 +166,8 @@ defaults.py:16:22: ICN001 [*] `altair` should be imported as `alt` 18 18 | import numpy as nmp 19 19 | import pandas as pdas + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + defaults.py:17:33: ICN001 [*] `matplotlib.pyplot` should be imported as `plt` | 15 | def unconventional_aliases(): @@ -165,7 +179,7 @@ defaults.py:17:33: ICN001 [*] `matplotlib.pyplot` should be imported as `plt` | = help: Alias `matplotlib.pyplot` to `plt` -ℹ Unsafe fix +Suggested fix: 14 14 | 15 15 | def unconventional_aliases(): 16 16 | import altair as altr @@ -175,6 +189,8 @@ defaults.py:17:33: ICN001 [*] `matplotlib.pyplot` should be imported as `plt` 19 19 | import pandas as pdas 20 20 | import seaborn as sbrn + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + defaults.py:18:21: ICN001 [*] `numpy` should be imported as `np` | 16 | import altair as altr @@ -186,7 +202,7 @@ defaults.py:18:21: ICN001 [*] `numpy` should be imported as `np` | = help: Alias `numpy` to `np` -ℹ Unsafe fix +Suggested fix: 15 15 | def unconventional_aliases(): 16 16 | import altair as altr 17 17 | import matplotlib.pyplot as plot @@ -196,6 +212,8 @@ defaults.py:18:21: ICN001 [*] `numpy` should be imported as `np` 20 20 | import seaborn as sbrn 21 21 | import tkinter as tkr + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + defaults.py:19:22: ICN001 [*] `pandas` should be imported as `pd` | 17 | import matplotlib.pyplot as plot @@ -207,7 +225,7 @@ defaults.py:19:22: ICN001 [*] `pandas` should be imported as `pd` | = help: Alias `pandas` to `pd` -ℹ Unsafe fix +Suggested fix: 16 16 | import altair as altr 17 17 | import matplotlib.pyplot as plot 18 18 | import numpy as nmp @@ -217,6 +235,8 @@ defaults.py:19:22: ICN001 [*] `pandas` should be imported as `pd` 21 21 | import tkinter as tkr 22 22 | import networkx as nxy + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + defaults.py:20:23: ICN001 [*] `seaborn` should be imported as `sns` | 18 | import numpy as nmp @@ -228,7 +248,7 @@ defaults.py:20:23: ICN001 [*] `seaborn` should be imported as `sns` | = help: Alias `seaborn` to `sns` -ℹ Unsafe fix +Suggested fix: 17 17 | import matplotlib.pyplot as plot 18 18 | import numpy as nmp 19 19 | import pandas as pdas @@ -238,6 +258,8 @@ defaults.py:20:23: ICN001 [*] `seaborn` should be imported as `sns` 22 22 | import networkx as nxy 23 23 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + defaults.py:21:23: ICN001 [*] `tkinter` should be imported as `tk` | 19 | import pandas as pdas @@ -248,7 +270,7 @@ defaults.py:21:23: ICN001 [*] `tkinter` should be imported as `tk` | = help: Alias `tkinter` to `tk` -ℹ Unsafe fix +Suggested fix: 18 18 | import numpy as nmp 19 19 | import pandas as pdas 20 20 | import seaborn as sbrn @@ -258,6 +280,8 @@ defaults.py:21:23: ICN001 [*] `tkinter` should be imported as `tk` 23 23 | 24 24 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + defaults.py:22:24: ICN001 [*] `networkx` should be imported as `nx` | 20 | import seaborn as sbrn @@ -267,7 +291,7 @@ defaults.py:22:24: ICN001 [*] `networkx` should be imported as `nx` | = help: Alias `networkx` to `nx` -ℹ Unsafe fix +Suggested fix: 19 19 | import pandas as pdas 20 20 | import seaborn as sbrn 21 21 | import tkinter as tkr @@ -276,3 +300,5 @@ defaults.py:22:24: ICN001 [*] `networkx` should be imported as `nx` 23 23 | 24 24 | 25 25 | def conventional_aliases(): + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__same_name.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__same_name.snap index c30be9f37554c..af721e0853b44 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__same_name.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__same_name.snap @@ -9,9 +9,11 @@ same_name.py:10:41: ICN001 [*] `django.conf.settings` should be imported as `set | = help: Alias `django.conf.settings` to `settings` -ℹ Unsafe fix +Suggested fix: 7 7 | 8 8 | 9 9 | def unconventional_alias(): 10 |- from django.conf import settings as s 10 |+ from django.conf import settings as settings + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap index b3c7cc2368a49..a76a30a39829d 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap @@ -12,7 +12,7 @@ tricky.py:7:16: ICN001 [*] `pandas` should be imported as `pd` | = help: Alias `pandas` to `pd` -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | def rename_global(): 5 5 | try: @@ -23,4 +23,4 @@ tricky.py:7:16: ICN001 [*] `pandas` should be imported as `pd` 8 8 | except ImportError: 9 9 | return False - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap index c72edc6042394..0c9f7d6a57afb 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap @@ -12,7 +12,7 @@ LOG001.py:3:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers | = help: Replace with `logging.getLogger()` -ℹ Unsafe fix +Suggested fix: 1 1 | import logging 2 2 | 3 |-logging.Logger(__name__) @@ -20,6 +20,8 @@ LOG001.py:3:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers 4 4 | logging.Logger() 5 5 | logging.getLogger(__name__) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + LOG001.py:4:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers | 3 | logging.Logger(__name__) @@ -29,7 +31,7 @@ LOG001.py:4:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers | = help: Replace with `logging.getLogger()` -ℹ Unsafe fix +Suggested fix: 1 1 | import logging 2 2 | 3 3 | logging.Logger(__name__) @@ -37,4 +39,4 @@ LOG001.py:4:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers 4 |+logging.getLogger() 5 5 | logging.getLogger(__name__) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap index b73778126387b..af57337424506 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap @@ -10,7 +10,7 @@ LOG002.py:11:11: LOG002 [*] Use `__name__` with `logging.getLogger()` | = help: Replace with `__name__` -ℹ Unsafe fix +Suggested fix: 8 8 | logging.getLogger(name="custom") 9 9 | 10 10 | # LOG002 @@ -20,6 +20,8 @@ LOG002.py:11:11: LOG002 [*] Use `__name__` with `logging.getLogger()` 13 13 | 14 14 | logging.getLogger(__cached__) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + LOG002.py:12:24: LOG002 [*] Use `__name__` with `logging.getLogger()` | 10 | # LOG002 @@ -31,7 +33,7 @@ LOG002.py:12:24: LOG002 [*] Use `__name__` with `logging.getLogger()` | = help: Replace with `__name__` -ℹ Unsafe fix +Suggested fix: 9 9 | 10 10 | # LOG002 11 11 | getLogger(__file__) @@ -41,6 +43,8 @@ LOG002.py:12:24: LOG002 [*] Use `__name__` with `logging.getLogger()` 14 14 | logging.getLogger(__cached__) 15 15 | getLogger(name=__cached__) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + LOG002.py:14:19: LOG002 [*] Use `__name__` with `logging.getLogger()` | 12 | logging.getLogger(name=__file__) @@ -51,7 +55,7 @@ LOG002.py:14:19: LOG002 [*] Use `__name__` with `logging.getLogger()` | = help: Replace with `__name__` -ℹ Unsafe fix +Suggested fix: 11 11 | getLogger(__file__) 12 12 | logging.getLogger(name=__file__) 13 13 | @@ -61,6 +65,8 @@ LOG002.py:14:19: LOG002 [*] Use `__name__` with `logging.getLogger()` 16 16 | 17 17 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + LOG002.py:15:16: LOG002 [*] Use `__name__` with `logging.getLogger()` | 14 | logging.getLogger(__cached__) @@ -69,7 +75,7 @@ LOG002.py:15:16: LOG002 [*] Use `__name__` with `logging.getLogger()` | = help: Replace with `__name__` -ℹ Unsafe fix +Suggested fix: 12 12 | logging.getLogger(name=__file__) 13 13 | 14 14 | logging.getLogger(__cached__) @@ -79,4 +85,4 @@ LOG002.py:15:16: LOG002 [*] Use `__name__` with `logging.getLogger()` 17 17 | 18 18 | # Override `logging.getLogger` - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap index b630875d83233..086fedde0858f 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap @@ -11,7 +11,7 @@ LOG009.py:4:5: LOG009 [*] Use of undocumented `logging.WARN` constant | = help: Replace `logging.WARN` with `logging.WARNING` -ℹ Safe fix +Suggested fix: 1 1 | def func(): 2 2 | import logging 3 3 | @@ -21,6 +21,8 @@ LOG009.py:4:5: LOG009 [*] Use of undocumented `logging.WARN` constant 6 6 | 7 7 | + Run `ruff check --fix` to apply this fix. + LOG009.py:11:5: LOG009 [*] Use of undocumented `logging.WARN` constant | 9 | from logging import WARN, WARNING @@ -31,10 +33,12 @@ LOG009.py:11:5: LOG009 [*] Use of undocumented `logging.WARN` constant | = help: Replace `logging.WARN` with `logging.WARNING` -ℹ Safe fix +Suggested fix: 8 8 | def func(): 9 9 | from logging import WARN, WARNING 10 10 | 11 |- WARN # LOG009 11 |+ WARNING # LOG009 12 12 | WARNING # OK + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G010.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G010.py.snap index 8a9191704f79f..63cab07c20c25 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G010.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G010.py.snap @@ -12,7 +12,7 @@ G010.py:6:9: G010 [*] Logging statement uses `warn` instead of `warning` | = help: Convert to `warning` -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | from logging_setup import logger 5 5 | @@ -22,6 +22,8 @@ G010.py:6:9: G010 [*] Logging statement uses `warn` instead of `warning` 8 8 | logger.warn("Hello world!") 9 9 | + Run `ruff check --fix` to apply this fix. + G010.py:8:8: G010 [*] Logging statement uses `warn` instead of `warning` | 6 | logging.warn("Hello World!") @@ -33,7 +35,7 @@ G010.py:8:8: G010 [*] Logging statement uses `warn` instead of `warning` | = help: Convert to `warning` -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | logging.warn("Hello World!") 7 7 | log.warn("Hello world!") # This shouldn't be considered as a logger candidate @@ -43,6 +45,8 @@ G010.py:8:8: G010 [*] Logging statement uses `warn` instead of `warning` 10 10 | logging . warn("Hello World!") 11 11 | + Run `ruff check --fix` to apply this fix. + G010.py:10:11: G010 [*] Logging statement uses `warn` instead of `warning` | 8 | logger.warn("Hello world!") @@ -54,7 +58,7 @@ G010.py:10:11: G010 [*] Logging statement uses `warn` instead of `warning` | = help: Convert to `warning` -ℹ Safe fix +Suggested fix: 7 7 | log.warn("Hello world!") # This shouldn't be considered as a logger candidate 8 8 | logger.warn("Hello world!") 9 9 | @@ -64,6 +68,8 @@ G010.py:10:11: G010 [*] Logging statement uses `warn` instead of `warning` 12 12 | from logging import warn, warning, exception 13 13 | warn("foo") + Run `ruff check --fix` to apply this fix. + G010.py:13:1: G010 [*] Logging statement uses `warn` instead of `warning` | 12 | from logging import warn, warning, exception @@ -74,7 +80,7 @@ G010.py:13:1: G010 [*] Logging statement uses `warn` instead of `warning` | = help: Convert to `warning` -ℹ Safe fix +Suggested fix: 10 10 | logging . warn("Hello World!") 11 11 | 12 12 | from logging import warn, warning, exception @@ -83,4 +89,4 @@ G010.py:13:1: G010 [*] Logging statement uses `warn` instead of `warning` 14 |+warning("foo") 15 15 | exception("foo") - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE790_PIE790.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE790_PIE790.py.snap index b2356b7f347a8..b0ba0d4867e24 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE790_PIE790.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE790_PIE790.py.snap @@ -10,7 +10,7 @@ PIE790.py:4:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 1 1 | class Foo: 2 2 | """buzz""" 3 3 | @@ -19,6 +19,8 @@ PIE790.py:4:5: PIE790 [*] Unnecessary `pass` statement 6 5 | 7 6 | if foo: + Run `ruff check --fix` to apply this fix. + PIE790.py:9:5: PIE790 [*] Unnecessary `pass` statement | 7 | if foo: @@ -28,7 +30,7 @@ PIE790.py:9:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 6 6 | 7 7 | if foo: 8 8 | """foo""" @@ -37,6 +39,8 @@ PIE790.py:9:5: PIE790 [*] Unnecessary `pass` statement 11 10 | 12 11 | def multi_statement() -> None: + Run `ruff check --fix` to apply this fix. + PIE790.py:14:5: PIE790 [*] Unnecessary `pass` statement | 12 | def multi_statement() -> None: @@ -46,7 +50,7 @@ PIE790.py:14:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 11 11 | 12 12 | def multi_statement() -> None: 13 13 | """This is a function.""" @@ -56,6 +60,8 @@ PIE790.py:14:5: PIE790 [*] Unnecessary `pass` statement 16 16 | 17 17 | if foo: + Run `ruff check --fix` to apply this fix. + PIE790.py:21:5: PIE790 [*] Unnecessary `pass` statement | 19 | else: @@ -65,7 +71,7 @@ PIE790.py:21:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 18 18 | pass 19 19 | else: 20 20 | """bar""" @@ -74,6 +80,8 @@ PIE790.py:21:5: PIE790 [*] Unnecessary `pass` statement 23 22 | 24 23 | while True: + Run `ruff check --fix` to apply this fix. + PIE790.py:28:5: PIE790 [*] Unnecessary `pass` statement | 26 | else: @@ -83,7 +91,7 @@ PIE790.py:28:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 25 25 | pass 26 26 | else: 27 27 | """bar""" @@ -92,6 +100,8 @@ PIE790.py:28:5: PIE790 [*] Unnecessary `pass` statement 30 29 | 31 30 | for _ in range(10): + Run `ruff check --fix` to apply this fix. + PIE790.py:35:5: PIE790 [*] Unnecessary `pass` statement | 33 | else: @@ -101,7 +111,7 @@ PIE790.py:35:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 32 32 | pass 33 33 | else: 34 34 | """bar""" @@ -110,6 +120,8 @@ PIE790.py:35:5: PIE790 [*] Unnecessary `pass` statement 37 36 | 38 37 | async for _ in range(10): + Run `ruff check --fix` to apply this fix. + PIE790.py:42:5: PIE790 [*] Unnecessary `pass` statement | 40 | else: @@ -119,7 +131,7 @@ PIE790.py:42:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 39 39 | pass 40 40 | else: 41 41 | """bar""" @@ -128,6 +140,8 @@ PIE790.py:42:5: PIE790 [*] Unnecessary `pass` statement 44 43 | 45 44 | def foo() -> None: + Run `ruff check --fix` to apply this fix. + PIE790.py:50:5: PIE790 [*] Unnecessary `pass` statement | 48 | """ @@ -137,7 +151,7 @@ PIE790.py:50:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 47 47 | buzz 48 48 | """ 49 49 | @@ -146,6 +160,8 @@ PIE790.py:50:5: PIE790 [*] Unnecessary `pass` statement 52 51 | 53 52 | async def foo(): + Run `ruff check --fix` to apply this fix. + PIE790.py:58:5: PIE790 [*] Unnecessary `pass` statement | 56 | """ @@ -155,7 +171,7 @@ PIE790.py:58:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 55 55 | buzz 56 56 | """ 57 57 | @@ -164,6 +180,8 @@ PIE790.py:58:5: PIE790 [*] Unnecessary `pass` statement 60 59 | 61 60 | try: + Run `ruff check --fix` to apply this fix. + PIE790.py:65:5: PIE790 [*] Unnecessary `pass` statement | 63 | buzz @@ -175,7 +193,7 @@ PIE790.py:65:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 62 62 | """ 63 63 | buzz 64 64 | """ @@ -184,6 +202,8 @@ PIE790.py:65:5: PIE790 [*] Unnecessary `pass` statement 67 66 | pass 68 67 | + Run `ruff check --fix` to apply this fix. + PIE790.py:74:5: PIE790 [*] Unnecessary `pass` statement | 72 | except ValueError: @@ -193,7 +213,7 @@ PIE790.py:74:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 71 71 | bar() 72 72 | except ValueError: 73 73 | """bar""" @@ -202,6 +222,8 @@ PIE790.py:74:5: PIE790 [*] Unnecessary `pass` statement 76 75 | 77 76 | for _ in range(10): + Run `ruff check --fix` to apply this fix. + PIE790.py:79:5: PIE790 [*] Unnecessary `pass` statement | 77 | for _ in range(10): @@ -213,7 +235,7 @@ PIE790.py:79:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 76 76 | 77 77 | for _ in range(10): 78 78 | """buzz""" @@ -222,6 +244,8 @@ PIE790.py:79:5: PIE790 [*] Unnecessary `pass` statement 81 80 | async for _ in range(10): 82 81 | """buzz""" + Run `ruff check --fix` to apply this fix. + PIE790.py:83:5: PIE790 [*] Unnecessary `pass` statement | 81 | async for _ in range(10): @@ -233,7 +257,7 @@ PIE790.py:83:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 80 80 | 81 81 | async for _ in range(10): 82 82 | """buzz""" @@ -242,6 +266,8 @@ PIE790.py:83:5: PIE790 [*] Unnecessary `pass` statement 85 84 | while cond: 86 85 | """buzz""" + Run `ruff check --fix` to apply this fix. + PIE790.py:87:5: PIE790 [*] Unnecessary `pass` statement | 85 | while cond: @@ -251,7 +277,7 @@ PIE790.py:87:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 84 84 | 85 85 | while cond: 86 86 | """buzz""" @@ -260,6 +286,8 @@ PIE790.py:87:5: PIE790 [*] Unnecessary `pass` statement 89 88 | 90 89 | with bar: + Run `ruff check --fix` to apply this fix. + PIE790.py:92:5: PIE790 [*] Unnecessary `pass` statement | 90 | with bar: @@ -271,7 +299,7 @@ PIE790.py:92:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 89 89 | 90 90 | with bar: 91 91 | """buzz""" @@ -280,6 +308,8 @@ PIE790.py:92:5: PIE790 [*] Unnecessary `pass` statement 94 93 | async with bar: 95 94 | """buzz""" + Run `ruff check --fix` to apply this fix. + PIE790.py:96:5: PIE790 [*] Unnecessary `pass` statement | 94 | async with bar: @@ -289,7 +319,7 @@ PIE790.py:96:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 93 93 | 94 94 | async with bar: 95 95 | """buzz""" @@ -298,6 +328,8 @@ PIE790.py:96:5: PIE790 [*] Unnecessary `pass` statement 98 97 | 99 98 | def foo() -> None: + Run `ruff check --fix` to apply this fix. + PIE790.py:101:5: PIE790 [*] Unnecessary `pass` statement | 99 | def foo() -> None: @@ -307,7 +339,7 @@ PIE790.py:101:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 98 98 | 99 99 | def foo() -> None: 100 100 | """buzz""" @@ -317,6 +349,8 @@ PIE790.py:101:5: PIE790 [*] Unnecessary `pass` statement 103 103 | 104 104 | class Foo: + Run `ruff check --fix` to apply this fix. + PIE790.py:130:5: PIE790 [*] Unnecessary `pass` statement | 128 | def foo(): @@ -326,7 +360,7 @@ PIE790.py:130:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 127 127 | 128 128 | def foo(): 129 129 | print("foo") @@ -335,6 +369,8 @@ PIE790.py:130:5: PIE790 [*] Unnecessary `pass` statement 132 131 | 133 132 | def foo(): + Run `ruff check --fix` to apply this fix. + PIE790.py:136:5: PIE790 [*] Unnecessary `pass` statement | 134 | """A docstring.""" @@ -344,7 +380,7 @@ PIE790.py:136:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 133 133 | def foo(): 134 134 | """A docstring.""" 135 135 | print("foo") @@ -353,6 +389,8 @@ PIE790.py:136:5: PIE790 [*] Unnecessary `pass` statement 138 137 | 139 138 | for i in range(10): + Run `ruff check --fix` to apply this fix. + PIE790.py:140:5: PIE790 [*] Unnecessary `pass` statement | 139 | for i in range(10): @@ -362,7 +400,7 @@ PIE790.py:140:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 138 138 | 139 139 | for i in range(10): 140 140 | pass @@ -371,6 +409,8 @@ PIE790.py:140:5: PIE790 [*] Unnecessary `pass` statement 143 142 | for i in range(10): 144 143 | pass + Run `ruff check --fix` to apply this fix. + PIE790.py:141:5: PIE790 [*] Unnecessary `pass` statement | 139 | for i in range(10): @@ -382,7 +422,7 @@ PIE790.py:141:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 138 138 | 139 139 | for i in range(10): 140 140 | pass @@ -391,6 +431,8 @@ PIE790.py:141:5: PIE790 [*] Unnecessary `pass` statement 143 142 | for i in range(10): 144 143 | pass + Run `ruff check --fix` to apply this fix. + PIE790.py:144:5: PIE790 [*] Unnecessary `pass` statement | 143 | for i in range(10): @@ -401,7 +443,7 @@ PIE790.py:144:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 141 141 | pass 142 142 | 143 143 | for i in range(10): @@ -410,6 +452,8 @@ PIE790.py:144:5: PIE790 [*] Unnecessary `pass` statement 146 145 | pass 147 146 | + Run `ruff check --fix` to apply this fix. + PIE790.py:146:5: PIE790 [*] Unnecessary `pass` statement | 144 | pass @@ -421,7 +465,7 @@ PIE790.py:146:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 143 143 | for i in range(10): 144 144 | pass 145 145 | @@ -430,6 +474,8 @@ PIE790.py:146:5: PIE790 [*] Unnecessary `pass` statement 148 147 | for i in range(10): 149 148 | pass # comment + Run `ruff check --fix` to apply this fix. + PIE790.py:149:5: PIE790 [*] Unnecessary `pass` statement | 148 | for i in range(10): @@ -439,7 +485,7 @@ PIE790.py:149:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 146 146 | pass 147 147 | 148 148 | for i in range(10): @@ -449,6 +495,8 @@ PIE790.py:149:5: PIE790 [*] Unnecessary `pass` statement 151 151 | 152 152 | + Run `ruff check --fix` to apply this fix. + PIE790.py:150:5: PIE790 [*] Unnecessary `pass` statement | 148 | for i in range(10): @@ -458,7 +506,7 @@ PIE790.py:150:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 147 147 | 148 148 | for i in range(10): 149 149 | pass # comment @@ -467,6 +515,8 @@ PIE790.py:150:5: PIE790 [*] Unnecessary `pass` statement 152 151 | 153 152 | def foo(): + Run `ruff check --fix` to apply this fix. + PIE790.py:155:5: PIE790 [*] Unnecessary `...` literal | 153 | def foo(): @@ -476,7 +526,7 @@ PIE790.py:155:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 152 152 | 153 153 | def foo(): 154 154 | print("foo") @@ -485,6 +535,8 @@ PIE790.py:155:5: PIE790 [*] Unnecessary `...` literal 157 156 | 158 157 | def foo(): + Run `ruff check --fix` to apply this fix. + PIE790.py:161:5: PIE790 [*] Unnecessary `...` literal | 159 | """A docstring.""" @@ -494,7 +546,7 @@ PIE790.py:161:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 158 158 | def foo(): 159 159 | """A docstring.""" 160 160 | print("foo") @@ -503,6 +555,8 @@ PIE790.py:161:5: PIE790 [*] Unnecessary `...` literal 163 162 | 164 163 | for i in range(10): + Run `ruff check --fix` to apply this fix. + PIE790.py:165:5: PIE790 [*] Unnecessary `...` literal | 164 | for i in range(10): @@ -512,7 +566,7 @@ PIE790.py:165:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 163 163 | 164 164 | for i in range(10): 165 165 | ... @@ -521,6 +575,8 @@ PIE790.py:165:5: PIE790 [*] Unnecessary `...` literal 168 167 | for i in range(10): 169 168 | ... + Run `ruff check --fix` to apply this fix. + PIE790.py:166:5: PIE790 [*] Unnecessary `...` literal | 164 | for i in range(10): @@ -532,7 +588,7 @@ PIE790.py:166:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 163 163 | 164 164 | for i in range(10): 165 165 | ... @@ -541,6 +597,8 @@ PIE790.py:166:5: PIE790 [*] Unnecessary `...` literal 168 167 | for i in range(10): 169 168 | ... + Run `ruff check --fix` to apply this fix. + PIE790.py:169:5: PIE790 [*] Unnecessary `...` literal | 168 | for i in range(10): @@ -551,7 +609,7 @@ PIE790.py:169:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 166 166 | ... 167 167 | 168 168 | for i in range(10): @@ -560,6 +618,8 @@ PIE790.py:169:5: PIE790 [*] Unnecessary `...` literal 171 170 | ... 172 171 | + Run `ruff check --fix` to apply this fix. + PIE790.py:171:5: PIE790 [*] Unnecessary `...` literal | 169 | ... @@ -571,7 +631,7 @@ PIE790.py:171:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 168 168 | for i in range(10): 169 169 | ... 170 170 | @@ -580,6 +640,8 @@ PIE790.py:171:5: PIE790 [*] Unnecessary `...` literal 173 172 | for i in range(10): 174 173 | ... # comment + Run `ruff check --fix` to apply this fix. + PIE790.py:174:5: PIE790 [*] Unnecessary `...` literal | 173 | for i in range(10): @@ -589,7 +651,7 @@ PIE790.py:174:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 171 171 | ... 172 172 | 173 173 | for i in range(10): @@ -599,6 +661,8 @@ PIE790.py:174:5: PIE790 [*] Unnecessary `...` literal 176 176 | 177 177 | for i in range(10): + Run `ruff check --fix` to apply this fix. + PIE790.py:175:5: PIE790 [*] Unnecessary `...` literal | 173 | for i in range(10): @@ -610,7 +674,7 @@ PIE790.py:175:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 172 172 | 173 173 | for i in range(10): 174 174 | ... # comment @@ -619,6 +683,8 @@ PIE790.py:175:5: PIE790 [*] Unnecessary `...` literal 177 176 | for i in range(10): 178 177 | ... + Run `ruff check --fix` to apply this fix. + PIE790.py:178:5: PIE790 [*] Unnecessary `...` literal | 177 | for i in range(10): @@ -628,7 +694,7 @@ PIE790.py:178:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 175 175 | ... 176 176 | 177 177 | for i in range(10): @@ -637,6 +703,8 @@ PIE790.py:178:5: PIE790 [*] Unnecessary `...` literal 180 179 | 181 180 | from typing import Protocol + Run `ruff check --fix` to apply this fix. + PIE790.py:179:5: PIE790 [*] Unnecessary `pass` statement | 177 | for i in range(10): @@ -648,7 +716,7 @@ PIE790.py:179:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 176 176 | 177 177 | for i in range(10): 178 178 | ... @@ -657,6 +725,8 @@ PIE790.py:179:5: PIE790 [*] Unnecessary `pass` statement 181 180 | from typing import Protocol 182 181 | + Run `ruff check --fix` to apply this fix. + PIE790.py:209:9: PIE790 [*] Unnecessary `...` literal | 207 | def stub(self) -> str: @@ -666,7 +736,7 @@ PIE790.py:209:9: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 206 206 | 207 207 | def stub(self) -> str: 208 208 | """Docstring""" @@ -675,4 +745,4 @@ PIE790.py:209:9: PIE790 [*] Unnecessary `...` literal 211 210 | 212 211 | class Repro(Protocol[int]): - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap index f5945563ffb5f..e123bd2ac6426 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap @@ -12,7 +12,7 @@ PIE794.py:4:5: PIE794 [*] Class field `name` is defined multiple times | = help: Remove duplicate field definition for `name` -ℹ Unsafe fix +Suggested fix: 1 1 | class Foo(BaseModel): 2 2 | name = StringField() 3 3 | # .... @@ -21,6 +21,8 @@ PIE794.py:4:5: PIE794 [*] Class field `name` is defined multiple times 6 5 | def remove(self) -> None: 7 6 | ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PIE794.py:13:5: PIE794 [*] Class field `name` is defined multiple times | 11 | name: str = StringField() @@ -32,7 +34,7 @@ PIE794.py:13:5: PIE794 [*] Class field `name` is defined multiple times | = help: Remove duplicate field definition for `name` -ℹ Unsafe fix +Suggested fix: 10 10 | class Foo(BaseModel): 11 11 | name: str = StringField() 12 12 | # .... @@ -41,6 +43,8 @@ PIE794.py:13:5: PIE794 [*] Class field `name` is defined multiple times 15 14 | def foo(self) -> None: 16 15 | ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PIE794.py:23:5: PIE794 [*] Class field `bar` is defined multiple times | 21 | foo: bool = BooleanField() @@ -50,7 +54,7 @@ PIE794.py:23:5: PIE794 [*] Class field `bar` is defined multiple times | = help: Remove duplicate field definition for `bar` -ℹ Unsafe fix +Suggested fix: 20 20 | bar: str = StringField() 21 21 | foo: bool = BooleanField() 22 22 | # ... @@ -59,6 +63,8 @@ PIE794.py:23:5: PIE794 [*] Class field `bar` is defined multiple times 25 24 | 26 25 | class User(BaseModel): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PIE794.py:40:5: PIE794 [*] Class field `bar` is defined multiple times | 38 | foo: bool = BooleanField() @@ -68,7 +74,7 @@ PIE794.py:40:5: PIE794 [*] Class field `bar` is defined multiple times | = help: Remove duplicate field definition for `bar` -ℹ Unsafe fix +Suggested fix: 37 37 | bar: str = StringField() 38 38 | foo: bool = BooleanField() 39 39 | # ... @@ -77,6 +83,8 @@ PIE794.py:40:5: PIE794 [*] Class field `bar` is defined multiple times 42 41 | 43 42 | class Person: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PIE794.py:46:5: PIE794 [*] Class field `name` is defined multiple times | 44 | name = "Foo" @@ -86,7 +94,7 @@ PIE794.py:46:5: PIE794 [*] Class field `name` is defined multiple times | = help: Remove duplicate field definition for `name` -ℹ Unsafe fix +Suggested fix: 43 43 | class Person: 44 44 | name = "Foo" 45 45 | name = name + " Bar" @@ -95,6 +103,8 @@ PIE794.py:46:5: PIE794 [*] Class field `name` is defined multiple times 48 47 | 49 48 | class Person: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PIE794.py:52:5: PIE794 [*] Class field `name` is defined multiple times | 50 | name: str = "Foo" @@ -104,10 +114,10 @@ PIE794.py:52:5: PIE794 [*] Class field `name` is defined multiple times | = help: Remove duplicate field definition for `name` -ℹ Unsafe fix +Suggested fix: 49 49 | class Person: 50 50 | name: str = "Foo" 51 51 | name: str = name + " Bar" 52 |- name: str = "Bar" # PIE794 - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap index 217e4c71f3a21..7a1b88457d50a 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap @@ -10,13 +10,15 @@ PIE800.py:1:14: PIE800 [*] Unnecessary spread `**` | = help: Remove unnecessary dict -ℹ Safe fix +Suggested fix: 1 |-{"foo": 1, **{"bar": 1}} # PIE800 1 |+{"foo": 1, "bar": 1} # PIE800 2 2 | 3 3 | {**{"bar": 10}, "a": "b"} # PIE800 4 4 | + Run `ruff check --fix` to apply this fix. + PIE800.py:3:4: PIE800 [*] Unnecessary spread `**` | 1 | {"foo": 1, **{"bar": 1}} # PIE800 @@ -28,7 +30,7 @@ PIE800.py:3:4: PIE800 [*] Unnecessary spread `**` | = help: Remove unnecessary dict -ℹ Safe fix +Suggested fix: 1 1 | {"foo": 1, **{"bar": 1}} # PIE800 2 2 | 3 |-{**{"bar": 10}, "a": "b"} # PIE800 @@ -37,6 +39,8 @@ PIE800.py:3:4: PIE800 [*] Unnecessary spread `**` 5 5 | foo({**foo, **{"bar": True}}) # PIE800 6 6 | + Run `ruff check --fix` to apply this fix. + PIE800.py:5:15: PIE800 [*] Unnecessary spread `**` | 3 | {**{"bar": 10}, "a": "b"} # PIE800 @@ -48,7 +52,7 @@ PIE800.py:5:15: PIE800 [*] Unnecessary spread `**` | = help: Remove unnecessary dict -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | {**{"bar": 10}, "a": "b"} # PIE800 4 4 | @@ -58,6 +62,8 @@ PIE800.py:5:15: PIE800 [*] Unnecessary spread `**` 7 7 | {**foo, **{"bar": 10}} # PIE800 8 8 | + Run `ruff check --fix` to apply this fix. + PIE800.py:7:11: PIE800 [*] Unnecessary spread `**` | 5 | foo({**foo, **{"bar": True}}) # PIE800 @@ -69,7 +75,7 @@ PIE800.py:7:11: PIE800 [*] Unnecessary spread `**` | = help: Remove unnecessary dict -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | foo({**foo, **{"bar": True}}) # PIE800 6 6 | @@ -79,6 +85,8 @@ PIE800.py:7:11: PIE800 [*] Unnecessary spread `**` 9 9 | { # PIE800 10 10 | "a": "b", + Run `ruff check --fix` to apply this fix. + PIE800.py:12:7: PIE800 [*] Unnecessary spread `**` | 10 | "a": "b", @@ -94,7 +102,7 @@ PIE800.py:12:7: PIE800 [*] Unnecessary spread `**` | = help: Remove unnecessary dict -ℹ Safe fix +Suggested fix: 9 9 | { # PIE800 10 10 | "a": "b", 11 11 | # Preserve @@ -110,6 +118,8 @@ PIE800.py:12:7: PIE800 [*] Unnecessary spread `**` 18 18 | 19 19 | {**foo, **buzz, **{bar: 10}} # PIE800 + Run `ruff check --fix` to apply this fix. + PIE800.py:19:19: PIE800 [*] Unnecessary spread `**` | 17 | } @@ -121,7 +131,7 @@ PIE800.py:19:19: PIE800 [*] Unnecessary spread `**` | = help: Remove unnecessary dict -ℹ Safe fix +Suggested fix: 16 16 | }, 17 17 | } 18 18 | @@ -131,4 +141,4 @@ PIE800.py:19:19: PIE800 [*] Unnecessary spread `**` 21 21 | {**foo, "bar": True } # OK 22 22 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE804_PIE804.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE804_PIE804.py.snap index b6a65ca50d257..29b871cbb8033 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE804_PIE804.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE804_PIE804.py.snap @@ -10,13 +10,15 @@ PIE804.py:1:5: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -ℹ Safe fix +Suggested fix: 1 |-foo(**{"bar": True}) # PIE804 1 |+foo(bar=True) # PIE804 2 2 | 3 3 | foo(**{"r2d2": True}) # PIE804 4 4 | + Run `ruff check --fix` to apply this fix. + PIE804.py:3:5: PIE804 [*] Unnecessary `dict` kwargs | 1 | foo(**{"bar": True}) # PIE804 @@ -28,7 +30,7 @@ PIE804.py:3:5: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -ℹ Safe fix +Suggested fix: 1 1 | foo(**{"bar": True}) # PIE804 2 2 | 3 |-foo(**{"r2d2": True}) # PIE804 @@ -37,6 +39,8 @@ PIE804.py:3:5: PIE804 [*] Unnecessary `dict` kwargs 5 5 | Foo.objects.create(**{"bar": True}) # PIE804 6 6 | + Run `ruff check --fix` to apply this fix. + PIE804.py:5:20: PIE804 [*] Unnecessary `dict` kwargs | 3 | foo(**{"r2d2": True}) # PIE804 @@ -48,7 +52,7 @@ PIE804.py:5:20: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | foo(**{"r2d2": True}) # PIE804 4 4 | @@ -58,6 +62,8 @@ PIE804.py:5:20: PIE804 [*] Unnecessary `dict` kwargs 7 7 | Foo.objects.create(**{"_id": some_id}) # PIE804 8 8 | + Run `ruff check --fix` to apply this fix. + PIE804.py:7:20: PIE804 [*] Unnecessary `dict` kwargs | 5 | Foo.objects.create(**{"bar": True}) # PIE804 @@ -69,7 +75,7 @@ PIE804.py:7:20: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | Foo.objects.create(**{"bar": True}) # PIE804 6 6 | @@ -79,6 +85,8 @@ PIE804.py:7:20: PIE804 [*] Unnecessary `dict` kwargs 9 9 | Foo.objects.create(**{**bar}) # PIE804 10 10 | + Run `ruff check --fix` to apply this fix. + PIE804.py:9:20: PIE804 [*] Unnecessary `dict` kwargs | 7 | Foo.objects.create(**{"_id": some_id}) # PIE804 @@ -90,7 +98,7 @@ PIE804.py:9:20: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -ℹ Safe fix +Suggested fix: 6 6 | 7 7 | Foo.objects.create(**{"_id": some_id}) # PIE804 8 8 | @@ -100,6 +108,8 @@ PIE804.py:9:20: PIE804 [*] Unnecessary `dict` kwargs 11 11 | foo(**{}) 12 12 | + Run `ruff check --fix` to apply this fix. + PIE804.py:11:5: PIE804 [*] Unnecessary `dict` kwargs | 9 | Foo.objects.create(**{**bar}) # PIE804 @@ -111,7 +121,7 @@ PIE804.py:11:5: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -ℹ Safe fix +Suggested fix: 8 8 | 9 9 | Foo.objects.create(**{**bar}) # PIE804 10 10 | @@ -121,6 +131,8 @@ PIE804.py:11:5: PIE804 [*] Unnecessary `dict` kwargs 13 13 | foo(**{**data, "foo": "buzz"}) 14 14 | foo(**buzz) + Run `ruff check --fix` to apply this fix. + PIE804.py:22:5: PIE804 [*] Unnecessary `dict` kwargs | 20 | foo(**{f"buzz__{bar}": True}) @@ -132,7 +144,7 @@ PIE804.py:22:5: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -ℹ Safe fix +Suggested fix: 19 19 | foo(**{"": True}) 20 20 | foo(**{f"buzz__{bar}": True}) 21 21 | abc(**{"for": 3}) @@ -142,6 +154,8 @@ PIE804.py:22:5: PIE804 [*] Unnecessary `dict` kwargs 24 24 | # Duplicated key names won't be fixed, to avoid syntax errors. 25 25 | abc(**{'a': b}, **{'a': c}) # PIE804 + Run `ruff check --fix` to apply this fix. + PIE804.py:25:5: PIE804 Unnecessary `dict` kwargs | 24 | # Duplicated key names won't be fixed, to avoid syntax errors. @@ -182,7 +196,7 @@ PIE804.py:26:22: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -ℹ Safe fix +Suggested fix: 23 23 | 24 24 | # Duplicated key names won't be fixed, to avoid syntax errors. 25 25 | abc(**{'a': b}, **{'a': c}) # PIE804 @@ -192,6 +206,8 @@ PIE804.py:26:22: PIE804 [*] Unnecessary `dict` kwargs 28 28 | # Some values need to be parenthesized. 29 29 | abc(foo=1, **{'bar': (bar := 1)}) # PIE804 + Run `ruff check --fix` to apply this fix. + PIE804.py:29:12: PIE804 [*] Unnecessary `dict` kwargs | 28 | # Some values need to be parenthesized. @@ -201,7 +217,7 @@ PIE804.py:29:12: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -ℹ Safe fix +Suggested fix: 26 26 | abc(a=1, **{'a': c}, **{'b': c}) # PIE804 27 27 | 28 28 | # Some values need to be parenthesized. @@ -209,6 +225,8 @@ PIE804.py:29:12: PIE804 [*] Unnecessary `dict` kwargs 29 |+abc(foo=1, bar=(bar := 1)) # PIE804 30 30 | abc(foo=1, **{'bar': (yield 1)}) # PIE804 + Run `ruff check --fix` to apply this fix. + PIE804.py:30:12: PIE804 [*] Unnecessary `dict` kwargs | 28 | # Some values need to be parenthesized. @@ -218,9 +236,11 @@ PIE804.py:30:12: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -ℹ Safe fix +Suggested fix: 27 27 | 28 28 | # Some values need to be parenthesized. 29 29 | abc(foo=1, **{'bar': (bar := 1)}) # PIE804 30 |-abc(foo=1, **{'bar': (yield 1)}) # PIE804 30 |+abc(foo=1, bar=(yield 1)) # PIE804 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE807_PIE807.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE807_PIE807.py.snap index 474c3456d53f9..0b48ea9a8e8f1 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE807_PIE807.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE807_PIE807.py.snap @@ -11,7 +11,7 @@ PIE807.py:3:44: PIE807 [*] Prefer `list` over useless lambda | = help: Replace with `lambda` with `list` -ℹ Safe fix +Suggested fix: 1 1 | @dataclass 2 2 | class Foo: 3 |- foo: List[str] = field(default_factory=lambda: []) # PIE807 @@ -20,6 +20,8 @@ PIE807.py:3:44: PIE807 [*] Prefer `list` over useless lambda 5 5 | 6 6 | + Run `ruff check --fix` to apply this fix. + PIE807.py:4:49: PIE807 [*] Prefer `dict` over useless lambda | 2 | class Foo: @@ -29,7 +31,7 @@ PIE807.py:4:49: PIE807 [*] Prefer `dict` over useless lambda | = help: Replace with `lambda` with `dict` -ℹ Safe fix +Suggested fix: 1 1 | @dataclass 2 2 | class Foo: 3 3 | foo: List[str] = field(default_factory=lambda: []) # PIE807 @@ -39,6 +41,8 @@ PIE807.py:4:49: PIE807 [*] Prefer `dict` over useless lambda 6 6 | 7 7 | class FooTable(BaseTable): + Run `ruff check --fix` to apply this fix. + PIE807.py:8:36: PIE807 [*] Prefer `list` over useless lambda | 7 | class FooTable(BaseTable): @@ -48,7 +52,7 @@ PIE807.py:8:36: PIE807 [*] Prefer `list` over useless lambda | = help: Replace with `lambda` with `list` -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | 7 7 | class FooTable(BaseTable): @@ -58,6 +62,8 @@ PIE807.py:8:36: PIE807 [*] Prefer `list` over useless lambda 10 10 | 11 11 | + Run `ruff check --fix` to apply this fix. + PIE807.py:9:36: PIE807 [*] Prefer `dict` over useless lambda | 7 | class FooTable(BaseTable): @@ -67,7 +73,7 @@ PIE807.py:9:36: PIE807 [*] Prefer `dict` over useless lambda | = help: Replace with `lambda` with `dict` -ℹ Safe fix +Suggested fix: 6 6 | 7 7 | class FooTable(BaseTable): 8 8 | foo = fields.ListField(default=lambda: []) # PIE807 @@ -77,6 +83,8 @@ PIE807.py:9:36: PIE807 [*] Prefer `dict` over useless lambda 11 11 | 12 12 | class FooTable(BaseTable): + Run `ruff check --fix` to apply this fix. + PIE807.py:13:28: PIE807 [*] Prefer `list` over useless lambda | 12 | class FooTable(BaseTable): @@ -86,7 +94,7 @@ PIE807.py:13:28: PIE807 [*] Prefer `list` over useless lambda | = help: Replace with `lambda` with `list` -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | 12 12 | class FooTable(BaseTable): @@ -96,6 +104,8 @@ PIE807.py:13:28: PIE807 [*] Prefer `list` over useless lambda 15 15 | 16 16 | + Run `ruff check --fix` to apply this fix. + PIE807.py:14:36: PIE807 [*] Prefer `dict` over useless lambda | 12 | class FooTable(BaseTable): @@ -105,7 +115,7 @@ PIE807.py:14:36: PIE807 [*] Prefer `dict` over useless lambda | = help: Replace with `lambda` with `dict` -ℹ Safe fix +Suggested fix: 11 11 | 12 12 | class FooTable(BaseTable): 13 13 | foo = fields.ListField(lambda: []) # PIE807 @@ -115,4 +125,4 @@ PIE807.py:14:36: PIE807 [*] Prefer `dict` over useless lambda 16 16 | 17 17 | @dataclass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE808_PIE808.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE808_PIE808.py.snap index 91c5932b028c7..73c6defbebd56 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE808_PIE808.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE808_PIE808.py.snap @@ -11,7 +11,7 @@ PIE808.py:2:7: PIE808 [*] Unnecessary `start` argument in `range` | = help: Remove `start` argument -ℹ Safe fix +Suggested fix: 1 1 | # PIE808 2 |-range(0, 10) 2 |+range(10) @@ -19,6 +19,8 @@ PIE808.py:2:7: PIE808 [*] Unnecessary `start` argument in `range` 4 4 | import builtins 5 5 | builtins.range(0, 10) + Run `ruff check --fix` to apply this fix. + PIE808.py:5:16: PIE808 [*] Unnecessary `start` argument in `range` | 4 | import builtins @@ -29,7 +31,7 @@ PIE808.py:5:16: PIE808 [*] Unnecessary `start` argument in `range` | = help: Remove `start` argument -ℹ Safe fix +Suggested fix: 2 2 | range(0, 10) 3 3 | 4 4 | import builtins @@ -38,3 +40,5 @@ PIE808.py:5:16: PIE808 [*] Unnecessary `start` argument in `range` 6 6 | 7 7 | # OK 8 8 | range(x, 10) + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap index d2d29d693f350..ccb047259e15d 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap @@ -11,7 +11,7 @@ PIE810.py:2:1: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -ℹ Unsafe fix +Suggested fix: 1 1 | # error 2 |-obj.startswith("foo") or obj.startswith("bar") 2 |+obj.startswith(("foo", "bar")) @@ -19,6 +19,8 @@ PIE810.py:2:1: PIE810 [*] Call `startswith` once with a `tuple` 4 4 | obj.endswith("foo") or obj.endswith("bar") 5 5 | # error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PIE810.py:4:1: PIE810 [*] Call `endswith` once with a `tuple` | 2 | obj.startswith("foo") or obj.startswith("bar") @@ -30,7 +32,7 @@ PIE810.py:4:1: PIE810 [*] Call `endswith` once with a `tuple` | = help: Merge into a single `endswith` call -ℹ Unsafe fix +Suggested fix: 1 1 | # error 2 2 | obj.startswith("foo") or obj.startswith("bar") 3 3 | # error @@ -40,6 +42,8 @@ PIE810.py:4:1: PIE810 [*] Call `endswith` once with a `tuple` 6 6 | obj.startswith(foo) or obj.startswith(bar) 7 7 | # error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PIE810.py:6:1: PIE810 [*] Call `startswith` once with a `tuple` | 4 | obj.endswith("foo") or obj.endswith("bar") @@ -51,7 +55,7 @@ PIE810.py:6:1: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -ℹ Unsafe fix +Suggested fix: 3 3 | # error 4 4 | obj.endswith("foo") or obj.endswith("bar") 5 5 | # error @@ -61,6 +65,8 @@ PIE810.py:6:1: PIE810 [*] Call `startswith` once with a `tuple` 8 8 | obj.startswith(foo) or obj.startswith("foo") 9 9 | # error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PIE810.py:8:1: PIE810 [*] Call `startswith` once with a `tuple` | 6 | obj.startswith(foo) or obj.startswith(bar) @@ -72,7 +78,7 @@ PIE810.py:8:1: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -ℹ Unsafe fix +Suggested fix: 5 5 | # error 6 6 | obj.startswith(foo) or obj.startswith(bar) 7 7 | # error @@ -82,6 +88,8 @@ PIE810.py:8:1: PIE810 [*] Call `startswith` once with a `tuple` 10 10 | obj.endswith(foo) or obj.startswith(foo) or obj.startswith("foo") 11 11 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PIE810.py:10:1: PIE810 [*] Call `startswith` once with a `tuple` | 8 | obj.startswith(foo) or obj.startswith("foo") @@ -93,7 +101,7 @@ PIE810.py:10:1: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -ℹ Unsafe fix +Suggested fix: 7 7 | # error 8 8 | obj.startswith(foo) or obj.startswith("foo") 9 9 | # error @@ -103,6 +111,8 @@ PIE810.py:10:1: PIE810 [*] Call `startswith` once with a `tuple` 12 12 | def func(): 13 13 | msg = "hello world" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PIE810.py:19:8: PIE810 [*] Call `startswith` once with a `tuple` | 17 | z = "w" @@ -113,7 +123,7 @@ PIE810.py:19:8: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -ℹ Unsafe fix +Suggested fix: 16 16 | y = ("h", "e", "l", "l", "o") 17 17 | z = "w" 18 18 | @@ -123,6 +133,8 @@ PIE810.py:19:8: PIE810 [*] Call `startswith` once with a `tuple` 21 21 | 22 22 | def func(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PIE810.py:25:8: PIE810 [*] Call `startswith` once with a `tuple` | 23 | msg = "hello world" @@ -133,7 +145,7 @@ PIE810.py:25:8: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -ℹ Unsafe fix +Suggested fix: 22 22 | def func(): 23 23 | msg = "hello world" 24 24 | @@ -143,4 +155,4 @@ PIE810.py:25:8: PIE810 [*] Call `startswith` once with a `tuple` 27 27 | 28 28 | # ok - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap index 2cbb5753612a3..ef41f25d577ff 100644 --- a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap +++ b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap @@ -12,7 +12,7 @@ T201.py:4:1: T201 [*] `print` found | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 1 1 | import sys 2 2 | import tempfile 3 3 | @@ -21,6 +21,8 @@ T201.py:4:1: T201 [*] `print` found 6 5 | print("Hello, world!", file=sys.stdout) # T201 7 6 | print("Hello, world!", file=sys.stderr) # T201 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + T201.py:5:1: T201 [*] `print` found | 4 | print("Hello, world!") # T201 @@ -31,7 +33,7 @@ T201.py:5:1: T201 [*] `print` found | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 2 2 | import tempfile 3 3 | 4 4 | print("Hello, world!") # T201 @@ -40,6 +42,8 @@ T201.py:5:1: T201 [*] `print` found 7 6 | print("Hello, world!", file=sys.stderr) # T201 8 7 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + T201.py:6:1: T201 [*] `print` found | 4 | print("Hello, world!") # T201 @@ -50,7 +54,7 @@ T201.py:6:1: T201 [*] `print` found | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | print("Hello, world!") # T201 5 5 | print("Hello, world!", file=None) # T201 @@ -59,6 +63,8 @@ T201.py:6:1: T201 [*] `print` found 8 7 | 9 8 | with tempfile.NamedTemporaryFile() as fp: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + T201.py:7:1: T201 [*] `print` found | 5 | print("Hello, world!", file=None) # T201 @@ -70,7 +76,7 @@ T201.py:7:1: T201 [*] `print` found | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 4 4 | print("Hello, world!") # T201 5 5 | print("Hello, world!", file=None) # T201 6 6 | print("Hello, world!", file=sys.stdout) # T201 @@ -79,4 +85,4 @@ T201.py:7:1: T201 [*] `print` found 9 8 | with tempfile.NamedTemporaryFile() as fp: 10 9 | print("Hello, world!", file=fp) # OK - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap index f63e108c8618c..d365c438eccfe 100644 --- a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap +++ b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap @@ -12,7 +12,7 @@ T203.py:3:1: T203 [*] `pprint` found | = help: Remove `pprint` -ℹ Unsafe fix +Suggested fix: 1 1 | from pprint import pprint 2 2 | 3 |-pprint("Hello, world!") # T203 @@ -20,6 +20,8 @@ T203.py:3:1: T203 [*] `pprint` found 5 4 | import pprint 6 5 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + T203.py:7:1: T203 [*] `pprint` found | 5 | import pprint @@ -31,7 +33,7 @@ T203.py:7:1: T203 [*] `pprint` found | = help: Remove `pprint` -ℹ Unsafe fix +Suggested fix: 4 4 | 5 5 | import pprint 6 6 | @@ -39,4 +41,4 @@ T203.py:7:1: T203 [*] `pprint` found 8 7 | 9 8 | pprint.pformat("Hello, world!") - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI009_PYI009.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI009_PYI009.pyi.snap index d4c1347bf3c7a..05072ab2d3d70 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI009_PYI009.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI009_PYI009.pyi.snap @@ -12,7 +12,7 @@ PYI009.pyi:3:5: PYI009 [*] Empty body should contain `...`, not `pass` | = help: Replace `pass` with `...` -ℹ Safe fix +Suggested fix: 1 1 | def bar(): ... # OK 2 2 | def foo(): 3 |- pass # ERROR PYI009, since we're in a stub file @@ -21,6 +21,8 @@ PYI009.pyi:3:5: PYI009 [*] Empty body should contain `...`, not `pass` 5 5 | class Bar: ... # OK 6 6 | + Run `ruff check --fix` to apply this fix. + PYI009.pyi:8:5: PYI009 [*] Empty body should contain `...`, not `pass` | 7 | class Foo: @@ -29,11 +31,11 @@ PYI009.pyi:8:5: PYI009 [*] Empty body should contain `...`, not `pass` | = help: Replace `pass` with `...` -ℹ Safe fix +Suggested fix: 5 5 | class Bar: ... # OK 6 6 | 7 7 | class Foo: 8 |- pass # ERROR PYI009, since we're in a stub file 8 |+ ... # ERROR PYI009, since we're in a stub file - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap index 516ca749ad73b..4f27777cd4829 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap @@ -11,7 +11,7 @@ PYI010.pyi:6:5: PYI010 [*] Function body must contain only `...` | = help: Replace function body with `...` -ℹ Safe fix +Suggested fix: 3 3 | """foo""" # OK, docstrings are handled by another rule 4 4 | 5 5 | def buzz(): @@ -21,6 +21,8 @@ PYI010.pyi:6:5: PYI010 [*] Function body must contain only `...` 8 8 | def foo2(): 9 9 | 123 # ERROR PYI010 + Run `ruff check --fix` to apply this fix. + PYI010.pyi:9:5: PYI010 [*] Function body must contain only `...` | 8 | def foo2(): @@ -31,7 +33,7 @@ PYI010.pyi:9:5: PYI010 [*] Function body must contain only `...` | = help: Replace function body with `...` -ℹ Safe fix +Suggested fix: 6 6 | print("buzz") # ERROR PYI010 7 7 | 8 8 | def foo2(): @@ -41,6 +43,8 @@ PYI010.pyi:9:5: PYI010 [*] Function body must contain only `...` 11 11 | def bizz(): 12 12 | x = 123 # ERROR PYI010 + Run `ruff check --fix` to apply this fix. + PYI010.pyi:12:5: PYI010 [*] Function body must contain only `...` | 11 | def bizz(): @@ -51,7 +55,7 @@ PYI010.pyi:12:5: PYI010 [*] Function body must contain only `...` | = help: Replace function body with `...` -ℹ Safe fix +Suggested fix: 9 9 | 123 # ERROR PYI010 10 10 | 11 11 | def bizz(): @@ -61,4 +65,4 @@ PYI010.pyi:12:5: PYI010 [*] Function body must contain only `...` 14 14 | def foo3(): 15 15 | pass # OK, pass is handled by another rule - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap index 6a68fe21f28fb..5dc5af9468d89 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap @@ -12,7 +12,7 @@ PYI011.pyi:10:14: PYI011 [*] Only simple default values allowed for typed argume | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 7 7 | 8 8 | def f12( 9 9 | x, @@ -22,6 +22,8 @@ PYI011.pyi:10:14: PYI011 [*] Only simple default values allowed for typed argume 12 12 | def f11(*, x: str = "x") -> None: ... # OK 13 13 | def f13( + Run `ruff check --fix` to apply this fix. + PYI011.pyi:38:9: PYI011 [*] Only simple default values allowed for typed arguments | 36 | x: dict[ @@ -37,7 +39,7 @@ PYI011.pyi:38:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 35 35 | def f152( 36 36 | x: dict[ 37 37 | int, int @@ -50,6 +52,8 @@ PYI011.pyi:38:9: PYI011 [*] Only simple default values allowed for typed argumen 43 40 | def f153( 44 41 | x: list[ + Run `ruff check --fix` to apply this fix. + PYI011.pyi:46:9: PYI011 [*] Only simple default values allowed for typed arguments | 44 | x: list[ @@ -74,7 +78,7 @@ PYI011.pyi:46:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 43 43 | def f153( 44 44 | x: list[ 45 45 | int @@ -96,6 +100,8 @@ PYI011.pyi:46:9: PYI011 [*] Only simple default values allowed for typed argumen 60 48 | def f154( 61 49 | x: tuple[ + Run `ruff check --fix` to apply this fix. + PYI011.pyi:63:9: PYI011 [*] Only simple default values allowed for typed arguments | 61 | x: tuple[ @@ -111,7 +117,7 @@ PYI011.pyi:63:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 60 60 | def f154( 61 61 | x: tuple[ 62 62 | str, tuple[str, ...] @@ -124,6 +130,8 @@ PYI011.pyi:63:9: PYI011 [*] Only simple default values allowed for typed argumen 68 65 | def f141( 69 66 | x: list[ + Run `ruff check --fix` to apply this fix. + PYI011.pyi:71:9: PYI011 [*] Only simple default values allowed for typed arguments | 69 | x: list[ @@ -138,7 +146,7 @@ PYI011.pyi:71:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 68 68 | def f141( 69 69 | x: list[ 70 70 | int @@ -150,6 +158,8 @@ PYI011.pyi:71:9: PYI011 [*] Only simple default values allowed for typed argumen 75 73 | def f142( 76 74 | x: list[ + Run `ruff check --fix` to apply this fix. + PYI011.pyi:78:9: PYI011 [*] Only simple default values allowed for typed arguments | 76 | x: list[ @@ -164,7 +174,7 @@ PYI011.pyi:78:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 75 75 | def f142( 76 76 | x: list[ 77 77 | int @@ -176,6 +186,8 @@ PYI011.pyi:78:9: PYI011 [*] Only simple default values allowed for typed argumen 82 80 | def f16( 83 81 | x: frozenset[ + Run `ruff check --fix` to apply this fix. + PYI011.pyi:85:9: PYI011 [*] Only simple default values allowed for typed arguments | 83 | x: frozenset[ @@ -190,7 +202,7 @@ PYI011.pyi:85:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 82 82 | def f16( 83 83 | x: frozenset[ 84 84 | bytes @@ -202,6 +214,8 @@ PYI011.pyi:85:9: PYI011 [*] Only simple default values allowed for typed argumen 89 87 | def f17( 90 88 | x: str = "foo" # Error PYI011 Only simple default values allowed for typed arguments + Run `ruff check --fix` to apply this fix. + PYI011.pyi:90:14: PYI011 [*] Only simple default values allowed for typed arguments | 88 | ) -> None: ... @@ -215,7 +229,7 @@ PYI011.pyi:90:14: PYI011 [*] Only simple default values allowed for typed argume | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 87 87 | ) 88 88 | ) -> None: ... 89 89 | def f17( @@ -226,6 +240,8 @@ PYI011.pyi:90:14: PYI011 [*] Only simple default values allowed for typed argume 93 92 | def f18( 94 93 | x: str = b"foo" # Error PYI011 Only simple default values allowed for typed arguments + Run `ruff check --fix` to apply this fix. + PYI011.pyi:94:14: PYI011 [*] Only simple default values allowed for typed arguments | 92 | ) -> None: ... @@ -239,7 +255,7 @@ PYI011.pyi:94:14: PYI011 [*] Only simple default values allowed for typed argume | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 91 91 | + "bar", 92 92 | ) -> None: ... 93 93 | def f18( @@ -250,6 +266,8 @@ PYI011.pyi:94:14: PYI011 [*] Only simple default values allowed for typed argume 97 96 | def f19( 98 97 | x: object = "foo" # Error PYI011 Only simple default values allowed for typed arguments + Run `ruff check --fix` to apply this fix. + PYI011.pyi:98:17: PYI011 [*] Only simple default values allowed for typed arguments | 96 | ) -> None: ... @@ -263,7 +281,7 @@ PYI011.pyi:98:17: PYI011 [*] Only simple default values allowed for typed argume | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 95 95 | + b"bar", 96 96 | ) -> None: ... 97 97 | def f19( @@ -274,6 +292,8 @@ PYI011.pyi:98:17: PYI011 [*] Only simple default values allowed for typed argume 101 100 | def f20( 102 101 | x: int = 5 + Run `ruff check --fix` to apply this fix. + PYI011.pyi:102:14: PYI011 [*] Only simple default values allowed for typed arguments | 100 | ) -> None: ... @@ -287,7 +307,7 @@ PYI011.pyi:102:14: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 99 99 | + 4, 100 100 | ) -> None: ... 101 101 | def f20( @@ -298,6 +318,8 @@ PYI011.pyi:102:14: PYI011 [*] Only simple default values allowed for typed argum 105 104 | def f21( 106 105 | x: complex = 3j + Run `ruff check --fix` to apply this fix. + PYI011.pyi:106:18: PYI011 [*] Only simple default values allowed for typed arguments | 104 | ) -> None: ... @@ -311,7 +333,7 @@ PYI011.pyi:106:18: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 103 103 | + 5, # Error PYI011 Only simple default values allowed for typed arguments 104 104 | ) -> None: ... 105 105 | def f21( @@ -322,6 +344,8 @@ PYI011.pyi:106:18: PYI011 [*] Only simple default values allowed for typed argum 109 108 | def f22( 110 109 | x: complex = -42.5j # Error PYI011 Only simple default values allowed for typed arguments + Run `ruff check --fix` to apply this fix. + PYI011.pyi:110:18: PYI011 [*] Only simple default values allowed for typed arguments | 108 | ) -> None: ... @@ -335,7 +359,7 @@ PYI011.pyi:110:18: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 107 107 | - 3j, # Error PYI011 Only simple default values allowed for typed arguments 108 108 | ) -> None: ... 109 109 | def f22( @@ -346,6 +370,8 @@ PYI011.pyi:110:18: PYI011 [*] Only simple default values allowed for typed argum 113 112 | def f23( 114 113 | x: bool = True, # OK + Run `ruff check --fix` to apply this fix. + PYI011.pyi:138:16: PYI011 [*] Only simple default values allowed for typed arguments | 136 | ) -> None: ... @@ -357,7 +383,7 @@ PYI011.pyi:138:16: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 135 135 | x: float = -math.inf, # OK 136 136 | ) -> None: ... 137 137 | def f31( @@ -367,6 +393,8 @@ PYI011.pyi:138:16: PYI011 [*] Only simple default values allowed for typed argum 140 140 | def f32( 141 141 | x: float = np.inf, # Error PYI011 Only simple default values allowed for typed arguments + Run `ruff check --fix` to apply this fix. + PYI011.pyi:141:16: PYI011 [*] Only simple default values allowed for typed arguments | 139 | ) -> None: ... @@ -378,7 +406,7 @@ PYI011.pyi:141:16: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 138 138 | x: float = inf, # Error PYI011 Only simple default values allowed for typed arguments 139 139 | ) -> None: ... 140 140 | def f32( @@ -388,6 +416,8 @@ PYI011.pyi:141:16: PYI011 [*] Only simple default values allowed for typed argum 143 143 | def f33( 144 144 | x: float = math.nan, # OK + Run `ruff check --fix` to apply this fix. + PYI011.pyi:147:16: PYI011 [*] Only simple default values allowed for typed arguments | 145 | ) -> None: ... @@ -399,7 +429,7 @@ PYI011.pyi:147:16: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 144 144 | x: float = math.nan, # OK 145 145 | ) -> None: ... 146 146 | def f34( @@ -409,6 +439,8 @@ PYI011.pyi:147:16: PYI011 [*] Only simple default values allowed for typed argum 149 149 | def f35( 150 150 | x: complex = math.inf # Error PYI011 Only simple default values allowed for typed arguments + Run `ruff check --fix` to apply this fix. + PYI011.pyi:150:18: PYI011 [*] Only simple default values allowed for typed arguments | 148 | ) -> None: ... @@ -422,7 +454,7 @@ PYI011.pyi:150:18: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 147 147 | x: float = -math.nan, # Error PYI011 Only simple default values allowed for typed arguments 148 148 | ) -> None: ... 149 149 | def f35( @@ -433,6 +465,8 @@ PYI011.pyi:150:18: PYI011 [*] Only simple default values allowed for typed argum 153 152 | def f36( 154 153 | *, + Run `ruff check --fix` to apply this fix. + PYI011.pyi:159:14: PYI011 [*] Only simple default values allowed for typed arguments | 157 | def f37( @@ -445,7 +479,7 @@ PYI011.pyi:159:14: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 156 156 | ) -> None: ... 157 157 | def f37( 158 158 | *, @@ -454,4 +488,4 @@ PYI011.pyi:159:14: PYI011 [*] Only simple default values allowed for typed argum 159 |+ x: str = ..., 161 160 | ) -> None: ... - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI012_PYI012.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI012_PYI012.pyi.snap index 9b67fe2854108..80a224c5d2bb2 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI012_PYI012.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI012_PYI012.pyi.snap @@ -12,7 +12,7 @@ PYI012.pyi:5:5: PYI012 [*] Class body must not contain `pass` | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | class OneAttributeClass: 4 4 | value: int @@ -21,6 +21,8 @@ PYI012.pyi:5:5: PYI012 [*] Class body must not contain `pass` 7 6 | class OneAttributeClassRev: 8 7 | pass # PYI012 Class body must not contain `pass` + Run `ruff check --fix` to apply this fix. + PYI012.pyi:8:5: PYI012 [*] Class body must not contain `pass` | 7 | class OneAttributeClassRev: @@ -30,7 +32,7 @@ PYI012.pyi:8:5: PYI012 [*] Class body must not contain `pass` | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 5 5 | pass # PYI012 Class body must not contain `pass` 6 6 | 7 7 | class OneAttributeClassRev: @@ -39,6 +41,8 @@ PYI012.pyi:8:5: PYI012 [*] Class body must not contain `pass` 10 9 | 11 10 | class DocstringClass: + Run `ruff check --fix` to apply this fix. + PYI012.pyi:16:5: PYI012 [*] Class body must not contain `pass` | 14 | """ @@ -50,7 +54,7 @@ PYI012.pyi:16:5: PYI012 [*] Class body must not contain `pass` | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 13 13 | My body only contains pass. 14 14 | """ 15 15 | @@ -59,6 +63,8 @@ PYI012.pyi:16:5: PYI012 [*] Class body must not contain `pass` 18 17 | class NonEmptyChild(Exception): 19 18 | value: int + Run `ruff check --fix` to apply this fix. + PYI012.pyi:20:5: PYI012 [*] Class body must not contain `pass` | 18 | class NonEmptyChild(Exception): @@ -70,7 +76,7 @@ PYI012.pyi:20:5: PYI012 [*] Class body must not contain `pass` | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 17 17 | 18 18 | class NonEmptyChild(Exception): 19 19 | value: int @@ -79,6 +85,8 @@ PYI012.pyi:20:5: PYI012 [*] Class body must not contain `pass` 22 21 | class NonEmptyChild2(Exception): 23 22 | pass # PYI012 Class body must not contain `pass` + Run `ruff check --fix` to apply this fix. + PYI012.pyi:23:5: PYI012 [*] Class body must not contain `pass` | 22 | class NonEmptyChild2(Exception): @@ -88,7 +96,7 @@ PYI012.pyi:23:5: PYI012 [*] Class body must not contain `pass` | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 20 20 | pass # PYI012 Class body must not contain `pass` 21 21 | 22 22 | class NonEmptyChild2(Exception): @@ -97,6 +105,8 @@ PYI012.pyi:23:5: PYI012 [*] Class body must not contain `pass` 25 24 | 26 25 | class NonEmptyWithInit: + Run `ruff check --fix` to apply this fix. + PYI012.pyi:28:5: PYI012 [*] Class body must not contain `pass` | 26 | class NonEmptyWithInit: @@ -108,7 +118,7 @@ PYI012.pyi:28:5: PYI012 [*] Class body must not contain `pass` | = help: Remove unnecessary `pass` -ℹ Safe fix +Suggested fix: 25 25 | 26 26 | class NonEmptyWithInit: 27 27 | value: int @@ -117,4 +127,4 @@ PYI012.pyi:28:5: PYI012 [*] Class body must not contain `pass` 30 29 | def __init__(): 31 30 | pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.py.snap index 5dfb8d8b4bdee..ecc76d9323ab9 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.py.snap @@ -10,7 +10,7 @@ PYI013.py:3:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 1 1 | class OneAttributeClass: 2 2 | value: int 3 |- ... @@ -18,6 +18,8 @@ PYI013.py:3:5: PYI013 [*] Non-empty class body must not contain `...` 5 4 | 6 5 | class OneAttributeClass2: + Run `ruff check --fix` to apply this fix. + PYI013.py:7:5: PYI013 [*] Non-empty class body must not contain `...` | 6 | class OneAttributeClass2: @@ -27,7 +29,7 @@ PYI013.py:7:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | 6 6 | class OneAttributeClass2: @@ -36,6 +38,8 @@ PYI013.py:7:5: PYI013 [*] Non-empty class body must not contain `...` 9 8 | 10 9 | + Run `ruff check --fix` to apply this fix. + PYI013.py:12:5: PYI013 [*] Non-empty class body must not contain `...` | 11 | class TwoEllipsesClass: @@ -45,7 +49,7 @@ PYI013.py:12:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | class TwoEllipsesClass: 12 12 | ... @@ -54,6 +58,8 @@ PYI013.py:12:5: PYI013 [*] Non-empty class body must not contain `...` 15 14 | 16 15 | class DocstringClass: + Run `ruff check --fix` to apply this fix. + PYI013.py:13:5: PYI013 [*] Non-empty class body must not contain `...` | 11 | class TwoEllipsesClass: @@ -63,7 +69,7 @@ PYI013.py:13:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | class TwoEllipsesClass: 12 12 | ... @@ -72,6 +78,8 @@ PYI013.py:13:5: PYI013 [*] Non-empty class body must not contain `...` 15 14 | 16 15 | class DocstringClass: + Run `ruff check --fix` to apply this fix. + PYI013.py:21:5: PYI013 [*] Non-empty class body must not contain `...` | 19 | """ @@ -81,7 +89,7 @@ PYI013.py:21:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 18 18 | My body only contains an ellipsis. 19 19 | """ 20 20 | @@ -90,6 +98,8 @@ PYI013.py:21:5: PYI013 [*] Non-empty class body must not contain `...` 23 22 | 24 23 | class NonEmptyChild(Exception): + Run `ruff check --fix` to apply this fix. + PYI013.py:26:5: PYI013 [*] Non-empty class body must not contain `...` | 24 | class NonEmptyChild(Exception): @@ -99,7 +109,7 @@ PYI013.py:26:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 23 23 | 24 24 | class NonEmptyChild(Exception): 25 25 | value: int @@ -108,6 +118,8 @@ PYI013.py:26:5: PYI013 [*] Non-empty class body must not contain `...` 28 27 | 29 28 | class NonEmptyChild2(Exception): + Run `ruff check --fix` to apply this fix. + PYI013.py:30:5: PYI013 [*] Non-empty class body must not contain `...` | 29 | class NonEmptyChild2(Exception): @@ -117,7 +129,7 @@ PYI013.py:30:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 27 27 | 28 28 | 29 29 | class NonEmptyChild2(Exception): @@ -126,6 +138,8 @@ PYI013.py:30:5: PYI013 [*] Non-empty class body must not contain `...` 32 31 | 33 32 | + Run `ruff check --fix` to apply this fix. + PYI013.py:36:5: PYI013 [*] Non-empty class body must not contain `...` | 34 | class NonEmptyWithInit: @@ -137,7 +151,7 @@ PYI013.py:36:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 33 33 | 34 34 | class NonEmptyWithInit: 35 35 | value: int @@ -146,4 +160,4 @@ PYI013.py:36:5: PYI013 [*] Non-empty class body must not contain `...` 38 37 | def __init__(): 39 38 | pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.pyi.snap index 83ac30ca4e468..3095b78fa8247 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.pyi.snap @@ -12,7 +12,7 @@ PYI013.pyi:5:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | class OneAttributeClass: 4 4 | value: int @@ -21,6 +21,8 @@ PYI013.pyi:5:5: PYI013 [*] Non-empty class body must not contain `...` 7 6 | class OneAttributeClass2: 8 7 | ... # Error + Run `ruff check --fix` to apply this fix. + PYI013.pyi:8:5: PYI013 [*] Non-empty class body must not contain `...` | 7 | class OneAttributeClass2: @@ -30,7 +32,7 @@ PYI013.pyi:8:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 5 5 | ... # Error 6 6 | 7 7 | class OneAttributeClass2: @@ -39,6 +41,8 @@ PYI013.pyi:8:5: PYI013 [*] Non-empty class body must not contain `...` 10 9 | 11 10 | class MyClass: + Run `ruff check --fix` to apply this fix. + PYI013.pyi:12:5: PYI013 [*] Non-empty class body must not contain `...` | 11 | class MyClass: @@ -48,7 +52,7 @@ PYI013.pyi:12:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 9 9 | value: int 10 10 | 11 11 | class MyClass: @@ -57,6 +61,8 @@ PYI013.pyi:12:5: PYI013 [*] Non-empty class body must not contain `...` 14 13 | 15 14 | class TwoEllipsesClass: + Run `ruff check --fix` to apply this fix. + PYI013.pyi:16:5: PYI013 [*] Non-empty class body must not contain `...` | 15 | class TwoEllipsesClass: @@ -66,7 +72,7 @@ PYI013.pyi:16:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 13 13 | value: int 14 14 | 15 15 | class TwoEllipsesClass: @@ -75,6 +81,8 @@ PYI013.pyi:16:5: PYI013 [*] Non-empty class body must not contain `...` 18 17 | 19 18 | class DocstringClass: + Run `ruff check --fix` to apply this fix. + PYI013.pyi:17:5: PYI013 [*] Non-empty class body must not contain `...` | 15 | class TwoEllipsesClass: @@ -86,7 +94,7 @@ PYI013.pyi:17:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 14 14 | 15 15 | class TwoEllipsesClass: 16 16 | ... @@ -95,6 +103,8 @@ PYI013.pyi:17:5: PYI013 [*] Non-empty class body must not contain `...` 19 18 | class DocstringClass: 20 19 | """ + Run `ruff check --fix` to apply this fix. + PYI013.pyi:24:5: PYI013 [*] Non-empty class body must not contain `...` | 22 | """ @@ -106,7 +116,7 @@ PYI013.pyi:24:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 21 21 | My body only contains an ellipsis. 22 22 | """ 23 23 | @@ -115,6 +125,8 @@ PYI013.pyi:24:5: PYI013 [*] Non-empty class body must not contain `...` 26 25 | class NonEmptyChild(Exception): 27 26 | value: int + Run `ruff check --fix` to apply this fix. + PYI013.pyi:28:5: PYI013 [*] Non-empty class body must not contain `...` | 26 | class NonEmptyChild(Exception): @@ -126,7 +138,7 @@ PYI013.pyi:28:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 25 25 | 26 26 | class NonEmptyChild(Exception): 27 27 | value: int @@ -135,6 +147,8 @@ PYI013.pyi:28:5: PYI013 [*] Non-empty class body must not contain `...` 30 29 | class NonEmptyChild2(Exception): 31 30 | ... # Error + Run `ruff check --fix` to apply this fix. + PYI013.pyi:31:5: PYI013 [*] Non-empty class body must not contain `...` | 30 | class NonEmptyChild2(Exception): @@ -144,7 +158,7 @@ PYI013.pyi:31:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 28 28 | ... # Error 29 29 | 30 30 | class NonEmptyChild2(Exception): @@ -153,6 +167,8 @@ PYI013.pyi:31:5: PYI013 [*] Non-empty class body must not contain `...` 33 32 | 34 33 | class NonEmptyWithInit: + Run `ruff check --fix` to apply this fix. + PYI013.pyi:36:5: PYI013 [*] Non-empty class body must not contain `...` | 34 | class NonEmptyWithInit: @@ -164,7 +180,7 @@ PYI013.pyi:36:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Safe fix +Suggested fix: 33 33 | 34 34 | class NonEmptyWithInit: 35 35 | value: int @@ -173,4 +189,4 @@ PYI013.pyi:36:5: PYI013 [*] Non-empty class body must not contain `...` 38 37 | def __init__(): 39 38 | pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap index cdad97490f8b9..92e435e87f488 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap @@ -12,7 +12,7 @@ PYI014.pyi:3:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 1 1 | def f12( 2 2 | x, 3 |- y=os.pathsep, # Error PYI014 @@ -21,6 +21,8 @@ PYI014.pyi:3:7: PYI014 [*] Only simple default values allowed for arguments 5 5 | def f11(*, x="x") -> None: ... # OK 6 6 | def f13( + Run `ruff check --fix` to apply this fix. + PYI014.pyi:29:7: PYI014 [*] Only simple default values allowed for arguments | 27 | def f151(x={1: 2}) -> None: ... @@ -36,7 +38,7 @@ PYI014.pyi:29:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 26 26 | ) -> None: ... 27 27 | def f151(x={1: 2}) -> None: ... 28 28 | def f152( @@ -49,6 +51,8 @@ PYI014.pyi:29:7: PYI014 [*] Only simple default values allowed for arguments 34 31 | def f153( 35 32 | x=[ # Error PYI014 + Run `ruff check --fix` to apply this fix. + PYI014.pyi:35:7: PYI014 [*] Only simple default values allowed for arguments | 33 | ) -> None: ... @@ -73,7 +77,7 @@ PYI014.pyi:35:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 32 32 | } 33 33 | ) -> None: ... 34 34 | def f153( @@ -95,6 +99,8 @@ PYI014.pyi:35:7: PYI014 [*] Only simple default values allowed for arguments 49 37 | def f154( 50 38 | x=( # Error PYI014 + Run `ruff check --fix` to apply this fix. + PYI014.pyi:50:7: PYI014 [*] Only simple default values allowed for arguments | 48 | ) -> None: ... @@ -110,7 +116,7 @@ PYI014.pyi:50:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 47 47 | ] 48 48 | ) -> None: ... 49 49 | def f154( @@ -123,6 +129,8 @@ PYI014.pyi:50:7: PYI014 [*] Only simple default values allowed for arguments 55 52 | def f141( 56 53 | x=[*range(10)], # Error PYI014 + Run `ruff check --fix` to apply this fix. + PYI014.pyi:56:7: PYI014 [*] Only simple default values allowed for arguments | 54 | ) -> None: ... @@ -134,7 +142,7 @@ PYI014.pyi:56:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 53 53 | ) 54 54 | ) -> None: ... 55 55 | def f141( @@ -144,6 +152,8 @@ PYI014.pyi:56:7: PYI014 [*] Only simple default values allowed for arguments 58 58 | def f142( 59 59 | x=list(range(10)), # Error PYI014 + Run `ruff check --fix` to apply this fix. + PYI014.pyi:59:7: PYI014 [*] Only simple default values allowed for arguments | 57 | ) -> None: ... @@ -155,7 +165,7 @@ PYI014.pyi:59:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 56 56 | x=[*range(10)], # Error PYI014 57 57 | ) -> None: ... 58 58 | def f142( @@ -165,6 +175,8 @@ PYI014.pyi:59:7: PYI014 [*] Only simple default values allowed for arguments 61 61 | def f16(x=frozenset({b"foo", b"bar", b"baz"})) -> None: ... # Error PYI014 62 62 | def f17( + Run `ruff check --fix` to apply this fix. + PYI014.pyi:61:11: PYI014 [*] Only simple default values allowed for arguments | 59 | x=list(range(10)), # Error PYI014 @@ -176,7 +188,7 @@ PYI014.pyi:61:11: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 58 58 | def f142( 59 59 | x=list(range(10)), # Error PYI014 60 60 | ) -> None: ... @@ -186,6 +198,8 @@ PYI014.pyi:61:11: PYI014 [*] Only simple default values allowed for arguments 63 63 | x="foo" + "bar", # Error PYI014 64 64 | ) -> None: ... + Run `ruff check --fix` to apply this fix. + PYI014.pyi:63:7: PYI014 [*] Only simple default values allowed for arguments | 61 | def f16(x=frozenset({b"foo", b"bar", b"baz"})) -> None: ... # Error PYI014 @@ -197,7 +211,7 @@ PYI014.pyi:63:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 60 60 | ) -> None: ... 61 61 | def f16(x=frozenset({b"foo", b"bar", b"baz"})) -> None: ... # Error PYI014 62 62 | def f17( @@ -207,6 +221,8 @@ PYI014.pyi:63:7: PYI014 [*] Only simple default values allowed for arguments 65 65 | def f18( 66 66 | x=b"foo" + b"bar", # Error PYI014 + Run `ruff check --fix` to apply this fix. + PYI014.pyi:66:7: PYI014 [*] Only simple default values allowed for arguments | 64 | ) -> None: ... @@ -218,7 +234,7 @@ PYI014.pyi:66:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 63 63 | x="foo" + "bar", # Error PYI014 64 64 | ) -> None: ... 65 65 | def f18( @@ -228,6 +244,8 @@ PYI014.pyi:66:7: PYI014 [*] Only simple default values allowed for arguments 68 68 | def f19( 69 69 | x="foo" + 4, # Error PYI014 + Run `ruff check --fix` to apply this fix. + PYI014.pyi:69:7: PYI014 [*] Only simple default values allowed for arguments | 67 | ) -> None: ... @@ -239,7 +257,7 @@ PYI014.pyi:69:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 66 66 | x=b"foo" + b"bar", # Error PYI014 67 67 | ) -> None: ... 68 68 | def f19( @@ -249,6 +267,8 @@ PYI014.pyi:69:7: PYI014 [*] Only simple default values allowed for arguments 71 71 | def f20( 72 72 | x=5 + 5, # Error PYI014 + Run `ruff check --fix` to apply this fix. + PYI014.pyi:72:7: PYI014 [*] Only simple default values allowed for arguments | 70 | ) -> None: ... @@ -260,7 +280,7 @@ PYI014.pyi:72:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 69 69 | x="foo" + 4, # Error PYI014 70 70 | ) -> None: ... 71 71 | def f20( @@ -270,6 +290,8 @@ PYI014.pyi:72:7: PYI014 [*] Only simple default values allowed for arguments 74 74 | def f21( 75 75 | x=3j - 3j, # Error PYI014 + Run `ruff check --fix` to apply this fix. + PYI014.pyi:75:7: PYI014 [*] Only simple default values allowed for arguments | 73 | ) -> None: ... @@ -281,7 +303,7 @@ PYI014.pyi:75:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 72 72 | x=5 + 5, # Error PYI014 73 73 | ) -> None: ... 74 74 | def f21( @@ -291,6 +313,8 @@ PYI014.pyi:75:7: PYI014 [*] Only simple default values allowed for arguments 77 77 | def f22( 78 78 | x=-42.5j + 4.3j, # Error PYI014 + Run `ruff check --fix` to apply this fix. + PYI014.pyi:78:7: PYI014 [*] Only simple default values allowed for arguments | 76 | ) -> None: ... @@ -302,7 +326,7 @@ PYI014.pyi:78:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 75 75 | x=3j - 3j, # Error PYI014 76 76 | ) -> None: ... 77 77 | def f22( @@ -312,4 +336,4 @@ PYI014.pyi:78:7: PYI014 [*] Only simple default values allowed for arguments 80 80 | def f23( 81 81 | x=True, # OK - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap index 95ae4adb58ee0..17264559e85c6 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap @@ -11,7 +11,7 @@ PYI015.pyi:44:23: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 41 41 | field22: Final = {"foo": 5} 42 42 | 43 43 | # We *should* emit Y015 for more complex default values @@ -21,6 +21,8 @@ PYI015.pyi:44:23: PYI015 [*] Only simple default values allowed for assignments 46 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments 47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments + Run `ruff check --fix` to apply this fix. + PYI015.pyi:45:23: PYI015 [*] Only simple default values allowed for assignments | 43 | # We *should* emit Y015 for more complex default values @@ -32,7 +34,7 @@ PYI015.pyi:45:23: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 42 42 | 43 43 | # We *should* emit Y015 for more complex default values 44 44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments @@ -42,6 +44,8 @@ PYI015.pyi:45:23: PYI015 [*] Only simple default values allowed for assignments 47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments 48 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments + Run `ruff check --fix` to apply this fix. + PYI015.pyi:46:23: PYI015 [*] Only simple default values allowed for assignments | 44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments @@ -53,7 +57,7 @@ PYI015.pyi:46:23: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 43 43 | # We *should* emit Y015 for more complex default values 44 44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments 45 45 | field223: list[int] = [*range(10)] # Y015 Only simple default values are allowed for assignments @@ -63,6 +67,8 @@ PYI015.pyi:46:23: PYI015 [*] Only simple default values allowed for assignments 48 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments 49 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments + Run `ruff check --fix` to apply this fix. + PYI015.pyi:47:26: PYI015 [*] Only simple default values allowed for assignments | 45 | field223: list[int] = [*range(10)] # Y015 Only simple default values are allowed for assignments @@ -74,7 +80,7 @@ PYI015.pyi:47:26: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 44 44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments 45 45 | field223: list[int] = [*range(10)] # Y015 Only simple default values are allowed for assignments 46 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments @@ -84,6 +90,8 @@ PYI015.pyi:47:26: PYI015 [*] Only simple default values allowed for assignments 49 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments 50 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments + Run `ruff check --fix` to apply this fix. + PYI015.pyi:48:47: PYI015 [*] Only simple default values allowed for assignments | 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments @@ -95,7 +103,7 @@ PYI015.pyi:48:47: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 45 45 | field223: list[int] = [*range(10)] # Y015 Only simple default values are allowed for assignments 46 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments 47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments @@ -105,6 +113,8 @@ PYI015.pyi:48:47: PYI015 [*] Only simple default values allowed for assignments 50 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments 51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node + Run `ruff check --fix` to apply this fix. + PYI015.pyi:49:31: PYI015 [*] Only simple default values allowed for assignments | 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments @@ -116,7 +126,7 @@ PYI015.pyi:49:31: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 46 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments 47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments 48 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments @@ -126,6 +136,8 @@ PYI015.pyi:49:31: PYI015 [*] Only simple default values allowed for assignments 51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node 52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments + Run `ruff check --fix` to apply this fix. + PYI015.pyi:50:37: PYI015 [*] Only simple default values allowed for assignments | 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments @@ -137,7 +149,7 @@ PYI015.pyi:50:37: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments 48 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments 49 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments @@ -147,6 +159,8 @@ PYI015.pyi:50:37: PYI015 [*] Only simple default values allowed for assignments 52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments 53 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments + Run `ruff check --fix` to apply this fix. + PYI015.pyi:52:28: PYI015 [*] Only simple default values allowed for assignments | 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments @@ -158,7 +172,7 @@ PYI015.pyi:52:28: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 49 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments 50 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments 51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node @@ -168,6 +182,8 @@ PYI015.pyi:52:28: PYI015 [*] Only simple default values allowed for assignments 54 54 | field24 = b"foo" + b"bar" # Y015 Only simple default values are allowed for assignments 55 55 | field25 = 5 * 5 # Y015 Only simple default values are allowed for assignments + Run `ruff check --fix` to apply this fix. + PYI015.pyi:53:11: PYI015 [*] Only simple default values allowed for assignments | 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node @@ -179,7 +195,7 @@ PYI015.pyi:53:11: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 50 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments 51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node 52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments @@ -189,6 +205,8 @@ PYI015.pyi:53:11: PYI015 [*] Only simple default values allowed for assignments 55 55 | field25 = 5 * 5 # Y015 Only simple default values are allowed for assignments 56 56 | + Run `ruff check --fix` to apply this fix. + PYI015.pyi:54:11: PYI015 [*] Only simple default values allowed for assignments | 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments @@ -199,7 +217,7 @@ PYI015.pyi:54:11: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node 52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments 53 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments @@ -209,6 +227,8 @@ PYI015.pyi:54:11: PYI015 [*] Only simple default values allowed for assignments 56 56 | 57 57 | # We shouldn't emit Y015 within functions + Run `ruff check --fix` to apply this fix. + PYI015.pyi:55:11: PYI015 [*] Only simple default values allowed for assignments | 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments @@ -220,7 +240,7 @@ PYI015.pyi:55:11: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Safe fix +Suggested fix: 52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments 53 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments 54 54 | field24 = b"foo" + b"bar" # Y015 Only simple default values are allowed for assignments @@ -230,4 +250,4 @@ PYI015.pyi:55:11: PYI015 [*] Only simple default values allowed for assignments 57 57 | # We shouldn't emit Y015 within functions 58 58 | def f(): - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.py.snap index d3ba1b4f1334b..a89481febbf09 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.py.snap @@ -11,7 +11,7 @@ PYI016.py:7:15: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Safe fix +Suggested fix: 4 4 | field1: str 5 5 | 6 6 | # Should emit for duplicate field types. @@ -21,6 +21,8 @@ PYI016.py:7:15: PYI016 [*] Duplicate union member `str` 9 9 | # Should emit for union types in arguments. 10 10 | def func1(arg1: int | int): # PYI016: Duplicate union member `int` + Run `ruff check --fix` to apply this fix. + PYI016.py:10:23: PYI016 [*] Duplicate union member `int` | 9 | # Should emit for union types in arguments. @@ -30,7 +32,7 @@ PYI016.py:10:23: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 7 7 | field2: str | str # PYI016: Duplicate union member `str` 8 8 | 9 9 | # Should emit for union types in arguments. @@ -40,6 +42,8 @@ PYI016.py:10:23: PYI016 [*] Duplicate union member `int` 12 12 | 13 13 | # Should emit for unions in return types. + Run `ruff check --fix` to apply this fix. + PYI016.py:14:22: PYI016 [*] Duplicate union member `str` | 13 | # Should emit for unions in return types. @@ -49,7 +53,7 @@ PYI016.py:14:22: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Safe fix +Suggested fix: 11 11 | print(arg1) 12 12 | 13 13 | # Should emit for unions in return types. @@ -59,6 +63,8 @@ PYI016.py:14:22: PYI016 [*] Duplicate union member `str` 16 16 | 17 17 | # Should emit in longer unions, even if not directly adjacent. + Run `ruff check --fix` to apply this fix. + PYI016.py:18:15: PYI016 [*] Duplicate union member `str` | 17 | # Should emit in longer unions, even if not directly adjacent. @@ -69,7 +75,7 @@ PYI016.py:18:15: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Safe fix +Suggested fix: 15 15 | return "my string" 16 16 | 17 17 | # Should emit in longer unions, even if not directly adjacent. @@ -79,6 +85,8 @@ PYI016.py:18:15: PYI016 [*] Duplicate union member `str` 20 20 | field5: str | int | str # PYI016: Duplicate union member `str` 21 21 | field6: int | bool | str | int # PYI016: Duplicate union member `int` + Run `ruff check --fix` to apply this fix. + PYI016.py:19:15: PYI016 [*] Duplicate union member `int` | 17 | # Should emit in longer unions, even if not directly adjacent. @@ -90,7 +98,7 @@ PYI016.py:19:15: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 16 16 | 17 17 | # Should emit in longer unions, even if not directly adjacent. 18 18 | field3: str | str | int # PYI016: Duplicate union member `str` @@ -100,6 +108,8 @@ PYI016.py:19:15: PYI016 [*] Duplicate union member `int` 21 21 | field6: int | bool | str | int # PYI016: Duplicate union member `int` 22 22 | + Run `ruff check --fix` to apply this fix. + PYI016.py:20:21: PYI016 [*] Duplicate union member `str` | 18 | field3: str | str | int # PYI016: Duplicate union member `str` @@ -110,7 +120,7 @@ PYI016.py:20:21: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Safe fix +Suggested fix: 17 17 | # Should emit in longer unions, even if not directly adjacent. 18 18 | field3: str | str | int # PYI016: Duplicate union member `str` 19 19 | field4: int | int | str # PYI016: Duplicate union member `int` @@ -120,6 +130,8 @@ PYI016.py:20:21: PYI016 [*] Duplicate union member `str` 22 22 | 23 23 | # Shouldn't emit for non-type unions. + Run `ruff check --fix` to apply this fix. + PYI016.py:21:28: PYI016 [*] Duplicate union member `int` | 19 | field4: int | int | str # PYI016: Duplicate union member `int` @@ -131,7 +143,7 @@ PYI016.py:21:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 18 18 | field3: str | str | int # PYI016: Duplicate union member `str` 19 19 | field4: int | int | str # PYI016: Duplicate union member `int` 20 20 | field5: str | int | str # PYI016: Duplicate union member `str` @@ -141,6 +153,8 @@ PYI016.py:21:28: PYI016 [*] Duplicate union member `int` 23 23 | # Shouldn't emit for non-type unions. 24 24 | field7 = str | str + Run `ruff check --fix` to apply this fix. + PYI016.py:27:22: PYI016 [*] Duplicate union member `int` | 26 | # Should emit for strangely-bracketed unions. @@ -151,7 +165,7 @@ PYI016.py:27:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 24 24 | field7 = str | str 25 25 | 26 26 | # Should emit for strangely-bracketed unions. @@ -161,6 +175,8 @@ PYI016.py:27:22: PYI016 [*] Duplicate union member `int` 29 29 | # Should handle user brackets when fixing. 30 30 | field9: int | (int | str) # PYI016: Duplicate union member `int` + Run `ruff check --fix` to apply this fix. + PYI016.py:30:16: PYI016 [*] Duplicate union member `int` | 29 | # Should handle user brackets when fixing. @@ -170,7 +186,7 @@ PYI016.py:30:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 27 27 | field8: int | (str | int) # PYI016: Duplicate union member `int` 28 28 | 29 29 | # Should handle user brackets when fixing. @@ -180,6 +196,8 @@ PYI016.py:30:16: PYI016 [*] Duplicate union member `int` 32 32 | 33 33 | # Should emit for nested unions. + Run `ruff check --fix` to apply this fix. + PYI016.py:31:24: PYI016 [*] Duplicate union member `str` | 29 | # Should handle user brackets when fixing. @@ -191,7 +209,7 @@ PYI016.py:31:24: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Safe fix +Suggested fix: 28 28 | 29 29 | # Should handle user brackets when fixing. 30 30 | field9: int | (int | str) # PYI016: Duplicate union member `int` @@ -201,6 +219,8 @@ PYI016.py:31:24: PYI016 [*] Duplicate union member `str` 33 33 | # Should emit for nested unions. 34 34 | field11: dict[int | int, str] + Run `ruff check --fix` to apply this fix. + PYI016.py:34:21: PYI016 [*] Duplicate union member `int` | 33 | # Should emit for nested unions. @@ -211,7 +231,7 @@ PYI016.py:34:21: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 31 31 | field10: (str | int) | str # PYI016: Duplicate union member `str` 32 32 | 33 33 | # Should emit for nested unions. @@ -221,6 +241,8 @@ PYI016.py:34:21: PYI016 [*] Duplicate union member `int` 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error + Run `ruff check --fix` to apply this fix. + PYI016.py:37:16: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -230,7 +252,7 @@ PYI016.py:37:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 34 34 | field11: dict[int | int, str] 35 35 | 36 36 | # Should emit for unions with more than two cases @@ -240,6 +262,8 @@ PYI016.py:37:16: PYI016 [*] Duplicate union member `int` 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent + Run `ruff check --fix` to apply this fix. + PYI016.py:37:22: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -249,7 +273,7 @@ PYI016.py:37:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 34 34 | field11: dict[int | int, str] 35 35 | 36 36 | # Should emit for unions with more than two cases @@ -259,6 +283,8 @@ PYI016.py:37:22: PYI016 [*] Duplicate union member `int` 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent + Run `ruff check --fix` to apply this fix. + PYI016.py:38:16: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -270,7 +296,7 @@ PYI016.py:38:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -280,6 +306,8 @@ PYI016.py:38:16: PYI016 [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error + Run `ruff check --fix` to apply this fix. + PYI016.py:38:22: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -291,7 +319,7 @@ PYI016.py:38:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -301,6 +329,8 @@ PYI016.py:38:22: PYI016 [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error + Run `ruff check --fix` to apply this fix. + PYI016.py:38:28: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -312,7 +342,7 @@ PYI016.py:38:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -322,6 +352,8 @@ PYI016.py:38:28: PYI016 [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error + Run `ruff check --fix` to apply this fix. + PYI016.py:41:16: PYI016 [*] Duplicate union member `int` | 40 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -332,7 +364,7 @@ PYI016.py:41:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 38 38 | field13: int | int | int | int # Error 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -342,6 +374,8 @@ PYI016.py:41:16: PYI016 [*] Duplicate union member `int` 43 43 | # Should emit for duplicate literal types; also covered by PYI030 44 44 | field15: typing.Literal[1] | typing.Literal[1] # Error + Run `ruff check --fix` to apply this fix. + PYI016.py:41:28: PYI016 [*] Duplicate union member `int` | 40 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -352,7 +386,7 @@ PYI016.py:41:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 38 38 | field13: int | int | int | int # Error 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -362,6 +396,8 @@ PYI016.py:41:28: PYI016 [*] Duplicate union member `int` 43 43 | # Should emit for duplicate literal types; also covered by PYI030 44 44 | field15: typing.Literal[1] | typing.Literal[1] # Error + Run `ruff check --fix` to apply this fix. + PYI016.py:44:30: PYI016 [*] Duplicate union member `typing.Literal[1]` | 43 | # Should emit for duplicate literal types; also covered by PYI030 @@ -372,7 +408,7 @@ PYI016.py:44:30: PYI016 [*] Duplicate union member `typing.Literal[1]` | = help: Remove duplicate union member `typing.Literal[1]` -ℹ Safe fix +Suggested fix: 41 41 | field14: int | int | str | int # Error 42 42 | 43 43 | # Should emit for duplicate literal types; also covered by PYI030 @@ -382,6 +418,8 @@ PYI016.py:44:30: PYI016 [*] Duplicate union member `typing.Literal[1]` 46 46 | # Shouldn't emit if in new parent type 47 47 | field16: int | dict[int, str] # OK + Run `ruff check --fix` to apply this fix. + PYI016.py:57:5: PYI016 Duplicate union member `set[int]` | 55 | int # foo @@ -425,7 +463,7 @@ PYI016.py:69:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 66 66 | field20: typing.Union[int, typing.Union[int, str]] # Error 67 67 | 68 68 | # Should emit in cases with mixed `typing.Union` and `|` @@ -435,6 +473,8 @@ PYI016.py:69:28: PYI016 [*] Duplicate union member `int` 71 71 | # Should emit only once in cases with multiple nested `typing.Union` 72 72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error + Run `ruff check --fix` to apply this fix. + PYI016.py:72:41: PYI016 Duplicate union member `int` | 71 | # Should emit only once in cases with multiple nested `typing.Union` @@ -476,7 +516,7 @@ PYI016.py:76:12: PYI016 [*] Duplicate union member `set[int]` | = help: Remove duplicate union member `set[int]` -ℹ Safe fix +Suggested fix: 73 73 | 74 74 | # Should emit in cases with newlines 75 75 | field23: set[ # foo @@ -486,6 +526,8 @@ PYI016.py:76:12: PYI016 [*] Duplicate union member `set[int]` 78 78 | # Should emit twice (once for each `int` in the nested union, both of which are 79 79 | # duplicates of the outer `int`), but not three times (which would indicate that + Run `ruff check --fix` to apply this fix. + PYI016.py:81:41: PYI016 Duplicate union member `int` | 79 | # duplicates of the outer `int`), but not three times (which would indicate that @@ -517,13 +559,15 @@ PYI016.py:86:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 83 83 | # Should emit twice (once for each `int` in the nested union, both of which are 84 84 | # duplicates of the outer `int`), but not three times (which would indicate that 85 85 | # we incorrectly re-checked the nested union). 86 |-field25: typing.Union[int, int | int] # PYI016: Duplicate union member `int` 86 |+field25: typing.Union[int, int] # PYI016: Duplicate union member `int` + Run `ruff check --fix` to apply this fix. + PYI016.py:86:34: PYI016 [*] Duplicate union member `int` | 84 | # duplicates of the outer `int`), but not three times (which would indicate that @@ -533,11 +577,11 @@ PYI016.py:86:34: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 83 83 | # Should emit twice (once for each `int` in the nested union, both of which are 84 84 | # duplicates of the outer `int`), but not three times (which would indicate that 85 85 | # we incorrectly re-checked the nested union). 86 |-field25: typing.Union[int, int | int] # PYI016: Duplicate union member `int` 86 |+field25: typing.Union[int, int] # PYI016: Duplicate union member `int` - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.pyi.snap index 647791e92b21e..09593badd6d66 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.pyi.snap @@ -11,7 +11,7 @@ PYI016.pyi:7:15: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Safe fix +Suggested fix: 4 4 | field1: str 5 5 | 6 6 | # Should emit for duplicate field types. @@ -21,6 +21,8 @@ PYI016.pyi:7:15: PYI016 [*] Duplicate union member `str` 9 9 | # Should emit for union types in arguments. 10 10 | def func1(arg1: int | int): # PYI016: Duplicate union member `int` + Run `ruff check --fix` to apply this fix. + PYI016.pyi:10:23: PYI016 [*] Duplicate union member `int` | 9 | # Should emit for union types in arguments. @@ -30,7 +32,7 @@ PYI016.pyi:10:23: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 7 7 | field2: str | str # PYI016: Duplicate union member `str` 8 8 | 9 9 | # Should emit for union types in arguments. @@ -40,6 +42,8 @@ PYI016.pyi:10:23: PYI016 [*] Duplicate union member `int` 12 12 | 13 13 | # Should emit for unions in return types. + Run `ruff check --fix` to apply this fix. + PYI016.pyi:14:22: PYI016 [*] Duplicate union member `str` | 13 | # Should emit for unions in return types. @@ -49,7 +53,7 @@ PYI016.pyi:14:22: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Safe fix +Suggested fix: 11 11 | print(arg1) 12 12 | 13 13 | # Should emit for unions in return types. @@ -59,6 +63,8 @@ PYI016.pyi:14:22: PYI016 [*] Duplicate union member `str` 16 16 | 17 17 | # Should emit in longer unions, even if not directly adjacent. + Run `ruff check --fix` to apply this fix. + PYI016.pyi:18:15: PYI016 [*] Duplicate union member `str` | 17 | # Should emit in longer unions, even if not directly adjacent. @@ -69,7 +75,7 @@ PYI016.pyi:18:15: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Safe fix +Suggested fix: 15 15 | return "my string" 16 16 | 17 17 | # Should emit in longer unions, even if not directly adjacent. @@ -79,6 +85,8 @@ PYI016.pyi:18:15: PYI016 [*] Duplicate union member `str` 20 20 | field5: str | int | str # PYI016: Duplicate union member `str` 21 21 | field6: int | bool | str | int # PYI016: Duplicate union member `int` + Run `ruff check --fix` to apply this fix. + PYI016.pyi:19:15: PYI016 [*] Duplicate union member `int` | 17 | # Should emit in longer unions, even if not directly adjacent. @@ -90,7 +98,7 @@ PYI016.pyi:19:15: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 16 16 | 17 17 | # Should emit in longer unions, even if not directly adjacent. 18 18 | field3: str | str | int # PYI016: Duplicate union member `str` @@ -100,6 +108,8 @@ PYI016.pyi:19:15: PYI016 [*] Duplicate union member `int` 21 21 | field6: int | bool | str | int # PYI016: Duplicate union member `int` 22 22 | + Run `ruff check --fix` to apply this fix. + PYI016.pyi:20:21: PYI016 [*] Duplicate union member `str` | 18 | field3: str | str | int # PYI016: Duplicate union member `str` @@ -110,7 +120,7 @@ PYI016.pyi:20:21: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Safe fix +Suggested fix: 17 17 | # Should emit in longer unions, even if not directly adjacent. 18 18 | field3: str | str | int # PYI016: Duplicate union member `str` 19 19 | field4: int | int | str # PYI016: Duplicate union member `int` @@ -120,6 +130,8 @@ PYI016.pyi:20:21: PYI016 [*] Duplicate union member `str` 22 22 | 23 23 | # Shouldn't emit for non-type unions. + Run `ruff check --fix` to apply this fix. + PYI016.pyi:21:28: PYI016 [*] Duplicate union member `int` | 19 | field4: int | int | str # PYI016: Duplicate union member `int` @@ -131,7 +143,7 @@ PYI016.pyi:21:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 18 18 | field3: str | str | int # PYI016: Duplicate union member `str` 19 19 | field4: int | int | str # PYI016: Duplicate union member `int` 20 20 | field5: str | int | str # PYI016: Duplicate union member `str` @@ -141,6 +153,8 @@ PYI016.pyi:21:28: PYI016 [*] Duplicate union member `int` 23 23 | # Shouldn't emit for non-type unions. 24 24 | field7 = str | str + Run `ruff check --fix` to apply this fix. + PYI016.pyi:27:22: PYI016 [*] Duplicate union member `int` | 26 | # Should emit for strangely-bracketed unions. @@ -151,7 +165,7 @@ PYI016.pyi:27:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 24 24 | field7 = str | str 25 25 | 26 26 | # Should emit for strangely-bracketed unions. @@ -161,6 +175,8 @@ PYI016.pyi:27:22: PYI016 [*] Duplicate union member `int` 29 29 | # Should handle user brackets when fixing. 30 30 | field9: int | (int | str) # PYI016: Duplicate union member `int` + Run `ruff check --fix` to apply this fix. + PYI016.pyi:30:16: PYI016 [*] Duplicate union member `int` | 29 | # Should handle user brackets when fixing. @@ -170,7 +186,7 @@ PYI016.pyi:30:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 27 27 | field8: int | (str | int) # PYI016: Duplicate union member `int` 28 28 | 29 29 | # Should handle user brackets when fixing. @@ -180,6 +196,8 @@ PYI016.pyi:30:16: PYI016 [*] Duplicate union member `int` 32 32 | 33 33 | # Should emit for nested unions. + Run `ruff check --fix` to apply this fix. + PYI016.pyi:31:24: PYI016 [*] Duplicate union member `str` | 29 | # Should handle user brackets when fixing. @@ -191,7 +209,7 @@ PYI016.pyi:31:24: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Safe fix +Suggested fix: 28 28 | 29 29 | # Should handle user brackets when fixing. 30 30 | field9: int | (int | str) # PYI016: Duplicate union member `int` @@ -201,6 +219,8 @@ PYI016.pyi:31:24: PYI016 [*] Duplicate union member `str` 33 33 | # Should emit for nested unions. 34 34 | field11: dict[int | int, str] + Run `ruff check --fix` to apply this fix. + PYI016.pyi:34:21: PYI016 [*] Duplicate union member `int` | 33 | # Should emit for nested unions. @@ -211,7 +231,7 @@ PYI016.pyi:34:21: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 31 31 | field10: (str | int) | str # PYI016: Duplicate union member `str` 32 32 | 33 33 | # Should emit for nested unions. @@ -221,6 +241,8 @@ PYI016.pyi:34:21: PYI016 [*] Duplicate union member `int` 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error + Run `ruff check --fix` to apply this fix. + PYI016.pyi:37:16: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -230,7 +252,7 @@ PYI016.pyi:37:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 34 34 | field11: dict[int | int, str] 35 35 | 36 36 | # Should emit for unions with more than two cases @@ -240,6 +262,8 @@ PYI016.pyi:37:16: PYI016 [*] Duplicate union member `int` 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent + Run `ruff check --fix` to apply this fix. + PYI016.pyi:37:22: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -249,7 +273,7 @@ PYI016.pyi:37:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 34 34 | field11: dict[int | int, str] 35 35 | 36 36 | # Should emit for unions with more than two cases @@ -259,6 +283,8 @@ PYI016.pyi:37:22: PYI016 [*] Duplicate union member `int` 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent + Run `ruff check --fix` to apply this fix. + PYI016.pyi:38:16: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -270,7 +296,7 @@ PYI016.pyi:38:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -280,6 +306,8 @@ PYI016.pyi:38:16: PYI016 [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error + Run `ruff check --fix` to apply this fix. + PYI016.pyi:38:22: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -291,7 +319,7 @@ PYI016.pyi:38:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -301,6 +329,8 @@ PYI016.pyi:38:22: PYI016 [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error + Run `ruff check --fix` to apply this fix. + PYI016.pyi:38:28: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -312,7 +342,7 @@ PYI016.pyi:38:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -322,6 +352,8 @@ PYI016.pyi:38:28: PYI016 [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error + Run `ruff check --fix` to apply this fix. + PYI016.pyi:41:16: PYI016 [*] Duplicate union member `int` | 40 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -332,7 +364,7 @@ PYI016.pyi:41:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 38 38 | field13: int | int | int | int # Error 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -342,6 +374,8 @@ PYI016.pyi:41:16: PYI016 [*] Duplicate union member `int` 43 43 | # Should emit for duplicate literal types; also covered by PYI030 44 44 | field15: typing.Literal[1] | typing.Literal[1] # Error + Run `ruff check --fix` to apply this fix. + PYI016.pyi:41:28: PYI016 [*] Duplicate union member `int` | 40 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -352,7 +386,7 @@ PYI016.pyi:41:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 38 38 | field13: int | int | int | int # Error 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -362,6 +396,8 @@ PYI016.pyi:41:28: PYI016 [*] Duplicate union member `int` 43 43 | # Should emit for duplicate literal types; also covered by PYI030 44 44 | field15: typing.Literal[1] | typing.Literal[1] # Error + Run `ruff check --fix` to apply this fix. + PYI016.pyi:44:30: PYI016 [*] Duplicate union member `typing.Literal[1]` | 43 | # Should emit for duplicate literal types; also covered by PYI030 @@ -372,7 +408,7 @@ PYI016.pyi:44:30: PYI016 [*] Duplicate union member `typing.Literal[1]` | = help: Remove duplicate union member `typing.Literal[1]` -ℹ Safe fix +Suggested fix: 41 41 | field14: int | int | str | int # Error 42 42 | 43 43 | # Should emit for duplicate literal types; also covered by PYI030 @@ -382,6 +418,8 @@ PYI016.pyi:44:30: PYI016 [*] Duplicate union member `typing.Literal[1]` 46 46 | # Shouldn't emit if in new parent type 47 47 | field16: int | dict[int, str] # OK + Run `ruff check --fix` to apply this fix. + PYI016.pyi:57:5: PYI016 Duplicate union member `set[int]` | 55 | int # foo @@ -425,7 +463,7 @@ PYI016.pyi:69:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 66 66 | field20: typing.Union[int, typing.Union[int, str]] # Error 67 67 | 68 68 | # Should emit in cases with mixed `typing.Union` and `|` @@ -435,6 +473,8 @@ PYI016.pyi:69:28: PYI016 [*] Duplicate union member `int` 71 71 | # Should emit only once in cases with multiple nested `typing.Union` 72 72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error + Run `ruff check --fix` to apply this fix. + PYI016.pyi:72:41: PYI016 Duplicate union member `int` | 71 | # Should emit only once in cases with multiple nested `typing.Union` @@ -476,7 +516,7 @@ PYI016.pyi:76:12: PYI016 [*] Duplicate union member `set[int]` | = help: Remove duplicate union member `set[int]` -ℹ Safe fix +Suggested fix: 73 73 | 74 74 | # Should emit in cases with newlines 75 75 | field23: set[ # foo @@ -486,6 +526,8 @@ PYI016.pyi:76:12: PYI016 [*] Duplicate union member `set[int]` 78 78 | # Should emit twice (once for each `int` in the nested union, both of which are 79 79 | # duplicates of the outer `int`), but not three times (which would indicate that + Run `ruff check --fix` to apply this fix. + PYI016.pyi:81:41: PYI016 Duplicate union member `int` | 79 | # duplicates of the outer `int`), but not three times (which would indicate that @@ -517,13 +559,15 @@ PYI016.pyi:86:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 83 83 | # Should emit twice (once for each `int` in the nested union, both of which are 84 84 | # duplicates of the outer `int`), but not three times (which would indicate that 85 85 | # we incorrectly re-checked the nested union). 86 |-field25: typing.Union[int, int | int] # PYI016: Duplicate union member `int` 86 |+field25: typing.Union[int, int] # PYI016: Duplicate union member `int` + Run `ruff check --fix` to apply this fix. + PYI016.pyi:86:34: PYI016 [*] Duplicate union member `int` | 84 | # duplicates of the outer `int`), but not three times (which would indicate that @@ -533,11 +577,11 @@ PYI016.pyi:86:34: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Safe fix +Suggested fix: 83 83 | # Should emit twice (once for each `int` in the nested union, both of which are 84 84 | # duplicates of the outer `int`), but not three times (which would indicate that 85 85 | # we incorrectly re-checked the nested union). 86 |-field25: typing.Union[int, int | int] # PYI016: Duplicate union member `int` 86 |+field25: typing.Union[int, int] # PYI016: Duplicate union member `int` - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI020_PYI020.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI020_PYI020.pyi.snap index f10bbc7b832d8..974c368b75b61 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI020_PYI020.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI020_PYI020.pyi.snap @@ -12,7 +12,7 @@ PYI020.pyi:7:10: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | import typing_extensions 6 6 | @@ -22,6 +22,8 @@ PYI020.pyi:7:10: PYI020 [*] Quoted annotations should not be included in stubs 9 9 | _T = TypeVar("_T", bound="int") # Y020 Quoted annotations should never be used in stubs 10 10 | + Run `ruff check --fix` to apply this fix. + PYI020.pyi:8:15: PYI020 [*] Quoted annotations should not be included in stubs | 7 | def f(x: "int"): ... # Y020 Quoted annotations should never be used in stubs @@ -31,7 +33,7 @@ PYI020.pyi:8:15: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -ℹ Safe fix +Suggested fix: 5 5 | import typing_extensions 6 6 | 7 7 | def f(x: "int"): ... # Y020 Quoted annotations should never be used in stubs @@ -41,6 +43,8 @@ PYI020.pyi:8:15: PYI020 [*] Quoted annotations should not be included in stubs 10 10 | 11 11 | def h(w: Literal["a", "b"], x: typing.Literal["c"], y: typing_extensions.Literal["d"], z: _T) -> _T: ... + Run `ruff check --fix` to apply this fix. + PYI020.pyi:9:26: PYI020 [*] Quoted annotations should not be included in stubs | 7 | def f(x: "int"): ... # Y020 Quoted annotations should never be used in stubs @@ -52,7 +56,7 @@ PYI020.pyi:9:26: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -ℹ Safe fix +Suggested fix: 6 6 | 7 7 | def f(x: "int"): ... # Y020 Quoted annotations should never be used in stubs 8 8 | def g(x: list["int"]): ... # Y020 Quoted annotations should never be used in stubs @@ -62,6 +66,8 @@ PYI020.pyi:9:26: PYI020 [*] Quoted annotations should not be included in stubs 11 11 | def h(w: Literal["a", "b"], x: typing.Literal["c"], y: typing_extensions.Literal["d"], z: _T) -> _T: ... 12 12 | + Run `ruff check --fix` to apply this fix. + PYI020.pyi:13:12: PYI020 [*] Quoted annotations should not be included in stubs | 11 | def h(w: Literal["a", "b"], x: typing.Literal["c"], y: typing_extensions.Literal["d"], z: _T) -> _T: ... @@ -72,7 +78,7 @@ PYI020.pyi:13:12: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | def h(w: Literal["a", "b"], x: typing.Literal["c"], y: typing_extensions.Literal["d"], z: _T) -> _T: ... 12 12 | @@ -82,6 +88,8 @@ PYI020.pyi:13:12: PYI020 [*] Quoted annotations should not be included in stubs 15 15 | 16 16 | class Child(list["int"]): # Y020 Quoted annotations should never be used in stubs + Run `ruff check --fix` to apply this fix. + PYI020.pyi:14:25: PYI020 [*] Quoted annotations should not be included in stubs | 13 | def j() -> "int": ... # Y020 Quoted annotations should never be used in stubs @@ -92,7 +100,7 @@ PYI020.pyi:14:25: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -ℹ Safe fix +Suggested fix: 11 11 | def h(w: Literal["a", "b"], x: typing.Literal["c"], y: typing_extensions.Literal["d"], z: _T) -> _T: ... 12 12 | 13 13 | def j() -> "int": ... # Y020 Quoted annotations should never be used in stubs @@ -102,6 +110,8 @@ PYI020.pyi:14:25: PYI020 [*] Quoted annotations should not be included in stubs 16 16 | class Child(list["int"]): # Y020 Quoted annotations should never be used in stubs 17 17 | """Documented and guaranteed useful.""" # Y021 Docstrings should not be included in stubs + Run `ruff check --fix` to apply this fix. + PYI020.pyi:16:18: PYI020 [*] Quoted annotations should not be included in stubs | 14 | Alias: TypeAlias = list["int"] # Y020 Quoted annotations should never be used in stubs @@ -112,7 +122,7 @@ PYI020.pyi:16:18: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -ℹ Safe fix +Suggested fix: 13 13 | def j() -> "int": ... # Y020 Quoted annotations should never be used in stubs 14 14 | Alias: TypeAlias = list["int"] # Y020 Quoted annotations should never be used in stubs 15 15 | @@ -122,6 +132,8 @@ PYI020.pyi:16:18: PYI020 [*] Quoted annotations should not be included in stubs 18 18 | 19 19 | if sys.platform == "linux": + Run `ruff check --fix` to apply this fix. + PYI020.pyi:20:8: PYI020 [*] Quoted annotations should not be included in stubs | 19 | if sys.platform == "linux": @@ -132,7 +144,7 @@ PYI020.pyi:20:8: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -ℹ Safe fix +Suggested fix: 17 17 | """Documented and guaranteed useful.""" # Y021 Docstrings should not be included in stubs 18 18 | 19 19 | if sys.platform == "linux": @@ -142,6 +154,8 @@ PYI020.pyi:20:8: PYI020 [*] Quoted annotations should not be included in stubs 22 22 | f: "str" # Y020 Quoted annotations should never be used in stubs 23 23 | else: + Run `ruff check --fix` to apply this fix. + PYI020.pyi:22:8: PYI020 [*] Quoted annotations should not be included in stubs | 20 | f: "int" # Y020 Quoted annotations should never be used in stubs @@ -153,7 +167,7 @@ PYI020.pyi:22:8: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -ℹ Safe fix +Suggested fix: 19 19 | if sys.platform == "linux": 20 20 | f: "int" # Y020 Quoted annotations should never be used in stubs 21 21 | elif sys.platform == "win32": @@ -163,6 +177,8 @@ PYI020.pyi:22:8: PYI020 [*] Quoted annotations should not be included in stubs 24 24 | f: "bytes" # Y020 Quoted annotations should never be used in stubs 25 25 | + Run `ruff check --fix` to apply this fix. + PYI020.pyi:24:8: PYI020 [*] Quoted annotations should not be included in stubs | 22 | f: "str" # Y020 Quoted annotations should never be used in stubs @@ -174,7 +190,7 @@ PYI020.pyi:24:8: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -ℹ Safe fix +Suggested fix: 21 21 | elif sys.platform == "win32": 22 22 | f: "str" # Y020 Quoted annotations should never be used in stubs 23 23 | else: @@ -184,4 +200,4 @@ PYI020.pyi:24:8: PYI020 [*] Quoted annotations should not be included in stubs 26 26 | # These two shouldn't trigger Y020 -- empty strings can't be "quoted annotations" 27 27 | k = "" # Y052 Need type annotation for "k" - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap index 3fd40be9ec54c..931dbde8b028a 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap @@ -9,7 +9,7 @@ PYI025_1.py:10:33: PYI025 [*] Use `from collections.abc import Set as AbstractSe | = help: Alias `Set` to `AbstractSet` -ℹ Safe fix +Suggested fix: 7 7 | 8 8 | 9 9 | def f(): @@ -19,6 +19,8 @@ PYI025_1.py:10:33: PYI025 [*] Use `from collections.abc import Set as AbstractSe 12 12 | 13 13 | def f(): + Run `ruff check --fix` to apply this fix. + PYI025_1.py:14:51: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 13 | def f(): @@ -29,7 +31,7 @@ PYI025_1.py:14:51: PYI025 [*] Use `from collections.abc import Set as AbstractSe | = help: Alias `Set` to `AbstractSet` -ℹ Safe fix +Suggested fix: 11 11 | 12 12 | 13 13 | def f(): @@ -42,3 +44,5 @@ PYI025_1.py:14:51: PYI025 [*] Use `from collections.abc import Set as AbstractSe 18 18 | class Class: 19 |- member: Set[int] 19 |+ member: AbstractSet[int] + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap index 208551931e8c2..715cfa96b9e29 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap @@ -11,7 +11,7 @@ PYI025_1.pyi:8:33: PYI025 [*] Use `from collections.abc import Set as AbstractSe | = help: Alias `Set` to `AbstractSet` -ℹ Safe fix +Suggested fix: 5 5 | from collections.abc import Container, Sized, Set as AbstractSet, ValuesView # Ok 6 6 | 7 7 | def f(): @@ -21,6 +21,8 @@ PYI025_1.pyi:8:33: PYI025 [*] Use `from collections.abc import Set as AbstractSe 10 10 | def f(): 11 11 | from collections.abc import Container, Sized, Set, ValuesView # PYI025 + Run `ruff check --fix` to apply this fix. + PYI025_1.pyi:11:51: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 10 | def f(): @@ -31,7 +33,7 @@ PYI025_1.pyi:11:51: PYI025 [*] Use `from collections.abc import Set as AbstractS | = help: Alias `Set` to `AbstractSet` -ℹ Safe fix +Suggested fix: 8 8 | from collections.abc import Set # PYI025 9 9 | 10 10 | def f(): @@ -41,6 +43,8 @@ PYI025_1.pyi:11:51: PYI025 [*] Use `from collections.abc import Set as AbstractS 13 13 | def f(): 14 14 | """Test: local symbol renaming.""" + Run `ruff check --fix` to apply this fix. + PYI025_1.pyi:16:37: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 14 | """Test: local symbol renaming.""" @@ -52,7 +56,7 @@ PYI025_1.pyi:16:37: PYI025 [*] Use `from collections.abc import Set as AbstractS | = help: Alias `Set` to `AbstractSet` -ℹ Safe fix +Suggested fix: 13 13 | def f(): 14 14 | """Test: local symbol renaming.""" 15 15 | if True: @@ -76,6 +80,8 @@ PYI025_1.pyi:16:37: PYI025 [*] Use `from collections.abc import Set as AbstractS 29 29 | def Set(): 30 30 | pass + Run `ruff check --fix` to apply this fix. + PYI025_1.pyi:33:29: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 31 | print(Set) @@ -87,7 +93,7 @@ PYI025_1.pyi:33:29: PYI025 [*] Use `from collections.abc import Set as AbstractS | = help: Alias `Set` to `AbstractSet` -ℹ Safe fix +Suggested fix: 17 17 | else: 18 18 | Set = 1 19 19 | @@ -119,6 +125,8 @@ PYI025_1.pyi:33:29: PYI025 [*] Use `from collections.abc import Set as AbstractS 42 42 | def f(): 43 43 | """Test: nonlocal symbol renaming.""" + Run `ruff check --fix` to apply this fix. + PYI025_1.pyi:44:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 42 | def f(): @@ -130,7 +138,7 @@ PYI025_1.pyi:44:33: PYI025 [*] Use `from collections.abc import Set as AbstractS | = help: Alias `Set` to `AbstractSet` -ℹ Safe fix +Suggested fix: 41 41 | 42 42 | def f(): 43 43 | """Test: nonlocal symbol renaming.""" @@ -145,3 +153,5 @@ PYI025_1.pyi:44:33: PYI025 [*] Use `from collections.abc import Set as AbstractS 50 |- print(Set) 49 |+ AbstractSet = 1 50 |+ print(AbstractSet) + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap index 1177dc90ecf8e..20653dbbfc398 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap @@ -12,7 +12,7 @@ PYI025_2.py:3:29: PYI025 [*] Use `from collections.abc import Set as AbstractSet | = help: Alias `Set` to `AbstractSet` -ℹ Unsafe fix +Suggested fix: 1 1 | """Tests to ensure we correctly rename references inside `__all__`""" 2 2 | 3 |-from collections.abc import Set @@ -32,3 +32,5 @@ PYI025_2.py:3:29: PYI025 [*] Use `from collections.abc import Set as AbstractSet 13 13 | if not False: 14 |- __all__ += ["Se" 't'] 14 |+ __all__ += ["AbstractSet"] + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap index 41feeabda6cf0..1c6cc732fd9ab 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap @@ -12,7 +12,7 @@ PYI025_2.pyi:3:29: PYI025 [*] Use `from collections.abc import Set as AbstractSe | = help: Alias `Set` to `AbstractSet` -ℹ Unsafe fix +Suggested fix: 1 1 | """Tests to ensure we correctly rename references inside `__all__`""" 2 2 | 3 |-from collections.abc import Set @@ -32,3 +32,5 @@ PYI025_2.pyi:3:29: PYI025 [*] Use `from collections.abc import Set as AbstractSe 13 13 | if not False: 14 |- __all__ += ["Se" 't'] 14 |+ __all__ += ["AbstractSet"] + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap index 008e68502946c..61a3621f1a2dc 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap @@ -10,9 +10,11 @@ PYI025_3.py:6:36: PYI025 [*] Use `from collections.abc import Set as AbstractSet | = help: Alias `Set` to `AbstractSet` -ℹ Unsafe fix +Suggested fix: 3 3 | through usage of a "redundant" `import Set as Set` alias 4 4 | """ 5 5 | 6 |-from collections.abc import Set as Set # PYI025 triggered but fix is not marked as safe 6 |+from collections.abc import Set as AbstractSet # PYI025 triggered but fix is not marked as safe + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap index ae54570974134..357f383a48ee1 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap @@ -10,9 +10,11 @@ PYI025_3.pyi:6:36: PYI025 [*] Use `from collections.abc import Set as AbstractSe | = help: Alias `Set` to `AbstractSet` -ℹ Unsafe fix +Suggested fix: 3 3 | through usage of a "redundant" `import Set as Set` alias 4 4 | """ 5 5 | 6 |-from collections.abc import Set as Set # PYI025 triggered but fix is not marked as safe 6 |+from collections.abc import Set as AbstractSet # PYI025 triggered but fix is not marked as safe + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap index 91c4bbddd76ac..3e10eba02a36a 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap @@ -12,7 +12,7 @@ PYI026.pyi:3:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `NewAny: | = help: Add `TypeAlias` annotation -ℹ Safe fix +Suggested fix: 1 |-from typing import Literal, Any 1 |+from typing import Literal, Any, TypeAlias 2 2 | @@ -22,6 +22,8 @@ PYI026.pyi:3:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `NewAny: 5 5 | Foo = Literal["foo"] 6 6 | IntOrStr = int | str + Run `ruff check --fix` to apply this fix. + PYI026.pyi:4:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]` | 3 | NewAny = Any @@ -32,7 +34,7 @@ PYI026.pyi:4:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Optiona | = help: Add `TypeAlias` annotation -ℹ Safe fix +Suggested fix: 1 |-from typing import Literal, Any 1 |+from typing import Literal, Any, TypeAlias 2 2 | @@ -43,6 +45,8 @@ PYI026.pyi:4:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Optiona 6 6 | IntOrStr = int | str 7 7 | AliasNone = None + Run `ruff check --fix` to apply this fix. + PYI026.pyi:5:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]` | 3 | NewAny = Any @@ -54,7 +58,7 @@ PYI026.pyi:5:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Foo: Ty | = help: Add `TypeAlias` annotation -ℹ Safe fix +Suggested fix: 1 |-from typing import Literal, Any 1 |+from typing import Literal, Any, TypeAlias 2 2 | @@ -66,6 +70,8 @@ PYI026.pyi:5:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Foo: Ty 7 7 | AliasNone = None 8 8 | + Run `ruff check --fix` to apply this fix. + PYI026.pyi:6:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str` | 4 | OptionalStr = typing.Optional[str] @@ -76,7 +82,7 @@ PYI026.pyi:6:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `IntOrSt | = help: Add `TypeAlias` annotation -ℹ Safe fix +Suggested fix: 1 |-from typing import Literal, Any 1 |+from typing import Literal, Any, TypeAlias 2 2 | @@ -89,6 +95,8 @@ PYI026.pyi:6:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `IntOrSt 8 8 | 9 9 | NewAny: typing.TypeAlias = Any + Run `ruff check --fix` to apply this fix. + PYI026.pyi:7:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None` | 5 | Foo = Literal["foo"] @@ -100,7 +108,7 @@ PYI026.pyi:7:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `AliasNo | = help: Add `TypeAlias` annotation -ℹ Safe fix +Suggested fix: 1 |-from typing import Literal, Any 1 |+from typing import Literal, Any, TypeAlias 2 2 | @@ -114,6 +122,8 @@ PYI026.pyi:7:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `AliasNo 9 9 | NewAny: typing.TypeAlias = Any 10 10 | OptionalStr: TypeAlias = typing.Optional[str] + Run `ruff check --fix` to apply this fix. + PYI026.pyi:17:5: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `FLAG_THIS: TypeAlias = None` | 16 | class NotAnEnum: @@ -124,7 +134,7 @@ PYI026.pyi:17:5: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `FLAG_T | = help: Add `TypeAlias` annotation -ℹ Safe fix +Suggested fix: 1 |-from typing import Literal, Any 1 |+from typing import Literal, Any, TypeAlias 2 2 | @@ -139,3 +149,5 @@ PYI026.pyi:17:5: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `FLAG_T 18 18 | 19 19 | # these are ok 20 20 | from enum import Enum + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI029_PYI029.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI029_PYI029.pyi.snap index 40bdd22441e1c..501226e552f07 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI029_PYI029.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI029_PYI029.pyi.snap @@ -11,7 +11,7 @@ PYI029.pyi:10:9: PYI029 [*] Defining `__str__` in a stub is almost always redund | = help: Remove definition of `__str__` -ℹ Safe fix +Suggested fix: 7 7 | def __repr__(self, *, foo) -> str: ... 8 8 | 9 9 | class ShouldRemoveSingle: @@ -21,6 +21,8 @@ PYI029.pyi:10:9: PYI029 [*] Defining `__str__` in a stub is almost always redund 12 12 | class ShouldRemove: 13 13 | def __repr__(self) -> str: ... # Error: PYI029 + Run `ruff check --fix` to apply this fix. + PYI029.pyi:13:9: PYI029 [*] Defining `__repr__` in a stub is almost always redundant | 12 | class ShouldRemove: @@ -30,7 +32,7 @@ PYI029.pyi:13:9: PYI029 [*] Defining `__repr__` in a stub is almost always redun | = help: Remove definition of `__repr__` -ℹ Safe fix +Suggested fix: 10 10 | def __str__(self) -> builtins.str: ... # Error: PYI029 11 11 | 12 12 | class ShouldRemove: @@ -39,6 +41,8 @@ PYI029.pyi:13:9: PYI029 [*] Defining `__repr__` in a stub is almost always redun 15 14 | 16 15 | class NoReturnSpecified: + Run `ruff check --fix` to apply this fix. + PYI029.pyi:14:9: PYI029 [*] Defining `__str__` in a stub is almost always redundant | 12 | class ShouldRemove: @@ -50,7 +54,7 @@ PYI029.pyi:14:9: PYI029 [*] Defining `__str__` in a stub is almost always redund | = help: Remove definition of `__str__` -ℹ Safe fix +Suggested fix: 11 11 | 12 12 | class ShouldRemove: 13 13 | def __repr__(self) -> str: ... # Error: PYI029 @@ -59,4 +63,4 @@ PYI029.pyi:14:9: PYI029 [*] Defining `__str__` in a stub is almost always redund 16 15 | class NoReturnSpecified: 17 16 | def __str__(self): ... - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap index 47a803b8da44a..e380847ee2364 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap @@ -11,7 +11,7 @@ PYI030.py:9:9: PYI030 [*] Multiple literal members in a union. Use a single lite | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 6 6 | field1: Literal[1] # OK 7 7 | 8 8 | # Should emit for duplicate field types. @@ -21,6 +21,8 @@ PYI030.py:9:9: PYI030 [*] Multiple literal members in a union. Use a single lite 11 11 | # Should emit for union types in arguments. 12 12 | def func1(arg1: Literal[1] | Literal[2]): # Error + Run `ruff check --fix` to apply this fix. + PYI030.py:12:17: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 11 | # Should emit for union types in arguments. @@ -30,7 +32,7 @@ PYI030.py:12:17: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 9 9 | field2: Literal[1] | Literal[2] # Error 10 10 | 11 11 | # Should emit for union types in arguments. @@ -40,6 +42,8 @@ PYI030.py:12:17: PYI030 [*] Multiple literal members in a union. Use a single li 14 14 | 15 15 | + Run `ruff check --fix` to apply this fix. + PYI030.py:17:16: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 16 | # Should emit for unions in return types. @@ -49,7 +53,7 @@ PYI030.py:17:16: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 14 14 | 15 15 | 16 16 | # Should emit for unions in return types. @@ -59,6 +63,8 @@ PYI030.py:17:16: PYI030 [*] Multiple literal members in a union. Use a single li 19 19 | 20 20 | + Run `ruff check --fix` to apply this fix. + PYI030.py:22:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 21 | # Should emit in longer unions, even if not directly adjacent. @@ -69,7 +75,7 @@ PYI030.py:22:9: PYI030 [*] Multiple literal members in a union. Use a single lit | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 19 19 | 20 20 | 21 21 | # Should emit in longer unions, even if not directly adjacent. @@ -79,6 +85,8 @@ PYI030.py:22:9: PYI030 [*] Multiple literal members in a union. Use a single lit 24 24 | field5: Literal[1] | str | Literal[2] # Error 25 25 | field6: Literal[1] | bool | Literal[2] | str # Error + Run `ruff check --fix` to apply this fix. + PYI030.py:23:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 21 | # Should emit in longer unions, even if not directly adjacent. @@ -90,7 +98,7 @@ PYI030.py:23:9: PYI030 [*] Multiple literal members in a union. Use a single lit | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 20 20 | 21 21 | # Should emit in longer unions, even if not directly adjacent. 22 22 | field3: Literal[1] | Literal[2] | str # Error @@ -100,6 +108,8 @@ PYI030.py:23:9: PYI030 [*] Multiple literal members in a union. Use a single lit 25 25 | field6: Literal[1] | bool | Literal[2] | str # Error 26 26 | + Run `ruff check --fix` to apply this fix. + PYI030.py:24:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 22 | field3: Literal[1] | Literal[2] | str # Error @@ -110,7 +120,7 @@ PYI030.py:24:9: PYI030 [*] Multiple literal members in a union. Use a single lit | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 21 21 | # Should emit in longer unions, even if not directly adjacent. 22 22 | field3: Literal[1] | Literal[2] | str # Error 23 23 | field4: str | Literal[1] | Literal[2] # Error @@ -120,6 +130,8 @@ PYI030.py:24:9: PYI030 [*] Multiple literal members in a union. Use a single lit 26 26 | 27 27 | # Should emit for non-type unions. + Run `ruff check --fix` to apply this fix. + PYI030.py:25:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 23 | field4: str | Literal[1] | Literal[2] # Error @@ -131,7 +143,7 @@ PYI030.py:25:9: PYI030 [*] Multiple literal members in a union. Use a single lit | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 22 22 | field3: Literal[1] | Literal[2] | str # Error 23 23 | field4: str | Literal[1] | Literal[2] # Error 24 24 | field5: Literal[1] | str | Literal[2] # Error @@ -141,6 +153,8 @@ PYI030.py:25:9: PYI030 [*] Multiple literal members in a union. Use a single lit 27 27 | # Should emit for non-type unions. 28 28 | field7 = Literal[1] | Literal[2] # Error + Run `ruff check --fix` to apply this fix. + PYI030.py:28:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 27 | # Should emit for non-type unions. @@ -151,7 +165,7 @@ PYI030.py:28:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 25 25 | field6: Literal[1] | bool | Literal[2] | str # Error 26 26 | 27 27 | # Should emit for non-type unions. @@ -161,6 +175,8 @@ PYI030.py:28:10: PYI030 [*] Multiple literal members in a union. Use a single li 30 30 | # Should emit for parenthesized unions. 31 31 | field8: Literal[1] | (Literal[2] | str) # Error + Run `ruff check --fix` to apply this fix. + PYI030.py:31:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 30 | # Should emit for parenthesized unions. @@ -171,7 +187,7 @@ PYI030.py:31:9: PYI030 [*] Multiple literal members in a union. Use a single lit | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 28 28 | field7 = Literal[1] | Literal[2] # Error 29 29 | 30 30 | # Should emit for parenthesized unions. @@ -181,6 +197,8 @@ PYI030.py:31:9: PYI030 [*] Multiple literal members in a union. Use a single lit 33 33 | # Should handle user parentheses when fixing. 34 34 | field9: Literal[1] | (Literal[2] | str) # Error + Run `ruff check --fix` to apply this fix. + PYI030.py:34:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 33 | # Should handle user parentheses when fixing. @@ -190,7 +208,7 @@ PYI030.py:34:9: PYI030 [*] Multiple literal members in a union. Use a single lit | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 31 31 | field8: Literal[1] | (Literal[2] | str) # Error 32 32 | 33 33 | # Should handle user parentheses when fixing. @@ -200,6 +218,8 @@ PYI030.py:34:9: PYI030 [*] Multiple literal members in a union. Use a single lit 36 36 | 37 37 | # Should emit for union in generic parent type. + Run `ruff check --fix` to apply this fix. + PYI030.py:35:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 33 | # Should handle user parentheses when fixing. @@ -211,7 +231,7 @@ PYI030.py:35:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 32 32 | 33 33 | # Should handle user parentheses when fixing. 34 34 | field9: Literal[1] | (Literal[2] | str) # Error @@ -221,6 +241,8 @@ PYI030.py:35:10: PYI030 [*] Multiple literal members in a union. Use a single li 37 37 | # Should emit for union in generic parent type. 38 38 | field11: dict[Literal[1] | Literal[2], str] # Error + Run `ruff check --fix` to apply this fix. + PYI030.py:38:15: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 37 | # Should emit for union in generic parent type. @@ -231,7 +253,7 @@ PYI030.py:38:15: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 35 35 | field10: (Literal[1] | str) | Literal[2] # Error 36 36 | 37 37 | # Should emit for union in generic parent type. @@ -241,6 +263,8 @@ PYI030.py:38:15: PYI030 [*] Multiple literal members in a union. Use a single li 40 40 | # Should emit for unions with more than two cases 41 41 | field12: Literal[1] | Literal[2] | Literal[3] # Error + Run `ruff check --fix` to apply this fix. + PYI030.py:41:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3]` | 40 | # Should emit for unions with more than two cases @@ -250,7 +274,7 @@ PYI030.py:41:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 38 38 | field11: dict[Literal[1] | Literal[2], str] # Error 39 39 | 40 40 | # Should emit for unions with more than two cases @@ -260,6 +284,8 @@ PYI030.py:41:10: PYI030 [*] Multiple literal members in a union. Use a single li 43 43 | 44 44 | # Should emit for unions with more than two cases, even if not directly adjacent + Run `ruff check --fix` to apply this fix. + PYI030.py:42:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` | 40 | # Should emit for unions with more than two cases @@ -271,7 +297,7 @@ PYI030.py:42:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 39 39 | 40 40 | # Should emit for unions with more than two cases 41 41 | field12: Literal[1] | Literal[2] | Literal[3] # Error @@ -281,6 +307,8 @@ PYI030.py:42:10: PYI030 [*] Multiple literal members in a union. Use a single li 44 44 | # Should emit for unions with more than two cases, even if not directly adjacent 45 45 | field14: Literal[1] | Literal[2] | str | Literal[3] # Error + Run `ruff check --fix` to apply this fix. + PYI030.py:45:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3]` | 44 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -291,7 +319,7 @@ PYI030.py:45:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 42 42 | field13: Literal[1] | Literal[2] | Literal[3] | Literal[4] # Error 43 43 | 44 44 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -301,6 +329,8 @@ PYI030.py:45:10: PYI030 [*] Multiple literal members in a union. Use a single li 47 47 | # Should emit for unions with mixed literal internal types 48 48 | field15: Literal[1] | Literal["foo"] | Literal[True] # Error + Run `ruff check --fix` to apply this fix. + PYI030.py:48:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, "foo", True]` | 47 | # Should emit for unions with mixed literal internal types @@ -311,7 +341,7 @@ PYI030.py:48:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 45 45 | field14: Literal[1] | Literal[2] | str | Literal[3] # Error 46 46 | 47 47 | # Should emit for unions with mixed literal internal types @@ -321,6 +351,8 @@ PYI030.py:48:10: PYI030 [*] Multiple literal members in a union. Use a single li 50 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 51 51 | field16: Literal[1] | Literal[1] # OK + Run `ruff check --fix` to apply this fix. + PYI030.py:51:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 1]` | 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 @@ -331,7 +363,7 @@ PYI030.py:51:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 48 48 | field15: Literal[1] | Literal["foo"] | Literal[True] # Error 49 49 | 50 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 @@ -341,6 +373,8 @@ PYI030.py:51:10: PYI030 [*] Multiple literal members in a union. Use a single li 53 53 | # Shouldn't emit if in new parent type 54 54 | field17: Literal[1] | dict[Literal[2], str] # OK + Run `ruff check --fix` to apply this fix. + PYI030.py:60:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 59 | # Should respect name of literal type used @@ -351,7 +385,7 @@ PYI030.py:60:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 57 57 | field18: dict[Literal[1], Literal[2]] # OK 58 58 | 59 59 | # Should respect name of literal type used @@ -361,6 +395,8 @@ PYI030.py:60:10: PYI030 [*] Multiple literal members in a union. Use a single li 62 62 | # Should emit in cases with newlines 63 63 | field20: typing.Union[ + Run `ruff check --fix` to apply this fix. + PYI030.py:63:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 62 | # Should emit in cases with newlines @@ -377,7 +413,7 @@ PYI030.py:63:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 60 60 | field19: typing.Literal[1] | typing.Literal[2] # Error 61 61 | 62 62 | # Should emit in cases with newlines @@ -392,6 +428,8 @@ PYI030.py:63:10: PYI030 [*] Multiple literal members in a union. Use a single li 70 65 | # Should handle multiple unions with multiple members 71 66 | field21: Literal[1, 2] | Literal[3, 4] # Error + Run `ruff check --fix` to apply this fix. + PYI030.py:71:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` | 70 | # Should handle multiple unions with multiple members @@ -402,7 +440,7 @@ PYI030.py:71:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 68 68 | ] # Error, newline and comment will not be emitted in message 69 69 | 70 70 | # Should handle multiple unions with multiple members @@ -412,6 +450,8 @@ PYI030.py:71:10: PYI030 [*] Multiple literal members in a union. Use a single li 73 73 | # Should emit in cases with `typing.Union` instead of `|` 74 74 | field22: typing.Union[Literal[1], Literal[2]] # Error + Run `ruff check --fix` to apply this fix. + PYI030.py:74:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 73 | # Should emit in cases with `typing.Union` instead of `|` @@ -422,7 +462,7 @@ PYI030.py:74:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 71 71 | field21: Literal[1, 2] | Literal[3, 4] # Error 72 72 | 73 73 | # Should emit in cases with `typing.Union` instead of `|` @@ -432,6 +472,8 @@ PYI030.py:74:10: PYI030 [*] Multiple literal members in a union. Use a single li 76 76 | # Should emit in cases with `typing_extensions.Literal` 77 77 | field23: typing_extensions.Literal[1] | typing_extensions.Literal[2] # Error + Run `ruff check --fix` to apply this fix. + PYI030.py:77:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 76 | # Should emit in cases with `typing_extensions.Literal` @@ -442,7 +484,7 @@ PYI030.py:77:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 74 74 | field22: typing.Union[Literal[1], Literal[2]] # Error 75 75 | 76 76 | # Should emit in cases with `typing_extensions.Literal` @@ -452,6 +494,8 @@ PYI030.py:77:10: PYI030 [*] Multiple literal members in a union. Use a single li 79 79 | # Should emit in cases with nested `typing.Union` 80 80 | field24: typing.Union[Literal[1], typing.Union[Literal[2], str]] # Error + Run `ruff check --fix` to apply this fix. + PYI030.py:80:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 79 | # Should emit in cases with nested `typing.Union` @@ -462,7 +506,7 @@ PYI030.py:80:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 77 77 | field23: typing_extensions.Literal[1] | typing_extensions.Literal[2] # Error 78 78 | 79 79 | # Should emit in cases with nested `typing.Union` @@ -472,6 +516,8 @@ PYI030.py:80:10: PYI030 [*] Multiple literal members in a union. Use a single li 82 82 | # Should emit in cases with mixed `typing.Union` and `|` 83 83 | field25: typing.Union[Literal[1], Literal[2] | str] # Error + Run `ruff check --fix` to apply this fix. + PYI030.py:83:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 82 | # Should emit in cases with mixed `typing.Union` and `|` @@ -482,7 +528,7 @@ PYI030.py:83:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 80 80 | field24: typing.Union[Literal[1], typing.Union[Literal[2], str]] # Error 81 81 | 82 82 | # Should emit in cases with mixed `typing.Union` and `|` @@ -492,6 +538,8 @@ PYI030.py:83:10: PYI030 [*] Multiple literal members in a union. Use a single li 85 85 | # Should emit only once in cases with multiple nested `typing.Union` 86 86 | field24: typing.Union[Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]]] # Error + Run `ruff check --fix` to apply this fix. + PYI030.py:86:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` | 85 | # Should emit only once in cases with multiple nested `typing.Union` @@ -502,7 +550,7 @@ PYI030.py:86:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 83 83 | field25: typing.Union[Literal[1], Literal[2] | str] # Error 84 84 | 85 85 | # Should emit only once in cases with multiple nested `typing.Union` @@ -512,6 +560,8 @@ PYI030.py:86:10: PYI030 [*] Multiple literal members in a union. Use a single li 88 88 | # Should use the first literal subscript attribute when fixing 89 89 | field25: typing.Union[typing_extensions.Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]], str] # Error + Run `ruff check --fix` to apply this fix. + PYI030.py:89:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` | 88 | # Should use the first literal subscript attribute when fixing @@ -520,11 +570,11 @@ PYI030.py:89:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 86 86 | field24: typing.Union[Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]]] # Error 87 87 | 88 88 | # Should use the first literal subscript attribute when fixing 89 |-field25: typing.Union[typing_extensions.Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]], str] # Error 89 |+field25: typing.Union[typing_extensions.Literal[1, 2, 3, 4], str] # Error - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap index 7d49337d4cf41..613db88ee15e3 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap @@ -11,7 +11,7 @@ PYI030.pyi:9:9: PYI030 [*] Multiple literal members in a union. Use a single lit | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 6 6 | field1: Literal[1] # OK 7 7 | 8 8 | # Should emit for duplicate field types. @@ -21,6 +21,8 @@ PYI030.pyi:9:9: PYI030 [*] Multiple literal members in a union. Use a single lit 11 11 | # Should emit for union types in arguments. 12 12 | def func1(arg1: Literal[1] | Literal[2]): # Error + Run `ruff check --fix` to apply this fix. + PYI030.pyi:12:17: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 11 | # Should emit for union types in arguments. @@ -30,7 +32,7 @@ PYI030.pyi:12:17: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 9 9 | field2: Literal[1] | Literal[2] # Error 10 10 | 11 11 | # Should emit for union types in arguments. @@ -40,6 +42,8 @@ PYI030.pyi:12:17: PYI030 [*] Multiple literal members in a union. Use a single l 14 14 | 15 15 | + Run `ruff check --fix` to apply this fix. + PYI030.pyi:17:16: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 16 | # Should emit for unions in return types. @@ -49,7 +53,7 @@ PYI030.pyi:17:16: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 14 14 | 15 15 | 16 16 | # Should emit for unions in return types. @@ -59,6 +63,8 @@ PYI030.pyi:17:16: PYI030 [*] Multiple literal members in a union. Use a single l 19 19 | 20 20 | + Run `ruff check --fix` to apply this fix. + PYI030.pyi:22:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 21 | # Should emit in longer unions, even if not directly adjacent. @@ -69,7 +75,7 @@ PYI030.pyi:22:9: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 19 19 | 20 20 | 21 21 | # Should emit in longer unions, even if not directly adjacent. @@ -79,6 +85,8 @@ PYI030.pyi:22:9: PYI030 [*] Multiple literal members in a union. Use a single li 24 24 | field5: Literal[1] | str | Literal[2] # Error 25 25 | field6: Literal[1] | bool | Literal[2] | str # Error + Run `ruff check --fix` to apply this fix. + PYI030.pyi:23:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 21 | # Should emit in longer unions, even if not directly adjacent. @@ -90,7 +98,7 @@ PYI030.pyi:23:9: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 20 20 | 21 21 | # Should emit in longer unions, even if not directly adjacent. 22 22 | field3: Literal[1] | Literal[2] | str # Error @@ -100,6 +108,8 @@ PYI030.pyi:23:9: PYI030 [*] Multiple literal members in a union. Use a single li 25 25 | field6: Literal[1] | bool | Literal[2] | str # Error 26 26 | + Run `ruff check --fix` to apply this fix. + PYI030.pyi:24:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 22 | field3: Literal[1] | Literal[2] | str # Error @@ -110,7 +120,7 @@ PYI030.pyi:24:9: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 21 21 | # Should emit in longer unions, even if not directly adjacent. 22 22 | field3: Literal[1] | Literal[2] | str # Error 23 23 | field4: str | Literal[1] | Literal[2] # Error @@ -120,6 +130,8 @@ PYI030.pyi:24:9: PYI030 [*] Multiple literal members in a union. Use a single li 26 26 | 27 27 | # Should emit for non-type unions. + Run `ruff check --fix` to apply this fix. + PYI030.pyi:25:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 23 | field4: str | Literal[1] | Literal[2] # Error @@ -131,7 +143,7 @@ PYI030.pyi:25:9: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 22 22 | field3: Literal[1] | Literal[2] | str # Error 23 23 | field4: str | Literal[1] | Literal[2] # Error 24 24 | field5: Literal[1] | str | Literal[2] # Error @@ -141,6 +153,8 @@ PYI030.pyi:25:9: PYI030 [*] Multiple literal members in a union. Use a single li 27 27 | # Should emit for non-type unions. 28 28 | field7 = Literal[1] | Literal[2] # Error + Run `ruff check --fix` to apply this fix. + PYI030.pyi:28:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 27 | # Should emit for non-type unions. @@ -151,7 +165,7 @@ PYI030.pyi:28:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 25 25 | field6: Literal[1] | bool | Literal[2] | str # Error 26 26 | 27 27 | # Should emit for non-type unions. @@ -161,6 +175,8 @@ PYI030.pyi:28:10: PYI030 [*] Multiple literal members in a union. Use a single l 30 30 | # Should emit for parenthesized unions. 31 31 | field8: Literal[1] | (Literal[2] | str) # Error + Run `ruff check --fix` to apply this fix. + PYI030.pyi:31:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 30 | # Should emit for parenthesized unions. @@ -171,7 +187,7 @@ PYI030.pyi:31:9: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 28 28 | field7 = Literal[1] | Literal[2] # Error 29 29 | 30 30 | # Should emit for parenthesized unions. @@ -181,6 +197,8 @@ PYI030.pyi:31:9: PYI030 [*] Multiple literal members in a union. Use a single li 33 33 | # Should handle user parentheses when fixing. 34 34 | field9: Literal[1] | (Literal[2] | str) # Error + Run `ruff check --fix` to apply this fix. + PYI030.pyi:34:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 33 | # Should handle user parentheses when fixing. @@ -190,7 +208,7 @@ PYI030.pyi:34:9: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 31 31 | field8: Literal[1] | (Literal[2] | str) # Error 32 32 | 33 33 | # Should handle user parentheses when fixing. @@ -200,6 +218,8 @@ PYI030.pyi:34:9: PYI030 [*] Multiple literal members in a union. Use a single li 36 36 | 37 37 | # Should emit for union in generic parent type. + Run `ruff check --fix` to apply this fix. + PYI030.pyi:35:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 33 | # Should handle user parentheses when fixing. @@ -211,7 +231,7 @@ PYI030.pyi:35:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 32 32 | 33 33 | # Should handle user parentheses when fixing. 34 34 | field9: Literal[1] | (Literal[2] | str) # Error @@ -221,6 +241,8 @@ PYI030.pyi:35:10: PYI030 [*] Multiple literal members in a union. Use a single l 37 37 | # Should emit for union in generic parent type. 38 38 | field11: dict[Literal[1] | Literal[2], str] # Error + Run `ruff check --fix` to apply this fix. + PYI030.pyi:38:15: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 37 | # Should emit for union in generic parent type. @@ -231,7 +253,7 @@ PYI030.pyi:38:15: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 35 35 | field10: (Literal[1] | str) | Literal[2] # Error 36 36 | 37 37 | # Should emit for union in generic parent type. @@ -241,6 +263,8 @@ PYI030.pyi:38:15: PYI030 [*] Multiple literal members in a union. Use a single l 40 40 | # Should emit for unions with more than two cases 41 41 | field12: Literal[1] | Literal[2] | Literal[3] # Error + Run `ruff check --fix` to apply this fix. + PYI030.pyi:41:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3]` | 40 | # Should emit for unions with more than two cases @@ -250,7 +274,7 @@ PYI030.pyi:41:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 38 38 | field11: dict[Literal[1] | Literal[2], str] # Error 39 39 | 40 40 | # Should emit for unions with more than two cases @@ -260,6 +284,8 @@ PYI030.pyi:41:10: PYI030 [*] Multiple literal members in a union. Use a single l 43 43 | 44 44 | # Should emit for unions with more than two cases, even if not directly adjacent + Run `ruff check --fix` to apply this fix. + PYI030.pyi:42:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` | 40 | # Should emit for unions with more than two cases @@ -271,7 +297,7 @@ PYI030.pyi:42:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 39 39 | 40 40 | # Should emit for unions with more than two cases 41 41 | field12: Literal[1] | Literal[2] | Literal[3] # Error @@ -281,6 +307,8 @@ PYI030.pyi:42:10: PYI030 [*] Multiple literal members in a union. Use a single l 44 44 | # Should emit for unions with more than two cases, even if not directly adjacent 45 45 | field14: Literal[1] | Literal[2] | str | Literal[3] # Error + Run `ruff check --fix` to apply this fix. + PYI030.pyi:45:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3]` | 44 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -291,7 +319,7 @@ PYI030.pyi:45:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 42 42 | field13: Literal[1] | Literal[2] | Literal[3] | Literal[4] # Error 43 43 | 44 44 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -301,6 +329,8 @@ PYI030.pyi:45:10: PYI030 [*] Multiple literal members in a union. Use a single l 47 47 | # Should emit for unions with mixed literal internal types 48 48 | field15: Literal[1] | Literal["foo"] | Literal[True] # Error + Run `ruff check --fix` to apply this fix. + PYI030.pyi:48:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, "foo", True]` | 47 | # Should emit for unions with mixed literal internal types @@ -311,7 +341,7 @@ PYI030.pyi:48:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 45 45 | field14: Literal[1] | Literal[2] | str | Literal[3] # Error 46 46 | 47 47 | # Should emit for unions with mixed literal internal types @@ -321,6 +351,8 @@ PYI030.pyi:48:10: PYI030 [*] Multiple literal members in a union. Use a single l 50 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 51 51 | field16: Literal[1] | Literal[1] # OK + Run `ruff check --fix` to apply this fix. + PYI030.pyi:51:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 1]` | 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 @@ -331,7 +363,7 @@ PYI030.pyi:51:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 48 48 | field15: Literal[1] | Literal["foo"] | Literal[True] # Error 49 49 | 50 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 @@ -341,6 +373,8 @@ PYI030.pyi:51:10: PYI030 [*] Multiple literal members in a union. Use a single l 53 53 | # Shouldn't emit if in new parent type 54 54 | field17: Literal[1] | dict[Literal[2], str] # OK + Run `ruff check --fix` to apply this fix. + PYI030.pyi:60:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 59 | # Should respect name of literal type used @@ -351,7 +385,7 @@ PYI030.pyi:60:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 57 57 | field18: dict[Literal[1], Literal[2]] # OK 58 58 | 59 59 | # Should respect name of literal type used @@ -361,6 +395,8 @@ PYI030.pyi:60:10: PYI030 [*] Multiple literal members in a union. Use a single l 62 62 | # Should emit in cases with newlines 63 63 | field20: typing.Union[ + Run `ruff check --fix` to apply this fix. + PYI030.pyi:63:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 62 | # Should emit in cases with newlines @@ -377,7 +413,7 @@ PYI030.pyi:63:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 60 60 | field19: typing.Literal[1] | typing.Literal[2] # Error 61 61 | 62 62 | # Should emit in cases with newlines @@ -392,6 +428,8 @@ PYI030.pyi:63:10: PYI030 [*] Multiple literal members in a union. Use a single l 70 65 | # Should handle multiple unions with multiple members 71 66 | field21: Literal[1, 2] | Literal[3, 4] # Error + Run `ruff check --fix` to apply this fix. + PYI030.pyi:71:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` | 70 | # Should handle multiple unions with multiple members @@ -402,7 +440,7 @@ PYI030.pyi:71:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 68 68 | ] # Error, newline and comment will not be emitted in message 69 69 | 70 70 | # Should handle multiple unions with multiple members @@ -412,6 +450,8 @@ PYI030.pyi:71:10: PYI030 [*] Multiple literal members in a union. Use a single l 73 73 | # Should emit in cases with `typing.Union` instead of `|` 74 74 | field22: typing.Union[Literal[1], Literal[2]] # Error + Run `ruff check --fix` to apply this fix. + PYI030.pyi:74:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 73 | # Should emit in cases with `typing.Union` instead of `|` @@ -422,7 +462,7 @@ PYI030.pyi:74:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 71 71 | field21: Literal[1, 2] | Literal[3, 4] # Error 72 72 | 73 73 | # Should emit in cases with `typing.Union` instead of `|` @@ -432,6 +472,8 @@ PYI030.pyi:74:10: PYI030 [*] Multiple literal members in a union. Use a single l 76 76 | # Should emit in cases with `typing_extensions.Literal` 77 77 | field23: typing_extensions.Literal[1] | typing_extensions.Literal[2] # Error + Run `ruff check --fix` to apply this fix. + PYI030.pyi:77:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 76 | # Should emit in cases with `typing_extensions.Literal` @@ -442,7 +484,7 @@ PYI030.pyi:77:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 74 74 | field22: typing.Union[Literal[1], Literal[2]] # Error 75 75 | 76 76 | # Should emit in cases with `typing_extensions.Literal` @@ -452,6 +494,8 @@ PYI030.pyi:77:10: PYI030 [*] Multiple literal members in a union. Use a single l 79 79 | # Should emit in cases with nested `typing.Union` 80 80 | field24: typing.Union[Literal[1], typing.Union[Literal[2], str]] # Error + Run `ruff check --fix` to apply this fix. + PYI030.pyi:80:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 79 | # Should emit in cases with nested `typing.Union` @@ -462,7 +506,7 @@ PYI030.pyi:80:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 77 77 | field23: typing_extensions.Literal[1] | typing_extensions.Literal[2] # Error 78 78 | 79 79 | # Should emit in cases with nested `typing.Union` @@ -472,6 +516,8 @@ PYI030.pyi:80:10: PYI030 [*] Multiple literal members in a union. Use a single l 82 82 | # Should emit in cases with mixed `typing.Union` and `|` 83 83 | field25: typing.Union[Literal[1], Literal[2] | str] # Error + Run `ruff check --fix` to apply this fix. + PYI030.pyi:83:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 82 | # Should emit in cases with mixed `typing.Union` and `|` @@ -482,7 +528,7 @@ PYI030.pyi:83:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 80 80 | field24: typing.Union[Literal[1], typing.Union[Literal[2], str]] # Error 81 81 | 82 82 | # Should emit in cases with mixed `typing.Union` and `|` @@ -492,6 +538,8 @@ PYI030.pyi:83:10: PYI030 [*] Multiple literal members in a union. Use a single l 85 85 | # Should emit only once in cases with multiple nested `typing.Union` 86 86 | field24: typing.Union[Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]]] # Error + Run `ruff check --fix` to apply this fix. + PYI030.pyi:86:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` | 85 | # Should emit only once in cases with multiple nested `typing.Union` @@ -502,7 +550,7 @@ PYI030.pyi:86:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 83 83 | field25: typing.Union[Literal[1], Literal[2] | str] # Error 84 84 | 85 85 | # Should emit only once in cases with multiple nested `typing.Union` @@ -512,6 +560,8 @@ PYI030.pyi:86:10: PYI030 [*] Multiple literal members in a union. Use a single l 88 88 | # Should use the first literal subscript attribute when fixing 89 89 | field25: typing.Union[typing_extensions.Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]], str] # Error + Run `ruff check --fix` to apply this fix. + PYI030.pyi:89:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` | 88 | # Should use the first literal subscript attribute when fixing @@ -520,11 +570,11 @@ PYI030.pyi:89:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -ℹ Safe fix +Suggested fix: 86 86 | field24: typing.Union[Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]]] # Error 87 87 | 88 88 | # Should use the first literal subscript attribute when fixing 89 |-field25: typing.Union[typing_extensions.Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]], str] # Error 89 |+field25: typing.Union[typing_extensions.Literal[1, 2, 3, 4], str] # Error - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.py.snap index 7415a2ab741be..0d1b7588df80e 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.py.snap @@ -10,7 +10,7 @@ PYI032.py:6:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to | = help: Replace with `object` -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | 5 5 | class Bad: @@ -20,6 +20,8 @@ PYI032.py:6:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to 8 8 | 9 9 | + Run `ruff check --fix` to apply this fix. + PYI032.py:7:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to `__ne__` | 5 | class Bad: @@ -29,7 +31,7 @@ PYI032.py:7:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to | = help: Replace with `object` -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | class Bad: 6 6 | def __eq__(self, other: Any) -> bool: ... # Y032 @@ -39,4 +41,4 @@ PYI032.py:7:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to 9 9 | 10 10 | class Good: - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.pyi.snap index 0017fe8889720..174c4b0be2fab 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.pyi.snap @@ -10,7 +10,7 @@ PYI032.pyi:6:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to | = help: Replace with `object` -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | 5 5 | class Bad: @@ -20,6 +20,8 @@ PYI032.pyi:6:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to 8 8 | 9 9 | + Run `ruff check --fix` to apply this fix. + PYI032.pyi:7:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to `__ne__` | 5 | class Bad: @@ -29,7 +31,7 @@ PYI032.pyi:7:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to | = help: Replace with `object` -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | class Bad: 6 6 | def __eq__(self, other: Any) -> bool: ... # Y032 @@ -39,4 +41,4 @@ PYI032.pyi:7:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to 9 9 | 10 10 | class Good: - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.py.snap index 2f3dc38a504bd..bcb4028d87577 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.py.snap @@ -10,7 +10,7 @@ PYI036.py:54:31: PYI036 [*] Star-args in `__exit__` should be annotated with `ob | = help: Annotate star-args with `object` -ℹ Safe fix +Suggested fix: 51 51 | 52 52 | 53 53 | class BadOne: @@ -20,6 +20,8 @@ PYI036.py:54:31: PYI036 [*] Star-args in `__exit__` should be annotated with `ob 56 56 | 57 57 | class BadTwo: + Run `ruff check --fix` to apply this fix. + PYI036.py:55:24: PYI036 If there are no star-args, `__aexit__` should have at least 3 non-keyword-only args (excluding `self`) | 53 | class BadOne: @@ -111,7 +113,7 @@ PYI036.py:70:58: PYI036 [*] Star-args in `__exit__` should be annotated with `ob | = help: Annotate star-args with `object` -ℹ Safe fix +Suggested fix: 67 67 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException | None, __tb: typing.Union[TracebackType, None, int]) -> bool | None: ... # PYI036: Third arg has bad annotation 68 68 | 69 69 | class BadFive: @@ -121,6 +123,8 @@ PYI036.py:70:58: PYI036 [*] Star-args in `__exit__` should be annotated with `ob 72 72 | 73 73 | class BadSix: + Run `ruff check --fix` to apply this fix. + PYI036.py:71:74: PYI036 [*] Star-args in `__aexit__` should be annotated with `object` | 69 | class BadFive: @@ -132,7 +136,7 @@ PYI036.py:71:74: PYI036 [*] Star-args in `__aexit__` should be annotated with `o | = help: Annotate star-args with `object` -ℹ Safe fix +Suggested fix: 68 68 | 69 69 | class BadFive: 70 70 | def __exit__(self, typ: BaseException | None, *args: list[str]) -> bool: ... # PYI036: Bad star-args annotation @@ -142,6 +146,8 @@ PYI036.py:71:74: PYI036 [*] Star-args in `__aexit__` should be annotated with `o 73 73 | class BadSix: 74 74 | def __exit__(self, typ, exc, tb, weird_extra_arg, extra_arg2 = None) -> None: ... # PYI036: Extra arg must have default + Run `ruff check --fix` to apply this fix. + PYI036.py:74:38: PYI036 All arguments after the first four in `__exit__` must have a default value | 73 | class BadSix: diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.pyi.snap index 7f31ca0ccdf0b..998d3828c709b 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.pyi.snap @@ -10,7 +10,7 @@ PYI036.pyi:54:31: PYI036 [*] Star-args in `__exit__` should be annotated with `o | = help: Annotate star-args with `object` -ℹ Safe fix +Suggested fix: 51 51 | 52 52 | 53 53 | class BadOne: @@ -20,6 +20,8 @@ PYI036.pyi:54:31: PYI036 [*] Star-args in `__exit__` should be annotated with `o 56 56 | 57 57 | class BadTwo: + Run `ruff check --fix` to apply this fix. + PYI036.pyi:55:24: PYI036 If there are no star-args, `__aexit__` should have at least 3 non-keyword-only args (excluding `self`) | 53 | class BadOne: @@ -121,7 +123,7 @@ PYI036.pyi:70:58: PYI036 [*] Star-args in `__exit__` should be annotated with `o | = help: Annotate star-args with `object` -ℹ Safe fix +Suggested fix: 67 67 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException | None, __tb: typing.Union[TracebackType, None, int]) -> bool | None: ... # PYI036: Third arg has bad annotation 68 68 | 69 69 | class BadFive: @@ -131,6 +133,8 @@ PYI036.pyi:70:58: PYI036 [*] Star-args in `__exit__` should be annotated with `o 72 72 | 73 73 | class BadSix: + Run `ruff check --fix` to apply this fix. + PYI036.pyi:71:74: PYI036 [*] Star-args in `__aexit__` should be annotated with `object` | 69 | class BadFive: @@ -142,7 +146,7 @@ PYI036.pyi:71:74: PYI036 [*] Star-args in `__aexit__` should be annotated with ` | = help: Annotate star-args with `object` -ℹ Safe fix +Suggested fix: 68 68 | 69 69 | class BadFive: 70 70 | def __exit__(self, typ: BaseException | None, *args: list[str]) -> bool: ... # PYI036: Bad star-args annotation @@ -152,6 +156,8 @@ PYI036.pyi:71:74: PYI036 [*] Star-args in `__aexit__` should be annotated with ` 73 73 | class BadSix: 74 74 | def __exit__(self, typ, exc, tb, weird_extra_arg, extra_arg2 = None) -> None: ... # PYI036: Extra arg must have default + Run `ruff check --fix` to apply this fix. + PYI036.pyi:74:38: PYI036 All arguments after the first four in `__exit__` must have a default value | 73 | class BadSix: diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap index 19ca04f611b51..bf5d379cc6283 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap @@ -12,7 +12,7 @@ PYI053.pyi:7:14: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | def f1(x: str = "50 character stringggggggggggggggggggggggggggggggg") -> None: ... # OK 6 6 | def f2( @@ -22,6 +22,8 @@ PYI053.pyi:7:14: PYI053 [*] String and bytes literals longer than 50 characters 9 9 | def f3( 10 10 | x: str = "50 character stringgggggggggggggggggggggggggggggg\U0001f600", # OK + Run `ruff check --fix` to apply this fix. + PYI053.pyi:13:14: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 11 | ) -> None: ... @@ -33,7 +35,7 @@ PYI053.pyi:13:14: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -ℹ Safe fix +Suggested fix: 10 10 | x: str = "50 character stringgggggggggggggggggggggggggggggg\U0001f600", # OK 11 11 | ) -> None: ... 12 12 | def f4( @@ -43,6 +45,8 @@ PYI053.pyi:13:14: PYI053 [*] String and bytes literals longer than 50 characters 15 15 | def f5( 16 16 | x: bytes = b"50 character byte stringgggggggggggggggggggggggggg", # OK + Run `ruff check --fix` to apply this fix. + PYI053.pyi:25:16: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 23 | ) -> None: ... @@ -53,7 +57,7 @@ PYI053.pyi:25:16: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -ℹ Safe fix +Suggested fix: 22 22 | x: bytes = b"50 character byte stringggggggggggggggggggggggggg\xff", # OK 23 23 | ) -> None: ... 24 24 | def f8( @@ -63,6 +67,8 @@ PYI053.pyi:25:16: PYI053 [*] String and bytes literals longer than 50 characters 27 27 | 28 28 | foo: str = "50 character stringggggggggggggggggggggggggggggggg" # OK + Run `ruff check --fix` to apply this fix. + PYI053.pyi:30:12: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 28 | foo: str = "50 character stringggggggggggggggggggggggggggggggg" # OK @@ -74,7 +80,7 @@ PYI053.pyi:30:12: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -ℹ Safe fix +Suggested fix: 27 27 | 28 28 | foo: str = "50 character stringggggggggggggggggggggggggggggggg" # OK 29 29 | @@ -84,6 +90,8 @@ PYI053.pyi:30:12: PYI053 [*] String and bytes literals longer than 50 characters 32 32 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK 33 33 | + Run `ruff check --fix` to apply this fix. + PYI053.pyi:34:14: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 32 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK @@ -95,7 +103,7 @@ PYI053.pyi:34:14: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -ℹ Safe fix +Suggested fix: 31 31 | 32 32 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK 33 33 | @@ -105,6 +113,8 @@ PYI053.pyi:34:14: PYI053 [*] String and bytes literals longer than 50 characters 36 36 | ffoo: str = f"50 character stringggggggggggggggggggggggggggggggg" # OK 37 37 | + Run `ruff check --fix` to apply this fix. + PYI053.pyi:38:13: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 36 | ffoo: str = f"50 character stringggggggggggggggggggggggggggggggg" # OK @@ -116,7 +126,7 @@ PYI053.pyi:38:13: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -ℹ Safe fix +Suggested fix: 35 35 | 36 36 | ffoo: str = f"50 character stringggggggggggggggggggggggggggggggg" # OK 37 37 | @@ -126,6 +136,8 @@ PYI053.pyi:38:13: PYI053 [*] String and bytes literals longer than 50 characters 40 40 | class Demo: 41 41 | """Docstrings are excluded from this rule. Some padding.""" # OK + Run `ruff check --fix` to apply this fix. + PYI053.pyi:64:5: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 63 | @not_warnings_dot_deprecated( @@ -136,7 +148,7 @@ PYI053.pyi:64:5: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -ℹ Safe fix +Suggested fix: 61 61 | ) -> Callable[[Callable[[], None]], Callable[[], None]]: ... 62 62 | 63 63 | @not_warnings_dot_deprecated( @@ -146,6 +158,8 @@ PYI053.pyi:64:5: PYI053 [*] String and bytes literals longer than 50 characters 66 66 | def not_a_deprecated_function() -> None: ... 67 67 | + Run `ruff check --fix` to apply this fix. + PYI053.pyi:68:13: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 66 | def not_a_deprecated_function() -> None: ... @@ -155,9 +169,11 @@ PYI053.pyi:68:13: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -ℹ Safe fix +Suggested fix: 65 65 | ) 66 66 | def not_a_deprecated_function() -> None: ... 67 67 | 68 |-fbaz: str = f"51 character {foo} stringgggggggggggggggggggggggggg" # Error: PYI053 68 |+fbaz: str = ... # Error: PYI053 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap index 24457599a3ba0..5d58e19257d1e 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap @@ -11,7 +11,7 @@ PYI054.pyi:2:16: PYI054 [*] Numeric literals with a string representation longer | = help: Replace with `...` -ℹ Safe fix +Suggested fix: 1 1 | field01: int = 0xFFFFFFFF 2 |-field02: int = 0xFFFFFFFFF # Error: PYI054 2 |+field02: int = ... # Error: PYI054 @@ -19,6 +19,8 @@ PYI054.pyi:2:16: PYI054 [*] Numeric literals with a string representation longer 4 4 | field04: int = -0xFFFFFFFFF # Error: PYI054 5 5 | + Run `ruff check --fix` to apply this fix. + PYI054.pyi:4:17: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 2 | field02: int = 0xFFFFFFFFF # Error: PYI054 @@ -30,7 +32,7 @@ PYI054.pyi:4:17: PYI054 [*] Numeric literals with a string representation longer | = help: Replace with `...` -ℹ Safe fix +Suggested fix: 1 1 | field01: int = 0xFFFFFFFF 2 2 | field02: int = 0xFFFFFFFFF # Error: PYI054 3 3 | field03: int = -0xFFFFFFFF @@ -40,6 +42,8 @@ PYI054.pyi:4:17: PYI054 [*] Numeric literals with a string representation longer 6 6 | field05: int = 1234567890 7 7 | field06: int = 12_456_890 + Run `ruff check --fix` to apply this fix. + PYI054.pyi:8:16: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 6 | field05: int = 1234567890 @@ -51,7 +55,7 @@ PYI054.pyi:8:16: PYI054 [*] Numeric literals with a string representation longer | = help: Replace with `...` -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | field05: int = 1234567890 7 7 | field06: int = 12_456_890 @@ -61,6 +65,8 @@ PYI054.pyi:8:16: PYI054 [*] Numeric literals with a string representation longer 10 10 | field09: int = -234_567_890 # Error: PYI054 11 11 | + Run `ruff check --fix` to apply this fix. + PYI054.pyi:10:17: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 8 | field07: int = 12345678901 # Error: PYI054 @@ -72,7 +78,7 @@ PYI054.pyi:10:17: PYI054 [*] Numeric literals with a string representation longe | = help: Replace with `...` -ℹ Safe fix +Suggested fix: 7 7 | field06: int = 12_456_890 8 8 | field07: int = 12345678901 # Error: PYI054 9 9 | field08: int = -1234567801 @@ -82,6 +88,8 @@ PYI054.pyi:10:17: PYI054 [*] Numeric literals with a string representation longe 12 12 | field10: float = 123.456789 13 13 | field11: float = 123.4567890 # Error: PYI054 + Run `ruff check --fix` to apply this fix. + PYI054.pyi:13:18: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 12 | field10: float = 123.456789 @@ -92,7 +100,7 @@ PYI054.pyi:13:18: PYI054 [*] Numeric literals with a string representation longe | = help: Replace with `...` -ℹ Safe fix +Suggested fix: 10 10 | field09: int = -234_567_890 # Error: PYI054 11 11 | 12 12 | field10: float = 123.456789 @@ -102,6 +110,8 @@ PYI054.pyi:13:18: PYI054 [*] Numeric literals with a string representation longe 15 15 | field13: float = -123.567_890 # Error: PYI054 16 16 | + Run `ruff check --fix` to apply this fix. + PYI054.pyi:15:19: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 13 | field11: float = 123.4567890 # Error: PYI054 @@ -113,7 +123,7 @@ PYI054.pyi:15:19: PYI054 [*] Numeric literals with a string representation longe | = help: Replace with `...` -ℹ Safe fix +Suggested fix: 12 12 | field10: float = 123.456789 13 13 | field11: float = 123.4567890 # Error: PYI054 14 14 | field12: float = -123.456789 @@ -123,6 +133,8 @@ PYI054.pyi:15:19: PYI054 [*] Numeric literals with a string representation longe 17 17 | field14: complex = 1e1234567j 18 18 | field15: complex = 1e12345678j # Error: PYI054 + Run `ruff check --fix` to apply this fix. + PYI054.pyi:18:20: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 17 | field14: complex = 1e1234567j @@ -133,7 +145,7 @@ PYI054.pyi:18:20: PYI054 [*] Numeric literals with a string representation longe | = help: Replace with `...` -ℹ Safe fix +Suggested fix: 15 15 | field13: float = -123.567_890 # Error: PYI054 16 16 | 17 17 | field14: complex = 1e1234567j @@ -142,6 +154,8 @@ PYI054.pyi:18:20: PYI054 [*] Numeric literals with a string representation longe 19 19 | field16: complex = -1e1234567j 20 20 | field17: complex = 1e123456789j # Error: PYI054 + Run `ruff check --fix` to apply this fix. + PYI054.pyi:20:20: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 18 | field15: complex = 1e12345678j # Error: PYI054 @@ -151,11 +165,11 @@ PYI054.pyi:20:20: PYI054 [*] Numeric literals with a string representation longe | = help: Replace with `...` -ℹ Safe fix +Suggested fix: 17 17 | field14: complex = 1e1234567j 18 18 | field15: complex = 1e12345678j # Error: PYI054 19 19 | field16: complex = -1e1234567j 20 |-field17: complex = 1e123456789j # Error: PYI054 20 |+field17: complex = ... # Error: PYI054 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.py.snap index e93e79a12d48a..1d4b1ff4d033d 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.py.snap @@ -11,7 +11,7 @@ PYI055.py:31:8: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -ℹ Safe fix +Suggested fix: 28 28 | 29 29 | def func(): 30 30 | # PYI055 @@ -21,6 +21,8 @@ PYI055.py:31:8: PYI055 [*] Multiple `type` members in a union. Combine them into 33 33 | 34 34 | + Run `ruff check --fix` to apply this fix. + PYI055.py:32:8: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[requests_mock.Mocker, httpretty, str]]`. | 30 | # PYI055 @@ -30,7 +32,7 @@ PYI055.py:32:8: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -ℹ Safe fix +Suggested fix: 29 29 | def func(): 30 30 | # PYI055 31 31 | x: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker @@ -40,6 +42,8 @@ PYI055.py:32:8: PYI055 [*] Multiple `type` members in a union. Combine them into 34 34 | 35 35 | def func(): + Run `ruff check --fix` to apply this fix. + PYI055.py:39:8: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[requests_mock.Mocker, httpretty, str]]`. | 38 | # PYI055 @@ -48,7 +52,7 @@ PYI055.py:39:8: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -ℹ Safe fix +Suggested fix: 36 36 | from typing import Union as U 37 37 | 38 38 | # PYI055 @@ -58,6 +62,8 @@ PYI055.py:39:8: PYI055 [*] Multiple `type` members in a union. Combine them into 41 41 | 42 42 | def convert_union(union: UnionType) -> _T | None: + Run `ruff check --fix` to apply this fix. + PYI055.py:44:9: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. | 42 | def convert_union(union: UnionType) -> _T | None: @@ -69,7 +75,7 @@ PYI055.py:44:9: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -ℹ Safe fix +Suggested fix: 41 41 | 42 42 | def convert_union(union: UnionType) -> _T | None: 43 43 | converters: tuple[ @@ -79,6 +85,8 @@ PYI055.py:44:9: PYI055 [*] Multiple `type` members in a union. Combine them into 46 46 | ... 47 47 | + Run `ruff check --fix` to apply this fix. + PYI055.py:50:15: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. | 48 | def convert_union(union: UnionType) -> _T | None: @@ -90,7 +98,7 @@ PYI055.py:50:15: PYI055 [*] Multiple `type` members in a union. Combine them int | = help: Combine multiple `type` members -ℹ Safe fix +Suggested fix: 47 47 | 48 48 | def convert_union(union: UnionType) -> _T | None: 49 49 | converters: tuple[ @@ -100,6 +108,8 @@ PYI055.py:50:15: PYI055 [*] Multiple `type` members in a union. Combine them int 52 52 | ... 53 53 | + Run `ruff check --fix` to apply this fix. + PYI055.py:56:15: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. | 54 | def convert_union(union: UnionType) -> _T | None: @@ -111,7 +121,7 @@ PYI055.py:56:15: PYI055 [*] Multiple `type` members in a union. Combine them int | = help: Combine multiple `type` members -ℹ Safe fix +Suggested fix: 53 53 | 54 54 | def convert_union(union: UnionType) -> _T | None: 55 55 | converters: tuple[ @@ -121,6 +131,8 @@ PYI055.py:56:15: PYI055 [*] Multiple `type` members in a union. Combine them int 58 58 | ... 59 59 | + Run `ruff check --fix` to apply this fix. + PYI055.py:62:15: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. | 60 | def convert_union(union: UnionType) -> _T | None: @@ -132,7 +144,7 @@ PYI055.py:62:15: PYI055 [*] Multiple `type` members in a union. Combine them int | = help: Combine multiple `type` members -ℹ Safe fix +Suggested fix: 59 59 | 60 60 | def convert_union(union: UnionType) -> _T | None: 61 61 | converters: tuple[ @@ -141,4 +153,4 @@ PYI055.py:62:15: PYI055 [*] Multiple `type` members in a union. Combine them int 63 63 | ] = union.__args__ 64 64 | ... - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.pyi.snap index 0e41288be5073..b2d27a7a7f091 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.pyi.snap @@ -12,7 +12,7 @@ PYI055.pyi:4:4: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -ℹ Safe fix +Suggested fix: 1 1 | import builtins 2 2 | from typing import Union 3 3 | @@ -22,6 +22,8 @@ PYI055.pyi:4:4: PYI055 [*] Multiple `type` members in a union. Combine them into 6 6 | y: builtins.type[int] | type[str] | builtins.type[complex] 7 7 | z: Union[type[float], type[complex]] + Run `ruff check --fix` to apply this fix. + PYI055.pyi:5:4: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[int | str | float]`. | 4 | w: builtins.type[int] | builtins.type[str] | builtins.type[complex] @@ -32,7 +34,7 @@ PYI055.pyi:5:4: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -ℹ Safe fix +Suggested fix: 2 2 | from typing import Union 3 3 | 4 4 | w: builtins.type[int] | builtins.type[str] | builtins.type[complex] @@ -42,6 +44,8 @@ PYI055.pyi:5:4: PYI055 [*] Multiple `type` members in a union. Combine them into 7 7 | z: Union[type[float], type[complex]] 8 8 | z: Union[type[float, int], type[complex]] + Run `ruff check --fix` to apply this fix. + PYI055.pyi:6:4: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[int | str | complex]`. | 4 | w: builtins.type[int] | builtins.type[str] | builtins.type[complex] @@ -53,7 +57,7 @@ PYI055.pyi:6:4: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | w: builtins.type[int] | builtins.type[str] | builtins.type[complex] 5 5 | x: type[int] | type[str] | type[float] @@ -63,6 +67,8 @@ PYI055.pyi:6:4: PYI055 [*] Multiple `type` members in a union. Combine them into 8 8 | z: Union[type[float, int], type[complex]] 9 9 | + Run `ruff check --fix` to apply this fix. + PYI055.pyi:7:4: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[float, complex]]`. | 5 | x: type[int] | type[str] | type[float] @@ -73,7 +79,7 @@ PYI055.pyi:7:4: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -ℹ Safe fix +Suggested fix: 4 4 | w: builtins.type[int] | builtins.type[str] | builtins.type[complex] 5 5 | x: type[int] | type[str] | type[float] 6 6 | y: builtins.type[int] | type[str] | builtins.type[complex] @@ -83,6 +89,8 @@ PYI055.pyi:7:4: PYI055 [*] Multiple `type` members in a union. Combine them into 9 9 | 10 10 | def func(arg: type[int] | str | type[float]) -> None: ... + Run `ruff check --fix` to apply this fix. + PYI055.pyi:8:4: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[float, int, complex]]`. | 6 | y: builtins.type[int] | type[str] | builtins.type[complex] @@ -94,7 +102,7 @@ PYI055.pyi:8:4: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -ℹ Safe fix +Suggested fix: 5 5 | x: type[int] | type[str] | type[float] 6 6 | y: builtins.type[int] | type[str] | builtins.type[complex] 7 7 | z: Union[type[float], type[complex]] @@ -104,6 +112,8 @@ PYI055.pyi:8:4: PYI055 [*] Multiple `type` members in a union. Combine them into 10 10 | def func(arg: type[int] | str | type[float]) -> None: ... 11 11 | + Run `ruff check --fix` to apply this fix. + PYI055.pyi:10:15: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[int | float]`. | 8 | z: Union[type[float, int], type[complex]] @@ -115,7 +125,7 @@ PYI055.pyi:10:15: PYI055 [*] Multiple `type` members in a union. Combine them in | = help: Combine multiple `type` members -ℹ Safe fix +Suggested fix: 7 7 | z: Union[type[float], type[complex]] 8 8 | z: Union[type[float, int], type[complex]] 9 9 | @@ -125,6 +135,8 @@ PYI055.pyi:10:15: PYI055 [*] Multiple `type` members in a union. Combine them in 12 12 | # OK 13 13 | x: type[int, str, float] + Run `ruff check --fix` to apply this fix. + PYI055.pyi:20:7: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[requests_mock.Mocker | httpretty]`. | 19 | # OK @@ -135,7 +147,7 @@ PYI055.pyi:20:7: PYI055 [*] Multiple `type` members in a union. Combine them int | = help: Combine multiple `type` members -ℹ Safe fix +Suggested fix: 17 17 | def func(arg: type[int, float] | str) -> None: ... 18 18 | 19 19 | # OK @@ -145,6 +157,8 @@ PYI055.pyi:20:7: PYI055 [*] Multiple `type` members in a union. Combine them int 22 22 | def func(): 23 23 | # PYI055 + Run `ruff check --fix` to apply this fix. + PYI055.pyi:24:11: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[requests_mock.Mocker | httpretty | str]`. | 22 | def func(): @@ -155,7 +169,7 @@ PYI055.pyi:24:11: PYI055 [*] Multiple `type` members in a union. Combine them in | = help: Combine multiple `type` members -ℹ Safe fix +Suggested fix: 21 21 | 22 22 | def func(): 23 23 | # PYI055 @@ -163,6 +177,8 @@ PYI055.pyi:24:11: PYI055 [*] Multiple `type` members in a union. Combine them in 24 |+ item: type[requests_mock.Mocker | httpretty | str] = requests_mock.Mocker 25 25 | item2: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker + Run `ruff check --fix` to apply this fix. + PYI055.pyi:25:12: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[requests_mock.Mocker, httpretty, str]]`. | 23 | # PYI055 @@ -172,11 +188,11 @@ PYI055.pyi:25:12: PYI055 [*] Multiple `type` members in a union. Combine them in | = help: Combine multiple `type` members -ℹ Safe fix +Suggested fix: 22 22 | def func(): 23 23 | # PYI055 24 24 | item: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker 25 |- item2: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker 25 |+ item2: type[Union[requests_mock.Mocker, httpretty, str]] = requests_mock.Mocker - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.py.snap index 67a1ecba57303..5b43a330597bc 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.py.snap @@ -10,7 +10,7 @@ PYI058.py:5:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter | = help: Convert the return annotation of your `__iter__` method to `Iterator` -ℹ Safe fix +Suggested fix: 1 |+from collections.abc import Iterator 1 2 | def scope(): 2 3 | from collections.abc import Generator @@ -22,6 +22,8 @@ PYI058.py:5:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter 7 8 | 8 9 | + Run `ruff check --fix` to apply this fix. + PYI058.py:13:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 12 | class IteratorReturningSimpleGenerator2: @@ -31,7 +33,7 @@ PYI058.py:13:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite | = help: Convert the return annotation of your `__iter__` method to `Iterator` -ℹ Safe fix +Suggested fix: 10 10 | import typing 11 11 | 12 12 | class IteratorReturningSimpleGenerator2: @@ -41,6 +43,8 @@ PYI058.py:13:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite 15 15 | 16 16 | + Run `ruff check --fix` to apply this fix. + PYI058.py:21:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 20 | class IteratorReturningSimpleGenerator3: @@ -50,7 +54,7 @@ PYI058.py:21:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite | = help: Convert the return annotation of your `__iter__` method to `Iterator` -ℹ Safe fix +Suggested fix: 18 18 | import collections.abc 19 19 | 20 20 | class IteratorReturningSimpleGenerator3: @@ -60,6 +64,8 @@ PYI058.py:21:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite 23 23 | 24 24 | + Run `ruff check --fix` to apply this fix. + PYI058.py:30:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 29 | class IteratorReturningSimpleGenerator4: @@ -69,7 +75,7 @@ PYI058.py:30:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite | = help: Convert the return annotation of your `__iter__` method to `Iterator` -ℹ Safe fix +Suggested fix: 27 27 | from typing import Any 28 28 | 29 29 | class IteratorReturningSimpleGenerator4: @@ -79,6 +85,8 @@ PYI058.py:30:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite 32 32 | 33 33 | + Run `ruff check --fix` to apply this fix. + PYI058.py:39:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 38 | class IteratorReturningSimpleGenerator5: @@ -88,7 +96,7 @@ PYI058.py:39:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite | = help: Convert the return annotation of your `__iter__` method to `Iterator` -ℹ Safe fix +Suggested fix: 36 36 | import typing 37 37 | 38 38 | class IteratorReturningSimpleGenerator5: @@ -98,6 +106,8 @@ PYI058.py:39:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite 41 41 | 42 42 | + Run `ruff check --fix` to apply this fix. + PYI058.py:47:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 46 | class IteratorReturningSimpleGenerator6: @@ -107,7 +117,7 @@ PYI058.py:47:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite | = help: Convert the return annotation of your `__iter__` method to `Iterator` -ℹ Safe fix +Suggested fix: 1 |+from collections.abc import Iterator 1 2 | def scope(): 2 3 | from collections.abc import Generator @@ -122,6 +132,8 @@ PYI058.py:47:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite 49 50 | 50 51 | + Run `ruff check --fix` to apply this fix. + PYI058.py:55:13: PYI058 [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods | 54 | class AsyncIteratorReturningSimpleAsyncGenerator1: @@ -132,7 +144,7 @@ PYI058.py:55:13: PYI058 [*] Use `AsyncIterator` as the return value for simple ` | = help: Convert the return annotation of your `__aiter__` method to `AsyncIterator` -ℹ Safe fix +Suggested fix: 54 54 | class AsyncIteratorReturningSimpleAsyncGenerator1: 55 55 | def __aiter__( 56 56 | self, @@ -142,6 +154,8 @@ PYI058.py:55:13: PYI058 [*] Use `AsyncIterator` as the return value for simple ` 59 59 | 60 60 | + Run `ruff check --fix` to apply this fix. + PYI058.py:73:13: PYI058 [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods | 72 | class AsyncIteratorReturningSimpleAsyncGenerator3: @@ -151,7 +165,7 @@ PYI058.py:73:13: PYI058 [*] Use `AsyncIterator` as the return value for simple ` | = help: Convert the return annotation of your `__aiter__` method to `AsyncIterator` -ℹ Safe fix +Suggested fix: 70 70 | import collections.abc 71 71 | 72 72 | class AsyncIteratorReturningSimpleAsyncGenerator3: @@ -161,4 +175,4 @@ PYI058.py:73:13: PYI058 [*] Use `AsyncIterator` as the return value for simple ` 75 75 | 76 76 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap index 9da7931b514db..f25449e417c05 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap @@ -11,7 +11,7 @@ PYI058.pyi:5:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite | = help: Convert the return annotation of your `__iter__` method to `Iterator` -ℹ Safe fix +Suggested fix: 1 |+from collections.abc import Iterator 1 2 | def scope(): 2 3 | from collections.abc import Generator @@ -23,6 +23,8 @@ PYI058.pyi:5:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite 7 8 | def scope(): 8 9 | import typing + Run `ruff check --fix` to apply this fix. + PYI058.pyi:11:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 10 | class IteratorReturningSimpleGenerator2: @@ -33,7 +35,7 @@ PYI058.pyi:11:13: PYI058 [*] Use `Iterator` as the return value for simple `__it | = help: Convert the return annotation of your `__iter__` method to `Iterator` -ℹ Safe fix +Suggested fix: 8 8 | import typing 9 9 | 10 10 | class IteratorReturningSimpleGenerator2: @@ -43,6 +45,8 @@ PYI058.pyi:11:13: PYI058 [*] Use `Iterator` as the return value for simple `__it 13 13 | def scope(): 14 14 | import collections.abc + Run `ruff check --fix` to apply this fix. + PYI058.pyi:17:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 16 | class IteratorReturningSimpleGenerator3: @@ -53,7 +57,7 @@ PYI058.pyi:17:13: PYI058 [*] Use `Iterator` as the return value for simple `__it | = help: Convert the return annotation of your `__iter__` method to `Iterator` -ℹ Safe fix +Suggested fix: 14 14 | import collections.abc 15 15 | 16 16 | class IteratorReturningSimpleGenerator3: @@ -63,6 +67,8 @@ PYI058.pyi:17:13: PYI058 [*] Use `Iterator` as the return value for simple `__it 19 19 | def scope(): 20 20 | import collections.abc + Run `ruff check --fix` to apply this fix. + PYI058.pyi:24:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 23 | class IteratorReturningSimpleGenerator4: @@ -73,7 +79,7 @@ PYI058.pyi:24:13: PYI058 [*] Use `Iterator` as the return value for simple `__it | = help: Convert the return annotation of your `__iter__` method to `Iterator` -ℹ Safe fix +Suggested fix: 21 21 | from typing import Any 22 22 | 23 23 | class IteratorReturningSimpleGenerator4: @@ -83,6 +89,8 @@ PYI058.pyi:24:13: PYI058 [*] Use `Iterator` as the return value for simple `__it 26 26 | def scope(): 27 27 | import collections.abc + Run `ruff check --fix` to apply this fix. + PYI058.pyi:31:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 30 | class IteratorReturningSimpleGenerator5: @@ -93,7 +101,7 @@ PYI058.pyi:31:13: PYI058 [*] Use `Iterator` as the return value for simple `__it | = help: Convert the return annotation of your `__iter__` method to `Iterator` -ℹ Safe fix +Suggested fix: 28 28 | import typing 29 29 | 30 30 | class IteratorReturningSimpleGenerator5: @@ -103,6 +111,8 @@ PYI058.pyi:31:13: PYI058 [*] Use `Iterator` as the return value for simple `__it 33 33 | def scope(): 34 34 | from collections.abc import Generator + Run `ruff check --fix` to apply this fix. + PYI058.pyi:37:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 36 | class IteratorReturningSimpleGenerator6: @@ -113,7 +123,7 @@ PYI058.pyi:37:13: PYI058 [*] Use `Iterator` as the return value for simple `__it | = help: Convert the return annotation of your `__iter__` method to `Iterator` -ℹ Safe fix +Suggested fix: 1 |+from collections.abc import Iterator 1 2 | def scope(): 2 3 | from collections.abc import Generator @@ -128,6 +138,8 @@ PYI058.pyi:37:13: PYI058 [*] Use `Iterator` as the return value for simple `__it 39 40 | def scope(): 40 41 | import typing_extensions + Run `ruff check --fix` to apply this fix. + PYI058.pyi:43:13: PYI058 [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods | 42 | class AsyncIteratorReturningSimpleAsyncGenerator1: @@ -138,7 +150,7 @@ PYI058.pyi:43:13: PYI058 [*] Use `AsyncIterator` as the return value for simple | = help: Convert the return annotation of your `__aiter__` method to `AsyncIterator` -ℹ Safe fix +Suggested fix: 40 40 | import typing_extensions 41 41 | 42 42 | class AsyncIteratorReturningSimpleAsyncGenerator1: @@ -148,6 +160,8 @@ PYI058.pyi:43:13: PYI058 [*] Use `AsyncIterator` as the return value for simple 45 45 | def scope(): 46 46 | import collections.abc + Run `ruff check --fix` to apply this fix. + PYI058.pyi:49:13: PYI058 [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods | 48 | class AsyncIteratorReturningSimpleAsyncGenerator3: @@ -157,7 +171,7 @@ PYI058.pyi:49:13: PYI058 [*] Use `AsyncIterator` as the return value for simple | = help: Convert the return annotation of your `__aiter__` method to `AsyncIterator` -ℹ Safe fix +Suggested fix: 46 46 | import collections.abc 47 47 | 48 48 | class AsyncIteratorReturningSimpleAsyncGenerator3: @@ -167,6 +181,8 @@ PYI058.pyi:49:13: PYI058 [*] Use `AsyncIterator` as the return value for simple 51 51 | 52 52 | def scope(): + Run `ruff check --fix` to apply this fix. + PYI058.pyi:56:13: PYI058 [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods | 55 | class AsyncIteratorReturningSimpleAsyncGenerator3: @@ -177,7 +193,7 @@ PYI058.pyi:56:13: PYI058 [*] Use `AsyncIterator` as the return value for simple | = help: Convert the return annotation of your `__aiter__` method to `AsyncIterator` -ℹ Safe fix +Suggested fix: 53 53 | import collections.abc 54 54 | 55 55 | class AsyncIteratorReturningSimpleAsyncGenerator3: @@ -187,4 +203,4 @@ PYI058.pyi:56:13: PYI058 [*] Use `AsyncIterator` as the return value for simple 58 58 | def scope(): 59 59 | from typing import Iterator - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap index bcb28618ff3c8..0d996b58020cb 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap @@ -12,7 +12,7 @@ PYI059.py:8:17: PYI059 [*] `Generic[]` should always be the last base class | = help: Move `Generic[]` to the end -ℹ Safe fix +Suggested fix: 5 5 | K = TypeVar('K') 6 6 | V = TypeVar('V') 7 7 | @@ -22,6 +22,8 @@ PYI059.py:8:17: PYI059 [*] `Generic[]` should always be the last base class 10 10 | self._items: List[T] = [] 11 11 | + Run `ruff check --fix` to apply this fix. + PYI059.py:15:16: PYI059 [*] `Generic[]` should always be the last base class | 13 | self._items.append(item) @@ -37,7 +39,7 @@ PYI059.py:15:16: PYI059 [*] `Generic[]` should always be the last base class | = help: Move `Generic[]` to the end -ℹ Safe fix +Suggested fix: 13 13 | self._items.append(item) 14 14 | 15 15 | class MyMapping( # PYI059 @@ -49,6 +51,8 @@ PYI059.py:15:16: PYI059 [*] `Generic[]` should always be the last base class 20 19 | ... 21 20 | + Run `ruff check --fix` to apply this fix. + PYI059.py:26:10: PYI059 [*] `Generic[]` should always be the last base class | 24 | # to flag this issue in this case as well, since after fixing the error @@ -59,7 +63,7 @@ PYI059.py:26:10: PYI059 [*] `Generic[]` should always be the last base class | = help: Move `Generic[]` to the end -ℹ Safe fix +Suggested fix: 23 23 | # Inheriting from just `Generic` is a TypeError, but it's probably fine 24 24 | # to flag this issue in this case as well, since after fixing the error 25 25 | # the Generic's position issue persists. @@ -69,6 +73,8 @@ PYI059.py:26:10: PYI059 [*] `Generic[]` should always be the last base class 28 28 | 29 29 | + Run `ruff check --fix` to apply this fix. + PYI059.py:30:10: PYI059 [*] `Generic[]` should always be the last base class | 30 | class Foo( # comment about the bracket @@ -88,7 +94,7 @@ PYI059.py:30:10: PYI059 [*] `Generic[]` should always be the last base class | = help: Move `Generic[]` to the end -ℹ Safe fix +Suggested fix: 30 30 | class Foo( # comment about the bracket 31 31 | # Part 1 of multiline comment 1 32 32 | # Part 2 of multiline comment 1 @@ -104,6 +110,8 @@ PYI059.py:30:10: PYI059 [*] `Generic[]` should always be the last base class 40 38 | ): # and another one for good measure 41 39 | ... + Run `ruff check --fix` to apply this fix. + PYI059.py:45:8: PYI059 `Generic[]` should always be the last base class | 44 | # in case of multiple Generic[] inheritance, don't fix it. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap index eec9fa9f22c4c..8faa775a90c76 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap @@ -12,7 +12,7 @@ PYI059.pyi:8:17: PYI059 [*] `Generic[]` should always be the last base class | = help: Move `Generic[]` to the end -ℹ Safe fix +Suggested fix: 5 5 | K = TypeVar('K') 6 6 | V = TypeVar('V') 7 7 | @@ -22,6 +22,8 @@ PYI059.pyi:8:17: PYI059 [*] `Generic[]` should always be the last base class 10 10 | def push(self, item: T) -> None: ... 11 11 | + Run `ruff check --fix` to apply this fix. + PYI059.pyi:12:16: PYI059 [*] `Generic[]` should always be the last base class | 10 | def push(self, item: T) -> None: ... @@ -37,7 +39,7 @@ PYI059.pyi:12:16: PYI059 [*] `Generic[]` should always be the last base class | = help: Move `Generic[]` to the end -ℹ Safe fix +Suggested fix: 10 10 | def push(self, item: T) -> None: ... 11 11 | 12 12 | class MyMapping( # PYI059 @@ -49,6 +51,8 @@ PYI059.pyi:12:16: PYI059 [*] `Generic[]` should always be the last base class 17 16 | ... 18 17 | + Run `ruff check --fix` to apply this fix. + PYI059.pyi:22:10: PYI059 [*] `Generic[]` should always be the last base class | 20 | # to flag this issue in this case as well, since after fixing the error @@ -58,7 +62,7 @@ PYI059.pyi:22:10: PYI059 [*] `Generic[]` should always be the last base class | = help: Move `Generic[]` to the end -ℹ Safe fix +Suggested fix: 19 19 | # Inheriting from just `Generic` is a TypeError, but it's probably fine 20 20 | # to flag this issue in this case as well, since after fixing the error 21 21 | # the Generic's position issue persists. @@ -68,6 +72,8 @@ PYI059.pyi:22:10: PYI059 [*] `Generic[]` should always be the last base class 24 24 | 25 25 | class Foo( # comment about the bracket + Run `ruff check --fix` to apply this fix. + PYI059.pyi:25:10: PYI059 [*] `Generic[]` should always be the last base class | 25 | class Foo( # comment about the bracket @@ -87,7 +93,7 @@ PYI059.pyi:25:10: PYI059 [*] `Generic[]` should always be the last base class | = help: Move `Generic[]` to the end -ℹ Safe fix +Suggested fix: 25 25 | class Foo( # comment about the bracket 26 26 | # Part 1 of multiline comment 1 27 27 | # Part 2 of multiline comment 1 @@ -103,6 +109,8 @@ PYI059.pyi:25:10: PYI059 [*] `Generic[]` should always be the last base class 35 33 | ): # and another one for good measure 36 34 | ... + Run `ruff check --fix` to apply this fix. + PYI059.pyi:40:8: PYI059 `Generic[]` should always be the last base class | 39 | # in case of multiple Generic[] inheritance, don't fix it. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap index 4e441d5012a1f..29434230bf97a 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap @@ -12,7 +12,7 @@ PYI064.py:3:1: PYI064 [*] `Final[Literal[True]]` can be replaced with a bare `Fi | = help: Replace with `Final` -ℹ Safe fix +Suggested fix: 1 1 | from typing import Final, Literal 2 2 | 3 |-x: Final[Literal[True]] = True # PYI064 @@ -21,6 +21,8 @@ PYI064.py:3:1: PYI064 [*] `Final[Literal[True]]` can be replaced with a bare `Fi 5 5 | z: Final[Literal[ # PYI064 6 6 | "this is a really long literal, that won't be rendered in the issue text" + Run `ruff check --fix` to apply this fix. + PYI064.py:4:1: PYI064 [*] `Final[Literal[None]]` can be replaced with a bare `Final` | 3 | x: Final[Literal[True]] = True # PYI064 @@ -31,7 +33,7 @@ PYI064.py:4:1: PYI064 [*] `Final[Literal[None]]` can be replaced with a bare `Fi | = help: Replace with `Final` -ℹ Safe fix +Suggested fix: 1 1 | from typing import Final, Literal 2 2 | 3 3 | x: Final[Literal[True]] = True # PYI064 @@ -41,6 +43,8 @@ PYI064.py:4:1: PYI064 [*] `Final[Literal[None]]` can be replaced with a bare `Fi 6 6 | "this is a really long literal, that won't be rendered in the issue text" 7 7 | ]] = "this is a really long literal, that won't be rendered in the issue text" + Run `ruff check --fix` to apply this fix. + PYI064.py:5:1: PYI064 [*] `Final[Literal[...]]` can be replaced with a bare `Final` | 3 | x: Final[Literal[True]] = True # PYI064 @@ -54,7 +58,7 @@ PYI064.py:5:1: PYI064 [*] `Final[Literal[...]]` can be replaced with a bare `Fin | = help: Replace with `Final` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | x: Final[Literal[True]] = True # PYI064 4 4 | y: Final[Literal[None]] = None # PYI064 @@ -66,6 +70,8 @@ PYI064.py:5:1: PYI064 [*] `Final[Literal[...]]` can be replaced with a bare `Fin 9 7 | # This should be fixable, and marked as safe 10 8 | w1: Final[Literal[123]] # PYI064 + Run `ruff check --fix` to apply this fix. + PYI064.py:10:1: PYI064 [*] `Final[Literal[123]]` can be replaced with a bare `Final` | 9 | # This should be fixable, and marked as safe @@ -76,7 +82,7 @@ PYI064.py:10:1: PYI064 [*] `Final[Literal[123]]` can be replaced with a bare `Fi | = help: Replace with `Final` -ℹ Safe fix +Suggested fix: 7 7 | ]] = "this is a really long literal, that won't be rendered in the issue text" 8 8 | 9 9 | # This should be fixable, and marked as safe @@ -86,6 +92,8 @@ PYI064.py:10:1: PYI064 [*] `Final[Literal[123]]` can be replaced with a bare `Fi 12 12 | # This should not be fixable 13 13 | w2: Final[Literal[123]] = "random value" # PYI064 + Run `ruff check --fix` to apply this fix. + PYI064.py:13:1: PYI064 `Final[Literal[123]]` can be replaced with a bare `Final` | 12 | # This should not be fixable diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap index 2c25d8adc5f36..54fd185434f61 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap @@ -12,7 +12,7 @@ PYI064.pyi:3:1: PYI064 [*] `Final[Literal[True]]` can be replaced with a bare `F | = help: Replace with `Final` -ℹ Safe fix +Suggested fix: 1 1 | from typing import Final, Literal 2 2 | 3 |-x: Final[Literal[True]] # PYI064 @@ -21,6 +21,8 @@ PYI064.pyi:3:1: PYI064 [*] `Final[Literal[True]]` can be replaced with a bare `F 5 5 | z: Final[Literal["this is a really long literal, that won't be rendered in the issue text"]] # PYI064 6 6 | + Run `ruff check --fix` to apply this fix. + PYI064.pyi:4:1: PYI064 [*] `Final[Literal[None]]` can be replaced with a bare `Final` | 3 | x: Final[Literal[True]] # PYI064 @@ -30,7 +32,7 @@ PYI064.pyi:4:1: PYI064 [*] `Final[Literal[None]]` can be replaced with a bare `F | = help: Replace with `Final` -ℹ Safe fix +Suggested fix: 1 1 | from typing import Final, Literal 2 2 | 3 3 | x: Final[Literal[True]] # PYI064 @@ -40,6 +42,8 @@ PYI064.pyi:4:1: PYI064 [*] `Final[Literal[None]]` can be replaced with a bare `F 6 6 | 7 7 | # This should be fixable, and marked as safe + Run `ruff check --fix` to apply this fix. + PYI064.pyi:5:1: PYI064 [*] `Final[Literal[...]]` can be replaced with a bare `Final` | 3 | x: Final[Literal[True]] # PYI064 @@ -51,7 +55,7 @@ PYI064.pyi:5:1: PYI064 [*] `Final[Literal[...]]` can be replaced with a bare `Fi | = help: Replace with `Final` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | x: Final[Literal[True]] # PYI064 4 4 | y: Final[Literal[None]] = None # PYI064 @@ -61,6 +65,8 @@ PYI064.pyi:5:1: PYI064 [*] `Final[Literal[...]]` can be replaced with a bare `Fi 7 7 | # This should be fixable, and marked as safe 8 8 | w1: Final[Literal[123]] # PYI064 + Run `ruff check --fix` to apply this fix. + PYI064.pyi:8:1: PYI064 [*] `Final[Literal[123]]` can be replaced with a bare `Final` | 7 | # This should be fixable, and marked as safe @@ -71,7 +77,7 @@ PYI064.pyi:8:1: PYI064 [*] `Final[Literal[123]]` can be replaced with a bare `Fi | = help: Replace with `Final` -ℹ Safe fix +Suggested fix: 5 5 | z: Final[Literal["this is a really long literal, that won't be rendered in the issue text"]] # PYI064 6 6 | 7 7 | # This should be fixable, and marked as safe @@ -81,6 +87,8 @@ PYI064.pyi:8:1: PYI064 [*] `Final[Literal[123]]` can be replaced with a bare `Fi 10 10 | # This should not be fixable 11 11 | w2: Final[Literal[123]] = "random value" # PYI064 + Run `ruff check --fix` to apply this fix. + PYI064.pyi:11:1: PYI064 `Final[Literal[123]]` can be replaced with a bare `Final` | 10 | # This should not be fixable diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap index 7c5cd3152327a..ec8fe0f81320d 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap @@ -12,7 +12,7 @@ PYI026.pyi:3:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g | = help: Add `TypeAlias` annotation -ℹ Safe fix +Suggested fix: 1 1 | from typing import Literal, Any 2 |+import typing_extensions 2 3 | @@ -22,6 +22,8 @@ PYI026.pyi:3:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g 5 6 | Foo = Literal["foo"] 6 7 | IntOrStr = int | str + Run `ruff check --fix` to apply this fix. + PYI026.pyi:4:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]` | 3 | NewAny = Any @@ -32,7 +34,7 @@ PYI026.pyi:4:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g | = help: Add `TypeAlias` annotation -ℹ Safe fix +Suggested fix: 1 1 | from typing import Literal, Any 2 |+import typing_extensions 2 3 | @@ -43,6 +45,8 @@ PYI026.pyi:4:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g 6 7 | IntOrStr = int | str 7 8 | AliasNone = None + Run `ruff check --fix` to apply this fix. + PYI026.pyi:5:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]` | 3 | NewAny = Any @@ -54,7 +58,7 @@ PYI026.pyi:5:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g | = help: Add `TypeAlias` annotation -ℹ Safe fix +Suggested fix: 1 1 | from typing import Literal, Any 2 |+import typing_extensions 2 3 | @@ -66,6 +70,8 @@ PYI026.pyi:5:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g 7 8 | AliasNone = None 8 9 | + Run `ruff check --fix` to apply this fix. + PYI026.pyi:6:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str` | 4 | OptionalStr = typing.Optional[str] @@ -76,7 +82,7 @@ PYI026.pyi:6:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g | = help: Add `TypeAlias` annotation -ℹ Safe fix +Suggested fix: 1 1 | from typing import Literal, Any 2 |+import typing_extensions 2 3 | @@ -89,6 +95,8 @@ PYI026.pyi:6:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g 8 9 | 9 10 | NewAny: typing.TypeAlias = Any + Run `ruff check --fix` to apply this fix. + PYI026.pyi:7:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None` | 5 | Foo = Literal["foo"] @@ -100,7 +108,7 @@ PYI026.pyi:7:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g | = help: Add `TypeAlias` annotation -ℹ Safe fix +Suggested fix: 1 1 | from typing import Literal, Any 2 |+import typing_extensions 2 3 | @@ -114,6 +122,8 @@ PYI026.pyi:7:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g 9 10 | NewAny: typing.TypeAlias = Any 10 11 | OptionalStr: TypeAlias = typing.Optional[str] + Run `ruff check --fix` to apply this fix. + PYI026.pyi:17:5: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `FLAG_THIS: TypeAlias = None` | 16 | class NotAnEnum: @@ -124,7 +134,7 @@ PYI026.pyi:17:5: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e. | = help: Add `TypeAlias` annotation -ℹ Safe fix +Suggested fix: 1 1 | from typing import Literal, Any 2 |+import typing_extensions 2 3 | @@ -139,3 +149,5 @@ PYI026.pyi:17:5: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e. 18 19 | 19 20 | # these are ok 20 21 | from enum import Enum + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_default.snap index ebb023025c2cd..ddc5c50905aac 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_default.snap @@ -10,7 +10,7 @@ PT001.py:9:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` | = help: Add parentheses -ℹ Safe fix +Suggested fix: 6 6 | # `import pytest` 7 7 | 8 8 | @@ -20,6 +20,8 @@ PT001.py:9:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` 11 11 | return 42 12 12 | + Run `ruff check --fix` to apply this fix. + PT001.py:34:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` | 34 | @fixture @@ -29,7 +31,7 @@ PT001.py:34:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` | = help: Add parentheses -ℹ Safe fix +Suggested fix: 31 31 | # `from pytest import fixture` 32 32 | 33 33 | @@ -39,6 +41,8 @@ PT001.py:34:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` 36 36 | return 42 37 37 | + Run `ruff check --fix` to apply this fix. + PT001.py:59:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` | 59 | @aliased @@ -48,7 +52,7 @@ PT001.py:59:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` | = help: Add parentheses -ℹ Safe fix +Suggested fix: 56 56 | # `from pytest import fixture as aliased` 57 57 | 58 58 | @@ -58,4 +62,4 @@ PT001.py:59:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` 61 61 | return 42 62 62 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_no_parentheses.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_no_parentheses.snap index e508652be8397..f0a1b418433a9 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_no_parentheses.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_no_parentheses.snap @@ -10,7 +10,7 @@ PT001.py:14:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | = help: Remove parentheses -ℹ Safe fix +Suggested fix: 11 11 | return 42 12 12 | 13 13 | @@ -20,6 +20,8 @@ PT001.py:14:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` 16 16 | return 42 17 17 | + Run `ruff check --fix` to apply this fix. + PT001.py:24:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | 24 | / @pytest.fixture( @@ -31,7 +33,7 @@ PT001.py:24:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | = help: Remove parentheses -ℹ Safe fix +Suggested fix: 21 21 | return 42 22 22 | 23 23 | @@ -43,6 +45,8 @@ PT001.py:24:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` 28 26 | return 42 29 27 | + Run `ruff check --fix` to apply this fix. + PT001.py:39:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | 39 | @fixture() @@ -52,7 +56,7 @@ PT001.py:39:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | = help: Remove parentheses -ℹ Safe fix +Suggested fix: 36 36 | return 42 37 37 | 38 38 | @@ -62,6 +66,8 @@ PT001.py:39:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` 41 41 | return 42 42 42 | + Run `ruff check --fix` to apply this fix. + PT001.py:49:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | 49 | / @fixture( @@ -73,7 +79,7 @@ PT001.py:49:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | = help: Remove parentheses -ℹ Safe fix +Suggested fix: 46 46 | return 42 47 47 | 48 48 | @@ -85,6 +91,8 @@ PT001.py:49:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` 53 51 | return 42 54 52 | + Run `ruff check --fix` to apply this fix. + PT001.py:64:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | 64 | @aliased() @@ -94,7 +102,7 @@ PT001.py:64:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | = help: Remove parentheses -ℹ Safe fix +Suggested fix: 61 61 | return 42 62 62 | 63 63 | @@ -104,6 +112,8 @@ PT001.py:64:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` 66 66 | return 42 67 67 | + Run `ruff check --fix` to apply this fix. + PT001.py:74:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | 74 | / @aliased( @@ -115,7 +125,7 @@ PT001.py:74:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | = help: Remove parentheses -ℹ Safe fix +Suggested fix: 71 71 | return 42 72 72 | 73 73 | @@ -126,4 +136,4 @@ PT001.py:74:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` 77 75 | def aliased_parentheses_no_params_multiline(): 78 76 | return 42 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap index 1e7536acab7f0..0f8d2b2a3c4ee 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap @@ -10,7 +10,7 @@ PT003.py:14:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -ℹ Unsafe fix +Suggested fix: 11 11 | ... 12 12 | 13 13 | @@ -20,6 +20,8 @@ PT003.py:14:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` 16 16 | ... 17 17 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT003.py:19:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | 19 | @pytest.fixture(scope="function", name="my_fixture") @@ -29,7 +31,7 @@ PT003.py:19:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -ℹ Unsafe fix +Suggested fix: 16 16 | ... 17 17 | 18 18 | @@ -39,6 +41,8 @@ PT003.py:19:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` 21 21 | ... 22 22 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT003.py:24:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | 24 | @pytest.fixture(name="my_fixture", scope="function") @@ -48,7 +52,7 @@ PT003.py:24:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -ℹ Unsafe fix +Suggested fix: 21 21 | ... 22 22 | 23 23 | @@ -58,6 +62,8 @@ PT003.py:24:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` 26 26 | ... 27 27 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT003.py:29:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | 29 | @pytest.fixture(name="my_fixture", scope="function", **kwargs) @@ -67,7 +73,7 @@ PT003.py:29:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -ℹ Unsafe fix +Suggested fix: 26 26 | ... 27 27 | 28 28 | @@ -77,6 +83,8 @@ PT003.py:29:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` 31 31 | ... 32 32 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT003.py:37:31: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | 35 | # tests the general case as we use a helper function that should @@ -88,7 +96,7 @@ PT003.py:37:31: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -ℹ Unsafe fix +Suggested fix: 34 34 | # pytest.fixture does not take positional arguments, however this 35 35 | # tests the general case as we use a helper function that should 36 36 | # work for all cases. @@ -98,6 +106,8 @@ PT003.py:37:31: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` 39 39 | ... 40 40 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT003.py:43:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | 42 | @pytest.fixture( @@ -108,7 +118,7 @@ PT003.py:43:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -ℹ Unsafe fix +Suggested fix: 40 40 | 41 41 | 42 42 | @pytest.fixture( @@ -117,6 +127,8 @@ PT003.py:43:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` 45 44 | ) 46 45 | def error_multiple_args(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT003.py:52:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | 50 | @pytest.fixture( @@ -128,7 +140,7 @@ PT003.py:52:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -ℹ Unsafe fix +Suggested fix: 49 49 | 50 50 | @pytest.fixture( 51 51 | name="my_fixture", @@ -137,6 +149,8 @@ PT003.py:52:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` 54 53 | def error_multiple_args(): 55 54 | ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT003.py:66:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | 64 | # another comment ,) @@ -149,7 +163,7 @@ PT003.py:66:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -ℹ Unsafe fix +Suggested fix: 63 63 | 64 64 | # another comment ,) 65 65 | @@ -161,4 +175,4 @@ PT003.py:66:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` 71 67 | ) 72 68 | def error_multiple_args(): - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap index 2f17c775677ee..8985498320d84 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap @@ -10,7 +10,7 @@ PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string of comma-separated values for the first argument -ℹ Unsafe fix +Suggested fix: 21 21 | ... 22 22 | 23 23 | @@ -20,6 +20,8 @@ PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 26 26 | ... 27 27 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` | 29 | @pytest.mark.parametrize(("param1",), [1, 2, 3]) @@ -29,7 +31,7 @@ PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string for the first argument -ℹ Safe fix +Suggested fix: 26 26 | ... 27 27 | 28 28 | @@ -39,6 +41,8 @@ PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 31 31 | ... 32 32 | + Run `ruff check --fix` to apply this fix. + PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected a string of comma-separated values | 34 | @pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) @@ -48,7 +52,7 @@ PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string of comma-separated values for the first argument -ℹ Unsafe fix +Suggested fix: 31 31 | ... 32 32 | 33 33 | @@ -58,6 +62,8 @@ PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 36 36 | ... 37 37 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` | 39 | @pytest.mark.parametrize(["param1"], [1, 2, 3]) @@ -67,7 +73,7 @@ PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string for the first argument -ℹ Safe fix +Suggested fix: 36 36 | ... 37 37 | 38 38 | @@ -77,6 +83,8 @@ PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 41 41 | ... 42 42 | + Run `ruff check --fix` to apply this fix. + PT006.py:44:26: PT006 Wrong type passed to first argument of `@pytest.mark.parametrize`; expected a string of comma-separated values | 44 | @pytest.mark.parametrize([some_expr, another_expr], [1, 2, 3]) diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap index 2942fa06d4dc9..dba252fbb5030 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap @@ -10,7 +10,7 @@ PT006.py:9:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.pa | = help: Use a `tuple` for the first argument -ℹ Unsafe fix +Suggested fix: 6 6 | ... 7 7 | 8 8 | @@ -20,6 +20,8 @@ PT006.py:9:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.pa 11 11 | ... 12 12 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | 14 | @pytest.mark.parametrize(" param1, , param2 , ", [(1, 2), (3, 4)]) @@ -29,7 +31,7 @@ PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -ℹ Unsafe fix +Suggested fix: 11 11 | ... 12 12 | 13 13 | @@ -39,6 +41,8 @@ PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 16 16 | ... 17 17 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | 19 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) @@ -48,7 +52,7 @@ PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -ℹ Unsafe fix +Suggested fix: 16 16 | ... 17 17 | 18 18 | @@ -58,6 +62,8 @@ PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 21 21 | ... 22 22 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` | 29 | @pytest.mark.parametrize(("param1",), [1, 2, 3]) @@ -67,7 +73,7 @@ PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string for the first argument -ℹ Safe fix +Suggested fix: 26 26 | ... 27 27 | 28 28 | @@ -77,6 +83,8 @@ PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 31 31 | ... 32 32 | + Run `ruff check --fix` to apply this fix. + PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | 34 | @pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) @@ -86,7 +94,7 @@ PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -ℹ Unsafe fix +Suggested fix: 31 31 | ... 32 32 | 33 33 | @@ -96,6 +104,8 @@ PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 36 36 | ... 37 37 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` | 39 | @pytest.mark.parametrize(["param1"], [1, 2, 3]) @@ -105,7 +115,7 @@ PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string for the first argument -ℹ Safe fix +Suggested fix: 36 36 | ... 37 37 | 38 38 | @@ -115,6 +125,8 @@ PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 41 41 | ... 42 42 | + Run `ruff check --fix` to apply this fix. + PT006.py:44:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | 44 | @pytest.mark.parametrize([some_expr, another_expr], [1, 2, 3]) @@ -124,7 +136,7 @@ PT006.py:44:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -ℹ Unsafe fix +Suggested fix: 41 41 | ... 42 42 | 43 43 | @@ -134,6 +146,8 @@ PT006.py:44:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 46 46 | ... 47 47 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:49:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | 49 | @pytest.mark.parametrize([some_expr, "param2"], [1, 2, 3]) @@ -143,7 +157,7 @@ PT006.py:49:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -ℹ Unsafe fix +Suggested fix: 46 46 | ... 47 47 | 48 48 | @@ -153,6 +167,8 @@ PT006.py:49:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 51 51 | ... 52 52 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | 54 | @pytest.mark.parametrize(("param1, " "param2, " "param3"), [(1, 2, 3), (4, 5, 6)]) @@ -162,7 +178,7 @@ PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -ℹ Unsafe fix +Suggested fix: 51 51 | ... 52 52 | 53 53 | @@ -172,6 +188,8 @@ PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 56 56 | ... 57 57 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | 59 | @pytest.mark.parametrize("param1, " "param2, " "param3", [(1, 2, 3), (4, 5, 6)]) @@ -181,7 +199,7 @@ PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -ℹ Unsafe fix +Suggested fix: 56 56 | ... 57 57 | 58 58 | @@ -191,6 +209,8 @@ PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 61 61 | ... 62 62 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | 64 | @pytest.mark.parametrize((("param1, " "param2, " "param3")), [(1, 2, 3), (4, 5, 6)]) @@ -200,7 +220,7 @@ PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -ℹ Unsafe fix +Suggested fix: 61 61 | ... 62 62 | 63 63 | @@ -210,6 +230,8 @@ PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 66 66 | ... 67 67 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:69:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | 69 | @pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)]) @@ -219,7 +241,7 @@ PT006.py:69:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -ℹ Unsafe fix +Suggested fix: 66 66 | ... 67 67 | 68 68 | @@ -227,3 +249,5 @@ PT006.py:69:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 69 |+@pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)]) 70 70 | def test_csv_with_parens(param1, param2): 71 71 | ... + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap index b5c44886ca862..163c9da9d2d7d 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap @@ -10,7 +10,7 @@ PT006.py:9:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.pa | = help: Use a `list` for the first argument -ℹ Unsafe fix +Suggested fix: 6 6 | ... 7 7 | 8 8 | @@ -20,6 +20,8 @@ PT006.py:9:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.pa 11 11 | ... 12 12 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` | 14 | @pytest.mark.parametrize(" param1, , param2 , ", [(1, 2), (3, 4)]) @@ -29,7 +31,7 @@ PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -ℹ Unsafe fix +Suggested fix: 11 11 | ... 12 12 | 13 13 | @@ -39,6 +41,8 @@ PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 16 16 | ... 17 17 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` | 19 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) @@ -48,7 +52,7 @@ PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -ℹ Unsafe fix +Suggested fix: 16 16 | ... 17 17 | 18 18 | @@ -58,6 +62,8 @@ PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 21 21 | ... 22 22 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` | 24 | @pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)]) @@ -67,7 +73,7 @@ PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -ℹ Unsafe fix +Suggested fix: 21 21 | ... 22 22 | 23 23 | @@ -77,6 +83,8 @@ PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 26 26 | ... 27 27 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` | 29 | @pytest.mark.parametrize(("param1",), [1, 2, 3]) @@ -86,7 +94,7 @@ PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string for the first argument -ℹ Safe fix +Suggested fix: 26 26 | ... 27 27 | 28 28 | @@ -96,6 +104,8 @@ PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 31 31 | ... 32 32 | + Run `ruff check --fix` to apply this fix. + PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` | 39 | @pytest.mark.parametrize(["param1"], [1, 2, 3]) @@ -105,7 +115,7 @@ PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string for the first argument -ℹ Safe fix +Suggested fix: 36 36 | ... 37 37 | 38 38 | @@ -115,6 +125,8 @@ PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 41 41 | ... 42 42 | + Run `ruff check --fix` to apply this fix. + PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` | 54 | @pytest.mark.parametrize(("param1, " "param2, " "param3"), [(1, 2, 3), (4, 5, 6)]) @@ -124,7 +136,7 @@ PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -ℹ Unsafe fix +Suggested fix: 51 51 | ... 52 52 | 53 53 | @@ -134,6 +146,8 @@ PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 56 56 | ... 57 57 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` | 59 | @pytest.mark.parametrize("param1, " "param2, " "param3", [(1, 2, 3), (4, 5, 6)]) @@ -143,7 +157,7 @@ PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -ℹ Unsafe fix +Suggested fix: 56 56 | ... 57 57 | 58 58 | @@ -153,6 +167,8 @@ PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 61 61 | ... 62 62 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` | 64 | @pytest.mark.parametrize((("param1, " "param2, " "param3")), [(1, 2, 3), (4, 5, 6)]) @@ -162,7 +178,7 @@ PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -ℹ Unsafe fix +Suggested fix: 61 61 | ... 62 62 | 63 63 | @@ -172,6 +188,8 @@ PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 66 66 | ... 67 67 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT006.py:69:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` | 69 | @pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)]) @@ -181,7 +199,7 @@ PT006.py:69:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -ℹ Unsafe fix +Suggested fix: 66 66 | ... 67 67 | 68 68 | @@ -189,3 +207,5 @@ PT006.py:69:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 69 |+@pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) 70 70 | def test_csv_with_parens(param1, param2): 71 71 | ... + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_lists.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_lists.snap index 1feb8b1d245d0..eba5d9a4e8614 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_lists.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_lists.snap @@ -10,7 +10,7 @@ PT007.py:4:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 1 1 | import pytest 2 2 | 3 3 | @@ -20,6 +20,8 @@ PT007.py:4:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 6 6 | ... 7 7 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:11:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | 9 | @pytest.mark.parametrize( @@ -35,7 +37,7 @@ PT007.py:11:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 8 8 | 9 9 | @pytest.mark.parametrize( 10 10 | ("param1", "param2"), @@ -49,6 +51,8 @@ PT007.py:11:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 16 16 | def test_tuple_of_tuples(param1, param2): 17 17 | ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:12:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | 10 | ("param1", "param2"), @@ -60,7 +64,7 @@ PT007.py:12:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 9 9 | @pytest.mark.parametrize( 10 10 | ("param1", "param2"), 11 11 | ( @@ -70,6 +74,8 @@ PT007.py:12:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 14 14 | ), 15 15 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:13:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | 11 | ( @@ -81,7 +87,7 @@ PT007.py:13:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 10 10 | ("param1", "param2"), 11 11 | ( 12 12 | (1, 2), @@ -91,6 +97,8 @@ PT007.py:13:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 15 15 | ) 16 16 | def test_tuple_of_tuples(param1, param2): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:22:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | 20 | @pytest.mark.parametrize( @@ -106,7 +114,7 @@ PT007.py:22:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 19 19 | 20 20 | @pytest.mark.parametrize( 21 21 | ("param1", "param2"), @@ -120,6 +128,8 @@ PT007.py:22:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 27 27 | def test_tuple_of_lists(param1, param2): 28 28 | ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:39:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | 37 | ("param1", "param2"), @@ -131,7 +141,7 @@ PT007.py:39:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 36 36 | @pytest.mark.parametrize( 37 37 | ("param1", "param2"), 38 38 | [ @@ -141,6 +151,8 @@ PT007.py:39:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 41 41 | ], 42 42 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:40:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | 38 | [ @@ -152,7 +164,7 @@ PT007.py:40:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 37 37 | ("param1", "param2"), 38 38 | [ 39 39 | (1, 2), @@ -162,6 +174,8 @@ PT007.py:40:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 42 42 | ) 43 43 | def test_list_of_tuples(param1, param2): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:81:38: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -172,7 +186,7 @@ PT007.py:81:38: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `list` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 78 78 | 79 79 | 80 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -182,6 +196,8 @@ PT007.py:81:38: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect 83 83 | @pytest.mark.parametrize( 84 84 | "d", + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:81:39: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -192,7 +208,7 @@ PT007.py:81:39: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `list` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 78 78 | 79 79 | 80 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -202,6 +218,8 @@ PT007.py:81:39: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect 83 83 | @pytest.mark.parametrize( 84 84 | "d", + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:81:47: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -212,7 +230,7 @@ PT007.py:81:47: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `list` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 78 78 | 79 79 | 80 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -221,3 +239,5 @@ PT007.py:81:47: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect 82 82 | @pytest.mark.parametrize("d", [3,]) 83 83 | @pytest.mark.parametrize( 84 84 | "d", + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_tuples.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_tuples.snap index 2ee341b846203..fa6d007fdb810 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_tuples.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_tuples.snap @@ -10,7 +10,7 @@ PT007.py:4:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 1 1 | import pytest 2 2 | 3 3 | @@ -20,6 +20,8 @@ PT007.py:4:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 6 6 | ... 7 7 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:11:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | 9 | @pytest.mark.parametrize( @@ -35,7 +37,7 @@ PT007.py:11:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 8 8 | 9 9 | @pytest.mark.parametrize( 10 10 | ("param1", "param2"), @@ -49,6 +51,8 @@ PT007.py:11:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 16 16 | def test_tuple_of_tuples(param1, param2): 17 17 | ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:22:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | 20 | @pytest.mark.parametrize( @@ -64,7 +68,7 @@ PT007.py:22:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 19 19 | 20 20 | @pytest.mark.parametrize( 21 21 | ("param1", "param2"), @@ -78,6 +82,8 @@ PT007.py:22:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 27 27 | def test_tuple_of_lists(param1, param2): 28 28 | ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:23:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | 21 | ("param1", "param2"), @@ -89,7 +95,7 @@ PT007.py:23:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 20 20 | @pytest.mark.parametrize( 21 21 | ("param1", "param2"), 22 22 | ( @@ -99,6 +105,8 @@ PT007.py:23:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 25 25 | ), 26 26 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:24:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | 22 | ( @@ -110,7 +118,7 @@ PT007.py:24:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 21 21 | ("param1", "param2"), 22 22 | ( 23 23 | [1, 2], @@ -120,6 +128,8 @@ PT007.py:24:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 26 26 | ) 27 27 | def test_tuple_of_lists(param1, param2): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:50:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | 48 | ("param1", "param2"), @@ -131,7 +141,7 @@ PT007.py:50:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 47 47 | @pytest.mark.parametrize( 48 48 | ("param1", "param2"), 49 49 | [ @@ -141,6 +151,8 @@ PT007.py:50:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 52 52 | ], 53 53 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:51:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | 49 | [ @@ -152,7 +164,7 @@ PT007.py:51:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 48 48 | ("param1", "param2"), 49 49 | [ 50 50 | [1, 2], @@ -162,6 +174,8 @@ PT007.py:51:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 53 53 | ) 54 54 | def test_list_of_lists(param1, param2): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:61:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | 59 | "param1,param2", @@ -173,7 +187,7 @@ PT007.py:61:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 58 58 | @pytest.mark.parametrize( 59 59 | "param1,param2", 60 60 | [ @@ -183,6 +197,8 @@ PT007.py:61:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 63 63 | ], 64 64 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:62:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | 60 | [ @@ -194,7 +210,7 @@ PT007.py:62:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 59 59 | "param1,param2", 60 60 | [ 61 61 | [1, 2], @@ -204,6 +220,8 @@ PT007.py:62:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 64 64 | ) 65 65 | def test_csv_name_list_of_lists(param1, param2): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:81:38: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -214,7 +232,7 @@ PT007.py:81:38: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `list` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 78 78 | 79 79 | 80 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -223,3 +241,5 @@ PT007.py:81:38: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect 82 82 | @pytest.mark.parametrize("d", [3,]) 83 83 | @pytest.mark.parametrize( 84 84 | "d", + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_lists.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_lists.snap index 93a0b2954c463..fcdfd455f6726 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_lists.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_lists.snap @@ -12,7 +12,7 @@ PT007.py:12:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 9 9 | @pytest.mark.parametrize( 10 10 | ("param1", "param2"), 11 11 | ( @@ -22,6 +22,8 @@ PT007.py:12:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 14 14 | ), 15 15 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:13:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | 11 | ( @@ -33,7 +35,7 @@ PT007.py:13:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 10 10 | ("param1", "param2"), 11 11 | ( 12 12 | (1, 2), @@ -43,6 +45,8 @@ PT007.py:13:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 15 15 | ) 16 16 | def test_tuple_of_tuples(param1, param2): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:31:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | 31 | @pytest.mark.parametrize("param", [1, 2]) @@ -52,7 +56,7 @@ PT007.py:31:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 28 28 | ... 29 29 | 30 30 | @@ -62,6 +66,8 @@ PT007.py:31:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect 33 33 | ... 34 34 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:38:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | 36 | @pytest.mark.parametrize( @@ -77,7 +83,7 @@ PT007.py:38:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 35 35 | 36 36 | @pytest.mark.parametrize( 37 37 | ("param1", "param2"), @@ -91,6 +97,8 @@ PT007.py:38:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 43 43 | def test_list_of_tuples(param1, param2): 44 44 | ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:39:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | 37 | ("param1", "param2"), @@ -102,7 +110,7 @@ PT007.py:39:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 36 36 | @pytest.mark.parametrize( 37 37 | ("param1", "param2"), 38 38 | [ @@ -112,6 +120,8 @@ PT007.py:39:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 41 41 | ], 42 42 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:40:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | 38 | [ @@ -123,7 +133,7 @@ PT007.py:40:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 37 37 | ("param1", "param2"), 38 38 | [ 39 39 | (1, 2), @@ -133,6 +143,8 @@ PT007.py:40:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 42 42 | ) 43 43 | def test_list_of_tuples(param1, param2): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:49:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | 47 | @pytest.mark.parametrize( @@ -148,7 +160,7 @@ PT007.py:49:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 46 46 | 47 47 | @pytest.mark.parametrize( 48 48 | ("param1", "param2"), @@ -162,6 +174,8 @@ PT007.py:49:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 54 54 | def test_list_of_lists(param1, param2): 55 55 | ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:60:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | 58 | @pytest.mark.parametrize( @@ -177,7 +191,7 @@ PT007.py:60:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 57 57 | 58 58 | @pytest.mark.parametrize( 59 59 | "param1,param2", @@ -191,6 +205,8 @@ PT007.py:60:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 65 65 | def test_csv_name_list_of_lists(param1, param2): 66 66 | ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:71:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | 69 | @pytest.mark.parametrize( @@ -206,7 +222,7 @@ PT007.py:71:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 68 68 | 69 69 | @pytest.mark.parametrize( 70 70 | "param", @@ -220,6 +236,8 @@ PT007.py:71:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 76 76 | def test_single_list_of_lists(param): 77 77 | ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:80:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -229,7 +247,7 @@ PT007.py:80:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 77 77 | ... 78 78 | 79 79 | @@ -239,6 +257,8 @@ PT007.py:80:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect 82 82 | @pytest.mark.parametrize("d", [3,]) 83 83 | @pytest.mark.parametrize( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:81:39: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -249,7 +269,7 @@ PT007.py:81:39: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 78 78 | 79 79 | 80 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -259,6 +279,8 @@ PT007.py:81:39: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect 83 83 | @pytest.mark.parametrize( 84 84 | "d", + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:81:47: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -269,7 +291,7 @@ PT007.py:81:47: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 78 78 | 79 79 | 80 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -279,6 +301,8 @@ PT007.py:81:47: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect 83 83 | @pytest.mark.parametrize( 84 84 | "d", + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:82:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -290,7 +314,7 @@ PT007.py:82:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 79 79 | 80 80 | @pytest.mark.parametrize("a", [1, 2]) 81 81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) @@ -300,6 +324,8 @@ PT007.py:82:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect 84 84 | "d", 85 85 | [("3", "4")], + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:85:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | 83 | @pytest.mark.parametrize( @@ -311,7 +337,7 @@ PT007.py:85:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 82 82 | @pytest.mark.parametrize("d", [3,]) 83 83 | @pytest.mark.parametrize( 84 84 | "d", @@ -321,6 +347,8 @@ PT007.py:85:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 87 87 | @pytest.mark.parametrize( 88 88 | "e", + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:89:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | 87 | @pytest.mark.parametrize( @@ -332,7 +360,7 @@ PT007.py:89:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -ℹ Unsafe fix +Suggested fix: 86 86 | ) 87 87 | @pytest.mark.parametrize( 88 88 | "e", @@ -341,3 +369,5 @@ PT007.py:89:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 90 90 | ) 91 91 | def test_multiple_decorators(a, b, c, d, e): 92 92 | pass + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_tuples.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_tuples.snap index 3d90a13b2eb9c..7e1accd1e441d 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_tuples.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_tuples.snap @@ -12,7 +12,7 @@ PT007.py:23:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 20 20 | @pytest.mark.parametrize( 21 21 | ("param1", "param2"), 22 22 | ( @@ -22,6 +22,8 @@ PT007.py:23:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 25 25 | ), 26 26 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:24:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | 22 | ( @@ -33,7 +35,7 @@ PT007.py:24:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 21 21 | ("param1", "param2"), 22 22 | ( 23 23 | [1, 2], @@ -43,6 +45,8 @@ PT007.py:24:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 26 26 | ) 27 27 | def test_tuple_of_lists(param1, param2): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:31:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | 31 | @pytest.mark.parametrize("param", [1, 2]) @@ -52,7 +56,7 @@ PT007.py:31:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 28 28 | ... 29 29 | 30 30 | @@ -62,6 +66,8 @@ PT007.py:31:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect 33 33 | ... 34 34 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:38:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | 36 | @pytest.mark.parametrize( @@ -77,7 +83,7 @@ PT007.py:38:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 35 35 | 36 36 | @pytest.mark.parametrize( 37 37 | ("param1", "param2"), @@ -91,6 +97,8 @@ PT007.py:38:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 43 43 | def test_list_of_tuples(param1, param2): 44 44 | ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:49:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | 47 | @pytest.mark.parametrize( @@ -106,7 +114,7 @@ PT007.py:49:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 46 46 | 47 47 | @pytest.mark.parametrize( 48 48 | ("param1", "param2"), @@ -120,6 +128,8 @@ PT007.py:49:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 54 54 | def test_list_of_lists(param1, param2): 55 55 | ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:50:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | 48 | ("param1", "param2"), @@ -131,7 +141,7 @@ PT007.py:50:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 47 47 | @pytest.mark.parametrize( 48 48 | ("param1", "param2"), 49 49 | [ @@ -141,6 +151,8 @@ PT007.py:50:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 52 52 | ], 53 53 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:51:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | 49 | [ @@ -152,7 +164,7 @@ PT007.py:51:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 48 48 | ("param1", "param2"), 49 49 | [ 50 50 | [1, 2], @@ -162,6 +174,8 @@ PT007.py:51:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 53 53 | ) 54 54 | def test_list_of_lists(param1, param2): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:60:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | 58 | @pytest.mark.parametrize( @@ -177,7 +191,7 @@ PT007.py:60:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 57 57 | 58 58 | @pytest.mark.parametrize( 59 59 | "param1,param2", @@ -191,6 +205,8 @@ PT007.py:60:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 65 65 | def test_csv_name_list_of_lists(param1, param2): 66 66 | ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:61:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | 59 | "param1,param2", @@ -202,7 +218,7 @@ PT007.py:61:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 58 58 | @pytest.mark.parametrize( 59 59 | "param1,param2", 60 60 | [ @@ -212,6 +228,8 @@ PT007.py:61:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 63 63 | ], 64 64 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:62:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | 60 | [ @@ -223,7 +241,7 @@ PT007.py:62:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 59 59 | "param1,param2", 60 60 | [ 61 61 | [1, 2], @@ -233,6 +251,8 @@ PT007.py:62:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 64 64 | ) 65 65 | def test_csv_name_list_of_lists(param1, param2): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:71:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | 69 | @pytest.mark.parametrize( @@ -248,7 +268,7 @@ PT007.py:71:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 68 68 | 69 69 | @pytest.mark.parametrize( 70 70 | "param", @@ -262,6 +282,8 @@ PT007.py:71:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 76 76 | def test_single_list_of_lists(param): 77 77 | ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:80:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -271,7 +293,7 @@ PT007.py:80:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 77 77 | ... 78 78 | 79 79 | @@ -281,6 +303,8 @@ PT007.py:80:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect 82 82 | @pytest.mark.parametrize("d", [3,]) 83 83 | @pytest.mark.parametrize( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:82:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -292,7 +316,7 @@ PT007.py:82:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 79 79 | 80 80 | @pytest.mark.parametrize("a", [1, 2]) 81 81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) @@ -302,6 +326,8 @@ PT007.py:82:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect 84 84 | "d", 85 85 | [("3", "4")], + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:85:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | 83 | @pytest.mark.parametrize( @@ -313,7 +339,7 @@ PT007.py:85:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 82 82 | @pytest.mark.parametrize("d", [3,]) 83 83 | @pytest.mark.parametrize( 84 84 | "d", @@ -323,6 +349,8 @@ PT007.py:85:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 87 87 | @pytest.mark.parametrize( 88 88 | "e", + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT007.py:89:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | 87 | @pytest.mark.parametrize( @@ -334,7 +362,7 @@ PT007.py:89:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -ℹ Unsafe fix +Suggested fix: 86 86 | ) 87 87 | @pytest.mark.parametrize( 88 88 | "e", @@ -343,3 +371,5 @@ PT007.py:89:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 90 90 | ) 91 91 | def test_multiple_decorators(a, b, c, d, e): 92 92 | pass + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap index 572c08916f966..1a605854fea86 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap @@ -12,7 +12,7 @@ PT009.py:11:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 8 8 | def test_assert_true(self): 9 9 | expr = 1 10 10 | msg = "Must be True" @@ -22,6 +22,8 @@ PT009.py:11:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 13 13 | self.assertTrue(expr, msg) # Error 14 14 | self.assertTrue(expr=expr, msg=msg) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:12:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` | 10 | msg = "Must be True" @@ -33,7 +35,7 @@ PT009.py:12:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 9 9 | expr = 1 10 10 | msg = "Must be True" 11 11 | self.assertTrue(expr) # Error @@ -43,6 +45,8 @@ PT009.py:12:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 14 14 | self.assertTrue(expr=expr, msg=msg) # Error 15 15 | self.assertTrue(msg=msg, expr=expr) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:13:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` | 11 | self.assertTrue(expr) # Error @@ -54,7 +58,7 @@ PT009.py:13:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 10 10 | msg = "Must be True" 11 11 | self.assertTrue(expr) # Error 12 12 | self.assertTrue(expr=expr) # Error @@ -64,6 +68,8 @@ PT009.py:13:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 15 15 | self.assertTrue(msg=msg, expr=expr) # Error 16 16 | self.assertTrue(*(expr, msg)) # Error, unfixable + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:14:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` | 12 | self.assertTrue(expr=expr) # Error @@ -75,7 +81,7 @@ PT009.py:14:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 11 11 | self.assertTrue(expr) # Error 12 12 | self.assertTrue(expr=expr) # Error 13 13 | self.assertTrue(expr, msg) # Error @@ -85,6 +91,8 @@ PT009.py:14:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 16 16 | self.assertTrue(*(expr, msg)) # Error, unfixable 17 17 | self.assertTrue(**{"expr": expr, "msg": msg}) # Error, unfixable + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:15:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` | 13 | self.assertTrue(expr, msg) # Error @@ -96,7 +104,7 @@ PT009.py:15:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 12 12 | self.assertTrue(expr=expr) # Error 13 13 | self.assertTrue(expr, msg) # Error 14 14 | self.assertTrue(expr=expr, msg=msg) # Error @@ -106,6 +114,8 @@ PT009.py:15:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 17 17 | self.assertTrue(**{"expr": expr, "msg": msg}) # Error, unfixable 18 18 | self.assertTrue(msg=msg, expr=expr, unexpected_arg=False) # Error, unfixable + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:16:9: PT009 Use a regular `assert` instead of unittest-style `assertTrue` | 14 | self.assertTrue(expr=expr, msg=msg) # Error @@ -193,7 +203,7 @@ PT009.py:28:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertFalse(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 25 25 | return self.assertEqual(True, False) # Error, unfixable 26 26 | 27 27 | def test_assert_false(self): @@ -203,6 +213,8 @@ PT009.py:28:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 30 30 | def test_assert_equal(self): 31 31 | self.assertEqual(1, 2) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:31:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertEqual` | 30 | def test_assert_equal(self): @@ -213,7 +225,7 @@ PT009.py:31:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertEqual(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 28 28 | self.assertFalse(True) # Error 29 29 | 30 30 | def test_assert_equal(self): @@ -223,6 +235,8 @@ PT009.py:31:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 33 33 | def test_assert_not_equal(self): 34 34 | self.assertNotEqual(1, 1) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:34:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotEqual` | 33 | def test_assert_not_equal(self): @@ -233,7 +247,7 @@ PT009.py:34:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotEqual(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 31 31 | self.assertEqual(1, 2) # Error 32 32 | 33 33 | def test_assert_not_equal(self): @@ -243,6 +257,8 @@ PT009.py:34:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 36 36 | def test_assert_greater(self): 37 37 | self.assertGreater(1, 2) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:37:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertGreater` | 36 | def test_assert_greater(self): @@ -253,7 +269,7 @@ PT009.py:37:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertGreater(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 34 34 | self.assertNotEqual(1, 1) # Error 35 35 | 36 36 | def test_assert_greater(self): @@ -263,6 +279,8 @@ PT009.py:37:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 39 39 | def test_assert_greater_equal(self): 40 40 | self.assertGreaterEqual(1, 2) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:40:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertGreaterEqual` | 39 | def test_assert_greater_equal(self): @@ -273,7 +291,7 @@ PT009.py:40:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertGreaterEqual(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 37 37 | self.assertGreater(1, 2) # Error 38 38 | 39 39 | def test_assert_greater_equal(self): @@ -283,6 +301,8 @@ PT009.py:40:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 42 42 | def test_assert_less(self): 43 43 | self.assertLess(2, 1) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:43:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertLess` | 42 | def test_assert_less(self): @@ -293,7 +313,7 @@ PT009.py:43:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertLess(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 40 40 | self.assertGreaterEqual(1, 2) # Error 41 41 | 42 42 | def test_assert_less(self): @@ -303,6 +323,8 @@ PT009.py:43:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 45 45 | def test_assert_less_equal(self): 46 46 | self.assertLessEqual(1, 2) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:46:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertLessEqual` | 45 | def test_assert_less_equal(self): @@ -313,7 +335,7 @@ PT009.py:46:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertLessEqual(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 43 43 | self.assertLess(2, 1) # Error 44 44 | 45 45 | def test_assert_less_equal(self): @@ -323,6 +345,8 @@ PT009.py:46:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 48 48 | def test_assert_in(self): 49 49 | self.assertIn(1, [2, 3]) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:49:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIn` | 48 | def test_assert_in(self): @@ -333,7 +357,7 @@ PT009.py:49:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIn(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 46 46 | self.assertLessEqual(1, 2) # Error 47 47 | 48 48 | def test_assert_in(self): @@ -343,6 +367,8 @@ PT009.py:49:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 51 51 | def test_assert_not_in(self): 52 52 | self.assertNotIn(2, [2, 3]) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:52:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotIn` | 51 | def test_assert_not_in(self): @@ -353,7 +379,7 @@ PT009.py:52:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotIn(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 49 49 | self.assertIn(1, [2, 3]) # Error 50 50 | 51 51 | def test_assert_not_in(self): @@ -363,6 +389,8 @@ PT009.py:52:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 54 54 | def test_assert_is_none(self): 55 55 | self.assertIsNone(0) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:55:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsNone` | 54 | def test_assert_is_none(self): @@ -373,7 +401,7 @@ PT009.py:55:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIsNone(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 52 52 | self.assertNotIn(2, [2, 3]) # Error 53 53 | 54 54 | def test_assert_is_none(self): @@ -383,6 +411,8 @@ PT009.py:55:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 57 57 | def test_assert_is_not_none(self): 58 58 | self.assertIsNotNone(0) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:58:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsNotNone` | 57 | def test_assert_is_not_none(self): @@ -393,7 +423,7 @@ PT009.py:58:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIsNotNone(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 55 55 | self.assertIsNone(0) # Error 56 56 | 57 57 | def test_assert_is_not_none(self): @@ -403,6 +433,8 @@ PT009.py:58:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 60 60 | def test_assert_is(self): 61 61 | self.assertIs([], []) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:61:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIs` | 60 | def test_assert_is(self): @@ -413,7 +445,7 @@ PT009.py:61:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIs(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 58 58 | self.assertIsNotNone(0) # Error 59 59 | 60 60 | def test_assert_is(self): @@ -423,6 +455,8 @@ PT009.py:61:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 63 63 | def test_assert_is_not(self): 64 64 | self.assertIsNot(1, 1) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:64:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsNot` | 63 | def test_assert_is_not(self): @@ -433,7 +467,7 @@ PT009.py:64:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIsNot(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 61 61 | self.assertIs([], []) # Error 62 62 | 63 63 | def test_assert_is_not(self): @@ -443,6 +477,8 @@ PT009.py:64:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 66 66 | def test_assert_is_instance(self): 67 67 | self.assertIsInstance(1, str) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:67:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsInstance` | 66 | def test_assert_is_instance(self): @@ -453,7 +489,7 @@ PT009.py:67:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIsInstance(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 64 64 | self.assertIsNot(1, 1) # Error 65 65 | 66 66 | def test_assert_is_instance(self): @@ -463,6 +499,8 @@ PT009.py:67:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 69 69 | def test_assert_is_not_instance(self): 70 70 | self.assertNotIsInstance(1, int) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:70:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotIsInstance` | 69 | def test_assert_is_not_instance(self): @@ -473,7 +511,7 @@ PT009.py:70:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotIsInstance(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 67 67 | self.assertIsInstance(1, str) # Error 68 68 | 69 69 | def test_assert_is_not_instance(self): @@ -483,6 +521,8 @@ PT009.py:70:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 72 72 | def test_assert_regex(self): 73 73 | self.assertRegex("abc", r"def") # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:73:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertRegex` | 72 | def test_assert_regex(self): @@ -493,7 +533,7 @@ PT009.py:73:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertRegex(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 70 70 | self.assertNotIsInstance(1, int) # Error 71 71 | 72 72 | def test_assert_regex(self): @@ -503,6 +543,8 @@ PT009.py:73:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 75 75 | def test_assert_not_regex(self): 76 76 | self.assertNotRegex("abc", r"abc") # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:76:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotRegex` | 75 | def test_assert_not_regex(self): @@ -513,7 +555,7 @@ PT009.py:76:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotRegex(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 73 73 | self.assertRegex("abc", r"def") # Error 74 74 | 75 75 | def test_assert_not_regex(self): @@ -523,6 +565,8 @@ PT009.py:76:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 78 78 | def test_assert_regexp_matches(self): 79 79 | self.assertRegexpMatches("abc", r"def") # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:79:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertRegexpMatches` | 78 | def test_assert_regexp_matches(self): @@ -533,7 +577,7 @@ PT009.py:79:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertRegexpMatches(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 76 76 | self.assertNotRegex("abc", r"abc") # Error 77 77 | 78 78 | def test_assert_regexp_matches(self): @@ -543,6 +587,8 @@ PT009.py:79:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 81 81 | def test_assert_not_regexp_matches(self): 82 82 | self.assertNotRegex("abc", r"abc") # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:82:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotRegex` | 81 | def test_assert_not_regexp_matches(self): @@ -553,7 +599,7 @@ PT009.py:82:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotRegex(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 79 79 | self.assertRegexpMatches("abc", r"def") # Error 80 80 | 81 81 | def test_assert_not_regexp_matches(self): @@ -563,6 +609,8 @@ PT009.py:82:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 84 84 | def test_fail_if(self): 85 85 | self.failIf("abc") # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:85:9: PT009 [*] Use a regular `assert` instead of unittest-style `failIf` | 84 | def test_fail_if(self): @@ -573,7 +621,7 @@ PT009.py:85:9: PT009 [*] Use a regular `assert` instead of unittest-style `failI | = help: Replace `failIf(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 82 82 | self.assertNotRegex("abc", r"abc") # Error 83 83 | 84 84 | def test_fail_if(self): @@ -583,6 +631,8 @@ PT009.py:85:9: PT009 [*] Use a regular `assert` instead of unittest-style `failI 87 87 | def test_fail_unless(self): 88 88 | self.failUnless("abc") # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:88:9: PT009 [*] Use a regular `assert` instead of unittest-style `failUnless` | 87 | def test_fail_unless(self): @@ -593,7 +643,7 @@ PT009.py:88:9: PT009 [*] Use a regular `assert` instead of unittest-style `failU | = help: Replace `failUnless(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 85 85 | self.failIf("abc") # Error 86 86 | 87 87 | def test_fail_unless(self): @@ -603,6 +653,8 @@ PT009.py:88:9: PT009 [*] Use a regular `assert` instead of unittest-style `failU 90 90 | def test_fail_unless_equal(self): 91 91 | self.failUnlessEqual(1, 2) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:91:9: PT009 [*] Use a regular `assert` instead of unittest-style `failUnlessEqual` | 90 | def test_fail_unless_equal(self): @@ -613,7 +665,7 @@ PT009.py:91:9: PT009 [*] Use a regular `assert` instead of unittest-style `failU | = help: Replace `failUnlessEqual(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 88 88 | self.failUnless("abc") # Error 89 89 | 90 90 | def test_fail_unless_equal(self): @@ -623,6 +675,8 @@ PT009.py:91:9: PT009 [*] Use a regular `assert` instead of unittest-style `failU 93 93 | def test_fail_if_equal(self): 94 94 | self.failIfEqual(1, 2) # Error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:94:9: PT009 [*] Use a regular `assert` instead of unittest-style `failIfEqual` | 93 | def test_fail_if_equal(self): @@ -631,7 +685,7 @@ PT009.py:94:9: PT009 [*] Use a regular `assert` instead of unittest-style `failI | = help: Replace `failIfEqual(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 91 91 | self.failUnlessEqual(1, 2) # Error 92 92 | 93 93 | def test_fail_if_equal(self): @@ -641,6 +695,8 @@ PT009.py:94:9: PT009 [*] Use a regular `assert` instead of unittest-style `failI 96 96 | 97 97 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459517 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT009.py:98:2: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` | 97 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459517 @@ -651,7 +707,7 @@ PT009.py:98:2: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -ℹ Unsafe fix +Suggested fix: 95 95 | 96 96 | 97 97 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459517 @@ -660,4 +716,4 @@ PT009.py:98:2: PT009 [*] Use a regular `assert` instead of unittest-style `asser 100 |- self.model.piAx_piAy_beta[r][x][y]))) 98 |+assert "piAx_piAy_beta[r][x][y] = {17}".format(self.model.piAx_piAy_beta[r][x][y]) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap index 92240183c3672..3ff6603735af2 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap @@ -10,7 +10,7 @@ PT014.py:4:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.para | = help: Remove duplicate test case -ℹ Unsafe fix +Suggested fix: 1 1 | import pytest 2 2 | 3 3 | @@ -20,6 +20,8 @@ PT014.py:4:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.para 6 6 | ... 7 7 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT014.py:14:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 14 | @pytest.mark.parametrize("x", [a, a, b, b, b, c]) @@ -29,7 +31,7 @@ PT014.py:14:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -ℹ Unsafe fix +Suggested fix: 11 11 | c = 3 12 12 | 13 13 | @@ -39,6 +41,8 @@ PT014.py:14:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par 16 16 | ... 17 17 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT014.py:14:41: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.parametrize` | 14 | @pytest.mark.parametrize("x", [a, a, b, b, b, c]) @@ -48,7 +52,7 @@ PT014.py:14:41: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.par | = help: Remove duplicate test case -ℹ Unsafe fix +Suggested fix: 11 11 | c = 3 12 12 | 13 13 | @@ -58,6 +62,8 @@ PT014.py:14:41: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.par 16 16 | ... 17 17 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT014.py:14:44: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.parametrize` | 14 | @pytest.mark.parametrize("x", [a, a, b, b, b, c]) @@ -67,7 +73,7 @@ PT014.py:14:44: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.par | = help: Remove duplicate test case -ℹ Unsafe fix +Suggested fix: 11 11 | c = 3 12 12 | 13 13 | @@ -77,6 +83,8 @@ PT014.py:14:44: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.par 16 16 | ... 17 17 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT014.py:24:9: PT014 Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 22 | (a, b), @@ -97,7 +105,7 @@ PT014.py:32:39: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -ℹ Unsafe fix +Suggested fix: 29 29 | ... 30 30 | 31 31 | @@ -107,6 +115,8 @@ PT014.py:32:39: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par 34 34 | ... 35 35 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT014.py:32:48: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 32 | @pytest.mark.parametrize("x", [a, b, (a), c, ((a))]) @@ -116,7 +126,7 @@ PT014.py:32:48: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -ℹ Unsafe fix +Suggested fix: 29 29 | ... 30 30 | 31 31 | @@ -126,6 +136,8 @@ PT014.py:32:48: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par 34 34 | ... 35 35 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT014.py:42:10: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 40 | a, @@ -137,7 +149,7 @@ PT014.py:42:10: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -ℹ Unsafe fix +Suggested fix: 39 39 | [ 40 40 | a, 41 41 | b, @@ -146,6 +158,8 @@ PT014.py:42:10: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par 44 43 | ((a)), 45 44 | ], + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT014.py:44:11: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 42 | (a), @@ -157,7 +171,7 @@ PT014.py:44:11: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -ℹ Unsafe fix +Suggested fix: 41 41 | b, 42 42 | (a), 43 43 | c, @@ -166,6 +180,8 @@ PT014.py:44:11: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par 46 45 | ) 47 46 | def test_error_parentheses_trailing_comma(x): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT014.py:56:53: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 56 | @pytest.mark.parametrize('data, spec', [(1.0, 1.0), (1.0, 1.0)]) @@ -175,7 +191,7 @@ PT014.py:56:53: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -ℹ Unsafe fix +Suggested fix: 53 53 | ... 54 54 | 55 55 | @@ -183,3 +199,5 @@ PT014.py:56:53: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par 56 |+@pytest.mark.parametrize('data, spec', [(1.0, 1.0)]) 57 57 | def test_numbers(data, spec): 58 58 | ... + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap index cf96ebfbb180e..19d99a1ccb71e 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap @@ -11,7 +11,7 @@ PT018.py:14:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Unsafe fix +Suggested fix: 11 11 | 12 12 | 13 13 | def test_error(): @@ -22,6 +22,8 @@ PT018.py:14:5: PT018 [*] Assertion should be broken down into multiple parts 16 17 | assert something and not something_else 17 18 | assert something and (something_else or something_third) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT018.py:15:5: PT018 [*] Assertion should be broken down into multiple parts | 13 | def test_error(): @@ -33,7 +35,7 @@ PT018.py:15:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Unsafe fix +Suggested fix: 12 12 | 13 13 | def test_error(): 14 14 | assert something and something_else @@ -44,6 +46,8 @@ PT018.py:15:5: PT018 [*] Assertion should be broken down into multiple parts 17 18 | assert something and (something_else or something_third) 18 19 | assert not something and something_else + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT018.py:16:5: PT018 [*] Assertion should be broken down into multiple parts | 14 | assert something and something_else @@ -55,7 +59,7 @@ PT018.py:16:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Unsafe fix +Suggested fix: 13 13 | def test_error(): 14 14 | assert something and something_else 15 15 | assert something and something_else and something_third @@ -66,6 +70,8 @@ PT018.py:16:5: PT018 [*] Assertion should be broken down into multiple parts 18 19 | assert not something and something_else 19 20 | assert not (something or something_else) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT018.py:17:5: PT018 [*] Assertion should be broken down into multiple parts | 15 | assert something and something_else and something_third @@ -77,7 +83,7 @@ PT018.py:17:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Unsafe fix +Suggested fix: 14 14 | assert something and something_else 15 15 | assert something and something_else and something_third 16 16 | assert something and not something_else @@ -88,6 +94,8 @@ PT018.py:17:5: PT018 [*] Assertion should be broken down into multiple parts 19 20 | assert not (something or something_else) 20 21 | assert not (something or something_else or something_third) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT018.py:18:5: PT018 [*] Assertion should be broken down into multiple parts | 16 | assert something and not something_else @@ -99,7 +107,7 @@ PT018.py:18:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Unsafe fix +Suggested fix: 15 15 | assert something and something_else and something_third 16 16 | assert something and not something_else 17 17 | assert something and (something_else or something_third) @@ -110,6 +118,8 @@ PT018.py:18:5: PT018 [*] Assertion should be broken down into multiple parts 20 21 | assert not (something or something_else or something_third) 21 22 | assert something and something_else == """error + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT018.py:19:5: PT018 [*] Assertion should be broken down into multiple parts | 17 | assert something and (something_else or something_third) @@ -121,7 +131,7 @@ PT018.py:19:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Unsafe fix +Suggested fix: 16 16 | assert something and not something_else 17 17 | assert something and (something_else or something_third) 18 18 | assert not something and something_else @@ -132,6 +142,8 @@ PT018.py:19:5: PT018 [*] Assertion should be broken down into multiple parts 21 22 | assert something and something_else == """error 22 23 | message + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT018.py:20:5: PT018 [*] Assertion should be broken down into multiple parts | 18 | assert not something and something_else @@ -143,7 +155,7 @@ PT018.py:20:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Unsafe fix +Suggested fix: 17 17 | assert something and (something_else or something_third) 18 18 | assert not something and something_else 19 19 | assert not (something or something_else) @@ -154,6 +166,8 @@ PT018.py:20:5: PT018 [*] Assertion should be broken down into multiple parts 22 23 | message 23 24 | """ + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT018.py:21:5: PT018 [*] Assertion should be broken down into multiple parts | 19 | assert not (something or something_else) @@ -168,7 +182,7 @@ PT018.py:21:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Unsafe fix +Suggested fix: 18 18 | assert not something and something_else 19 19 | assert not (something or something_else) 20 20 | assert not (something or something_else or something_third) @@ -179,6 +193,8 @@ PT018.py:21:5: PT018 [*] Assertion should be broken down into multiple parts 23 24 | """ 24 25 | assert ( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT018.py:24:5: PT018 [*] Assertion should be broken down into multiple parts | 22 | message @@ -197,7 +213,7 @@ PT018.py:24:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Unsafe fix +Suggested fix: 21 21 | assert something and something_else == """error 22 22 | message 23 23 | """ @@ -210,6 +226,8 @@ PT018.py:24:5: PT018 [*] Assertion should be broken down into multiple parts 28 28 | message 29 29 | """ + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT018.py:33:5: PT018 [*] Assertion should be broken down into multiple parts | 32 | # recursive case @@ -219,7 +237,7 @@ PT018.py:33:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Unsafe fix +Suggested fix: 30 30 | ) 31 31 | 32 32 | # recursive case @@ -230,6 +248,8 @@ PT018.py:33:5: PT018 [*] Assertion should be broken down into multiple parts 35 36 | 36 37 | # detected, but no fix for messages + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT018.py:34:5: PT018 [*] Assertion should be broken down into multiple parts | 32 | # recursive case @@ -241,7 +261,7 @@ PT018.py:34:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Unsafe fix +Suggested fix: 31 31 | 32 32 | # recursive case 33 33 | assert not (a or not (b or c)) @@ -252,6 +272,8 @@ PT018.py:34:5: PT018 [*] Assertion should be broken down into multiple parts 36 37 | # detected, but no fix for messages 37 38 | assert something and something_else, "error message" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT018.py:37:5: PT018 Assertion should be broken down into multiple parts | 36 | # detected, but no fix for messages @@ -291,7 +313,7 @@ PT018.py:44:1: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Unsafe fix +Suggested fix: 41 41 | 42 42 | 43 43 | assert something # OK @@ -302,6 +324,8 @@ PT018.py:44:1: PT018 [*] Assertion should be broken down into multiple parts 46 47 | 47 48 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT018.py:45:1: PT018 [*] Assertion should be broken down into multiple parts | 43 | assert something # OK @@ -311,7 +335,7 @@ PT018.py:45:1: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Unsafe fix +Suggested fix: 42 42 | 43 43 | assert something # OK 44 44 | assert something and something_else # Error @@ -322,6 +346,8 @@ PT018.py:45:1: PT018 [*] Assertion should be broken down into multiple parts 47 48 | 48 49 | def test_multiline(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT018.py:49:5: PT018 Assertion should be broken down into multiple parts | 48 | def test_multiline(): @@ -367,7 +393,7 @@ PT018.py:59:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Unsafe fix +Suggested fix: 59 59 | assert not ( 60 60 | self.find_graph_output(node.output[0]) 61 61 | or self.find_graph_input(node.input[0]) @@ -380,6 +406,8 @@ PT018.py:59:5: PT018 [*] Assertion should be broken down into multiple parts 65 67 | assert (not ( 66 68 | self.find_graph_output(node.output[0]) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT018.py:65:5: PT018 [*] Assertion should be broken down into multiple parts | 63 | ) @@ -396,7 +424,7 @@ PT018.py:65:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Unsafe fix +Suggested fix: 62 62 | or self.find_graph_output(node.input[0]) 63 63 | ) 64 64 | @@ -413,3 +441,5 @@ PT018.py:65:5: PT018 [*] Assertion should be broken down into multiple parts 70 72 | 71 73 | assert (not self.find_graph_output(node.output[0]) or 72 74 | self.find_graph_input(node.input[0])) + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT022.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT022.snap index 33378e77f0007..1b4e5352c85c5 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT022.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT022.snap @@ -10,7 +10,7 @@ PT022.py:17:5: PT022 [*] No teardown in fixture `error`, use `return` instead of | = help: Replace `yield` with `return` -ℹ Safe fix +Suggested fix: 14 14 | @pytest.fixture() 15 15 | def error(): 16 16 | resource = acquire_resource() @@ -20,6 +20,8 @@ PT022.py:17:5: PT022 [*] No teardown in fixture `error`, use `return` instead of 19 19 | 20 20 | import typing + Run `ruff check --fix` to apply this fix. + PT022.py:37:5: PT022 [*] No teardown in fixture `error`, use `return` instead of `yield` | 35 | def error() -> typing.Generator[typing.Any, None, None]: @@ -29,7 +31,7 @@ PT022.py:37:5: PT022 [*] No teardown in fixture `error`, use `return` instead of | = help: Replace `yield` with `return` -ℹ Safe fix +Suggested fix: 32 32 | 33 33 | 34 34 | @pytest.fixture() @@ -42,6 +44,8 @@ PT022.py:37:5: PT022 [*] No teardown in fixture `error`, use `return` instead of 39 39 | 40 40 | @pytest.fixture() + Run `ruff check --fix` to apply this fix. + PT022.py:43:5: PT022 [*] No teardown in fixture `error`, use `return` instead of `yield` | 41 | def error() -> Generator[Resource, None, None]: @@ -51,7 +55,7 @@ PT022.py:43:5: PT022 [*] No teardown in fixture `error`, use `return` instead of | = help: Replace `yield` with `return` -ℹ Safe fix +Suggested fix: 38 38 | 39 39 | 40 40 | @pytest.fixture() @@ -61,4 +65,4 @@ PT022.py:43:5: PT022 [*] No teardown in fixture `error`, use `return` instead of 43 |- yield resource 43 |+ return resource - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_default.snap index 419dbb107af8b..1246a1d3674fa 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_default.snap @@ -10,7 +10,7 @@ PT023.py:12:1: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | = help: Add/remove parentheses -ℹ Safe fix +Suggested fix: 9 9 | # Without parentheses 10 10 | 11 11 | @@ -20,6 +20,8 @@ PT023.py:12:1: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` 14 14 | pass 15 15 | + Run `ruff check --fix` to apply this fix. + PT023.py:17:1: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | 17 | @pytest.mark.foo @@ -29,7 +31,7 @@ PT023.py:17:1: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | = help: Add/remove parentheses -ℹ Safe fix +Suggested fix: 14 14 | pass 15 15 | 16 16 | @@ -39,6 +41,8 @@ PT023.py:17:1: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` 19 19 | def test_something(): 20 20 | pass + Run `ruff check --fix` to apply this fix. + PT023.py:24:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | 23 | class TestClass: @@ -49,7 +53,7 @@ PT023.py:24:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | = help: Add/remove parentheses -ℹ Safe fix +Suggested fix: 21 21 | 22 22 | 23 23 | class TestClass: @@ -59,6 +63,8 @@ PT023.py:24:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` 26 26 | pass 27 27 | + Run `ruff check --fix` to apply this fix. + PT023.py:30:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | 29 | class TestClass: @@ -69,7 +75,7 @@ PT023.py:30:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | = help: Add/remove parentheses -ℹ Safe fix +Suggested fix: 27 27 | 28 28 | 29 29 | class TestClass: @@ -79,6 +85,8 @@ PT023.py:30:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` 32 32 | def test_something(): 33 33 | pass + Run `ruff check --fix` to apply this fix. + PT023.py:38:9: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | 36 | class TestClass: @@ -90,7 +98,7 @@ PT023.py:38:9: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | = help: Add/remove parentheses -ℹ Safe fix +Suggested fix: 35 35 | 36 36 | class TestClass: 37 37 | class TestNestedClass: @@ -100,4 +108,4 @@ PT023.py:38:9: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` 40 40 | pass 41 41 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_no_parentheses.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_no_parentheses.snap index da77a9ecac2f8..8aed97f95209a 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_no_parentheses.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_no_parentheses.snap @@ -10,7 +10,7 @@ PT023.py:46:1: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | = help: Add/remove parentheses -ℹ Safe fix +Suggested fix: 43 43 | # With parentheses 44 44 | 45 45 | @@ -20,6 +20,8 @@ PT023.py:46:1: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` 48 48 | pass 49 49 | + Run `ruff check --fix` to apply this fix. + PT023.py:51:1: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | 51 | @pytest.mark.foo() @@ -29,7 +31,7 @@ PT023.py:51:1: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | = help: Add/remove parentheses -ℹ Safe fix +Suggested fix: 48 48 | pass 49 49 | 50 50 | @@ -39,6 +41,8 @@ PT023.py:51:1: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` 53 53 | def test_something(): 54 54 | pass + Run `ruff check --fix` to apply this fix. + PT023.py:58:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | 57 | class TestClass: @@ -49,7 +53,7 @@ PT023.py:58:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | = help: Add/remove parentheses -ℹ Safe fix +Suggested fix: 55 55 | 56 56 | 57 57 | class TestClass: @@ -59,6 +63,8 @@ PT023.py:58:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` 60 60 | pass 61 61 | + Run `ruff check --fix` to apply this fix. + PT023.py:64:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | 63 | class TestClass: @@ -69,7 +75,7 @@ PT023.py:64:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | = help: Add/remove parentheses -ℹ Safe fix +Suggested fix: 61 61 | 62 62 | 63 63 | class TestClass: @@ -79,6 +85,8 @@ PT023.py:64:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` 66 66 | def test_something(): 67 67 | pass + Run `ruff check --fix` to apply this fix. + PT023.py:72:9: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | 70 | class TestClass: @@ -90,7 +98,7 @@ PT023.py:72:9: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | = help: Add/remove parentheses -ℹ Safe fix +Suggested fix: 69 69 | 70 70 | class TestClass: 71 71 | class TestNestedClass: @@ -99,4 +107,4 @@ PT023.py:72:9: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` 73 73 | def test_something(): 74 74 | pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT024.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT024.snap index 29707b0e7335a..9de6c7d2b0145 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT024.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT024.snap @@ -10,7 +10,7 @@ PT024.py:14:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures | = help: Remove `pytest.mark.asyncio` -ℹ Safe fix +Suggested fix: 11 11 | pass 12 12 | 13 13 | @@ -19,6 +19,8 @@ PT024.py:14:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures 16 15 | async def my_fixture(): # Error before 17 16 | return 0 + Run `ruff check --fix` to apply this fix. + PT024.py:20:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures | 20 | @pytest.mark.asyncio @@ -28,7 +30,7 @@ PT024.py:20:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures | = help: Remove `pytest.mark.asyncio` -ℹ Safe fix +Suggested fix: 17 17 | return 0 18 18 | 19 19 | @@ -37,6 +39,8 @@ PT024.py:20:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures 22 21 | async def my_fixture(): # Error before no parens 23 22 | return 0 + Run `ruff check --fix` to apply this fix. + PT024.py:27:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures | 26 | @pytest.fixture() @@ -47,7 +51,7 @@ PT024.py:27:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures | = help: Remove `pytest.mark.asyncio` -ℹ Safe fix +Suggested fix: 24 24 | 25 25 | 26 26 | @pytest.fixture() @@ -56,6 +60,8 @@ PT024.py:27:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures 29 28 | return 0 30 29 | + Run `ruff check --fix` to apply this fix. + PT024.py:33:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures | 32 | @pytest.fixture() @@ -66,7 +72,7 @@ PT024.py:33:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures | = help: Remove `pytest.mark.asyncio` -ℹ Safe fix +Suggested fix: 30 30 | 31 31 | 32 32 | @pytest.fixture() @@ -74,4 +80,4 @@ PT024.py:33:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures 34 33 | async def my_fixture(): # Error after no parens 35 34 | return 0 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT025.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT025.snap index ba4457e915e08..677ff95feece7 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT025.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT025.snap @@ -10,7 +10,7 @@ PT025.py:9:1: PT025 [*] `pytest.mark.usefixtures` has no effect on fixtures | = help: Remove `pytest.mark.usefixtures` -ℹ Safe fix +Suggested fix: 6 6 | pass 7 7 | 8 8 | @@ -19,6 +19,8 @@ PT025.py:9:1: PT025 [*] `pytest.mark.usefixtures` has no effect on fixtures 11 10 | def my_fixture(): # Error before 12 11 | return 0 + Run `ruff check --fix` to apply this fix. + PT025.py:16:1: PT025 [*] `pytest.mark.usefixtures` has no effect on fixtures | 15 | @pytest.fixture() @@ -29,7 +31,7 @@ PT025.py:16:1: PT025 [*] `pytest.mark.usefixtures` has no effect on fixtures | = help: Remove `pytest.mark.usefixtures` -ℹ Safe fix +Suggested fix: 13 13 | 14 14 | 15 15 | @pytest.fixture() @@ -37,4 +39,4 @@ PT025.py:16:1: PT025 [*] `pytest.mark.usefixtures` has no effect on fixtures 17 16 | def my_fixture(): # Error after 18 17 | return 0 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap index 8fb8c8d7fe6c1..6ea0a7ce20a4b 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap @@ -10,7 +10,7 @@ PT026.py:19:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters | = help: Remove `usefixtures` decorator or pass parameters -ℹ Unsafe fix +Suggested fix: 16 16 | pass 17 17 | 18 18 | @@ -20,6 +20,8 @@ PT026.py:19:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters 21 21 | pass 22 22 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT026.py:24:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters | 24 | @pytest.mark.usefixtures @@ -29,7 +31,7 @@ PT026.py:24:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters | = help: Remove `usefixtures` decorator or pass parameters -ℹ Unsafe fix +Suggested fix: 21 21 | pass 22 22 | 23 23 | @@ -38,4 +40,4 @@ PT026.py:24:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters 25 25 | def test_error_no_parens(): 26 26 | pass - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap index 555cfdd5c772b..192a1d2a47a09 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap @@ -12,7 +12,7 @@ PT027_0.py:6:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assert | = help: Replace `assertRaises` with `pytest.raises` -ℹ Unsafe fix +Suggested fix: 1 1 | import unittest 2 |+import pytest 2 3 | @@ -25,6 +25,8 @@ PT027_0.py:6:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assert 8 9 | with self.assertRaises(expected_exception=ValueError): 9 10 | raise ValueError + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT027_0.py:8:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaises` | 6 | with self.assertRaises(ValueError): @@ -35,7 +37,7 @@ PT027_0.py:8:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assert | = help: Replace `assertRaises` with `pytest.raises` -ℹ Unsafe fix +Suggested fix: 1 1 | import unittest 2 |+import pytest 2 3 | @@ -50,6 +52,8 @@ PT027_0.py:8:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assert 10 11 | 11 12 | with self.failUnlessRaises(ValueError): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT027_0.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `failUnlessRaises` | 9 | raise ValueError @@ -60,7 +64,7 @@ PT027_0.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `failU | = help: Replace `failUnlessRaises` with `pytest.raises` -ℹ Unsafe fix +Suggested fix: 1 1 | import unittest 2 |+import pytest 2 3 | @@ -76,6 +80,8 @@ PT027_0.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `failU 13 14 | 14 15 | with self.assertRaisesRegex(ValueError, "test"): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT027_0.py:14:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` | 12 | raise ValueError @@ -86,7 +92,7 @@ PT027_0.py:14:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegex` with `pytest.raises` -ℹ Unsafe fix +Suggested fix: 1 1 | import unittest 2 |+import pytest 2 3 | @@ -102,6 +108,8 @@ PT027_0.py:14:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser 16 17 | 17 18 | with self.assertRaisesRegex(ValueError, expected_regex="test"): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT027_0.py:17:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` | 15 | raise ValueError("test") @@ -112,7 +120,7 @@ PT027_0.py:17:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegex` with `pytest.raises` -ℹ Unsafe fix +Suggested fix: 1 1 | import unittest 2 |+import pytest 2 3 | @@ -128,6 +136,8 @@ PT027_0.py:17:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser 19 20 | 20 21 | with self.assertRaisesRegex( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT027_0.py:20:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` | 18 | raise ValueError("test") @@ -139,7 +149,7 @@ PT027_0.py:20:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegex` with `pytest.raises` -ℹ Unsafe fix +Suggested fix: 1 1 | import unittest 2 |+import pytest 2 3 | @@ -157,6 +167,8 @@ PT027_0.py:20:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser 24 23 | 25 24 | with self.assertRaisesRegex( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT027_0.py:25:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` | 23 | raise ValueError("test") @@ -168,7 +180,7 @@ PT027_0.py:25:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegex` with `pytest.raises` -ℹ Unsafe fix +Suggested fix: 1 1 | import unittest 2 |+import pytest 2 3 | @@ -186,6 +198,8 @@ PT027_0.py:25:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser 29 28 | 30 29 | with self.assertRaisesRegexp(ValueError, "test"): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT027_0.py:30:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegexp` | 28 | raise ValueError("test") @@ -196,7 +210,7 @@ PT027_0.py:30:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegexp` with `pytest.raises` -ℹ Unsafe fix +Suggested fix: 1 1 | import unittest 2 |+import pytest 2 3 | @@ -212,6 +226,8 @@ PT027_0.py:30:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser 32 33 | 33 34 | def test_unfixable_errors(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PT027_0.py:34:14: PT027 Use `pytest.raises` instead of unittest-style `assertRaises` | 33 | def test_unfixable_errors(self): @@ -244,5 +260,3 @@ PT027_0.py:44:13: PT027 Use `pytest.raises` instead of unittest-style `assertRai 48 | raise ValueError | = help: Replace `assertRaises` with `pytest.raises` - - diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap index cc642fb5d8aa7..427faf353d0ba 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap @@ -10,7 +10,7 @@ PT027_1.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaises` with `pytest.raises` -ℹ Unsafe fix +Suggested fix: 8 8 | raise ValueError 9 9 | 10 10 | def test_errors(self): @@ -18,4 +18,4 @@ PT027_1.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser 11 |+ with pytest.raises(ValueError): 12 12 | raise ValueError - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap index 6a87062097567..5775764ba4a20 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap @@ -10,9 +10,11 @@ doubles_all.py:1:1: Q002 [*] Double quote docstring found but single quotes pref | = help: Replace double quotes docstring with single quotes -ℹ Safe fix +Suggested fix: 1 |-"""This is a docstring.""" 1 |+'''This is a docstring.''' 2 2 | 3 3 | this_is_an_inline_string = "double quote string" -4 4 | +4 4 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap index 0ca50ac62e93a..27687aa43842a 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap @@ -12,7 +12,7 @@ doubles_all.py:3:28: Q000 [*] Double quotes found but single quotes preferred | = help: Replace double quotes with single quotes -ℹ Safe fix +Suggested fix: 1 1 | """This is a docstring.""" 2 2 | 3 |-this_is_an_inline_string = "double quote string" @@ -20,3 +20,5 @@ doubles_all.py:3:28: Q000 [*] Double quotes found but single quotes preferred 4 4 | 5 5 | this_is_a_multiline_string = """ 6 6 | double quote string + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap index ddffe1bb80a5f..d47b36d30b71d 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap @@ -13,7 +13,7 @@ doubles_all.py:5:30: Q001 [*] Double quote multiline found but single quotes pre | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | this_is_an_inline_string = "double quote string" 4 4 | @@ -22,3 +22,5 @@ doubles_all.py:5:30: Q001 [*] Double quote multiline found but single quotes pre 6 6 | double quote string 7 |-""" 7 |+''' + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap index 771a4ddc2b45d..4c2f8e0baa1c9 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap @@ -14,7 +14,7 @@ docstring_doubles.py:5:1: Q001 [*] Double quote multiline found but single quote | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 2 2 | Double quotes multiline module docstring 3 3 | """ 4 4 | @@ -27,6 +27,8 @@ docstring_doubles.py:5:1: Q001 [*] Double quote multiline found but single quote 9 9 | l = [] 10 10 | + Run `ruff check --fix` to apply this fix. + docstring_doubles.py:16:5: Q001 [*] Double quote multiline found but single quotes preferred | 14 | """ @@ -41,7 +43,7 @@ docstring_doubles.py:16:5: Q001 [*] Double quote multiline found but single quot | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 13 13 | Double quotes multiline class docstring 14 14 | """ 15 15 | @@ -54,6 +56,8 @@ docstring_doubles.py:16:5: Q001 [*] Double quote multiline found but single quot 20 20 | # The colon in the list indexing below is an edge case for the docstring scanner 21 21 | def f(self, bar=""" + Run `ruff check --fix` to apply this fix. + docstring_doubles.py:21:21: Q001 [*] Double quote multiline found but single quotes preferred | 20 | # The colon in the list indexing below is an edge case for the docstring scanner @@ -66,7 +70,7 @@ docstring_doubles.py:21:21: Q001 [*] Double quote multiline found but single quo | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 18 18 | """ 19 19 | 20 20 | # The colon in the list indexing below is an edge case for the docstring scanner @@ -78,6 +82,8 @@ docstring_doubles.py:21:21: Q001 [*] Double quote multiline found but single quo 24 24 | """ 25 25 | Double quotes multiline function docstring + Run `ruff check --fix` to apply this fix. + docstring_doubles.py:30:9: Q001 [*] Double quote multiline found but single quotes preferred | 28 | some_expression = 'hello world' @@ -92,7 +98,7 @@ docstring_doubles.py:30:9: Q001 [*] Double quote multiline found but single quot | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 27 27 | 28 28 | some_expression = 'hello world' 29 29 | @@ -105,6 +111,8 @@ docstring_doubles.py:30:9: Q001 [*] Double quote multiline found but single quot 34 34 | if l: 35 35 | """ + Run `ruff check --fix` to apply this fix. + docstring_doubles.py:35:13: Q001 [*] Double quote multiline found but single quotes preferred | 34 | if l: @@ -117,7 +125,7 @@ docstring_doubles.py:35:13: Q001 [*] Double quote multiline found but single quo | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 32 32 | """ 33 33 | 34 34 | if l: @@ -128,4 +136,4 @@ docstring_doubles.py:35:13: Q001 [*] Double quote multiline found but single quo 37 |+ ''' 38 38 | pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap index 5eb1e20892926..ce831e79d6ab9 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap @@ -12,7 +12,7 @@ docstring_doubles_class.py:3:5: Q001 [*] Double quote multiline found but single | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 1 1 | class SingleLineDocstrings(): 2 2 | """ Double quotes single line class docstring """ 3 |- """ Not a docstring """ @@ -21,6 +21,8 @@ docstring_doubles_class.py:3:5: Q001 [*] Double quote multiline found but single 5 5 | def foo(self, bar="""not a docstring"""): 6 6 | """ Double quotes single line method docstring""" + Run `ruff check --fix` to apply this fix. + docstring_doubles_class.py:5:23: Q001 [*] Double quote multiline found but single quotes preferred | 3 | """ Not a docstring """ @@ -32,7 +34,7 @@ docstring_doubles_class.py:5:23: Q001 [*] Double quote multiline found but singl | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 2 2 | """ Double quotes single line class docstring """ 3 3 | """ Not a docstring """ 4 4 | @@ -42,4 +44,4 @@ docstring_doubles_class.py:5:23: Q001 [*] Double quote multiline found but singl 7 7 | pass 8 8 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap index b669528cd7451..f06c82efba593 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap @@ -11,7 +11,7 @@ docstring_doubles_function.py:3:5: Q001 [*] Double quote multiline found but sin | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 1 1 | def foo(): 2 2 | """function without params, single line docstring""" 3 |- """ not a docstring""" @@ -20,6 +20,8 @@ docstring_doubles_function.py:3:5: Q001 [*] Double quote multiline found but sin 5 5 | 6 6 | + Run `ruff check --fix` to apply this fix. + docstring_doubles_function.py:11:5: Q001 [*] Double quote multiline found but single quotes preferred | 9 | function without params, multiline docstring @@ -30,7 +32,7 @@ docstring_doubles_function.py:11:5: Q001 [*] Double quote multiline found but si | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 8 8 | """ 9 9 | function without params, multiline docstring 10 10 | """ @@ -40,6 +42,8 @@ docstring_doubles_function.py:11:5: Q001 [*] Double quote multiline found but si 13 13 | 14 14 | + Run `ruff check --fix` to apply this fix. + docstring_doubles_function.py:15:39: Q001 [*] Double quote multiline found but single quotes preferred | 15 | def fun_with_params_no_docstring(a, b=""" @@ -51,7 +55,7 @@ docstring_doubles_function.py:15:39: Q001 [*] Double quote multiline found but s | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 12 12 | return 13 13 | 14 14 | @@ -64,6 +68,8 @@ docstring_doubles_function.py:15:39: Q001 [*] Double quote multiline found but s 19 19 | 20 20 | + Run `ruff check --fix` to apply this fix. + docstring_doubles_function.py:17:5: Q001 [*] Double quote multiline found but single quotes preferred | 15 | def fun_with_params_no_docstring(a, b=""" @@ -74,7 +80,7 @@ docstring_doubles_function.py:17:5: Q001 [*] Double quote multiline found but si | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 14 14 | 15 15 | def fun_with_params_no_docstring(a, b=""" 16 16 | not a @@ -84,6 +90,8 @@ docstring_doubles_function.py:17:5: Q001 [*] Double quote multiline found but si 19 19 | 20 20 | + Run `ruff check --fix` to apply this fix. + docstring_doubles_function.py:22:5: Q001 [*] Double quote multiline found but single quotes preferred | 21 | def fun_with_params_no_docstring2(a, b=c[foo():], c=\ @@ -93,7 +101,7 @@ docstring_doubles_function.py:22:5: Q001 [*] Double quote multiline found but si | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 19 19 | 20 20 | 21 21 | def fun_with_params_no_docstring2(a, b=c[foo():], c=\ @@ -103,4 +111,4 @@ docstring_doubles_function.py:22:5: Q001 [*] Double quote multiline found but si 24 24 | 25 25 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap index 058c60b92440b..a2248776f5b75 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap @@ -14,7 +14,7 @@ docstring_doubles_module_multiline.py:4:1: Q001 [*] Double quote multiline found | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 1 1 | """ 2 2 | Double quotes multiline module docstring 3 3 | """ @@ -27,6 +27,8 @@ docstring_doubles_module_multiline.py:4:1: Q001 [*] Double quote multiline found 8 8 | pass 9 9 | """ + Run `ruff check --fix` to apply this fix. + docstring_doubles_module_multiline.py:9:1: Q001 [*] Double quote multiline found but single quotes preferred | 7 | def foo(): @@ -38,7 +40,7 @@ docstring_doubles_module_multiline.py:9:1: Q001 [*] Double quote multiline found | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 6 6 | """ 7 7 | def foo(): 8 8 | pass @@ -48,4 +50,4 @@ docstring_doubles_module_multiline.py:9:1: Q001 [*] Double quote multiline found 11 |-""" 11 |+''' - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap index 64f43441c8d3a..f48a18fd1122f 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap @@ -11,7 +11,7 @@ docstring_doubles_module_singleline.py:2:1: Q001 [*] Double quote multiline foun | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 1 1 | """ Double quotes singleline module docstring """ 2 |-""" this is not a docstring """ 2 |+''' this is not a docstring ''' @@ -19,6 +19,8 @@ docstring_doubles_module_singleline.py:2:1: Q001 [*] Double quote multiline foun 4 4 | def foo(): 5 5 | pass + Run `ruff check --fix` to apply this fix. + docstring_doubles_module_singleline.py:6:1: Q001 [*] Double quote multiline found but single quotes preferred | 4 | def foo(): @@ -28,11 +30,11 @@ docstring_doubles_module_singleline.py:6:1: Q001 [*] Double quote multiline foun | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | def foo(): 5 5 | pass 6 |-""" this is not a docstring """ 6 |+''' this is not a docstring ''' - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap index c1c2f2c821599..d665dcbf3ab26 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap @@ -12,7 +12,7 @@ docstring_singles.py:1:1: Q002 [*] Single quote docstring found but double quote | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 1 |-''' 1 |+""" 2 2 | Single quotes multiline module docstring @@ -22,6 +22,8 @@ docstring_singles.py:1:1: Q002 [*] Single quote docstring found but double quote 5 5 | ''' 6 6 | this is not a docstring + Run `ruff check --fix` to apply this fix. + docstring_singles.py:14:5: Q002 [*] Single quote docstring found but double quotes preferred | 12 | class params \t not a docstring @@ -36,7 +38,7 @@ docstring_singles.py:14:5: Q002 [*] Single quote docstring found but double quot | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 11 11 | class Cls(MakeKlass(''' 12 12 | class params \t not a docstring 13 13 | ''')): @@ -49,6 +51,8 @@ docstring_singles.py:14:5: Q002 [*] Single quote docstring found but double quot 18 18 | ''' 19 19 | this is not a docstring + Run `ruff check --fix` to apply this fix. + docstring_singles.py:26:9: Q002 [*] Single quote docstring found but double quotes preferred | 24 | definitely not a docstring''', @@ -63,7 +67,7 @@ docstring_singles.py:26:9: Q002 [*] Single quote docstring found but double quot | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 23 23 | def f(self, bar=''' 24 24 | definitely not a docstring''', 25 25 | val=l[Cls():3]): @@ -76,4 +80,4 @@ docstring_singles.py:26:9: Q002 [*] Single quote docstring found but double quot 30 30 | some_expression = 'hello world' 31 31 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap index da70df063d6e5..5ecabc16d72ca 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap @@ -10,7 +10,7 @@ docstring_singles_class.py:2:5: Q002 [*] Single quote docstring found but double | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 1 1 | class SingleLineDocstrings(): 2 |- ''' Double quotes single line class docstring ''' 2 |+ """ Double quotes single line class docstring """ @@ -18,6 +18,8 @@ docstring_singles_class.py:2:5: Q002 [*] Single quote docstring found but double 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): + Run `ruff check --fix` to apply this fix. + docstring_singles_class.py:6:9: Q002 [*] Single quote docstring found but double quotes preferred | 5 | def foo(self, bar='''not a docstring'''): @@ -27,7 +29,7 @@ docstring_singles_class.py:6:9: Q002 [*] Single quote docstring found but double | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 3 3 | ''' Not a docstring ''' 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): @@ -37,6 +39,8 @@ docstring_singles_class.py:6:9: Q002 [*] Single quote docstring found but double 8 8 | 9 9 | class Nested(foo()[:]): ''' inline docstring '''; pass + Run `ruff check --fix` to apply this fix. + docstring_singles_class.py:9:29: Q002 [*] Single quote docstring found but double quotes preferred | 7 | pass @@ -46,11 +50,11 @@ docstring_singles_class.py:9:29: Q002 [*] Single quote docstring found but doubl | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 6 6 | ''' Double quotes single line method docstring''' 7 7 | pass 8 8 | 9 |- class Nested(foo()[:]): ''' inline docstring '''; pass 9 |+ class Nested(foo()[:]): """ inline docstring """; pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap index cad7d15422ec7..198234214c006 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap @@ -11,7 +11,7 @@ docstring_singles_function.py:2:5: Q002 [*] Single quote docstring found but dou | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 1 1 | def foo(): 2 |- '''function without params, single line docstring''' 2 |+ """function without params, single line docstring""" @@ -19,6 +19,8 @@ docstring_singles_function.py:2:5: Q002 [*] Single quote docstring found but dou 4 4 | return 5 5 | + Run `ruff check --fix` to apply this fix. + docstring_singles_function.py:8:5: Q002 [*] Single quote docstring found but double quotes preferred | 7 | def foo2(): @@ -32,7 +34,7 @@ docstring_singles_function.py:8:5: Q002 [*] Single quote docstring found but dou | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | 7 7 | def foo2(): @@ -45,6 +47,8 @@ docstring_singles_function.py:8:5: Q002 [*] Single quote docstring found but dou 12 12 | return 13 13 | + Run `ruff check --fix` to apply this fix. + docstring_singles_function.py:27:5: Q002 [*] Single quote docstring found but double quotes preferred | 26 | def function_with_single_docstring(a): @@ -53,7 +57,7 @@ docstring_singles_function.py:27:5: Q002 [*] Single quote docstring found but do | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 24 24 | 25 25 | 26 26 | def function_with_single_docstring(a): @@ -63,4 +67,4 @@ docstring_singles_function.py:27:5: Q002 [*] Single quote docstring found but do 29 29 | 30 30 | def double_inside_single(a): - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap index 6d3aeaab93d71..b01b0c9afa9b5 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap @@ -19,7 +19,7 @@ docstring_singles_mixed_quotes_class_var_1.py:2:33: Q002 [*] Single quote docstr | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 1 1 | class SingleLineDocstrings(): 2 |- ''"Start with empty string" ' and lint docstring safely' 2 |+ ''"Start with empty string" " and lint docstring safely" @@ -27,6 +27,8 @@ docstring_singles_mixed_quotes_class_var_1.py:2:33: Q002 [*] Single quote docstr 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): + Run `ruff check --fix` to apply this fix. + docstring_singles_mixed_quotes_class_var_1.py:6:9: Q002 Single quote docstring found but double quotes preferred | 5 | def foo(self, bar='''not a docstring'''): @@ -45,7 +47,7 @@ docstring_singles_mixed_quotes_class_var_1.py:6:37: Q002 [*] Single quote docstr | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 3 3 | ''' Not a docstring ''' 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): @@ -55,6 +57,8 @@ docstring_singles_mixed_quotes_class_var_1.py:6:37: Q002 [*] Single quote docstr 8 8 | 9 9 | class Nested(foo()[:]): ''"Start with empty string" ' and lint docstring safely'; pass + Run `ruff check --fix` to apply this fix. + docstring_singles_mixed_quotes_class_var_1.py:9:29: Q002 Single quote docstring found but double quotes preferred | 7 | pass @@ -73,9 +77,11 @@ docstring_singles_mixed_quotes_class_var_1.py:9:57: Q002 [*] Single quote docstr | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 6 6 | ''"Start with empty string" ' and lint docstring safely' 7 7 | pass 8 8 | 9 |- class Nested(foo()[:]): ''"Start with empty string" ' and lint docstring safely'; pass 9 |+ class Nested(foo()[:]): ''"Start with empty string" " and lint docstring safely"; pass + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap index 60ecc511e3e13..55c2f12e531c1 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap @@ -10,7 +10,7 @@ docstring_singles_mixed_quotes_class_var_2.py:2:5: Q002 [*] Single quote docstri | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 1 1 | class SingleLineDocstrings(): 2 |- 'Do not'" start with empty string" ' and lint docstring safely' 2 |+ "Do not"" start with empty string" ' and lint docstring safely' @@ -18,6 +18,8 @@ docstring_singles_mixed_quotes_class_var_2.py:2:5: Q002 [*] Single quote docstri 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): + Run `ruff check --fix` to apply this fix. + docstring_singles_mixed_quotes_class_var_2.py:2:40: Q002 [*] Single quote docstring found but double quotes preferred | 1 | class SingleLineDocstrings(): @@ -27,7 +29,7 @@ docstring_singles_mixed_quotes_class_var_2.py:2:40: Q002 [*] Single quote docstr | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 1 1 | class SingleLineDocstrings(): 2 |- 'Do not'" start with empty string" ' and lint docstring safely' 2 |+ 'Do not'" start with empty string" " and lint docstring safely" @@ -35,6 +37,8 @@ docstring_singles_mixed_quotes_class_var_2.py:2:40: Q002 [*] Single quote docstr 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): + Run `ruff check --fix` to apply this fix. + docstring_singles_mixed_quotes_class_var_2.py:6:9: Q002 [*] Single quote docstring found but double quotes preferred | 5 | def foo(self, bar='''not a docstring'''): @@ -44,7 +48,7 @@ docstring_singles_mixed_quotes_class_var_2.py:6:9: Q002 [*] Single quote docstri | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 3 3 | ''' Not a docstring ''' 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): @@ -54,6 +58,8 @@ docstring_singles_mixed_quotes_class_var_2.py:6:9: Q002 [*] Single quote docstri 8 8 | 9 9 | class Nested(foo()[:]): 'Do not'" start with empty string" ' and lint docstring safely'; pass + Run `ruff check --fix` to apply this fix. + docstring_singles_mixed_quotes_class_var_2.py:6:44: Q002 [*] Single quote docstring found but double quotes preferred | 5 | def foo(self, bar='''not a docstring'''): @@ -63,7 +69,7 @@ docstring_singles_mixed_quotes_class_var_2.py:6:44: Q002 [*] Single quote docstr | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 3 3 | ''' Not a docstring ''' 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): @@ -73,6 +79,8 @@ docstring_singles_mixed_quotes_class_var_2.py:6:44: Q002 [*] Single quote docstr 8 8 | 9 9 | class Nested(foo()[:]): 'Do not'" start with empty string" ' and lint docstring safely'; pass + Run `ruff check --fix` to apply this fix. + docstring_singles_mixed_quotes_class_var_2.py:9:29: Q002 [*] Single quote docstring found but double quotes preferred | 7 | pass @@ -82,13 +90,15 @@ docstring_singles_mixed_quotes_class_var_2.py:9:29: Q002 [*] Single quote docstr | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 6 6 | 'Do not'" start with empty string" ' and lint docstring safely' 7 7 | pass 8 8 | 9 |- class Nested(foo()[:]): 'Do not'" start with empty string" ' and lint docstring safely'; pass 9 |+ class Nested(foo()[:]): "Do not"" start with empty string" ' and lint docstring safely'; pass + Run `ruff check --fix` to apply this fix. + docstring_singles_mixed_quotes_class_var_2.py:9:64: Q002 [*] Single quote docstring found but double quotes preferred | 7 | pass @@ -98,9 +108,11 @@ docstring_singles_mixed_quotes_class_var_2.py:9:64: Q002 [*] Single quote docstr | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 6 6 | 'Do not'" start with empty string" ' and lint docstring safely' 7 7 | pass 8 8 | 9 |- class Nested(foo()[:]): 'Do not'" start with empty string" ' and lint docstring safely'; pass 9 |+ class Nested(foo()[:]): 'Do not'" start with empty string" " and lint docstring safely"; pass + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap index d8a027bcd0919..c89b998a10af2 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap @@ -19,13 +19,15 @@ docstring_singles_mixed_quotes_module_singleline_var_1.py:1:29: Q002 [*] Single | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 1 |-''"Start with empty string" ' and lint docstring safely' 1 |+''"Start with empty string" " and lint docstring safely" 2 2 | 3 3 | def foo(): 4 4 | pass + Run `ruff check --fix` to apply this fix. + docstring_singles_mixed_quotes_module_singleline_var_1.py:5:1: Q001 [*] Double quote multiline found but single quotes preferred | 3 | def foo(): @@ -35,9 +37,11 @@ docstring_singles_mixed_quotes_module_singleline_var_1.py:5:1: Q001 [*] Double q | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | def foo(): 4 4 | pass 5 |-""" this is not a docstring """ 5 |+''' this is not a docstring ''' + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap index 5ffafe0ffd2b6..f58f247893c91 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap @@ -10,13 +10,15 @@ docstring_singles_mixed_quotes_module_singleline_var_2.py:1:1: Q002 [*] Single q | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 1 |-'Do not'" start with empty string" ' and lint docstring safely' 1 |+"Do not"" start with empty string" ' and lint docstring safely' 2 2 | 3 3 | def foo(): 4 4 | pass + Run `ruff check --fix` to apply this fix. + docstring_singles_mixed_quotes_module_singleline_var_2.py:1:36: Q002 [*] Single quote docstring found but double quotes preferred | 1 | 'Do not'" start with empty string" ' and lint docstring safely' @@ -26,13 +28,15 @@ docstring_singles_mixed_quotes_module_singleline_var_2.py:1:36: Q002 [*] Single | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 1 |-'Do not'" start with empty string" ' and lint docstring safely' 1 |+'Do not'" start with empty string" " and lint docstring safely" 2 2 | 3 3 | def foo(): 4 4 | pass + Run `ruff check --fix` to apply this fix. + docstring_singles_mixed_quotes_module_singleline_var_2.py:5:1: Q001 [*] Double quote multiline found but single quotes preferred | 3 | def foo(): @@ -42,9 +46,11 @@ docstring_singles_mixed_quotes_module_singleline_var_2.py:5:1: Q001 [*] Double q | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | def foo(): 4 4 | pass 5 |-""" this is not a docstring """ 5 |+''' this is not a docstring ''' + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap index 3924f21233c1f..45ce3e07dac2d 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap @@ -12,7 +12,7 @@ docstring_singles_module_multiline.py:1:1: Q002 [*] Single quote docstring found | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 1 |-''' 1 |+""" 2 2 | Double quotes multiline module docstring @@ -22,4 +22,4 @@ docstring_singles_module_multiline.py:1:1: Q002 [*] Single quote docstring found 5 5 | this is not a docstring 6 6 | ''' - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap index c1c3012212b24..69178f5f61dde 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap @@ -9,11 +9,11 @@ docstring_singles_module_singleline.py:1:1: Q002 [*] Single quote docstring foun | = help: Replace single quotes docstring with double quotes -ℹ Safe fix +Suggested fix: 1 |-''' Double quotes singleline module docstring ''' 1 |+""" Double quotes singleline module docstring """ 2 2 | ''' this is not a docstring ''' 3 3 | 4 4 | def foo(): - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap index 8e031c7aab323..209167ba368b6 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap @@ -12,7 +12,7 @@ docstring_doubles.py:1:1: Q002 [*] Double quote docstring found but single quote | = help: Replace double quotes docstring with single quotes -ℹ Safe fix +Suggested fix: 1 |-""" 1 |+''' 2 2 | Double quotes multiline module docstring @@ -22,6 +22,8 @@ docstring_doubles.py:1:1: Q002 [*] Double quote docstring found but single quote 5 5 | """ 6 6 | this is not a docstring + Run `ruff check --fix` to apply this fix. + docstring_doubles.py:12:5: Q002 [*] Double quote docstring found but single quotes preferred | 11 | class Cls: @@ -35,7 +37,7 @@ docstring_doubles.py:12:5: Q002 [*] Double quote docstring found but single quot | = help: Replace double quotes docstring with single quotes -ℹ Safe fix +Suggested fix: 9 9 | l = [] 10 10 | 11 11 | class Cls: @@ -48,6 +50,8 @@ docstring_doubles.py:12:5: Q002 [*] Double quote docstring found but single quot 16 16 | """ 17 17 | this is not a docstring + Run `ruff check --fix` to apply this fix. + docstring_doubles.py:24:9: Q002 [*] Double quote docstring found but single quotes preferred | 22 | definitely not a docstring""", @@ -62,7 +66,7 @@ docstring_doubles.py:24:9: Q002 [*] Double quote docstring found but single quot | = help: Replace double quotes docstring with single quotes -ℹ Safe fix +Suggested fix: 21 21 | def f(self, bar=""" 22 22 | definitely not a docstring""", 23 23 | val=l[Cls():3]): @@ -75,4 +79,4 @@ docstring_doubles.py:24:9: Q002 [*] Double quote docstring found but single quot 28 28 | some_expression = 'hello world' 29 29 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap index 18e358b897580..77a57c55ebebe 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap @@ -10,7 +10,7 @@ docstring_doubles_class.py:2:5: Q002 [*] Double quote docstring found but single | = help: Replace double quotes docstring with single quotes -ℹ Safe fix +Suggested fix: 1 1 | class SingleLineDocstrings(): 2 |- """ Double quotes single line class docstring """ 2 |+ ''' Double quotes single line class docstring ''' @@ -18,6 +18,8 @@ docstring_doubles_class.py:2:5: Q002 [*] Double quote docstring found but single 4 4 | 5 5 | def foo(self, bar="""not a docstring"""): + Run `ruff check --fix` to apply this fix. + docstring_doubles_class.py:6:9: Q002 [*] Double quote docstring found but single quotes preferred | 5 | def foo(self, bar="""not a docstring"""): @@ -27,7 +29,7 @@ docstring_doubles_class.py:6:9: Q002 [*] Double quote docstring found but single | = help: Replace double quotes docstring with single quotes -ℹ Safe fix +Suggested fix: 3 3 | """ Not a docstring """ 4 4 | 5 5 | def foo(self, bar="""not a docstring"""): @@ -37,6 +39,8 @@ docstring_doubles_class.py:6:9: Q002 [*] Double quote docstring found but single 8 8 | 9 9 | class Nested(foo()[:]): """ inline docstring """; pass + Run `ruff check --fix` to apply this fix. + docstring_doubles_class.py:9:29: Q002 [*] Double quote docstring found but single quotes preferred | 7 | pass @@ -46,11 +50,11 @@ docstring_doubles_class.py:9:29: Q002 [*] Double quote docstring found but singl | = help: Replace double quotes docstring with single quotes -ℹ Safe fix +Suggested fix: 6 6 | """ Double quotes single line method docstring""" 7 7 | pass 8 8 | 9 |- class Nested(foo()[:]): """ inline docstring """; pass 9 |+ class Nested(foo()[:]): ''' inline docstring '''; pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap index 3758fc2a7bd1b..f9e3355a51a53 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap @@ -11,7 +11,7 @@ docstring_doubles_function.py:2:5: Q002 [*] Double quote docstring found but sin | = help: Replace double quotes docstring with single quotes -ℹ Safe fix +Suggested fix: 1 1 | def foo(): 2 |- """function without params, single line docstring""" 2 |+ '''function without params, single line docstring''' @@ -19,6 +19,8 @@ docstring_doubles_function.py:2:5: Q002 [*] Double quote docstring found but sin 4 4 | return 5 5 | + Run `ruff check --fix` to apply this fix. + docstring_doubles_function.py:8:5: Q002 [*] Double quote docstring found but single quotes preferred | 7 | def foo2(): @@ -32,7 +34,7 @@ docstring_doubles_function.py:8:5: Q002 [*] Double quote docstring found but sin | = help: Replace double quotes docstring with single quotes -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | 7 7 | def foo2(): @@ -45,6 +47,8 @@ docstring_doubles_function.py:8:5: Q002 [*] Double quote docstring found but sin 12 12 | return 13 13 | + Run `ruff check --fix` to apply this fix. + docstring_doubles_function.py:27:5: Q002 [*] Double quote docstring found but single quotes preferred | 26 | def function_with_single_docstring(a): @@ -53,7 +57,7 @@ docstring_doubles_function.py:27:5: Q002 [*] Double quote docstring found but si | = help: Replace double quotes docstring with single quotes -ℹ Safe fix +Suggested fix: 24 24 | 25 25 | 26 26 | def function_with_single_docstring(a): @@ -63,4 +67,4 @@ docstring_doubles_function.py:27:5: Q002 [*] Double quote docstring found but si 29 29 | 30 30 | def double_inside_single(a): - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap index e02c3c17c1e3e..b5a5b37cd361d 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap @@ -10,7 +10,7 @@ docstring_doubles_mixed_quotes_class_var_2.py:2:5: Q002 [*] Double quote docstri | = help: Replace double quotes docstring with single quotes -ℹ Safe fix +Suggested fix: 1 1 | class SingleLineDocstrings(): 2 |- "Do not"' start with empty string' ' and lint docstring safely' 2 |+ 'Do not'' start with empty string' ' and lint docstring safely' @@ -18,6 +18,8 @@ docstring_doubles_mixed_quotes_class_var_2.py:2:5: Q002 [*] Double quote docstri 4 4 | 5 5 | def foo(self, bar="""not a docstring"""): + Run `ruff check --fix` to apply this fix. + docstring_doubles_mixed_quotes_class_var_2.py:6:9: Q002 [*] Double quote docstring found but single quotes preferred | 5 | def foo(self, bar="""not a docstring"""): @@ -27,7 +29,7 @@ docstring_doubles_mixed_quotes_class_var_2.py:6:9: Q002 [*] Double quote docstri | = help: Replace double quotes docstring with single quotes -ℹ Safe fix +Suggested fix: 3 3 | """ Not a docstring """ 4 4 | 5 5 | def foo(self, bar="""not a docstring"""): @@ -37,6 +39,8 @@ docstring_doubles_mixed_quotes_class_var_2.py:6:9: Q002 [*] Double quote docstri 8 8 | 9 9 | class Nested(foo()[:]): "Do not"' start with empty string' ' and lint docstring safely'; pass + Run `ruff check --fix` to apply this fix. + docstring_doubles_mixed_quotes_class_var_2.py:9:29: Q002 [*] Double quote docstring found but single quotes preferred | 7 | pass @@ -46,9 +50,11 @@ docstring_doubles_mixed_quotes_class_var_2.py:9:29: Q002 [*] Double quote docstr | = help: Replace double quotes docstring with single quotes -ℹ Safe fix +Suggested fix: 6 6 | "Do not"' start with empty string' ' and lint docstring safely' 7 7 | pass 8 8 | 9 |- class Nested(foo()[:]): "Do not"' start with empty string' ' and lint docstring safely'; pass 9 |+ class Nested(foo()[:]): 'Do not'' start with empty string' ' and lint docstring safely'; pass + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap index 31efd169aff73..627dbd5aafcef 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap @@ -10,9 +10,11 @@ docstring_doubles_mixed_quotes_module_singleline_var_2.py:1:1: Q002 [*] Double q | = help: Replace double quotes docstring with single quotes -ℹ Safe fix +Suggested fix: 1 |-"Do not"' start with empty string' ' and lint docstring safely' 1 |+'Do not'' start with empty string' ' and lint docstring safely' 2 2 | 3 3 | def foo(): 4 4 | pass + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap index f66291915dcde..7f5027bbdc20e 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap @@ -12,7 +12,7 @@ docstring_doubles_module_multiline.py:1:1: Q002 [*] Double quote docstring found | = help: Replace double quotes docstring with single quotes -ℹ Safe fix +Suggested fix: 1 |-""" 1 |+''' 2 2 | Double quotes multiline module docstring @@ -22,4 +22,4 @@ docstring_doubles_module_multiline.py:1:1: Q002 [*] Double quote docstring found 5 5 | this is not a docstring 6 6 | """ - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap index 025add5fdd0bc..ee0b75d663a0f 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap @@ -9,11 +9,11 @@ docstring_doubles_module_singleline.py:1:1: Q002 [*] Double quote docstring foun | = help: Replace double quotes docstring with single quotes -ℹ Safe fix +Suggested fix: 1 |-""" Double quotes singleline module docstring """ 1 |+''' Double quotes singleline module docstring ''' 2 2 | """ this is not a docstring """ 3 3 | 4 4 | def foo(): - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap index 2a790da62fac4..515f7a3ac3ab0 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap @@ -14,7 +14,7 @@ docstring_singles.py:5:1: Q001 [*] Single quote multiline found but double quote | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 2 2 | Single quotes multiline module docstring 3 3 | ''' 4 4 | @@ -27,6 +27,8 @@ docstring_singles.py:5:1: Q001 [*] Single quote multiline found but double quote 9 9 | l = [] 10 10 | + Run `ruff check --fix` to apply this fix. + docstring_singles.py:11:21: Q001 [*] Single quote multiline found but double quotes preferred | 9 | l = [] @@ -41,7 +43,7 @@ docstring_singles.py:11:21: Q001 [*] Single quote multiline found but double quo | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 8 8 | 9 9 | l = [] 10 10 | @@ -54,6 +56,8 @@ docstring_singles.py:11:21: Q001 [*] Single quote multiline found but double quo 15 15 | Single quotes multiline class docstring 16 16 | ''' + Run `ruff check --fix` to apply this fix. + docstring_singles.py:18:5: Q001 [*] Single quote multiline found but double quotes preferred | 16 | ''' @@ -68,7 +72,7 @@ docstring_singles.py:18:5: Q001 [*] Single quote multiline found but double quot | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 15 15 | Single quotes multiline class docstring 16 16 | ''' 17 17 | @@ -81,6 +85,8 @@ docstring_singles.py:18:5: Q001 [*] Single quote multiline found but double quot 22 22 | # The colon in the list indexing below is an edge case for the docstring scanner 23 23 | def f(self, bar=''' + Run `ruff check --fix` to apply this fix. + docstring_singles.py:23:21: Q001 [*] Single quote multiline found but double quotes preferred | 22 | # The colon in the list indexing below is an edge case for the docstring scanner @@ -93,7 +99,7 @@ docstring_singles.py:23:21: Q001 [*] Single quote multiline found but double quo | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 20 20 | ''' 21 21 | 22 22 | # The colon in the list indexing below is an edge case for the docstring scanner @@ -105,6 +111,8 @@ docstring_singles.py:23:21: Q001 [*] Single quote multiline found but double quo 26 26 | ''' 27 27 | Single quotes multiline function docstring + Run `ruff check --fix` to apply this fix. + docstring_singles.py:32:9: Q001 [*] Single quote multiline found but double quotes preferred | 30 | some_expression = 'hello world' @@ -119,7 +127,7 @@ docstring_singles.py:32:9: Q001 [*] Single quote multiline found but double quot | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 29 29 | 30 30 | some_expression = 'hello world' 31 31 | @@ -132,6 +140,8 @@ docstring_singles.py:32:9: Q001 [*] Single quote multiline found but double quot 36 36 | if l: 37 37 | ''' + Run `ruff check --fix` to apply this fix. + docstring_singles.py:37:13: Q001 [*] Single quote multiline found but double quotes preferred | 36 | if l: @@ -144,7 +154,7 @@ docstring_singles.py:37:13: Q001 [*] Single quote multiline found but double quo | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 34 34 | ''' 35 35 | 36 36 | if l: @@ -155,4 +165,4 @@ docstring_singles.py:37:13: Q001 [*] Single quote multiline found but double quo 39 |+ """ 40 40 | pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap index a3a5bcf66ec88..a607e41bf5f4d 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap @@ -12,7 +12,7 @@ docstring_singles_class.py:3:5: Q001 [*] Single quote multiline found but double | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 1 1 | class SingleLineDocstrings(): 2 2 | ''' Double quotes single line class docstring ''' 3 |- ''' Not a docstring ''' @@ -21,6 +21,8 @@ docstring_singles_class.py:3:5: Q001 [*] Single quote multiline found but double 5 5 | def foo(self, bar='''not a docstring'''): 6 6 | ''' Double quotes single line method docstring''' + Run `ruff check --fix` to apply this fix. + docstring_singles_class.py:5:23: Q001 [*] Single quote multiline found but double quotes preferred | 3 | ''' Not a docstring ''' @@ -32,7 +34,7 @@ docstring_singles_class.py:5:23: Q001 [*] Single quote multiline found but doubl | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 2 2 | ''' Double quotes single line class docstring ''' 3 3 | ''' Not a docstring ''' 4 4 | @@ -42,4 +44,4 @@ docstring_singles_class.py:5:23: Q001 [*] Single quote multiline found but doubl 7 7 | pass 8 8 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap index afede01c5e111..5caf4931eeefa 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap @@ -11,7 +11,7 @@ docstring_singles_function.py:3:5: Q001 [*] Single quote multiline found but dou | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 1 1 | def foo(): 2 2 | '''function without params, single line docstring''' 3 |- ''' not a docstring''' @@ -20,6 +20,8 @@ docstring_singles_function.py:3:5: Q001 [*] Single quote multiline found but dou 5 5 | 6 6 | + Run `ruff check --fix` to apply this fix. + docstring_singles_function.py:11:5: Q001 [*] Single quote multiline found but double quotes preferred | 9 | function without params, multiline docstring @@ -30,7 +32,7 @@ docstring_singles_function.py:11:5: Q001 [*] Single quote multiline found but do | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 8 8 | ''' 9 9 | function without params, multiline docstring 10 10 | ''' @@ -40,6 +42,8 @@ docstring_singles_function.py:11:5: Q001 [*] Single quote multiline found but do 13 13 | 14 14 | + Run `ruff check --fix` to apply this fix. + docstring_singles_function.py:15:39: Q001 [*] Single quote multiline found but double quotes preferred | 15 | def fun_with_params_no_docstring(a, b=''' @@ -51,7 +55,7 @@ docstring_singles_function.py:15:39: Q001 [*] Single quote multiline found but d | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 12 12 | return 13 13 | 14 14 | @@ -64,6 +68,8 @@ docstring_singles_function.py:15:39: Q001 [*] Single quote multiline found but d 19 19 | 20 20 | + Run `ruff check --fix` to apply this fix. + docstring_singles_function.py:17:5: Q001 [*] Single quote multiline found but double quotes preferred | 15 | def fun_with_params_no_docstring(a, b=''' @@ -74,7 +80,7 @@ docstring_singles_function.py:17:5: Q001 [*] Single quote multiline found but do | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 14 14 | 15 15 | def fun_with_params_no_docstring(a, b=''' 16 16 | not a @@ -84,6 +90,8 @@ docstring_singles_function.py:17:5: Q001 [*] Single quote multiline found but do 19 19 | 20 20 | + Run `ruff check --fix` to apply this fix. + docstring_singles_function.py:22:5: Q001 [*] Single quote multiline found but double quotes preferred | 21 | def fun_with_params_no_docstring2(a, b=c[foo():], c=\ @@ -93,7 +101,7 @@ docstring_singles_function.py:22:5: Q001 [*] Single quote multiline found but do | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 19 19 | 20 20 | 21 21 | def fun_with_params_no_docstring2(a, b=c[foo():], c=\ @@ -103,4 +111,4 @@ docstring_singles_function.py:22:5: Q001 [*] Single quote multiline found but do 24 24 | 25 25 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap index 3cefd7eb4a27a..f8a1396a8b853 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap @@ -14,7 +14,7 @@ docstring_singles_module_multiline.py:4:1: Q001 [*] Single quote multiline found | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 1 1 | ''' 2 2 | Double quotes multiline module docstring 3 3 | ''' @@ -27,6 +27,8 @@ docstring_singles_module_multiline.py:4:1: Q001 [*] Single quote multiline found 8 8 | pass 9 9 | ''' + Run `ruff check --fix` to apply this fix. + docstring_singles_module_multiline.py:9:1: Q001 [*] Single quote multiline found but double quotes preferred | 7 | def foo(): @@ -38,7 +40,7 @@ docstring_singles_module_multiline.py:9:1: Q001 [*] Single quote multiline found | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 6 6 | ''' 7 7 | def foo(): 8 8 | pass @@ -48,4 +50,4 @@ docstring_singles_module_multiline.py:9:1: Q001 [*] Single quote multiline found 11 |-''' 11 |+""" - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap index f92fff71dba70..2669311a27ef9 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap @@ -11,7 +11,7 @@ docstring_singles_module_singleline.py:2:1: Q001 [*] Single quote multiline foun | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 1 1 | ''' Double quotes singleline module docstring ''' 2 |-''' this is not a docstring ''' 2 |+""" this is not a docstring """ @@ -19,6 +19,8 @@ docstring_singles_module_singleline.py:2:1: Q001 [*] Single quote multiline foun 4 4 | def foo(): 5 5 | pass + Run `ruff check --fix` to apply this fix. + docstring_singles_module_singleline.py:6:1: Q001 [*] Single quote multiline found but double quotes preferred | 4 | def foo(): @@ -28,11 +30,11 @@ docstring_singles_module_singleline.py:6:1: Q001 [*] Single quote multiline foun | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | def foo(): 5 5 | pass 6 |-''' this is not a docstring ''' 6 |+""" this is not a docstring """ - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap index 81b0fdf4da700..4e2552a2af942 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap @@ -10,13 +10,15 @@ singles.py:1:25: Q000 [*] Single quotes found but double quotes preferred | = help: Replace single quotes with double quotes -ℹ Safe fix +Suggested fix: 1 |-this_should_be_linted = 'single quote string' 1 |+this_should_be_linted = "single quote string" 2 2 | this_should_be_linted = u'double quote string' 3 3 | this_should_be_linted = f'double quote string' 4 4 | this_should_be_linted = f'double {"quote"} string' + Run `ruff check --fix` to apply this fix. + singles.py:2:25: Q000 [*] Single quotes found but double quotes preferred | 1 | this_should_be_linted = 'single quote string' @@ -27,7 +29,7 @@ singles.py:2:25: Q000 [*] Single quotes found but double quotes preferred | = help: Replace single quotes with double quotes -ℹ Safe fix +Suggested fix: 1 1 | this_should_be_linted = 'single quote string' 2 |-this_should_be_linted = u'double quote string' 2 |+this_should_be_linted = u"double quote string" @@ -35,6 +37,8 @@ singles.py:2:25: Q000 [*] Single quotes found but double quotes preferred 4 4 | this_should_be_linted = f'double {"quote"} string' 5 5 | + Run `ruff check --fix` to apply this fix. + singles.py:3:25: Q000 [*] Single quotes found but double quotes preferred | 1 | this_should_be_linted = 'single quote string' @@ -45,7 +49,7 @@ singles.py:3:25: Q000 [*] Single quotes found but double quotes preferred | = help: Replace single quotes with double quotes -ℹ Safe fix +Suggested fix: 1 1 | this_should_be_linted = 'single quote string' 2 2 | this_should_be_linted = u'double quote string' 3 |-this_should_be_linted = f'double quote string' @@ -53,3 +57,5 @@ singles.py:3:25: Q000 [*] Single quotes found but double quotes preferred 4 4 | this_should_be_linted = f'double {"quote"} string' 5 5 | 6 6 | # https://github.com/astral-sh/ruff/issues/10546 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap index 4cc1920e73b72..6f301798de9ec 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap @@ -10,13 +10,15 @@ singles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 1 |-this_should_raise_Q003 = "This is a \"string\"" 1 |+this_should_raise_Q003 = 'This is a "string"' 2 2 | this_is_fine = "'This' is a \"string\"" 3 3 | this_is_fine = 'This is a "string"' 4 4 | this_is_fine = '\'This\' is a "string"' + Run `ruff check --fix` to apply this fix. + singles_escaped.py:9:5: Q003 [*] Change outer quotes to avoid escaping inner quotes | 7 | this_should_raise = ( @@ -27,7 +29,7 @@ singles_escaped.py:9:5: Q003 [*] Change outer quotes to avoid escaping inner quo | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 6 6 | this_is_fine = R"This is a \"string\"" 7 7 | this_should_raise = ( 8 8 | "This is a" @@ -37,6 +39,8 @@ singles_escaped.py:9:5: Q003 [*] Change outer quotes to avoid escaping inner quo 11 11 | 12 12 | # Same as above, but with f-strings + Run `ruff check --fix` to apply this fix. + singles_escaped.py:13:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 12 | # Same as above, but with f-strings @@ -47,7 +51,7 @@ singles_escaped.py:13:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 10 10 | ) 11 11 | 12 12 | # Same as above, but with f-strings @@ -57,6 +61,8 @@ singles_escaped.py:13:1: Q003 [*] Change outer quotes to avoid escaping inner qu 15 15 | f'This is a "string"' 16 16 | f'\'This\' is a "string"' + Run `ruff check --fix` to apply this fix. + singles_escaped.py:21:5: Q003 [*] Change outer quotes to avoid escaping inner quotes | 19 | foo = ( @@ -67,7 +73,7 @@ singles_escaped.py:21:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 18 18 | fR"This is a \"string\"" 19 19 | foo = ( 20 20 | f"This is a" @@ -77,6 +83,8 @@ singles_escaped.py:21:5: Q003 [*] Change outer quotes to avoid escaping inner qu 23 23 | 24 24 | # Nested f-strings (Python 3.12+) + Run `ruff check --fix` to apply this fix. + singles_escaped.py:31:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 29 | # @@ -88,7 +96,7 @@ singles_escaped.py:31:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 28 28 | # f'"foo" {"nested"}' 29 29 | # 30 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -98,6 +106,8 @@ singles_escaped.py:31:1: Q003 [*] Change outer quotes to avoid escaping inner qu 33 33 | f"\"foo\" {f"\"foo\""} \"\"" # Q003 34 34 | + Run `ruff check --fix` to apply this fix. + singles_escaped.py:32:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -108,7 +118,7 @@ singles_escaped.py:32:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 29 29 | # 30 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 31 31 | f"\"foo\" {"foo"}" # Q003 @@ -118,6 +128,8 @@ singles_escaped.py:32:1: Q003 [*] Change outer quotes to avoid escaping inner qu 34 34 | 35 35 | f"normal {f"nested"} normal" + Run `ruff check --fix` to apply this fix. + singles_escaped.py:33:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 31 | f"\"foo\" {"foo"}" # Q003 @@ -129,7 +141,7 @@ singles_escaped.py:33:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 30 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 31 31 | f"\"foo\" {"foo"}" # Q003 32 32 | f"\"foo\" {f"foo"}" # Q003 @@ -139,6 +151,8 @@ singles_escaped.py:33:1: Q003 [*] Change outer quotes to avoid escaping inner qu 35 35 | f"normal {f"nested"} normal" 36 36 | f"\"normal\" {f"nested"} normal" # Q003 + Run `ruff check --fix` to apply this fix. + singles_escaped.py:33:12: Q003 [*] Change outer quotes to avoid escaping inner quotes | 31 | f"\"foo\" {"foo"}" # Q003 @@ -150,7 +164,7 @@ singles_escaped.py:33:12: Q003 [*] Change outer quotes to avoid escaping inner q | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 30 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 31 31 | f"\"foo\" {"foo"}" # Q003 32 32 | f"\"foo\" {f"foo"}" # Q003 @@ -160,6 +174,8 @@ singles_escaped.py:33:12: Q003 [*] Change outer quotes to avoid escaping inner q 35 35 | f"normal {f"nested"} normal" 36 36 | f"\"normal\" {f"nested"} normal" # Q003 + Run `ruff check --fix` to apply this fix. + singles_escaped.py:36:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 35 | f"normal {f"nested"} normal" @@ -170,7 +186,7 @@ singles_escaped.py:36:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 33 33 | f"\"foo\" {f"\"foo\""} \"\"" # Q003 34 34 | 35 35 | f"normal {f"nested"} normal" @@ -180,6 +196,8 @@ singles_escaped.py:36:1: Q003 [*] Change outer quotes to avoid escaping inner qu 38 38 | f"\"normal\" {f"\"nested\" {"other"} normal"} 'single quotes'" # Q003 39 39 | f"\"normal\" {f"\"nested\" {"other"} 'single quotes'"} normal" # Q003 + Run `ruff check --fix` to apply this fix. + singles_escaped.py:38:15: Q003 [*] Change outer quotes to avoid escaping inner quotes | 36 | f"\"normal\" {f"nested"} normal" # Q003 @@ -190,7 +208,7 @@ singles_escaped.py:38:15: Q003 [*] Change outer quotes to avoid escaping inner q | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 35 35 | f"normal {f"nested"} normal" 36 36 | f"\"normal\" {f"nested"} normal" # Q003 37 37 | f"\"normal\" {f"nested"} 'single quotes'" @@ -198,6 +216,8 @@ singles_escaped.py:38:15: Q003 [*] Change outer quotes to avoid escaping inner q 38 |+f"\"normal\" {f'"nested" {"other"} normal'} 'single quotes'" # Q003 39 39 | f"\"normal\" {f"\"nested\" {"other"} 'single quotes'"} normal" # Q003 + Run `ruff check --fix` to apply this fix. + singles_escaped.py:39:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 37 | f"\"normal\" {f"nested"} 'single quotes'" @@ -207,11 +227,11 @@ singles_escaped.py:39:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 36 36 | f"\"normal\" {f"nested"} normal" # Q003 37 37 | f"\"normal\" {f"nested"} 'single quotes'" 38 38 | f"\"normal\" {f"\"nested\" {"other"} normal"} 'single quotes'" # Q003 39 |-f"\"normal\" {f"\"nested\" {"other"} 'single quotes'"} normal" # Q003 39 |+f'"normal" {f"\"nested\" {"other"} 'single quotes'"} normal' # Q003 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_py311.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_py311.snap index e3d039ba634e7..e155dd4ffe7b9 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_py311.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_py311.snap @@ -10,13 +10,15 @@ singles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 1 |-this_should_raise_Q003 = "This is a \"string\"" 1 |+this_should_raise_Q003 = 'This is a "string"' 2 2 | this_is_fine = "'This' is a \"string\"" 3 3 | this_is_fine = 'This is a "string"' 4 4 | this_is_fine = '\'This\' is a "string"' + Run `ruff check --fix` to apply this fix. + singles_escaped.py:9:5: Q003 [*] Change outer quotes to avoid escaping inner quotes | 7 | this_should_raise = ( @@ -27,7 +29,7 @@ singles_escaped.py:9:5: Q003 [*] Change outer quotes to avoid escaping inner quo | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 6 6 | this_is_fine = R"This is a \"string\"" 7 7 | this_should_raise = ( 8 8 | "This is a" @@ -37,6 +39,8 @@ singles_escaped.py:9:5: Q003 [*] Change outer quotes to avoid escaping inner quo 11 11 | 12 12 | # Same as above, but with f-strings + Run `ruff check --fix` to apply this fix. + singles_escaped.py:13:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 12 | # Same as above, but with f-strings @@ -47,7 +51,7 @@ singles_escaped.py:13:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 10 10 | ) 11 11 | 12 12 | # Same as above, but with f-strings @@ -57,6 +61,8 @@ singles_escaped.py:13:1: Q003 [*] Change outer quotes to avoid escaping inner qu 15 15 | f'This is a "string"' 16 16 | f'\'This\' is a "string"' + Run `ruff check --fix` to apply this fix. + singles_escaped.py:21:5: Q003 [*] Change outer quotes to avoid escaping inner quotes | 19 | foo = ( @@ -67,7 +73,7 @@ singles_escaped.py:21:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 18 18 | fR"This is a \"string\"" 19 19 | foo = ( 20 20 | f"This is a" @@ -77,4 +83,4 @@ singles_escaped.py:21:5: Q003 [*] Change outer quotes to avoid escaping inner qu 23 23 | 24 24 | # Nested f-strings (Python 3.12+) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap index 5408f3962565a..e8ff426953038 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap @@ -10,13 +10,15 @@ singles_escaped_unnecessary.py:1:26: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 1 |-this_should_raise_Q004 = "This is a \'string\'" 1 |+this_should_raise_Q004 = "This is a 'string'" 2 2 | this_should_raise_Q004 = "'This' is a \'string\'" 3 3 | this_is_fine = 'This is a "string"' 4 4 | this_is_fine = '\'This\' is a "string"' + Run `ruff check --fix` to apply this fix. + singles_escaped_unnecessary.py:2:26: Q004 [*] Unnecessary escape on inner quote character | 1 | this_should_raise_Q004 = "This is a \'string\'" @@ -27,7 +29,7 @@ singles_escaped_unnecessary.py:2:26: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 1 1 | this_should_raise_Q004 = "This is a \'string\'" 2 |-this_should_raise_Q004 = "'This' is a \'string\'" 2 |+this_should_raise_Q004 = "'This' is a 'string'" @@ -35,6 +37,8 @@ singles_escaped_unnecessary.py:2:26: Q004 [*] Unnecessary escape on inner quote 4 4 | this_is_fine = '\'This\' is a "string"' 5 5 | this_is_fine = r"This is a \'string\'" + Run `ruff check --fix` to apply this fix. + singles_escaped_unnecessary.py:9:5: Q004 [*] Unnecessary escape on inner quote character | 7 | this_should_raise_Q004 = ( @@ -45,7 +49,7 @@ singles_escaped_unnecessary.py:9:5: Q004 [*] Unnecessary escape on inner quote c | = help: Remove backslash -ℹ Safe fix +Suggested fix: 6 6 | this_is_fine = R"This is a \'string\'" 7 7 | this_should_raise_Q004 = ( 8 8 | "This is a" @@ -55,6 +59,8 @@ singles_escaped_unnecessary.py:9:5: Q004 [*] Unnecessary escape on inner quote c 11 11 | 12 12 | # Same as above, but with f-strings + Run `ruff check --fix` to apply this fix. + singles_escaped_unnecessary.py:13:1: Q004 [*] Unnecessary escape on inner quote character | 12 | # Same as above, but with f-strings @@ -65,7 +71,7 @@ singles_escaped_unnecessary.py:13:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 10 10 | ) 11 11 | 12 12 | # Same as above, but with f-strings @@ -75,6 +81,8 @@ singles_escaped_unnecessary.py:13:1: Q004 [*] Unnecessary escape on inner quote 15 15 | f'This is a "string"' 16 16 | f'\'This\' is a "string"' + Run `ruff check --fix` to apply this fix. + singles_escaped_unnecessary.py:14:1: Q004 [*] Unnecessary escape on inner quote character | 12 | # Same as above, but with f-strings @@ -86,7 +94,7 @@ singles_escaped_unnecessary.py:14:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 11 11 | 12 12 | # Same as above, but with f-strings 13 13 | f"This is a \'string\'" # Q004 @@ -96,6 +104,8 @@ singles_escaped_unnecessary.py:14:1: Q004 [*] Unnecessary escape on inner quote 16 16 | f'\'This\' is a "string"' 17 17 | fr"This is a \'string\'" + Run `ruff check --fix` to apply this fix. + singles_escaped_unnecessary.py:21:5: Q004 [*] Unnecessary escape on inner quote character | 19 | this_should_raise_Q004 = ( @@ -106,7 +116,7 @@ singles_escaped_unnecessary.py:21:5: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 18 18 | fR"This is a \'string\'" 19 19 | this_should_raise_Q004 = ( 20 20 | f"This is a" @@ -116,6 +126,8 @@ singles_escaped_unnecessary.py:21:5: Q004 [*] Unnecessary escape on inner quote 23 23 | 24 24 | # Nested f-strings (Python 3.12+) + Run `ruff check --fix` to apply this fix. + singles_escaped_unnecessary.py:31:1: Q004 [*] Unnecessary escape on inner quote character | 29 | # @@ -127,7 +139,7 @@ singles_escaped_unnecessary.py:31:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 28 28 | # f'"foo" {"nested"}' 29 29 | # 30 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -137,6 +149,8 @@ singles_escaped_unnecessary.py:31:1: Q004 [*] Unnecessary escape on inner quote 33 33 | f"\'foo\' {f"\'foo\'"} \'\'" # Q004 34 34 | + Run `ruff check --fix` to apply this fix. + singles_escaped_unnecessary.py:32:1: Q004 [*] Unnecessary escape on inner quote character | 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -147,7 +161,7 @@ singles_escaped_unnecessary.py:32:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 29 29 | # 30 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 31 31 | f"\'foo\' {"foo"}" # Q004 @@ -157,6 +171,8 @@ singles_escaped_unnecessary.py:32:1: Q004 [*] Unnecessary escape on inner quote 34 34 | 35 35 | f"normal {f"nested"} normal" + Run `ruff check --fix` to apply this fix. + singles_escaped_unnecessary.py:33:1: Q004 [*] Unnecessary escape on inner quote character | 31 | f"\'foo\' {"foo"}" # Q004 @@ -168,7 +184,7 @@ singles_escaped_unnecessary.py:33:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 30 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 31 31 | f"\'foo\' {"foo"}" # Q004 32 32 | f"\'foo\' {f"foo"}" # Q004 @@ -178,6 +194,8 @@ singles_escaped_unnecessary.py:33:1: Q004 [*] Unnecessary escape on inner quote 35 35 | f"normal {f"nested"} normal" 36 36 | f"\'normal\' {f"nested"} normal" # Q004 + Run `ruff check --fix` to apply this fix. + singles_escaped_unnecessary.py:33:12: Q004 [*] Unnecessary escape on inner quote character | 31 | f"\'foo\' {"foo"}" # Q004 @@ -189,7 +207,7 @@ singles_escaped_unnecessary.py:33:12: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 30 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 31 31 | f"\'foo\' {"foo"}" # Q004 32 32 | f"\'foo\' {f"foo"}" # Q004 @@ -199,6 +217,8 @@ singles_escaped_unnecessary.py:33:12: Q004 [*] Unnecessary escape on inner quote 35 35 | f"normal {f"nested"} normal" 36 36 | f"\'normal\' {f"nested"} normal" # Q004 + Run `ruff check --fix` to apply this fix. + singles_escaped_unnecessary.py:36:1: Q004 [*] Unnecessary escape on inner quote character | 35 | f"normal {f"nested"} normal" @@ -209,7 +229,7 @@ singles_escaped_unnecessary.py:36:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 33 33 | f"\'foo\' {f"\'foo\'"} \'\'" # Q004 34 34 | 35 35 | f"normal {f"nested"} normal" @@ -219,6 +239,8 @@ singles_escaped_unnecessary.py:36:1: Q004 [*] Unnecessary escape on inner quote 38 38 | f"\'normal\' {f"\'nested\' {"other"} normal"} 'single quotes'" # Q004 39 39 | f"\'normal\' {f"\'nested\' {"other"} 'single quotes'"} normal" # Q004 + Run `ruff check --fix` to apply this fix. + singles_escaped_unnecessary.py:37:1: Q004 [*] Unnecessary escape on inner quote character | 35 | f"normal {f"nested"} normal" @@ -230,7 +252,7 @@ singles_escaped_unnecessary.py:37:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 34 34 | 35 35 | f"normal {f"nested"} normal" 36 36 | f"\'normal\' {f"nested"} normal" # Q004 @@ -240,6 +262,8 @@ singles_escaped_unnecessary.py:37:1: Q004 [*] Unnecessary escape on inner quote 39 39 | f"\'normal\' {f"\'nested\' {"other"} 'single quotes'"} normal" # Q004 40 40 | + Run `ruff check --fix` to apply this fix. + singles_escaped_unnecessary.py:38:1: Q004 [*] Unnecessary escape on inner quote character | 36 | f"\'normal\' {f"nested"} normal" # Q004 @@ -250,7 +274,7 @@ singles_escaped_unnecessary.py:38:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 35 35 | f"normal {f"nested"} normal" 36 36 | f"\'normal\' {f"nested"} normal" # Q004 37 37 | f"\'normal\' {f"nested"} 'single quotes'" @@ -260,6 +284,8 @@ singles_escaped_unnecessary.py:38:1: Q004 [*] Unnecessary escape on inner quote 40 40 | 41 41 | # Make sure we do not unescape quotes + Run `ruff check --fix` to apply this fix. + singles_escaped_unnecessary.py:38:15: Q004 [*] Unnecessary escape on inner quote character | 36 | f"\'normal\' {f"nested"} normal" # Q004 @@ -270,7 +296,7 @@ singles_escaped_unnecessary.py:38:15: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 35 35 | f"normal {f"nested"} normal" 36 36 | f"\'normal\' {f"nested"} normal" # Q004 37 37 | f"\'normal\' {f"nested"} 'single quotes'" @@ -280,6 +306,8 @@ singles_escaped_unnecessary.py:38:15: Q004 [*] Unnecessary escape on inner quote 40 40 | 41 41 | # Make sure we do not unescape quotes + Run `ruff check --fix` to apply this fix. + singles_escaped_unnecessary.py:39:1: Q004 [*] Unnecessary escape on inner quote character | 37 | f"\'normal\' {f"nested"} 'single quotes'" @@ -291,7 +319,7 @@ singles_escaped_unnecessary.py:39:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 36 36 | f"\'normal\' {f"nested"} normal" # Q004 37 37 | f"\'normal\' {f"nested"} 'single quotes'" 38 38 | f"\'normal\' {f"\'nested\' {"other"} normal"} 'single quotes'" # Q004 @@ -301,6 +329,8 @@ singles_escaped_unnecessary.py:39:1: Q004 [*] Unnecessary escape on inner quote 41 41 | # Make sure we do not unescape quotes 42 42 | this_is_fine = "This is an \\'escaped\\' quote" + Run `ruff check --fix` to apply this fix. + singles_escaped_unnecessary.py:39:15: Q004 [*] Unnecessary escape on inner quote character | 37 | f"\'normal\' {f"nested"} 'single quotes'" @@ -312,7 +342,7 @@ singles_escaped_unnecessary.py:39:15: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 36 36 | f"\'normal\' {f"nested"} normal" # Q004 37 37 | f"\'normal\' {f"nested"} 'single quotes'" 38 38 | f"\'normal\' {f"\'nested\' {"other"} normal"} 'single quotes'" # Q004 @@ -322,6 +352,8 @@ singles_escaped_unnecessary.py:39:15: Q004 [*] Unnecessary escape on inner quote 41 41 | # Make sure we do not unescape quotes 42 42 | this_is_fine = "This is an \\'escaped\\' quote" + Run `ruff check --fix` to apply this fix. + singles_escaped_unnecessary.py:43:26: Q004 [*] Unnecessary escape on inner quote character | 41 | # Make sure we do not unescape quotes @@ -333,7 +365,7 @@ singles_escaped_unnecessary.py:43:26: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 40 40 | 41 41 | # Make sure we do not unescape quotes 42 42 | this_is_fine = "This is an \\'escaped\\' quote" @@ -343,6 +375,8 @@ singles_escaped_unnecessary.py:43:26: Q004 [*] Unnecessary escape on inner quote 45 45 | # Invalid escapes in bytestrings are also triggered: 46 46 | x = b"\xe7\xeb\x0c\xa1\x1b\x83tN\xce=x\xe9\xbe\x01\xb9\x13B_\xba\xe7\x0c2\xce\'rm\x0e\xcd\xe9.\xf8\xd2" # Q004 + Run `ruff check --fix` to apply this fix. + singles_escaped_unnecessary.py:46:5: Q004 [*] Unnecessary escape on inner quote character | 45 | # Invalid escapes in bytestrings are also triggered: @@ -351,9 +385,11 @@ singles_escaped_unnecessary.py:46:5: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 43 43 | this_should_raise_Q004 = "This is an \\\'escaped\\\' quote with an extra backslash" # Q004 44 44 | 45 45 | # Invalid escapes in bytestrings are also triggered: 46 |-x = b"\xe7\xeb\x0c\xa1\x1b\x83tN\xce=x\xe9\xbe\x01\xb9\x13B_\xba\xe7\x0c2\xce\'rm\x0e\xcd\xe9.\xf8\xd2" # Q004 46 |+x = b"\xe7\xeb\x0c\xa1\x1b\x83tN\xce=x\xe9\xbe\x01\xb9\x13B_\xba\xe7\x0c2\xce'rm\x0e\xcd\xe9.\xf8\xd2" # Q004 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap index e85c35c669cf9..eb3931f8dd5b3 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap @@ -11,7 +11,7 @@ singles_implicit.py:2:5: Q000 [*] Single quotes found but double quotes preferre | = help: Replace single quotes with double quotes -ℹ Safe fix +Suggested fix: 1 1 | x = ( 2 |- 'This' 2 |+ "This" @@ -19,6 +19,8 @@ singles_implicit.py:2:5: Q000 [*] Single quotes found but double quotes preferre 4 4 | 'not' 5 5 | ) + Run `ruff check --fix` to apply this fix. + singles_implicit.py:3:5: Q000 [*] Single quotes found but double quotes preferred | 1 | x = ( @@ -30,7 +32,7 @@ singles_implicit.py:3:5: Q000 [*] Single quotes found but double quotes preferre | = help: Replace single quotes with double quotes -ℹ Safe fix +Suggested fix: 1 1 | x = ( 2 2 | 'This' 3 |- 'is' @@ -39,6 +41,8 @@ singles_implicit.py:3:5: Q000 [*] Single quotes found but double quotes preferre 5 5 | ) 6 6 | + Run `ruff check --fix` to apply this fix. + singles_implicit.py:4:5: Q000 [*] Single quotes found but double quotes preferred | 2 | 'This' @@ -49,7 +53,7 @@ singles_implicit.py:4:5: Q000 [*] Single quotes found but double quotes preferre | = help: Replace single quotes with double quotes -ℹ Safe fix +Suggested fix: 1 1 | x = ( 2 2 | 'This' 3 3 | 'is' @@ -59,6 +63,8 @@ singles_implicit.py:4:5: Q000 [*] Single quotes found but double quotes preferre 6 6 | 7 7 | x = ( + Run `ruff check --fix` to apply this fix. + singles_implicit.py:8:5: Q000 [*] Single quotes found but double quotes preferred | 7 | x = ( @@ -69,7 +75,7 @@ singles_implicit.py:8:5: Q000 [*] Single quotes found but double quotes preferre | = help: Replace single quotes with double quotes -ℹ Safe fix +Suggested fix: 5 5 | ) 6 6 | 7 7 | x = ( @@ -79,6 +85,8 @@ singles_implicit.py:8:5: Q000 [*] Single quotes found but double quotes preferre 10 10 | 'not' 11 11 | ) + Run `ruff check --fix` to apply this fix. + singles_implicit.py:9:5: Q000 [*] Single quotes found but double quotes preferred | 7 | x = ( @@ -90,7 +98,7 @@ singles_implicit.py:9:5: Q000 [*] Single quotes found but double quotes preferre | = help: Replace single quotes with double quotes -ℹ Safe fix +Suggested fix: 6 6 | 7 7 | x = ( 8 8 | 'This' \ @@ -100,6 +108,8 @@ singles_implicit.py:9:5: Q000 [*] Single quotes found but double quotes preferre 11 11 | ) 12 12 | + Run `ruff check --fix` to apply this fix. + singles_implicit.py:10:5: Q000 [*] Single quotes found but double quotes preferred | 8 | 'This' \ @@ -110,7 +120,7 @@ singles_implicit.py:10:5: Q000 [*] Single quotes found but double quotes preferr | = help: Replace single quotes with double quotes -ℹ Safe fix +Suggested fix: 7 7 | x = ( 8 8 | 'This' \ 9 9 | 'is' \ @@ -120,6 +130,8 @@ singles_implicit.py:10:5: Q000 [*] Single quotes found but double quotes preferr 12 12 | 13 13 | x = ( + Run `ruff check --fix` to apply this fix. + singles_implicit.py:27:1: Q000 [*] Single quotes found but double quotes preferred | 25 | if True: @@ -129,11 +141,11 @@ singles_implicit.py:27:1: Q000 [*] Single quotes found but double quotes preferr | = help: Replace single quotes with double quotes -ℹ Safe fix +Suggested fix: 24 24 | 25 25 | if True: 26 26 | 'This can use "single" quotes' 27 |-'But this needs to be changed' 27 |+"But this needs to be changed" - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap index 3fdadee4d83e4..addbb8359506d 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap @@ -13,7 +13,7 @@ singles_multiline_string.py:1:5: Q001 [*] Single quote multiline found but doubl | = help: Replace single multiline quotes with double quotes -ℹ Safe fix +Suggested fix: 1 |-s = ''' This 'should' 1 |+s = """ This 'should' 2 2 | be @@ -23,4 +23,4 @@ singles_multiline_string.py:1:5: Q001 [*] Single quote multiline found but doubl 5 5 | s = """ This 'should' 6 6 | 'not' be - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_would_be_triple_quotes.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_would_be_triple_quotes.py.snap index 3c5b35cd44202..917992575cd59 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_would_be_triple_quotes.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_would_be_triple_quotes.py.snap @@ -17,11 +17,13 @@ singles_would_be_triple_quotes.py:1:33: Q000 [*] Single quotes found but double | = help: Replace single quotes with double quotes -ℹ Safe fix +Suggested fix: 1 |-s = ''"Start with empty string" ' and lint docstring safely' 1 |+s = ''"Start with empty string" " and lint docstring safely" 2 2 | s = 'Do not'" start with empty string" ' and lint docstring safely' + Run `ruff check --fix` to apply this fix. + singles_would_be_triple_quotes.py:2:5: Q000 [*] Single quotes found but double quotes preferred | 1 | s = ''"Start with empty string" ' and lint docstring safely' @@ -30,11 +32,13 @@ singles_would_be_triple_quotes.py:2:5: Q000 [*] Single quotes found but double q | = help: Replace single quotes with double quotes -ℹ Safe fix +Suggested fix: 1 1 | s = ''"Start with empty string" ' and lint docstring safely' 2 |-s = 'Do not'" start with empty string" ' and lint docstring safely' 2 |+s = "Do not"" start with empty string" ' and lint docstring safely' + Run `ruff check --fix` to apply this fix. + singles_would_be_triple_quotes.py:2:40: Q000 [*] Single quotes found but double quotes preferred | 1 | s = ''"Start with empty string" ' and lint docstring safely' @@ -43,7 +47,9 @@ singles_would_be_triple_quotes.py:2:40: Q000 [*] Single quotes found but double | = help: Replace single quotes with double quotes -ℹ Safe fix +Suggested fix: 1 1 | s = ''"Start with empty string" ' and lint docstring safely' 2 |-s = 'Do not'" start with empty string" ' and lint docstring safely' 2 |+s = 'Do not'" start with empty string" " and lint docstring safely" + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap index 594f620909e59..58861e61d07e3 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap @@ -10,13 +10,15 @@ doubles.py:1:25: Q000 [*] Double quotes found but single quotes preferred | = help: Replace double quotes with single quotes -ℹ Safe fix +Suggested fix: 1 |-this_should_be_linted = "double quote string" 1 |+this_should_be_linted = 'double quote string' 2 2 | this_should_be_linted = u"double quote string" 3 3 | this_should_be_linted = f"double quote string" 4 4 | this_should_be_linted = f"double {'quote'} string" + Run `ruff check --fix` to apply this fix. + doubles.py:2:25: Q000 [*] Double quotes found but single quotes preferred | 1 | this_should_be_linted = "double quote string" @@ -27,13 +29,15 @@ doubles.py:2:25: Q000 [*] Double quotes found but single quotes preferred | = help: Replace double quotes with single quotes -ℹ Safe fix +Suggested fix: 1 1 | this_should_be_linted = "double quote string" 2 |-this_should_be_linted = u"double quote string" 2 |+this_should_be_linted = u'double quote string' 3 3 | this_should_be_linted = f"double quote string" 4 4 | this_should_be_linted = f"double {'quote'} string" + Run `ruff check --fix` to apply this fix. + doubles.py:3:25: Q000 [*] Double quotes found but single quotes preferred | 1 | this_should_be_linted = "double quote string" @@ -44,11 +48,11 @@ doubles.py:3:25: Q000 [*] Double quotes found but single quotes preferred | = help: Replace double quotes with single quotes -ℹ Safe fix +Suggested fix: 1 1 | this_should_be_linted = "double quote string" 2 2 | this_should_be_linted = u"double quote string" 3 |-this_should_be_linted = f"double quote string" 3 |+this_should_be_linted = f'double quote string' 4 4 | this_should_be_linted = f"double {'quote'} string" - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap index e93b1aab9a1b3..95dbad67cf008 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap @@ -10,13 +10,15 @@ doubles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 1 |-this_should_raise_Q003 = 'This is a \'string\'' 1 |+this_should_raise_Q003 = "This is a 'string'" 2 2 | this_should_raise_Q003 = 'This is \\ a \\\'string\'' 3 3 | this_is_fine = '"This" is a \'string\'' 4 4 | this_is_fine = "This is a 'string'" + Run `ruff check --fix` to apply this fix. + doubles_escaped.py:2:26: Q003 [*] Change outer quotes to avoid escaping inner quotes | 1 | this_should_raise_Q003 = 'This is a \'string\'' @@ -27,7 +29,7 @@ doubles_escaped.py:2:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 1 1 | this_should_raise_Q003 = 'This is a \'string\'' 2 |-this_should_raise_Q003 = 'This is \\ a \\\'string\'' 2 |+this_should_raise_Q003 = "This is \\ a \\'string'" @@ -35,6 +37,8 @@ doubles_escaped.py:2:26: Q003 [*] Change outer quotes to avoid escaping inner qu 4 4 | this_is_fine = "This is a 'string'" 5 5 | this_is_fine = "\"This\" is a 'string'" + Run `ruff check --fix` to apply this fix. + doubles_escaped.py:10:5: Q003 [*] Change outer quotes to avoid escaping inner quotes | 8 | this_should_raise = ( @@ -45,7 +49,7 @@ doubles_escaped.py:10:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 7 7 | this_is_fine = R'This is a \'string\'' 8 8 | this_should_raise = ( 9 9 | 'This is a' @@ -55,6 +59,8 @@ doubles_escaped.py:10:5: Q003 [*] Change outer quotes to avoid escaping inner qu 12 12 | 13 13 | # Same as above, but with f-strings + Run `ruff check --fix` to apply this fix. + doubles_escaped.py:14:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 13 | # Same as above, but with f-strings @@ -65,7 +71,7 @@ doubles_escaped.py:14:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 11 11 | ) 12 12 | 13 13 | # Same as above, but with f-strings @@ -75,6 +81,8 @@ doubles_escaped.py:14:1: Q003 [*] Change outer quotes to avoid escaping inner qu 16 16 | f'"This" is a \'string\'' 17 17 | f"This is a 'string'" + Run `ruff check --fix` to apply this fix. + doubles_escaped.py:15:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 13 | # Same as above, but with f-strings @@ -86,7 +94,7 @@ doubles_escaped.py:15:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 12 12 | 13 13 | # Same as above, but with f-strings 14 14 | f'This is a \'string\'' # Q003 @@ -96,6 +104,8 @@ doubles_escaped.py:15:1: Q003 [*] Change outer quotes to avoid escaping inner qu 17 17 | f"This is a 'string'" 18 18 | f"\"This\" is a 'string'" + Run `ruff check --fix` to apply this fix. + doubles_escaped.py:23:5: Q003 [*] Change outer quotes to avoid escaping inner quotes | 21 | foo = ( @@ -106,7 +116,7 @@ doubles_escaped.py:23:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 20 20 | fR'This is a \'string\'' 21 21 | foo = ( 22 22 | f'This is a' @@ -116,6 +126,8 @@ doubles_escaped.py:23:5: Q003 [*] Change outer quotes to avoid escaping inner qu 25 25 | 26 26 | # Nested f-strings (Python 3.12+) + Run `ruff check --fix` to apply this fix. + doubles_escaped.py:33:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 31 | # @@ -127,7 +139,7 @@ doubles_escaped.py:33:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 30 30 | # f"'foo' {'nested'}" 31 31 | # 32 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -137,6 +149,8 @@ doubles_escaped.py:33:1: Q003 [*] Change outer quotes to avoid escaping inner qu 35 35 | f'\'foo\' {f'\'nested\''} \'\'' # Q003 36 36 | + Run `ruff check --fix` to apply this fix. + doubles_escaped.py:34:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -147,7 +161,7 @@ doubles_escaped.py:34:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 31 31 | # 32 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 33 33 | f'\'foo\' {'nested'}' # Q003 @@ -157,6 +171,8 @@ doubles_escaped.py:34:1: Q003 [*] Change outer quotes to avoid escaping inner qu 36 36 | 37 37 | f'normal {f'nested'} normal' + Run `ruff check --fix` to apply this fix. + doubles_escaped.py:35:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 33 | f'\'foo\' {'nested'}' # Q003 @@ -168,7 +184,7 @@ doubles_escaped.py:35:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 32 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 33 33 | f'\'foo\' {'nested'}' # Q003 34 34 | f'\'foo\' {f'nested'}' # Q003 @@ -178,6 +194,8 @@ doubles_escaped.py:35:1: Q003 [*] Change outer quotes to avoid escaping inner qu 37 37 | f'normal {f'nested'} normal' 38 38 | f'\'normal\' {f'nested'} normal' # Q003 + Run `ruff check --fix` to apply this fix. + doubles_escaped.py:35:12: Q003 [*] Change outer quotes to avoid escaping inner quotes | 33 | f'\'foo\' {'nested'}' # Q003 @@ -189,7 +207,7 @@ doubles_escaped.py:35:12: Q003 [*] Change outer quotes to avoid escaping inner q | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 32 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 33 33 | f'\'foo\' {'nested'}' # Q003 34 34 | f'\'foo\' {f'nested'}' # Q003 @@ -199,6 +217,8 @@ doubles_escaped.py:35:12: Q003 [*] Change outer quotes to avoid escaping inner q 37 37 | f'normal {f'nested'} normal' 38 38 | f'\'normal\' {f'nested'} normal' # Q003 + Run `ruff check --fix` to apply this fix. + doubles_escaped.py:38:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 37 | f'normal {f'nested'} normal' @@ -209,7 +229,7 @@ doubles_escaped.py:38:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 35 35 | f'\'foo\' {f'\'nested\''} \'\'' # Q003 36 36 | 37 37 | f'normal {f'nested'} normal' @@ -219,6 +239,8 @@ doubles_escaped.py:38:1: Q003 [*] Change outer quotes to avoid escaping inner qu 40 40 | f'\'normal\' {f'\'nested\' {'other'} normal'} "double quotes"' # Q003 41 41 | f'\'normal\' {f'\'nested\' {'other'} "double quotes"'} normal' # Q00l + Run `ruff check --fix` to apply this fix. + doubles_escaped.py:40:15: Q003 [*] Change outer quotes to avoid escaping inner quotes | 38 | f'\'normal\' {f'nested'} normal' # Q003 @@ -229,7 +251,7 @@ doubles_escaped.py:40:15: Q003 [*] Change outer quotes to avoid escaping inner q | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 37 37 | f'normal {f'nested'} normal' 38 38 | f'\'normal\' {f'nested'} normal' # Q003 39 39 | f'\'normal\' {f'nested'} "double quotes"' @@ -237,6 +259,8 @@ doubles_escaped.py:40:15: Q003 [*] Change outer quotes to avoid escaping inner q 40 |+f'\'normal\' {f"'nested' {'other'} normal"} "double quotes"' # Q003 41 41 | f'\'normal\' {f'\'nested\' {'other'} "double quotes"'} normal' # Q00l + Run `ruff check --fix` to apply this fix. + doubles_escaped.py:41:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 39 | f'\'normal\' {f'nested'} "double quotes"' @@ -246,11 +270,11 @@ doubles_escaped.py:41:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 38 38 | f'\'normal\' {f'nested'} normal' # Q003 39 39 | f'\'normal\' {f'nested'} "double quotes"' 40 40 | f'\'normal\' {f'\'nested\' {'other'} normal'} "double quotes"' # Q003 41 |-f'\'normal\' {f'\'nested\' {'other'} "double quotes"'} normal' # Q00l 41 |+f"'normal' {f'\'nested\' {'other'} "double quotes"'} normal" # Q00l - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_py311.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_py311.snap index 375eaacc4625e..45781253d715a 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_py311.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_py311.snap @@ -10,13 +10,15 @@ doubles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 1 |-this_should_raise_Q003 = 'This is a \'string\'' 1 |+this_should_raise_Q003 = "This is a 'string'" 2 2 | this_should_raise_Q003 = 'This is \\ a \\\'string\'' 3 3 | this_is_fine = '"This" is a \'string\'' 4 4 | this_is_fine = "This is a 'string'" + Run `ruff check --fix` to apply this fix. + doubles_escaped.py:2:26: Q003 [*] Change outer quotes to avoid escaping inner quotes | 1 | this_should_raise_Q003 = 'This is a \'string\'' @@ -27,7 +29,7 @@ doubles_escaped.py:2:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 1 1 | this_should_raise_Q003 = 'This is a \'string\'' 2 |-this_should_raise_Q003 = 'This is \\ a \\\'string\'' 2 |+this_should_raise_Q003 = "This is \\ a \\'string'" @@ -35,6 +37,8 @@ doubles_escaped.py:2:26: Q003 [*] Change outer quotes to avoid escaping inner qu 4 4 | this_is_fine = "This is a 'string'" 5 5 | this_is_fine = "\"This\" is a 'string'" + Run `ruff check --fix` to apply this fix. + doubles_escaped.py:10:5: Q003 [*] Change outer quotes to avoid escaping inner quotes | 8 | this_should_raise = ( @@ -45,7 +49,7 @@ doubles_escaped.py:10:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 7 7 | this_is_fine = R'This is a \'string\'' 8 8 | this_should_raise = ( 9 9 | 'This is a' @@ -55,6 +59,8 @@ doubles_escaped.py:10:5: Q003 [*] Change outer quotes to avoid escaping inner qu 12 12 | 13 13 | # Same as above, but with f-strings + Run `ruff check --fix` to apply this fix. + doubles_escaped.py:14:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 13 | # Same as above, but with f-strings @@ -65,7 +71,7 @@ doubles_escaped.py:14:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 11 11 | ) 12 12 | 13 13 | # Same as above, but with f-strings @@ -75,6 +81,8 @@ doubles_escaped.py:14:1: Q003 [*] Change outer quotes to avoid escaping inner qu 16 16 | f'"This" is a \'string\'' 17 17 | f"This is a 'string'" + Run `ruff check --fix` to apply this fix. + doubles_escaped.py:15:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 13 | # Same as above, but with f-strings @@ -86,7 +94,7 @@ doubles_escaped.py:15:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 12 12 | 13 13 | # Same as above, but with f-strings 14 14 | f'This is a \'string\'' # Q003 @@ -96,6 +104,8 @@ doubles_escaped.py:15:1: Q003 [*] Change outer quotes to avoid escaping inner qu 17 17 | f"This is a 'string'" 18 18 | f"\"This\" is a 'string'" + Run `ruff check --fix` to apply this fix. + doubles_escaped.py:23:5: Q003 [*] Change outer quotes to avoid escaping inner quotes | 21 | foo = ( @@ -106,7 +116,7 @@ doubles_escaped.py:23:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Safe fix +Suggested fix: 20 20 | fR'This is a \'string\'' 21 21 | foo = ( 22 22 | f'This is a' @@ -116,4 +126,4 @@ doubles_escaped.py:23:5: Q003 [*] Change outer quotes to avoid escaping inner qu 25 25 | 26 26 | # Nested f-strings (Python 3.12+) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap index 4e7c09e9cd981..f7e98b9cbbb77 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap @@ -10,13 +10,15 @@ doubles_escaped_unnecessary.py:1:26: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 1 |-this_should_raise_Q004 = 'This is a \"string\"' 1 |+this_should_raise_Q004 = 'This is a "string"' 2 2 | this_should_raise_Q004 = 'This is \\ a \\\"string\"' 3 3 | this_is_fine = '"This" is a \"string\"' 4 4 | this_is_fine = "This is a 'string'" + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:2:26: Q004 [*] Unnecessary escape on inner quote character | 1 | this_should_raise_Q004 = 'This is a \"string\"' @@ -27,7 +29,7 @@ doubles_escaped_unnecessary.py:2:26: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 1 1 | this_should_raise_Q004 = 'This is a \"string\"' 2 |-this_should_raise_Q004 = 'This is \\ a \\\"string\"' 2 |+this_should_raise_Q004 = 'This is \\ a \\"string"' @@ -35,6 +37,8 @@ doubles_escaped_unnecessary.py:2:26: Q004 [*] Unnecessary escape on inner quote 4 4 | this_is_fine = "This is a 'string'" 5 5 | this_is_fine = "\"This\" is a 'string'" + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:3:16: Q004 [*] Unnecessary escape on inner quote character | 1 | this_should_raise_Q004 = 'This is a \"string\"' @@ -46,7 +50,7 @@ doubles_escaped_unnecessary.py:3:16: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 1 1 | this_should_raise_Q004 = 'This is a \"string\"' 2 2 | this_should_raise_Q004 = 'This is \\ a \\\"string\"' 3 |-this_is_fine = '"This" is a \"string\"' @@ -55,6 +59,8 @@ doubles_escaped_unnecessary.py:3:16: Q004 [*] Unnecessary escape on inner quote 5 5 | this_is_fine = "\"This\" is a 'string'" 6 6 | this_is_fine = r'This is a \"string\"' + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:10:5: Q004 [*] Unnecessary escape on inner quote character | 8 | this_should_raise_Q004 = ( @@ -65,7 +71,7 @@ doubles_escaped_unnecessary.py:10:5: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 7 7 | this_is_fine = R'This is a \"string\"' 8 8 | this_should_raise_Q004 = ( 9 9 | 'This is a' @@ -75,6 +81,8 @@ doubles_escaped_unnecessary.py:10:5: Q004 [*] Unnecessary escape on inner quote 12 12 | 13 13 | # Same as above, but with f-strings + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:14:1: Q004 [*] Unnecessary escape on inner quote character | 13 | # Same as above, but with f-strings @@ -85,7 +93,7 @@ doubles_escaped_unnecessary.py:14:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 11 11 | ) 12 12 | 13 13 | # Same as above, but with f-strings @@ -95,6 +103,8 @@ doubles_escaped_unnecessary.py:14:1: Q004 [*] Unnecessary escape on inner quote 16 16 | f'"This" is a \"string\"' 17 17 | f"This is a 'string'" + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:15:1: Q004 [*] Unnecessary escape on inner quote character | 13 | # Same as above, but with f-strings @@ -106,7 +116,7 @@ doubles_escaped_unnecessary.py:15:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 12 12 | 13 13 | # Same as above, but with f-strings 14 14 | f'This is a \"string\"' # Q004 @@ -116,6 +126,8 @@ doubles_escaped_unnecessary.py:15:1: Q004 [*] Unnecessary escape on inner quote 17 17 | f"This is a 'string'" 18 18 | f"\"This\" is a 'string'" + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:16:1: Q004 [*] Unnecessary escape on inner quote character | 14 | f'This is a \"string\"' # Q004 @@ -127,7 +139,7 @@ doubles_escaped_unnecessary.py:16:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 13 13 | # Same as above, but with f-strings 14 14 | f'This is a \"string\"' # Q004 15 15 | f'This is \\ a \\\"string\"' # Q004 @@ -137,6 +149,8 @@ doubles_escaped_unnecessary.py:16:1: Q004 [*] Unnecessary escape on inner quote 18 18 | f"\"This\" is a 'string'" 19 19 | fr'This is a \"string\"' + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:23:5: Q004 [*] Unnecessary escape on inner quote character | 21 | this_should_raise_Q004 = ( @@ -147,7 +161,7 @@ doubles_escaped_unnecessary.py:23:5: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 20 20 | fR'This is a \"string\"' 21 21 | this_should_raise_Q004 = ( 22 22 | f'This is a' @@ -157,6 +171,8 @@ doubles_escaped_unnecessary.py:23:5: Q004 [*] Unnecessary escape on inner quote 25 25 | 26 26 | # Nested f-strings (Python 3.12+) + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:33:1: Q004 [*] Unnecessary escape on inner quote character | 31 | # @@ -168,7 +184,7 @@ doubles_escaped_unnecessary.py:33:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 30 30 | # f"'foo' {'nested'}" 31 31 | # 32 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -178,6 +194,8 @@ doubles_escaped_unnecessary.py:33:1: Q004 [*] Unnecessary escape on inner quote 35 35 | f'\"foo\" {f'\"nested\"'} \"\"' # Q004 36 36 | + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:34:1: Q004 [*] Unnecessary escape on inner quote character | 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -188,7 +206,7 @@ doubles_escaped_unnecessary.py:34:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 31 31 | # 32 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 33 33 | f'\"foo\" {'nested'}' # Q004 @@ -198,6 +216,8 @@ doubles_escaped_unnecessary.py:34:1: Q004 [*] Unnecessary escape on inner quote 36 36 | 37 37 | f'normal {f'nested'} normal' + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:35:1: Q004 [*] Unnecessary escape on inner quote character | 33 | f'\"foo\" {'nested'}' # Q004 @@ -209,7 +229,7 @@ doubles_escaped_unnecessary.py:35:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 32 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 33 33 | f'\"foo\" {'nested'}' # Q004 34 34 | f'\"foo\" {f'nested'}' # Q004 @@ -219,6 +239,8 @@ doubles_escaped_unnecessary.py:35:1: Q004 [*] Unnecessary escape on inner quote 37 37 | f'normal {f'nested'} normal' 38 38 | f'\"normal\" {f'nested'} normal' # Q004 + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:35:12: Q004 [*] Unnecessary escape on inner quote character | 33 | f'\"foo\" {'nested'}' # Q004 @@ -230,7 +252,7 @@ doubles_escaped_unnecessary.py:35:12: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 32 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 33 33 | f'\"foo\" {'nested'}' # Q004 34 34 | f'\"foo\" {f'nested'}' # Q004 @@ -240,6 +262,8 @@ doubles_escaped_unnecessary.py:35:12: Q004 [*] Unnecessary escape on inner quote 37 37 | f'normal {f'nested'} normal' 38 38 | f'\"normal\" {f'nested'} normal' # Q004 + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:38:1: Q004 [*] Unnecessary escape on inner quote character | 37 | f'normal {f'nested'} normal' @@ -250,7 +274,7 @@ doubles_escaped_unnecessary.py:38:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 35 35 | f'\"foo\" {f'\"nested\"'} \"\"' # Q004 36 36 | 37 37 | f'normal {f'nested'} normal' @@ -260,6 +284,8 @@ doubles_escaped_unnecessary.py:38:1: Q004 [*] Unnecessary escape on inner quote 40 40 | f'\"normal\" {f'\"nested\" {'other'} normal'} "double quotes"' # Q004 41 41 | f'\"normal\" {f'\"nested\" {'other'} "double quotes"'} normal' # Q004 + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:39:1: Q004 [*] Unnecessary escape on inner quote character | 37 | f'normal {f'nested'} normal' @@ -271,7 +297,7 @@ doubles_escaped_unnecessary.py:39:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 36 36 | 37 37 | f'normal {f'nested'} normal' 38 38 | f'\"normal\" {f'nested'} normal' # Q004 @@ -281,6 +307,8 @@ doubles_escaped_unnecessary.py:39:1: Q004 [*] Unnecessary escape on inner quote 41 41 | f'\"normal\" {f'\"nested\" {'other'} "double quotes"'} normal' # Q004 42 42 | + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:40:1: Q004 [*] Unnecessary escape on inner quote character | 38 | f'\"normal\" {f'nested'} normal' # Q004 @@ -291,7 +319,7 @@ doubles_escaped_unnecessary.py:40:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 37 37 | f'normal {f'nested'} normal' 38 38 | f'\"normal\" {f'nested'} normal' # Q004 39 39 | f'\"normal\" {f'nested'} "double quotes"' @@ -301,6 +329,8 @@ doubles_escaped_unnecessary.py:40:1: Q004 [*] Unnecessary escape on inner quote 42 42 | 43 43 | # Make sure we do not unescape quotes + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:40:15: Q004 [*] Unnecessary escape on inner quote character | 38 | f'\"normal\" {f'nested'} normal' # Q004 @@ -311,7 +341,7 @@ doubles_escaped_unnecessary.py:40:15: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 37 37 | f'normal {f'nested'} normal' 38 38 | f'\"normal\" {f'nested'} normal' # Q004 39 39 | f'\"normal\" {f'nested'} "double quotes"' @@ -321,6 +351,8 @@ doubles_escaped_unnecessary.py:40:15: Q004 [*] Unnecessary escape on inner quote 42 42 | 43 43 | # Make sure we do not unescape quotes + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:41:1: Q004 [*] Unnecessary escape on inner quote character | 39 | f'\"normal\" {f'nested'} "double quotes"' @@ -332,7 +364,7 @@ doubles_escaped_unnecessary.py:41:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 38 38 | f'\"normal\" {f'nested'} normal' # Q004 39 39 | f'\"normal\" {f'nested'} "double quotes"' 40 40 | f'\"normal\" {f'\"nested\" {'other'} normal'} "double quotes"' # Q004 @@ -342,6 +374,8 @@ doubles_escaped_unnecessary.py:41:1: Q004 [*] Unnecessary escape on inner quote 43 43 | # Make sure we do not unescape quotes 44 44 | this_is_fine = 'This is an \\"escaped\\" quote' + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:41:15: Q004 [*] Unnecessary escape on inner quote character | 39 | f'\"normal\" {f'nested'} "double quotes"' @@ -353,7 +387,7 @@ doubles_escaped_unnecessary.py:41:15: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 38 38 | f'\"normal\" {f'nested'} normal' # Q004 39 39 | f'\"normal\" {f'nested'} "double quotes"' 40 40 | f'\"normal\" {f'\"nested\" {'other'} normal'} "double quotes"' # Q004 @@ -363,6 +397,8 @@ doubles_escaped_unnecessary.py:41:15: Q004 [*] Unnecessary escape on inner quote 43 43 | # Make sure we do not unescape quotes 44 44 | this_is_fine = 'This is an \\"escaped\\" quote' + Run `ruff check --fix` to apply this fix. + doubles_escaped_unnecessary.py:45:26: Q004 [*] Unnecessary escape on inner quote character | 43 | # Make sure we do not unescape quotes @@ -372,11 +408,11 @@ doubles_escaped_unnecessary.py:45:26: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -ℹ Safe fix +Suggested fix: 42 42 | 43 43 | # Make sure we do not unescape quotes 44 44 | this_is_fine = 'This is an \\"escaped\\" quote' 45 |-this_should_raise_Q004 = 'This is an \\\"escaped\\\" quote with an extra backslash' 45 |+this_should_raise_Q004 = 'This is an \\"escaped\\" quote with an extra backslash' - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap index a44c07a17cf94..a40bc0525aee7 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap @@ -11,7 +11,7 @@ doubles_implicit.py:2:5: Q000 [*] Double quotes found but single quotes preferre | = help: Replace double quotes with single quotes -ℹ Safe fix +Suggested fix: 1 1 | x = ( 2 |- "This" 2 |+ 'This' @@ -19,6 +19,8 @@ doubles_implicit.py:2:5: Q000 [*] Double quotes found but single quotes preferre 4 4 | "not" 5 5 | ) + Run `ruff check --fix` to apply this fix. + doubles_implicit.py:3:5: Q000 [*] Double quotes found but single quotes preferred | 1 | x = ( @@ -30,7 +32,7 @@ doubles_implicit.py:3:5: Q000 [*] Double quotes found but single quotes preferre | = help: Replace double quotes with single quotes -ℹ Safe fix +Suggested fix: 1 1 | x = ( 2 2 | "This" 3 |- "is" @@ -39,6 +41,8 @@ doubles_implicit.py:3:5: Q000 [*] Double quotes found but single quotes preferre 5 5 | ) 6 6 | + Run `ruff check --fix` to apply this fix. + doubles_implicit.py:4:5: Q000 [*] Double quotes found but single quotes preferred | 2 | "This" @@ -49,7 +53,7 @@ doubles_implicit.py:4:5: Q000 [*] Double quotes found but single quotes preferre | = help: Replace double quotes with single quotes -ℹ Safe fix +Suggested fix: 1 1 | x = ( 2 2 | "This" 3 3 | "is" @@ -59,6 +63,8 @@ doubles_implicit.py:4:5: Q000 [*] Double quotes found but single quotes preferre 6 6 | 7 7 | x = ( + Run `ruff check --fix` to apply this fix. + doubles_implicit.py:8:5: Q000 [*] Double quotes found but single quotes preferred | 7 | x = ( @@ -69,7 +75,7 @@ doubles_implicit.py:8:5: Q000 [*] Double quotes found but single quotes preferre | = help: Replace double quotes with single quotes -ℹ Safe fix +Suggested fix: 5 5 | ) 6 6 | 7 7 | x = ( @@ -79,6 +85,8 @@ doubles_implicit.py:8:5: Q000 [*] Double quotes found but single quotes preferre 10 10 | "not" 11 11 | ) + Run `ruff check --fix` to apply this fix. + doubles_implicit.py:9:5: Q000 [*] Double quotes found but single quotes preferred | 7 | x = ( @@ -90,7 +98,7 @@ doubles_implicit.py:9:5: Q000 [*] Double quotes found but single quotes preferre | = help: Replace double quotes with single quotes -ℹ Safe fix +Suggested fix: 6 6 | 7 7 | x = ( 8 8 | "This" \ @@ -100,6 +108,8 @@ doubles_implicit.py:9:5: Q000 [*] Double quotes found but single quotes preferre 11 11 | ) 12 12 | + Run `ruff check --fix` to apply this fix. + doubles_implicit.py:10:5: Q000 [*] Double quotes found but single quotes preferred | 8 | "This" \ @@ -110,7 +120,7 @@ doubles_implicit.py:10:5: Q000 [*] Double quotes found but single quotes preferr | = help: Replace double quotes with single quotes -ℹ Safe fix +Suggested fix: 7 7 | x = ( 8 8 | "This" \ 9 9 | "is" \ @@ -120,6 +130,8 @@ doubles_implicit.py:10:5: Q000 [*] Double quotes found but single quotes preferr 12 12 | 13 13 | x = ( + Run `ruff check --fix` to apply this fix. + doubles_implicit.py:27:1: Q000 [*] Double quotes found but single quotes preferred | 25 | if True: @@ -129,11 +141,11 @@ doubles_implicit.py:27:1: Q000 [*] Double quotes found but single quotes preferr | = help: Replace double quotes with single quotes -ℹ Safe fix +Suggested fix: 24 24 | 25 25 | if True: 26 26 | "This can use 'double' quotes" 27 |-"But this needs to be changed" 27 |+'But this needs to be changed' - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap index bb0ef317cba48..72a085987c5db 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap @@ -13,7 +13,7 @@ doubles_multiline_string.py:1:5: Q001 [*] Double quote multiline found but singl | = help: Replace double multiline quotes with single quotes -ℹ Safe fix +Suggested fix: 1 |-s = """ This "should" 1 |+s = ''' This "should" 2 2 | be @@ -23,4 +23,4 @@ doubles_multiline_string.py:1:5: Q001 [*] Double quote multiline found but singl 5 5 | s = ''' This "should" 6 6 | "not" be - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_would_be_triple_quotes.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_would_be_triple_quotes.py.snap index 031164bad78ba..892506f1a7d2f 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_would_be_triple_quotes.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_would_be_triple_quotes.py.snap @@ -17,7 +17,9 @@ doubles_would_be_triple_quotes.py:2:5: Q000 [*] Double quotes found but single q | = help: Replace double quotes with single quotes -ℹ Safe fix +Suggested fix: 1 1 | s = ""'Start with empty string' ' and lint docstring safely' 2 |-s = "Do not"' start with empty string' ' and lint docstring safely' 2 |+s = 'Do not'' start with empty string' ' and lint docstring safely' + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap b/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap index d0dd2b4084b53..d67b9362402c7 100644 --- a/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap +++ b/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap @@ -12,7 +12,7 @@ RSE102.py:5:21: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Safe fix +Suggested fix: 2 2 | y = 6 + "7" 3 3 | except TypeError: 4 4 | # RSE102 @@ -22,6 +22,8 @@ RSE102.py:5:21: RSE102 [*] Unnecessary parentheses on raised exception 7 7 | try: 8 8 | x = 1 / 0 + Run `ruff check --fix` to apply this fix. + RSE102.py:13:16: RSE102 [*] Unnecessary parentheses on raised exception | 12 | # RSE102 @@ -32,7 +34,7 @@ RSE102.py:13:16: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Safe fix +Suggested fix: 10 10 | raise 11 11 | 12 12 | # RSE102 @@ -42,6 +44,8 @@ RSE102.py:13:16: RSE102 [*] Unnecessary parentheses on raised exception 15 15 | # RSE102 16 16 | raise TypeError () + Run `ruff check --fix` to apply this fix. + RSE102.py:16:17: RSE102 [*] Unnecessary parentheses on raised exception | 15 | # RSE102 @@ -52,7 +56,7 @@ RSE102.py:16:17: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Safe fix +Suggested fix: 13 13 | raise TypeError() 14 14 | 15 15 | # RSE102 @@ -62,6 +66,8 @@ RSE102.py:16:17: RSE102 [*] Unnecessary parentheses on raised exception 18 18 | # RSE102 19 19 | raise TypeError \ + Run `ruff check --fix` to apply this fix. + RSE102.py:20:5: RSE102 [*] Unnecessary parentheses on raised exception | 18 | # RSE102 @@ -73,7 +79,7 @@ RSE102.py:20:5: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Safe fix +Suggested fix: 17 17 | 18 18 | # RSE102 19 19 | raise TypeError \ @@ -83,6 +89,8 @@ RSE102.py:20:5: RSE102 [*] Unnecessary parentheses on raised exception 22 22 | # RSE102 23 23 | raise TypeError \ + Run `ruff check --fix` to apply this fix. + RSE102.py:24:5: RSE102 [*] Unnecessary parentheses on raised exception | 22 | # RSE102 @@ -94,7 +102,7 @@ RSE102.py:24:5: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Safe fix +Suggested fix: 21 21 | 22 22 | # RSE102 23 23 | raise TypeError \ @@ -104,6 +112,8 @@ RSE102.py:24:5: RSE102 [*] Unnecessary parentheses on raised exception 26 26 | # RSE102 27 27 | raise TypeError( + Run `ruff check --fix` to apply this fix. + RSE102.py:27:16: RSE102 [*] Unnecessary parentheses on raised exception | 26 | # RSE102 @@ -117,7 +127,7 @@ RSE102.py:27:16: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Safe fix +Suggested fix: 24 24 | (); 25 25 | 26 26 | # RSE102 @@ -129,6 +139,8 @@ RSE102.py:27:16: RSE102 [*] Unnecessary parentheses on raised exception 31 29 | # RSE102 32 30 | raise (TypeError) ( + Run `ruff check --fix` to apply this fix. + RSE102.py:32:19: RSE102 [*] Unnecessary parentheses on raised exception | 31 | # RSE102 @@ -142,7 +154,7 @@ RSE102.py:32:19: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Safe fix +Suggested fix: 29 29 | ) 30 30 | 31 31 | # RSE102 @@ -154,6 +166,8 @@ RSE102.py:32:19: RSE102 [*] Unnecessary parentheses on raised exception 36 34 | # RSE102 37 35 | raise TypeError( + Run `ruff check --fix` to apply this fix. + RSE102.py:37:16: RSE102 [*] Unnecessary parentheses on raised exception | 36 | # RSE102 @@ -167,7 +181,7 @@ RSE102.py:37:16: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Safe fix +Suggested fix: 34 34 | ) 35 35 | 36 36 | # RSE102 @@ -179,6 +193,8 @@ RSE102.py:37:16: RSE102 [*] Unnecessary parentheses on raised exception 41 39 | # OK 42 40 | raise AssertionError + Run `ruff check --fix` to apply this fix. + RSE102.py:74:17: RSE102 [*] Unnecessary parentheses on raised exception | 73 | # RSE102 @@ -189,7 +205,7 @@ RSE102.py:74:17: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Safe fix +Suggested fix: 71 71 | 72 72 | 73 73 | # RSE102 @@ -199,6 +215,8 @@ RSE102.py:74:17: RSE102 [*] Unnecessary parentheses on raised exception 76 76 | raise IndexError()\ 77 77 | from ZeroDivisionError + Run `ruff check --fix` to apply this fix. + RSE102.py:76:17: RSE102 [*] Unnecessary parentheses on raised exception | 74 | raise IndexError()from ZeroDivisionError @@ -209,7 +227,7 @@ RSE102.py:76:17: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Safe fix +Suggested fix: 73 73 | # RSE102 74 74 | raise IndexError()from ZeroDivisionError 75 75 | @@ -219,6 +237,8 @@ RSE102.py:76:17: RSE102 [*] Unnecessary parentheses on raised exception 78 78 | 79 79 | raise IndexError() from ZeroDivisionError + Run `ruff check --fix` to apply this fix. + RSE102.py:79:17: RSE102 [*] Unnecessary parentheses on raised exception | 77 | from ZeroDivisionError @@ -230,7 +250,7 @@ RSE102.py:79:17: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Safe fix +Suggested fix: 76 76 | raise IndexError()\ 77 77 | from ZeroDivisionError 78 78 | @@ -240,6 +260,8 @@ RSE102.py:79:17: RSE102 [*] Unnecessary parentheses on raised exception 81 81 | raise IndexError(); 82 82 | + Run `ruff check --fix` to apply this fix. + RSE102.py:81:17: RSE102 [*] Unnecessary parentheses on raised exception | 79 | raise IndexError() from ZeroDivisionError @@ -251,7 +273,7 @@ RSE102.py:81:17: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Safe fix +Suggested fix: 78 78 | 79 79 | raise IndexError() from ZeroDivisionError 80 80 | @@ -261,6 +283,8 @@ RSE102.py:81:17: RSE102 [*] Unnecessary parentheses on raised exception 83 83 | # RSE102 84 84 | raise Foo() + Run `ruff check --fix` to apply this fix. + RSE102.py:84:10: RSE102 [*] Unnecessary parentheses on raised exception | 83 | # RSE102 @@ -271,7 +295,7 @@ RSE102.py:84:10: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Unsafe fix +Suggested fix: 81 81 | raise IndexError(); 82 82 | 83 83 | # RSE102 @@ -281,6 +305,8 @@ RSE102.py:84:10: RSE102 [*] Unnecessary parentheses on raised exception 86 86 | # OK 87 87 | raise ctypes.WinError() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RSE102.py:107:27: RSE102 [*] Unnecessary parentheses on raised exception | 105 | future = executor.submit(float, "a") @@ -290,9 +316,11 @@ RSE102.py:107:27: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Unsafe fix +Suggested fix: 104 104 | # RSE102 105 105 | future = executor.submit(float, "a") 106 106 | if future.exception(): 107 |- raise future.Exception() 107 |+ raise future.Exception + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET501_RET501.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET501_RET501.py.snap index 889492cab6623..7fcf22779af54 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET501_RET501.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET501_RET501.py.snap @@ -10,7 +10,7 @@ RET501.py:4:5: RET501 [*] Do not explicitly `return None` in function if it is t | = help: Remove explicit `return None` -ℹ Safe fix +Suggested fix: 1 1 | def x(y): 2 2 | if not y: 3 3 | return @@ -20,6 +20,8 @@ RET501.py:4:5: RET501 [*] Do not explicitly `return None` in function if it is t 6 6 | 7 7 | class BaseCache: + Run `ruff check --fix` to apply this fix. + RET501.py:14:9: RET501 [*] Do not explicitly `return None` in function if it is the only possible return value | 12 | def get(self, key: str) -> None: @@ -31,7 +33,7 @@ RET501.py:14:9: RET501 [*] Do not explicitly `return None` in function if it is | = help: Remove explicit `return None` -ℹ Safe fix +Suggested fix: 11 11 | 12 12 | def get(self, key: str) -> None: 13 13 | print(f"{key} not found") @@ -40,3 +42,5 @@ RET501.py:14:9: RET501 [*] Do not explicitly `return None` in function if it is 15 15 | 16 16 | @property 17 17 | def prop(self) -> None: + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET502_RET502.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET502_RET502.py.snap index 01d5a439dbaab..d0a26a8fd538c 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET502_RET502.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET502_RET502.py.snap @@ -11,7 +11,7 @@ RET502.py:3:9: RET502 [*] Do not implicitly `return None` in function able to re | = help: Add explicit `None` return value -ℹ Safe fix +Suggested fix: 1 1 | def x(y): 2 2 | if not y: 3 |- return # error @@ -20,4 +20,4 @@ RET502.py:3:9: RET502 [*] Do not implicitly `return None` in function able to re 5 5 | 6 6 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap index 27e3258087d4b..793b0d64ebd35 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap @@ -13,7 +13,7 @@ RET503.py:21:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 20 20 | def x(y): 21 21 | if not y: 22 22 | return 1 @@ -22,6 +22,8 @@ RET503.py:21:5: RET503 [*] Missing explicit `return` at the end of function able 24 25 | 25 26 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:28:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 26 | def x(y): @@ -33,7 +35,7 @@ RET503.py:28:9: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 26 26 | def x(y): 27 27 | if not y: 28 28 | print() # error @@ -42,6 +44,8 @@ RET503.py:28:9: RET503 [*] Missing explicit `return` at the end of function able 30 31 | return 2 31 32 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:37:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 35 | return 1 @@ -51,7 +55,7 @@ RET503.py:37:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 35 35 | return 1 36 36 | 37 37 | print() # error @@ -60,6 +64,8 @@ RET503.py:37:5: RET503 [*] Missing explicit `return` at the end of function able 39 40 | 40 41 | # for + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:42:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 40 | # for @@ -73,7 +79,7 @@ RET503.py:42:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 42 42 | for i in range(10): 43 43 | if i > 10: 44 44 | return i @@ -82,6 +88,8 @@ RET503.py:42:5: RET503 [*] Missing explicit `return` at the end of function able 46 47 | 47 48 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:53:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 51 | return i @@ -91,7 +99,7 @@ RET503.py:53:9: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 51 51 | return i 52 52 | else: 53 53 | print() # error @@ -100,6 +108,8 @@ RET503.py:53:9: RET503 [*] Missing explicit `return` at the end of function able 55 56 | 56 57 | # A nonexistent function + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:60:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 58 | if x > 0: @@ -109,7 +119,7 @@ RET503.py:60:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 58 58 | if x > 0: 59 59 | return False 60 60 | no_such_function() # error @@ -118,6 +128,8 @@ RET503.py:60:5: RET503 [*] Missing explicit `return` at the end of function able 62 63 | 63 64 | # A function that does return the control + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:67:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 65 | if x > 0: @@ -127,7 +139,7 @@ RET503.py:67:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 65 65 | if x > 0: 66 66 | return False 67 67 | print("", end="") # error @@ -136,6 +148,8 @@ RET503.py:67:5: RET503 [*] Missing explicit `return` at the end of function able 69 70 | 70 71 | ### + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:83:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 81 | # last line in while loop @@ -149,7 +163,7 @@ RET503.py:83:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 84 84 | if y > 0: 85 85 | return 1 86 86 | y += 1 @@ -158,6 +172,8 @@ RET503.py:83:5: RET503 [*] Missing explicit `return` at the end of function able 88 89 | 89 90 | # exclude empty functions + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:114:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 112 | # return value within loop @@ -171,7 +187,7 @@ RET503.py:114:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 115 115 | if i > y: 116 116 | break 117 117 | return z @@ -180,6 +196,8 @@ RET503.py:114:5: RET503 [*] Missing explicit `return` at the end of function abl 119 120 | 120 121 | def bar3(x, y, z): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:121:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 120 | def bar3(x, y, z): @@ -195,7 +213,7 @@ RET503.py:121:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 125 125 | else: 126 126 | return z 127 127 | return None @@ -204,6 +222,8 @@ RET503.py:121:5: RET503 [*] Missing explicit `return` at the end of function abl 129 130 | 130 131 | def bar1(x, y, z): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:131:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 130 | def bar1(x, y, z): @@ -216,7 +236,7 @@ RET503.py:131:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 132 132 | if i < y: 133 133 | continue 134 134 | return z @@ -225,6 +245,8 @@ RET503.py:131:5: RET503 [*] Missing explicit `return` at the end of function abl 136 137 | 137 138 | def bar3(x, y, z): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:138:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 137 | def bar3(x, y, z): @@ -240,7 +262,7 @@ RET503.py:138:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 142 142 | else: 143 143 | return z 144 144 | return None @@ -249,6 +271,8 @@ RET503.py:138:5: RET503 [*] Missing explicit `return` at the end of function abl 146 147 | 147 148 | def prompts(self, foo): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:275:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 273 | return False @@ -260,7 +284,7 @@ RET503.py:275:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 274 274 | 275 275 | for value in values: 276 276 | print(value) @@ -269,6 +293,8 @@ RET503.py:275:5: RET503 [*] Missing explicit `return` at the end of function abl 278 279 | 279 280 | def while_true(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:292:13: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 290 | return 1 @@ -278,7 +304,7 @@ RET503.py:292:13: RET503 [*] Missing explicit `return` at the end of function ab | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 290 290 | return 1 291 291 | case 1: 292 292 | print() # error @@ -287,6 +313,8 @@ RET503.py:292:13: RET503 [*] Missing explicit `return` at the end of function ab 294 295 | 295 296 | def foo(baz: str) -> str: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:301:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 299 | def end_of_statement(): @@ -298,7 +326,7 @@ RET503.py:301:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 300 300 | def example(): 301 301 | if True: 302 302 | return "" @@ -307,6 +335,8 @@ RET503.py:301:9: RET503 [*] Missing explicit `return` at the end of function abl 304 305 | 305 306 | def example(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:306:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 305 | def example(): @@ -317,7 +347,7 @@ RET503.py:306:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 305 305 | def example(): 306 306 | if True: 307 307 | return "" @@ -326,6 +356,8 @@ RET503.py:306:9: RET503 [*] Missing explicit `return` at the end of function abl 309 310 | 310 311 | def example(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:311:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 310 | def example(): @@ -336,7 +368,7 @@ RET503.py:311:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 310 310 | def example(): 311 311 | if True: 312 312 | return "" # type: ignore @@ -345,6 +377,8 @@ RET503.py:311:9: RET503 [*] Missing explicit `return` at the end of function abl 314 315 | 315 316 | def example(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:316:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 315 | def example(): @@ -355,7 +389,7 @@ RET503.py:316:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 315 315 | def example(): 316 316 | if True: 317 317 | return "" ; @@ -364,6 +398,8 @@ RET503.py:316:9: RET503 [*] Missing explicit `return` at the end of function abl 319 320 | 320 321 | def example(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:321:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 320 | def example(): @@ -375,7 +411,7 @@ RET503.py:321:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 321 321 | if True: 322 322 | return "" \ 323 323 | ; # type: ignore @@ -384,6 +420,8 @@ RET503.py:321:9: RET503 [*] Missing explicit `return` at the end of function abl 325 326 | 326 327 | def end_of_file(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:329:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 327 | if False: @@ -393,7 +431,7 @@ RET503.py:329:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 328 328 | return 1 329 329 | x = 2 \ 330 330 | @@ -402,6 +440,8 @@ RET503.py:329:5: RET503 [*] Missing explicit `return` at the end of function abl 332 333 | 333 334 | # function return type annotation NoReturn + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:339:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 337 | if x == 5: @@ -411,7 +451,7 @@ RET503.py:339:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 337 337 | if x == 5: 338 338 | return 5 339 339 | bar() @@ -420,6 +460,8 @@ RET503.py:339:5: RET503 [*] Missing explicit `return` at the end of function abl 341 342 | 342 343 | def foo(string: str) -> str: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:354:13: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 352 | return "third" @@ -429,7 +471,7 @@ RET503.py:354:13: RET503 [*] Missing explicit `return` at the end of function ab | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 352 352 | return "third" 353 353 | case _: 354 354 | raises(string) @@ -438,6 +480,8 @@ RET503.py:354:13: RET503 [*] Missing explicit `return` at the end of function ab 356 357 | 357 358 | def foo() -> int: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET503.py:370:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 368 | if baz() > 3: @@ -447,10 +491,10 @@ RET503.py:370:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Unsafe fix +Suggested fix: 368 368 | if baz() > 3: 369 369 | return 1 370 370 | bar() 371 |+ return None - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap index 46ffb2df68b29..563f89ded4c83 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap @@ -10,7 +10,7 @@ RET504.py:6:12: RET504 [*] Unnecessary assignment to `a` before `return` stateme | = help: Remove unnecessary assignment -ℹ Unsafe fix +Suggested fix: 2 2 | # Errors 3 3 | ### 4 4 | def x(): @@ -21,6 +21,8 @@ RET504.py:6:12: RET504 [*] Unnecessary assignment to `a` before `return` stateme 8 7 | 9 8 | # Can be refactored false positives + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET504.py:23:12: RET504 [*] Unnecessary assignment to `formatted` before `return` statement | 21 | # clean up after any blank components @@ -30,7 +32,7 @@ RET504.py:23:12: RET504 [*] Unnecessary assignment to `formatted` before `return | = help: Remove unnecessary assignment -ℹ Unsafe fix +Suggested fix: 19 19 | def x(): 20 20 | formatted = _USER_AGENT_FORMATTER.format(format_string, **values) 21 21 | # clean up after any blank components @@ -41,6 +43,8 @@ RET504.py:23:12: RET504 [*] Unnecessary assignment to `formatted` before `return 25 24 | 26 25 | # https://github.com/afonasev/flake8-return/issues/47#issue-641117366 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET504.py:246:12: RET504 [*] Unnecessary assignment to `queryset` before `return` statement | 244 | queryset = Model.filter(a=1) @@ -50,7 +54,7 @@ RET504.py:246:12: RET504 [*] Unnecessary assignment to `queryset` before `return | = help: Remove unnecessary assignment -ℹ Unsafe fix +Suggested fix: 242 242 | 243 243 | def get_queryset(): 244 244 | queryset = Model.filter(a=1) @@ -61,6 +65,8 @@ RET504.py:246:12: RET504 [*] Unnecessary assignment to `queryset` before `return 248 247 | 249 248 | def get_queryset(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET504.py:251:12: RET504 [*] Unnecessary assignment to `queryset` before `return` statement | 249 | def get_queryset(): @@ -70,7 +76,7 @@ RET504.py:251:12: RET504 [*] Unnecessary assignment to `queryset` before `return | = help: Remove unnecessary assignment -ℹ Unsafe fix +Suggested fix: 247 247 | 248 248 | 249 249 | def get_queryset(): @@ -81,6 +87,8 @@ RET504.py:251:12: RET504 [*] Unnecessary assignment to `queryset` before `return 253 252 | 254 253 | # Function arguments + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET504.py:269:12: RET504 [*] Unnecessary assignment to `val` before `return` statement | 267 | return val @@ -90,7 +98,7 @@ RET504.py:269:12: RET504 [*] Unnecessary assignment to `val` before `return` sta | = help: Remove unnecessary assignment -ℹ Unsafe fix +Suggested fix: 265 265 | def str_to_bool(val): 266 266 | if isinstance(val, bool): 267 267 | return val @@ -101,6 +109,8 @@ RET504.py:269:12: RET504 [*] Unnecessary assignment to `val` before `return` sta 271 270 | 272 271 | def str_to_bool(val): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET504.py:321:12: RET504 [*] Unnecessary assignment to `x` before `return` statement | 319 | with open("foo.txt", "r") as f: @@ -110,7 +120,7 @@ RET504.py:321:12: RET504 [*] Unnecessary assignment to `x` before `return` state | = help: Remove unnecessary assignment -ℹ Unsafe fix +Suggested fix: 317 317 | # `with` statements 318 318 | def foo(): 319 319 | with open("foo.txt", "r") as f: @@ -121,6 +131,8 @@ RET504.py:321:12: RET504 [*] Unnecessary assignment to `x` before `return` state 323 322 | 324 323 | def foo(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET504.py:342:12: RET504 [*] Unnecessary assignment to `b` before `return` statement | 340 | a = 1 @@ -130,7 +142,7 @@ RET504.py:342:12: RET504 [*] Unnecessary assignment to `b` before `return` state | = help: Remove unnecessary assignment -ℹ Unsafe fix +Suggested fix: 338 338 | # Fix cases 339 339 | def foo(): 340 340 | a = 1 @@ -141,6 +153,8 @@ RET504.py:342:12: RET504 [*] Unnecessary assignment to `b` before `return` state 344 343 | 345 344 | def foo(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET504.py:348:12: RET504 [*] Unnecessary assignment to `b` before `return` statement | 346 | a = 1 @@ -150,7 +164,7 @@ RET504.py:348:12: RET504 [*] Unnecessary assignment to `b` before `return` state | = help: Remove unnecessary assignment -ℹ Unsafe fix +Suggested fix: 344 344 | 345 345 | def foo(): 346 346 | a = 1 @@ -161,6 +175,8 @@ RET504.py:348:12: RET504 [*] Unnecessary assignment to `b` before `return` state 350 349 | 351 350 | def foo(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET504.py:354:12: RET504 [*] Unnecessary assignment to `b` before `return` statement | 352 | a = 1 @@ -170,7 +186,7 @@ RET504.py:354:12: RET504 [*] Unnecessary assignment to `b` before `return` state | = help: Remove unnecessary assignment -ℹ Unsafe fix +Suggested fix: 350 350 | 351 351 | def foo(): 352 352 | a = 1 @@ -181,6 +197,8 @@ RET504.py:354:12: RET504 [*] Unnecessary assignment to `b` before `return` state 356 355 | 357 356 | def foo(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET504.py:359:12: RET504 [*] Unnecessary assignment to `a` before `return` statement | 357 | def foo(): @@ -190,7 +208,7 @@ RET504.py:359:12: RET504 [*] Unnecessary assignment to `a` before `return` state | = help: Remove unnecessary assignment -ℹ Unsafe fix +Suggested fix: 355 355 | 356 356 | 357 357 | def foo(): @@ -201,6 +219,8 @@ RET504.py:359:12: RET504 [*] Unnecessary assignment to `a` before `return` state 361 360 | 362 361 | # Regression test for: https://github.com/astral-sh/ruff/issues/7098 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET504.py:365:12: RET504 [*] Unnecessary assignment to `D` before `return` statement | 363 | def mavko_debari(P_kbar): @@ -210,7 +230,7 @@ RET504.py:365:12: RET504 [*] Unnecessary assignment to `D` before `return` state | = help: Remove unnecessary assignment -ℹ Unsafe fix +Suggested fix: 361 361 | 362 362 | # Regression test for: https://github.com/astral-sh/ruff/issues/7098 363 363 | def mavko_debari(P_kbar): @@ -221,6 +241,8 @@ RET504.py:365:12: RET504 [*] Unnecessary assignment to `D` before `return` state 367 366 | 368 367 | # contextlib suppress in with statement + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET504.py:400:12: RET504 [*] Unnecessary assignment to `y` before `return` statement | 398 | x = 1 @@ -230,7 +252,7 @@ RET504.py:400:12: RET504 [*] Unnecessary assignment to `y` before `return` state | = help: Remove unnecessary assignment -ℹ Unsafe fix +Suggested fix: 396 396 | x = 2 397 397 | with contextlib.suppress(Exception): 398 398 | x = 1 @@ -241,6 +263,8 @@ RET504.py:400:12: RET504 [*] Unnecessary assignment to `y` before `return` state 402 401 | 403 402 | def foo(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RET504.py:423:16: RET504 [*] Unnecessary assignment to `services` before `return` statement | 421 | if "services" in a: @@ -250,10 +274,12 @@ RET504.py:423:16: RET504 [*] Unnecessary assignment to `services` before `return | = help: Remove unnecessary assignment -ℹ Unsafe fix +Suggested fix: 419 419 | # See: https://github.com/astral-sh/ruff/issues/10732 420 420 | def func(a: dict[str, int]) -> list[dict[str, int]]: 421 421 | if "services" in a: 422 |- services = a["services"] 423 |- return services 422 |+ return a["services"] + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET505_RET505.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET505_RET505.py.snap index 21a3d2efc6fd3..67e9d8e6470f6 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET505_RET505.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET505_RET505.py.snap @@ -12,7 +12,7 @@ RET505.py:8:5: RET505 [*] Unnecessary `elif` after `return` statement | = help: Remove unnecessary `elif` -ℹ Safe fix +Suggested fix: 5 5 | if x: # [no-else-return] 6 6 | a = 1 7 7 | return y @@ -22,6 +22,8 @@ RET505.py:8:5: RET505 [*] Unnecessary `elif` after `return` statement 10 10 | return w 11 11 | else: + Run `ruff check --fix` to apply this fix. + RET505.py:23:5: RET505 [*] Unnecessary `elif` after `return` statement | 21 | b = 2 @@ -33,7 +35,7 @@ RET505.py:23:5: RET505 [*] Unnecessary `elif` after `return` statement | = help: Remove unnecessary `elif` -ℹ Safe fix +Suggested fix: 20 20 | else: 21 21 | b = 2 22 22 | return @@ -43,6 +45,8 @@ RET505.py:23:5: RET505 [*] Unnecessary `elif` after `return` statement 25 25 | else: 26 26 | c = 3 + Run `ruff check --fix` to apply this fix. + RET505.py:41:5: RET505 [*] Unnecessary `elif` after `return` statement | 39 | a = 1 @@ -54,7 +58,7 @@ RET505.py:41:5: RET505 [*] Unnecessary `elif` after `return` statement | = help: Remove unnecessary `elif` -ℹ Safe fix +Suggested fix: 38 38 | if x: # [no-else-return] 39 39 | a = 1 40 40 | return y @@ -64,6 +68,8 @@ RET505.py:41:5: RET505 [*] Unnecessary `elif` after `return` statement 43 43 | return w 44 44 | else: + Run `ruff check --fix` to apply this fix. + RET505.py:53:5: RET505 [*] Unnecessary `else` after `return` statement | 51 | a = 1 @@ -75,7 +81,7 @@ RET505.py:53:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 50 50 | if x: # [no-else-return] 51 51 | a = 1 52 52 | return y @@ -88,6 +94,8 @@ RET505.py:53:5: RET505 [*] Unnecessary `else` after `return` statement 57 56 | 58 57 | def foo3(x, y, z): + Run `ruff check --fix` to apply this fix. + RET505.py:64:9: RET505 [*] Unnecessary `else` after `return` statement | 62 | b = 2 @@ -99,7 +107,7 @@ RET505.py:64:9: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 61 61 | if y: # [no-else-return] 62 62 | b = 2 63 63 | return y @@ -112,6 +120,8 @@ RET505.py:64:9: RET505 [*] Unnecessary `else` after `return` statement 68 67 | d = 4 69 68 | return z + Run `ruff check --fix` to apply this fix. + RET505.py:79:5: RET505 [*] Unnecessary `else` after `return` statement | 77 | b = 2 @@ -123,7 +133,7 @@ RET505.py:79:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 76 76 | else: 77 77 | b = 2 78 78 | return @@ -134,6 +144,8 @@ RET505.py:79:5: RET505 [*] Unnecessary `else` after `return` statement 82 81 | 83 82 | + Run `ruff check --fix` to apply this fix. + RET505.py:89:9: RET505 [*] Unnecessary `else` after `return` statement | 87 | a = 4 @@ -145,7 +157,7 @@ RET505.py:89:9: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 86 86 | if y: # [no-else-return] 87 87 | a = 4 88 88 | return @@ -156,6 +168,8 @@ RET505.py:89:9: RET505 [*] Unnecessary `else` after `return` statement 92 91 | c = 3 93 92 | return + Run `ruff check --fix` to apply this fix. + RET505.py:99:5: RET505 [*] Unnecessary `else` after `return` statement | 97 | if x: # [no-else-return] @@ -167,7 +181,7 @@ RET505.py:99:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 96 96 | def bar4(x): 97 97 | if x: # [no-else-return] 98 98 | return True @@ -184,6 +198,8 @@ RET505.py:99:5: RET505 [*] Unnecessary `else` after `return` statement 105 104 | 106 105 | def fibo(n): + Run `ruff check --fix` to apply this fix. + RET505.py:109:5: RET505 [*] Unnecessary `else` after `return` statement | 107 | if n<2: @@ -195,7 +211,7 @@ RET505.py:109:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 106 106 | def fibo(n): 107 107 | if n<2: 108 108 | return n; @@ -208,6 +224,8 @@ RET505.py:109:5: RET505 [*] Unnecessary `else` after `return` statement 113 112 | 114 113 | ### + Run `ruff check --fix` to apply this fix. + RET505.py:145:5: RET505 [*] Unnecessary `else` after `return` statement | 143 | if True: @@ -219,7 +237,7 @@ RET505.py:145:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 142 142 | def bar4(x): 143 143 | if True: 144 144 | return @@ -232,6 +250,8 @@ RET505.py:145:5: RET505 [*] Unnecessary `else` after `return` statement 149 148 | 150 149 | def bar5(): + Run `ruff check --fix` to apply this fix. + RET505.py:153:5: RET505 [*] Unnecessary `else` after `return` statement | 151 | if True: @@ -242,7 +262,7 @@ RET505.py:153:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 150 150 | def bar5(): 151 151 | if True: 152 152 | return @@ -254,6 +274,8 @@ RET505.py:153:5: RET505 [*] Unnecessary `else` after `return` statement 156 156 | 157 157 | def bar6(): + Run `ruff check --fix` to apply this fix. + RET505.py:160:5: RET505 [*] Unnecessary `else` after `return` statement | 158 | if True: @@ -265,7 +287,7 @@ RET505.py:160:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 157 157 | def bar6(): 158 158 | if True: 159 159 | return @@ -279,6 +301,8 @@ RET505.py:160:5: RET505 [*] Unnecessary `else` after `return` statement 165 163 | 166 164 | def bar7(): + Run `ruff check --fix` to apply this fix. + RET505.py:169:5: RET505 [*] Unnecessary `else` after `return` statement | 167 | if True: @@ -290,7 +314,7 @@ RET505.py:169:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 166 166 | def bar7(): 167 167 | if True: 168 168 | return @@ -303,6 +327,8 @@ RET505.py:169:5: RET505 [*] Unnecessary `else` after `return` statement 173 172 | 174 173 | def bar8(): + Run `ruff check --fix` to apply this fix. + RET505.py:177:5: RET505 [*] Unnecessary `else` after `return` statement | 175 | if True: @@ -312,7 +338,7 @@ RET505.py:177:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 174 174 | def bar8(): 175 175 | if True: 176 176 | return @@ -322,6 +348,8 @@ RET505.py:177:5: RET505 [*] Unnecessary `else` after `return` statement 179 179 | 180 180 | def bar9(): + Run `ruff check --fix` to apply this fix. + RET505.py:183:5: RET505 [*] Unnecessary `else` after `return` statement | 181 | if True: @@ -332,7 +360,7 @@ RET505.py:183:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 180 180 | def bar9(): 181 181 | if True: 182 182 | return @@ -343,6 +371,8 @@ RET505.py:183:5: RET505 [*] Unnecessary `else` after `return` statement 186 185 | 187 186 | x = 0 + Run `ruff check --fix` to apply this fix. + RET505.py:200:5: RET505 [*] Unnecessary `else` after `return` statement | 198 | def sb(self): @@ -352,7 +382,7 @@ RET505.py:200:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 197 197 | # Regression test for: https://github.com/astral-sh/ruff/issues/9732 198 198 | def sb(self): 199 199 | if self._sb is not None: return self._sb @@ -362,6 +392,8 @@ RET505.py:200:5: RET505 [*] Unnecessary `else` after `return` statement 202 202 | 203 203 | def indent(x, y, w, z): + Run `ruff check --fix` to apply this fix. + RET505.py:207:5: RET505 [*] Unnecessary `else` after `return` statement | 205 | a = 1 @@ -373,7 +405,7 @@ RET505.py:207:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 204 204 | if x: # [no-else-return] 205 205 | a = 1 206 206 | return y @@ -387,6 +419,8 @@ RET505.py:207:5: RET505 [*] Unnecessary `else` after `return` statement 212 211 | 213 212 | def indent(x, y, w, z): + Run `ruff check --fix` to apply this fix. + RET505.py:217:5: RET505 [*] Unnecessary `else` after `return` statement | 215 | a = 1 @@ -398,7 +432,7 @@ RET505.py:217:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 214 214 | if x: # [no-else-return] 215 215 | a = 1 216 216 | return y @@ -413,6 +447,8 @@ RET505.py:217:5: RET505 [*] Unnecessary `else` after `return` statement 222 221 | 223 222 | def indent(x, y, w, z): + Run `ruff check --fix` to apply this fix. + RET505.py:227:5: RET505 [*] Unnecessary `else` after `return` statement | 225 | a = 1 @@ -424,7 +460,7 @@ RET505.py:227:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 224 224 | if x: # [no-else-return] 225 225 | a = 1 226 226 | return y @@ -439,6 +475,8 @@ RET505.py:227:5: RET505 [*] Unnecessary `else` after `return` statement 232 231 | 233 232 | def indent(x, y, w, z): + Run `ruff check --fix` to apply this fix. + RET505.py:237:5: RET505 [*] Unnecessary `else` after `return` statement | 235 | a = 1 @@ -450,7 +488,7 @@ RET505.py:237:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 234 234 | if x: # [no-else-return] 235 235 | a = 1 236 236 | return y @@ -461,4 +499,4 @@ RET505.py:237:5: RET505 [*] Unnecessary `else` after `return` statement 238 |+ c = 3 239 |+ return z - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET506_RET506.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET506_RET506.py.snap index 549850ee8d25b..5e623556e9ffe 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET506_RET506.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET506_RET506.py.snap @@ -12,7 +12,7 @@ RET506.py:8:5: RET506 [*] Unnecessary `elif` after `raise` statement | = help: Remove unnecessary `elif` -ℹ Safe fix +Suggested fix: 5 5 | if x: # [no-else-raise] 6 6 | a = 1 7 7 | raise Exception(y) @@ -22,6 +22,8 @@ RET506.py:8:5: RET506 [*] Unnecessary `elif` after `raise` statement 10 10 | raise Exception(w) 11 11 | else: + Run `ruff check --fix` to apply this fix. + RET506.py:23:5: RET506 [*] Unnecessary `elif` after `raise` statement | 21 | b = 2 @@ -33,7 +35,7 @@ RET506.py:23:5: RET506 [*] Unnecessary `elif` after `raise` statement | = help: Remove unnecessary `elif` -ℹ Safe fix +Suggested fix: 20 20 | else: 21 21 | b = 2 22 22 | raise Exception(x) @@ -43,6 +45,8 @@ RET506.py:23:5: RET506 [*] Unnecessary `elif` after `raise` statement 25 25 | else: 26 26 | c = 3 + Run `ruff check --fix` to apply this fix. + RET506.py:34:5: RET506 [*] Unnecessary `else` after `raise` statement | 32 | a = 1 @@ -54,7 +58,7 @@ RET506.py:34:5: RET506 [*] Unnecessary `else` after `raise` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 31 31 | if x: # [no-else-raise] 32 32 | a = 1 33 33 | raise Exception(y) @@ -67,6 +71,8 @@ RET506.py:34:5: RET506 [*] Unnecessary `else` after `raise` statement 38 37 | 39 38 | def foo3(x, y, z): + Run `ruff check --fix` to apply this fix. + RET506.py:45:9: RET506 [*] Unnecessary `else` after `raise` statement | 43 | b = 2 @@ -78,7 +84,7 @@ RET506.py:45:9: RET506 [*] Unnecessary `else` after `raise` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 42 42 | if y: # [no-else-raise] 43 43 | b = 2 44 44 | raise Exception(y) @@ -91,6 +97,8 @@ RET506.py:45:9: RET506 [*] Unnecessary `else` after `raise` statement 49 48 | d = 4 50 49 | raise Exception(z) + Run `ruff check --fix` to apply this fix. + RET506.py:60:5: RET506 [*] Unnecessary `else` after `raise` statement | 58 | b = 2 @@ -102,7 +110,7 @@ RET506.py:60:5: RET506 [*] Unnecessary `else` after `raise` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 57 57 | else: 58 58 | b = 2 59 59 | raise Exception(x) @@ -113,6 +121,8 @@ RET506.py:60:5: RET506 [*] Unnecessary `else` after `raise` statement 63 62 | 64 63 | + Run `ruff check --fix` to apply this fix. + RET506.py:70:9: RET506 [*] Unnecessary `else` after `raise` statement | 68 | a = 4 @@ -124,7 +134,7 @@ RET506.py:70:9: RET506 [*] Unnecessary `else` after `raise` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 67 67 | if y: # [no-else-raise] 68 68 | a = 4 69 69 | raise Exception(x) @@ -135,6 +145,8 @@ RET506.py:70:9: RET506 [*] Unnecessary `else` after `raise` statement 73 72 | c = 3 74 73 | raise Exception(y) + Run `ruff check --fix` to apply this fix. + RET506.py:80:5: RET506 [*] Unnecessary `else` after `raise` statement | 78 | if x: # [no-else-raise] @@ -146,7 +158,7 @@ RET506.py:80:5: RET506 [*] Unnecessary `else` after `raise` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 77 77 | def bar4(x): 78 78 | if x: # [no-else-raise] 79 79 | raise Exception(True) @@ -163,4 +175,4 @@ RET506.py:80:5: RET506 [*] Unnecessary `else` after `raise` statement 86 85 | 87 86 | ### - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET507_RET507.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET507_RET507.py.snap index 1a745fc2f576f..e863b00d8b3c9 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET507_RET507.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET507_RET507.py.snap @@ -12,7 +12,7 @@ RET507.py:8:9: RET507 [*] Unnecessary `elif` after `continue` statement | = help: Remove unnecessary `elif` -ℹ Safe fix +Suggested fix: 5 5 | for i in x: 6 6 | if i < y: # [no-else-continue] 7 7 | continue @@ -22,6 +22,8 @@ RET507.py:8:9: RET507 [*] Unnecessary `elif` after `continue` statement 10 10 | else: 11 11 | a = z + Run `ruff check --fix` to apply this fix. + RET507.py:22:9: RET507 [*] Unnecessary `elif` after `continue` statement | 20 | b = 2 @@ -33,7 +35,7 @@ RET507.py:22:9: RET507 [*] Unnecessary `elif` after `continue` statement | = help: Remove unnecessary `elif` -ℹ Safe fix +Suggested fix: 19 19 | else: 20 20 | b = 2 21 21 | continue @@ -43,6 +45,8 @@ RET507.py:22:9: RET507 [*] Unnecessary `elif` after `continue` statement 24 24 | else: 25 25 | c = 3 + Run `ruff check --fix` to apply this fix. + RET507.py:36:9: RET507 [*] Unnecessary `else` after `continue` statement | 34 | if i < y: # [no-else-continue] @@ -53,7 +57,7 @@ RET507.py:36:9: RET507 [*] Unnecessary `else` after `continue` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 33 33 | for i in x: 34 34 | if i < y: # [no-else-continue] 35 35 | continue @@ -64,6 +68,8 @@ RET507.py:36:9: RET507 [*] Unnecessary `else` after `continue` statement 39 38 | 40 39 | def foo3(x, y, z): + Run `ruff check --fix` to apply this fix. + RET507.py:47:13: RET507 [*] Unnecessary `else` after `continue` statement | 45 | b = 2 @@ -75,7 +81,7 @@ RET507.py:47:13: RET507 [*] Unnecessary `else` after `continue` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 44 44 | if z: # [no-else-continue] 45 45 | b = 2 46 46 | continue @@ -88,6 +94,8 @@ RET507.py:47:13: RET507 [*] Unnecessary `else` after `continue` statement 51 50 | d = 4 52 51 | continue + Run `ruff check --fix` to apply this fix. + RET507.py:63:9: RET507 [*] Unnecessary `else` after `continue` statement | 61 | b = 2 @@ -99,7 +107,7 @@ RET507.py:63:9: RET507 [*] Unnecessary `else` after `continue` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 60 60 | else: 61 61 | b = 2 62 62 | continue @@ -110,6 +118,8 @@ RET507.py:63:9: RET507 [*] Unnecessary `else` after `continue` statement 66 65 | 67 66 | + Run `ruff check --fix` to apply this fix. + RET507.py:74:13: RET507 [*] Unnecessary `else` after `continue` statement | 72 | a = 4 @@ -121,7 +131,7 @@ RET507.py:74:13: RET507 [*] Unnecessary `else` after `continue` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 71 71 | if y: # [no-else-continue] 72 72 | a = 4 73 73 | continue @@ -132,6 +142,8 @@ RET507.py:74:13: RET507 [*] Unnecessary `else` after `continue` statement 77 76 | c = 3 78 77 | continue + Run `ruff check --fix` to apply this fix. + RET507.py:85:9: RET507 [*] Unnecessary `else` after `continue` statement | 83 | if x: # [no-else-continue] @@ -143,7 +155,7 @@ RET507.py:85:9: RET507 [*] Unnecessary `else` after `continue` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 82 82 | for i in range(10): 83 83 | if x: # [no-else-continue] 84 84 | continue @@ -160,4 +172,4 @@ RET507.py:85:9: RET507 [*] Unnecessary `else` after `continue` statement 91 90 | 92 91 | def bar1(x, y, z): - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET508_RET508.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET508_RET508.py.snap index f35bda0f4e39e..c05aeb9b17721 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET508_RET508.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET508_RET508.py.snap @@ -12,7 +12,7 @@ RET508.py:8:9: RET508 [*] Unnecessary `elif` after `break` statement | = help: Remove unnecessary `elif` -ℹ Safe fix +Suggested fix: 5 5 | for i in x: 6 6 | if i > y: # [no-else-break] 7 7 | break @@ -22,6 +22,8 @@ RET508.py:8:9: RET508 [*] Unnecessary `elif` after `break` statement 10 10 | else: 11 11 | a = z + Run `ruff check --fix` to apply this fix. + RET508.py:22:9: RET508 [*] Unnecessary `elif` after `break` statement | 20 | b = 2 @@ -33,7 +35,7 @@ RET508.py:22:9: RET508 [*] Unnecessary `elif` after `break` statement | = help: Remove unnecessary `elif` -ℹ Safe fix +Suggested fix: 19 19 | else: 20 20 | b = 2 21 21 | break @@ -43,6 +45,8 @@ RET508.py:22:9: RET508 [*] Unnecessary `elif` after `break` statement 24 24 | else: 25 25 | c = 3 + Run `ruff check --fix` to apply this fix. + RET508.py:33:9: RET508 [*] Unnecessary `else` after `break` statement | 31 | if i > y: # [no-else-break] @@ -53,7 +57,7 @@ RET508.py:33:9: RET508 [*] Unnecessary `else` after `break` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 30 30 | for i in x: 31 31 | if i > y: # [no-else-break] 32 32 | break @@ -64,6 +68,8 @@ RET508.py:33:9: RET508 [*] Unnecessary `else` after `break` statement 36 35 | 37 36 | def foo3(x, y, z): + Run `ruff check --fix` to apply this fix. + RET508.py:44:13: RET508 [*] Unnecessary `else` after `break` statement | 42 | b = 2 @@ -75,7 +81,7 @@ RET508.py:44:13: RET508 [*] Unnecessary `else` after `break` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 41 41 | if z: # [no-else-break] 42 42 | b = 2 43 43 | break @@ -88,6 +94,8 @@ RET508.py:44:13: RET508 [*] Unnecessary `else` after `break` statement 48 47 | d = 4 49 48 | break + Run `ruff check --fix` to apply this fix. + RET508.py:60:9: RET508 [*] Unnecessary `else` after `break` statement | 58 | b = 2 @@ -99,7 +107,7 @@ RET508.py:60:9: RET508 [*] Unnecessary `else` after `break` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 57 57 | else: 58 58 | b = 2 59 59 | break @@ -110,6 +118,8 @@ RET508.py:60:9: RET508 [*] Unnecessary `else` after `break` statement 63 62 | 64 63 | + Run `ruff check --fix` to apply this fix. + RET508.py:71:13: RET508 [*] Unnecessary `else` after `break` statement | 69 | a = 4 @@ -121,7 +131,7 @@ RET508.py:71:13: RET508 [*] Unnecessary `else` after `break` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 68 68 | if y: # [no-else-break] 69 69 | a = 4 70 70 | break @@ -132,6 +142,8 @@ RET508.py:71:13: RET508 [*] Unnecessary `else` after `break` statement 74 73 | c = 3 75 74 | break + Run `ruff check --fix` to apply this fix. + RET508.py:82:9: RET508 [*] Unnecessary `else` after `break` statement | 80 | if x: # [no-else-break] @@ -143,7 +155,7 @@ RET508.py:82:9: RET508 [*] Unnecessary `else` after `break` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 79 79 | for i in range(10): 80 80 | if x: # [no-else-break] 81 81 | break @@ -160,6 +172,8 @@ RET508.py:82:9: RET508 [*] Unnecessary `else` after `break` statement 88 87 | 89 88 | ### + Run `ruff check --fix` to apply this fix. + RET508.py:158:13: RET508 [*] Unnecessary `else` after `break` statement | 156 | if i > w: @@ -170,7 +184,7 @@ RET508.py:158:13: RET508 [*] Unnecessary `else` after `break` statement | = help: Remove unnecessary `else` -ℹ Safe fix +Suggested fix: 155 155 | else: 156 156 | if i > w: 157 157 | break @@ -178,4 +192,4 @@ RET508.py:158:13: RET508 [*] Unnecessary `else` after `break` statement 159 |- a = z 158 |+ a = z - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap index 7fe5ffe88ba0b..cd659ed5cab20 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap @@ -9,13 +9,15 @@ SIM101.py:1:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing | = help: Merge `isinstance` calls for `a` -ℹ Unsafe fix +Suggested fix: 1 |-if isinstance(a, int) or isinstance(a, float): # SIM101 1 |+if isinstance(a, (int, float)): # SIM101 2 2 | pass 3 3 | 4 4 | if isinstance(a, (int, float)) or isinstance(a, bool): # SIM101 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM101.py:4:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 2 | pass @@ -26,7 +28,7 @@ SIM101.py:4:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing | = help: Merge `isinstance` calls for `a` -ℹ Unsafe fix +Suggested fix: 1 1 | if isinstance(a, int) or isinstance(a, float): # SIM101 2 2 | pass 3 3 | @@ -36,6 +38,8 @@ SIM101.py:4:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing 6 6 | 7 7 | if isinstance(a, int) or isinstance(a, float) or isinstance(b, bool): # SIM101 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM101.py:7:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 5 | pass @@ -46,7 +50,7 @@ SIM101.py:7:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing | = help: Merge `isinstance` calls for `a` -ℹ Unsafe fix +Suggested fix: 4 4 | if isinstance(a, (int, float)) or isinstance(a, bool): # SIM101 5 5 | pass 6 6 | @@ -56,6 +60,8 @@ SIM101.py:7:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing 9 9 | 10 10 | if isinstance(b, bool) or isinstance(a, int) or isinstance(a, float): # SIM101 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM101.py:10:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 8 | pass @@ -66,7 +72,7 @@ SIM101.py:10:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -ℹ Unsafe fix +Suggested fix: 7 7 | if isinstance(a, int) or isinstance(a, float) or isinstance(b, bool): # SIM101 8 8 | pass 9 9 | @@ -76,6 +82,8 @@ SIM101.py:10:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin 12 12 | 13 13 | if isinstance(a, int) or isinstance(b, bool) or isinstance(a, float): # SIM101 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM101.py:16:5: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 14 | pass @@ -86,7 +94,7 @@ SIM101.py:16:5: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -ℹ Unsafe fix +Suggested fix: 13 13 | if isinstance(a, int) or isinstance(b, bool) or isinstance(a, float): # SIM101 14 14 | pass 15 15 | @@ -96,6 +104,8 @@ SIM101.py:16:5: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin 18 18 | 19 19 | if isinstance(a.b, int) or isinstance(a.b, float): # SIM101 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM101.py:19:4: SIM101 [*] Multiple `isinstance` calls for expression, merge into a single call | 17 | pass @@ -106,7 +116,7 @@ SIM101.py:19:4: SIM101 [*] Multiple `isinstance` calls for expression, merge int | = help: Merge `isinstance` calls -ℹ Unsafe fix +Suggested fix: 16 16 | if (isinstance(a, int) or isinstance(a, float)) and isinstance(b, bool): # SIM101 17 17 | pass 18 18 | @@ -116,6 +126,8 @@ SIM101.py:19:4: SIM101 [*] Multiple `isinstance` calls for expression, merge int 21 21 | 22 22 | if isinstance(a(), int) or isinstance(a(), float): # SIM101 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM101.py:22:4: SIM101 Multiple `isinstance` calls for expression, merge into a single call | 20 | pass @@ -136,7 +148,7 @@ SIM101.py:38:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -ℹ Unsafe fix +Suggested fix: 35 35 | if isinstance(a, int) or unrelated_condition or isinstance(a, float): 36 36 | pass 37 37 | @@ -146,6 +158,8 @@ SIM101.py:38:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin 40 40 | 41 41 | if x or y or isinstance(a, int) or isinstance(a, float) or z: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM101.py:41:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 39 | pass @@ -156,7 +170,7 @@ SIM101.py:41:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -ℹ Unsafe fix +Suggested fix: 38 38 | if x or isinstance(a, int) or isinstance(a, float): 39 39 | pass 40 40 | @@ -166,6 +180,8 @@ SIM101.py:41:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin 43 43 | 44 44 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM101.py:53:3: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 52 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722460483 @@ -175,10 +191,12 @@ SIM101.py:53:3: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -ℹ Unsafe fix +Suggested fix: 50 50 | pass 51 51 | 52 52 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722460483 53 |-if(isinstance(a, int)) or (isinstance(a, float)): 53 |+if isinstance(a, (int, float)): 54 54 | pass + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap index 480bd0fa4cc66..42f69c8df6c22 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap @@ -11,7 +11,7 @@ SIM102.py:2:1: SIM102 [*] Use a single `if` statement instead of nested `if` sta | = help: Combine `if` statements using `and` -ℹ Unsafe fix +Suggested fix: 1 1 | # SIM102 2 |-if a: 3 |- if b: @@ -22,6 +22,8 @@ SIM102.py:2:1: SIM102 [*] Use a single `if` statement instead of nested `if` sta 6 5 | # SIM102 7 6 | if a: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM102.py:7:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 6 | # SIM102 @@ -33,7 +35,7 @@ SIM102.py:7:1: SIM102 [*] Use a single `if` statement instead of nested `if` sta | = help: Combine `if` statements using `and` -ℹ Unsafe fix +Suggested fix: 4 4 | c 5 5 | 6 6 | # SIM102 @@ -48,6 +50,8 @@ SIM102.py:7:1: SIM102 [*] Use a single `if` statement instead of nested `if` sta 12 11 | # SIM102 13 12 | if a: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM102.py:8:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 6 | # SIM102 @@ -60,7 +64,7 @@ SIM102.py:8:5: SIM102 [*] Use a single `if` statement instead of nested `if` sta | = help: Combine `if` statements using `and` -ℹ Unsafe fix +Suggested fix: 5 5 | 6 6 | # SIM102 7 7 | if a: @@ -73,6 +77,8 @@ SIM102.py:8:5: SIM102 [*] Use a single `if` statement instead of nested `if` sta 12 11 | # SIM102 13 12 | if a: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM102.py:15:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 13 | if a: @@ -84,7 +90,7 @@ SIM102.py:15:1: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -ℹ Unsafe fix +Suggested fix: 12 12 | # SIM102 13 13 | if a: 14 14 | pass @@ -97,6 +103,8 @@ SIM102.py:15:1: SIM102 [*] Use a single `if` statement instead of nested `if` st 19 18 | # SIM102 20 19 | if a: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM102.py:20:1: SIM102 Use a single `if` statement instead of nested `if` statements | 19 | # SIM102 @@ -119,7 +127,7 @@ SIM102.py:26:1: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -ℹ Unsafe fix +Suggested fix: 23 23 | c 24 24 | 25 25 | # SIM102 @@ -134,6 +142,8 @@ SIM102.py:26:1: SIM102 [*] Use a single `if` statement instead of nested `if` st 31 30 | # OK 32 31 | if a: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM102.py:51:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 49 | while x > 0: @@ -147,7 +157,7 @@ SIM102.py:51:5: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -ℹ Unsafe fix +Suggested fix: 48 48 | 49 49 | while x > 0: 50 50 | # SIM102 @@ -172,6 +182,8 @@ SIM102.py:51:5: SIM102 [*] Use a single `if` statement instead of nested `if` st 64 63 | 65 64 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM102.py:67:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 66 | # SIM102 @@ -183,7 +195,7 @@ SIM102.py:67:1: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -ℹ Unsafe fix +Suggested fix: 64 64 | 65 65 | 66 66 | # SIM102 @@ -208,6 +220,8 @@ SIM102.py:67:1: SIM102 [*] Use a single `if` statement instead of nested `if` st 80 79 | 81 80 | while x > 0: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM102.py:83:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 81 | while x > 0: @@ -222,7 +236,7 @@ SIM102.py:83:5: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -ℹ Unsafe fix +Suggested fix: 80 80 | 81 81 | while x > 0: 82 82 | # SIM102 @@ -239,6 +253,8 @@ SIM102.py:83:5: SIM102 [*] Use a single `if` statement instead of nested `if` st 89 88 | # SIM102 (auto-fixable) 90 89 | if node.module012345678: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM102.py:90:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 89 | # SIM102 (auto-fixable) @@ -251,7 +267,7 @@ SIM102.py:90:1: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -ℹ Unsafe fix +Suggested fix: 87 87 | print("Bad module!") 88 88 | 89 89 | # SIM102 (auto-fixable) @@ -268,6 +284,8 @@ SIM102.py:90:1: SIM102 [*] Use a single `if` statement instead of nested `if` st 96 95 | # SIM102 (not auto-fixable) 97 96 | if node.module0123456789: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM102.py:97:1: SIM102 Use a single `if` statement instead of nested `if` statements | 96 | # SIM102 (not auto-fixable) @@ -293,7 +311,7 @@ SIM102.py:106:5: SIM102 [*] Use a single `if` statement instead of nested `if` s | = help: Combine `if` statements using `and` -ℹ Unsafe fix +Suggested fix: 103 103 | # SIM102 104 104 | # Regression test for https://github.com/apache/airflow/blob/145b16caaa43f0c42bffd97344df916c602cddde/airflow/configuration.py#L1161 105 105 | if a: @@ -306,6 +324,8 @@ SIM102.py:106:5: SIM102 [*] Use a single `if` statement instead of nested `if` s 110 109 | print("elif") 111 110 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM102.py:132:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 130 | if a: @@ -319,7 +339,7 @@ SIM102.py:132:5: SIM102 [*] Use a single `if` statement instead of nested `if` s | = help: Combine `if` statements using `and` -ℹ Unsafe fix +Suggested fix: 129 129 | # OK 130 130 | if a: 131 131 | # SIM 102 @@ -332,6 +352,8 @@ SIM102.py:132:5: SIM102 [*] Use a single `if` statement instead of nested `if` s 136 135 | print("bar") 137 136 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM102.py:165:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 163 | if a: @@ -344,7 +366,7 @@ SIM102.py:165:5: SIM102 [*] Use a single `if` statement instead of nested `if` s | = help: Combine `if` statements using `and` -ℹ Unsafe fix +Suggested fix: 162 162 | def f(): 163 163 | if a: 164 164 | pass @@ -354,4 +376,4 @@ SIM102.py:165:5: SIM102 [*] Use a single `if` statement instead of nested `if` s 165 |+ elif b and c: 166 |+ d - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap index 1b44533abc17b..20759bbb86fb6 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap @@ -14,7 +14,7 @@ SIM103.py:3:5: SIM103 [*] Return the condition `bool(a)` directly | = help: Replace with `return bool(a)` -ℹ Unsafe fix +Suggested fix: 1 1 | def f(): 2 2 | # SIM103 3 |- if a: @@ -26,6 +26,8 @@ SIM103.py:3:5: SIM103 [*] Return the condition `bool(a)` directly 8 5 | 9 6 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM103.py:11:5: SIM103 [*] Return the condition `a == b` directly | 9 | def f(): @@ -39,7 +41,7 @@ SIM103.py:11:5: SIM103 [*] Return the condition `a == b` directly | = help: Replace with `return a == b` -ℹ Unsafe fix +Suggested fix: 8 8 | 9 9 | def f(): 10 10 | # SIM103 @@ -52,6 +54,8 @@ SIM103.py:11:5: SIM103 [*] Return the condition `a == b` directly 16 13 | 17 14 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM103.py:21:5: SIM103 [*] Return the condition `bool(b)` directly | 19 | if a: @@ -65,7 +69,7 @@ SIM103.py:21:5: SIM103 [*] Return the condition `bool(b)` directly | = help: Replace with `return bool(b)` -ℹ Unsafe fix +Suggested fix: 18 18 | # SIM103 19 19 | if a: 20 20 | return 1 @@ -78,6 +82,8 @@ SIM103.py:21:5: SIM103 [*] Return the condition `bool(b)` directly 26 23 | 27 24 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM103.py:32:9: SIM103 [*] Return the condition `bool(b)` directly | 30 | return 1 @@ -91,7 +97,7 @@ SIM103.py:32:9: SIM103 [*] Return the condition `bool(b)` directly | = help: Replace with `return bool(b)` -ℹ Unsafe fix +Suggested fix: 29 29 | if a: 30 30 | return 1 31 31 | else: @@ -104,6 +110,8 @@ SIM103.py:32:9: SIM103 [*] Return the condition `bool(b)` directly 37 34 | 38 35 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM103.py:57:5: SIM103 [*] Return the condition `not a` directly | 55 | def f(): @@ -117,7 +125,7 @@ SIM103.py:57:5: SIM103 [*] Return the condition `not a` directly | = help: Replace with `return not a` -ℹ Unsafe fix +Suggested fix: 54 54 | 55 55 | def f(): 56 56 | # SIM103 @@ -130,6 +138,8 @@ SIM103.py:57:5: SIM103 [*] Return the condition `not a` directly 62 59 | 63 60 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM103.py:83:5: SIM103 Return the condition directly | 81 | def bool(): @@ -156,7 +166,7 @@ SIM103.py:91:5: SIM103 [*] Return the condition `not (keys is not None and notic | = help: Replace with `return not (keys is not None and notice.key not in keys)` -ℹ Unsafe fix +Suggested fix: 88 88 | 89 89 | def f(): 90 90 | # SIM103 @@ -169,6 +179,8 @@ SIM103.py:91:5: SIM103 [*] Return the condition `not (keys is not None and notic 96 93 | 97 94 | ### + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM103.py:104:5: SIM103 [*] Return the condition `bool(a)` directly | 102 | def f(): @@ -181,7 +193,7 @@ SIM103.py:104:5: SIM103 [*] Return the condition `bool(a)` directly | = help: Replace with `return bool(a)` -ℹ Unsafe fix +Suggested fix: 101 101 | 102 102 | def f(): 103 103 | # SIM103 @@ -193,6 +205,8 @@ SIM103.py:104:5: SIM103 [*] Return the condition `bool(a)` directly 108 106 | 109 107 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM103.py:111:5: SIM103 [*] Return the condition `not a` directly | 109 | def f(): @@ -205,7 +219,7 @@ SIM103.py:111:5: SIM103 [*] Return the condition `not a` directly | = help: Replace with `return not a` -ℹ Unsafe fix +Suggested fix: 108 108 | 109 109 | def f(): 110 110 | # SIM103 @@ -217,6 +231,8 @@ SIM103.py:111:5: SIM103 [*] Return the condition `not a` directly 115 113 | 116 114 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM103.py:117:5: SIM103 [*] Return the condition `10 < a` directly | 116 | def f(): @@ -228,7 +244,7 @@ SIM103.py:117:5: SIM103 [*] Return the condition `10 < a` directly | = help: Replace with `return 10 < a` -ℹ Unsafe fix +Suggested fix: 114 114 | 115 115 | 116 116 | def f(): @@ -240,6 +256,8 @@ SIM103.py:117:5: SIM103 [*] Return the condition `10 < a` directly 121 119 | 122 120 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM103.py:123:5: SIM103 [*] Return the condition `not 10 < a` directly | 122 | def f(): @@ -251,7 +269,7 @@ SIM103.py:123:5: SIM103 [*] Return the condition `not 10 < a` directly | = help: Replace with `return not 10 < a` -ℹ Unsafe fix +Suggested fix: 120 120 | 121 121 | 122 122 | def f(): @@ -259,3 +277,5 @@ SIM103.py:123:5: SIM103 [*] Return the condition `not 10 < a` directly 124 |- return False 125 |- return True 123 |+ return not 10 < a + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap index dfd257b8a0ec9..5e4e68bd78ba4 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap @@ -12,7 +12,7 @@ SIM105_0.py:6:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `tr | = help: Replace with `contextlib.suppress(ValueError)` -ℹ Unsafe fix +Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -28,6 +28,8 @@ SIM105_0.py:6:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `tr 11 10 | 12 11 | # SIM105 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM105_0.py:13:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` | 12 | # SIM105 @@ -41,7 +43,7 @@ SIM105_0.py:13:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` inst | = help: Replace with `contextlib.suppress(ValueError, OSError)` -ℹ Unsafe fix +Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -59,6 +61,8 @@ SIM105_0.py:13:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` inst 18 17 | # SIM105 19 18 | try: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM105_0.py:19:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` | 18 | # SIM105 @@ -72,7 +76,7 @@ SIM105_0.py:19:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` inst | = help: Replace with `contextlib.suppress(ValueError, OSError)` -ℹ Unsafe fix +Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -90,6 +94,8 @@ SIM105_0.py:19:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` inst 24 23 | # SIM105 25 24 | try: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM105_0.py:25:1: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass` | 24 | # SIM105 @@ -103,7 +109,7 @@ SIM105_0.py:25:1: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `tr | = help: Replace with `contextlib.suppress(Exception)` -ℹ Unsafe fix +Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -121,6 +127,8 @@ SIM105_0.py:25:1: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `tr 30 29 | # SIM105 31 30 | try: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM105_0.py:31:1: SIM105 [*] Use `contextlib.suppress(a.Error, b.Error)` instead of `try`-`except`-`pass` | 30 | # SIM105 @@ -134,7 +142,7 @@ SIM105_0.py:31:1: SIM105 [*] Use `contextlib.suppress(a.Error, b.Error)` instead | = help: Replace with `contextlib.suppress(a.Error, b.Error)` -ℹ Unsafe fix +Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -152,6 +160,8 @@ SIM105_0.py:31:1: SIM105 [*] Use `contextlib.suppress(a.Error, b.Error)` instead 36 35 | # OK 37 36 | try: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM105_0.py:85:5: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` | 83 | def with_ellipsis(): @@ -165,7 +175,7 @@ SIM105_0.py:85:5: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `t | = help: Replace with `contextlib.suppress(ValueError)` -ℹ Unsafe fix +Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -183,6 +193,8 @@ SIM105_0.py:85:5: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `t 90 89 | 91 90 | def with_ellipsis_and_return(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM105_0.py:100:5: SIM105 Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` | 99 | def with_comment(): @@ -212,7 +224,7 @@ SIM105_0.py:117:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try | = help: Replace with `contextlib.suppress(OSError)` -ℹ Unsafe fix +Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -230,6 +242,8 @@ SIM105_0.py:117:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try 122 121 | try: os.makedirs(model_dir); 123 122 | except OSError: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM105_0.py:122:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` | 120 | pass; @@ -244,7 +258,7 @@ SIM105_0.py:122:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try | = help: Replace with `contextlib.suppress(OSError)` -ℹ Unsafe fix +Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -261,6 +275,8 @@ SIM105_0.py:122:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try 126 125 | try: os.makedirs(model_dir); 127 126 | except OSError: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM105_0.py:126:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` | 124 | pass; @@ -275,7 +291,7 @@ SIM105_0.py:126:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try | = help: Replace with `contextlib.suppress(OSError)` -ℹ Unsafe fix +Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -291,4 +307,4 @@ SIM105_0.py:126:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try 129 128 | \ 130 129 | # - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap index 65f4991e1752c..20508b7d3ed94 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap @@ -12,7 +12,7 @@ SIM105_1.py:5:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `tr | = help: Replace with `contextlib.suppress(ValueError)` -ℹ Unsafe fix +Suggested fix: 1 1 | """Case: There's a random import, so it should add `contextlib` after it.""" 2 2 | import math 3 |+import contextlib @@ -24,4 +24,4 @@ SIM105_1.py:5:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `tr 7 |-except ValueError: 8 |- pass - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap index 1963b91bc8c1f..fa1779140411b 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap @@ -12,7 +12,7 @@ SIM105_2.py:10:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `t | = help: Replace with `contextlib.suppress(ValueError)` -ℹ Unsafe fix +Suggested fix: 7 7 | 8 8 | 9 9 | # SIM105 @@ -22,4 +22,4 @@ SIM105_2.py:10:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `t 12 |-except ValueError: 13 |- pass - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap index 1389a2ce4fdbe..033399cd6607c 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap @@ -11,7 +11,7 @@ SIM105_4.py:2:1: SIM105 [*] Use `contextlib.suppress(ImportError)` instead of `t | = help: Replace with `contextlib.suppress(ImportError)` -ℹ Unsafe fix +Suggested fix: 1 1 | #!/usr/bin/env python 2 |-try: 2 |+import contextlib @@ -19,4 +19,4 @@ SIM105_4.py:2:1: SIM105 [*] Use `contextlib.suppress(ImportError)` instead of `t 3 4 | from __builtin__ import bytes, str, open, super, range, zip, round, int, pow, object, input 4 |-except ImportError: pass - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap index 71cede1631308..72ba2c077b982 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap @@ -14,7 +14,7 @@ SIM108.py:2:1: SIM108 [*] Use ternary operator `b = c if a else d` instead of `i | = help: Replace `if`-`else`-block with `b = c if a else d` -ℹ Unsafe fix +Suggested fix: 1 1 | # SIM108 2 |-if a: 3 |- b = c @@ -25,6 +25,8 @@ SIM108.py:2:1: SIM108 [*] Use ternary operator `b = c if a else d` instead of `i 7 4 | # OK 8 5 | b = c if a else d + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM108.py:30:5: SIM108 [*] Use ternary operator `b = 1 if a else 2` instead of `if`-`else`-block | 28 | pass @@ -38,7 +40,7 @@ SIM108.py:30:5: SIM108 [*] Use ternary operator `b = 1 if a else 2` instead of ` | = help: Replace `if`-`else`-block with `b = 1 if a else 2` -ℹ Unsafe fix +Suggested fix: 27 27 | if True: 28 28 | pass 29 29 | else: @@ -51,6 +53,8 @@ SIM108.py:30:5: SIM108 [*] Use ternary operator `b = 1 if a else 2` instead of ` 35 32 | 36 33 | import sys + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM108.py:58:1: SIM108 Use ternary operator `abc = x if x > 0 else -x` instead of `if`-`else`-block | 57 | # SIM108 (without fix due to comments) @@ -75,7 +79,7 @@ SIM108.py:82:1: SIM108 [*] Use ternary operator `b = "cccccccccccccccccccccccccc | = help: Replace `if`-`else`-block with `b = "cccccccccccccccccccccccccccccccccß" if a else "ddddddddddddddddddddddddddddddddd💣"` -ℹ Unsafe fix +Suggested fix: 79 79 | 80 80 | 81 81 | # SIM108 @@ -88,6 +92,8 @@ SIM108.py:82:1: SIM108 [*] Use ternary operator `b = "cccccccccccccccccccccccccc 87 84 | 88 85 | # OK (too long) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM108.py:105:1: SIM108 Use ternary operator `exitcode = 0 if True else 1` instead of `if`-`else`-block | 104 | # SIM108 (without fix due to trailing comment) @@ -118,5 +124,3 @@ SIM108.py:117:1: SIM108 Use ternary operator `x = 3 if True else 5` instead of ` | |_________^ SIM108 | = help: Replace `if`-`else`-block with `x = 3 if True else 5` - - diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap index 760f432942328..a698deb16006f 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap @@ -10,7 +10,7 @@ SIM109.py:2:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compari | = help: Replace with `a in (b, c)` -ℹ Unsafe fix +Suggested fix: 1 1 | # SIM109 2 |-if a == b or a == c: 2 |+if a in (b, c): @@ -18,6 +18,8 @@ SIM109.py:2:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compari 4 4 | 5 5 | # SIM109 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM109.py:6:5: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons | 5 | # SIM109 @@ -27,7 +29,7 @@ SIM109.py:6:5: SIM109 [*] Use `a in (b, c)` instead of multiple equality compari | = help: Replace with `a in (b, c)` -ℹ Unsafe fix +Suggested fix: 3 3 | d 4 4 | 5 5 | # SIM109 @@ -37,6 +39,8 @@ SIM109.py:6:5: SIM109 [*] Use `a in (b, c)` instead of multiple equality compari 8 8 | 9 9 | # SIM109 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM109.py:10:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons | 9 | # SIM109 @@ -46,7 +50,7 @@ SIM109.py:10:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compar | = help: Replace with `a in (b, c)` -ℹ Unsafe fix +Suggested fix: 7 7 | d 8 8 | 9 9 | # SIM109 @@ -56,6 +60,8 @@ SIM109.py:10:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compar 12 12 | 13 13 | # SIM109 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM109.py:14:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons | 13 | # SIM109 @@ -65,7 +71,7 @@ SIM109.py:14:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compar | = help: Replace with `a in (b, c)` -ℹ Unsafe fix +Suggested fix: 11 11 | d 12 12 | 13 13 | # SIM109 @@ -75,4 +81,4 @@ SIM109.py:14:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compar 16 16 | 17 17 | # OK - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap index f23d9000363ee..6f0a065ad0f9d 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap @@ -14,7 +14,7 @@ SIM110.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead o | = help: Replace with `return any(check(x) for x in iterable)` -ℹ Unsafe fix +Suggested fix: 1 1 | def f(): 2 2 | # SIM110 3 |- for x in iterable: @@ -26,6 +26,8 @@ SIM110.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead o 8 5 | 9 6 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM110.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 23 | def f(): @@ -39,7 +41,7 @@ SIM110.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -ℹ Unsafe fix +Suggested fix: 22 22 | 23 23 | def f(): 24 24 | # SIM111 @@ -52,6 +54,8 @@ SIM110.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst 30 27 | 31 28 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM110.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop | 31 | def f(): @@ -65,7 +69,7 @@ SIM110.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` inst | = help: Replace with `return all(x.is_empty() for x in iterable)` -ℹ Unsafe fix +Suggested fix: 30 30 | 31 31 | def f(): 32 32 | # SIM111 @@ -78,6 +82,8 @@ SIM110.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` inst 38 35 | 39 36 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM110.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | 53 | def f(): @@ -92,7 +98,7 @@ SIM110.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -ℹ Unsafe fix +Suggested fix: 52 52 | 53 53 | def f(): 54 54 | # SIM110 @@ -106,6 +112,8 @@ SIM110.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead 61 57 | 62 58 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM110.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 62 | def f(): @@ -120,7 +128,7 @@ SIM110.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -ℹ Unsafe fix +Suggested fix: 61 61 | 62 62 | def f(): 63 63 | # SIM111 @@ -134,6 +142,8 @@ SIM110.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst 70 66 | 71 67 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM110.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | 71 | def f(): @@ -149,7 +159,7 @@ SIM110.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -ℹ Unsafe fix +Suggested fix: 70 70 | 71 71 | def f(): 72 72 | # SIM110 @@ -163,6 +173,8 @@ SIM110.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead 79 75 | 80 76 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM110.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 81 | def f(): @@ -178,7 +190,7 @@ SIM110.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -ℹ Unsafe fix +Suggested fix: 80 80 | 81 81 | def f(): 82 82 | # SIM111 @@ -192,6 +204,8 @@ SIM110.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst 89 85 | 90 86 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM110.py:124:5: SIM110 Use `return any(check(x) for x in iterable)` instead of `for` loop | 122 | pass @@ -230,7 +244,7 @@ SIM110.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -ℹ Unsafe fix +Suggested fix: 141 141 | x = 1 142 142 | 143 143 | # SIM110 @@ -243,6 +257,8 @@ SIM110.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead 149 146 | 150 147 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM110.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 153 | # SIM111 @@ -255,7 +271,7 @@ SIM110.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` ins | = help: Replace with `return all(not check(x) for x in iterable)` -ℹ Unsafe fix +Suggested fix: 151 151 | x = 1 152 152 | 153 153 | # SIM111 @@ -268,6 +284,8 @@ SIM110.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` ins 159 156 | 160 157 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM110.py:162:5: SIM110 [*] Use `return any(x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ")` instead of `for` loop | 160 | def f(): @@ -281,7 +299,7 @@ SIM110.py:162:5: SIM110 [*] Use `return any(x.isdigit() for x in "012ß9💣2ℝ | = help: Replace with `return any(x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ")` -ℹ Unsafe fix +Suggested fix: 159 159 | 160 160 | def f(): 161 161 | # SIM110 @@ -294,6 +312,8 @@ SIM110.py:162:5: SIM110 [*] Use `return any(x.isdigit() for x in "012ß9💣2ℝ 167 164 | 168 165 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM110.py:184:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | 182 | async def f(): @@ -309,7 +329,7 @@ SIM110.py:184:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -ℹ Unsafe fix +Suggested fix: 181 181 | 182 182 | async def f(): 183 183 | # SIM110 @@ -322,6 +342,8 @@ SIM110.py:184:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead 189 186 | async def f(): 190 187 | # SIM110 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM110.py:191:5: SIM110 [*] Use `return any(check(x) for x in await iterable)` instead of `for` loop | 189 | async def f(): @@ -337,7 +359,7 @@ SIM110.py:191:5: SIM110 [*] Use `return any(check(x) for x in await iterable)` i | = help: Replace with `return any(check(x) for x in await iterable)` -ℹ Unsafe fix +Suggested fix: 188 188 | 189 189 | async def f(): 190 190 | # SIM110 @@ -350,4 +372,4 @@ SIM110.py:191:5: SIM110 [*] Use `return any(check(x) for x in await iterable)` i 196 193 | def f(): 197 194 | # OK (can't turn this into any() because the yield would end up inside a genexp) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap index 9b59955fe1eb6..cddc7aa027145 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap @@ -14,7 +14,7 @@ SIM111.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead o | = help: Replace with `return any(check(x) for x in iterable)` -ℹ Unsafe fix +Suggested fix: 1 1 | def f(): 2 2 | # SIM110 3 |- for x in iterable: @@ -26,6 +26,8 @@ SIM111.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead o 8 5 | 9 6 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM111.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 23 | def f(): @@ -39,7 +41,7 @@ SIM111.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -ℹ Unsafe fix +Suggested fix: 22 22 | 23 23 | def f(): 24 24 | # SIM111 @@ -52,6 +54,8 @@ SIM111.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst 30 27 | 31 28 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM111.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop | 31 | def f(): @@ -65,7 +69,7 @@ SIM111.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` inst | = help: Replace with `return all(x.is_empty() for x in iterable)` -ℹ Unsafe fix +Suggested fix: 30 30 | 31 31 | def f(): 32 32 | # SIM111 @@ -78,6 +82,8 @@ SIM111.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` inst 38 35 | 39 36 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM111.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | 53 | def f(): @@ -92,7 +98,7 @@ SIM111.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -ℹ Unsafe fix +Suggested fix: 52 52 | 53 53 | def f(): 54 54 | # SIM110 @@ -106,6 +112,8 @@ SIM111.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead 61 57 | 62 58 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM111.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 62 | def f(): @@ -120,7 +128,7 @@ SIM111.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -ℹ Unsafe fix +Suggested fix: 61 61 | 62 62 | def f(): 63 63 | # SIM111 @@ -134,6 +142,8 @@ SIM111.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst 70 66 | 71 67 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM111.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | 71 | def f(): @@ -149,7 +159,7 @@ SIM111.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -ℹ Unsafe fix +Suggested fix: 70 70 | 71 71 | def f(): 72 72 | # SIM110 @@ -163,6 +173,8 @@ SIM111.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead 79 75 | 80 76 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM111.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 81 | def f(): @@ -178,7 +190,7 @@ SIM111.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -ℹ Unsafe fix +Suggested fix: 80 80 | 81 81 | def f(): 82 82 | # SIM111 @@ -192,6 +204,8 @@ SIM111.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst 89 85 | 90 86 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM111.py:124:5: SIM110 Use `return any(check(x) for x in iterable)` instead of `for` loop | 122 | pass @@ -230,7 +244,7 @@ SIM111.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -ℹ Unsafe fix +Suggested fix: 141 141 | x = 1 142 142 | 143 143 | # SIM110 @@ -243,6 +257,8 @@ SIM111.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead 149 146 | 150 147 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM111.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 153 | # SIM111 @@ -255,7 +271,7 @@ SIM111.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` ins | = help: Replace with `return all(not check(x) for x in iterable)` -ℹ Unsafe fix +Suggested fix: 151 151 | x = 1 152 152 | 153 153 | # SIM111 @@ -268,6 +284,8 @@ SIM111.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` ins 159 156 | 160 157 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM111.py:162:5: SIM110 [*] Use `return all(x in y for x in iterable)` instead of `for` loop | 160 | def f(): @@ -281,7 +299,7 @@ SIM111.py:162:5: SIM110 [*] Use `return all(x in y for x in iterable)` instead o | = help: Replace with `return all(x in y for x in iterable)` -ℹ Unsafe fix +Suggested fix: 159 159 | 160 160 | def f(): 161 161 | # SIM111 @@ -294,6 +312,8 @@ SIM111.py:162:5: SIM110 [*] Use `return all(x in y for x in iterable)` instead o 167 164 | 168 165 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM111.py:170:5: SIM110 [*] Use `return all(x <= y for x in iterable)` instead of `for` loop | 168 | def f(): @@ -307,7 +327,7 @@ SIM111.py:170:5: SIM110 [*] Use `return all(x <= y for x in iterable)` instead o | = help: Replace with `return all(x <= y for x in iterable)` -ℹ Unsafe fix +Suggested fix: 167 167 | 168 168 | def f(): 169 169 | # SIM111 @@ -320,6 +340,8 @@ SIM111.py:170:5: SIM110 [*] Use `return all(x <= y for x in iterable)` instead o 175 172 | 176 173 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM111.py:178:5: SIM110 [*] Use `return all(not x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9")` instead of `for` loop | 176 | def f(): @@ -333,7 +355,7 @@ SIM111.py:178:5: SIM110 [*] Use `return all(not x.isdigit() for x in "012ß9💣 | = help: Replace with `return all(not x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9")` -ℹ Unsafe fix +Suggested fix: 175 175 | 176 176 | def f(): 177 177 | # SIM111 @@ -346,4 +368,4 @@ SIM111.py:178:5: SIM110 [*] Use `return all(not x.isdigit() for x in "012ß9💣 183 180 | 184 181 | def f(): - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap index fb82814e61b59..b5592397f0624 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap @@ -11,7 +11,7 @@ SIM112.py:4:12: SIM112 [*] Use capitalized environment variable `FOO` instead of | = help: Replace `foo` with `FOO` -ℹ Unsafe fix +Suggested fix: 1 1 | import os 2 2 | 3 3 | # Bad @@ -21,6 +21,8 @@ SIM112.py:4:12: SIM112 [*] Use capitalized environment variable `FOO` instead of 6 6 | os.environ.get('foo') 7 7 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM112.py:6:16: SIM112 Use capitalized environment variable `FOO` instead of `foo` | 4 | os.environ['foo'] @@ -76,7 +78,7 @@ SIM112.py:14:18: SIM112 [*] Use capitalized environment variable `FOO` instead o | = help: Replace `foo` with `FOO` -ℹ Unsafe fix +Suggested fix: 11 11 | 12 12 | env = os.environ.get('foo') 13 13 | @@ -86,6 +88,8 @@ SIM112.py:14:18: SIM112 [*] Use capitalized environment variable `FOO` instead o 16 16 | if env := os.environ.get('foo'): 17 17 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM112.py:16:26: SIM112 Use capitalized environment variable `FOO` instead of `foo` | 14 | env = os.environ['foo'] @@ -106,7 +110,7 @@ SIM112.py:19:22: SIM112 [*] Use capitalized environment variable `FOO` instead o | = help: Replace `foo` with `FOO` -ℹ Unsafe fix +Suggested fix: 16 16 | if env := os.environ.get('foo'): 17 17 | pass 18 18 | @@ -116,4 +120,4 @@ SIM112.py:19:22: SIM112 [*] Use capitalized environment variable `FOO` instead o 21 21 | 22 22 | - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM114_SIM114.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM114_SIM114.py.snap index eaf2057160b39..12cbac068fdda 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM114_SIM114.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM114_SIM114.py.snap @@ -14,7 +14,7 @@ SIM114.py:2:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -ℹ Safe fix +Suggested fix: 1 1 | # Errors 2 |-if a: 3 |- b @@ -24,6 +24,8 @@ SIM114.py:2:1: SIM114 [*] Combine `if` branches using logical `or` operator 6 4 | 7 5 | if a: # we preserve comments, too! + Run `ruff check --fix` to apply this fix. + SIM114.py:7:1: SIM114 [*] Combine `if` branches using logical `or` operator | 5 | b @@ -38,7 +40,7 @@ SIM114.py:7:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -ℹ Safe fix +Suggested fix: 4 4 | elif c: 5 5 | b 6 6 | @@ -50,6 +52,8 @@ SIM114.py:7:1: SIM114 [*] Combine `if` branches using logical `or` operator 11 9 | 12 10 | if x == 1: + Run `ruff check --fix` to apply this fix. + SIM114.py:12:1: SIM114 [*] Combine `if` branches using logical `or` operator | 10 | b @@ -66,7 +70,7 @@ SIM114.py:12:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -ℹ Safe fix +Suggested fix: 9 9 | elif c: # but not on the second branch 10 10 | b 11 11 | @@ -79,6 +83,8 @@ SIM114.py:12:1: SIM114 [*] Combine `if` branches using logical `or` operator 17 14 | print("hello") 18 15 | + Run `ruff check --fix` to apply this fix. + SIM114.py:19:1: SIM114 [*] Combine `if` branches using logical `or` operator | 17 | print("hello") @@ -97,7 +103,7 @@ SIM114.py:19:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -ℹ Safe fix +Suggested fix: 16 16 | for _ in range(20): 17 17 | print("hello") 18 18 | @@ -111,6 +117,8 @@ SIM114.py:19:1: SIM114 [*] Combine `if` branches using logical `or` operator 25 21 | for _ in range(20): 26 22 | print("hello") + Run `ruff check --fix` to apply this fix. + SIM114.py:28:1: SIM114 [*] Combine `if` branches using logical `or` operator | 26 | print("hello") @@ -135,7 +143,7 @@ SIM114.py:28:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -ℹ Safe fix +Suggested fix: 25 25 | for _ in range(20): 26 26 | print("hello") 27 27 | @@ -152,6 +160,8 @@ SIM114.py:28:1: SIM114 [*] Combine `if` branches using logical `or` operator 37 30 | for _ in range(20): 38 31 | print("hello") + Run `ruff check --fix` to apply this fix. + SIM114.py:29:5: SIM114 [*] Combine `if` branches using logical `or` operator | 28 | if x == 1: @@ -168,7 +178,7 @@ SIM114.py:29:5: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -ℹ Safe fix +Suggested fix: 26 26 | print("hello") 27 27 | 28 28 | if x == 1: @@ -181,6 +191,8 @@ SIM114.py:29:5: SIM114 [*] Combine `if` branches using logical `or` operator 34 31 | print("hello") 35 32 | elif x == 2: + Run `ruff check --fix` to apply this fix. + SIM114.py:36:5: SIM114 [*] Combine `if` branches using logical `or` operator | 34 | print("hello") @@ -198,7 +210,7 @@ SIM114.py:36:5: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -ℹ Safe fix +Suggested fix: 33 33 | for _ in range(20): 34 34 | print("hello") 35 35 | elif x == 2: @@ -211,6 +223,8 @@ SIM114.py:36:5: SIM114 [*] Combine `if` branches using logical `or` operator 41 38 | print("hello") 42 39 | + Run `ruff check --fix` to apply this fix. + SIM114.py:43:1: SIM114 [*] Combine `if` branches using logical `or` operator | 41 | print("hello") @@ -240,7 +254,7 @@ SIM114.py:43:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -ℹ Safe fix +Suggested fix: 55 55 | and i == 12 56 56 | and j == 13 57 57 | and k == 14 @@ -252,6 +266,8 @@ SIM114.py:43:1: SIM114 [*] Combine `if` branches using logical `or` operator 62 60 | 63 61 | if result.eofs == "O": + Run `ruff check --fix` to apply this fix. + SIM114.py:67:1: SIM114 [*] Combine `if` branches using logical `or` operator | 65 | elif result.eofs == "S": @@ -266,7 +282,7 @@ SIM114.py:67:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -ℹ Safe fix +Suggested fix: 64 64 | pass 65 65 | elif result.eofs == "S": 66 66 | skipped = 1 @@ -278,6 +294,8 @@ SIM114.py:67:1: SIM114 [*] Combine `if` branches using logical `or` operator 71 69 | elif result.eofs == "X": 72 70 | errors = 1 + Run `ruff check --fix` to apply this fix. + SIM114.py:69:1: SIM114 [*] Combine `if` branches using logical `or` operator | 67 | elif result.eofs == "F": @@ -292,7 +310,7 @@ SIM114.py:69:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -ℹ Safe fix +Suggested fix: 66 66 | skipped = 1 67 67 | elif result.eofs == "F": 68 68 | errors = 1 @@ -304,6 +322,8 @@ SIM114.py:69:1: SIM114 [*] Combine `if` branches using logical `or` operator 73 71 | elif result.eofs == "C": 74 72 | errors = 1 + Run `ruff check --fix` to apply this fix. + SIM114.py:71:1: SIM114 [*] Combine `if` branches using logical `or` operator | 69 | elif result.eofs == "E": @@ -316,7 +336,7 @@ SIM114.py:71:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -ℹ Safe fix +Suggested fix: 68 68 | errors = 1 69 69 | elif result.eofs == "E": 70 70 | errors = 1 @@ -328,6 +348,8 @@ SIM114.py:71:1: SIM114 [*] Combine `if` branches using logical `or` operator 75 73 | 76 74 | + Run `ruff check --fix` to apply this fix. + SIM114.py:118:5: SIM114 [*] Combine `if` branches using logical `or` operator | 116 | a = True @@ -343,7 +365,7 @@ SIM114.py:118:5: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -ℹ Safe fix +Suggested fix: 115 115 | def func(): 116 116 | a = True 117 117 | b = False @@ -355,6 +377,8 @@ SIM114.py:118:5: SIM114 [*] Combine `if` branches using logical `or` operator 122 120 | elif a < b: # end-of-line 123 121 | return 4 + Run `ruff check --fix` to apply this fix. + SIM114.py:122:5: SIM114 [*] Combine `if` branches using logical `or` operator | 120 | elif a == b: @@ -368,7 +392,7 @@ SIM114.py:122:5: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -ℹ Safe fix +Suggested fix: 119 119 | return 3 120 120 | elif a == b: 121 121 | return 3 @@ -380,6 +404,8 @@ SIM114.py:122:5: SIM114 [*] Combine `if` branches using logical `or` operator 126 124 | 127 125 | + Run `ruff check --fix` to apply this fix. + SIM114.py:132:5: SIM114 [*] Combine `if` branches using logical `or` operator | 130 | a = True @@ -393,7 +419,7 @@ SIM114.py:132:5: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -ℹ Safe fix +Suggested fix: 129 129 | """Ensure that the named expression is parenthesized when merged.""" 130 130 | a = True 131 131 | b = False @@ -405,6 +431,8 @@ SIM114.py:132:5: SIM114 [*] Combine `if` branches using logical `or` operator 136 134 | 137 135 | + Run `ruff check --fix` to apply this fix. + SIM114.py:138:1: SIM114 [*] Combine `if` branches using logical `or` operator | 138 | / if a: # we preserve comments, too! @@ -415,7 +443,7 @@ SIM114.py:138:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -ℹ Safe fix +Suggested fix: 135 135 | return 3 136 136 | 137 137 | @@ -427,6 +455,8 @@ SIM114.py:138:1: SIM114 [*] Combine `if` branches using logical `or` operator 142 140 | 143 141 | + Run `ruff check --fix` to apply this fix. + SIM114.py:144:1: SIM114 [*] Combine `if` branches using logical `or` operator | 144 | / if a: b # here's a comment @@ -435,7 +465,7 @@ SIM114.py:144:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -ℹ Safe fix +Suggested fix: 141 141 | b 142 142 | 143 143 | @@ -446,6 +476,8 @@ SIM114.py:144:1: SIM114 [*] Combine `if` branches using logical `or` operator 147 146 | 148 147 | if(x > 200): pass + Run `ruff check --fix` to apply this fix. + SIM114.py:148:1: SIM114 [*] Combine `if` branches using logical `or` operator | 148 | / if(x > 200): pass @@ -455,7 +487,7 @@ SIM114.py:148:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -ℹ Safe fix +Suggested fix: 145 145 | elif c: b 146 146 | 147 147 | @@ -464,4 +496,4 @@ SIM114.py:148:1: SIM114 [*] Combine `if` branches using logical `or` operator 150 |- pass 148 |+if(x > 200) or (100 < x and x < 200 and 300 < y and y < 800): pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap index 597f19d7fdce8..91e05d165252d 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap @@ -11,7 +11,7 @@ SIM117.py:2:1: SIM117 [*] Use a single `with` statement with multiple contexts i | = help: Combine `with` statements -ℹ Unsafe fix +Suggested fix: 1 1 | # SIM117 2 |-with A() as a: 3 |- with B() as b: @@ -22,6 +22,8 @@ SIM117.py:2:1: SIM117 [*] Use a single `with` statement with multiple contexts i 6 5 | # SIM117 7 6 | with A(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM117.py:7:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 6 | # SIM117 @@ -33,7 +35,7 @@ SIM117.py:7:1: SIM117 [*] Use a single `with` statement with multiple contexts i | = help: Combine `with` statements -ℹ Unsafe fix +Suggested fix: 4 4 | print("hello") 5 5 | 6 6 | # SIM117 @@ -48,6 +50,8 @@ SIM117.py:7:1: SIM117 [*] Use a single `with` statement with multiple contexts i 12 11 | # SIM117 13 12 | with A() as a: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM117.py:13:1: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements | 12 | # SIM117 @@ -70,7 +74,7 @@ SIM117.py:19:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -ℹ Unsafe fix +Suggested fix: 16 16 | print("hello") 17 17 | 18 18 | # SIM117 @@ -85,6 +89,8 @@ SIM117.py:19:1: SIM117 [*] Use a single `with` statement with multiple contexts 24 23 | # OK 25 24 | with A() as a: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM117.py:47:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 46 | # SIM117 @@ -95,7 +101,7 @@ SIM117.py:47:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -ℹ Unsafe fix +Suggested fix: 44 44 | print("hello") 45 45 | 46 46 | # SIM117 @@ -108,6 +114,8 @@ SIM117.py:47:1: SIM117 [*] Use a single `with` statement with multiple contexts 51 50 | while True: 52 51 | # SIM117 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM117.py:53:5: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 51 | while True: @@ -121,7 +129,7 @@ SIM117.py:53:5: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -ℹ Unsafe fix +Suggested fix: 50 50 | 51 51 | while True: 52 52 | # SIM117 @@ -146,6 +154,8 @@ SIM117.py:53:5: SIM117 [*] Use a single `with` statement with multiple contexts 66 65 | 67 66 | # SIM117 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM117.py:68:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 67 | # SIM117 @@ -159,7 +169,7 @@ SIM117.py:68:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -ℹ Unsafe fix +Suggested fix: 67 67 | # SIM117 68 68 | with ( 69 69 | A() as a, @@ -173,6 +183,8 @@ SIM117.py:68:1: SIM117 [*] Use a single `with` statement with multiple contexts 75 74 | # SIM117 76 75 | with A() as a: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM117.py:76:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 75 | # SIM117 @@ -186,7 +198,7 @@ SIM117.py:76:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -ℹ Unsafe fix +Suggested fix: 73 73 | print("hello") 74 74 | 75 75 | # SIM117 @@ -205,6 +217,8 @@ SIM117.py:76:1: SIM117 [*] Use a single `with` statement with multiple contexts 83 82 | # SIM117 84 83 | with ( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM117.py:84:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 83 | # SIM117 @@ -221,7 +235,7 @@ SIM117.py:84:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -ℹ Unsafe fix +Suggested fix: 83 83 | # SIM117 84 84 | with ( 85 85 | A() as a, @@ -239,6 +253,8 @@ SIM117.py:84:1: SIM117 [*] Use a single `with` statement with multiple contexts 94 91 | # SIM117 (auto-fixable) 95 92 | with A("01ß9💣2ℝ8901ß9💣2ℝ8901ß9💣2ℝ89") as a: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM117.py:95:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 94 | # SIM117 (auto-fixable) @@ -249,7 +265,7 @@ SIM117.py:95:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -ℹ Unsafe fix +Suggested fix: 92 92 | print("hello") 93 93 | 94 94 | # SIM117 (auto-fixable) @@ -262,6 +278,8 @@ SIM117.py:95:1: SIM117 [*] Use a single `with` statement with multiple contexts 99 98 | # SIM117 (not auto-fixable too long) 100 99 | with A("01ß9💣2ℝ8901ß9💣2ℝ8901ß9💣2ℝ890") as a: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM117.py:100:1: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements | 99 | # SIM117 (not auto-fixable too long) @@ -294,7 +312,7 @@ SIM117.py:126:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -ℹ Unsafe fix +Suggested fix: 123 123 | f(b2, c2, d2) 124 124 | 125 125 | # SIM117 @@ -320,6 +338,8 @@ SIM117.py:126:1: SIM117 [*] Use a single `with` statement with multiple contexts 138 137 | # Allow cascading for some statements. 139 138 | import anyio + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM117.py:163:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 162 | # Do not suppress combination, if a context manager is already combined with another. @@ -330,7 +350,7 @@ SIM117.py:163:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -ℹ Unsafe fix +Suggested fix: 160 160 | pass 161 161 | 162 162 | # Do not suppress combination, if a context manager is already combined with another. @@ -340,4 +360,4 @@ SIM117.py:163:1: SIM117 [*] Use a single `with` statement with multiple contexts 163 |+async with asyncio.timeout(1), A(), B(): 164 |+ pass - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap index 8acd4d438bc9e..096643745f8cf 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap @@ -12,7 +12,7 @@ SIM118.py:3:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Safe fix +Suggested fix: 1 1 | obj = {} 2 2 | 3 |-key in obj.keys() # SIM118 @@ -21,6 +21,8 @@ SIM118.py:3:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 5 5 | key not in obj.keys() # SIM118 6 6 | + Run `ruff check --fix` to apply this fix. + SIM118.py:5:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` | 3 | key in obj.keys() # SIM118 @@ -32,7 +34,7 @@ SIM118.py:5:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys | = help: Remove `.keys()` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | key in obj.keys() # SIM118 4 4 | @@ -42,6 +44,8 @@ SIM118.py:5:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys 7 7 | foo["bar"] in obj.keys() # SIM118 8 8 | + Run `ruff check --fix` to apply this fix. + SIM118.py:7:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 5 | key not in obj.keys() # SIM118 @@ -53,7 +57,7 @@ SIM118.py:7:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | key not in obj.keys() # SIM118 6 6 | @@ -63,6 +67,8 @@ SIM118.py:7:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 9 9 | foo["bar"] not in obj.keys() # SIM118 10 10 | + Run `ruff check --fix` to apply this fix. + SIM118.py:9:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` | 7 | foo["bar"] in obj.keys() # SIM118 @@ -74,7 +80,7 @@ SIM118.py:9:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys | = help: Remove `.keys()` -ℹ Safe fix +Suggested fix: 6 6 | 7 7 | foo["bar"] in obj.keys() # SIM118 8 8 | @@ -84,6 +90,8 @@ SIM118.py:9:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys 11 11 | foo['bar'] in obj.keys() # SIM118 12 12 | + Run `ruff check --fix` to apply this fix. + SIM118.py:11:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 9 | foo["bar"] not in obj.keys() # SIM118 @@ -95,7 +103,7 @@ SIM118.py:11:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Safe fix +Suggested fix: 8 8 | 9 9 | foo["bar"] not in obj.keys() # SIM118 10 10 | @@ -105,6 +113,8 @@ SIM118.py:11:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 13 13 | foo['bar'] not in obj.keys() # SIM118 14 14 | + Run `ruff check --fix` to apply this fix. + SIM118.py:13:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` | 11 | foo['bar'] in obj.keys() # SIM118 @@ -116,7 +126,7 @@ SIM118.py:13:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.key | = help: Remove `.keys()` -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | foo['bar'] in obj.keys() # SIM118 12 12 | @@ -126,6 +136,8 @@ SIM118.py:13:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.key 15 15 | foo() in obj.keys() # SIM118 16 16 | + Run `ruff check --fix` to apply this fix. + SIM118.py:15:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 13 | foo['bar'] not in obj.keys() # SIM118 @@ -137,7 +149,7 @@ SIM118.py:15:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Safe fix +Suggested fix: 12 12 | 13 13 | foo['bar'] not in obj.keys() # SIM118 14 14 | @@ -147,6 +159,8 @@ SIM118.py:15:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 17 17 | foo() not in obj.keys() # SIM118 18 18 | + Run `ruff check --fix` to apply this fix. + SIM118.py:17:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` | 15 | foo() in obj.keys() # SIM118 @@ -158,7 +172,7 @@ SIM118.py:17:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.key | = help: Remove `.keys()` -ℹ Safe fix +Suggested fix: 14 14 | 15 15 | foo() in obj.keys() # SIM118 16 16 | @@ -168,6 +182,8 @@ SIM118.py:17:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.key 19 19 | for key in obj.keys(): # SIM118 20 20 | pass + Run `ruff check --fix` to apply this fix. + SIM118.py:19:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 17 | foo() not in obj.keys() # SIM118 @@ -178,7 +194,7 @@ SIM118.py:19:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Safe fix +Suggested fix: 16 16 | 17 17 | foo() not in obj.keys() # SIM118 18 18 | @@ -188,6 +204,8 @@ SIM118.py:19:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 21 21 | 22 22 | for key in list(obj.keys()): + Run `ruff check --fix` to apply this fix. + SIM118.py:26:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 24 | del obj[key] @@ -199,7 +217,7 @@ SIM118.py:26:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Safe fix +Suggested fix: 23 23 | if some_property(key): 24 24 | del obj[key] 25 25 | @@ -209,6 +227,8 @@ SIM118.py:26:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 28 28 | {k for k in obj.keys()} # SIM118 29 29 | + Run `ruff check --fix` to apply this fix. + SIM118.py:28:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 26 | [k for k in obj.keys()] # SIM118 @@ -220,7 +240,7 @@ SIM118.py:28:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Safe fix +Suggested fix: 25 25 | 26 26 | [k for k in obj.keys()] # SIM118 27 27 | @@ -230,6 +250,8 @@ SIM118.py:28:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 30 30 | {k: k for k in obj.keys()} # SIM118 31 31 | + Run `ruff check --fix` to apply this fix. + SIM118.py:30:11: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 28 | {k for k in obj.keys()} # SIM118 @@ -241,7 +263,7 @@ SIM118.py:30:11: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Safe fix +Suggested fix: 27 27 | 28 28 | {k for k in obj.keys()} # SIM118 29 29 | @@ -251,6 +273,8 @@ SIM118.py:30:11: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 32 32 | (k for k in obj.keys()) # SIM118 33 33 | + Run `ruff check --fix` to apply this fix. + SIM118.py:32:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 30 | {k: k for k in obj.keys()} # SIM118 @@ -262,7 +286,7 @@ SIM118.py:32:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Safe fix +Suggested fix: 29 29 | 30 30 | {k: k for k in obj.keys()} # SIM118 31 31 | @@ -272,6 +296,8 @@ SIM118.py:32:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 34 34 | key in (obj or {}).keys() # SIM118 35 35 | + Run `ruff check --fix` to apply this fix. + SIM118.py:34:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 32 | (k for k in obj.keys()) # SIM118 @@ -283,7 +309,7 @@ SIM118.py:34:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Unsafe fix +Suggested fix: 31 31 | 32 32 | (k for k in obj.keys()) # SIM118 33 33 | @@ -293,6 +319,8 @@ SIM118.py:34:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 36 36 | (key) in (obj or {}).keys() # SIM118 37 37 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM118.py:36:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 34 | key in (obj or {}).keys() # SIM118 @@ -304,7 +332,7 @@ SIM118.py:36:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Unsafe fix +Suggested fix: 33 33 | 34 34 | key in (obj or {}).keys() # SIM118 35 35 | @@ -314,6 +342,8 @@ SIM118.py:36:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 38 38 | from typing import KeysView 39 39 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM118.py:50:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 49 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124 @@ -324,7 +354,7 @@ SIM118.py:50:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Safe fix +Suggested fix: 47 47 | 48 48 | 49 49 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124 @@ -334,6 +364,8 @@ SIM118.py:50:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 52 52 | key in (obj.keys())and foo 53 53 | + Run `ruff check --fix` to apply this fix. + SIM118.py:51:2: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 49 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124 @@ -344,7 +376,7 @@ SIM118.py:51:2: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Safe fix +Suggested fix: 48 48 | 49 49 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124 50 50 | key in obj.keys()and foo @@ -354,6 +386,8 @@ SIM118.py:51:2: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 53 53 | 54 54 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200 + Run `ruff check --fix` to apply this fix. + SIM118.py:52:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 50 | key in obj.keys()and foo @@ -365,7 +399,7 @@ SIM118.py:52:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Safe fix +Suggested fix: 49 49 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124 50 50 | key in obj.keys()and foo 51 51 | (key in obj.keys())and foo @@ -375,6 +409,8 @@ SIM118.py:52:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 54 54 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200 55 55 | for key in ( + Run `ruff check --fix` to apply this fix. + SIM118.py:55:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 54 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200 @@ -389,7 +425,7 @@ SIM118.py:55:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Unsafe fix +Suggested fix: 55 55 | for key in ( 56 56 | self.experiment.surveys[0] 57 57 | .stations[0] @@ -399,6 +435,8 @@ SIM118.py:55:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 60 60 | continue 61 61 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM118.py:65:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 64 | d = SneakyDict() @@ -407,9 +445,11 @@ SIM118.py:65:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Safe fix +Suggested fix: 62 62 | from builtins import dict as SneakyDict 63 63 | 64 64 | d = SneakyDict() 65 |-key in d.keys() # SIM118 65 |+key in d # SIM118 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM201_SIM201.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM201_SIM201.py.snap index 7bc978ae96e5a..9bf00cdfd3d71 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM201_SIM201.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM201_SIM201.py.snap @@ -10,7 +10,7 @@ SIM201.py:2:4: SIM201 [*] Use `a != b` instead of `not a == b` | = help: Replace with `!=` operator -ℹ Safe fix +Suggested fix: 1 1 | # SIM201 2 |-if not a == b: 2 |+if a != b: @@ -18,6 +18,8 @@ SIM201.py:2:4: SIM201 [*] Use `a != b` instead of `not a == b` 4 4 | 5 5 | # SIM201 + Run `ruff check --fix` to apply this fix. + SIM201.py:6:4: SIM201 [*] Use `a != b + c` instead of `not a == b + c` | 5 | # SIM201 @@ -27,7 +29,7 @@ SIM201.py:6:4: SIM201 [*] Use `a != b + c` instead of `not a == b + c` | = help: Replace with `!=` operator -ℹ Safe fix +Suggested fix: 3 3 | pass 4 4 | 5 5 | # SIM201 @@ -37,6 +39,8 @@ SIM201.py:6:4: SIM201 [*] Use `a != b + c` instead of `not a == b + c` 8 8 | 9 9 | # SIM201 + Run `ruff check --fix` to apply this fix. + SIM201.py:10:4: SIM201 [*] Use `a + b != c` instead of `not a + b == c` | 9 | # SIM201 @@ -46,7 +50,7 @@ SIM201.py:10:4: SIM201 [*] Use `a + b != c` instead of `not a + b == c` | = help: Replace with `!=` operator -ℹ Safe fix +Suggested fix: 7 7 | pass 8 8 | 9 9 | # SIM201 @@ -56,4 +60,4 @@ SIM201.py:10:4: SIM201 [*] Use `a + b != c` instead of `not a + b == c` 12 12 | 13 13 | # OK - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap index 46e9c368fa1b0..e38fefe496ded 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap @@ -10,7 +10,7 @@ SIM202.py:2:4: SIM202 [*] Use `a == b` instead of `not a != b` | = help: Replace with `==` operator -ℹ Safe fix +Suggested fix: 1 1 | # SIM202 2 |-if not a != b: 2 |+if a == b: @@ -18,6 +18,8 @@ SIM202.py:2:4: SIM202 [*] Use `a == b` instead of `not a != b` 4 4 | 5 5 | # SIM202 + Run `ruff check --fix` to apply this fix. + SIM202.py:6:4: SIM202 [*] Use `a == b + c` instead of `not a != b + c` | 5 | # SIM202 @@ -27,7 +29,7 @@ SIM202.py:6:4: SIM202 [*] Use `a == b + c` instead of `not a != b + c` | = help: Replace with `==` operator -ℹ Safe fix +Suggested fix: 3 3 | pass 4 4 | 5 5 | # SIM202 @@ -37,6 +39,8 @@ SIM202.py:6:4: SIM202 [*] Use `a == b + c` instead of `not a != b + c` 8 8 | 9 9 | # SIM202 + Run `ruff check --fix` to apply this fix. + SIM202.py:10:4: SIM202 [*] Use `a + b == c` instead of `not a + b != c` | 9 | # SIM202 @@ -46,7 +50,7 @@ SIM202.py:10:4: SIM202 [*] Use `a + b == c` instead of `not a + b != c` | = help: Replace with `==` operator -ℹ Safe fix +Suggested fix: 7 7 | pass 8 8 | 9 9 | # SIM202 @@ -56,4 +60,4 @@ SIM202.py:10:4: SIM202 [*] Use `a + b == c` instead of `not a + b != c` 12 12 | 13 13 | # OK - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap index fa96fedd5098c..8dcd4b24d3d83 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap @@ -9,13 +9,15 @@ SIM208.py:1:4: SIM208 [*] Use `a` instead of `not (not a)` | = help: Replace with `a` -ℹ Safe fix +Suggested fix: 1 |-if not (not a): # SIM208 1 |+if a: # SIM208 2 2 | pass 3 3 | 4 4 | if not (not (a == b)): # SIM208 + Run `ruff check --fix` to apply this fix. + SIM208.py:4:4: SIM208 [*] Use `a == b` instead of `not (not a == b)` | 2 | pass @@ -26,7 +28,7 @@ SIM208.py:4:4: SIM208 [*] Use `a == b` instead of `not (not a == b)` | = help: Replace with `a == b` -ℹ Safe fix +Suggested fix: 1 1 | if not (not a): # SIM208 2 2 | pass 3 3 | @@ -36,6 +38,8 @@ SIM208.py:4:4: SIM208 [*] Use `a == b` instead of `not (not a == b)` 6 6 | 7 7 | if not a: # OK + Run `ruff check --fix` to apply this fix. + SIM208.py:16:5: SIM208 [*] Use `b` instead of `not (not b)` | 14 | pass @@ -47,7 +51,7 @@ SIM208.py:16:5: SIM208 [*] Use `b` instead of `not (not b)` | = help: Replace with `b` -ℹ Safe fix +Suggested fix: 13 13 | if not a != b: # OK 14 14 | pass 15 15 | @@ -57,6 +61,8 @@ SIM208.py:16:5: SIM208 [*] Use `b` instead of `not (not b)` 18 18 | f(not not a) # SIM208 19 19 | + Run `ruff check --fix` to apply this fix. + SIM208.py:18:3: SIM208 [*] Use `a` instead of `not (not a)` | 16 | a = not not b # SIM208 @@ -68,7 +74,7 @@ SIM208.py:18:3: SIM208 [*] Use `a` instead of `not (not a)` | = help: Replace with `a` -ℹ Safe fix +Suggested fix: 15 15 | 16 16 | a = not not b # SIM208 17 17 | @@ -78,6 +84,8 @@ SIM208.py:18:3: SIM208 [*] Use `a` instead of `not (not a)` 20 20 | if 1 + (not (not a)): # SIM208 21 21 | pass + Run `ruff check --fix` to apply this fix. + SIM208.py:20:9: SIM208 [*] Use `a` instead of `not (not a)` | 18 | f(not not a) # SIM208 @@ -88,7 +96,7 @@ SIM208.py:20:9: SIM208 [*] Use `a` instead of `not (not a)` | = help: Replace with `a` -ℹ Safe fix +Suggested fix: 17 17 | 18 18 | f(not not a) # SIM208 19 19 | @@ -96,4 +104,4 @@ SIM208.py:20:9: SIM208 [*] Use `a` instead of `not (not a)` 20 |+if 1 + (bool(a)): # SIM208 21 21 | pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap index 50c7b4ebe93d1..87c06bea3cc44 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap @@ -10,13 +10,15 @@ SIM210.py:1:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` | = help: Replace with `bool(...) -ℹ Unsafe fix +Suggested fix: 1 |-a = True if b else False # SIM210 1 |+a = bool(b) # SIM210 2 2 | 3 3 | a = True if b != c else False # SIM210 4 4 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM210.py:3:5: SIM210 [*] Remove unnecessary `True if ... else False` | 1 | a = True if b else False # SIM210 @@ -28,7 +30,7 @@ SIM210.py:3:5: SIM210 [*] Remove unnecessary `True if ... else False` | = help: Remove unnecessary `True if ... else False` -ℹ Unsafe fix +Suggested fix: 1 1 | a = True if b else False # SIM210 2 2 | 3 |-a = True if b != c else False # SIM210 @@ -37,6 +39,8 @@ SIM210.py:3:5: SIM210 [*] Remove unnecessary `True if ... else False` 5 5 | a = True if b + c else False # SIM210 6 6 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM210.py:5:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` | 3 | a = True if b != c else False # SIM210 @@ -48,7 +52,7 @@ SIM210.py:5:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` | = help: Replace with `bool(...) -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | a = True if b != c else False # SIM210 4 4 | @@ -58,6 +62,8 @@ SIM210.py:5:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` 7 7 | a = False if b else True # OK 8 8 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM210.py:15:9: SIM210 Use `bool(...)` instead of `True if ... else False` | 13 | return False @@ -77,7 +83,7 @@ SIM210.py:19:11: SIM210 [*] Remove unnecessary `True if ... else False` | = help: Remove unnecessary `True if ... else False` -ℹ Unsafe fix +Suggested fix: 16 16 | 17 17 | 18 18 | # Regression test for: https://github.com/astral-sh/ruff/issues/7076 @@ -86,4 +92,4 @@ SIM210.py:19:11: SIM210 [*] Remove unnecessary `True if ... else False` 19 |+samesld = (psl.privatesuffix(urlparse(response.url).netloc) == 20 |+ psl.privatesuffix(src.netloc)) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap index 8e3650b7e5723..35306b1ea3a5d 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap @@ -10,13 +10,15 @@ SIM211.py:1:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | = help: Replace with `not ...` -ℹ Unsafe fix +Suggested fix: 1 |-a = False if b else True # SIM211 1 |+a = not b # SIM211 2 2 | 3 3 | a = False if b != c else True # SIM211 4 4 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM211.py:3:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | 1 | a = False if b else True # SIM211 @@ -28,7 +30,7 @@ SIM211.py:3:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | = help: Replace with `not ...` -ℹ Unsafe fix +Suggested fix: 1 1 | a = False if b else True # SIM211 2 2 | 3 |-a = False if b != c else True # SIM211 @@ -37,6 +39,8 @@ SIM211.py:3:5: SIM211 [*] Use `not ...` instead of `False if ... else True` 5 5 | a = False if b + c else True # SIM211 6 6 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM211.py:5:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | 3 | a = False if b != c else True # SIM211 @@ -48,7 +52,7 @@ SIM211.py:5:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | = help: Replace with `not ...` -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | a = False if b != c else True # SIM211 4 4 | @@ -57,4 +61,4 @@ SIM211.py:5:5: SIM211 [*] Use `not ...` instead of `False if ... else True` 6 6 | 7 7 | a = True if b else False # OK - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap index 35b8bc12a55e4..73c3e98277931 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap @@ -10,13 +10,15 @@ SIM212.py:1:5: SIM212 [*] Use `a if a else b` instead of `b if not a else a` | = help: Replace with `a if a else b` -ℹ Unsafe fix +Suggested fix: 1 |-c = b if not a else a # SIM212 1 |+c = a if a else b # SIM212 2 2 | 3 3 | c = b + c if not a else a # SIM212 4 4 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM212.py:3:5: SIM212 [*] Use `a if a else b + c` instead of `b + c if not a else a` | 1 | c = b if not a else a # SIM212 @@ -28,7 +30,7 @@ SIM212.py:3:5: SIM212 [*] Use `a if a else b + c` instead of `b + c if not a els | = help: Replace with `a if a else b + c` -ℹ Unsafe fix +Suggested fix: 1 1 | c = b if not a else a # SIM212 2 2 | 3 |-c = b + c if not a else a # SIM212 @@ -37,4 +39,4 @@ SIM212.py:3:5: SIM212 [*] Use `a if a else b + c` instead of `b + c if not a els 5 5 | c = b if not x else a # OK 6 6 | - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap index b0c23c954c721..d51da47aa76a1 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap @@ -9,13 +9,15 @@ SIM220.py:1:4: SIM220 [*] Use `False` instead of `a and not a` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 1 |-if a and not a: 1 |+if False: 2 2 | pass 3 3 | 4 4 | if (a and not a) and b: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM220.py:4:5: SIM220 [*] Use `False` instead of `a and not a` | 2 | pass @@ -26,7 +28,7 @@ SIM220.py:4:5: SIM220 [*] Use `False` instead of `a and not a` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 1 1 | if a and not a: 2 2 | pass 3 3 | @@ -36,6 +38,8 @@ SIM220.py:4:5: SIM220 [*] Use `False` instead of `a and not a` 6 6 | 7 7 | if (a and not a) or b: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM220.py:7:5: SIM220 [*] Use `False` instead of `a and not a` | 5 | pass @@ -46,7 +50,7 @@ SIM220.py:7:5: SIM220 [*] Use `False` instead of `a and not a` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 4 4 | if (a and not a) and b: 5 5 | pass 6 6 | @@ -56,4 +60,4 @@ SIM220.py:7:5: SIM220 [*] Use `False` instead of `a and not a` 9 9 | 10 10 | if a: - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap index 038e5fcf64a24..99bf61000d5d3 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap @@ -9,13 +9,15 @@ SIM221.py:1:4: SIM221 [*] Use `True` instead of `a or not a` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 1 |-if a or not a: 1 |+if True: 2 2 | pass 3 3 | 4 4 | if (a or not a) or b: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM221.py:4:5: SIM221 [*] Use `True` instead of `a or not a` | 2 | pass @@ -26,7 +28,7 @@ SIM221.py:4:5: SIM221 [*] Use `True` instead of `a or not a` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 1 1 | if a or not a: 2 2 | pass 3 3 | @@ -36,6 +38,8 @@ SIM221.py:4:5: SIM221 [*] Use `True` instead of `a or not a` 6 6 | 7 7 | if (a or not a) and b: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM221.py:7:5: SIM221 [*] Use `True` instead of `a or not a` | 5 | pass @@ -46,7 +50,7 @@ SIM221.py:7:5: SIM221 [*] Use `True` instead of `a or not a` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 4 4 | if (a or not a) or b: 5 5 | pass 6 6 | @@ -56,4 +60,4 @@ SIM221.py:7:5: SIM221 [*] Use `True` instead of `a or not a` 9 9 | 10 10 | if a: - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap index ddf4598e13b59..aa314e68a2360 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap @@ -9,13 +9,15 @@ SIM222.py:1:4: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 1 |-if a or True: # SIM222 1 |+if True: # SIM222 2 2 | pass 3 3 | 4 4 | if (a or b) or True: # SIM222 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:4:4: SIM222 [*] Use `True` instead of `... or True` | 2 | pass @@ -26,7 +28,7 @@ SIM222.py:4:4: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 1 1 | if a or True: # SIM222 2 2 | pass 3 3 | @@ -36,6 +38,8 @@ SIM222.py:4:4: SIM222 [*] Use `True` instead of `... or True` 6 6 | 7 7 | if a or (b or True): # SIM222 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:7:10: SIM222 [*] Use `True` instead of `... or True` | 5 | pass @@ -46,7 +50,7 @@ SIM222.py:7:10: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 4 4 | if (a or b) or True: # SIM222 5 5 | pass 6 6 | @@ -56,6 +60,8 @@ SIM222.py:7:10: SIM222 [*] Use `True` instead of `... or True` 9 9 | 10 10 | if a and True: # OK + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:24:16: SIM222 [*] Use `True` instead of `True or ...` | 22 | pass @@ -66,7 +72,7 @@ SIM222.py:24:16: SIM222 [*] Use `True` instead of `True or ...` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 21 21 | if a or f() or b or g() or True: # OK 22 22 | pass 23 23 | @@ -76,6 +82,8 @@ SIM222.py:24:16: SIM222 [*] Use `True` instead of `True or ...` 26 26 | 27 27 | if True or f() or a or g() or b: # SIM222 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:27:4: SIM222 [*] Use `True` instead of `True or ...` | 25 | pass @@ -86,7 +94,7 @@ SIM222.py:27:4: SIM222 [*] Use `True` instead of `True or ...` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 24 24 | if a or f() or True or g() or b: # SIM222 25 25 | pass 26 26 | @@ -96,6 +104,8 @@ SIM222.py:27:4: SIM222 [*] Use `True` instead of `True or ...` 29 29 | 30 30 | if a or True or f() or b or g(): # SIM222 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:30:4: SIM222 [*] Use `True` instead of `... or True or ...` | 28 | pass @@ -106,7 +116,7 @@ SIM222.py:30:4: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 27 27 | if True or f() or a or g() or b: # SIM222 28 28 | pass 29 29 | @@ -116,6 +126,8 @@ SIM222.py:30:4: SIM222 [*] Use `True` instead of `... or True or ...` 32 32 | 33 33 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:47:6: SIM222 [*] Use `True` instead of `... or True` | 47 | a or "" or True # SIM222 @@ -125,7 +137,7 @@ SIM222.py:47:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 44 44 | pass 45 45 | 46 46 | @@ -135,6 +147,8 @@ SIM222.py:47:6: SIM222 [*] Use `True` instead of `... or True` 49 49 | a or "foo" or True or "bar" # SIM222 50 50 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:49:6: SIM222 [*] Use `"foo"` instead of `"foo" or ...` | 47 | a or "" or True # SIM222 @@ -146,7 +160,7 @@ SIM222.py:49:6: SIM222 [*] Use `"foo"` instead of `"foo" or ...` | = help: Replace with `"foo"` -ℹ Unsafe fix +Suggested fix: 46 46 | 47 47 | a or "" or True # SIM222 48 48 | @@ -156,6 +170,8 @@ SIM222.py:49:6: SIM222 [*] Use `"foo"` instead of `"foo" or ...` 51 51 | a or 0 or True # SIM222 52 52 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:51:6: SIM222 [*] Use `True` instead of `... or True` | 49 | a or "foo" or True or "bar" # SIM222 @@ -167,7 +183,7 @@ SIM222.py:51:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 48 48 | 49 49 | a or "foo" or True or "bar" # SIM222 50 50 | @@ -177,6 +193,8 @@ SIM222.py:51:6: SIM222 [*] Use `True` instead of `... or True` 53 53 | a or 1 or True or 2 # SIM222 54 54 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:53:6: SIM222 [*] Use `1` instead of `1 or ...` | 51 | a or 0 or True # SIM222 @@ -188,7 +206,7 @@ SIM222.py:53:6: SIM222 [*] Use `1` instead of `1 or ...` | = help: Replace with `1` -ℹ Unsafe fix +Suggested fix: 50 50 | 51 51 | a or 0 or True # SIM222 52 52 | @@ -198,6 +216,8 @@ SIM222.py:53:6: SIM222 [*] Use `1` instead of `1 or ...` 55 55 | a or 0.0 or True # SIM222 56 56 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:55:6: SIM222 [*] Use `True` instead of `... or True` | 53 | a or 1 or True or 2 # SIM222 @@ -209,7 +229,7 @@ SIM222.py:55:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 52 52 | 53 53 | a or 1 or True or 2 # SIM222 54 54 | @@ -219,6 +239,8 @@ SIM222.py:55:6: SIM222 [*] Use `True` instead of `... or True` 57 57 | a or 0.1 or True or 0.2 # SIM222 58 58 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:57:6: SIM222 [*] Use `0.1` instead of `0.1 or ...` | 55 | a or 0.0 or True # SIM222 @@ -230,7 +252,7 @@ SIM222.py:57:6: SIM222 [*] Use `0.1` instead of `0.1 or ...` | = help: Replace with `0.1` -ℹ Unsafe fix +Suggested fix: 54 54 | 55 55 | a or 0.0 or True # SIM222 56 56 | @@ -240,6 +262,8 @@ SIM222.py:57:6: SIM222 [*] Use `0.1` instead of `0.1 or ...` 59 59 | a or [] or True # SIM222 60 60 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:59:6: SIM222 [*] Use `True` instead of `... or True` | 57 | a or 0.1 or True or 0.2 # SIM222 @@ -251,7 +275,7 @@ SIM222.py:59:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 56 56 | 57 57 | a or 0.1 or True or 0.2 # SIM222 58 58 | @@ -261,6 +285,8 @@ SIM222.py:59:6: SIM222 [*] Use `True` instead of `... or True` 61 61 | a or list([]) or True # SIM222 62 62 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:61:6: SIM222 [*] Use `True` instead of `... or True` | 59 | a or [] or True # SIM222 @@ -272,7 +298,7 @@ SIM222.py:61:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 58 58 | 59 59 | a or [] or True # SIM222 60 60 | @@ -282,6 +308,8 @@ SIM222.py:61:6: SIM222 [*] Use `True` instead of `... or True` 63 63 | a or [1] or True or [2] # SIM222 64 64 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:63:6: SIM222 [*] Use `[1]` instead of `[1] or ...` | 61 | a or list([]) or True # SIM222 @@ -293,7 +321,7 @@ SIM222.py:63:6: SIM222 [*] Use `[1]` instead of `[1] or ...` | = help: Replace with `[1]` -ℹ Unsafe fix +Suggested fix: 60 60 | 61 61 | a or list([]) or True # SIM222 62 62 | @@ -303,6 +331,8 @@ SIM222.py:63:6: SIM222 [*] Use `[1]` instead of `[1] or ...` 65 65 | a or list([1]) or True or list([2]) # SIM222 66 66 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:65:6: SIM222 [*] Use `list([1])` instead of `list([1]) or ...` | 63 | a or [1] or True or [2] # SIM222 @@ -314,7 +344,7 @@ SIM222.py:65:6: SIM222 [*] Use `list([1])` instead of `list([1]) or ...` | = help: Replace with `list([1])` -ℹ Unsafe fix +Suggested fix: 62 62 | 63 63 | a or [1] or True or [2] # SIM222 64 64 | @@ -324,6 +354,8 @@ SIM222.py:65:6: SIM222 [*] Use `list([1])` instead of `list([1]) or ...` 67 67 | a or {} or True # SIM222 68 68 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:67:6: SIM222 [*] Use `True` instead of `... or True` | 65 | a or list([1]) or True or list([2]) # SIM222 @@ -335,7 +367,7 @@ SIM222.py:67:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 64 64 | 65 65 | a or list([1]) or True or list([2]) # SIM222 66 66 | @@ -345,6 +377,8 @@ SIM222.py:67:6: SIM222 [*] Use `True` instead of `... or True` 69 69 | a or dict() or True # SIM222 70 70 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:69:6: SIM222 [*] Use `True` instead of `... or True` | 67 | a or {} or True # SIM222 @@ -356,7 +390,7 @@ SIM222.py:69:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 66 66 | 67 67 | a or {} or True # SIM222 68 68 | @@ -366,6 +400,8 @@ SIM222.py:69:6: SIM222 [*] Use `True` instead of `... or True` 71 71 | a or {1: 1} or True or {2: 2} # SIM222 72 72 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:71:6: SIM222 [*] Use `{1: 1}` instead of `{1: 1} or ...` | 69 | a or dict() or True # SIM222 @@ -377,7 +413,7 @@ SIM222.py:71:6: SIM222 [*] Use `{1: 1}` instead of `{1: 1} or ...` | = help: Replace with `{1: 1}` -ℹ Unsafe fix +Suggested fix: 68 68 | 69 69 | a or dict() or True # SIM222 70 70 | @@ -387,6 +423,8 @@ SIM222.py:71:6: SIM222 [*] Use `{1: 1}` instead of `{1: 1} or ...` 73 73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222 74 74 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:73:6: SIM222 [*] Use `dict({1: 1})` instead of `dict({1: 1}) or ...` | 71 | a or {1: 1} or True or {2: 2} # SIM222 @@ -398,7 +436,7 @@ SIM222.py:73:6: SIM222 [*] Use `dict({1: 1})` instead of `dict({1: 1}) or ...` | = help: Replace with `dict({1: 1})` -ℹ Unsafe fix +Suggested fix: 70 70 | 71 71 | a or {1: 1} or True or {2: 2} # SIM222 72 72 | @@ -408,6 +446,8 @@ SIM222.py:73:6: SIM222 [*] Use `dict({1: 1})` instead of `dict({1: 1}) or ...` 75 75 | a or set() or True # SIM222 76 76 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:75:6: SIM222 [*] Use `True` instead of `... or True` | 73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222 @@ -419,7 +459,7 @@ SIM222.py:75:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 72 72 | 73 73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222 74 74 | @@ -429,6 +469,8 @@ SIM222.py:75:6: SIM222 [*] Use `True` instead of `... or True` 77 77 | a or set(set()) or True # SIM222 78 78 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:77:6: SIM222 [*] Use `True` instead of `... or True` | 75 | a or set() or True # SIM222 @@ -440,7 +482,7 @@ SIM222.py:77:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 74 74 | 75 75 | a or set() or True # SIM222 76 76 | @@ -450,6 +492,8 @@ SIM222.py:77:6: SIM222 [*] Use `True` instead of `... or True` 79 79 | a or {1} or True or {2} # SIM222 80 80 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:79:6: SIM222 [*] Use `{1}` instead of `{1} or ...` | 77 | a or set(set()) or True # SIM222 @@ -461,7 +505,7 @@ SIM222.py:79:6: SIM222 [*] Use `{1}` instead of `{1} or ...` | = help: Replace with `{1}` -ℹ Unsafe fix +Suggested fix: 76 76 | 77 77 | a or set(set()) or True # SIM222 78 78 | @@ -471,6 +515,8 @@ SIM222.py:79:6: SIM222 [*] Use `{1}` instead of `{1} or ...` 81 81 | a or set({1}) or True or set({2}) # SIM222 82 82 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:81:6: SIM222 [*] Use `set({1})` instead of `set({1}) or ...` | 79 | a or {1} or True or {2} # SIM222 @@ -482,7 +528,7 @@ SIM222.py:81:6: SIM222 [*] Use `set({1})` instead of `set({1}) or ...` | = help: Replace with `set({1})` -ℹ Unsafe fix +Suggested fix: 78 78 | 79 79 | a or {1} or True or {2} # SIM222 80 80 | @@ -492,6 +538,8 @@ SIM222.py:81:6: SIM222 [*] Use `set({1})` instead of `set({1}) or ...` 83 83 | a or () or True # SIM222 84 84 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:83:6: SIM222 [*] Use `True` instead of `... or True` | 81 | a or set({1}) or True or set({2}) # SIM222 @@ -503,7 +551,7 @@ SIM222.py:83:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 80 80 | 81 81 | a or set({1}) or True or set({2}) # SIM222 82 82 | @@ -513,6 +561,8 @@ SIM222.py:83:6: SIM222 [*] Use `True` instead of `... or True` 85 85 | a or tuple(()) or True # SIM222 86 86 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:85:6: SIM222 [*] Use `True` instead of `... or True` | 83 | a or () or True # SIM222 @@ -524,7 +574,7 @@ SIM222.py:85:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 82 82 | 83 83 | a or () or True # SIM222 84 84 | @@ -534,6 +584,8 @@ SIM222.py:85:6: SIM222 [*] Use `True` instead of `... or True` 87 87 | a or (1,) or True or (2,) # SIM222 88 88 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:87:6: SIM222 [*] Use `(1,)` instead of `(1,) or ...` | 85 | a or tuple(()) or True # SIM222 @@ -545,7 +597,7 @@ SIM222.py:87:6: SIM222 [*] Use `(1,)` instead of `(1,) or ...` | = help: Replace with `(1,)` -ℹ Unsafe fix +Suggested fix: 84 84 | 85 85 | a or tuple(()) or True # SIM222 86 86 | @@ -555,6 +607,8 @@ SIM222.py:87:6: SIM222 [*] Use `(1,)` instead of `(1,) or ...` 89 89 | a or tuple((1,)) or True or tuple((2,)) # SIM222 90 90 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:89:6: SIM222 [*] Use `tuple((1,))` instead of `tuple((1,)) or ...` | 87 | a or (1,) or True or (2,) # SIM222 @@ -566,7 +620,7 @@ SIM222.py:89:6: SIM222 [*] Use `tuple((1,))` instead of `tuple((1,)) or ...` | = help: Replace with `tuple((1,))` -ℹ Unsafe fix +Suggested fix: 86 86 | 87 87 | a or (1,) or True or (2,) # SIM222 88 88 | @@ -576,6 +630,8 @@ SIM222.py:89:6: SIM222 [*] Use `tuple((1,))` instead of `tuple((1,)) or ...` 91 91 | a or frozenset() or True # SIM222 92 92 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:91:6: SIM222 [*] Use `True` instead of `... or True` | 89 | a or tuple((1,)) or True or tuple((2,)) # SIM222 @@ -587,7 +643,7 @@ SIM222.py:91:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 88 88 | 89 89 | a or tuple((1,)) or True or tuple((2,)) # SIM222 90 90 | @@ -597,6 +653,8 @@ SIM222.py:91:6: SIM222 [*] Use `True` instead of `... or True` 93 93 | a or frozenset(frozenset()) or True # SIM222 94 94 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:93:6: SIM222 [*] Use `True` instead of `... or True` | 91 | a or frozenset() or True # SIM222 @@ -608,7 +666,7 @@ SIM222.py:93:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 90 90 | 91 91 | a or frozenset() or True # SIM222 92 92 | @@ -618,6 +676,8 @@ SIM222.py:93:6: SIM222 [*] Use `True` instead of `... or True` 95 95 | a or frozenset({1}) or True or frozenset({2}) # SIM222 96 96 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:95:6: SIM222 [*] Use `frozenset({1})` instead of `frozenset({1}) or ...` | 93 | a or frozenset(frozenset()) or True # SIM222 @@ -629,7 +689,7 @@ SIM222.py:95:6: SIM222 [*] Use `frozenset({1})` instead of `frozenset({1}) or .. | = help: Replace with `frozenset({1})` -ℹ Unsafe fix +Suggested fix: 92 92 | 93 93 | a or frozenset(frozenset()) or True # SIM222 94 94 | @@ -639,6 +699,8 @@ SIM222.py:95:6: SIM222 [*] Use `frozenset({1})` instead of `frozenset({1}) or .. 97 97 | a or frozenset(frozenset({1})) or True or frozenset(frozenset({2})) # SIM222 98 98 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:97:6: SIM222 [*] Use `frozenset(frozenset({1}))` instead of `frozenset(frozenset({1})) or ...` | 95 | a or frozenset({1}) or True or frozenset({2}) # SIM222 @@ -648,7 +710,7 @@ SIM222.py:97:6: SIM222 [*] Use `frozenset(frozenset({1}))` instead of `frozenset | = help: Replace with `frozenset(frozenset({1}))` -ℹ Unsafe fix +Suggested fix: 94 94 | 95 95 | a or frozenset({1}) or True or frozenset({2}) # SIM222 96 96 | @@ -658,6 +720,8 @@ SIM222.py:97:6: SIM222 [*] Use `frozenset(frozenset({1}))` instead of `frozenset 99 99 | 100 100 | # Inside test `a` is simplified. + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:102:6: SIM222 [*] Use `True` instead of `... or True or ...` | 100 | # Inside test `a` is simplified. @@ -669,7 +733,7 @@ SIM222.py:102:6: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 99 99 | 100 100 | # Inside test `a` is simplified. 101 101 | @@ -679,6 +743,8 @@ SIM222.py:102:6: SIM222 [*] Use `True` instead of `... or True or ...` 104 104 | assert a or [1] or True or [2] # SIM222 105 105 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:104:8: SIM222 [*] Use `True` instead of `... or True or ...` | 102 | bool(a or [1] or True or [2]) # SIM222 @@ -690,7 +756,7 @@ SIM222.py:104:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 101 101 | 102 102 | bool(a or [1] or True or [2]) # SIM222 103 103 | @@ -700,6 +766,8 @@ SIM222.py:104:8: SIM222 [*] Use `True` instead of `... or True or ...` 106 106 | if (a or [1] or True or [2]) and (a or [1] or True or [2]): # SIM222 107 107 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:106:5: SIM222 [*] Use `True` instead of `... or True or ...` | 104 | assert a or [1] or True or [2] # SIM222 @@ -710,7 +778,7 @@ SIM222.py:106:5: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 103 103 | 104 104 | assert a or [1] or True or [2] # SIM222 105 105 | @@ -720,6 +788,8 @@ SIM222.py:106:5: SIM222 [*] Use `True` instead of `... or True or ...` 108 108 | 109 109 | 0 if a or [1] or True or [2] else 1 # SIM222 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:106:35: SIM222 [*] Use `True` instead of `... or True or ...` | 104 | assert a or [1] or True or [2] # SIM222 @@ -730,7 +800,7 @@ SIM222.py:106:35: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 103 103 | 104 104 | assert a or [1] or True or [2] # SIM222 105 105 | @@ -740,6 +810,8 @@ SIM222.py:106:35: SIM222 [*] Use `True` instead of `... or True or ...` 108 108 | 109 109 | 0 if a or [1] or True or [2] else 1 # SIM222 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:109:6: SIM222 [*] Use `True` instead of `... or True or ...` | 107 | pass @@ -751,7 +823,7 @@ SIM222.py:109:6: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 106 106 | if (a or [1] or True or [2]) and (a or [1] or True or [2]): # SIM222 107 107 | pass 108 108 | @@ -761,6 +833,8 @@ SIM222.py:109:6: SIM222 [*] Use `True` instead of `... or True or ...` 111 111 | while a or [1] or True or [2]: # SIM222 112 112 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:111:7: SIM222 [*] Use `True` instead of `... or True or ...` | 109 | 0 if a or [1] or True or [2] else 1 # SIM222 @@ -771,7 +845,7 @@ SIM222.py:111:7: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 108 108 | 109 109 | 0 if a or [1] or True or [2] else 1 # SIM222 110 110 | @@ -781,6 +855,8 @@ SIM222.py:111:7: SIM222 [*] Use `True` instead of `... or True or ...` 113 113 | 114 114 | [ + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:118:8: SIM222 [*] Use `True` instead of `... or True or ...` | 116 | for a in range(10) @@ -792,7 +868,7 @@ SIM222.py:118:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 115 115 | 0 116 116 | for a in range(10) 117 117 | for b in range(10) @@ -802,6 +878,8 @@ SIM222.py:118:8: SIM222 [*] Use `True` instead of `... or True or ...` 120 120 | ] 121 121 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:119:8: SIM222 [*] Use `True` instead of `... or True or ...` | 117 | for b in range(10) @@ -812,7 +890,7 @@ SIM222.py:119:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 116 116 | for a in range(10) 117 117 | for b in range(10) 118 118 | if a or [1] or True or [2] # SIM222 @@ -822,6 +900,8 @@ SIM222.py:119:8: SIM222 [*] Use `True` instead of `... or True or ...` 121 121 | 122 122 | { + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:126:8: SIM222 [*] Use `True` instead of `... or True or ...` | 124 | for a in range(10) @@ -833,7 +913,7 @@ SIM222.py:126:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 123 123 | 0 124 124 | for a in range(10) 125 125 | for b in range(10) @@ -843,6 +923,8 @@ SIM222.py:126:8: SIM222 [*] Use `True` instead of `... or True or ...` 128 128 | } 129 129 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:127:8: SIM222 [*] Use `True` instead of `... or True or ...` | 125 | for b in range(10) @@ -853,7 +935,7 @@ SIM222.py:127:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 124 124 | for a in range(10) 125 125 | for b in range(10) 126 126 | if a or [1] or True or [2] # SIM222 @@ -863,6 +945,8 @@ SIM222.py:127:8: SIM222 [*] Use `True` instead of `... or True or ...` 129 129 | 130 130 | { + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:134:8: SIM222 [*] Use `True` instead of `... or True or ...` | 132 | for a in range(10) @@ -874,7 +958,7 @@ SIM222.py:134:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 131 131 | 0: 0 132 132 | for a in range(10) 133 133 | for b in range(10) @@ -884,6 +968,8 @@ SIM222.py:134:8: SIM222 [*] Use `True` instead of `... or True or ...` 136 136 | } 137 137 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:135:8: SIM222 [*] Use `True` instead of `... or True or ...` | 133 | for b in range(10) @@ -894,7 +980,7 @@ SIM222.py:135:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 132 132 | for a in range(10) 133 133 | for b in range(10) 134 134 | if a or [1] or True or [2] # SIM222 @@ -904,6 +990,8 @@ SIM222.py:135:8: SIM222 [*] Use `True` instead of `... or True or ...` 137 137 | 138 138 | ( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:142:8: SIM222 [*] Use `True` instead of `... or True or ...` | 140 | for a in range(10) @@ -915,7 +1003,7 @@ SIM222.py:142:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 139 139 | 0 140 140 | for a in range(10) 141 141 | for b in range(10) @@ -925,6 +1013,8 @@ SIM222.py:142:8: SIM222 [*] Use `True` instead of `... or True or ...` 144 144 | ) 145 145 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:143:8: SIM222 [*] Use `True` instead of `... or True or ...` | 141 | for b in range(10) @@ -935,7 +1025,7 @@ SIM222.py:143:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Unsafe fix +Suggested fix: 140 140 | for a in range(10) 141 141 | for b in range(10) 142 142 | if a or [1] or True or [2] # SIM222 @@ -945,6 +1035,8 @@ SIM222.py:143:8: SIM222 [*] Use `True` instead of `... or True or ...` 145 145 | 146 146 | # Outside test `a` is not simplified. + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:148:6: SIM222 [*] Use `[1]` instead of `[1] or ...` | 146 | # Outside test `a` is not simplified. @@ -956,7 +1048,7 @@ SIM222.py:148:6: SIM222 [*] Use `[1]` instead of `[1] or ...` | = help: Replace with `[1]` -ℹ Unsafe fix +Suggested fix: 145 145 | 146 146 | # Outside test `a` is not simplified. 147 147 | @@ -966,6 +1058,8 @@ SIM222.py:148:6: SIM222 [*] Use `[1]` instead of `[1] or ...` 150 150 | if (a or [1] or True or [2]) == (a or [1]): # SIM222 151 151 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:150:10: SIM222 [*] Use `[1]` instead of `[1] or ...` | 148 | a or [1] or True or [2] # SIM222 @@ -976,7 +1070,7 @@ SIM222.py:150:10: SIM222 [*] Use `[1]` instead of `[1] or ...` | = help: Replace with `[1]` -ℹ Unsafe fix +Suggested fix: 147 147 | 148 148 | a or [1] or True or [2] # SIM222 149 149 | @@ -986,6 +1080,8 @@ SIM222.py:150:10: SIM222 [*] Use `[1]` instead of `[1] or ...` 152 152 | 153 153 | if f(a or [1] or True or [2]): # SIM222 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:153:11: SIM222 [*] Use `[1]` instead of `[1] or ...` | 151 | pass @@ -996,7 +1092,7 @@ SIM222.py:153:11: SIM222 [*] Use `[1]` instead of `[1] or ...` | = help: Replace with `[1]` -ℹ Unsafe fix +Suggested fix: 150 150 | if (a or [1] or True or [2]) == (a or [1]): # SIM222 151 151 | pass 152 152 | @@ -1006,6 +1102,8 @@ SIM222.py:153:11: SIM222 [*] Use `[1]` instead of `[1] or ...` 155 155 | 156 156 | # Regression test for: https://github.com/astral-sh/ruff/issues/7099 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:157:30: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) or ...` | 156 | # Regression test for: https://github.com/astral-sh/ruff/issues/7099 @@ -1015,7 +1113,7 @@ SIM222.py:157:30: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) o | = help: Replace with `(int, int, int)` -ℹ Unsafe fix +Suggested fix: 154 154 | pass 155 155 | 156 156 | # Regression test for: https://github.com/astral-sh/ruff/issues/7099 @@ -1025,6 +1123,8 @@ SIM222.py:157:30: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) o 159 159 | 160 160 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:161:31: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) or ...` | 161 | def secondToTime(s0: int) -> ((int, int, int) or str): @@ -1033,7 +1133,7 @@ SIM222.py:161:31: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) o | = help: Replace with `(int, int, int)` -ℹ Unsafe fix +Suggested fix: 158 158 | m, s = divmod(s0, 60) 159 159 | 160 160 | @@ -1043,6 +1143,8 @@ SIM222.py:161:31: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) o 163 163 | 164 164 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM222.py:168:7: SIM222 [*] Use `"bar"` instead of `... or "bar"` | 166 | print(f"{a}{b}" or "bar") @@ -1053,7 +1155,7 @@ SIM222.py:168:7: SIM222 [*] Use `"bar"` instead of `... or "bar"` | = help: Replace with `"bar"` -ℹ Unsafe fix +Suggested fix: 165 165 | # Regression test for: https://github.com/astral-sh/ruff/issues/9479 166 166 | print(f"{a}{b}" or "bar") 167 167 | print(f"{a}{''}" or "bar") @@ -1061,4 +1163,4 @@ SIM222.py:168:7: SIM222 [*] Use `"bar"` instead of `... or "bar"` 168 |+print("bar") 169 169 | print(f"{1}{''}" or "bar") - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap index 855b2091823cb..445071e1db77b 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap @@ -9,13 +9,15 @@ SIM223.py:1:4: SIM223 [*] Use `False` instead of `... and False` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 1 |-if a and False: # SIM223 1 |+if False: # SIM223 2 2 | pass 3 3 | 4 4 | if (a or b) and False: # SIM223 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:4:4: SIM223 [*] Use `False` instead of `... and False` | 2 | pass @@ -26,7 +28,7 @@ SIM223.py:4:4: SIM223 [*] Use `False` instead of `... and False` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 1 1 | if a and False: # SIM223 2 2 | pass 3 3 | @@ -36,6 +38,8 @@ SIM223.py:4:4: SIM223 [*] Use `False` instead of `... and False` 6 6 | 7 7 | if a or (b and False): # SIM223 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:7:10: SIM223 [*] Use `False` instead of `... and False` | 5 | pass @@ -46,7 +50,7 @@ SIM223.py:7:10: SIM223 [*] Use `False` instead of `... and False` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 4 4 | if (a or b) and False: # SIM223 5 5 | pass 6 6 | @@ -56,6 +60,8 @@ SIM223.py:7:10: SIM223 [*] Use `False` instead of `... and False` 9 9 | 10 10 | if a or False: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:19:18: SIM223 [*] Use `False` instead of `False and ...` | 17 | pass @@ -66,7 +72,7 @@ SIM223.py:19:18: SIM223 [*] Use `False` instead of `False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 16 16 | if a and f() and b and g() and False: # OK 17 17 | pass 18 18 | @@ -76,6 +82,8 @@ SIM223.py:19:18: SIM223 [*] Use `False` instead of `False and ...` 21 21 | 22 22 | if False and f() and a and g() and b: # SIM223 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:22:4: SIM223 [*] Use `False` instead of `False and ...` | 20 | pass @@ -86,7 +94,7 @@ SIM223.py:22:4: SIM223 [*] Use `False` instead of `False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 19 19 | if a and f() and False and g() and b: # SIM223 20 20 | pass 21 21 | @@ -96,6 +104,8 @@ SIM223.py:22:4: SIM223 [*] Use `False` instead of `False and ...` 24 24 | 25 25 | if a and False and f() and b and g(): # SIM223 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:25:4: SIM223 [*] Use `False` instead of `... and False and ...` | 23 | pass @@ -106,7 +116,7 @@ SIM223.py:25:4: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 22 22 | if False and f() and a and g() and b: # SIM223 23 23 | pass 24 24 | @@ -116,6 +126,8 @@ SIM223.py:25:4: SIM223 [*] Use `False` instead of `... and False and ...` 27 27 | 28 28 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:42:7: SIM223 [*] Use `""` instead of `"" and ...` | 42 | a and "" and False # SIM223 @@ -125,7 +137,7 @@ SIM223.py:42:7: SIM223 [*] Use `""` instead of `"" and ...` | = help: Replace with `""` -ℹ Unsafe fix +Suggested fix: 39 39 | pass 40 40 | 41 41 | @@ -135,6 +147,8 @@ SIM223.py:42:7: SIM223 [*] Use `""` instead of `"" and ...` 44 44 | a and "foo" and False and "bar" # SIM223 45 45 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:44:7: SIM223 [*] Use `False` instead of `... and False and ...` | 42 | a and "" and False # SIM223 @@ -146,7 +160,7 @@ SIM223.py:44:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 41 41 | 42 42 | a and "" and False # SIM223 43 43 | @@ -156,6 +170,8 @@ SIM223.py:44:7: SIM223 [*] Use `False` instead of `... and False and ...` 46 46 | a and 0 and False # SIM223 47 47 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:46:7: SIM223 [*] Use `0` instead of `0 and ...` | 44 | a and "foo" and False and "bar" # SIM223 @@ -167,7 +183,7 @@ SIM223.py:46:7: SIM223 [*] Use `0` instead of `0 and ...` | = help: Replace with `0` -ℹ Unsafe fix +Suggested fix: 43 43 | 44 44 | a and "foo" and False and "bar" # SIM223 45 45 | @@ -177,6 +193,8 @@ SIM223.py:46:7: SIM223 [*] Use `0` instead of `0 and ...` 48 48 | a and 1 and False and 2 # SIM223 49 49 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:48:7: SIM223 [*] Use `False` instead of `... and False and ...` | 46 | a and 0 and False # SIM223 @@ -188,7 +206,7 @@ SIM223.py:48:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 45 45 | 46 46 | a and 0 and False # SIM223 47 47 | @@ -198,6 +216,8 @@ SIM223.py:48:7: SIM223 [*] Use `False` instead of `... and False and ...` 50 50 | a and 0.0 and False # SIM223 51 51 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:50:7: SIM223 [*] Use `0.0` instead of `0.0 and ...` | 48 | a and 1 and False and 2 # SIM223 @@ -209,7 +229,7 @@ SIM223.py:50:7: SIM223 [*] Use `0.0` instead of `0.0 and ...` | = help: Replace with `0.0` -ℹ Unsafe fix +Suggested fix: 47 47 | 48 48 | a and 1 and False and 2 # SIM223 49 49 | @@ -219,6 +239,8 @@ SIM223.py:50:7: SIM223 [*] Use `0.0` instead of `0.0 and ...` 52 52 | a and 0.1 and False and 0.2 # SIM223 53 53 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:52:7: SIM223 [*] Use `False` instead of `... and False and ...` | 50 | a and 0.0 and False # SIM223 @@ -230,7 +252,7 @@ SIM223.py:52:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 49 49 | 50 50 | a and 0.0 and False # SIM223 51 51 | @@ -240,6 +262,8 @@ SIM223.py:52:7: SIM223 [*] Use `False` instead of `... and False and ...` 54 54 | a and [] and False # SIM223 55 55 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:54:7: SIM223 [*] Use `[]` instead of `[] and ...` | 52 | a and 0.1 and False and 0.2 # SIM223 @@ -251,7 +275,7 @@ SIM223.py:54:7: SIM223 [*] Use `[]` instead of `[] and ...` | = help: Replace with `[]` -ℹ Unsafe fix +Suggested fix: 51 51 | 52 52 | a and 0.1 and False and 0.2 # SIM223 53 53 | @@ -261,6 +285,8 @@ SIM223.py:54:7: SIM223 [*] Use `[]` instead of `[] and ...` 56 56 | a and list([]) and False # SIM223 57 57 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:56:7: SIM223 [*] Use `list([])` instead of `list([]) and ...` | 54 | a and [] and False # SIM223 @@ -272,7 +298,7 @@ SIM223.py:56:7: SIM223 [*] Use `list([])` instead of `list([]) and ...` | = help: Replace with `list([])` -ℹ Unsafe fix +Suggested fix: 53 53 | 54 54 | a and [] and False # SIM223 55 55 | @@ -282,6 +308,8 @@ SIM223.py:56:7: SIM223 [*] Use `list([])` instead of `list([]) and ...` 58 58 | a and [1] and False and [2] # SIM223 59 59 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:58:7: SIM223 [*] Use `False` instead of `... and False and ...` | 56 | a and list([]) and False # SIM223 @@ -293,7 +321,7 @@ SIM223.py:58:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 55 55 | 56 56 | a and list([]) and False # SIM223 57 57 | @@ -303,6 +331,8 @@ SIM223.py:58:7: SIM223 [*] Use `False` instead of `... and False and ...` 60 60 | a and list([1]) and False and list([2]) # SIM223 61 61 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:60:7: SIM223 [*] Use `False` instead of `... and False and ...` | 58 | a and [1] and False and [2] # SIM223 @@ -314,7 +344,7 @@ SIM223.py:60:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 57 57 | 58 58 | a and [1] and False and [2] # SIM223 59 59 | @@ -324,6 +354,8 @@ SIM223.py:60:7: SIM223 [*] Use `False` instead of `... and False and ...` 62 62 | a and {} and False # SIM223 63 63 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:62:7: SIM223 [*] Use `{}` instead of `{} and ...` | 60 | a and list([1]) and False and list([2]) # SIM223 @@ -335,7 +367,7 @@ SIM223.py:62:7: SIM223 [*] Use `{}` instead of `{} and ...` | = help: Replace with `{}` -ℹ Unsafe fix +Suggested fix: 59 59 | 60 60 | a and list([1]) and False and list([2]) # SIM223 61 61 | @@ -345,6 +377,8 @@ SIM223.py:62:7: SIM223 [*] Use `{}` instead of `{} and ...` 64 64 | a and dict() and False # SIM223 65 65 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:64:7: SIM223 [*] Use `dict()` instead of `dict() and ...` | 62 | a and {} and False # SIM223 @@ -356,7 +390,7 @@ SIM223.py:64:7: SIM223 [*] Use `dict()` instead of `dict() and ...` | = help: Replace with `dict()` -ℹ Unsafe fix +Suggested fix: 61 61 | 62 62 | a and {} and False # SIM223 63 63 | @@ -366,6 +400,8 @@ SIM223.py:64:7: SIM223 [*] Use `dict()` instead of `dict() and ...` 66 66 | a and {1: 1} and False and {2: 2} # SIM223 67 67 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:66:7: SIM223 [*] Use `False` instead of `... and False and ...` | 64 | a and dict() and False # SIM223 @@ -377,7 +413,7 @@ SIM223.py:66:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 63 63 | 64 64 | a and dict() and False # SIM223 65 65 | @@ -387,6 +423,8 @@ SIM223.py:66:7: SIM223 [*] Use `False` instead of `... and False and ...` 68 68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223 69 69 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:68:7: SIM223 [*] Use `False` instead of `... and False and ...` | 66 | a and {1: 1} and False and {2: 2} # SIM223 @@ -398,7 +436,7 @@ SIM223.py:68:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 65 65 | 66 66 | a and {1: 1} and False and {2: 2} # SIM223 67 67 | @@ -408,6 +446,8 @@ SIM223.py:68:7: SIM223 [*] Use `False` instead of `... and False and ...` 70 70 | a and set() and False # SIM223 71 71 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:70:7: SIM223 [*] Use `set()` instead of `set() and ...` | 68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223 @@ -419,7 +459,7 @@ SIM223.py:70:7: SIM223 [*] Use `set()` instead of `set() and ...` | = help: Replace with `set()` -ℹ Unsafe fix +Suggested fix: 67 67 | 68 68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223 69 69 | @@ -429,6 +469,8 @@ SIM223.py:70:7: SIM223 [*] Use `set()` instead of `set() and ...` 72 72 | a and set(set()) and False # SIM223 73 73 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:72:7: SIM223 [*] Use `set(set())` instead of `set(set()) and ...` | 70 | a and set() and False # SIM223 @@ -440,7 +482,7 @@ SIM223.py:72:7: SIM223 [*] Use `set(set())` instead of `set(set()) and ...` | = help: Replace with `set(set())` -ℹ Unsafe fix +Suggested fix: 69 69 | 70 70 | a and set() and False # SIM223 71 71 | @@ -450,6 +492,8 @@ SIM223.py:72:7: SIM223 [*] Use `set(set())` instead of `set(set()) and ...` 74 74 | a and {1} and False and {2} # SIM223 75 75 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:74:7: SIM223 [*] Use `False` instead of `... and False and ...` | 72 | a and set(set()) and False # SIM223 @@ -461,7 +505,7 @@ SIM223.py:74:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 71 71 | 72 72 | a and set(set()) and False # SIM223 73 73 | @@ -471,6 +515,8 @@ SIM223.py:74:7: SIM223 [*] Use `False` instead of `... and False and ...` 76 76 | a and set({1}) and False and set({2}) # SIM223 77 77 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:76:7: SIM223 [*] Use `False` instead of `... and False and ...` | 74 | a and {1} and False and {2} # SIM223 @@ -482,7 +528,7 @@ SIM223.py:76:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 73 73 | 74 74 | a and {1} and False and {2} # SIM223 75 75 | @@ -492,6 +538,8 @@ SIM223.py:76:7: SIM223 [*] Use `False` instead of `... and False and ...` 78 78 | a and () and False # SIM222 79 79 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:78:7: SIM223 [*] Use `()` instead of `() and ...` | 76 | a and set({1}) and False and set({2}) # SIM223 @@ -503,7 +551,7 @@ SIM223.py:78:7: SIM223 [*] Use `()` instead of `() and ...` | = help: Replace with `()` -ℹ Unsafe fix +Suggested fix: 75 75 | 76 76 | a and set({1}) and False and set({2}) # SIM223 77 77 | @@ -513,6 +561,8 @@ SIM223.py:78:7: SIM223 [*] Use `()` instead of `() and ...` 80 80 | a and tuple(()) and False # SIM222 81 81 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:80:7: SIM223 [*] Use `tuple(())` instead of `tuple(()) and ...` | 78 | a and () and False # SIM222 @@ -524,7 +574,7 @@ SIM223.py:80:7: SIM223 [*] Use `tuple(())` instead of `tuple(()) and ...` | = help: Replace with `tuple(())` -ℹ Unsafe fix +Suggested fix: 77 77 | 78 78 | a and () and False # SIM222 79 79 | @@ -534,6 +584,8 @@ SIM223.py:80:7: SIM223 [*] Use `tuple(())` instead of `tuple(()) and ...` 82 82 | a and (1,) and False and (2,) # SIM222 83 83 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:82:7: SIM223 [*] Use `False` instead of `... and False and ...` | 80 | a and tuple(()) and False # SIM222 @@ -545,7 +597,7 @@ SIM223.py:82:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 79 79 | 80 80 | a and tuple(()) and False # SIM222 81 81 | @@ -555,6 +607,8 @@ SIM223.py:82:7: SIM223 [*] Use `False` instead of `... and False and ...` 84 84 | a and tuple((1,)) and False and tuple((2,)) # SIM222 85 85 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:84:7: SIM223 [*] Use `False` instead of `... and False and ...` | 82 | a and (1,) and False and (2,) # SIM222 @@ -566,7 +620,7 @@ SIM223.py:84:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 81 81 | 82 82 | a and (1,) and False and (2,) # SIM222 83 83 | @@ -576,6 +630,8 @@ SIM223.py:84:7: SIM223 [*] Use `False` instead of `... and False and ...` 86 86 | a and frozenset() and False # SIM222 87 87 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:86:7: SIM223 [*] Use `frozenset()` instead of `frozenset() and ...` | 84 | a and tuple((1,)) and False and tuple((2,)) # SIM222 @@ -587,7 +643,7 @@ SIM223.py:86:7: SIM223 [*] Use `frozenset()` instead of `frozenset() and ...` | = help: Replace with `frozenset()` -ℹ Unsafe fix +Suggested fix: 83 83 | 84 84 | a and tuple((1,)) and False and tuple((2,)) # SIM222 85 85 | @@ -597,6 +653,8 @@ SIM223.py:86:7: SIM223 [*] Use `frozenset()` instead of `frozenset() and ...` 88 88 | a and frozenset(frozenset()) and False # SIM222 89 89 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:88:7: SIM223 [*] Use `frozenset(frozenset())` instead of `frozenset(frozenset()) and ...` | 86 | a and frozenset() and False # SIM222 @@ -608,7 +666,7 @@ SIM223.py:88:7: SIM223 [*] Use `frozenset(frozenset())` instead of `frozenset(fr | = help: Replace with `frozenset(frozenset())` -ℹ Unsafe fix +Suggested fix: 85 85 | 86 86 | a and frozenset() and False # SIM222 87 87 | @@ -618,6 +676,8 @@ SIM223.py:88:7: SIM223 [*] Use `frozenset(frozenset())` instead of `frozenset(fr 90 90 | a and frozenset({1}) and False and frozenset({2}) # SIM222 91 91 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:90:7: SIM223 [*] Use `False` instead of `... and False and ...` | 88 | a and frozenset(frozenset()) and False # SIM222 @@ -629,7 +689,7 @@ SIM223.py:90:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 87 87 | 88 88 | a and frozenset(frozenset()) and False # SIM222 89 89 | @@ -639,6 +699,8 @@ SIM223.py:90:7: SIM223 [*] Use `False` instead of `... and False and ...` 92 92 | a and frozenset(frozenset({1})) and False and frozenset(frozenset({2})) # SIM222 93 93 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:92:7: SIM223 [*] Use `False` instead of `... and False and ...` | 90 | a and frozenset({1}) and False and frozenset({2}) # SIM222 @@ -648,7 +710,7 @@ SIM223.py:92:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 89 89 | 90 90 | a and frozenset({1}) and False and frozenset({2}) # SIM222 91 91 | @@ -658,6 +720,8 @@ SIM223.py:92:7: SIM223 [*] Use `False` instead of `... and False and ...` 94 94 | 95 95 | # Inside test `a` is simplified. + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:97:6: SIM223 [*] Use `False` instead of `... and False and ...` | 95 | # Inside test `a` is simplified. @@ -669,7 +733,7 @@ SIM223.py:97:6: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 94 94 | 95 95 | # Inside test `a` is simplified. 96 96 | @@ -679,6 +743,8 @@ SIM223.py:97:6: SIM223 [*] Use `False` instead of `... and False and ...` 99 99 | assert a and [] and False and [] # SIM223 100 100 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:99:8: SIM223 [*] Use `False` instead of `... and False and ...` | 97 | bool(a and [] and False and []) # SIM223 @@ -690,7 +756,7 @@ SIM223.py:99:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 96 96 | 97 97 | bool(a and [] and False and []) # SIM223 98 98 | @@ -700,6 +766,8 @@ SIM223.py:99:8: SIM223 [*] Use `False` instead of `... and False and ...` 101 101 | if (a and [] and False and []) or (a and [] and False and []): # SIM223 102 102 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:101:5: SIM223 [*] Use `False` instead of `... and False and ...` | 99 | assert a and [] and False and [] # SIM223 @@ -710,7 +778,7 @@ SIM223.py:101:5: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 98 98 | 99 99 | assert a and [] and False and [] # SIM223 100 100 | @@ -720,6 +788,8 @@ SIM223.py:101:5: SIM223 [*] Use `False` instead of `... and False and ...` 103 103 | 104 104 | 0 if a and [] and False and [] else 1 # SIM222 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:101:36: SIM223 [*] Use `False` instead of `... and False and ...` | 99 | assert a and [] and False and [] # SIM223 @@ -730,7 +800,7 @@ SIM223.py:101:36: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 98 98 | 99 99 | assert a and [] and False and [] # SIM223 100 100 | @@ -740,6 +810,8 @@ SIM223.py:101:36: SIM223 [*] Use `False` instead of `... and False and ...` 103 103 | 104 104 | 0 if a and [] and False and [] else 1 # SIM222 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:104:6: SIM223 [*] Use `False` instead of `... and False and ...` | 102 | pass @@ -751,7 +823,7 @@ SIM223.py:104:6: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 101 101 | if (a and [] and False and []) or (a and [] and False and []): # SIM223 102 102 | pass 103 103 | @@ -761,6 +833,8 @@ SIM223.py:104:6: SIM223 [*] Use `False` instead of `... and False and ...` 106 106 | while a and [] and False and []: # SIM223 107 107 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:106:7: SIM223 [*] Use `False` instead of `... and False and ...` | 104 | 0 if a and [] and False and [] else 1 # SIM222 @@ -771,7 +845,7 @@ SIM223.py:106:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 103 103 | 104 104 | 0 if a and [] and False and [] else 1 # SIM222 105 105 | @@ -781,6 +855,8 @@ SIM223.py:106:7: SIM223 [*] Use `False` instead of `... and False and ...` 108 108 | 109 109 | [ + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:113:8: SIM223 [*] Use `False` instead of `... and False and ...` | 111 | for a in range(10) @@ -792,7 +868,7 @@ SIM223.py:113:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 110 110 | 0 111 111 | for a in range(10) 112 112 | for b in range(10) @@ -802,6 +878,8 @@ SIM223.py:113:8: SIM223 [*] Use `False` instead of `... and False and ...` 115 115 | ] 116 116 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:114:8: SIM223 [*] Use `False` instead of `... and False and ...` | 112 | for b in range(10) @@ -812,7 +890,7 @@ SIM223.py:114:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 111 111 | for a in range(10) 112 112 | for b in range(10) 113 113 | if a and [] and False and [] # SIM223 @@ -822,6 +900,8 @@ SIM223.py:114:8: SIM223 [*] Use `False` instead of `... and False and ...` 116 116 | 117 117 | { + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:121:8: SIM223 [*] Use `False` instead of `... and False and ...` | 119 | for a in range(10) @@ -833,7 +913,7 @@ SIM223.py:121:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 118 118 | 0 119 119 | for a in range(10) 120 120 | for b in range(10) @@ -843,6 +923,8 @@ SIM223.py:121:8: SIM223 [*] Use `False` instead of `... and False and ...` 123 123 | } 124 124 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:122:8: SIM223 [*] Use `False` instead of `... and False and ...` | 120 | for b in range(10) @@ -853,7 +935,7 @@ SIM223.py:122:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 119 119 | for a in range(10) 120 120 | for b in range(10) 121 121 | if a and [] and False and [] # SIM223 @@ -863,6 +945,8 @@ SIM223.py:122:8: SIM223 [*] Use `False` instead of `... and False and ...` 124 124 | 125 125 | { + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:129:8: SIM223 [*] Use `False` instead of `... and False and ...` | 127 | for a in range(10) @@ -874,7 +958,7 @@ SIM223.py:129:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 126 126 | 0: 0 127 127 | for a in range(10) 128 128 | for b in range(10) @@ -884,6 +968,8 @@ SIM223.py:129:8: SIM223 [*] Use `False` instead of `... and False and ...` 131 131 | } 132 132 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:130:8: SIM223 [*] Use `False` instead of `... and False and ...` | 128 | for b in range(10) @@ -894,7 +980,7 @@ SIM223.py:130:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 127 127 | for a in range(10) 128 128 | for b in range(10) 129 129 | if a and [] and False and [] # SIM223 @@ -904,6 +990,8 @@ SIM223.py:130:8: SIM223 [*] Use `False` instead of `... and False and ...` 132 132 | 133 133 | ( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:137:8: SIM223 [*] Use `False` instead of `... and False and ...` | 135 | for a in range(10) @@ -915,7 +1003,7 @@ SIM223.py:137:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 134 134 | 0 135 135 | for a in range(10) 136 136 | for b in range(10) @@ -925,6 +1013,8 @@ SIM223.py:137:8: SIM223 [*] Use `False` instead of `... and False and ...` 139 139 | ) 140 140 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:138:8: SIM223 [*] Use `False` instead of `... and False and ...` | 136 | for b in range(10) @@ -935,7 +1025,7 @@ SIM223.py:138:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Unsafe fix +Suggested fix: 135 135 | for a in range(10) 136 136 | for b in range(10) 137 137 | if a and [] and False and [] # SIM223 @@ -945,6 +1035,8 @@ SIM223.py:138:8: SIM223 [*] Use `False` instead of `... and False and ...` 140 140 | 141 141 | # Outside test `a` is not simplified. + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:143:7: SIM223 [*] Use `[]` instead of `[] and ...` | 141 | # Outside test `a` is not simplified. @@ -956,7 +1048,7 @@ SIM223.py:143:7: SIM223 [*] Use `[]` instead of `[] and ...` | = help: Replace with `[]` -ℹ Unsafe fix +Suggested fix: 140 140 | 141 141 | # Outside test `a` is not simplified. 142 142 | @@ -966,6 +1058,8 @@ SIM223.py:143:7: SIM223 [*] Use `[]` instead of `[] and ...` 145 145 | if (a and [] and False and []) == (a and []): # SIM223 146 146 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:145:11: SIM223 [*] Use `[]` instead of `[] and ...` | 143 | a and [] and False and [] # SIM223 @@ -976,7 +1070,7 @@ SIM223.py:145:11: SIM223 [*] Use `[]` instead of `[] and ...` | = help: Replace with `[]` -ℹ Unsafe fix +Suggested fix: 142 142 | 143 143 | a and [] and False and [] # SIM223 144 144 | @@ -986,6 +1080,8 @@ SIM223.py:145:11: SIM223 [*] Use `[]` instead of `[] and ...` 147 147 | 148 148 | if f(a and [] and False and []): # SIM223 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:148:12: SIM223 [*] Use `[]` instead of `[] and ...` | 146 | pass @@ -996,7 +1092,7 @@ SIM223.py:148:12: SIM223 [*] Use `[]` instead of `[] and ...` | = help: Replace with `[]` -ℹ Unsafe fix +Suggested fix: 145 145 | if (a and [] and False and []) == (a and []): # SIM223 146 146 | pass 147 147 | @@ -1006,6 +1102,8 @@ SIM223.py:148:12: SIM223 [*] Use `[]` instead of `[] and ...` 150 150 | 151 151 | # Regression test for: https://github.com/astral-sh/ruff/issues/9479 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + SIM223.py:154:7: SIM223 [*] Use `f"{''}{''}"` instead of `f"{''}{''}" and ...` | 152 | print(f"{a}{b}" and "bar") @@ -1016,7 +1114,7 @@ SIM223.py:154:7: SIM223 [*] Use `f"{''}{''}"` instead of `f"{''}{''}" and ...` | = help: Replace with `f"{''}{''}"` -ℹ Unsafe fix +Suggested fix: 151 151 | # Regression test for: https://github.com/astral-sh/ruff/issues/9479 152 152 | print(f"{a}{b}" and "bar") 153 153 | print(f"{a}{''}" and "bar") @@ -1024,4 +1122,4 @@ SIM223.py:154:7: SIM223 [*] Use `f"{''}{''}"` instead of `f"{''}{''}" and ...` 154 |+print(f"{''}{''}") 155 155 | print(f"{1}{''}" and "bar") - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM300_SIM300.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM300_SIM300.py.snap index 8af686ef8545f..ef273065290a7 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM300_SIM300.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM300_SIM300.py.snap @@ -11,7 +11,7 @@ SIM300.py:2:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `compare == "yoda"` -ℹ Safe fix +Suggested fix: 1 1 | # Errors 2 |-"yoda" == compare # SIM300 2 |+compare == "yoda" # SIM300 @@ -19,6 +19,8 @@ SIM300.py:2:1: SIM300 [*] Yoda condition detected 4 4 | ("a", "b") == compare # SIM300 5 5 | "yoda" <= compare # SIM300 + Run `ruff check --fix` to apply this fix. + SIM300.py:3:1: SIM300 [*] Yoda condition detected | 1 | # Errors @@ -30,7 +32,7 @@ SIM300.py:3:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `age == 42` -ℹ Safe fix +Suggested fix: 1 1 | # Errors 2 2 | "yoda" == compare # SIM300 3 |-42 == age # SIM300 @@ -39,6 +41,8 @@ SIM300.py:3:1: SIM300 [*] Yoda condition detected 5 5 | "yoda" <= compare # SIM300 6 6 | "yoda" < compare # SIM300 + Run `ruff check --fix` to apply this fix. + SIM300.py:4:1: SIM300 [*] Yoda condition detected | 2 | "yoda" == compare # SIM300 @@ -50,7 +54,7 @@ SIM300.py:4:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `compare == ("a", "b")` -ℹ Safe fix +Suggested fix: 1 1 | # Errors 2 2 | "yoda" == compare # SIM300 3 3 | 42 == age # SIM300 @@ -60,6 +64,8 @@ SIM300.py:4:1: SIM300 [*] Yoda condition detected 6 6 | "yoda" < compare # SIM300 7 7 | 42 > age # SIM300 + Run `ruff check --fix` to apply this fix. + SIM300.py:5:1: SIM300 [*] Yoda condition detected | 3 | 42 == age # SIM300 @@ -71,7 +77,7 @@ SIM300.py:5:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `compare >= "yoda"` -ℹ Safe fix +Suggested fix: 2 2 | "yoda" == compare # SIM300 3 3 | 42 == age # SIM300 4 4 | ("a", "b") == compare # SIM300 @@ -81,6 +87,8 @@ SIM300.py:5:1: SIM300 [*] Yoda condition detected 7 7 | 42 > age # SIM300 8 8 | -42 > age # SIM300 + Run `ruff check --fix` to apply this fix. + SIM300.py:6:1: SIM300 [*] Yoda condition detected | 4 | ("a", "b") == compare # SIM300 @@ -92,7 +100,7 @@ SIM300.py:6:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `compare > "yoda"` -ℹ Safe fix +Suggested fix: 3 3 | 42 == age # SIM300 4 4 | ("a", "b") == compare # SIM300 5 5 | "yoda" <= compare # SIM300 @@ -102,6 +110,8 @@ SIM300.py:6:1: SIM300 [*] Yoda condition detected 8 8 | -42 > age # SIM300 9 9 | +42 > age # SIM300 + Run `ruff check --fix` to apply this fix. + SIM300.py:7:1: SIM300 [*] Yoda condition detected | 5 | "yoda" <= compare # SIM300 @@ -113,7 +123,7 @@ SIM300.py:7:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `age < 42` -ℹ Safe fix +Suggested fix: 4 4 | ("a", "b") == compare # SIM300 5 5 | "yoda" <= compare # SIM300 6 6 | "yoda" < compare # SIM300 @@ -123,6 +133,8 @@ SIM300.py:7:1: SIM300 [*] Yoda condition detected 9 9 | +42 > age # SIM300 10 10 | YODA == age # SIM300 + Run `ruff check --fix` to apply this fix. + SIM300.py:8:1: SIM300 [*] Yoda condition detected | 6 | "yoda" < compare # SIM300 @@ -134,7 +146,7 @@ SIM300.py:8:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `age < -42` -ℹ Safe fix +Suggested fix: 5 5 | "yoda" <= compare # SIM300 6 6 | "yoda" < compare # SIM300 7 7 | 42 > age # SIM300 @@ -144,6 +156,8 @@ SIM300.py:8:1: SIM300 [*] Yoda condition detected 10 10 | YODA == age # SIM300 11 11 | YODA > age # SIM300 + Run `ruff check --fix` to apply this fix. + SIM300.py:9:1: SIM300 [*] Yoda condition detected | 7 | 42 > age # SIM300 @@ -155,7 +169,7 @@ SIM300.py:9:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `age < +42` -ℹ Safe fix +Suggested fix: 6 6 | "yoda" < compare # SIM300 7 7 | 42 > age # SIM300 8 8 | -42 > age # SIM300 @@ -165,6 +179,8 @@ SIM300.py:9:1: SIM300 [*] Yoda condition detected 11 11 | YODA > age # SIM300 12 12 | YODA >= age # SIM300 + Run `ruff check --fix` to apply this fix. + SIM300.py:10:1: SIM300 [*] Yoda condition detected | 8 | -42 > age # SIM300 @@ -176,7 +192,7 @@ SIM300.py:10:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `age == YODA` -ℹ Safe fix +Suggested fix: 7 7 | 42 > age # SIM300 8 8 | -42 > age # SIM300 9 9 | +42 > age # SIM300 @@ -186,6 +202,8 @@ SIM300.py:10:1: SIM300 [*] Yoda condition detected 12 12 | YODA >= age # SIM300 13 13 | JediOrder.YODA == age # SIM300 + Run `ruff check --fix` to apply this fix. + SIM300.py:11:1: SIM300 [*] Yoda condition detected | 9 | +42 > age # SIM300 @@ -197,7 +215,7 @@ SIM300.py:11:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `age < YODA` -ℹ Safe fix +Suggested fix: 8 8 | -42 > age # SIM300 9 9 | +42 > age # SIM300 10 10 | YODA == age # SIM300 @@ -207,6 +225,8 @@ SIM300.py:11:1: SIM300 [*] Yoda condition detected 13 13 | JediOrder.YODA == age # SIM300 14 14 | 0 < (number - 100) # SIM300 + Run `ruff check --fix` to apply this fix. + SIM300.py:12:1: SIM300 [*] Yoda condition detected | 10 | YODA == age # SIM300 @@ -218,7 +238,7 @@ SIM300.py:12:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `age <= YODA` -ℹ Safe fix +Suggested fix: 9 9 | +42 > age # SIM300 10 10 | YODA == age # SIM300 11 11 | YODA > age # SIM300 @@ -228,6 +248,8 @@ SIM300.py:12:1: SIM300 [*] Yoda condition detected 14 14 | 0 < (number - 100) # SIM300 15 15 | B age # SIM300 @@ -239,7 +261,7 @@ SIM300.py:13:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `age == JediOrder.YODA` -ℹ Safe fix +Suggested fix: 10 10 | YODA == age # SIM300 11 11 | YODA > age # SIM300 12 12 | YODA >= age # SIM300 @@ -249,6 +271,8 @@ SIM300.py:13:1: SIM300 [*] Yoda condition detected 15 15 | B= age # SIM300 @@ -260,7 +284,7 @@ SIM300.py:14:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `(number - 100) > 0` -ℹ Safe fix +Suggested fix: 11 11 | YODA > age # SIM300 12 12 | YODA >= age # SIM300 13 13 | JediOrder.YODA == age # SIM300 @@ -270,6 +294,8 @@ SIM300.py:14:1: SIM300 [*] Yoda condition detected 16 16 | B or(B) B` -ℹ Safe fix +Suggested fix: 12 12 | YODA >= age # SIM300 13 13 | JediOrder.YODA == age # SIM300 14 14 | 0 < (number - 100) # SIM300 @@ -290,6 +316,8 @@ SIM300.py:15:1: SIM300 [*] Yoda condition detected 17 17 | 18 18 | # Errors in preview + Run `ruff check --fix` to apply this fix. + SIM300.py:16:5: SIM300 [*] Yoda condition detected | 14 | 0 < (number - 100) # SIM300 @@ -301,7 +329,7 @@ SIM300.py:16:5: SIM300 [*] Yoda condition detected | = help: Rewrite as `A[0][0] > (B)` -ℹ Safe fix +Suggested fix: 13 13 | JediOrder.YODA == age # SIM300 14 14 | 0 < (number - 100) # SIM300 15 15 | B:8:5: TCH002 [*] Move third-party import `pandas.Series` into a type-checking block | 6 | from pandas import ( @@ -39,7 +41,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | from typing import TYPE_CHECKING 5 5 | @@ -57,4 +59,4 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 11 13 | def f(x: DataFrame, y: Series): 12 14 | pass - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 567f695f25eef..317b4ad15dd47 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 @@ -12,7 +12,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | from typing import TYPE_CHECKING 5 5 | @@ -25,6 +25,8 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 8 11 | def f(x: os, y: pandas): 9 12 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + :6:12: TCH002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING @@ -36,7 +38,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | from typing import TYPE_CHECKING 5 5 | @@ -49,4 +51,4 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 8 11 | def f(x: os, y: pandas): 9 12 | pass - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 6814710f481d8..38c1eb40c6dbc 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 @@ -12,7 +12,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | from typing import TYPE_CHECKING 5 5 | @@ -24,6 +24,8 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 8 10 | def f(x: os, y: sys): 9 11 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + :6:12: TCH003 [*] Move standard library import `sys` into a type-checking block | 4 | from typing import TYPE_CHECKING @@ -35,7 +37,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | from typing import TYPE_CHECKING 5 5 | @@ -47,4 +49,4 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 8 10 | def f(x: os, y: sys): 9 11 | pass - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 3f9c1fb4f77a0..10d6ee2149351 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 @@ -12,7 +12,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | 2 2 | from __future__ import annotations 3 3 | @@ -25,4 +25,4 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 6 9 | def f(x: pd.DataFrame): 7 10 | pass - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 ae71c56c8195a..f1ab2599ceec7 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 @@ -11,7 +11,7 @@ quote.py:64:28: TCH004 [*] Quote references to `pandas.DataFrame`. Import is in | = help: Quote references -ℹ Unsafe fix +Suggested fix: 63 63 | if TYPE_CHECKING: 64 64 | from pandas import DataFrame 65 65 | @@ -21,4 +21,4 @@ quote.py:64:28: TCH004 [*] Quote references to `pandas.DataFrame`. Import is in 68 68 | 69 69 | - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 d9bb6a9824812..872ede57f0e5a 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 @@ -11,7 +11,7 @@ quote.py:2:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 |-def f(): 1 |+from typing import TYPE_CHECKING 2 |+ @@ -25,6 +25,8 @@ quote.py:2:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type 6 9 | 7 10 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + quote.py:9:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 8 | def f(): @@ -35,7 +37,7 @@ quote.py:9:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 |+from typing import TYPE_CHECKING 2 |+ 3 |+if TYPE_CHECKING: @@ -55,6 +57,8 @@ quote.py:9:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type 13 16 | 14 17 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + quote.py:16:24: TCH002 Move third-party import `pandas.DataFrame` into a type-checking block | 15 | def f(): @@ -75,7 +79,7 @@ quote.py:23:22: TCH002 [*] Move third-party import `pandas` into a type-checking | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 |+from typing import TYPE_CHECKING 2 |+ 3 |+if TYPE_CHECKING: @@ -95,6 +99,8 @@ quote.py:23:22: TCH002 [*] Move third-party import `pandas` into a type-checking 27 30 | 28 31 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + quote.py:30:22: TCH002 [*] Move third-party import `pandas` into a type-checking block | 29 | def f(): @@ -105,7 +111,7 @@ quote.py:30:22: TCH002 [*] Move third-party import `pandas` into a type-checking | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 |+from typing import TYPE_CHECKING 2 |+ 3 |+if TYPE_CHECKING: @@ -125,6 +131,8 @@ quote.py:30:22: TCH002 [*] Move third-party import `pandas` into a type-checking 34 37 | 35 38 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + quote.py:37:22: TCH002 [*] Move third-party import `pandas` into a type-checking block | 36 | def f(): @@ -135,7 +143,7 @@ quote.py:37:22: TCH002 [*] Move third-party import `pandas` into a type-checking | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 |+from typing import TYPE_CHECKING 2 |+ 3 |+if TYPE_CHECKING: @@ -155,6 +163,8 @@ quote.py:37:22: TCH002 [*] Move third-party import `pandas` into a type-checking 41 44 | 42 45 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + quote.py:45:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 44 | def f(): @@ -165,7 +175,7 @@ quote.py:45:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a typ | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 |+from typing import TYPE_CHECKING 2 |+ 3 |+if TYPE_CHECKING: @@ -185,6 +195,8 @@ quote.py:45:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a typ 49 52 | 50 53 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + quote.py:54:24: TCH002 Move third-party import `pandas.DataFrame` into a type-checking block | 52 | from typing import Literal @@ -206,7 +218,7 @@ quote.py:71:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a typ | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 |+from typing import TYPE_CHECKING 2 |+ 3 |+if TYPE_CHECKING: @@ -226,6 +238,8 @@ quote.py:71:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a typ 75 78 | 76 79 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + quote.py:71:35: TCH002 [*] Move third-party import `pandas.Series` into a type-checking block | 70 | def f(): @@ -236,7 +250,7 @@ quote.py:71:35: TCH002 [*] Move third-party import `pandas.Series` into a type-c | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 |+from typing import TYPE_CHECKING 2 |+ 3 |+if TYPE_CHECKING: @@ -256,6 +270,8 @@ quote.py:71:35: TCH002 [*] Move third-party import `pandas.Series` into a type-c 75 78 | 76 79 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + quote.py:78:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 77 | def f(): @@ -266,7 +282,7 @@ quote.py:78:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a typ | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 |+from typing import TYPE_CHECKING 2 |+ 3 |+if TYPE_CHECKING: @@ -299,6 +315,8 @@ quote.py:78:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a typ 93 93 | 94 94 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + quote.py:78:35: TCH002 [*] Move third-party import `pandas.Series` into a type-checking block | 77 | def f(): @@ -309,7 +327,7 @@ quote.py:78:35: TCH002 [*] Move third-party import `pandas.Series` into a type-c | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 |+from typing import TYPE_CHECKING 2 |+ 3 |+if TYPE_CHECKING: @@ -342,6 +360,8 @@ quote.py:78:35: TCH002 [*] Move third-party import `pandas.Series` into a type-c 93 93 | 94 94 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + quote.py:96:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 95 | def f(): @@ -352,7 +372,7 @@ quote.py:96:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a typ | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 |+from typing import TYPE_CHECKING 2 |+ 3 |+if TYPE_CHECKING: @@ -370,6 +390,8 @@ quote.py:96:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a typ 101 |+ def func(self) -> "DataFrame | list[Series]": 99 102 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + quote.py:96:35: TCH002 [*] Move third-party import `pandas.Series` into a type-checking block | 95 | def f(): @@ -380,7 +402,7 @@ quote.py:96:35: TCH002 [*] Move third-party import `pandas.Series` into a type-c | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 |+from typing import TYPE_CHECKING 2 |+ 3 |+if TYPE_CHECKING: @@ -397,3 +419,5 @@ quote.py:96:35: TCH002 [*] Move third-party import `pandas.Series` into a type-c 98 |- def func(self) -> DataFrame | list[Series]: 101 |+ def func(self) -> "DataFrame | list[Series]": 99 102 | pass + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH004_1.py.snap index b11905593b5aa..9d4b551f72099 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_TCH004_1.py.snap @@ -10,7 +10,7 @@ TCH004_1.py:4:26: TCH004 [*] Move import `datetime.datetime` out of type-checkin | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from typing import TYPE_CHECKING 2 |+from datetime import datetime 2 3 | @@ -19,4 +19,4 @@ TCH004_1.py:4:26: TCH004 [*] Move import `datetime.datetime` out of type-checkin 5 |+ pass 5 6 | x = datetime - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH004_11.py.snap index 1c4e1df589f8c..b8c0101b3be7a 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_TCH004_11.py.snap @@ -11,7 +11,7 @@ TCH004_11.py:4:24: TCH004 [*] Move import `typing.List` out of type-checking blo | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from typing import TYPE_CHECKING 2 |+from typing import List 2 3 | @@ -21,4 +21,4 @@ TCH004_11.py:4:24: TCH004 [*] Move import `typing.List` out of type-checking blo 5 6 | 6 7 | __all__ = ("List",) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH004_12.py.snap index 8efe1fd384ac0..7af90db1f20ba 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_TCH004_12.py.snap @@ -11,7 +11,7 @@ TCH004_12.py:6:33: TCH004 [*] Move import `collections.abc.Callable` out of type | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from __future__ import annotations 2 2 | 3 3 | from typing import Any, TYPE_CHECKING, TypeAlias @@ -23,4 +23,4 @@ TCH004_12.py:6:33: TCH004 [*] Move import `collections.abc.Callable` out of type 7 8 | 8 9 | AnyCallable: TypeAlias = Callable[..., Any] - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH004_17.py.snap index 785c4c1d2e6c4..73af55628a674 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_TCH004_17.py.snap @@ -9,7 +9,7 @@ TCH004_17.py:6:24: TCH004 [*] Move import `pandas.DataFrame` out of type-checkin | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from __future__ import annotations 2 2 | 3 3 | from typing_extensions import TYPE_CHECKING @@ -22,4 +22,4 @@ TCH004_17.py:6:24: TCH004 [*] Move import `pandas.DataFrame` out of type-checkin 8 9 | 9 10 | def example() -> DataFrame: - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH004_2.py.snap index 7e49226762c46..f5508cbbc8a0c 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_TCH004_2.py.snap @@ -9,7 +9,7 @@ TCH004_2.py:4:26: TCH004 [*] Move import `datetime.date` out of type-checking bl | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from typing import TYPE_CHECKING 2 |+from datetime import date 2 3 | @@ -20,4 +20,4 @@ TCH004_2.py:4:26: TCH004 [*] Move import `datetime.date` out of type-checking bl 6 7 | 7 8 | def example(): - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH004_4.py.snap index aa464d7840a11..50dec6d3cb70e 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_TCH004_4.py.snap @@ -9,7 +9,7 @@ TCH004_4.py:4:24: TCH004 [*] Move import `typing.Any` out of type-checking block | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from typing import TYPE_CHECKING, Type 2 |+from typing import Any 2 3 | @@ -20,4 +20,4 @@ TCH004_4.py:4:24: TCH004 [*] Move import `typing.Any` out of type-checking block 6 7 | 7 8 | def example(*args: Any, **kwargs: Any): - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH004_5.py.snap index ff1e64f7b5304..12fc220651ff6 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_TCH004_5.py.snap @@ -9,7 +9,7 @@ TCH004_5.py:4:24: TCH004 [*] Move import `typing.List` out of type-checking bloc | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from typing import TYPE_CHECKING 2 |+from typing import List, Sequence, Set 2 3 | @@ -20,6 +20,8 @@ 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]): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TCH004_5.py:4:30: TCH004 [*] Move import `typing.Sequence` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: @@ -28,7 +30,7 @@ TCH004_5.py:4:30: TCH004 [*] Move import `typing.Sequence` out of type-checking | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from typing import TYPE_CHECKING 2 |+from typing import List, Sequence, Set 2 3 | @@ -39,6 +41,8 @@ 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]): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TCH004_5.py:4:40: TCH004 [*] Move import `typing.Set` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: @@ -47,7 +51,7 @@ TCH004_5.py:4:40: TCH004 [*] Move import `typing.Set` out of type-checking block | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from typing import TYPE_CHECKING 2 |+from typing import List, Sequence, Set 2 3 | @@ -58,4 +62,4 @@ TCH004_5.py:4:40: TCH004 [*] Move import `typing.Set` out of type-checking block 6 7 | 7 8 | def example(a: List[int], /, b: Sequence[int], *, c: Set[int]): - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH004_9.py.snap index 0c30f3a80053d..a16db3027fa31 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_TCH004_9.py.snap @@ -11,7 +11,7 @@ TCH004_9.py:4:24: TCH004 [*] Move import `typing.Tuple` out of type-checking blo | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from typing import TYPE_CHECKING 2 |+from typing import Tuple, List 2 3 | @@ -22,6 +22,8 @@ TCH004_9.py:4:24: TCH004 [*] Move import `typing.Tuple` out of type-checking blo 6 7 | x: Tuple 7 8 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TCH004_9.py:4:31: TCH004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: @@ -32,7 +34,7 @@ TCH004_9.py:4:31: TCH004 [*] Move import `typing.List` out of type-checking bloc | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from typing import TYPE_CHECKING 2 |+from typing import Tuple, List 2 3 | @@ -43,4 +45,4 @@ TCH004_9.py:4:31: TCH004 [*] Move import `typing.List` out of type-checking bloc 6 7 | x: Tuple 7 8 | - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 c09777853b97a..4cea005568adb 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 @@ -11,7 +11,7 @@ quote.py:64:28: TCH004 [*] Move import `pandas.DataFrame` out of type-checking b | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 1 |+from pandas import DataFrame 1 2 | def f(): 2 3 | from pandas import DataFrame @@ -26,4 +26,4 @@ quote.py:64:28: TCH004 [*] Move import `pandas.DataFrame` out of type-checking b 66 67 | def func(value: DataFrame): 67 68 | ... - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 e3174cb4546f4..a4b9b1ea9a6fa 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 @@ -10,7 +10,7 @@ runtime_evaluated_base_classes_1.py:10:12: TCH004 [*] Move import `datetime` out | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 5 5 | 6 6 | import pydantic 7 7 | from pydantic import BaseModel @@ -22,6 +22,8 @@ runtime_evaluated_base_classes_1.py:10:12: TCH004 [*] Move import `datetime` out 12 12 | 13 13 | import pandas # TCH004 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + 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. | 9 | if TYPE_CHECKING: @@ -33,7 +35,7 @@ runtime_evaluated_base_classes_1.py:11:23: TCH004 [*] Move import `array.array` | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 5 5 | 6 6 | import pydantic 7 7 | from pydantic import BaseModel @@ -46,6 +48,8 @@ runtime_evaluated_base_classes_1.py:11:23: TCH004 [*] Move import `array.array` 13 13 | import pandas # TCH004 14 14 | import pyproj + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + 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. | 11 | from array import array # TCH004 @@ -56,7 +60,7 @@ runtime_evaluated_base_classes_1.py:13:12: TCH004 [*] Move import `pandas` out o | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 5 5 | 6 6 | import pydantic 7 7 | from pydantic import BaseModel @@ -71,4 +75,4 @@ runtime_evaluated_base_classes_1.py:13:12: TCH004 [*] Move import `pandas` out o 15 15 | 16 16 | - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 d229203c36788..ac9054e400c64 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 @@ -10,7 +10,7 @@ runtime_evaluated_decorators_1.py:12:12: TCH004 [*] Move import `datetime` out o | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 7 7 | from attrs import frozen 8 8 | 9 9 | import numpy @@ -22,6 +22,8 @@ runtime_evaluated_decorators_1.py:12:12: TCH004 [*] Move import `datetime` out o 14 14 | 15 15 | import pandas # TCH004 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + 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. | 11 | if TYPE_CHECKING: @@ -33,7 +35,7 @@ runtime_evaluated_decorators_1.py:13:23: TCH004 [*] Move import `array.array` ou | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 7 7 | from attrs import frozen 8 8 | 9 9 | import numpy @@ -46,6 +48,8 @@ runtime_evaluated_decorators_1.py:13:23: TCH004 [*] Move import `array.array` ou 15 15 | import pandas # TCH004 16 16 | import pyproj + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + runtime_evaluated_decorators_1.py:15:12: TCH004 [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting. | 13 | from array import array # TCH004 @@ -56,7 +60,7 @@ runtime_evaluated_decorators_1.py:15:12: TCH004 [*] Move import `pandas` out of | = help: Move out of type-checking block -ℹ Unsafe fix +Suggested fix: 7 7 | from attrs import frozen 8 8 | 9 9 | import numpy @@ -71,4 +75,4 @@ runtime_evaluated_decorators_1.py:15:12: TCH004 [*] Move import `pandas` out of 17 17 | 18 18 | - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 64ba87ffb395b..1959d09fd9a9f 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 @@ -11,7 +11,7 @@ init_var.py:5:25: TCH003 [*] Move standard library import `dataclasses.FrozenIns | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | from __future__ import annotations 4 4 | @@ -26,6 +26,8 @@ init_var.py:5:25: TCH003 [*] Move standard library import `dataclasses.FrozenIns 8 12 | 9 13 | @dataclass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + init_var.py:6:21: TCH003 [*] Move standard library import `pathlib.Path` into a type-checking block | 5 | from dataclasses import FrozenInstanceError, InitVar, dataclass @@ -34,7 +36,7 @@ init_var.py:6:21: TCH003 [*] Move standard library import `pathlib.Path` into a | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 3 3 | from __future__ import annotations 4 4 | 5 5 | from dataclasses import FrozenInstanceError, InitVar, dataclass @@ -47,4 +49,4 @@ init_var.py:6:21: TCH003 [*] Move standard library import `pathlib.Path` into a 8 11 | 9 12 | @dataclass - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 99d8f413bb163..91a9ea6cec1aa 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 @@ -12,7 +12,7 @@ strict.py:27:21: TCH002 [*] Move third-party import `pkg.A` into a type-checking | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from __future__ import annotations 2 |+from typing import TYPE_CHECKING 3 |+ @@ -30,6 +30,8 @@ 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() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + strict.py:35:21: TCH002 [*] Move third-party import `pkg.A` into a type-checking block | 33 | def f(): @@ -41,7 +43,7 @@ strict.py:35:21: TCH002 [*] Move third-party import `pkg.A` into a type-checking | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from __future__ import annotations 2 |+from typing import TYPE_CHECKING 3 |+ @@ -60,6 +62,8 @@ 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() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + strict.py:54:25: TCH002 [*] 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 @@ -71,7 +75,7 @@ strict.py:54:25: TCH002 [*] Move third-party import `pkg.bar.A` into a type-chec | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from __future__ import annotations 2 |+from typing import TYPE_CHECKING 3 |+ @@ -89,6 +93,8 @@ 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() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + strict.py:62:12: TCH002 [*] Move third-party import `pkg` into a type-checking block | 60 | def f(): @@ -99,7 +105,7 @@ strict.py:62:12: TCH002 [*] Move third-party import `pkg` into a type-checking b | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from __future__ import annotations 2 |+from typing import TYPE_CHECKING 3 |+ @@ -117,6 +123,8 @@ strict.py:62:12: TCH002 [*] Move third-party import `pkg` into a type-checking b 64 67 | 65 68 | def test(value: pkg.A): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + strict.py:71:23: TCH002 [*] Move third-party import `pkg.foo` into a type-checking block | 69 | def f(): @@ -127,7 +135,7 @@ strict.py:71:23: TCH002 [*] Move third-party import `pkg.foo` into a type-checki | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from __future__ import annotations 2 |+from typing import TYPE_CHECKING 3 |+ @@ -145,6 +153,8 @@ strict.py:71:23: TCH002 [*] Move third-party import `pkg.foo` into a type-checki 73 76 | 74 77 | def test(value: F.Foo): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + strict.py:80:12: TCH002 [*] Move third-party import `pkg` into a type-checking block | 78 | def f(): @@ -155,7 +165,7 @@ strict.py:80:12: TCH002 [*] Move third-party import `pkg` into a type-checking b | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from __future__ import annotations 2 |+from typing import TYPE_CHECKING 3 |+ @@ -173,6 +183,8 @@ strict.py:80:12: TCH002 [*] Move third-party import `pkg` into a type-checking b 82 85 | 83 86 | def test(value: pkg.A): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + strict.py:91:12: TCH002 [*] 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 @@ -183,7 +195,7 @@ strict.py:91:12: TCH002 [*] Move third-party import `pkg` into a type-checking b | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from __future__ import annotations 2 |+from typing import TYPE_CHECKING 3 |+ @@ -201,6 +213,8 @@ strict.py:91:12: TCH002 [*] Move third-party import `pkg` into a type-checking b 93 96 | 94 97 | def test(value: pkg.A): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + strict.py:101:23: TCH002 [*] 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. @@ -212,7 +226,7 @@ strict.py:101:23: TCH002 [*] Move third-party import `pkg.foo` into a type-check | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from __future__ import annotations 2 |+from typing import TYPE_CHECKING 3 |+ @@ -230,4 +244,4 @@ strict.py:101:23: TCH002 [*] Move third-party import `pkg.foo` into a type-check 103 106 | def test(value: F.Foo): 104 107 | return B.Bar() - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 da83b1545fffa..129ae2da26633 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 @@ -12,7 +12,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | from typing import TYPE_CHECKING 5 5 | @@ -25,4 +25,4 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 9 11 | pass 10 12 | - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 0cd80a368e5f1..2c0f22ef3bf52 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 @@ -12,7 +12,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | from typing import TYPE_CHECKING 5 5 | @@ -25,4 +25,4 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 11 11 | 12 12 | def f(x: pd.DataFrame): - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 c79f7c9e53dca..546c564a53433 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 @@ -12,7 +12,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | from typing import TYPE_CHECKING 5 5 | @@ -24,4 +24,4 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 10 9 | def f(x: pd.DataFrame): 11 10 | pass - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 bf141729eb56b..9b836444bd6f2 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 @@ -12,7 +12,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | from typing import TYPE_CHECKING 5 5 | @@ -24,4 +24,4 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 10 10 | 11 11 | def f(x: pd.DataFrame): - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH001.py.snap index 2c086380af453..2276cd8fb1b61 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_TCH001.py.snap @@ -11,7 +11,7 @@ TCH001.py:20:19: TCH001 [*] Move application import `.TYP001` into a type-checki | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | For typing-only import detection tests, see `TCH002.py`. 4 4 | """ @@ -31,4 +31,4 @@ TCH001.py:20:19: TCH001 [*] Move application import `.TYP001` into a type-checki 22 25 | x: TYP001 23 26 | - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH003.py.snap index a5016892c3fb2..4d1905ee38216 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_TCH003.py.snap @@ -11,7 +11,7 @@ TCH003.py:8:12: TCH003 [*] Move standard library import `os` into a type-checkin | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | For typing-only import detection tests, see `TCH002.py`. 4 4 | """ @@ -27,4 +27,4 @@ TCH003.py:8:12: TCH003 [*] Move standard library import `os` into a type-checkin 10 13 | x: os 11 14 | - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 ca63f50e1fc0b..2405e054d5b98 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 @@ -12,7 +12,7 @@ exempt_type_checking_1.py:5:20: TCH003 [*] Move standard library import `typing. | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | from __future__ import annotations 4 4 | @@ -24,4 +24,4 @@ exempt_type_checking_1.py:5:20: TCH003 [*] Move standard library import `typing. 6 9 | 7 10 | Const: Final[dict] = {} - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 82d27250c6c6a..68a1dd7d54125 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 @@ -12,7 +12,7 @@ exempt_type_checking_2.py:5:20: TCH003 [*] Move standard library import `typing. | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | from __future__ import annotations 4 4 | @@ -24,4 +24,4 @@ exempt_type_checking_2.py:5:20: TCH003 [*] Move standard library import `typing. 6 9 | 7 10 | Const: Final[dict] = {} - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 18b9b569ecd34..f5a6129e29d00 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 @@ -12,7 +12,7 @@ exempt_type_checking_3.py:5:20: TCH003 [*] Move standard library import `typing. | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | from __future__ import annotations 4 4 | @@ -25,4 +25,4 @@ exempt_type_checking_3.py:5:20: TCH003 [*] Move standard library import `typing. 6 10 | 7 11 | Const: Final[dict] = {} - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 08a45c92e134c..851b06c17b036 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 @@ -9,7 +9,7 @@ init_var.py:6:21: TCH003 [*] Move standard library import `pathlib.Path` into a | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 3 3 | from __future__ import annotations 4 4 | 5 5 | from dataclasses import FrozenInstanceError, InitVar, dataclass @@ -22,4 +22,4 @@ init_var.py:6:21: TCH003 [*] Move standard library import `pathlib.Path` into a 8 11 | 9 12 | @dataclass - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 b7f049eaa86ff..de5a9702f940f 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 @@ -10,7 +10,7 @@ undefined.py:3:29: TCH003 [*] Move standard library import `collections.abc.Sequ | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from __future__ import annotations 2 2 | 3 |-from collections.abc import Sequence @@ -22,4 +22,4 @@ undefined.py:3:29: TCH003 [*] Move standard library import `collections.abc.Sequ 5 8 | 6 9 | class Foo(MyBaseClass): - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 7eb6ba98775d0..dce3a5debf501 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 @@ -12,7 +12,7 @@ runtime_evaluated_base_classes_3.py:5:18: TCH003 [*] Move standard library impor | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | import datetime 4 4 | import pathlib @@ -28,4 +28,4 @@ runtime_evaluated_base_classes_3.py:5:18: TCH003 [*] Move standard library impor 10 13 | 11 14 | class A(pydantic.BaseModel): - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 618928099681a..24ac0605bc195 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 @@ -12,7 +12,7 @@ runtime_evaluated_decorators_3.py:6:18: TCH003 [*] Move standard library import | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 3 3 | import datetime 4 4 | from array import array 5 5 | from dataclasses import dataclass @@ -30,4 +30,4 @@ runtime_evaluated_decorators_3.py:6:18: TCH003 [*] Move standard library import 13 16 | 14 17 | @attrs.define(auto_attribs=True) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH002.py.snap index 7d8365daa6ef9..aa737e9292516 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_TCH002.py.snap @@ -11,7 +11,7 @@ TCH002.py:5:22: TCH002 [*] Move third-party import `pandas` into a type-checking | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | """Tests to determine accurate detection of typing-only imports.""" 2 |+from typing import TYPE_CHECKING 3 |+ @@ -25,6 +25,8 @@ TCH002.py:5:22: TCH002 [*] Move third-party import `pandas` into a type-checking 7 10 | x: pd.DataFrame 8 11 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TCH002.py:11:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 10 | def f(): @@ -35,7 +37,7 @@ TCH002.py:11:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | """Tests to determine accurate detection of typing-only imports.""" 2 |+from typing import TYPE_CHECKING 3 |+ @@ -53,6 +55,8 @@ TCH002.py:11:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty 13 16 | x: DataFrame 14 17 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TCH002.py:17:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 16 | def f(): @@ -63,7 +67,7 @@ TCH002.py:17:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | """Tests to determine accurate detection of typing-only imports.""" 2 |+from typing import TYPE_CHECKING 3 |+ @@ -81,6 +85,8 @@ TCH002.py:17:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty 19 22 | x: df 20 23 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TCH002.py:23:22: TCH002 [*] Move third-party import `pandas` into a type-checking block | 22 | def f(): @@ -91,7 +97,7 @@ TCH002.py:23:22: TCH002 [*] Move third-party import `pandas` into a type-checkin | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | """Tests to determine accurate detection of typing-only imports.""" 2 |+from typing import TYPE_CHECKING 3 |+ @@ -109,6 +115,8 @@ TCH002.py:23:22: TCH002 [*] Move third-party import `pandas` into a type-checkin 25 28 | x: pd.DataFrame = 1 26 29 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TCH002.py:29:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 28 | def f(): @@ -119,7 +127,7 @@ TCH002.py:29:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | """Tests to determine accurate detection of typing-only imports.""" 2 |+from typing import TYPE_CHECKING 3 |+ @@ -137,6 +145,8 @@ TCH002.py:29:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty 31 34 | x: DataFrame = 2 32 35 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TCH002.py:35:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 34 | def f(): @@ -147,7 +157,7 @@ TCH002.py:35:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | """Tests to determine accurate detection of typing-only imports.""" 2 |+from typing import TYPE_CHECKING 3 |+ @@ -165,6 +175,8 @@ TCH002.py:35:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty 37 40 | x: df = 3 38 41 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TCH002.py:41:22: TCH002 [*] Move third-party import `pandas` into a type-checking block | 40 | def f(): @@ -175,7 +187,7 @@ TCH002.py:41:22: TCH002 [*] Move third-party import `pandas` into a type-checkin | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | """Tests to determine accurate detection of typing-only imports.""" 2 |+from typing import TYPE_CHECKING 3 |+ @@ -193,6 +205,8 @@ TCH002.py:41:22: TCH002 [*] Move third-party import `pandas` into a type-checkin 43 46 | x: "pd.DataFrame" = 1 44 47 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TCH002.py:47:22: TCH002 [*] Move third-party import `pandas` into a type-checking block | 46 | def f(): @@ -203,7 +217,7 @@ TCH002.py:47:22: TCH002 [*] Move third-party import `pandas` into a type-checkin | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | """Tests to determine accurate detection of typing-only imports.""" 2 |+from typing import TYPE_CHECKING 3 |+ @@ -221,6 +235,8 @@ TCH002.py:47:22: TCH002 [*] Move third-party import `pandas` into a type-checkin 49 52 | x = dict["pd.DataFrame", "pd.DataFrame"] 50 53 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TCH002.py:172:24: TCH002 [*] Move third-party import `module.Member` into a type-checking block | 170 | global Member @@ -232,7 +248,7 @@ TCH002.py:172:24: TCH002 [*] Move third-party import `module.Member` into a type | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | """Tests to determine accurate detection of typing-only imports.""" 2 |+from typing import TYPE_CHECKING 3 |+ @@ -250,4 +266,4 @@ TCH002.py:172:24: TCH002 [*] Move third-party import `module.Member` into a type 174 177 | x: Member = 1 175 178 | - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 fdefb73be5917..52b8c97c5ab8e 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 @@ -12,7 +12,7 @@ runtime_evaluated_base_classes_2.py:3:21: TCH002 [*] Move third-party import `ge | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from __future__ import annotations 2 2 | 3 |-import geopandas as gpd # TCH002 @@ -29,6 +29,8 @@ runtime_evaluated_base_classes_2.py:3:21: TCH002 [*] Move third-party import `ge 10 13 | 11 14 | class A(BaseModel): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + runtime_evaluated_base_classes_2.py:5:8: TCH002 [*] Move third-party import `pyproj` into a type-checking block | 3 | import geopandas as gpd # TCH002 @@ -39,7 +41,7 @@ runtime_evaluated_base_classes_2.py:5:8: TCH002 [*] Move third-party import `pyp | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | import geopandas as gpd # TCH002 4 4 | import pydantic @@ -55,4 +57,4 @@ runtime_evaluated_base_classes_2.py:5:8: TCH002 [*] Move third-party import `pyp 10 13 | 11 14 | class A(BaseModel): - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 518edf55aac37..bc89020033dd8 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 @@ -10,7 +10,7 @@ runtime_evaluated_decorators_2.py:10:8: TCH002 [*] Move third-party import `nump | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 7 7 | import pyproj 8 8 | from attrs import frozen 9 9 | @@ -23,4 +23,4 @@ runtime_evaluated_decorators_2.py:10:8: TCH002 [*] Move third-party import `nump 12 15 | 13 16 | @attrs.define(auto_attribs=True) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 4ff84f8f0f66e..61f1f587dee7b 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 @@ -12,7 +12,7 @@ singledispatch.py:11:20: TCH002 [*] Move third-party import `pandas.DataFrame` i | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 8 8 | from numpy import asarray 9 9 | from numpy.typing import ArrayLike 10 10 | from scipy.sparse import spmatrix @@ -22,4 +22,6 @@ singledispatch.py:11:20: TCH002 [*] Move third-party import `pandas.DataFrame` i 13 |+ from pandas import DataFrame 14 14 | from numpy import ndarray 15 15 | -16 16 | +16 16 | + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 f9d6240613db2..92ee26e3f783a 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 @@ -12,7 +12,7 @@ strict.py:54:25: TCH002 [*] Move third-party import `pkg.bar.A` into a type-chec | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from __future__ import annotations 2 |+from typing import TYPE_CHECKING 3 |+ @@ -30,6 +30,8 @@ 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() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + strict.py:91:12: TCH002 [*] 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 @@ -40,7 +42,7 @@ strict.py:91:12: TCH002 [*] Move third-party import `pkg` into a type-checking b | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from __future__ import annotations 2 |+from typing import TYPE_CHECKING 3 |+ @@ -58,4 +60,4 @@ strict.py:91:12: TCH002 [*] Move third-party import `pkg` into a type-checking b 93 96 | 94 97 | def test(value: pkg.A): - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 3e758fc6c110d..cca8506b98b07 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 @@ -11,7 +11,7 @@ typing_modules_1.py:7:24: TCH002 [*] Move third-party import `pandas.DataFrame` | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | from __future__ import annotations 2 2 | 3 3 | from typing_extensions import Self @@ -26,4 +26,4 @@ typing_modules_1.py:7:24: TCH002 [*] Move third-party import `pandas.DataFrame` 8 11 | 9 12 | df: DataFrame - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 820be3f860f27..c7a1da09e072c 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 @@ -11,7 +11,7 @@ typing_modules_2.py:7:24: TCH002 [*] Move third-party import `pandas.DataFrame` | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | import typing_extensions 4 4 | @@ -24,4 +24,4 @@ typing_modules_2.py:7:24: TCH002 [*] Move third-party import `pandas.DataFrame` 8 10 | 9 11 | df: DataFrame - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 d8f9298f51c31..d797207786ab3 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 @@ -12,7 +12,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 1 1 | 2 2 | from __future__ import annotations 3 3 | @@ -26,4 +26,4 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 8 10 | def f(x: pd.DataFrame): 9 11 | pass - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 d939819ed6214..d78c6f052e438 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 @@ -12,7 +12,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs | = help: Move into type-checking block -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | from typing import TYPE_CHECKING 5 5 | @@ -24,4 +24,4 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 8 10 | def f(x: pd.DataFrame): 9 11 | pass - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH201_PTH201.py.snap b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH201_PTH201.py.snap index 045e8c733ec8c..c5b59258bbeac 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH201_PTH201.py.snap +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/snapshots/ruff_linter__rules__flake8_use_pathlib__tests__PTH201_PTH201.py.snap @@ -11,7 +11,7 @@ PTH201.py:5:10: PTH201 [*] Do not pass the current directory explicitly to `Path | = help: Remove the current directory argument -ℹ Safe fix +Suggested fix: 2 2 | from pathlib import Path as pth 3 3 | 4 4 | # match @@ -21,6 +21,8 @@ PTH201.py:5:10: PTH201 [*] Do not pass the current directory explicitly to `Path 7 7 | _ = PurePath(".") 8 8 | _ = Path("") + Run `ruff check --fix` to apply this fix. + PTH201.py:6:9: PTH201 [*] Do not pass the current directory explicitly to `Path` | 4 | # match @@ -32,7 +34,7 @@ PTH201.py:6:9: PTH201 [*] Do not pass the current directory explicitly to `Path` | = help: Remove the current directory argument -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | # match 5 5 | _ = Path(".") @@ -42,6 +44,8 @@ PTH201.py:6:9: PTH201 [*] Do not pass the current directory explicitly to `Path` 8 8 | _ = Path("") 9 9 | + Run `ruff check --fix` to apply this fix. + PTH201.py:7:14: PTH201 [*] Do not pass the current directory explicitly to `Path` | 5 | _ = Path(".") @@ -52,7 +56,7 @@ PTH201.py:7:14: PTH201 [*] Do not pass the current directory explicitly to `Path | = help: Remove the current directory argument -ℹ Safe fix +Suggested fix: 4 4 | # match 5 5 | _ = Path(".") 6 6 | _ = pth(".") @@ -62,6 +66,8 @@ PTH201.py:7:14: PTH201 [*] Do not pass the current directory explicitly to `Path 9 9 | 10 10 | # no match + Run `ruff check --fix` to apply this fix. + PTH201.py:8:10: PTH201 [*] Do not pass the current directory explicitly to `Path` | 6 | _ = pth(".") @@ -73,7 +79,7 @@ PTH201.py:8:10: PTH201 [*] Do not pass the current directory explicitly to `Path | = help: Remove the current directory argument -ℹ Safe fix +Suggested fix: 5 5 | _ = Path(".") 6 6 | _ = pth(".") 7 7 | _ = PurePath(".") @@ -83,4 +89,4 @@ PTH201.py:8:10: PTH201 [*] Do not pass the current directory explicitly to `Path 10 10 | # no match 11 11 | _ = Path() - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap b/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap index 5d531d603b2ab..cfec265be1e10 100644 --- a/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap +++ b/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap @@ -11,7 +11,7 @@ FLY002.py:5:7: FLY002 [*] Consider `f"{a} World"` instead of string join | = help: Replace with `f"{a} World"` -ℹ Unsafe fix +Suggested fix: 2 2 | from random import random, choice 3 3 | 4 4 | a = "Hello" @@ -21,6 +21,8 @@ FLY002.py:5:7: FLY002 [*] Consider `f"{a} World"` instead of string join 7 7 | ok3 = "x".join(("1", "2", "3")) # OK 8 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FLY002.py:6:7: FLY002 [*] Consider `f"Finally, {a} World"` instead of string join | 4 | a = "Hello" @@ -32,7 +34,7 @@ FLY002.py:6:7: FLY002 [*] Consider `f"Finally, {a} World"` instead of string joi | = help: Replace with `f"Finally, {a} World"` -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | a = "Hello" 5 5 | ok1 = " ".join([a, " World"]) # OK @@ -42,6 +44,8 @@ FLY002.py:6:7: FLY002 [*] Consider `f"Finally, {a} World"` instead of string joi 8 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally 9 9 | ok5 = "a".join([random(), random()]) # OK (simple calls) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FLY002.py:7:7: FLY002 [*] Consider `"1x2x3"` instead of string join | 5 | ok1 = " ".join([a, " World"]) # OK @@ -53,7 +57,7 @@ FLY002.py:7:7: FLY002 [*] Consider `"1x2x3"` instead of string join | = help: Replace with `"1x2x3"` -ℹ Unsafe fix +Suggested fix: 4 4 | a = "Hello" 5 5 | ok1 = " ".join([a, " World"]) # OK 6 6 | ok2 = "".join(["Finally, ", a, " World"]) # OK @@ -63,6 +67,8 @@ FLY002.py:7:7: FLY002 [*] Consider `"1x2x3"` instead of string join 9 9 | ok5 = "a".join([random(), random()]) # OK (simple calls) 10 10 | ok6 = "a".join([secrets.token_urlsafe(), secrets.token_hex()]) # OK (attr calls) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FLY002.py:8:7: FLY002 [*] Consider `f"{1}y{2}y{3}"` instead of string join | 6 | ok2 = "".join(["Finally, ", a, " World"]) # OK @@ -74,7 +80,7 @@ FLY002.py:8:7: FLY002 [*] Consider `f"{1}y{2}y{3}"` instead of string join | = help: Replace with `f"{1}y{2}y{3}"` -ℹ Unsafe fix +Suggested fix: 5 5 | ok1 = " ".join([a, " World"]) # OK 6 6 | ok2 = "".join(["Finally, ", a, " World"]) # OK 7 7 | ok3 = "x".join(("1", "2", "3")) # OK @@ -84,6 +90,8 @@ FLY002.py:8:7: FLY002 [*] Consider `f"{1}y{2}y{3}"` instead of string join 10 10 | ok6 = "a".join([secrets.token_urlsafe(), secrets.token_hex()]) # OK (attr calls) 11 11 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FLY002.py:9:7: FLY002 [*] Consider `f"{random()}a{random()}"` instead of string join | 7 | ok3 = "x".join(("1", "2", "3")) # OK @@ -94,7 +102,7 @@ FLY002.py:9:7: FLY002 [*] Consider `f"{random()}a{random()}"` instead of string | = help: Replace with `f"{random()}a{random()}"` -ℹ Unsafe fix +Suggested fix: 6 6 | ok2 = "".join(["Finally, ", a, " World"]) # OK 7 7 | ok3 = "x".join(("1", "2", "3")) # OK 8 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally @@ -104,6 +112,8 @@ FLY002.py:9:7: FLY002 [*] Consider `f"{random()}a{random()}"` instead of string 11 11 | 12 12 | nok1 = "x".join({"4", "5", "yee"}) # Not OK (set) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FLY002.py:10:7: FLY002 [*] Consider `f"{secrets.token_urlsafe()}a{secrets.token_hex()}"` instead of string join | 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally @@ -115,7 +125,7 @@ FLY002.py:10:7: FLY002 [*] Consider `f"{secrets.token_urlsafe()}a{secrets.token_ | = help: Replace with `f"{secrets.token_urlsafe()}a{secrets.token_hex()}"` -ℹ Unsafe fix +Suggested fix: 7 7 | ok3 = "x".join(("1", "2", "3")) # OK 8 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally 9 9 | ok5 = "a".join([random(), random()]) # OK (simple calls) @@ -125,6 +135,8 @@ FLY002.py:10:7: FLY002 [*] Consider `f"{secrets.token_urlsafe()}a{secrets.token_ 12 12 | nok1 = "x".join({"4", "5", "yee"}) # Not OK (set) 13 13 | nok2 = a.join(["1", "2", "3"]) # Not OK (not a static joiner) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FLY002.py:23:11: FLY002 [*] Consider `f"{url}{filename}"` instead of string join | 21 | # Regression test for: https://github.com/astral-sh/ruff/issues/7197 @@ -134,11 +146,11 @@ FLY002.py:23:11: FLY002 [*] Consider `f"{url}{filename}"` instead of string join | = help: Replace with `f"{url}{filename}"` -ℹ Unsafe fix +Suggested fix: 20 20 | 21 21 | # Regression test for: https://github.com/astral-sh/ruff/issues/7197 22 22 | def create_file_public_url(url, filename): 23 |- return''.join([url, filename]) 23 |+ return f"{url}{filename}" - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__1_separate_subpackage_first_and_third_party_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__1_separate_subpackage_first_and_third_party_imports.py.snap index 68c6ab87ddf01..b827c934b684c 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__1_separate_subpackage_first_and_third_party_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__1_separate_subpackage_first_and_third_party_imports.py.snap @@ -14,7 +14,7 @@ separate_subpackage_first_and_third_party_imports.py:1:1: I001 [*] Import block | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import sys 2 |+ 3 |+import foo @@ -30,4 +30,4 @@ separate_subpackage_first_and_third_party_imports.py:1:1: I001 [*] Import block 7 |-import foo.bar 8 |-import foo.bar.baz - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__2_separate_subpackage_first_and_third_party_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__2_separate_subpackage_first_and_third_party_imports.py.snap index 26039b8c93453..20e514625c0cf 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__2_separate_subpackage_first_and_third_party_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__2_separate_subpackage_first_and_third_party_imports.py.snap @@ -14,7 +14,7 @@ separate_subpackage_first_and_third_party_imports.py:1:1: I001 [*] Import block | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import sys 2 |+ 2 3 | import baz @@ -29,4 +29,4 @@ separate_subpackage_first_and_third_party_imports.py:1:1: I001 [*] Import block 8 |-import foo.bar.baz 10 |+from foo import bar, baz - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__add_newline_before_comments.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__add_newline_before_comments.py.snap index 95cca1454b583..77815fa52bef2 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__add_newline_before_comments.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__add_newline_before_comments.py.snap @@ -13,7 +13,7 @@ add_newline_before_comments.py:1:1: I001 [*] Import block is un-sorted or un-for | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import os 2 |+ 2 3 | # This is a comment in the same section, so we need to add one newline. @@ -25,4 +25,4 @@ add_newline_before_comments.py:1:1: I001 [*] Import block is un-sorted or un-for 6 9 | # before it. 7 10 | import leading_prefix - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__as_imports_comments.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__as_imports_comments.py.snap index 4866de74a682e..57643a869aad9 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__as_imports_comments.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__as_imports_comments.py.snap @@ -21,7 +21,7 @@ as_imports_comments.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from foo import ( # Comment on `foo` 2 |- Member as Alias, # Comment on `Alias` 3 |-) @@ -41,3 +41,5 @@ as_imports_comments.py:1:1: I001 [*] Import block is un-sorted or un-formatted 6 |+from foo import ( # Comment on `foo` 7 |+ Member as Alias, # Comment on `Alias` 15 8 | ) + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__bom_unsorted.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__bom_unsorted.py.snap index d9c75d398f75b..03edae02e7aa5 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__bom_unsorted.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__bom_unsorted.py.snap @@ -9,8 +9,10 @@ bom_unsorted.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-import foo 2 |-import bar 1 |+import bar 2 |+import foo + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__case_sensitive_case_sensitive.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__case_sensitive_case_sensitive.py.snap index 1374bd787f733..ce65b219c5b8e 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__case_sensitive_case_sensitive.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__case_sensitive_case_sensitive.py.snap @@ -15,7 +15,7 @@ case_sensitive.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import A 2 2 | import B 3 |+import C @@ -30,4 +30,4 @@ case_sensitive.py:1:1: I001 [*] Import block is un-sorted or un-formatted 8 |+from g import B, a, c 9 |+from h import A, C, b - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__closest_to_furthest_relative_imports_order.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__closest_to_furthest_relative_imports_order.py.snap index 3c554a7eed595..3d71ebababcc8 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__closest_to_furthest_relative_imports_order.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__closest_to_furthest_relative_imports_order.py.snap @@ -9,11 +9,11 @@ relative_imports_order.py:1:1: I001 [*] Import block is un-sorted or un-formatte | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+from . import c 2 |+from .. import b 1 3 | from ... import a 2 |-from .. import b 3 |-from . import c - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_as_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_as_imports.py.snap index 7888f59e11d85..f9c77cac41ca6 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_as_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_as_imports.py.snap @@ -10,11 +10,11 @@ combine_as_imports.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+from module import CONSTANT, function 1 2 | from module import Class as C 2 |-from module import CONSTANT 3 |-from module import function 4 3 | from module import function as f - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_as_imports_combine_as_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_as_imports_combine_as_imports.py.snap index 0ec3437a37641..be8a3359a599e 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_as_imports_combine_as_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_as_imports_combine_as_imports.py.snap @@ -10,11 +10,11 @@ combine_as_imports.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from module import Class as C 2 |-from module import CONSTANT 3 |-from module import function 4 |-from module import function as f 1 |+from module import CONSTANT, Class as C, function, function as f - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_import_from.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_import_from.py.snap index b5783de363867..a6c861f25efe5 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_import_from.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__combine_import_from.py.snap @@ -11,7 +11,7 @@ combine_import_from.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from collections import Awaitable 2 |-from collections import AsyncIterable 3 |-from collections import Collection @@ -26,4 +26,4 @@ combine_import_from.py:1:1: I001 [*] Import block is un-sorted or un-formatted 7 |+ MutableSequence, 8 |+) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__comments.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__comments.py.snap index 133ac942147ba..c671d6ca48c3e 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__comments.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__comments.py.snap @@ -39,7 +39,7 @@ comments.py:3:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | # Comment 1 2 2 | # Comment 2 3 |-import D @@ -86,4 +86,4 @@ comments.py:3:1: I001 [*] Import block is un-sorted or un-formatted 24 |+ b, 25 |+) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__deduplicate_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__deduplicate_imports.py.snap index 4ec8ce1b51b52..1514a88406bbf 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__deduplicate_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__deduplicate_imports.py.snap @@ -10,10 +10,10 @@ deduplicate_imports.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import os 2 |-import os 3 2 | import os as os1 4 3 | import os as os2 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__detect_same_package.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__detect_same_package.snap index 25d20bc8a59bd..53156cbdc9c93 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__detect_same_package.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__detect_same_package.snap @@ -9,11 +9,11 @@ bar.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import os 2 |+ 2 3 | import pandas 4 |+ 3 5 | import foo.baz - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__fit_line_length.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__fit_line_length.py.snap index e6ea05b4e429c..9199e4258e20d 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__fit_line_length.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__fit_line_length.py.snap @@ -15,7 +15,7 @@ fit_line_length.py:7:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | if indented: 7 7 | from line_with_88 import aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa @@ -39,4 +39,4 @@ fit_line_length.py:7:1: I001 [*] Import block is un-sorted or un-formatted 13 21 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, 14 22 | ) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__fit_line_length_comment.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__fit_line_length_comment.py.snap index 5efdf7d3216fb..72f1534668a57 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__fit_line_length_comment.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__fit_line_length_comment.py.snap @@ -14,7 +14,7 @@ fit_line_length_comment.py:1:1: I001 [*] Import block is un-sorted or un-formatt | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import a 2 |+ 2 3 | # Don't take this comment into account when determining whether the next import can fit on one line. @@ -33,4 +33,4 @@ fit_line_length_comment.py:1:1: I001 [*] Import block is un-sorted or un-formatt 14 |+ i, # 012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9 15 |+) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_single_line_force_single_line.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_single_line_force_single_line.py.snap index b7fa34f0e2562..3598fe30eee6a 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_single_line_force_single_line.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_single_line_force_single_line.py.snap @@ -33,7 +33,7 @@ force_single_line.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-import sys, math 2 |-from os import path, uname 1 |+import math @@ -82,4 +82,4 @@ force_single_line.py:1:1: I001 [*] Import block is un-sorted or un-formatted 30 |+from third_party import lib6 31 |+from third_party import lib7 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections.py.snap index 43ecebee2265d..361bdeecbe6f0 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections.py.snap @@ -19,7 +19,7 @@ force_sort_within_sections.py:1:1: I001 [*] Import block is un-sorted or un-form | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from a import a1 # import_from 2 |-from c import * # import_from_star 3 1 | import a # import @@ -40,4 +40,4 @@ force_sort_within_sections.py:1:1: I001 [*] Import block is un-sorted or un-form 12 13 | from .my.nested import fn2 13 |-from ...grandparent import fn3 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections.py.snap index 412d6f38862d5..42ea9b513f2d7 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections.py.snap @@ -19,7 +19,7 @@ force_sort_within_sections.py:1:1: I001 [*] Import block is un-sorted or un-form | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from a import a1 # import_from 2 |-from c import * # import_from_star 1 |+import z @@ -41,4 +41,4 @@ force_sort_within_sections.py:1:1: I001 [*] Import block is un-sorted or un-form 12 13 | from .my.nested import fn2 13 |-from ...grandparent import fn3 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections_future.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections_future.py.snap index 6864d488b75ed..6dd06bca53786 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections_future.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections_future.py.snap @@ -8,9 +8,9 @@ force_sort_within_sections_future.py:1:1: I001 [*] Import block is un-sorted or | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+from __future__ import annotations 1 2 | import __future__ 2 |-from __future__ import annotations - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections_with_as_names.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections_with_as_names.py.snap index b14f52ac659df..8b6b14f19dc25 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections_with_as_names.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_sort_within_sections_force_sort_within_sections_with_as_names.py.snap @@ -11,7 +11,7 @@ force_sort_within_sections_with_as_names.py:1:1: I001 [*] Import block is un-sor | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+import datetime 2 |+import datetime as dt 3 |+from datetime import timedelta @@ -22,4 +22,4 @@ force_sort_within_sections_with_as_names.py:1:1: I001 [*] Import block is un-sor 4 |-import datetime as dt 5 |-import datetime - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_to_top.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_to_top.py.snap index eccb76bc9efff..8aeae1adb2962 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_to_top.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_to_top.py.snap @@ -29,7 +29,7 @@ force_to_top.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-import lib6 1 |+import foo 2 |+import lib1 @@ -64,4 +64,4 @@ force_to_top.py:1:1: I001 [*] Import block is un-sorted or un-formatted 18 |+from lib4 import lib1, lib2 19 |+from lib5 import lib1, lib2 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_to_top_force_to_top.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_to_top_force_to_top.py.snap index eb5678616bfb2..fcd75ebfef7fd 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_to_top_force_to_top.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_to_top_force_to_top.py.snap @@ -29,7 +29,7 @@ force_to_top.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-import lib6 2 |-import lib2 3 |-import lib5 @@ -67,4 +67,4 @@ force_to_top.py:1:1: I001 [*] Import block is un-sorted or un-formatted 23 18 | from lib3.lib4.lib5 import foo 19 |+from lib4 import lib1, lib2 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_wrap_aliases.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_wrap_aliases.py.snap index e19ca4942bfb8..8be20359f8298 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_wrap_aliases.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_wrap_aliases.py.snap @@ -9,11 +9,11 @@ force_wrap_aliases.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from .a import a1 as a1, a2 as a2 1 |+from .a import a1 as a1 2 |+from .a import a2 as a2 2 3 | from .b import b1 as b1 3 4 | from .c import c1 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_wrap_aliases_force_wrap_aliases.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_wrap_aliases_force_wrap_aliases.py.snap index d59c8a13d1e20..7df3964c8afc1 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_wrap_aliases_force_wrap_aliases.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__force_wrap_aliases_force_wrap_aliases.py.snap @@ -9,7 +9,7 @@ force_wrap_aliases.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from .a import a1 as a1, a2 as a2 1 |+from .a import ( 2 |+ a1 as a1, @@ -18,4 +18,4 @@ force_wrap_aliases.py:1:1: I001 [*] Import block is un-sorted or un-formatted 2 5 | from .b import b1 as b1 3 6 | from .c import c1 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__forced_separate.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__forced_separate.py.snap index ad410b015c2ec..9fa3ce317b00a 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__forced_separate.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__forced_separate.py.snap @@ -14,7 +14,7 @@ forced_separate.py:3:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | # office_helper and tests are both first-party, 2 2 | # but we want tests and experiments to be separated, in that order 3 |+from office_helper.assistants import entity_registry as er @@ -27,4 +27,4 @@ forced_separate.py:3:1: I001 [*] Import block is un-sorted or un-formatted 7 10 | from experiments.weird import varieties 8 |-from office_helper.assistants import entity_registry as er - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__future_from.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__future_from.py.snap index f3f5cd2a3574d..6d6e0317f0d27 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__future_from.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__future_from.py.snap @@ -8,9 +8,9 @@ future_from.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+from __future__ import annotations 1 2 | import __future__ 2 |-from __future__ import annotations - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__glob_1_separate_subpackage_first_and_third_party_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__glob_1_separate_subpackage_first_and_third_party_imports.py.snap index 68c6ab87ddf01..b827c934b684c 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__glob_1_separate_subpackage_first_and_third_party_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__glob_1_separate_subpackage_first_and_third_party_imports.py.snap @@ -14,7 +14,7 @@ separate_subpackage_first_and_third_party_imports.py:1:1: I001 [*] Import block | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import sys 2 |+ 3 |+import foo @@ -30,4 +30,4 @@ separate_subpackage_first_and_third_party_imports.py:1:1: I001 [*] Import block 7 |-import foo.bar 8 |-import foo.bar.baz - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__if_elif_else.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__if_elif_else.py.snap index 4a09c500c40be..f247ab1376475 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__if_elif_else.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__if_elif_else.py.snap @@ -10,7 +10,7 @@ if_elif_else.py:6:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 3 3 | elif "setuptools" in sys.modules: 4 4 | from setuptools.command.sdist import sdist as _sdist 5 5 | else: @@ -18,4 +18,4 @@ if_elif_else.py:6:1: I001 [*] Import block is un-sorted or un-formatted 6 7 | from setuptools.command.sdist import sdist as _sdist 7 |- from distutils.command.sdist import sdist as _sdist - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__import_from_after_import.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__import_from_after_import.py.snap index 09e2aa2a32542..8110bcca3ea55 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__import_from_after_import.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__import_from_after_import.py.snap @@ -8,9 +8,9 @@ import_from_after_import.py:1:1: I001 [*] Import block is un-sorted or un-format | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+import os 1 2 | from collections import Collection 2 |-import os - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__inline_comments.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__inline_comments.py.snap index bc6a07f6581b5..a486457d22e7d 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__inline_comments.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__inline_comments.py.snap @@ -17,7 +17,7 @@ inline_comments.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | from a.prometheus.metrics import ( # type:ignore[attr-defined] 2 2 | TERMINAL_CURRENTLY_RUNNING_TOTAL, 3 3 | ) @@ -37,4 +37,4 @@ inline_comments.py:1:1: I001 [*] Import block is un-sorted or un-formatted 12 |+ TERMINAL_CURRENTLY_RUNNING_TOTAL, 13 |+) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__insert_empty_lines.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__insert_empty_lines.py.snap index 238cb6092207f..35c9a6ca37c86 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__insert_empty_lines.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__insert_empty_lines.py.snap @@ -12,7 +12,7 @@ insert_empty_lines.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import a 2 2 | import b 3 |+ @@ -20,6 +20,8 @@ insert_empty_lines.py:1:1: I001 [*] Import block is un-sorted or un-formatted 4 5 | import os 5 6 | import sys + Run `ruff check --fix` to apply this fix. + insert_empty_lines.py:4:1: I001 [*] Import block is un-sorted or un-formatted | 2 | import b @@ -33,7 +35,7 @@ insert_empty_lines.py:4:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 3 3 | x = 1 4 4 | import os 5 5 | import sys @@ -43,6 +45,8 @@ insert_empty_lines.py:4:1: I001 [*] Import block is un-sorted or un-formatted 7 9 | pass 8 10 | if True: + Run `ruff check --fix` to apply this fix. + insert_empty_lines.py:14:1: I001 [*] Import block is un-sorted or un-formatted | 12 | class X: pass @@ -56,7 +60,7 @@ insert_empty_lines.py:14:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 13 13 | y = 1 14 14 | import os 15 15 | import sys @@ -65,6 +69,8 @@ insert_empty_lines.py:14:1: I001 [*] Import block is un-sorted or un-formatted 17 18 | 18 19 | if True: + Run `ruff check --fix` to apply this fix. + insert_empty_lines.py:52:1: I001 [*] Import block is un-sorted or un-formatted | 52 | / import os @@ -76,7 +82,7 @@ insert_empty_lines.py:52:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 51 51 | 52 52 | import os 53 53 | @@ -85,4 +91,4 @@ insert_empty_lines.py:52:1: I001 [*] Import block is un-sorted or un-formatted 55 56 | def f(): 56 57 | pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__insert_empty_lines.pyi.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__insert_empty_lines.pyi.snap index a2e262e7e8e18..a7d0fa37e648c 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__insert_empty_lines.pyi.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__insert_empty_lines.pyi.snap @@ -12,7 +12,7 @@ insert_empty_lines.pyi:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import a 2 2 | import b 3 |+ @@ -20,6 +20,8 @@ insert_empty_lines.pyi:1:1: I001 [*] Import block is un-sorted or un-formatted 4 5 | import os 5 6 | import sys + Run `ruff check --fix` to apply this fix. + insert_empty_lines.pyi:4:1: I001 [*] Import block is un-sorted or un-formatted | 2 | import b @@ -33,7 +35,7 @@ insert_empty_lines.pyi:4:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 3 3 | x = 1 4 4 | import os 5 5 | import sys @@ -42,6 +44,8 @@ insert_empty_lines.pyi:4:1: I001 [*] Import block is un-sorted or un-formatted 7 8 | pass 8 9 | if True: + Run `ruff check --fix` to apply this fix. + insert_empty_lines.pyi:14:1: I001 [*] Import block is un-sorted or un-formatted | 12 | class X: pass @@ -55,7 +59,7 @@ insert_empty_lines.pyi:14:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 13 13 | y = 1 14 14 | import os 15 15 | import sys @@ -64,4 +68,4 @@ insert_empty_lines.pyi:14:1: I001 [*] Import block is un-sorted or un-formatted 17 18 | 18 19 | if True: - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__known_local_folder_closest_separate_local_folder_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__known_local_folder_closest_separate_local_folder_imports.py.snap index 8eb419a4a4739..5e9be3c3f4e50 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__known_local_folder_closest_separate_local_folder_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__known_local_folder_closest_separate_local_folder_imports.py.snap @@ -13,7 +13,7 @@ separate_local_folder_imports.py:1:1: I001 [*] Import block is un-sorted or un-f | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+import os 1 2 | import sys 3 |+ @@ -25,3 +25,5 @@ separate_local_folder_imports.py:1:1: I001 [*] Import block is un-sorted or un-f 5 7 | from . import leading_prefix 6 8 | from .. import trailing_prefix 7 9 | from ruff import check + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__known_local_folder_separate_local_folder_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__known_local_folder_separate_local_folder_imports.py.snap index 21ed77408c35c..b44469df4fb11 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__known_local_folder_separate_local_folder_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__known_local_folder_separate_local_folder_imports.py.snap @@ -13,7 +13,7 @@ separate_local_folder_imports.py:1:1: I001 [*] Import block is un-sorted or un-f | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+import os 1 2 | import sys 3 |+ @@ -26,3 +26,5 @@ separate_local_folder_imports.py:1:1: I001 [*] Import block is un-sorted or un-f 5 8 | from . import leading_prefix 6 |-from .. import trailing_prefix 7 9 | from ruff import check + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_from_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_from_imports.py.snap index a2183e7de32c7..85ec63b121958 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_from_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_from_imports.py.snap @@ -9,10 +9,10 @@ length_sort_from_imports.py:1:1: I001 [*] Import block is un-sorted or un-format | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+from short import b 1 2 | from mediuuuuuuuuuuum import a 2 |-from short import b 3 3 | from loooooooooooooooooooooog import c - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_non_ascii_members.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_non_ascii_members.py.snap index d6cfc0e340920..f1446af6d64e2 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_non_ascii_members.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_non_ascii_members.py.snap @@ -17,7 +17,7 @@ length_sort_non_ascii_members.py:1:1: I001 [*] Import block is un-sorted or un-f | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | from module1 import ( 2 |- loooooooooooooong, 2 |+ short, @@ -34,4 +34,4 @@ length_sort_non_ascii_members.py:1:1: I001 [*] Import block is un-sorted or un-f 10 |+ looooooooooooooong, 11 11 | ) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_non_ascii_modules.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_non_ascii_modules.py.snap index e1d66bd9a7bb9..9ee05fd95171b 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_non_ascii_modules.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_non_ascii_modules.py.snap @@ -15,7 +15,7 @@ length_sort_non_ascii_modules.py:1:1: I001 [*] Import block is un-sorted or un-f | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-import loooooooooooooong 2 |-import mediuuuuuum 3 1 | import short @@ -29,4 +29,4 @@ length_sort_non_ascii_modules.py:1:1: I001 [*] Import block is un-sorted or un-f 8 |-import μεδιυυυυυμ 9 9 | import looooooooooooooong - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_straight_and_from_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_straight_and_from_imports.py.snap index 7acc627804180..c2f6673baa26c 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_straight_and_from_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_straight_and_from_imports.py.snap @@ -12,7 +12,7 @@ length_sort_straight_and_from_imports.py:1:1: I001 [*] Import block is un-sorted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+import short 1 2 | import mediuuuuuum 2 |-import short @@ -23,4 +23,4 @@ length_sort_straight_and_from_imports.py:1:1: I001 [*] Import block is un-sorted 6 |-from short import b 6 |+from looooooooooooooong import a - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_straight_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_straight_imports.py.snap index 6c73af3a2a8fa..ea4ef5924c14c 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_straight_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_straight_imports.py.snap @@ -10,7 +10,7 @@ length_sort_straight_imports.py:1:1: I001 [*] Import block is un-sorted or un-fo | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+import short 2 |+import mediuuuuuuma 1 3 | import mediuuuuuumb @@ -18,4 +18,4 @@ length_sort_straight_imports.py:1:1: I001 [*] Import block is un-sorted or un-fo 3 4 | import looooooooooooooooong 4 |-import mediuuuuuuma - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_with_relative_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_with_relative_imports.py.snap index 20531ecd26d43..d70d5a26a13b7 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_with_relative_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort__length_sort_with_relative_imports.py.snap @@ -13,7 +13,7 @@ length_sort_with_relative_imports.py:1:1: I001 [*] Import block is un-sorted or | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from ..looooooooooooooong import a 2 |-from ...mediuuuum import b 1 |+from . import d @@ -25,4 +25,4 @@ length_sort_with_relative_imports.py:1:1: I001 [*] Import block is un-sorted or 6 |+from ...mediuuuum import b 7 |+from ..looooooooooooooong import a - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_from_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_from_imports.py.snap index 35bdec18f120c..1d7c739b220d4 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_from_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_from_imports.py.snap @@ -9,10 +9,10 @@ length_sort_from_imports.py:1:1: I001 [*] Import block is un-sorted or un-format | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+from loooooooooooooooooooooog import c 1 2 | from mediuuuuuuuuuuum import a 2 3 | from short import b 3 |-from loooooooooooooooooooooog import c - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_straight_and_from_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_straight_and_from_imports.py.snap index 3cd80a04effd9..92f358fa22c10 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_straight_and_from_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_straight_and_from_imports.py.snap @@ -12,7 +12,7 @@ length_sort_straight_and_from_imports.py:1:1: I001 [*] Import block is un-sorted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+import short 1 2 | import mediuuuuuum 2 |-import short @@ -20,4 +20,4 @@ length_sort_straight_and_from_imports.py:1:1: I001 [*] Import block is un-sorted 4 4 | from looooooooooooooong import a 5 5 | from mediuuuum import c - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_straight_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_straight_imports.py.snap index 6c73af3a2a8fa..ea4ef5924c14c 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_straight_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__length_sort_straight__length_sort_straight_imports.py.snap @@ -10,7 +10,7 @@ length_sort_straight_imports.py:1:1: I001 [*] Import block is un-sorted or un-fo | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+import short 2 |+import mediuuuuuuma 1 3 | import mediuuuuuumb @@ -18,4 +18,4 @@ length_sort_straight_imports.py:1:1: I001 [*] Import block is un-sorted or un-fo 3 4 | import looooooooooooooooong 4 |-import mediuuuuuuma - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_crlf.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_crlf.py.snap index 07043dd802d27..c9305fc051bbe 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_crlf.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_crlf.py.snap @@ -9,7 +9,7 @@ line_ending_crlf.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from long_module_name import member_one, member_two, member_three, member_four, member_five 1 |+from long_module_name import ( 2 |+ member_five, @@ -20,4 +20,4 @@ line_ending_crlf.py:1:1: I001 [*] Import block is un-sorted or un-formatted 7 |+) 2 8 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_lf.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_lf.py.snap index 757fdaa9803b2..8c71203d37dda 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_lf.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__line_ending_lf.py.snap @@ -9,7 +9,7 @@ line_ending_lf.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from long_module_name import member_one, member_two, member_three, member_four, member_five 1 |+from long_module_name import ( 2 |+ member_five, @@ -20,4 +20,4 @@ line_ending_lf.py:1:1: I001 [*] Import block is un-sorted or un-formatted 7 |+) 2 8 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports.pyi.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports.pyi.snap index 3cb4eb573c315..214c8cad2c7ea 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports.pyi.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports.pyi.snap @@ -22,7 +22,7 @@ lines_after_imports.pyi:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | from typing import Any 4 4 | @@ -38,4 +38,4 @@ lines_after_imports.pyi:1:1: I001 [*] Import block is un-sorted or un-formatted 13 10 | class Thing(object): 14 11 | name: str - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_class_after.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_class_after.py.snap index 8f5efb9988504..8eec1d6a7f236 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_class_after.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_class_after.py.snap @@ -19,7 +19,7 @@ lines_after_imports_class_after.py:1:1: I001 [*] Import block is un-sorted or un | = help: Organize imports -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | from typing import Any 4 4 | @@ -35,4 +35,4 @@ lines_after_imports_class_after.py:1:1: I001 [*] Import block is un-sorted or un 11 12 | name: str 12 13 | def __init__(self, name: str): - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_func_after.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_func_after.py.snap index 0f71f16f36243..9e173b9027c20 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_func_after.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_func_after.py.snap @@ -29,7 +29,7 @@ lines_after_imports_func_after.py:1:1: I001 [*] Import block is un-sorted or un- | = help: Organize imports -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | from typing import Any 4 4 | @@ -52,4 +52,4 @@ lines_after_imports_func_after.py:1:1: I001 [*] Import block is un-sorted or un- 20 10 | 21 11 | def main(): - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports.pyi.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports.pyi.snap index 3cb4eb573c315..214c8cad2c7ea 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports.pyi.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports.pyi.snap @@ -22,7 +22,7 @@ lines_after_imports.pyi:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | from typing import Any 4 4 | @@ -38,4 +38,4 @@ lines_after_imports.pyi:1:1: I001 [*] Import block is un-sorted or un-formatted 13 10 | class Thing(object): 14 11 | name: str - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_class_after.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_class_after.py.snap index 747af3269a61a..c05f4e8bb6d52 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_class_after.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_class_after.py.snap @@ -19,7 +19,7 @@ lines_after_imports_class_after.py:1:1: I001 [*] Import block is un-sorted or un | = help: Organize imports -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | from typing import Any 4 4 | @@ -36,4 +36,4 @@ lines_after_imports_class_after.py:1:1: I001 [*] Import block is un-sorted or un 11 13 | name: str 12 14 | def __init__(self, name: str): - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_func_after.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_func_after.py.snap index ff312106a4d89..fd9211c113308 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_func_after.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_func_after.py.snap @@ -29,7 +29,7 @@ lines_after_imports_func_after.py:1:1: I001 [*] Import block is un-sorted or un- | = help: Organize imports -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | from typing import Any 4 4 | @@ -51,4 +51,4 @@ lines_after_imports_func_after.py:1:1: I001 [*] Import block is un-sorted or un- 19 10 | 20 11 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_nothing_after.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_nothing_after.py.snap index 37d9fca223fe2..8caaa014606a3 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_nothing_after.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_after_imports_lines_after_imports_nothing_after.py.snap @@ -15,7 +15,7 @@ lines_after_imports_nothing_after.py:1:1: I001 [*] Import block is un-sorted or | = help: Organize imports -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | from typing import Any 4 4 | @@ -26,4 +26,4 @@ lines_after_imports_nothing_after.py:1:1: I001 [*] Import block is un-sorted or 8 7 | 9 8 | from . import my_local_folder_object - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_between_typeslines_between_types.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_between_typeslines_between_types.py.snap index 09ff2aa19ea73..7cba140f3b2cb 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_between_typeslines_between_types.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__lines_between_typeslines_between_types.py.snap @@ -22,7 +22,7 @@ lines_between_types.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 9 9 | import requests 10 10 | 11 11 | @@ -33,4 +33,4 @@ lines_between_types.py:1:1: I001 [*] Import block is un-sorted or un-formatted 15 15 | from . import config 16 16 | from .data import Data - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__magic_trailing_comma.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__magic_trailing_comma.py.snap index 78c0456bcd7ff..f47cf80d19571 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__magic_trailing_comma.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__magic_trailing_comma.py.snap @@ -44,7 +44,7 @@ magic_trailing_comma.py:2:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | # This has a magic trailing comma, will be sorted, but not rolled into one line 2 |-from sys import ( 3 |- stderr, @@ -98,4 +98,4 @@ magic_trailing_comma.py:2:1: I001 [*] Import block is un-sorted or un-formatted 37 31 | member3, 38 32 | ) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__match_case.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__match_case.py.snap index d3a6f45d7e73b..9d994d338bdba 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__match_case.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__match_case.py.snap @@ -14,7 +14,7 @@ match_case.py:3:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | match 1: 2 2 | case 1: 3 |+ import os @@ -24,6 +24,8 @@ match_case.py:3:1: I001 [*] Import block is un-sorted or un-formatted 6 6 | import collections 7 7 | import abc + Run `ruff check --fix` to apply this fix. + match_case.py:6:1: I001 [*] Import block is un-sorted or un-formatted | 4 | import os @@ -33,7 +35,7 @@ match_case.py:6:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 3 3 | import sys 4 4 | import os 5 5 | case 2: @@ -41,4 +43,4 @@ match_case.py:6:1: I001 [*] Import block is un-sorted or un-formatted 6 7 | import collections 7 |- import abc - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__natural_order.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__natural_order.py.snap index dbfade412a569..15d00a9fd67c3 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__natural_order.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__natural_order.py.snap @@ -22,7 +22,7 @@ natural_order.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import numpy1 2 |+import numpy2 2 3 | import numpy10 @@ -43,4 +43,4 @@ natural_order.py:1:1: I001 [*] Import block is un-sorted or un-formatted 15 15 | uint64, 16 16 | ) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_detect_same_package.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_detect_same_package.snap index 391a603c79de1..f807ade656670 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_detect_same_package.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_detect_same_package.snap @@ -9,11 +9,11 @@ bar.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import os 2 |-import pandas 2 |+ 3 3 | import foo.baz 4 |+import pandas - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before.py.snap index 4947f22fef3c7..55e97d62c0d8d 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before.py.snap @@ -15,7 +15,7 @@ no_lines_before.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | from typing import Any 4 4 | @@ -26,4 +26,4 @@ no_lines_before.py:1:1: I001 [*] Import block is un-sorted or un-formatted 8 7 | 9 8 | from . import my_local_folder_object - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before.py_no_lines_before.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before.py_no_lines_before.py.snap index d85f8eb6c3754..cd1566ea25f96 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before.py_no_lines_before.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before.py_no_lines_before.py.snap @@ -15,7 +15,7 @@ no_lines_before.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | from __future__ import annotations 2 |- 3 2 | from typing import Any @@ -27,4 +27,4 @@ no_lines_before.py:1:1: I001 [*] Import block is un-sorted or un-formatted 8 |- 9 5 | from . import my_local_folder_object - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before_with_empty_sections.py_no_lines_before_with_empty_sections.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before_with_empty_sections.py_no_lines_before_with_empty_sections.py.snap index 0e8d39e7ca878..80b5623d450bb 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before_with_empty_sections.py_no_lines_before_with_empty_sections.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_lines_before_with_empty_sections.py_no_lines_before_with_empty_sections.py.snap @@ -9,10 +9,10 @@ no_lines_before_with_empty_sections.py:1:1: I001 [*] Import block is un-sorted o | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | from __future__ import annotations 2 2 | from typing import Any 3 |+ 3 4 | from . import my_local_folder_object - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_standard_library_no_standard_library.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_standard_library_no_standard_library.py.snap index 8dfcfe5183d0b..43efe4281ef98 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_standard_library_no_standard_library.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_standard_library_no_standard_library.py.snap @@ -15,7 +15,7 @@ no_standard_library.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | from __future__ import annotations 2 2 | 3 |-import os @@ -27,3 +27,5 @@ no_standard_library.py:1:1: I001 [*] Import block is un-sorted or un-formatted 7 8 | 8 9 | from . import local 9 |-import sys + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_wrap_star.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_wrap_star.py.snap index c99b0fdb4e60a..14055f629eaaf 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_wrap_star.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__no_wrap_star.py.snap @@ -7,8 +7,8 @@ no_wrap_star.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from .subscription import * # type: ignore # some very long comment explaining why this needs a type ignore 1 |+from .subscription import * # type: ignore # some very long comment explaining why this needs a type ignore - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type.py.snap index d8b56617063ed..5b5afcea35fff 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type.py.snap @@ -18,7 +18,7 @@ order_by_type.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-import StringIO 2 1 | import glob 3 2 | import os @@ -38,4 +38,4 @@ order_by_type.py:1:1: I001 [*] Import block is un-sorted or un-formatted 12 |+import StringIO 13 |+from module import BASIC, CONSTANT, Apple, Class, function - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_false_order_by_type.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_false_order_by_type.py.snap index e529a09b24d32..c849c6f4fd9e5 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_false_order_by_type.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_false_order_by_type.py.snap @@ -18,7 +18,7 @@ order_by_type.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-import StringIO 2 1 | import glob 3 2 | import os @@ -37,4 +37,4 @@ order_by_type.py:1:1: I001 [*] Import block is un-sorted or un-formatted 12 |+import StringIO 13 |+from module import Apple, BASIC, Class, CONSTANT, function - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_classes.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_classes.py.snap index 63462bfd800b8..264aa5ff21320 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_classes.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_classes.py.snap @@ -10,7 +10,7 @@ order_by_type_with_custom_classes.py:1:1: I001 [*] Import block is un-sorted or | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from sklearn.svm import func, SVC, CONST, Klass 2 |-from subprocess import N_CLASS, PIPE, Popen, STDOUT 3 |-from module import CLASS, Class, CONSTANT, function, BASIC, Apple @@ -21,4 +21,4 @@ order_by_type_with_custom_classes.py:1:1: I001 [*] Import block is un-sorted or 4 |+from sklearn.svm import CONST, SVC, Klass, func 5 |+from torch.nn import A_CONSTANT, SELU, AClass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_classes_order_by_type_with_custom_classes.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_classes_order_by_type_with_custom_classes.py.snap index 08c6f19ddeb7f..9165a59142c24 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_classes_order_by_type_with_custom_classes.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_classes_order_by_type_with_custom_classes.py.snap @@ -10,7 +10,7 @@ order_by_type_with_custom_classes.py:1:1: I001 [*] Import block is un-sorted or | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from sklearn.svm import func, SVC, CONST, Klass 2 |-from subprocess import N_CLASS, PIPE, Popen, STDOUT 3 |-from module import CLASS, Class, CONSTANT, function, BASIC, Apple @@ -21,4 +21,4 @@ order_by_type_with_custom_classes.py:1:1: I001 [*] Import block is un-sorted or 4 |+from sklearn.svm import CONST, Klass, SVC, func 5 |+from torch.nn import A_CONSTANT, AClass, SELU - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_constants.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_constants.py.snap index d935e7728606f..c81479f4972ab 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_constants.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_constants.py.snap @@ -8,11 +8,11 @@ order_by_type_with_custom_constants.py:1:1: I001 [*] Import block is un-sorted o | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from sklearn.svm import XYZ, func, variable, Const, Klass, constant 2 |-from subprocess import First, var, func, Class, konst, A_constant, Last, STDOUT 1 |+from subprocess import STDOUT, A_constant, Class, First, Last, func, konst, var 2 |+ 3 |+from sklearn.svm import XYZ, Const, Klass, constant, func, variable - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_constants_order_by_type_with_custom_constants.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_constants_order_by_type_with_custom_constants.py.snap index ce509d7bdce6a..3f46312e263b4 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_constants_order_by_type_with_custom_constants.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_constants_order_by_type_with_custom_constants.py.snap @@ -8,11 +8,11 @@ order_by_type_with_custom_constants.py:1:1: I001 [*] Import block is un-sorted o | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from sklearn.svm import XYZ, func, variable, Const, Klass, constant 2 |-from subprocess import First, var, func, Class, konst, A_constant, Last, STDOUT 1 |+from subprocess import A_constant, First, konst, Last, STDOUT, Class, func, var 2 |+ 3 |+from sklearn.svm import Const, constant, XYZ, Klass, func, variable - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_variables.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_variables.py.snap index 5285c77bf82a5..db8a4885c576d 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_variables.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_variables.py.snap @@ -8,11 +8,11 @@ order_by_type_with_custom_variables.py:1:1: I001 [*] Import block is un-sorted o | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from sklearn.svm import VAR, Class, MyVar, CONST, abc 2 |-from subprocess import utils, var_ABC, Variable, Klass, CONSTANT, exe 1 |+from subprocess import CONSTANT, Klass, Variable, exe, utils, var_ABC 2 |+ 3 |+from sklearn.svm import CONST, VAR, Class, MyVar, abc - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_variables_order_by_type_with_custom_variables.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_variables_order_by_type_with_custom_variables.py.snap index ed6c44822c61b..9a4869d1158de 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_variables_order_by_type_with_custom_variables.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_by_type_with_custom_variables_order_by_type_with_custom_variables.py.snap @@ -8,11 +8,11 @@ order_by_type_with_custom_variables.py:1:1: I001 [*] Import block is un-sorted o | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from sklearn.svm import VAR, Class, MyVar, CONST, abc 2 |-from subprocess import utils, var_ABC, Variable, Klass, CONSTANT, exe 1 |+from subprocess import CONSTANT, Klass, exe, utils, var_ABC, Variable 2 |+ 3 |+from sklearn.svm import CONST, Class, abc, MyVar, VAR - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_relative_imports_by_level.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_relative_imports_by_level.py.snap index f1aad7edc0a5f..7305e36be4d34 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_relative_imports_by_level.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__order_relative_imports_by_level.py.snap @@ -10,11 +10,11 @@ order_relative_imports_by_level.py:1:1: I001 [*] Import block is un-sorted or un | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from .a import a 2 1 | from ..a import a 3 2 | from ..b import a 3 |+from .a import a 4 4 | from .b import a - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_comment_order.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_comment_order.py.snap index 375b252ccf4b0..fc4e9dbbd690d 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_comment_order.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_comment_order.py.snap @@ -17,7 +17,7 @@ preserve_comment_order.py:1:1: I001 [*] Import block is un-sorted or un-formatte | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+import abc 1 2 | import io 3 |+ @@ -30,4 +30,4 @@ preserve_comment_order.py:1:1: I001 [*] Import block is un-sorted or un-formatte 10 12 | from errno import EIO 11 |-import abc - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_import_star.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_import_star.py.snap index e44b824e4dc8b..3d40d47e8db8d 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_import_star.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_import_star.py.snap @@ -12,7 +12,7 @@ preserve_import_star.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from some_other_module import some_class 2 |-from some_other_module import * 3 1 | # Above @@ -25,4 +25,4 @@ preserve_import_star.py:1:1: I001 [*] Import block is un-sorted or un-formatted 6 |+from some_other_module import * 7 |+from some_other_module import some_class - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_indentation.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_indentation.py.snap index d9117c89e61d0..7f4c34eb160e9 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_indentation.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__preserve_indentation.py.snap @@ -13,7 +13,7 @@ preserve_indentation.py:2:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | if True: 2 |+ import os 2 3 | import sys @@ -22,6 +22,8 @@ preserve_indentation.py:2:1: I001 [*] Import block is un-sorted or un-formatted 5 5 | import sys 6 6 | import os + Run `ruff check --fix` to apply this fix. + preserve_indentation.py:5:1: I001 [*] Import block is un-sorted or un-formatted | 3 | import os @@ -31,7 +33,7 @@ preserve_indentation.py:5:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 2 2 | import sys 3 3 | import os 4 4 | else: @@ -39,4 +41,4 @@ preserve_indentation.py:5:1: I001 [*] Import block is un-sorted or un-formatted 5 6 | import sys 6 |- import os - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__propagate_inline_comments_propagate_inline_comments.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__propagate_inline_comments_propagate_inline_comments.py.snap index 6346a04dd236c..256b0e4c76385 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__propagate_inline_comments_propagate_inline_comments.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__propagate_inline_comments_propagate_inline_comments.py.snap @@ -10,11 +10,11 @@ propagate_inline_comments.py:1:1: I001 [*] Import block is un-sorted or un-forma | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | from mypackage.subpackage import ( # long comment that seems to be a problem 2 2 | a_long_variable_name_that_causes_problems, 3 |- items, 4 3 | ) 4 |+from mypackage.subpackage import items # long comment that seems to be a problem - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__reorder_within_section.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__reorder_within_section.py.snap index 23d95af3545c5..9600b2b5c51fe 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__reorder_within_section.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__reorder_within_section.py.snap @@ -8,9 +8,9 @@ reorder_within_section.py:1:1: I001 [*] Import block is un-sorted or un-formatte | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+import os 1 2 | import sys 2 |-import os - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_comment.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_comment.py.snap index 313ec7cbb467d..cd8577484fccb 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_comment.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_comment.py.snap @@ -2,8 +2,10 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- comment.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` -ℹ Safe fix +Suggested fix: 1 1 | #!/usr/bin/env python3 2 |+from __future__ import annotations 2 3 | 3 4 | x = 1 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_comments_and_newlines.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_comments_and_newlines.py.snap index c5d92854a2864..61a4d3e9eec85 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_comments_and_newlines.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_comments_and_newlines.py.snap @@ -2,10 +2,12 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- comments_and_newlines.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` -ℹ Safe fix +Suggested fix: 2 2 | # A copyright notice could go here 3 3 | 4 4 | # A linter directive could go here 5 |+from __future__ import annotations 5 6 | 6 7 | x = 1 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring.py.snap index 4a513546859a8..2b39bfee3de9c 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring.py.snap @@ -2,8 +2,10 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- docstring.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` -ℹ Safe fix +Suggested fix: 1 1 | """Hello, world!""" 2 |+from __future__ import annotations 2 3 | 3 4 | x = 1 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring_with_continuation.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring_with_continuation.py.snap index c48ef63610db9..ea5ded5003390 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring_with_continuation.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring_with_continuation.py.snap @@ -2,7 +2,9 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- docstring_with_continuation.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` -ℹ Safe fix +Suggested fix: 1 |-"""Hello, world!"""; x = \ 1 |+"""Hello, world!"""; from __future__ import annotations; x = \ 2 2 | 1; y = 2 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring_with_semicolon.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring_with_semicolon.py.snap index dfd35beb25140..6634f2e69c2ff 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring_with_semicolon.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_docstring_with_semicolon.py.snap @@ -2,6 +2,8 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- docstring_with_semicolon.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` -ℹ Safe fix +Suggested fix: 1 |-"""Hello, world!"""; x = 1 1 |+"""Hello, world!"""; from __future__ import annotations; x = 1 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_existing_import.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_existing_import.py.snap index 12ff6dbd5cc02..3bbafefa65cbc 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_existing_import.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_existing_import.py.snap @@ -2,7 +2,9 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- existing_import.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` -ℹ Safe fix +Suggested fix: 1 |+from __future__ import annotations 1 2 | from __future__ import generator_stop 2 3 | import os + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_multiline_docstring.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_multiline_docstring.py.snap index 18e6b94876b25..836d48fffd155 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_multiline_docstring.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_multiline_docstring.py.snap @@ -2,9 +2,11 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- multiline_docstring.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` -ℹ Safe fix +Suggested fix: 1 1 | """a 2 2 | b""" 3 3 | # b 4 |+from __future__ import annotations 4 5 | import os + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_off.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_off.py.snap index 5107b912908db..f1e9159dea9f0 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_off.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_off.py.snap @@ -2,9 +2,11 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- off.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` -ℹ Safe fix +Suggested fix: 1 1 | # isort: off 2 |+from __future__ import annotations 2 3 | 3 4 | x = 1 4 5 | # isort: on + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_comment.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_comment.py.snap index ea3f16c36b1e7..13cce7429a1a1 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_comment.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_comment.py.snap @@ -2,8 +2,10 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- comment.py:1:1: I002 [*] Missing required import: `from __future__ import annotations as _annotations` -ℹ Safe fix +Suggested fix: 1 1 | #!/usr/bin/env python3 2 |+from __future__ import annotations as _annotations 2 3 | 3 4 | x = 1 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_comments_and_newlines.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_comments_and_newlines.py.snap index 509094af63e6a..56c903b886317 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_comments_and_newlines.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_comments_and_newlines.py.snap @@ -2,10 +2,12 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- comments_and_newlines.py:1:1: I002 [*] Missing required import: `from __future__ import annotations as _annotations` -ℹ Safe fix +Suggested fix: 2 2 | # A copyright notice could go here 3 3 | 4 4 | # A linter directive could go here 5 |+from __future__ import annotations as _annotations 5 6 | 6 7 | x = 1 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring.py.snap index 21c36c4e30461..8e8a16fd3295a 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring.py.snap @@ -2,8 +2,10 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- docstring.py:1:1: I002 [*] Missing required import: `from __future__ import annotations as _annotations` -ℹ Safe fix +Suggested fix: 1 1 | """Hello, world!""" 2 |+from __future__ import annotations as _annotations 2 3 | 3 4 | x = 1 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring_with_continuation.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring_with_continuation.py.snap index 0a40adb35a58c..0b9711d5a68a2 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring_with_continuation.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring_with_continuation.py.snap @@ -2,7 +2,9 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- docstring_with_continuation.py:1:1: I002 [*] Missing required import: `from __future__ import annotations as _annotations` -ℹ Safe fix +Suggested fix: 1 |-"""Hello, world!"""; x = \ 1 |+"""Hello, world!"""; from __future__ import annotations as _annotations; x = \ 2 2 | 1; y = 2 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring_with_semicolon.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring_with_semicolon.py.snap index 3c61e64a8ba79..d638a38fc2855 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring_with_semicolon.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_docstring_with_semicolon.py.snap @@ -2,6 +2,8 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- docstring_with_semicolon.py:1:1: I002 [*] Missing required import: `from __future__ import annotations as _annotations` -ℹ Safe fix +Suggested fix: 1 |-"""Hello, world!"""; x = 1 1 |+"""Hello, world!"""; from __future__ import annotations as _annotations; x = 1 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_existing_import.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_existing_import.py.snap index 96e891413b4af..f5c6e9c22a457 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_existing_import.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_existing_import.py.snap @@ -2,7 +2,9 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- existing_import.py:1:1: I002 [*] Missing required import: `from __future__ import annotations as _annotations` -ℹ Safe fix +Suggested fix: 1 |+from __future__ import annotations as _annotations 1 2 | from __future__ import generator_stop 2 3 | import os + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_multiline_docstring.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_multiline_docstring.py.snap index 6426ab3898496..a9126315a6e84 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_multiline_docstring.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_multiline_docstring.py.snap @@ -2,9 +2,11 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- multiline_docstring.py:1:1: I002 [*] Missing required import: `from __future__ import annotations as _annotations` -ℹ Safe fix +Suggested fix: 1 1 | """a 2 2 | b""" 3 3 | # b 4 |+from __future__ import annotations as _annotations 4 5 | import os + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_off.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_off.py.snap index 4387774dddd69..6ca2da7acc895 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_off.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_import_with_alias_off.py.snap @@ -2,9 +2,11 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- off.py:1:1: I002 [*] Missing required import: `from __future__ import annotations as _annotations` -ℹ Safe fix +Suggested fix: 1 1 | # isort: off 2 |+from __future__ import annotations as _annotations 2 3 | 3 4 | x = 1 4 5 | # isort: on + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_imports_docstring.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_imports_docstring.py.snap index d65d89b7038d5..f91a0770e142f 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_imports_docstring.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__required_imports_docstring.py.snap @@ -2,15 +2,19 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- docstring.py:1:1: I002 [*] Missing required import: `from __future__ import annotations` -ℹ Safe fix +Suggested fix: 1 1 | """Hello, world!""" 2 |+from __future__ import annotations 2 3 | 3 4 | x = 1 + Run `ruff check --fix` to apply this fix. + docstring.py:1:1: I002 [*] Missing required import: `from __future__ import generator_stop` -ℹ Safe fix +Suggested fix: 1 1 | """Hello, world!""" 2 |+from __future__ import generator_stop 2 3 | 3 4 | x = 1 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__section_order_sections.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__section_order_sections.py.snap index 8643ef2443362..341fc0c362a56 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__section_order_sections.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__section_order_sections.py.snap @@ -13,7 +13,7 @@ sections.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | from __future__ import annotations 2 |+ 2 3 | import os @@ -27,4 +27,4 @@ sections.py:1:1: I001 [*] Import block is un-sorted or un-formatted 11 |+ 7 12 | from . import local - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sections_main_first_party.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sections_main_first_party.py.snap index 404ad962cb670..d2e1a00e405fe 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sections_main_first_party.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sections_main_first_party.py.snap @@ -17,7 +17,7 @@ main_first_party.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import os 2 2 | 3 |-import __main__ @@ -28,4 +28,4 @@ main_first_party.py:1:1: I001 [*] Import block is un-sorted or un-formatted 7 7 | 8 8 | os.a - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sections_sections.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sections_sections.py.snap index 15572d6be1f65..37e6591e34e75 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sections_sections.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sections_sections.py.snap @@ -13,7 +13,7 @@ sections.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | from __future__ import annotations 2 |+ 2 3 | import os @@ -27,4 +27,4 @@ sections.py:1:1: I001 [*] Import block is un-sorted or un-formatted 10 |+ 11 |+import django.settings - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_first_party_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_first_party_imports.py.snap index e1f4b5298d973..f22dca7e1fb55 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_first_party_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_first_party_imports.py.snap @@ -11,7 +11,7 @@ separate_first_party_imports.py:1:1: I001 [*] Import block is un-sorted or un-fo | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+import os 1 2 | import sys 3 |+ @@ -22,4 +22,4 @@ separate_first_party_imports.py:1:1: I001 [*] Import block is un-sorted or un-fo 4 |-import os 5 7 | from leading_prefix import Class - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_future_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_future_imports.py.snap index 238a0b20f69e6..698100432a1c7 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_future_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_future_imports.py.snap @@ -9,7 +9,7 @@ separate_future_imports.py:1:1: I001 [*] Import block is un-sorted or un-formatt | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-import sys 2 |-import os 3 1 | from __future__ import annotations @@ -17,4 +17,4 @@ separate_future_imports.py:1:1: I001 [*] Import block is un-sorted or un-formatt 3 |+import os 4 |+import sys - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_local_folder_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_local_folder_imports.py.snap index 88d2f3a1bcfa0..77d5f5d594034 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_local_folder_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_local_folder_imports.py.snap @@ -13,7 +13,7 @@ separate_local_folder_imports.py:1:1: I001 [*] Import block is un-sorted or un-f | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+import os 1 2 | import sys 3 |+ @@ -27,3 +27,5 @@ separate_local_folder_imports.py:1:1: I001 [*] Import block is un-sorted or un-f 5 10 | from . import leading_prefix 6 |-from .. import trailing_prefix 7 |-from ruff import check + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_third_party_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_third_party_imports.py.snap index 955c5421ff4ca..f449b3910eb13 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_third_party_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__separate_third_party_imports.py.snap @@ -10,7 +10,7 @@ separate_third_party_imports.py:1:1: I001 [*] Import block is un-sorted or un-fo | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-import pandas as pd 1 |+import os 2 2 | import sys @@ -19,4 +19,4 @@ separate_third_party_imports.py:1:1: I001 [*] Import block is un-sorted or un-fo 4 |-import os 5 |+import pandas as pd - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__skip.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__skip.py.snap index acd83b5cbe271..72859bad462e9 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__skip.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__skip.py.snap @@ -14,7 +14,7 @@ skip.py:20:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 17 17 | def f(): 18 18 | import sys 19 19 | import os # isort: skip @@ -25,6 +25,8 @@ skip.py:20:1: I001 [*] Import block is un-sorted or un-formatted 23 23 | 24 24 | def f(): + Run `ruff check --fix` to apply this fix. + skip.py:27:1: I001 [*] Import block is un-sorted or un-formatted | 25 | import sys @@ -38,7 +40,7 @@ skip.py:27:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 24 24 | def f(): 25 25 | import sys 26 26 | import os # isort:skip @@ -49,6 +51,8 @@ skip.py:27:1: I001 [*] Import block is un-sorted or un-formatted 30 30 | 31 31 | def f(): + Run `ruff check --fix` to apply this fix. + skip.py:34:1: I001 [*] Import block is un-sorted or un-formatted | 32 | import sys; import os # isort:skip @@ -57,7 +61,7 @@ skip.py:34:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 31 31 | def f(): 32 32 | import sys; import os # isort:skip 33 33 | import sys; import os # isort:skip # isort:skip @@ -65,4 +69,4 @@ skip.py:34:1: I001 [*] Import block is un-sorted or un-formatted 34 |+ import os 35 |+ import sys - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sort_similar_imports.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sort_similar_imports.py.snap index 588a1c9a97cbb..d4163955db57b 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sort_similar_imports.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__sort_similar_imports.py.snap @@ -32,7 +32,7 @@ sort_similar_imports.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |-from a import b 1 |+import A 2 |+import a @@ -74,4 +74,4 @@ sort_similar_imports.py:1:1: I001 [*] Import block is un-sorted or un-formatted 25 |-import x 26 |-import x as a - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__split.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__split.py.snap index a729c4efd6eb4..cb96f84d51867 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__split.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__split.py.snap @@ -12,7 +12,7 @@ split.py:15:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 12 12 | import b 13 13 | 14 14 | if True: @@ -23,6 +23,8 @@ split.py:15:1: I001 [*] Import block is un-sorted or un-formatted 18 18 | # isort: split 19 19 | + Run `ruff check --fix` to apply this fix. + split.py:20:1: I001 [*] Import block is un-sorted or un-formatted | 18 | # isort: split @@ -36,7 +38,7 @@ split.py:20:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 17 17 | 18 18 | # isort: split 19 19 | @@ -47,6 +49,8 @@ split.py:20:1: I001 [*] Import block is un-sorted or un-formatted 23 23 | 24 24 | import e + Run `ruff check --fix` to apply this fix. + split.py:30:1: I001 [*] Import block is un-sorted or un-formatted | 28 | # isort: split @@ -56,7 +60,7 @@ split.py:30:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 27 27 | # isort: split 28 28 | # isort: split 29 29 | @@ -64,4 +68,4 @@ split.py:30:1: I001 [*] Import block is un-sorted or un-formatted 30 31 | import d 31 |-import c - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__split_on_trailing_comma_magic_trailing_comma.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__split_on_trailing_comma_magic_trailing_comma.py.snap index 87b842c9f89a7..527ab1f75ac79 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__split_on_trailing_comma_magic_trailing_comma.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__split_on_trailing_comma_magic_trailing_comma.py.snap @@ -44,7 +44,7 @@ magic_trailing_comma.py:2:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | # This has a magic trailing comma, will be sorted, but not rolled into one line 2 |-from sys import ( 3 |- stderr, @@ -92,4 +92,4 @@ magic_trailing_comma.py:2:1: I001 [*] Import block is un-sorted or un-formatted 38 |-) 19 |+from module2 import member1, member2, member3 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__star_before_others.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__star_before_others.py.snap index 98fadba6e6dbe..0fcb1ce3f1cd9 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__star_before_others.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__star_before_others.py.snap @@ -9,10 +9,10 @@ star_before_others.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | from .logging import config_logging 2 |+from .settings import * 2 3 | from .settings import ENV 3 |-from .settings import * - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__straight_required_import_docstring.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__straight_required_import_docstring.py.snap index 6ce4357615da8..2f41952a2fcc5 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__straight_required_import_docstring.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__straight_required_import_docstring.py.snap @@ -2,8 +2,10 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- docstring.py:1:1: I002 [*] Missing required import: `import os` -ℹ Safe fix +Suggested fix: 1 1 | """Hello, world!""" 2 |+import os 2 3 | 3 4 | x = 1 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__straight_required_import_docstring.pyi.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__straight_required_import_docstring.pyi.snap index 9c789cb79e5e0..5684837ddd231 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__straight_required_import_docstring.pyi.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__straight_required_import_docstring.pyi.snap @@ -2,8 +2,10 @@ source: crates/ruff_linter/src/rules/isort/mod.rs --- docstring.pyi:1:1: I002 [*] Missing required import: `import os` -ℹ Safe fix +Suggested fix: 1 1 | """Hello, world!""" 2 |+import os 2 3 | 3 4 | x = 1 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__trailing_comment.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__trailing_comment.py.snap index 8a1f7e61d3670..f7f6d8873a620 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__trailing_comment.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__trailing_comment.py.snap @@ -19,7 +19,7 @@ trailing_comment.py:8:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | pass 7 7 | @@ -35,6 +35,8 @@ trailing_comment.py:8:1: I001 [*] Import block is un-sorted or un-formatted 15 14 | pass 16 15 | + Run `ruff check --fix` to apply this fix. + trailing_comment.py:17:1: I001 [*] Import block is un-sorted or un-formatted | 15 | pass @@ -55,7 +57,7 @@ trailing_comment.py:17:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 14 14 | 15 15 | pass 16 16 | @@ -67,6 +69,8 @@ trailing_comment.py:17:1: I001 [*] Import block is un-sorted or un-formatted 21 19 | MyClient, 22 20 | MyMgmtClient, + Run `ruff check --fix` to apply this fix. + trailing_comment.py:35:1: I001 [*] Import block is un-sorted or un-formatted | 33 | pass @@ -83,7 +87,7 @@ trailing_comment.py:35:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 32 32 | 33 33 | pass 34 34 | @@ -96,6 +100,8 @@ trailing_comment.py:35:1: I001 [*] Import block is un-sorted or un-formatted 40 37 | pass 41 38 | + Run `ruff check --fix` to apply this fix. + trailing_comment.py:42:1: I001 [*] Import block is un-sorted or un-formatted | 40 | pass @@ -112,7 +118,7 @@ trailing_comment.py:42:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 39 39 | 40 40 | pass 41 41 | @@ -125,6 +131,8 @@ trailing_comment.py:42:1: I001 [*] Import block is un-sorted or un-formatted 47 44 | pass 48 45 | + Run `ruff check --fix` to apply this fix. + trailing_comment.py:50:1: I001 [*] Import block is un-sorted or un-formatted | 49 | # a @@ -136,7 +144,7 @@ trailing_comment.py:50:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 47 47 | pass 48 48 | 49 49 | # a @@ -146,3 +154,5 @@ trailing_comment.py:50:1: I001 [*] Import block is un-sorted or un-formatted 53 |- # e 54 |-) # f 50 |+from mylib import MyClient # b # c # d # e # f + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__two_space.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__two_space.py.snap index 3d7aa735039ba..2e0908f74d543 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__two_space.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__two_space.py.snap @@ -17,7 +17,7 @@ two_space.py:2:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | # If the file doesn't contain a logical indent token, we should still detect two-space indentation on imports. 2 2 | from math import ( 3 |- sin, @@ -30,3 +30,5 @@ two_space.py:2:1: I001 [*] Import block is un-sorted or un-formatted 8 8 | ) 9 9 | 10 10 | del sin, cos, tan, pi, nan + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__unicode.py.snap b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__unicode.py.snap index 0a6f035c6241d..5a39b5401b0ca 100644 --- a/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__unicode.py.snap +++ b/crates/ruff_linter/src/rules/isort/snapshots/ruff_linter__rules__isort__tests__unicode.py.snap @@ -13,7 +13,7 @@ unicode.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+import numpy as CƐgHHHhIILlNZΩZKÅBCeEFio 2 |+import numpy as ℂℇℊℋℌℍℎℐℑℒℓℕℤΩℨKÅℬℭℯℰℱℹℴ 1 3 | from astropy.constants import hbar as ℏ @@ -22,3 +22,5 @@ unicode.py:1:1: I001 [*] Import block is un-sorted or un-formatted 4 |-import numpy as CƐgHHHhIILlNZΩZKÅBCeEFio 5 5 | 6 6 | h = 2 * π * ℏ + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap index d857a69203f2f..592512a74b5c1 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap @@ -12,7 +12,7 @@ NPY003.py:4:5: NPY003 [*] `np.round_` is deprecated; use `np.round` instead | = help: Replace with `np.round` -ℹ Safe fix +Suggested fix: 1 1 | def func(): 2 2 | import numpy as np 3 3 | @@ -22,6 +22,8 @@ NPY003.py:4:5: NPY003 [*] `np.round_` is deprecated; use `np.round` instead 6 6 | np.cumproduct(np.random.rand(5, 5)) 7 7 | np.sometrue(np.random.rand(5, 5)) + Run `ruff check --fix` to apply this fix. + NPY003.py:5:5: NPY003 [*] `np.product` is deprecated; use `np.prod` instead | 4 | np.round_(np.random.rand(5, 5), 2) @@ -32,7 +34,7 @@ NPY003.py:5:5: NPY003 [*] `np.product` is deprecated; use `np.prod` instead | = help: Replace with `np.prod` -ℹ Safe fix +Suggested fix: 2 2 | import numpy as np 3 3 | 4 4 | np.round_(np.random.rand(5, 5), 2) @@ -42,6 +44,8 @@ NPY003.py:5:5: NPY003 [*] `np.product` is deprecated; use `np.prod` instead 7 7 | np.sometrue(np.random.rand(5, 5)) 8 8 | np.alltrue(np.random.rand(5, 5)) + Run `ruff check --fix` to apply this fix. + NPY003.py:6:5: NPY003 [*] `np.cumproduct` is deprecated; use `np.cumprod` instead | 4 | np.round_(np.random.rand(5, 5), 2) @@ -53,7 +57,7 @@ NPY003.py:6:5: NPY003 [*] `np.cumproduct` is deprecated; use `np.cumprod` instea | = help: Replace with `np.cumprod` -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | np.round_(np.random.rand(5, 5), 2) 5 5 | np.product(np.random.rand(5, 5)) @@ -63,6 +67,8 @@ NPY003.py:6:5: NPY003 [*] `np.cumproduct` is deprecated; use `np.cumprod` instea 8 8 | np.alltrue(np.random.rand(5, 5)) 9 9 | + Run `ruff check --fix` to apply this fix. + NPY003.py:7:5: NPY003 [*] `np.sometrue` is deprecated; use `np.any` instead | 5 | np.product(np.random.rand(5, 5)) @@ -73,7 +79,7 @@ NPY003.py:7:5: NPY003 [*] `np.sometrue` is deprecated; use `np.any` instead | = help: Replace with `np.any` -ℹ Safe fix +Suggested fix: 4 4 | np.round_(np.random.rand(5, 5), 2) 5 5 | np.product(np.random.rand(5, 5)) 6 6 | np.cumproduct(np.random.rand(5, 5)) @@ -83,6 +89,8 @@ NPY003.py:7:5: NPY003 [*] `np.sometrue` is deprecated; use `np.any` instead 9 9 | 10 10 | + Run `ruff check --fix` to apply this fix. + NPY003.py:8:5: NPY003 [*] `np.alltrue` is deprecated; use `np.all` instead | 6 | np.cumproduct(np.random.rand(5, 5)) @@ -92,7 +100,7 @@ NPY003.py:8:5: NPY003 [*] `np.alltrue` is deprecated; use `np.all` instead | = help: Replace with `np.all` -ℹ Safe fix +Suggested fix: 5 5 | np.product(np.random.rand(5, 5)) 6 6 | np.cumproduct(np.random.rand(5, 5)) 7 7 | np.sometrue(np.random.rand(5, 5)) @@ -102,6 +110,8 @@ NPY003.py:8:5: NPY003 [*] `np.alltrue` is deprecated; use `np.all` instead 10 10 | 11 11 | def func(): + Run `ruff check --fix` to apply this fix. + NPY003.py:14:5: NPY003 [*] `np.round_` is deprecated; use `np.round` instead | 12 | from numpy import round_, product, cumproduct, sometrue, alltrue @@ -113,7 +123,7 @@ NPY003.py:14:5: NPY003 [*] `np.round_` is deprecated; use `np.round` instead | = help: Replace with `np.round` -ℹ Safe fix +Suggested fix: 1 |+from numpy import round 1 2 | def func(): 2 3 | import numpy as np @@ -128,6 +138,8 @@ NPY003.py:14:5: NPY003 [*] `np.round_` is deprecated; use `np.round` instead 16 17 | cumproduct(np.random.rand(5, 5)) 17 18 | sometrue(np.random.rand(5, 5)) + Run `ruff check --fix` to apply this fix. + NPY003.py:15:5: NPY003 [*] `np.product` is deprecated; use `np.prod` instead | 14 | round_(np.random.rand(5, 5), 2) @@ -138,7 +150,7 @@ NPY003.py:15:5: NPY003 [*] `np.product` is deprecated; use `np.prod` instead | = help: Replace with `np.prod` -ℹ Safe fix +Suggested fix: 1 |+from numpy import prod 1 2 | def func(): 2 3 | import numpy as np @@ -153,6 +165,8 @@ NPY003.py:15:5: NPY003 [*] `np.product` is deprecated; use `np.prod` instead 17 18 | sometrue(np.random.rand(5, 5)) 18 19 | alltrue(np.random.rand(5, 5)) + Run `ruff check --fix` to apply this fix. + NPY003.py:16:5: NPY003 [*] `np.cumproduct` is deprecated; use `np.cumprod` instead | 14 | round_(np.random.rand(5, 5), 2) @@ -164,7 +178,7 @@ NPY003.py:16:5: NPY003 [*] `np.cumproduct` is deprecated; use `np.cumprod` inste | = help: Replace with `np.cumprod` -ℹ Safe fix +Suggested fix: 1 |+from numpy import cumprod 1 2 | def func(): 2 3 | import numpy as np @@ -178,6 +192,8 @@ NPY003.py:16:5: NPY003 [*] `np.cumproduct` is deprecated; use `np.cumprod` inste 17 18 | sometrue(np.random.rand(5, 5)) 18 19 | alltrue(np.random.rand(5, 5)) + Run `ruff check --fix` to apply this fix. + NPY003.py:17:5: NPY003 [*] `np.sometrue` is deprecated; use `np.any` instead | 15 | product(np.random.rand(5, 5)) @@ -188,7 +204,7 @@ NPY003.py:17:5: NPY003 [*] `np.sometrue` is deprecated; use `np.any` instead | = help: Replace with `np.any` -ℹ Safe fix +Suggested fix: 1 |+from numpy import any 1 2 | def func(): 2 3 | import numpy as np @@ -201,6 +217,8 @@ NPY003.py:17:5: NPY003 [*] `np.sometrue` is deprecated; use `np.any` instead 18 |+ any(np.random.rand(5, 5)) 18 19 | alltrue(np.random.rand(5, 5)) + Run `ruff check --fix` to apply this fix. + NPY003.py:18:5: NPY003 [*] `np.alltrue` is deprecated; use `np.all` instead | 16 | cumproduct(np.random.rand(5, 5)) @@ -210,7 +228,7 @@ NPY003.py:18:5: NPY003 [*] `np.alltrue` is deprecated; use `np.all` instead | = help: Replace with `np.all` -ℹ Safe fix +Suggested fix: 1 |+from numpy import all 1 2 | def func(): 2 3 | import numpy as np @@ -222,4 +240,4 @@ NPY003.py:18:5: NPY003 [*] `np.alltrue` is deprecated; use `np.all` instead 18 |- alltrue(np.random.rand(5, 5)) 19 |+ all(np.random.rand(5, 5)) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap index 6af2e8eac11cd..68dd81b3b02a1 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap @@ -10,7 +10,7 @@ NPY001.py:6:1: NPY001 [*] Type alias `np.float` is deprecated, replace with buil | = help: Replace `np.float` with builtin type -ℹ Safe fix +Suggested fix: 3 3 | import numpy 4 4 | 5 5 | # Error @@ -20,6 +20,8 @@ NPY001.py:6:1: NPY001 [*] Type alias `np.float` is deprecated, replace with buil 8 8 | 9 9 | if dtype == np.object: + Run `ruff check --fix` to apply this fix. + NPY001.py:7:1: NPY001 [*] Type alias `np.int` is deprecated, replace with builtin type | 5 | # Error @@ -31,7 +33,7 @@ NPY001.py:7:1: NPY001 [*] Type alias `np.int` is deprecated, replace with builti | = help: Replace `np.int` with builtin type -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | # Error 6 6 | npy.float @@ -41,6 +43,8 @@ NPY001.py:7:1: NPY001 [*] Type alias `np.int` is deprecated, replace with builti 9 9 | if dtype == np.object: 10 10 | ... + Run `ruff check --fix` to apply this fix. + NPY001.py:9:13: NPY001 [*] Type alias `np.object` is deprecated, replace with builtin type | 7 | npy.int @@ -51,7 +55,7 @@ NPY001.py:9:13: NPY001 [*] Type alias `np.object` is deprecated, replace with bu | = help: Replace `np.object` with builtin type -ℹ Safe fix +Suggested fix: 6 6 | npy.float 7 7 | npy.int 8 8 | @@ -61,6 +65,8 @@ NPY001.py:9:13: NPY001 [*] Type alias `np.object` is deprecated, replace with bu 11 11 | 12 12 | result = result.select_dtypes([np.byte, np.ubyte, np.short, np.ushort, np.int, np.complex]) + Run `ruff check --fix` to apply this fix. + NPY001.py:12:72: NPY001 [*] Type alias `np.int` is deprecated, replace with builtin type | 10 | ... @@ -72,7 +78,7 @@ NPY001.py:12:72: NPY001 [*] Type alias `np.int` is deprecated, replace with buil | = help: Replace `np.int` with builtin type -ℹ Safe fix +Suggested fix: 9 9 | if dtype == np.object: 10 10 | ... 11 11 | @@ -82,6 +88,8 @@ NPY001.py:12:72: NPY001 [*] Type alias `np.int` is deprecated, replace with buil 14 14 | pdf = pd.DataFrame( 15 15 | data=[[1, 2, 3]], + Run `ruff check --fix` to apply this fix. + NPY001.py:12:80: NPY001 [*] Type alias `np.complex` is deprecated, replace with builtin type | 10 | ... @@ -93,7 +101,7 @@ NPY001.py:12:80: NPY001 [*] Type alias `np.complex` is deprecated, replace with | = help: Replace `np.complex` with builtin type -ℹ Safe fix +Suggested fix: 9 9 | if dtype == np.object: 10 10 | ... 11 11 | @@ -103,6 +111,8 @@ NPY001.py:12:80: NPY001 [*] Type alias `np.complex` is deprecated, replace with 14 14 | pdf = pd.DataFrame( 15 15 | data=[[1, 2, 3]], + Run `ruff check --fix` to apply this fix. + NPY001.py:17:11: NPY001 [*] Type alias `np.object` is deprecated, replace with builtin type | 15 | data=[[1, 2, 3]], @@ -113,7 +123,7 @@ NPY001.py:17:11: NPY001 [*] Type alias `np.object` is deprecated, replace with b | = help: Replace `np.object` with builtin type -ℹ Safe fix +Suggested fix: 14 14 | pdf = pd.DataFrame( 15 15 | data=[[1, 2, 3]], 16 16 | columns=["a", "b", "c"], @@ -123,6 +133,8 @@ NPY001.py:17:11: NPY001 [*] Type alias `np.object` is deprecated, replace with b 19 19 | 20 20 | _ = arr.astype(np.int) + Run `ruff check --fix` to apply this fix. + NPY001.py:20:16: NPY001 [*] Type alias `np.int` is deprecated, replace with builtin type | 18 | ) @@ -134,7 +146,7 @@ NPY001.py:20:16: NPY001 [*] Type alias `np.int` is deprecated, replace with buil | = help: Replace `np.int` with builtin type -ℹ Safe fix +Suggested fix: 17 17 | dtype=numpy.object, 18 18 | ) 19 19 | @@ -144,6 +156,8 @@ NPY001.py:20:16: NPY001 [*] Type alias `np.int` is deprecated, replace with buil 22 22 | # Regression test for: https://github.com/astral-sh/ruff/issues/6952 23 23 | from numpy import float + Run `ruff check --fix` to apply this fix. + NPY001.py:25:1: NPY001 [*] Type alias `np.float` is deprecated, replace with builtin type | 23 | from numpy import float @@ -153,7 +167,7 @@ NPY001.py:25:1: NPY001 [*] Type alias `np.float` is deprecated, replace with bui | = help: Replace `np.float` with builtin type -ℹ Safe fix +Suggested fix: 21 21 | 22 22 | # Regression test for: https://github.com/astral-sh/ruff/issues/6952 23 23 | from numpy import float @@ -161,3 +175,5 @@ NPY001.py:25:1: NPY001 [*] Type alias `np.float` is deprecated, replace with bui 24 25 | 25 |-float(1) 26 |+builtins.float(1) + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201.py.snap index 6941c9efc9aff..0f1a0149217ad 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201.py.snap @@ -12,7 +12,7 @@ NPY201.py:4:5: NPY201 [*] `np.add_docstring` will be removed in NumPy 2.0. Use ` | = help: Replace with `numpy.lib.add_docstring` -ℹ Safe fix +Suggested fix: 1 |+from numpy.lib import add_docstring 1 2 | def func(): 2 3 | import numpy as np @@ -23,6 +23,8 @@ NPY201.py:4:5: NPY201 [*] `np.add_docstring` will be removed in NumPy 2.0. Use ` 6 7 | np.add_newdoc 7 8 | + Run `ruff check --fix` to apply this fix. + NPY201.py:6:5: NPY201 [*] `np.add_newdoc` will be removed in NumPy 2.0. Use `numpy.lib.add_newdoc` instead. | 4 | np.add_docstring @@ -34,7 +36,7 @@ NPY201.py:6:5: NPY201 [*] `np.add_newdoc` will be removed in NumPy 2.0. Use `num | = help: Replace with `numpy.lib.add_newdoc` -ℹ Safe fix +Suggested fix: 1 |+from numpy.lib import add_newdoc 1 2 | def func(): 2 3 | import numpy as np @@ -47,6 +49,8 @@ NPY201.py:6:5: NPY201 [*] `np.add_newdoc` will be removed in NumPy 2.0. Use `num 8 9 | np.add_newdoc_ufunc 9 10 | + Run `ruff check --fix` to apply this fix. + NPY201.py:8:5: NPY201 `np.add_newdoc_ufunc` will be removed in NumPy 2.0. `add_newdoc_ufunc` is an internal function. | 6 | np.add_newdoc @@ -78,7 +82,7 @@ NPY201.py:12:5: NPY201 [*] `np.byte_bounds` will be removed in NumPy 2.0. Use `n | = help: Replace with `numpy.lib.array_utils.byte_bounds` (requires NumPy 2.0 or greater) -ℹ Unsafe fix +Suggested fix: 1 |+from numpy.lib.array_utils import byte_bounds 1 2 | def func(): 2 3 | import numpy as np @@ -93,6 +97,8 @@ NPY201.py:12:5: NPY201 [*] `np.byte_bounds` will be removed in NumPy 2.0. Use `n 14 15 | np.cast 15 16 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + NPY201.py:14:5: NPY201 `np.cast` will be removed in NumPy 2.0. Use `np.asarray(arr, dtype=dtype)` instead. | 12 | np.byte_bounds(np.array([1,2,3])) @@ -114,7 +120,7 @@ NPY201.py:16:5: NPY201 [*] `np.cfloat` will be removed in NumPy 2.0. Use `numpy. | = help: Replace with `numpy.complex128` -ℹ Safe fix +Suggested fix: 13 13 | 14 14 | np.cast 15 15 | @@ -124,6 +130,8 @@ NPY201.py:16:5: NPY201 [*] `np.cfloat` will be removed in NumPy 2.0. Use `numpy. 18 18 | np.clongfloat(12+34j) 19 19 | + Run `ruff check --fix` to apply this fix. + NPY201.py:18:5: NPY201 [*] `np.clongfloat` will be removed in NumPy 2.0. Use `numpy.clongdouble` instead. | 16 | np.cfloat(12+34j) @@ -135,7 +143,7 @@ NPY201.py:18:5: NPY201 [*] `np.clongfloat` will be removed in NumPy 2.0. Use `nu | = help: Replace with `numpy.clongdouble` -ℹ Safe fix +Suggested fix: 15 15 | 16 16 | np.cfloat(12+34j) 17 17 | @@ -145,6 +153,8 @@ NPY201.py:18:5: NPY201 [*] `np.clongfloat` will be removed in NumPy 2.0. Use `nu 20 20 | np.compat 21 21 | + Run `ruff check --fix` to apply this fix. + NPY201.py:20:5: NPY201 `np.compat` will be removed in NumPy 2.0. Python 2 is no longer supported. | 18 | np.clongfloat(12+34j) @@ -166,7 +176,7 @@ NPY201.py:22:5: NPY201 [*] `np.complex_` will be removed in NumPy 2.0. Use `nump | = help: Replace with `numpy.complex128` -ℹ Safe fix +Suggested fix: 19 19 | 20 20 | np.compat 21 21 | @@ -176,6 +186,8 @@ NPY201.py:22:5: NPY201 [*] `np.complex_` will be removed in NumPy 2.0. Use `nump 24 24 | np.DataSource 25 25 | + Run `ruff check --fix` to apply this fix. + NPY201.py:24:5: NPY201 [*] `np.DataSource` will be removed in NumPy 2.0. Use `numpy.lib.npyio.DataSource` instead. | 22 | np.complex_(12+34j) @@ -187,7 +199,7 @@ NPY201.py:24:5: NPY201 [*] `np.DataSource` will be removed in NumPy 2.0. Use `nu | = help: Replace with `numpy.lib.npyio.DataSource` -ℹ Safe fix +Suggested fix: 1 |+from numpy.lib.npyio import DataSource 1 2 | def func(): 2 3 | import numpy as np @@ -202,6 +214,8 @@ NPY201.py:24:5: NPY201 [*] `np.DataSource` will be removed in NumPy 2.0. Use `nu 26 27 | np.deprecate 27 28 | + Run `ruff check --fix` to apply this fix. + NPY201.py:26:5: NPY201 `np.deprecate` will be removed in NumPy 2.0. Emit `DeprecationWarning` with `warnings.warn` directly, or use `typing.deprecated`. | 24 | np.DataSource @@ -273,7 +287,7 @@ NPY201.py:38:5: NPY201 [*] `np.float_` will be removed in NumPy 2.0. Use `numpy. | = help: Replace with `numpy.float64` -ℹ Safe fix +Suggested fix: 35 35 | 36 36 | np.get_array_wrap 37 37 | @@ -283,6 +297,8 @@ NPY201.py:38:5: NPY201 [*] `np.float_` will be removed in NumPy 2.0. Use `numpy. 40 40 | np.geterrobj 41 41 | + Run `ruff check --fix` to apply this fix. + NPY201.py:40:5: NPY201 `np.geterrobj` will be removed in NumPy 2.0. Use the `np.errstate` context manager instead. | 38 | np.float_ @@ -304,7 +320,7 @@ NPY201.py:42:5: NPY201 [*] `np.Inf` will be removed in NumPy 2.0. Use `numpy.inf | = help: Replace with `numpy.inf` -ℹ Safe fix +Suggested fix: 39 39 | 40 40 | np.geterrobj 41 41 | @@ -314,6 +330,8 @@ NPY201.py:42:5: NPY201 [*] `np.Inf` will be removed in NumPy 2.0. Use `numpy.inf 44 44 | np.Infinity 45 45 | + Run `ruff check --fix` to apply this fix. + NPY201.py:44:5: NPY201 [*] `np.Infinity` will be removed in NumPy 2.0. Use `numpy.inf` instead. | 42 | np.Inf @@ -325,7 +343,7 @@ NPY201.py:44:5: NPY201 [*] `np.Infinity` will be removed in NumPy 2.0. Use `nump | = help: Replace with `numpy.inf` -ℹ Safe fix +Suggested fix: 41 41 | 42 42 | np.Inf 43 43 | @@ -335,6 +353,8 @@ NPY201.py:44:5: NPY201 [*] `np.Infinity` will be removed in NumPy 2.0. Use `nump 46 46 | np.infty 47 47 | + Run `ruff check --fix` to apply this fix. + NPY201.py:46:5: NPY201 [*] `np.infty` will be removed in NumPy 2.0. Use `numpy.inf` instead. | 44 | np.Infinity @@ -346,7 +366,7 @@ NPY201.py:46:5: NPY201 [*] `np.infty` will be removed in NumPy 2.0. Use `numpy.i | = help: Replace with `numpy.inf` -ℹ Safe fix +Suggested fix: 43 43 | 44 44 | np.Infinity 45 45 | @@ -356,6 +376,8 @@ NPY201.py:46:5: NPY201 [*] `np.infty` will be removed in NumPy 2.0. Use `numpy.i 48 48 | np.issctype 49 49 | + Run `ruff check --fix` to apply this fix. + NPY201.py:48:5: NPY201 `np.issctype` will be removed without replacement in NumPy 2.0 | 46 | np.infty @@ -377,7 +399,7 @@ NPY201.py:50:5: NPY201 [*] `np.issubclass_` will be removed in NumPy 2.0. Use `i | = help: Replace with `issubclass` -ℹ Safe fix +Suggested fix: 47 47 | 48 48 | np.issctype 49 49 | @@ -387,6 +409,8 @@ NPY201.py:50:5: NPY201 [*] `np.issubclass_` will be removed in NumPy 2.0. Use `i 52 52 | np.issubsctype 53 53 | + Run `ruff check --fix` to apply this fix. + NPY201.py:52:5: NPY201 [*] `np.issubsctype` will be removed in NumPy 2.0. Use `numpy.issubdtype` instead. | 50 | np.issubclass_(np.int32, np.integer) @@ -398,7 +422,7 @@ NPY201.py:52:5: NPY201 [*] `np.issubsctype` will be removed in NumPy 2.0. Use `n | = help: Replace with `numpy.issubdtype` -ℹ Safe fix +Suggested fix: 49 49 | 50 50 | np.issubclass_(np.int32, np.integer) 51 51 | @@ -408,6 +432,8 @@ NPY201.py:52:5: NPY201 [*] `np.issubsctype` will be removed in NumPy 2.0. Use `n 54 54 | np.mat 55 55 | + Run `ruff check --fix` to apply this fix. + NPY201.py:54:5: NPY201 [*] `np.mat` will be removed in NumPy 2.0. Use `numpy.asmatrix` instead. | 52 | np.issubsctype @@ -419,7 +445,7 @@ NPY201.py:54:5: NPY201 [*] `np.mat` will be removed in NumPy 2.0. Use `numpy.asm | = help: Replace with `numpy.asmatrix` -ℹ Safe fix +Suggested fix: 51 51 | 52 52 | np.issubsctype 53 53 | @@ -429,6 +455,8 @@ NPY201.py:54:5: NPY201 [*] `np.mat` will be removed in NumPy 2.0. Use `numpy.asm 56 56 | np.maximum_sctype 57 57 | + Run `ruff check --fix` to apply this fix. + NPY201.py:56:5: NPY201 `np.maximum_sctype` will be removed without replacement in NumPy 2.0 | 54 | np.mat @@ -450,7 +478,7 @@ NPY201.py:58:5: NPY201 [*] `np.NaN` will be removed in NumPy 2.0. Use `numpy.nan | = help: Replace with `numpy.nan` -ℹ Safe fix +Suggested fix: 55 55 | 56 56 | np.maximum_sctype 57 57 | @@ -460,6 +488,8 @@ NPY201.py:58:5: NPY201 [*] `np.NaN` will be removed in NumPy 2.0. Use `numpy.nan 60 60 | np.nbytes[np.int64] 61 61 | + Run `ruff check --fix` to apply this fix. + NPY201.py:60:5: NPY201 `np.nbytes` will be removed in NumPy 2.0. Use `np.dtype().itemsize` instead. | 58 | np.NaN @@ -481,7 +511,7 @@ NPY201.py:62:5: NPY201 [*] `np.NINF` will be removed in NumPy 2.0. Use `-np.inf` | = help: Replace with `-np.inf` -ℹ Safe fix +Suggested fix: 59 59 | 60 60 | np.nbytes[np.int64] 61 61 | @@ -491,6 +521,8 @@ NPY201.py:62:5: NPY201 [*] `np.NINF` will be removed in NumPy 2.0. Use `-np.inf` 64 64 | np.NZERO 65 65 | + Run `ruff check --fix` to apply this fix. + NPY201.py:64:5: NPY201 [*] `np.NZERO` will be removed in NumPy 2.0. Use `-0.0` instead. | 62 | np.NINF @@ -502,7 +534,7 @@ NPY201.py:64:5: NPY201 [*] `np.NZERO` will be removed in NumPy 2.0. Use `-0.0` i | = help: Replace with `-0.0` -ℹ Safe fix +Suggested fix: 61 61 | 62 62 | np.NINF 63 63 | @@ -512,6 +544,8 @@ NPY201.py:64:5: NPY201 [*] `np.NZERO` will be removed in NumPy 2.0. Use `-0.0` i 66 66 | np.longcomplex(12+34j) 67 67 | + Run `ruff check --fix` to apply this fix. + NPY201.py:66:5: NPY201 [*] `np.longcomplex` will be removed in NumPy 2.0. Use `numpy.clongdouble` instead. | 64 | np.NZERO @@ -523,7 +557,7 @@ NPY201.py:66:5: NPY201 [*] `np.longcomplex` will be removed in NumPy 2.0. Use `n | = help: Replace with `numpy.clongdouble` -ℹ Safe fix +Suggested fix: 63 63 | 64 64 | np.NZERO 65 65 | @@ -533,6 +567,8 @@ NPY201.py:66:5: NPY201 [*] `np.longcomplex` will be removed in NumPy 2.0. Use `n 68 68 | np.longfloat(12+34j) 69 69 | + Run `ruff check --fix` to apply this fix. + NPY201.py:68:5: NPY201 [*] `np.longfloat` will be removed in NumPy 2.0. Use `numpy.longdouble` instead. | 66 | np.longcomplex(12+34j) @@ -544,7 +580,7 @@ NPY201.py:68:5: NPY201 [*] `np.longfloat` will be removed in NumPy 2.0. Use `num | = help: Replace with `numpy.longdouble` -ℹ Safe fix +Suggested fix: 65 65 | 66 66 | np.longcomplex(12+34j) 67 67 | @@ -554,6 +590,8 @@ NPY201.py:68:5: NPY201 [*] `np.longfloat` will be removed in NumPy 2.0. Use `num 70 70 | np.lookfor 71 71 | + Run `ruff check --fix` to apply this fix. + NPY201.py:70:5: NPY201 `np.lookfor` will be removed in NumPy 2.0. Search NumPy’s documentation directly. | 68 | np.longfloat(12+34j) @@ -575,7 +613,7 @@ NPY201.py:72:5: NPY201 [*] `np.NAN` will be removed in NumPy 2.0. Use `numpy.nan | = help: Replace with `numpy.nan` -ℹ Safe fix +Suggested fix: 69 69 | 70 70 | np.lookfor 71 71 | @@ -584,3 +622,5 @@ NPY201.py:72:5: NPY201 [*] `np.NAN` will be removed in NumPy 2.0. Use `numpy.nan 73 73 | 74 74 | try: 75 75 | from numpy.lib.npyio import DataSource + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap index 56be229615aa6..0793005f7abb3 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap @@ -22,7 +22,7 @@ NPY201_2.py:6:5: NPY201 [*] `np.PINF` will be removed in NumPy 2.0. Use `numpy.i | = help: Replace with `numpy.inf` -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | np.obj2sctype(int) 5 5 | @@ -32,6 +32,8 @@ NPY201_2.py:6:5: NPY201 [*] `np.PINF` will be removed in NumPy 2.0. Use `numpy.i 8 8 | np.PZERO 9 9 | + Run `ruff check --fix` to apply this fix. + NPY201_2.py:8:5: NPY201 [*] `np.PZERO` will be removed in NumPy 2.0. Use `0.0` instead. | 6 | np.PINF @@ -43,7 +45,7 @@ NPY201_2.py:8:5: NPY201 [*] `np.PZERO` will be removed in NumPy 2.0. Use `0.0` i | = help: Replace with `0.0` -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | np.PINF 7 7 | @@ -53,6 +55,8 @@ NPY201_2.py:8:5: NPY201 [*] `np.PZERO` will be removed in NumPy 2.0. Use `0.0` i 10 10 | np.recfromcsv 11 11 | + Run `ruff check --fix` to apply this fix. + NPY201_2.py:10:5: NPY201 `np.recfromcsv` will be removed in NumPy 2.0. Use `np.genfromtxt` with comma delimiter instead. | 8 | np.PZERO @@ -84,7 +88,7 @@ NPY201_2.py:14:5: NPY201 [*] `np.round_` will be removed in NumPy 2.0. Use `nump | = help: Replace with `numpy.round` -ℹ Safe fix +Suggested fix: 11 11 | 12 12 | np.recfromtxt 13 13 | @@ -94,6 +98,8 @@ NPY201_2.py:14:5: NPY201 [*] `np.round_` will be removed in NumPy 2.0. Use `nump 16 16 | np.safe_eval 17 17 | + Run `ruff check --fix` to apply this fix. + NPY201_2.py:16:5: NPY201 [*] `np.safe_eval` will be removed in NumPy 2.0. Use `ast.literal_eval` instead. | 14 | np.round_(12.34) @@ -105,7 +111,7 @@ NPY201_2.py:16:5: NPY201 [*] `np.safe_eval` will be removed in NumPy 2.0. Use `a | = help: Replace with `ast.literal_eval` -ℹ Safe fix +Suggested fix: 1 |+from ast import literal_eval 1 2 | def func(): 2 3 | import numpy as np @@ -120,6 +126,8 @@ NPY201_2.py:16:5: NPY201 [*] `np.safe_eval` will be removed in NumPy 2.0. Use `a 18 19 | np.sctype2char 19 20 | + Run `ruff check --fix` to apply this fix. + NPY201_2.py:18:5: NPY201 `np.sctype2char` will be removed without replacement in NumPy 2.0 | 16 | np.safe_eval @@ -171,7 +179,7 @@ NPY201_2.py:28:5: NPY201 [*] `np.singlecomplex` will be removed in NumPy 2.0. Us | = help: Replace with `numpy.complex64` -ℹ Safe fix +Suggested fix: 25 25 | 26 26 | np.set_string_function 27 27 | @@ -181,6 +189,8 @@ NPY201_2.py:28:5: NPY201 [*] `np.singlecomplex` will be removed in NumPy 2.0. Us 30 30 | np.string_("asdf") 31 31 | + Run `ruff check --fix` to apply this fix. + NPY201_2.py:30:5: NPY201 [*] `np.string_` will be removed in NumPy 2.0. Use `numpy.bytes_` instead. | 28 | np.singlecomplex(12+1j) @@ -192,7 +202,7 @@ NPY201_2.py:30:5: NPY201 [*] `np.string_` will be removed in NumPy 2.0. Use `num | = help: Replace with `numpy.bytes_` -ℹ Safe fix +Suggested fix: 27 27 | 28 28 | np.singlecomplex(12+1j) 29 29 | @@ -202,6 +212,8 @@ NPY201_2.py:30:5: NPY201 [*] `np.string_` will be removed in NumPy 2.0. Use `num 32 32 | np.source 33 33 | + Run `ruff check --fix` to apply this fix. + NPY201_2.py:32:5: NPY201 [*] `np.source` will be removed in NumPy 2.0. Use `inspect.getsource` instead. | 30 | np.string_("asdf") @@ -213,7 +225,7 @@ NPY201_2.py:32:5: NPY201 [*] `np.source` will be removed in NumPy 2.0. Use `insp | = help: Replace with `inspect.getsource` -ℹ Safe fix +Suggested fix: 1 |+from inspect import getsource 1 2 | def func(): 2 3 | import numpy as np @@ -228,6 +240,8 @@ NPY201_2.py:32:5: NPY201 [*] `np.source` will be removed in NumPy 2.0. Use `insp 34 35 | np.tracemalloc_domain 35 36 | + Run `ruff check --fix` to apply this fix. + NPY201_2.py:34:5: NPY201 [*] `np.tracemalloc_domain` will be removed in NumPy 2.0. Use `numpy.lib.tracemalloc_domain` instead. | 32 | np.source @@ -239,7 +253,7 @@ NPY201_2.py:34:5: NPY201 [*] `np.tracemalloc_domain` will be removed in NumPy 2. | = help: Replace with `numpy.lib.tracemalloc_domain` -ℹ Safe fix +Suggested fix: 1 |+from numpy.lib import tracemalloc_domain 1 2 | def func(): 2 3 | import numpy as np @@ -254,6 +268,8 @@ NPY201_2.py:34:5: NPY201 [*] `np.tracemalloc_domain` will be removed in NumPy 2. 36 37 | np.unicode_("asf") 37 38 | + Run `ruff check --fix` to apply this fix. + NPY201_2.py:36:5: NPY201 [*] `np.unicode_` will be removed in NumPy 2.0. Use `numpy.str_` instead. | 34 | np.tracemalloc_domain @@ -265,7 +281,7 @@ NPY201_2.py:36:5: NPY201 [*] `np.unicode_` will be removed in NumPy 2.0. Use `nu | = help: Replace with `numpy.str_` -ℹ Safe fix +Suggested fix: 33 33 | 34 34 | np.tracemalloc_domain 35 35 | @@ -275,6 +291,8 @@ NPY201_2.py:36:5: NPY201 [*] `np.unicode_` will be removed in NumPy 2.0. Use `nu 38 38 | np.who() 39 39 | + Run `ruff check --fix` to apply this fix. + NPY201_2.py:38:5: NPY201 `np.who` will be removed in NumPy 2.0. Use an IDE variable explorer or `locals()` instead. | 36 | np.unicode_("asf") @@ -296,7 +314,7 @@ NPY201_2.py:40:5: NPY201 [*] `np.row_stack` will be removed in NumPy 2.0. Use `n | = help: Replace with `numpy.vstack` -ℹ Safe fix +Suggested fix: 37 37 | 38 38 | np.who() 39 39 | @@ -306,6 +324,8 @@ NPY201_2.py:40:5: NPY201 [*] `np.row_stack` will be removed in NumPy 2.0. Use `n 42 42 | np.alltrue([True, True]) 43 43 | + Run `ruff check --fix` to apply this fix. + NPY201_2.py:42:5: NPY201 [*] `np.alltrue` will be removed in NumPy 2.0. Use `numpy.all` instead. | 40 | np.row_stack(([1,2], [3,4])) @@ -317,7 +337,7 @@ NPY201_2.py:42:5: NPY201 [*] `np.alltrue` will be removed in NumPy 2.0. Use `num | = help: Replace with `numpy.all` -ℹ Safe fix +Suggested fix: 39 39 | 40 40 | np.row_stack(([1,2], [3,4])) 41 41 | @@ -327,6 +347,8 @@ NPY201_2.py:42:5: NPY201 [*] `np.alltrue` will be removed in NumPy 2.0. Use `num 44 44 | np.sometrue([True, False]) 45 45 | + Run `ruff check --fix` to apply this fix. + NPY201_2.py:44:5: NPY201 [*] `np.sometrue` will be removed in NumPy 2.0. Use `numpy.any` instead. | 42 | np.alltrue([True, True]) @@ -338,7 +360,7 @@ NPY201_2.py:44:5: NPY201 [*] `np.sometrue` will be removed in NumPy 2.0. Use `nu | = help: Replace with `numpy.any` -ℹ Safe fix +Suggested fix: 41 41 | 42 42 | np.alltrue([True, True]) 43 43 | @@ -348,6 +370,8 @@ NPY201_2.py:44:5: NPY201 [*] `np.sometrue` will be removed in NumPy 2.0. Use `nu 46 46 | np.cumproduct([1, 2, 3]) 47 47 | + Run `ruff check --fix` to apply this fix. + NPY201_2.py:46:5: NPY201 [*] `np.cumproduct` will be removed in NumPy 2.0. Use `numpy.cumprod` instead. | 44 | np.sometrue([True, False]) @@ -359,7 +383,7 @@ NPY201_2.py:46:5: NPY201 [*] `np.cumproduct` will be removed in NumPy 2.0. Use ` | = help: Replace with `numpy.cumprod` -ℹ Safe fix +Suggested fix: 43 43 | 44 44 | np.sometrue([True, False]) 45 45 | @@ -369,6 +393,8 @@ NPY201_2.py:46:5: NPY201 [*] `np.cumproduct` will be removed in NumPy 2.0. Use ` 48 48 | np.product([1, 2, 3]) 49 49 | + Run `ruff check --fix` to apply this fix. + NPY201_2.py:48:5: NPY201 [*] `np.product` will be removed in NumPy 2.0. Use `numpy.prod` instead. | 46 | np.cumproduct([1, 2, 3]) @@ -380,7 +406,7 @@ NPY201_2.py:48:5: NPY201 [*] `np.product` will be removed in NumPy 2.0. Use `num | = help: Replace with `numpy.prod` -ℹ Safe fix +Suggested fix: 45 45 | 46 46 | np.cumproduct([1, 2, 3]) 47 47 | @@ -390,6 +416,8 @@ NPY201_2.py:48:5: NPY201 [*] `np.product` will be removed in NumPy 2.0. Use `num 50 50 | np.trapz([1, 2, 3]) 51 51 | + Run `ruff check --fix` to apply this fix. + NPY201_2.py:50:5: NPY201 [*] `np.trapz` will be removed in NumPy 2.0. Use `numpy.trapezoid` on NumPy 2.0, or ignore this warning on earlier versions. | 48 | np.product([1, 2, 3]) @@ -401,7 +429,7 @@ NPY201_2.py:50:5: NPY201 [*] `np.trapz` will be removed in NumPy 2.0. Use `numpy | = help: Replace with `numpy.trapezoid` (requires NumPy 2.0 or greater) -ℹ Unsafe fix +Suggested fix: 47 47 | 48 48 | np.product([1, 2, 3]) 49 49 | @@ -411,6 +439,8 @@ NPY201_2.py:50:5: NPY201 [*] `np.trapz` will be removed in NumPy 2.0. Use `numpy 52 52 | np.in1d([1, 2], [1, 3, 5]) 53 53 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + NPY201_2.py:52:5: NPY201 [*] `np.in1d` will be removed in NumPy 2.0. Use `numpy.isin` instead. | 50 | np.trapz([1, 2, 3]) @@ -422,7 +452,7 @@ NPY201_2.py:52:5: NPY201 [*] `np.in1d` will be removed in NumPy 2.0. Use `numpy. | = help: Replace with `numpy.isin` -ℹ Safe fix +Suggested fix: 49 49 | 50 50 | np.trapz([1, 2, 3]) 51 51 | @@ -432,6 +462,8 @@ NPY201_2.py:52:5: NPY201 [*] `np.in1d` will be removed in NumPy 2.0. Use `numpy. 54 54 | np.AxisError 55 55 | + Run `ruff check --fix` to apply this fix. + NPY201_2.py:54:5: NPY201 [*] `np.AxisError` will be removed in NumPy 2.0. Use `numpy.exceptions.AxisError` instead. | 52 | np.in1d([1, 2], [1, 3, 5]) @@ -443,7 +475,7 @@ NPY201_2.py:54:5: NPY201 [*] `np.AxisError` will be removed in NumPy 2.0. Use `n | = help: Replace with `numpy.exceptions.AxisError` -ℹ Safe fix +Suggested fix: 1 |+from numpy.exceptions import AxisError 1 2 | def func(): 2 3 | import numpy as np @@ -458,6 +490,8 @@ NPY201_2.py:54:5: NPY201 [*] `np.AxisError` will be removed in NumPy 2.0. Use `n 56 57 | np.ComplexWarning 57 58 | + Run `ruff check --fix` to apply this fix. + NPY201_2.py:56:5: NPY201 [*] `np.ComplexWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.ComplexWarning` instead. | 54 | np.AxisError @@ -469,7 +503,7 @@ NPY201_2.py:56:5: NPY201 [*] `np.ComplexWarning` will be removed in NumPy 2.0. U | = help: Replace with `numpy.exceptions.ComplexWarning` -ℹ Safe fix +Suggested fix: 1 |+from numpy.exceptions import ComplexWarning 1 2 | def func(): 2 3 | import numpy as np @@ -484,6 +518,8 @@ NPY201_2.py:56:5: NPY201 [*] `np.ComplexWarning` will be removed in NumPy 2.0. U 58 59 | np.compare_chararrays 59 60 | + Run `ruff check --fix` to apply this fix. + NPY201_2.py:58:5: NPY201 [*] `np.compare_chararrays` will be removed in NumPy 2.0. Use `numpy.char.compare_chararrays` instead. | 56 | np.ComplexWarning @@ -495,7 +531,7 @@ NPY201_2.py:58:5: NPY201 [*] `np.compare_chararrays` will be removed in NumPy 2. | = help: Replace with `numpy.char.compare_chararrays` -ℹ Safe fix +Suggested fix: 1 |+from numpy.char import compare_chararrays 1 2 | def func(): 2 3 | import numpy as np @@ -510,6 +546,8 @@ NPY201_2.py:58:5: NPY201 [*] `np.compare_chararrays` will be removed in NumPy 2. 60 61 | try: 61 62 | np.all([True, True]) + Run `ruff check --fix` to apply this fix. + NPY201_2.py:63:9: NPY201 [*] `np.alltrue` will be removed in NumPy 2.0. Use `numpy.all` instead. | 61 | np.all([True, True]) @@ -521,7 +559,7 @@ NPY201_2.py:63:9: NPY201 [*] `np.alltrue` will be removed in NumPy 2.0. Use `num | = help: Replace with `numpy.all` -ℹ Safe fix +Suggested fix: 60 60 | try: 61 61 | np.all([True, True]) 62 62 | except TypeError: @@ -531,6 +569,8 @@ NPY201_2.py:63:9: NPY201 [*] `np.alltrue` will be removed in NumPy 2.0. Use `num 65 65 | try: 66 66 | np.anyyyy([True, True]) + Run `ruff check --fix` to apply this fix. + NPY201_2.py:68:9: NPY201 [*] `np.sometrue` will be removed in NumPy 2.0. Use `numpy.any` instead. | 66 | np.anyyyy([True, True]) @@ -541,7 +581,7 @@ NPY201_2.py:68:9: NPY201 [*] `np.sometrue` will be removed in NumPy 2.0. Use `nu | = help: Replace with `numpy.any` -ℹ Safe fix +Suggested fix: 65 65 | try: 66 66 | np.anyyyy([True, True]) 67 67 | except AttributeError: @@ -550,3 +590,5 @@ NPY201_2.py:68:9: NPY201 [*] `np.sometrue` will be removed in NumPy 2.0. Use `nu 69 69 | # (must have an attribute access of the undeprecated name in the `try` body for it to be ignored) 70 70 | 71 71 | try: + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap index 2ba8e85fa30d1..e706aed64a60e 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap @@ -12,7 +12,7 @@ NPY201_3.py:4:5: NPY201 [*] `np.DTypePromotionError` will be removed in NumPy 2. | = help: Replace with `numpy.exceptions.DTypePromotionError` -ℹ Safe fix +Suggested fix: 1 |+from numpy.exceptions import DTypePromotionError 1 2 | def func(): 2 3 | import numpy as np @@ -23,6 +23,8 @@ NPY201_3.py:4:5: NPY201 [*] `np.DTypePromotionError` will be removed in NumPy 2. 6 7 | np.ModuleDeprecationWarning 7 8 | + Run `ruff check --fix` to apply this fix. + NPY201_3.py:6:5: NPY201 [*] `np.ModuleDeprecationWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.ModuleDeprecationWarning` instead. | 4 | np.DTypePromotionError @@ -34,7 +36,7 @@ NPY201_3.py:6:5: NPY201 [*] `np.ModuleDeprecationWarning` will be removed in Num | = help: Replace with `numpy.exceptions.ModuleDeprecationWarning` -ℹ Safe fix +Suggested fix: 1 |+from numpy.exceptions import ModuleDeprecationWarning 1 2 | def func(): 2 3 | import numpy as np @@ -47,6 +49,8 @@ NPY201_3.py:6:5: NPY201 [*] `np.ModuleDeprecationWarning` will be removed in Num 8 9 | np.RankWarning 9 10 | + Run `ruff check --fix` to apply this fix. + NPY201_3.py:8:5: NPY201 [*] `np.RankWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.RankWarning` on NumPy 2.0, or ignore this warning on earlier versions. | 6 | np.ModuleDeprecationWarning @@ -58,7 +62,7 @@ NPY201_3.py:8:5: NPY201 [*] `np.RankWarning` will be removed in NumPy 2.0. Use ` | = help: Replace with `numpy.exceptions.RankWarning` (requires NumPy 2.0 or greater) -ℹ Unsafe fix +Suggested fix: 1 |+from numpy.exceptions import RankWarning 1 2 | def func(): 2 3 | import numpy as np @@ -73,6 +77,8 @@ NPY201_3.py:8:5: NPY201 [*] `np.RankWarning` will be removed in NumPy 2.0. Use ` 10 11 | np.TooHardError 11 12 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + NPY201_3.py:10:5: NPY201 [*] `np.TooHardError` will be removed in NumPy 2.0. Use `numpy.exceptions.TooHardError` instead. | 8 | np.RankWarning @@ -84,7 +90,7 @@ NPY201_3.py:10:5: NPY201 [*] `np.TooHardError` will be removed in NumPy 2.0. Use | = help: Replace with `numpy.exceptions.TooHardError` -ℹ Safe fix +Suggested fix: 1 |+from numpy.exceptions import TooHardError 1 2 | def func(): 2 3 | import numpy as np @@ -99,6 +105,8 @@ NPY201_3.py:10:5: NPY201 [*] `np.TooHardError` will be removed in NumPy 2.0. Use 12 13 | np.VisibleDeprecationWarning 13 14 | + Run `ruff check --fix` to apply this fix. + NPY201_3.py:12:5: NPY201 [*] `np.VisibleDeprecationWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.VisibleDeprecationWarning` instead. | 10 | np.TooHardError @@ -110,7 +118,7 @@ NPY201_3.py:12:5: NPY201 [*] `np.VisibleDeprecationWarning` will be removed in N | = help: Replace with `numpy.exceptions.VisibleDeprecationWarning` -ℹ Safe fix +Suggested fix: 1 |+from numpy.exceptions import VisibleDeprecationWarning 1 2 | def func(): 2 3 | import numpy as np @@ -125,6 +133,8 @@ NPY201_3.py:12:5: NPY201 [*] `np.VisibleDeprecationWarning` will be removed in N 14 15 | np.chararray 15 16 | + Run `ruff check --fix` to apply this fix. + NPY201_3.py:14:5: NPY201 [*] `np.chararray` will be removed in NumPy 2.0. Use `numpy.char.chararray` instead. | 12 | np.VisibleDeprecationWarning @@ -136,7 +146,7 @@ NPY201_3.py:14:5: NPY201 [*] `np.chararray` will be removed in NumPy 2.0. Use `n | = help: Replace with `numpy.char.chararray` -ℹ Safe fix +Suggested fix: 1 |+from numpy.char import chararray 1 2 | def func(): 2 3 | import numpy as np @@ -150,6 +160,8 @@ NPY201_3.py:14:5: NPY201 [*] `np.chararray` will be removed in NumPy 2.0. Use `n 15 16 | 16 17 | np.format_parser + Run `ruff check --fix` to apply this fix. + NPY201_3.py:16:5: NPY201 [*] `np.format_parser` will be removed in NumPy 2.0. Use `numpy.rec.format_parser` instead. | 14 | np.chararray @@ -159,7 +171,7 @@ NPY201_3.py:16:5: NPY201 [*] `np.format_parser` will be removed in NumPy 2.0. Us | = help: Replace with `numpy.rec.format_parser` -ℹ Safe fix +Suggested fix: 1 |+from numpy.rec import format_parser 1 2 | def func(): 2 3 | import numpy as np @@ -170,3 +182,5 @@ NPY201_3.py:16:5: NPY201 [*] `np.format_parser` will be removed in NumPy 2.0. Us 15 16 | 16 |- np.format_parser 17 |+ format_parser + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap index 4b95a1c29a686..b6b69139ee90f 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap @@ -12,7 +12,7 @@ PD002.py:5:23: PD002 [*] `inplace=True` should be avoided; it has inconsistent b | = help: Assign to variable; remove `inplace` arg -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | x = pd.DataFrame() 4 4 | @@ -22,6 +22,8 @@ PD002.py:5:23: PD002 [*] `inplace=True` should be avoided; it has inconsistent b 7 7 | x.y.drop(["a"], axis=1, inplace=True) 8 8 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PD002.py:7:25: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 5 | x.drop(["a"], axis=1, inplace=True) @@ -33,7 +35,7 @@ PD002.py:7:25: PD002 [*] `inplace=True` should be avoided; it has inconsistent b | = help: Assign to variable; remove `inplace` arg -ℹ Unsafe fix +Suggested fix: 4 4 | 5 5 | x.drop(["a"], axis=1, inplace=True) 6 6 | @@ -43,6 +45,8 @@ PD002.py:7:25: PD002 [*] `inplace=True` should be avoided; it has inconsistent b 9 9 | x["y"].drop(["a"], axis=1, inplace=True) 10 10 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PD002.py:9:28: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 7 | x.y.drop(["a"], axis=1, inplace=True) @@ -54,7 +58,7 @@ PD002.py:9:28: PD002 [*] `inplace=True` should be avoided; it has inconsistent b | = help: Assign to variable; remove `inplace` arg -ℹ Unsafe fix +Suggested fix: 6 6 | 7 7 | x.y.drop(["a"], axis=1, inplace=True) 8 8 | @@ -64,6 +68,8 @@ PD002.py:9:28: PD002 [*] `inplace=True` should be avoided; it has inconsistent b 11 11 | x.drop( 12 12 | inplace=True, + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PD002.py:12:5: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 11 | x.drop( @@ -74,7 +80,7 @@ PD002.py:12:5: PD002 [*] `inplace=True` should be avoided; it has inconsistent b | = help: Assign to variable; remove `inplace` arg -ℹ Unsafe fix +Suggested fix: 8 8 | 9 9 | x["y"].drop(["a"], axis=1, inplace=True) 10 10 | @@ -85,6 +91,8 @@ PD002.py:12:5: PD002 [*] `inplace=True` should be avoided; it has inconsistent b 14 13 | axis=1, 15 14 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PD002.py:19:9: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 17 | if True: @@ -96,7 +104,7 @@ PD002.py:19:9: PD002 [*] `inplace=True` should be avoided; it has inconsistent b | = help: Assign to variable; remove `inplace` arg -ℹ Unsafe fix +Suggested fix: 15 15 | ) 16 16 | 17 17 | if True: @@ -107,6 +115,8 @@ PD002.py:19:9: PD002 [*] `inplace=True` should be avoided; it has inconsistent b 21 20 | axis=1, 22 21 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PD002.py:24:33: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 22 | ) @@ -118,7 +128,7 @@ PD002.py:24:33: PD002 [*] `inplace=True` should be avoided; it has inconsistent | = help: Assign to variable; remove `inplace` arg -ℹ Unsafe fix +Suggested fix: 21 21 | axis=1, 22 22 | ) 23 23 | @@ -128,6 +138,8 @@ PD002.py:24:33: PD002 [*] `inplace=True` should be avoided; it has inconsistent 26 26 | f(x.drop(["a"], axis=1, inplace=True)) 27 27 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PD002.py:25:23: PD002 `inplace=True` should be avoided; it has inconsistent behavior | 24 | x.drop(["a"], axis=1, **kwargs, inplace=True) @@ -169,7 +181,7 @@ PD002.py:33:24: PD002 [*] `inplace=True` should be avoided; it has inconsistent | = help: Assign to variable; remove `inplace` arg -ℹ Unsafe fix +Suggested fix: 30 30 | 31 31 | torch.m.ReLU(inplace=True) # safe because this isn't a pandas call 32 32 | @@ -179,4 +191,4 @@ PD002.py:33:24: PD002 [*] `inplace=True` should be avoided; it has inconsistent 35 35 | # This method doesn't take exist in Pandas, so ignore it. 36 36 | x.rotate_z(45, inplace=True) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap index f6335bd09177a..e1e2c5da672e6 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap @@ -10,11 +10,11 @@ source: crates/ruff_linter/src/rules/pandas_vet/mod.rs | = help: Assign to variable; remove `inplace` arg -ℹ Unsafe fix +Suggested fix: 1 1 | 2 2 | import pandas as pd 3 3 | x = pd.DataFrame() 4 |-x.drop(["a"], axis=1, inplace=True) 4 |+x = x.drop(["a"], axis=1) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N804_N804.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N804_N804.py.snap index ae7c7a8bc9c07..a87dee2d67a04 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N804_N804.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N804_N804.py.snap @@ -11,7 +11,7 @@ N804.py:30:27: N804 [*] First argument of a class method should be named `cls` | = help: Rename `self` to `cls` -ℹ Unsafe fix +Suggested fix: 27 27 | def __new__(cls, *args, **kwargs): 28 28 | ... 29 29 | @@ -21,6 +21,8 @@ N804.py:30:27: N804 [*] First argument of a class method should be named `cls` 32 32 | 33 33 | @classmethod + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N804.py:38:56: N804 [*] First argument of a class method should be named `cls` | 37 | @classmethod @@ -30,7 +32,7 @@ N804.py:38:56: N804 [*] First argument of a class method should be named `cls` | = help: Rename `self` to `cls` -ℹ Unsafe fix +Suggested fix: 35 35 | ... 36 36 | 37 37 | @classmethod @@ -40,6 +42,8 @@ N804.py:38:56: N804 [*] First argument of a class method should be named `cls` 40 40 | 41 41 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N804.py:43:20: N804 [*] First argument of a class method should be named `cls` | 42 | class MetaClass(ABCMeta): @@ -49,7 +53,7 @@ N804.py:43:20: N804 [*] First argument of a class method should be named `cls` | = help: Rename `self` to `cls` -ℹ Unsafe fix +Suggested fix: 40 40 | 41 41 | 42 42 | class MetaClass(ABCMeta): @@ -59,6 +63,8 @@ N804.py:43:20: N804 [*] First argument of a class method should be named `cls` 45 45 | 46 46 | def good_method(cls): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N804.py:54:25: N804 First argument of a class method should be named `cls` | 53 | class ClsInArgsClass(ABCMeta): @@ -118,7 +124,7 @@ N804.py:70:20: N804 [*] First argument of a class method should be named `cls` | = help: Rename `this` to `cls` -ℹ Unsafe fix +Suggested fix: 67 67 | pass 68 68 | 69 69 | class RenamingInMethodBodyClass(ABCMeta): @@ -132,6 +138,8 @@ N804.py:70:20: N804 [*] First argument of a class method should be named `cls` 74 74 | def bad_method(this): 75 75 | self = this + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N804.py:74:20: N804 [*] First argument of a class method should be named `cls` | 72 | this @@ -142,7 +150,7 @@ N804.py:74:20: N804 [*] First argument of a class method should be named `cls` | = help: Rename `this` to `cls` -ℹ Unsafe fix +Suggested fix: 71 71 | this = this 72 72 | this 73 73 | @@ -153,3 +161,5 @@ N804.py:74:20: N804 [*] First argument of a class method should be named `cls` 76 76 | 77 77 | def func(x): 78 78 | return x + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N805_N805.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N805_N805.py.snap index dfc03bc7ba38e..ffb4d55f73754 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N805_N805.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N805_N805.py.snap @@ -10,7 +10,7 @@ N805.py:7:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 4 4 | 5 5 | 6 6 | class Class: @@ -20,6 +20,8 @@ N805.py:7:20: N805 [*] First argument of a method should be named `self` 9 9 | 10 10 | if False: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:11:30: N805 [*] First argument of a method should be named `self` | 10 | if False: @@ -29,7 +31,7 @@ N805.py:11:30: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 8 8 | pass 9 9 | 10 10 | if False: @@ -39,6 +41,8 @@ N805.py:11:30: N805 [*] First argument of a method should be named `self` 13 13 | 14 14 | def good_method(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:30:15: N805 [*] First argument of a method should be named `self` | 29 | @pydantic.validator @@ -48,7 +52,7 @@ N805.py:30:15: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -ℹ Unsafe fix +Suggested fix: 27 27 | return x 28 28 | 29 29 | @pydantic.validator @@ -58,6 +62,8 @@ N805.py:30:15: N805 [*] First argument of a method should be named `self` 32 32 | 33 33 | @pydantic.validator("my_field") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:34:15: N805 [*] First argument of a method should be named `self` | 33 | @pydantic.validator("my_field") @@ -67,7 +73,7 @@ N805.py:34:15: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -ℹ Unsafe fix +Suggested fix: 31 31 | pass 32 32 | 33 33 | @pydantic.validator("my_field") @@ -77,6 +83,8 @@ N805.py:34:15: N805 [*] First argument of a method should be named `self` 36 36 | 37 37 | def __init__(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:63:29: N805 [*] First argument of a method should be named `self` | 61 | pass @@ -87,7 +95,7 @@ N805.py:63:29: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 60 60 | def good_method_pos_only(self, blah, /, something: str): 61 61 | pass 62 62 | @@ -97,6 +105,8 @@ N805.py:63:29: N805 [*] First argument of a method should be named `self` 65 65 | 66 66 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:69:13: N805 [*] First argument of a method should be named `self` | 67 | class ModelClass: @@ -107,7 +117,7 @@ N805.py:69:13: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -ℹ Unsafe fix +Suggested fix: 66 66 | 67 67 | class ModelClass: 68 68 | @hybrid_property @@ -117,6 +127,8 @@ N805.py:69:13: N805 [*] First argument of a method should be named `self` 71 71 | 72 72 | @bad.expression + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:77:13: N805 [*] First argument of a method should be named `self` | 76 | @bad.wtf @@ -126,7 +138,7 @@ N805.py:77:13: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -ℹ Unsafe fix +Suggested fix: 74 74 | pass 75 75 | 76 76 | @bad.wtf @@ -136,6 +148,8 @@ N805.py:77:13: N805 [*] First argument of a method should be named `self` 79 79 | 80 80 | @hybrid_property + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:85:14: N805 [*] First argument of a method should be named `self` | 84 | @good.expression @@ -145,7 +159,7 @@ N805.py:85:14: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -ℹ Unsafe fix +Suggested fix: 82 82 | pass 83 83 | 84 84 | @good.expression @@ -155,6 +169,8 @@ N805.py:85:14: N805 [*] First argument of a method should be named `self` 87 87 | 88 88 | @good.wtf + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:93:19: N805 [*] First argument of a method should be named `self` | 92 | @foobar.thisisstatic @@ -164,7 +180,7 @@ N805.py:93:19: N805 [*] First argument of a method should be named `self` | = help: Rename `foo` to `self` -ℹ Unsafe fix +Suggested fix: 90 90 | pass 91 91 | 92 92 | @foobar.thisisstatic @@ -174,6 +190,8 @@ N805.py:93:19: N805 [*] First argument of a method should be named `self` 95 95 | 96 96 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:98:26: N805 First argument of a method should be named `self` | 97 | class SelfInArgsClass: @@ -233,7 +251,7 @@ N805.py:115:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 112 112 | 113 113 | 114 114 | class RenamingInMethodBodyClass: @@ -247,6 +265,8 @@ N805.py:115:20: N805 [*] First argument of a method should be named `self` 119 119 | def bad_method(this): 120 120 | self = this + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:119:20: N805 [*] First argument of a method should be named `self` | 117 | this @@ -257,7 +277,7 @@ N805.py:119:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 116 116 | this = this 117 117 | this 118 118 | @@ -269,6 +289,8 @@ N805.py:119:20: N805 [*] First argument of a method should be named `self` 122 122 | 123 123 | class RenamingWithNFKC: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:124:17: N805 [*] First argument of a method should be named `self` | 123 | class RenamingWithNFKC: @@ -278,7 +300,7 @@ N805.py:124:17: N805 [*] First argument of a method should be named `self` | = help: Rename `household` to `self` -ℹ Unsafe fix +Suggested fix: 121 121 | 122 122 | 123 123 | class RenamingWithNFKC: @@ -286,3 +308,5 @@ N805.py:124:17: N805 [*] First argument of a method should be named `self` 125 |- hºusehold(1) 124 |+ def formula(self): 125 |+ self(1) + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__classmethod_decorators.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__classmethod_decorators.snap index 33143ab760a17..eda09dcc9a0c6 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__classmethod_decorators.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__classmethod_decorators.snap @@ -10,7 +10,7 @@ N805.py:7:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 4 4 | 5 5 | 6 6 | class Class: @@ -20,6 +20,8 @@ N805.py:7:20: N805 [*] First argument of a method should be named `self` 9 9 | 10 10 | if False: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:11:30: N805 [*] First argument of a method should be named `self` | 10 | if False: @@ -29,7 +31,7 @@ N805.py:11:30: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 8 8 | pass 9 9 | 10 10 | if False: @@ -39,6 +41,8 @@ N805.py:11:30: N805 [*] First argument of a method should be named `self` 13 13 | 14 14 | def good_method(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:63:29: N805 [*] First argument of a method should be named `self` | 61 | pass @@ -49,7 +53,7 @@ N805.py:63:29: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 60 60 | def good_method_pos_only(self, blah, /, something: str): 61 61 | pass 62 62 | @@ -59,6 +63,8 @@ N805.py:63:29: N805 [*] First argument of a method should be named `self` 65 65 | 66 66 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:69:13: N805 [*] First argument of a method should be named `self` | 67 | class ModelClass: @@ -69,7 +75,7 @@ N805.py:69:13: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -ℹ Unsafe fix +Suggested fix: 66 66 | 67 67 | class ModelClass: 68 68 | @hybrid_property @@ -79,6 +85,8 @@ N805.py:69:13: N805 [*] First argument of a method should be named `self` 71 71 | 72 72 | @bad.expression + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:77:13: N805 [*] First argument of a method should be named `self` | 76 | @bad.wtf @@ -88,7 +96,7 @@ N805.py:77:13: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -ℹ Unsafe fix +Suggested fix: 74 74 | pass 75 75 | 76 76 | @bad.wtf @@ -98,6 +106,8 @@ N805.py:77:13: N805 [*] First argument of a method should be named `self` 79 79 | 80 80 | @hybrid_property + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:93:19: N805 [*] First argument of a method should be named `self` | 92 | @foobar.thisisstatic @@ -107,7 +117,7 @@ N805.py:93:19: N805 [*] First argument of a method should be named `self` | = help: Rename `foo` to `self` -ℹ Unsafe fix +Suggested fix: 90 90 | pass 91 91 | 92 92 | @foobar.thisisstatic @@ -117,6 +127,8 @@ N805.py:93:19: N805 [*] First argument of a method should be named `self` 95 95 | 96 96 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:98:26: N805 First argument of a method should be named `self` | 97 | class SelfInArgsClass: @@ -176,7 +188,7 @@ N805.py:115:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 112 112 | 113 113 | 114 114 | class RenamingInMethodBodyClass: @@ -190,6 +202,8 @@ N805.py:115:20: N805 [*] First argument of a method should be named `self` 119 119 | def bad_method(this): 120 120 | self = this + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:119:20: N805 [*] First argument of a method should be named `self` | 117 | this @@ -200,7 +214,7 @@ N805.py:119:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 116 116 | this = this 117 117 | this 118 118 | @@ -212,6 +226,8 @@ N805.py:119:20: N805 [*] First argument of a method should be named `self` 122 122 | 123 123 | class RenamingWithNFKC: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:124:17: N805 [*] First argument of a method should be named `self` | 123 | class RenamingWithNFKC: @@ -221,7 +237,7 @@ N805.py:124:17: N805 [*] First argument of a method should be named `self` | = help: Rename `household` to `self` -ℹ Unsafe fix +Suggested fix: 121 121 | 122 122 | 123 123 | class RenamingWithNFKC: @@ -229,3 +245,5 @@ N805.py:124:17: N805 [*] First argument of a method should be named `self` 125 |- hºusehold(1) 124 |+ def formula(self): 125 |+ self(1) + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N804_N804.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N804_N804.py.snap index 678a2358c49ed..10cc007188147 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N804_N804.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N804_N804.py.snap @@ -10,7 +10,7 @@ N804.py:5:27: N804 [*] First argument of a class method should be named `cls` | = help: Rename `self` to `cls` -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | 4 4 | class Class: @@ -20,6 +20,8 @@ N804.py:5:27: N804 [*] First argument of a class method should be named `cls` 7 7 | 8 8 | @classmethod + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N804.py:9:20: N804 [*] First argument of a class method should be named `cls` | 8 | @classmethod @@ -29,7 +31,7 @@ N804.py:9:20: N804 [*] First argument of a class method should be named `cls` | = help: Rename `self` to `cls` -ℹ Unsafe fix +Suggested fix: 6 6 | ... 7 7 | 8 8 | @classmethod @@ -39,6 +41,8 @@ N804.py:9:20: N804 [*] First argument of a class method should be named `cls` 11 11 | 12 12 | @classmethod + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N804.py:13:18: N804 [*] First argument of a class method should be named `cls` | 12 | @classmethod @@ -48,7 +52,7 @@ N804.py:13:18: N804 [*] First argument of a class method should be named `cls` | = help: Rename `self` to `cls` -ℹ Unsafe fix +Suggested fix: 10 10 | ... 11 11 | 12 12 | @classmethod @@ -58,6 +62,8 @@ N804.py:13:18: N804 [*] First argument of a class method should be named `cls` 15 15 | 16 16 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N804.py:18:20: N804 [*] First argument of a class method should be named `cls` | 17 | class MetaClass(ABCMeta): @@ -67,7 +73,7 @@ N804.py:18:20: N804 [*] First argument of a class method should be named `cls` | = help: Rename `self` to `cls` -ℹ Unsafe fix +Suggested fix: 15 15 | 16 16 | 17 17 | class MetaClass(ABCMeta): @@ -77,6 +83,8 @@ N804.py:18:20: N804 [*] First argument of a class method should be named `cls` 20 20 | 21 21 | def stillBad(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N804.py:21:18: N804 [*] First argument of a class method should be named `cls` | 19 | pass @@ -87,10 +95,12 @@ N804.py:21:18: N804 [*] First argument of a class method should be named `cls` | = help: Rename `self` to `cls` -ℹ Unsafe fix +Suggested fix: 18 18 | def badAllowed(self): 19 19 | pass 20 20 | 21 |- def stillBad(self): 21 |+ def stillBad(cls): 22 22 | pass + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N805_N805.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N805_N805.py.snap index 0d5d100f42e22..d0a50df3d3a3b 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N805_N805.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N805_N805.py.snap @@ -10,7 +10,7 @@ N805.py:7:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 4 4 | 5 5 | 6 6 | class Class: @@ -20,6 +20,8 @@ N805.py:7:20: N805 [*] First argument of a method should be named `self` 9 9 | 10 10 | def stillBad(this): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:10:18: N805 [*] First argument of a method should be named `self` | 8 | pass @@ -30,7 +32,7 @@ N805.py:10:18: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 7 7 | def badAllowed(this): 8 8 | pass 9 9 | @@ -40,6 +42,8 @@ N805.py:10:18: N805 [*] First argument of a method should be named `self` 12 12 | 13 13 | if False: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:15:24: N805 [*] First argument of a method should be named `self` | 13 | if False: @@ -50,7 +54,7 @@ N805.py:15:24: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 12 12 | 13 13 | if False: 14 14 | @@ -60,6 +64,8 @@ N805.py:15:24: N805 [*] First argument of a method should be named `self` 17 17 | 18 18 | def stillBad(this): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:18:22: N805 [*] First argument of a method should be named `self` | 16 | pass @@ -70,7 +76,7 @@ N805.py:18:22: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 15 15 | def badAllowed(this): 16 16 | pass 17 17 | @@ -80,6 +86,8 @@ N805.py:18:22: N805 [*] First argument of a method should be named `self` 20 20 | 21 21 | @pydantic.validator + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:22:20: N805 [*] First argument of a method should be named `self` | 21 | @pydantic.validator @@ -89,7 +97,7 @@ N805.py:22:20: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -ℹ Unsafe fix +Suggested fix: 19 19 | pass 20 20 | 21 21 | @pydantic.validator @@ -99,6 +107,8 @@ N805.py:22:20: N805 [*] First argument of a method should be named `self` 24 24 | 25 25 | @pydantic.validator + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:26:18: N805 [*] First argument of a method should be named `self` | 25 | @pydantic.validator @@ -108,7 +118,7 @@ N805.py:26:18: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -ℹ Unsafe fix +Suggested fix: 23 23 | pass 24 24 | 25 25 | @pydantic.validator @@ -118,6 +128,8 @@ N805.py:26:18: N805 [*] First argument of a method should be named `self` 28 28 | 29 29 | @pydantic.validator("my_field") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:30:20: N805 [*] First argument of a method should be named `self` | 29 | @pydantic.validator("my_field") @@ -127,7 +139,7 @@ N805.py:30:20: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -ℹ Unsafe fix +Suggested fix: 27 27 | pass 28 28 | 29 29 | @pydantic.validator("my_field") @@ -137,6 +149,8 @@ N805.py:30:20: N805 [*] First argument of a method should be named `self` 32 32 | 33 33 | @pydantic.validator("my_field") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:34:18: N805 [*] First argument of a method should be named `self` | 33 | @pydantic.validator("my_field") @@ -146,7 +160,7 @@ N805.py:34:18: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -ℹ Unsafe fix +Suggested fix: 31 31 | pass 32 32 | 33 33 | @pydantic.validator("my_field") @@ -156,6 +170,8 @@ N805.py:34:18: N805 [*] First argument of a method should be named `self` 36 36 | 37 37 | @classmethod + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:55:20: N805 First argument of a method should be named `self` | 54 | class PosOnlyClass: diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__staticmethod_decorators.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__staticmethod_decorators.snap index cac0d909d994e..bc431a0a384b8 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__staticmethod_decorators.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__staticmethod_decorators.snap @@ -10,7 +10,7 @@ N805.py:7:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 4 4 | 5 5 | 6 6 | class Class: @@ -20,6 +20,8 @@ N805.py:7:20: N805 [*] First argument of a method should be named `self` 9 9 | 10 10 | if False: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:11:30: N805 [*] First argument of a method should be named `self` | 10 | if False: @@ -29,7 +31,7 @@ N805.py:11:30: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 8 8 | pass 9 9 | 10 10 | if False: @@ -39,6 +41,8 @@ N805.py:11:30: N805 [*] First argument of a method should be named `self` 13 13 | 14 14 | def good_method(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:30:15: N805 [*] First argument of a method should be named `self` | 29 | @pydantic.validator @@ -48,7 +52,7 @@ N805.py:30:15: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -ℹ Unsafe fix +Suggested fix: 27 27 | return x 28 28 | 29 29 | @pydantic.validator @@ -58,6 +62,8 @@ N805.py:30:15: N805 [*] First argument of a method should be named `self` 32 32 | 33 33 | @pydantic.validator("my_field") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:34:15: N805 [*] First argument of a method should be named `self` | 33 | @pydantic.validator("my_field") @@ -67,7 +73,7 @@ N805.py:34:15: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -ℹ Unsafe fix +Suggested fix: 31 31 | pass 32 32 | 33 33 | @pydantic.validator("my_field") @@ -77,6 +83,8 @@ N805.py:34:15: N805 [*] First argument of a method should be named `self` 36 36 | 37 37 | def __init__(self): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:63:29: N805 [*] First argument of a method should be named `self` | 61 | pass @@ -87,7 +95,7 @@ N805.py:63:29: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 60 60 | def good_method_pos_only(self, blah, /, something: str): 61 61 | pass 62 62 | @@ -97,6 +105,8 @@ N805.py:63:29: N805 [*] First argument of a method should be named `self` 65 65 | 66 66 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:69:13: N805 [*] First argument of a method should be named `self` | 67 | class ModelClass: @@ -107,7 +117,7 @@ N805.py:69:13: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -ℹ Unsafe fix +Suggested fix: 66 66 | 67 67 | class ModelClass: 68 68 | @hybrid_property @@ -117,6 +127,8 @@ N805.py:69:13: N805 [*] First argument of a method should be named `self` 71 71 | 72 72 | @bad.expression + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:77:13: N805 [*] First argument of a method should be named `self` | 76 | @bad.wtf @@ -126,7 +138,7 @@ N805.py:77:13: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -ℹ Unsafe fix +Suggested fix: 74 74 | pass 75 75 | 76 76 | @bad.wtf @@ -136,6 +148,8 @@ N805.py:77:13: N805 [*] First argument of a method should be named `self` 79 79 | 80 80 | @hybrid_property + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:85:14: N805 [*] First argument of a method should be named `self` | 84 | @good.expression @@ -145,7 +159,7 @@ N805.py:85:14: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -ℹ Unsafe fix +Suggested fix: 82 82 | pass 83 83 | 84 84 | @good.expression @@ -155,6 +169,8 @@ N805.py:85:14: N805 [*] First argument of a method should be named `self` 87 87 | 88 88 | @good.wtf + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:98:26: N805 First argument of a method should be named `self` | 97 | class SelfInArgsClass: @@ -214,7 +230,7 @@ N805.py:115:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 112 112 | 113 113 | 114 114 | class RenamingInMethodBodyClass: @@ -228,6 +244,8 @@ N805.py:115:20: N805 [*] First argument of a method should be named `self` 119 119 | def bad_method(this): 120 120 | self = this + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:119:20: N805 [*] First argument of a method should be named `self` | 117 | this @@ -238,7 +256,7 @@ N805.py:119:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -ℹ Unsafe fix +Suggested fix: 116 116 | this = this 117 117 | this 118 118 | @@ -250,6 +268,8 @@ N805.py:119:20: N805 [*] First argument of a method should be named `self` 122 122 | 123 123 | class RenamingWithNFKC: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + N805.py:124:17: N805 [*] First argument of a method should be named `self` | 123 | class RenamingWithNFKC: @@ -259,7 +279,7 @@ N805.py:124:17: N805 [*] First argument of a method should be named `self` | = help: Rename `household` to `self` -ℹ Unsafe fix +Suggested fix: 121 121 | 122 122 | 123 123 | class RenamingWithNFKC: @@ -267,3 +287,5 @@ N805.py:124:17: N805 [*] First argument of a method should be named `self` 125 |- hºusehold(1) 124 |+ def formula(self): 125 |+ self(1) + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF101_PERF101.py.snap b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF101_PERF101.py.snap index bf33ecd3e3457..8083a45cf9bc6 100644 --- a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF101_PERF101.py.snap +++ b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF101_PERF101.py.snap @@ -11,7 +11,7 @@ PERF101.py:7:10: PERF101 [*] Do not cast an iterable to `list` before iterating | = help: Remove `list()` cast -ℹ Safe fix +Suggested fix: 4 4 | foo_dict = {1: 2, 3: 4} 5 5 | foo_int = 123 6 6 | @@ -21,6 +21,8 @@ PERF101.py:7:10: PERF101 [*] Do not cast an iterable to `list` before iterating 9 9 | 10 10 | for i in list(foo_list): # PERF101 + Run `ruff check --fix` to apply this fix. + PERF101.py:10:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 8 | pass @@ -31,7 +33,7 @@ PERF101.py:10:10: PERF101 [*] Do not cast an iterable to `list` before iterating | = help: Remove `list()` cast -ℹ Safe fix +Suggested fix: 7 7 | for i in list(foo_tuple): # PERF101 8 8 | pass 9 9 | @@ -41,6 +43,8 @@ PERF101.py:10:10: PERF101 [*] Do not cast an iterable to `list` before iterating 12 12 | 13 13 | for i in list(foo_set): # PERF101 + Run `ruff check --fix` to apply this fix. + PERF101.py:13:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 11 | pass @@ -51,7 +55,7 @@ PERF101.py:13:10: PERF101 [*] Do not cast an iterable to `list` before iterating | = help: Remove `list()` cast -ℹ Safe fix +Suggested fix: 10 10 | for i in list(foo_list): # PERF101 11 11 | pass 12 12 | @@ -61,6 +65,8 @@ PERF101.py:13:10: PERF101 [*] Do not cast an iterable to `list` before iterating 15 15 | 16 16 | for i in list((1, 2, 3)): # PERF101 + Run `ruff check --fix` to apply this fix. + PERF101.py:16:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 14 | pass @@ -71,7 +77,7 @@ PERF101.py:16:10: PERF101 [*] Do not cast an iterable to `list` before iterating | = help: Remove `list()` cast -ℹ Safe fix +Suggested fix: 13 13 | for i in list(foo_set): # PERF101 14 14 | pass 15 15 | @@ -81,6 +87,8 @@ PERF101.py:16:10: PERF101 [*] Do not cast an iterable to `list` before iterating 18 18 | 19 19 | for i in list([1, 2, 3]): # PERF101 + Run `ruff check --fix` to apply this fix. + PERF101.py:19:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 17 | pass @@ -91,7 +99,7 @@ PERF101.py:19:10: PERF101 [*] Do not cast an iterable to `list` before iterating | = help: Remove `list()` cast -ℹ Safe fix +Suggested fix: 16 16 | for i in list((1, 2, 3)): # PERF101 17 17 | pass 18 18 | @@ -101,6 +109,8 @@ PERF101.py:19:10: PERF101 [*] Do not cast an iterable to `list` before iterating 21 21 | 22 22 | for i in list({1, 2, 3}): # PERF101 + Run `ruff check --fix` to apply this fix. + PERF101.py:22:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 20 | pass @@ -111,7 +121,7 @@ PERF101.py:22:10: PERF101 [*] Do not cast an iterable to `list` before iterating | = help: Remove `list()` cast -ℹ Safe fix +Suggested fix: 19 19 | for i in list([1, 2, 3]): # PERF101 20 20 | pass 21 21 | @@ -121,6 +131,8 @@ PERF101.py:22:10: PERF101 [*] Do not cast an iterable to `list` before iterating 24 24 | 25 25 | for i in list( + Run `ruff check --fix` to apply this fix. + PERF101.py:25:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 23 | pass @@ -138,7 +150,7 @@ PERF101.py:25:10: PERF101 [*] Do not cast an iterable to `list` before iterating | = help: Remove `list()` cast -ℹ Safe fix +Suggested fix: 22 22 | for i in list({1, 2, 3}): # PERF101 23 23 | pass 24 24 | @@ -155,6 +167,8 @@ PERF101.py:25:10: PERF101 [*] Do not cast an iterable to `list` before iterating 33 31 | 34 32 | for i in list( # Comment + Run `ruff check --fix` to apply this fix. + PERF101.py:34:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 32 | pass @@ -168,7 +182,7 @@ PERF101.py:34:10: PERF101 [*] Do not cast an iterable to `list` before iterating | = help: Remove `list()` cast -ℹ Safe fix +Suggested fix: 31 31 | ): 32 32 | pass 33 33 | @@ -180,6 +194,8 @@ PERF101.py:34:10: PERF101 [*] Do not cast an iterable to `list` before iterating 38 36 | 39 37 | for i in list(foo_dict): # OK + Run `ruff check --fix` to apply this fix. + PERF101.py:57:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 55 | foo_list.append(i + 1) @@ -191,7 +207,7 @@ PERF101.py:57:10: PERF101 [*] Do not cast an iterable to `list` before iterating | = help: Remove `list()` cast -ℹ Safe fix +Suggested fix: 54 54 | for i in list(foo_list): # OK 55 55 | foo_list.append(i + 1) 56 56 | @@ -201,6 +217,8 @@ PERF101.py:57:10: PERF101 [*] Do not cast an iterable to `list` before iterating 59 59 | other_list.append(i + 1) 60 60 | + Run `ruff check --fix` to apply this fix. + PERF101.py:69:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 67 | x, y, nested_tuple = (1, 2, (3, 4, 5)) @@ -211,7 +229,7 @@ PERF101.py:69:10: PERF101 [*] Do not cast an iterable to `list` before iterating | = help: Remove `list()` cast -ℹ Safe fix +Suggested fix: 66 66 | 67 67 | x, y, nested_tuple = (1, 2, (3, 4, 5)) 68 68 | @@ -221,6 +239,8 @@ PERF101.py:69:10: PERF101 [*] Do not cast an iterable to `list` before iterating 71 71 | 72 72 | for i in list(foo_list): # OK + Run `ruff check --fix` to apply this fix. + PERF101.py:86:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 84 | import builtins @@ -231,10 +251,12 @@ PERF101.py:86:10: PERF101 [*] Do not cast an iterable to `list` before iterating | = help: Remove `list()` cast -ℹ Safe fix +Suggested fix: 83 83 | 84 84 | import builtins 85 85 | 86 |-for i in builtins.list(nested_tuple): # PERF101 86 |+for i in nested_tuple: # PERF101 87 87 | pass + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap index f572521714595..a22a76eec5fa6 100644 --- a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap +++ b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap @@ -10,7 +10,7 @@ PERF102.py:5:21: PERF102 [*] When using only the values of a dict use the `value | = help: Replace `.items()` with `.values()` -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | 4 4 | def f(): @@ -20,6 +20,8 @@ PERF102.py:5:21: PERF102 [*] When using only the values of a dict use the `value 7 7 | 8 8 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PERF102.py:10:19: PERF102 [*] When using only the keys of a dict use the `keys()` method | 9 | def f(): @@ -29,7 +31,7 @@ PERF102.py:10:19: PERF102 [*] When using only the keys of a dict use the `keys() | = help: Replace `.items()` with `.keys()` -ℹ Unsafe fix +Suggested fix: 7 7 | 8 8 | 9 9 | def f(): @@ -39,6 +41,8 @@ PERF102.py:10:19: PERF102 [*] When using only the keys of a dict use the `keys() 12 12 | 13 13 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PERF102.py:15:30: PERF102 [*] When using only the keys of a dict use the `keys()` method | 14 | def f(): @@ -48,7 +52,7 @@ PERF102.py:15:30: PERF102 [*] When using only the keys of a dict use the `keys() | = help: Replace `.items()` with `.keys()` -ℹ Unsafe fix +Suggested fix: 12 12 | 13 13 | 14 14 | def f(): @@ -58,6 +62,8 @@ PERF102.py:15:30: PERF102 [*] When using only the keys of a dict use the `keys() 17 17 | 18 18 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PERF102.py:20:25: PERF102 [*] When using only the keys of a dict use the `keys()` method | 19 | def f(): @@ -67,7 +73,7 @@ PERF102.py:20:25: PERF102 [*] When using only the keys of a dict use the `keys() | = help: Replace `.items()` with `.keys()` -ℹ Unsafe fix +Suggested fix: 17 17 | 18 18 | 19 19 | def f(): @@ -77,6 +83,8 @@ PERF102.py:20:25: PERF102 [*] When using only the keys of a dict use the `keys() 22 22 | 23 23 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PERF102.py:30:30: PERF102 [*] When using only the keys of a dict use the `keys()` method | 29 | def f(): @@ -86,7 +94,7 @@ PERF102.py:30:30: PERF102 [*] When using only the keys of a dict use the `keys() | = help: Replace `.items()` with `.keys()` -ℹ Unsafe fix +Suggested fix: 27 27 | 28 28 | 29 29 | def f(): @@ -96,6 +104,8 @@ PERF102.py:30:30: PERF102 [*] When using only the keys of a dict use the `keys() 32 32 | 33 33 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PERF102.py:35:36: PERF102 [*] When using only the values of a dict use the `values()` method | 34 | def f(): @@ -105,7 +115,7 @@ PERF102.py:35:36: PERF102 [*] When using only the values of a dict use the `valu | = help: Replace `.items()` with `.values()` -ℹ Unsafe fix +Suggested fix: 32 32 | 33 33 | 34 34 | def f(): @@ -115,6 +125,8 @@ PERF102.py:35:36: PERF102 [*] When using only the values of a dict use the `valu 37 37 | 38 38 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PERF102.py:50:32: PERF102 [*] When using only the keys of a dict use the `keys()` method | 49 | def f(): @@ -124,7 +136,7 @@ PERF102.py:50:32: PERF102 [*] When using only the keys of a dict use the `keys() | = help: Replace `.items()` with `.keys()` -ℹ Unsafe fix +Suggested fix: 47 47 | 48 48 | 49 49 | def f(): @@ -134,6 +146,8 @@ PERF102.py:50:32: PERF102 [*] When using only the keys of a dict use the `keys() 52 52 | 53 53 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PERF102.py:85:25: PERF102 [*] When using only the keys of a dict use the `keys()` method | 84 | def f(): @@ -143,7 +157,7 @@ PERF102.py:85:25: PERF102 [*] When using only the keys of a dict use the `keys() | = help: Replace `.items()` with `.keys()` -ℹ Unsafe fix +Suggested fix: 82 82 | 83 83 | 84 84 | def f(): @@ -153,6 +167,8 @@ PERF102.py:85:25: PERF102 [*] When using only the keys of a dict use the `keys() 87 87 | 88 88 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PERF102.py:90:25: PERF102 [*] When using only the keys of a dict use the `keys()` method | 89 | def f(): @@ -162,7 +178,7 @@ PERF102.py:90:25: PERF102 [*] When using only the keys of a dict use the `keys() | = help: Replace `.items()` with `.keys()` -ℹ Unsafe fix +Suggested fix: 87 87 | 88 88 | 89 89 | def f(): @@ -172,6 +188,8 @@ PERF102.py:90:25: PERF102 [*] When using only the keys of a dict use the `keys() 92 92 | 93 93 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PERF102.py:95:31: PERF102 [*] When using only the keys of a dict use the `keys()` method | 94 | def f(): @@ -181,7 +199,7 @@ PERF102.py:95:31: PERF102 [*] When using only the keys of a dict use the `keys() | = help: Replace `.items()` with `.keys()` -ℹ Unsafe fix +Suggested fix: 92 92 | 93 93 | 94 94 | def f(): @@ -191,6 +209,8 @@ PERF102.py:95:31: PERF102 [*] When using only the keys of a dict use the `keys() 97 97 | 98 98 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PERF102.py:100:31: PERF102 [*] When using only the values of a dict use the `values()` method | 99 | def f(): @@ -200,7 +220,7 @@ PERF102.py:100:31: PERF102 [*] When using only the values of a dict use the `val | = help: Replace `.items()` with `.values()` -ℹ Unsafe fix +Suggested fix: 97 97 | 98 98 | 99 99 | def f(): @@ -210,6 +230,8 @@ PERF102.py:100:31: PERF102 [*] When using only the values of a dict use the `val 102 102 | 103 103 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PERF102.py:106:16: PERF102 [*] When using only the keys of a dict use the `keys()` method | 104 | # Regression test for: https://github.com/astral-sh/ruff/issues/7097 @@ -220,7 +242,7 @@ PERF102.py:106:16: PERF102 [*] When using only the keys of a dict use the `keys( | = help: Replace `.items()` with `.keys()` -ℹ Unsafe fix +Suggested fix: 103 103 | 104 104 | # Regression test for: https://github.com/astral-sh/ruff/issues/7097 105 105 | def _create_context(name_to_value): @@ -228,4 +250,4 @@ PERF102.py:106:16: PERF102 [*] When using only the keys of a dict use the `keys( 106 |+ for B in A.keys(): 107 107 | if(C:=name_to_value.get(B.name)):A.run(B.set,C) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E201_E20.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E201_E20.py.snap index 4d0dbb264503b..f4d1045a1b1f8 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E201_E20.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E201_E20.py.snap @@ -11,7 +11,7 @@ E20.py:2:6: E201 [*] Whitespace after '(' | = help: Remove whitespace before '(' -ℹ Safe fix +Suggested fix: 1 1 | #: E201:1:6 2 |-spam( ham[1], {eggs: 2}) 2 |+spam(ham[1], {eggs: 2}) @@ -19,6 +19,8 @@ E20.py:2:6: E201 [*] Whitespace after '(' 4 4 | spam(ham[ 1], {eggs: 2}) 5 5 | #: E201:1:15 + Run `ruff check --fix` to apply this fix. + E20.py:4:10: E201 [*] Whitespace after '[' | 2 | spam( ham[1], {eggs: 2}) @@ -30,7 +32,7 @@ E20.py:4:10: E201 [*] Whitespace after '[' | = help: Remove whitespace before '[' -ℹ Safe fix +Suggested fix: 1 1 | #: E201:1:6 2 2 | spam( ham[1], {eggs: 2}) 3 3 | #: E201:1:10 @@ -40,6 +42,8 @@ E20.py:4:10: E201 [*] Whitespace after '[' 6 6 | spam(ham[1], { eggs: 2}) 7 7 | #: E201:1:6 + Run `ruff check --fix` to apply this fix. + E20.py:6:15: E201 [*] Whitespace after '{' | 4 | spam(ham[ 1], {eggs: 2}) @@ -51,7 +55,7 @@ E20.py:6:15: E201 [*] Whitespace after '{' | = help: Remove whitespace before '{' -ℹ Safe fix +Suggested fix: 3 3 | #: E201:1:10 4 4 | spam(ham[ 1], {eggs: 2}) 5 5 | #: E201:1:15 @@ -61,6 +65,8 @@ E20.py:6:15: E201 [*] Whitespace after '{' 8 8 | spam( ham[1], {eggs: 2}) 9 9 | #: E201:1:10 + Run `ruff check --fix` to apply this fix. + E20.py:8:6: E201 [*] Whitespace after '(' | 6 | spam(ham[1], { eggs: 2}) @@ -72,7 +78,7 @@ E20.py:8:6: E201 [*] Whitespace after '(' | = help: Remove whitespace before '(' -ℹ Safe fix +Suggested fix: 5 5 | #: E201:1:15 6 6 | spam(ham[1], { eggs: 2}) 7 7 | #: E201:1:6 @@ -82,6 +88,8 @@ E20.py:8:6: E201 [*] Whitespace after '(' 10 10 | spam(ham[ 1], {eggs: 2}) 11 11 | #: E201:1:15 + Run `ruff check --fix` to apply this fix. + E20.py:10:10: E201 [*] Whitespace after '[' | 8 | spam( ham[1], {eggs: 2}) @@ -93,7 +101,7 @@ E20.py:10:10: E201 [*] Whitespace after '[' | = help: Remove whitespace before '[' -ℹ Safe fix +Suggested fix: 7 7 | #: E201:1:6 8 8 | spam( ham[1], {eggs: 2}) 9 9 | #: E201:1:10 @@ -103,6 +111,8 @@ E20.py:10:10: E201 [*] Whitespace after '[' 12 12 | spam(ham[1], { eggs: 2}) 13 13 | #: Okay + Run `ruff check --fix` to apply this fix. + E20.py:12:15: E201 [*] Whitespace after '{' | 10 | spam(ham[ 1], {eggs: 2}) @@ -114,7 +124,7 @@ E20.py:12:15: E201 [*] Whitespace after '{' | = help: Remove whitespace before '{' -ℹ Safe fix +Suggested fix: 9 9 | #: E201:1:10 10 10 | spam(ham[ 1], {eggs: 2}) 11 11 | #: E201:1:15 @@ -124,6 +134,8 @@ E20.py:12:15: E201 [*] Whitespace after '{' 14 14 | spam(ham[1], {eggs: 2}) 15 15 | #: + Run `ruff check --fix` to apply this fix. + E20.py:107:6: E201 [*] Whitespace after '[' | 106 | #: E201:1:6 @@ -134,7 +146,7 @@ E20.py:107:6: E201 [*] Whitespace after '[' | = help: Remove whitespace before '[' -ℹ Safe fix +Suggested fix: 104 104 | #: 105 105 | 106 106 | #: E201:1:6 @@ -144,6 +156,8 @@ E20.py:107:6: E201 [*] Whitespace after '[' 109 109 | #: Okay 110 110 | x = [ # + Run `ruff check --fix` to apply this fix. + E20.py:116:5: E201 [*] Whitespace after '[' | 114 | # F-strings @@ -154,7 +168,7 @@ E20.py:116:5: E201 [*] Whitespace after '[' | = help: Remove whitespace before '[' -ℹ Safe fix +Suggested fix: 113 113 | 114 114 | # F-strings 115 115 | f"{ {'a': 1} }" @@ -164,6 +178,8 @@ E20.py:116:5: E201 [*] Whitespace after '[' 118 118 | 119 119 | #: Okay + Run `ruff check --fix` to apply this fix. + E20.py:145:5: E201 [*] Whitespace after '[' | 144 | #: E201:1:5 @@ -174,7 +190,7 @@ E20.py:145:5: E201 [*] Whitespace after '[' | = help: Remove whitespace before '[' -ℹ Safe fix +Suggested fix: 142 142 | ham[lower + offset : upper + offset] 143 143 | 144 144 | #: E201:1:5 @@ -183,3 +199,5 @@ E20.py:145:5: E201 [*] Whitespace after '[' 146 146 | 147 147 | #: Okay 148 148 | ham[lower + offset :: upper + offset] + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E202_E20.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E202_E20.py.snap index d4044ba4a51e2..515dd0a22fe2a 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E202_E20.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E202_E20.py.snap @@ -11,7 +11,7 @@ E20.py:19:23: E202 [*] Whitespace before ')' | = help: Remove whitespace before ')' -ℹ Safe fix +Suggested fix: 16 16 | 17 17 | 18 18 | #: E202:1:23 @@ -21,6 +21,8 @@ E20.py:19:23: E202 [*] Whitespace before ')' 21 21 | spam(ham[1], {eggs: 2 }) 22 22 | #: E202:1:11 + Run `ruff check --fix` to apply this fix. + E20.py:21:22: E202 [*] Whitespace before '}' | 19 | spam(ham[1], {eggs: 2} ) @@ -32,7 +34,7 @@ E20.py:21:22: E202 [*] Whitespace before '}' | = help: Remove whitespace before '}' -ℹ Safe fix +Suggested fix: 18 18 | #: E202:1:23 19 19 | spam(ham[1], {eggs: 2} ) 20 20 | #: E202:1:22 @@ -42,6 +44,8 @@ E20.py:21:22: E202 [*] Whitespace before '}' 23 23 | spam(ham[1 ], {eggs: 2}) 24 24 | #: E202:1:23 + Run `ruff check --fix` to apply this fix. + E20.py:23:11: E202 [*] Whitespace before ']' | 21 | spam(ham[1], {eggs: 2 }) @@ -53,7 +57,7 @@ E20.py:23:11: E202 [*] Whitespace before ']' | = help: Remove whitespace before ']' -ℹ Safe fix +Suggested fix: 20 20 | #: E202:1:22 21 21 | spam(ham[1], {eggs: 2 }) 22 22 | #: E202:1:11 @@ -63,6 +67,8 @@ E20.py:23:11: E202 [*] Whitespace before ']' 25 25 | spam(ham[1], {eggs: 2} ) 26 26 | #: E202:1:22 + Run `ruff check --fix` to apply this fix. + E20.py:25:23: E202 [*] Whitespace before ')' | 23 | spam(ham[1 ], {eggs: 2}) @@ -74,7 +80,7 @@ E20.py:25:23: E202 [*] Whitespace before ')' | = help: Remove whitespace before ')' -ℹ Safe fix +Suggested fix: 22 22 | #: E202:1:11 23 23 | spam(ham[1 ], {eggs: 2}) 24 24 | #: E202:1:23 @@ -84,6 +90,8 @@ E20.py:25:23: E202 [*] Whitespace before ')' 27 27 | spam(ham[1], {eggs: 2 }) 28 28 | #: E202:1:11 + Run `ruff check --fix` to apply this fix. + E20.py:27:22: E202 [*] Whitespace before '}' | 25 | spam(ham[1], {eggs: 2} ) @@ -95,7 +103,7 @@ E20.py:27:22: E202 [*] Whitespace before '}' | = help: Remove whitespace before '}' -ℹ Safe fix +Suggested fix: 24 24 | #: E202:1:23 25 25 | spam(ham[1], {eggs: 2} ) 26 26 | #: E202:1:22 @@ -105,6 +113,8 @@ E20.py:27:22: E202 [*] Whitespace before '}' 29 29 | spam(ham[1 ], {eggs: 2}) 30 30 | #: Okay + Run `ruff check --fix` to apply this fix. + E20.py:29:11: E202 [*] Whitespace before ']' | 27 | spam(ham[1], {eggs: 2 }) @@ -116,7 +126,7 @@ E20.py:29:11: E202 [*] Whitespace before ']' | = help: Remove whitespace before ']' -ℹ Safe fix +Suggested fix: 26 26 | #: E202:1:22 27 27 | spam(ham[1], {eggs: 2 }) 28 28 | #: E202:1:11 @@ -126,6 +136,8 @@ E20.py:29:11: E202 [*] Whitespace before ']' 31 31 | spam(ham[1], {eggs: 2}) 32 32 | + Run `ruff check --fix` to apply this fix. + E20.py:116:18: E202 [*] Whitespace before ']' | 114 | # F-strings @@ -136,7 +148,7 @@ E20.py:116:18: E202 [*] Whitespace before ']' | = help: Remove whitespace before ']' -ℹ Safe fix +Suggested fix: 113 113 | 114 114 | # F-strings 115 115 | f"{ {'a': 1} }" @@ -146,6 +158,8 @@ E20.py:116:18: E202 [*] Whitespace before ']' 118 118 | 119 119 | #: Okay + Run `ruff check --fix` to apply this fix. + E20.py:172:12: E202 [*] Whitespace before ']' | 171 | #: E202:1:12 @@ -156,7 +170,7 @@ E20.py:172:12: E202 [*] Whitespace before ']' | = help: Remove whitespace before ']' -ℹ Safe fix +Suggested fix: 169 169 | ham[upper :] 170 170 | 171 171 | #: E202:1:12 @@ -165,3 +179,5 @@ E20.py:172:12: E202 [*] Whitespace before ']' 173 173 | 174 174 | #: E203:1:10 175 175 | ham[upper :] + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E203_E20.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E203_E20.py.snap index 7422f4309a74f..ecdd5015521d3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E203_E20.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E203_E20.py.snap @@ -11,7 +11,7 @@ E20.py:51:10: E203 [*] Whitespace before ':' | = help: Remove whitespace before ':' -ℹ Safe fix +Suggested fix: 48 48 | 49 49 | 50 50 | #: E203:1:10 @@ -21,6 +21,8 @@ E20.py:51:10: E203 [*] Whitespace before ':' 53 53 | x, y = y, x 54 54 | #: E203:1:10 + Run `ruff check --fix` to apply this fix. + E20.py:55:10: E203 [*] Whitespace before ':' | 53 | x, y = y, x @@ -32,7 +34,7 @@ E20.py:55:10: E203 [*] Whitespace before ':' | = help: Remove whitespace before ':' -ℹ Safe fix +Suggested fix: 52 52 | print(x, y) 53 53 | x, y = y, x 54 54 | #: E203:1:10 @@ -42,6 +44,8 @@ E20.py:55:10: E203 [*] Whitespace before ':' 57 57 | x, y = y, x 58 58 | #: E203:2:15 E702:2:16 + Run `ruff check --fix` to apply this fix. + E20.py:60:16: E203 [*] Whitespace before ';' | 58 | #: E203:2:15 E702:2:16 @@ -53,7 +57,7 @@ E20.py:60:16: E203 [*] Whitespace before ';' | = help: Remove whitespace before ';' -ℹ Safe fix +Suggested fix: 57 57 | x, y = y, x 58 58 | #: E203:2:15 E702:2:16 59 59 | if x == 4: @@ -63,6 +67,8 @@ E20.py:60:16: E203 [*] Whitespace before ';' 62 62 | if x == 4: 63 63 | print(x, y) ; x, y = y, x + Run `ruff check --fix` to apply this fix. + E20.py:63:16: E203 [*] Whitespace before ';' | 61 | #: E203:2:15 E702:2:16 @@ -74,7 +80,7 @@ E20.py:63:16: E203 [*] Whitespace before ';' | = help: Remove whitespace before ';' -ℹ Safe fix +Suggested fix: 60 60 | print(x, y) ; x, y = y, x 61 61 | #: E203:2:15 E702:2:16 62 62 | if x == 4: @@ -84,6 +90,8 @@ E20.py:63:16: E203 [*] Whitespace before ';' 65 65 | if x == 4: 66 66 | print(x, y) + Run `ruff check --fix` to apply this fix. + E20.py:67:13: E203 [*] Whitespace before ',' | 65 | if x == 4: @@ -95,7 +103,7 @@ E20.py:67:13: E203 [*] Whitespace before ',' | = help: Remove whitespace before ',' -ℹ Safe fix +Suggested fix: 64 64 | #: E203:3:13 65 65 | if x == 4: 66 66 | print(x, y) @@ -105,6 +113,8 @@ E20.py:67:13: E203 [*] Whitespace before ',' 69 69 | if x == 4: 70 70 | print(x, y) + Run `ruff check --fix` to apply this fix. + E20.py:71:13: E203 [*] Whitespace before ',' | 69 | if x == 4: @@ -116,7 +126,7 @@ E20.py:71:13: E203 [*] Whitespace before ',' | = help: Remove whitespace before ',' -ℹ Safe fix +Suggested fix: 68 68 | #: E203:3:13 69 69 | if x == 4: 70 70 | print(x, y) @@ -126,6 +136,8 @@ E20.py:71:13: E203 [*] Whitespace before ',' 73 73 | if x == 4: 74 74 | print(x, y) + Run `ruff check --fix` to apply this fix. + E20.py:86:61: E203 [*] Whitespace before ':' | 84 | #: E203 multi whitespace before : @@ -136,7 +148,7 @@ E20.py:86:61: E203 [*] Whitespace before ':' | = help: Remove whitespace before ':' -ℹ Safe fix +Suggested fix: 83 83 | 84 84 | #: E203 multi whitespace before : 85 85 | predictions = predictions[ @@ -146,6 +158,8 @@ E20.py:86:61: E203 [*] Whitespace before ':' 88 88 | 89 89 | #: E203 tab before : + Run `ruff check --fix` to apply this fix. + E20.py:91:61: E203 [*] Whitespace before ':' | 89 | #: E203 tab before : @@ -156,7 +170,7 @@ E20.py:91:61: E203 [*] Whitespace before ':' | = help: Remove whitespace before ':' -ℹ Safe fix +Suggested fix: 88 88 | 89 89 | #: E203 tab before : 90 90 | predictions = predictions[ @@ -166,6 +180,8 @@ E20.py:91:61: E203 [*] Whitespace before ':' 93 93 | 94 94 | #: E203 single whitespace before : with line a comment + Run `ruff check --fix` to apply this fix. + E20.py:101:61: E203 [*] Whitespace before ':' | 99 | #: E203 multi whitespace before : with line a comment @@ -176,7 +192,7 @@ E20.py:101:61: E203 [*] Whitespace before ':' | = help: Remove whitespace before ':' -ℹ Safe fix +Suggested fix: 98 98 | 99 99 | #: E203 multi whitespace before : with line a comment 100 100 | predictions = predictions[ @@ -186,6 +202,8 @@ E20.py:101:61: E203 [*] Whitespace before ':' 103 103 | 104 104 | #: + Run `ruff check --fix` to apply this fix. + E20.py:126:16: E203 [*] Whitespace before ':' | 125 | #: E203:1:19 @@ -196,7 +214,7 @@ E20.py:126:16: E203 [*] Whitespace before ':' | = help: Remove whitespace before ':' -ℹ Safe fix +Suggested fix: 123 123 | ham[(lower + offset) : upper + offset] 124 124 | 125 125 | #: E203:1:19 @@ -206,6 +224,8 @@ E20.py:126:16: E203 [*] Whitespace before ':' 128 128 | #: E203:1:19 129 129 | ham[lower + offset : upper + offset] + Run `ruff check --fix` to apply this fix. + E20.py:129:19: E203 [*] Whitespace before ':' | 128 | #: E203:1:19 @@ -216,7 +236,7 @@ E20.py:129:19: E203 [*] Whitespace before ':' | = help: Remove whitespace before ':' -ℹ Safe fix +Suggested fix: 126 126 | {lower + offset : upper + offset} 127 127 | 128 128 | #: E203:1:19 @@ -226,6 +246,8 @@ E20.py:129:19: E203 [*] Whitespace before ':' 131 131 | #: Okay 132 132 | release_lines = history_file_lines[history_file_lines.index('## Unreleased') + 1: -1] + Run `ruff check --fix` to apply this fix. + E20.py:157:21: E203 [*] Whitespace before ':' | 156 | #: E203:1:21 @@ -236,7 +258,7 @@ E20.py:157:21: E203 [*] Whitespace before ':' | = help: Remove whitespace before ':' -ℹ Safe fix +Suggested fix: 154 154 | ham[lower + offset::upper + offset] 155 155 | 156 156 | #: E203:1:21 @@ -246,6 +268,8 @@ E20.py:157:21: E203 [*] Whitespace before ':' 159 159 | #: E203:1:20 160 160 | ham[lower + offset: :upper + offset] + Run `ruff check --fix` to apply this fix. + E20.py:160:20: E203 [*] Whitespace before ':' | 159 | #: E203:1:20 @@ -256,7 +280,7 @@ E20.py:160:20: E203 [*] Whitespace before ':' | = help: Remove whitespace before ':' -ℹ Safe fix +Suggested fix: 157 157 | ham[lower + offset : : upper + offset] 158 158 | 159 159 | #: E203:1:20 @@ -266,6 +290,8 @@ E20.py:160:20: E203 [*] Whitespace before ':' 162 162 | #: E203:1:20 163 163 | ham[{lower + offset : upper + offset} : upper + offset] + Run `ruff check --fix` to apply this fix. + E20.py:163:20: E203 [*] Whitespace before ':' | 162 | #: E203:1:20 @@ -276,7 +302,7 @@ E20.py:163:20: E203 [*] Whitespace before ':' | = help: Remove whitespace before ':' -ℹ Safe fix +Suggested fix: 160 160 | ham[lower + offset: :upper + offset] 161 161 | 162 162 | #: E203:1:20 @@ -286,6 +312,8 @@ E20.py:163:20: E203 [*] Whitespace before ':' 165 165 | #: Okay 166 166 | ham[upper:] + Run `ruff check --fix` to apply this fix. + E20.py:175:10: E203 [*] Whitespace before ':' | 174 | #: E203:1:10 @@ -296,7 +324,7 @@ E20.py:175:10: E203 [*] Whitespace before ':' | = help: Remove whitespace before ':' -ℹ Safe fix +Suggested fix: 172 172 | ham[upper : ] 173 173 | 174 174 | #: E203:1:10 @@ -306,6 +334,8 @@ E20.py:175:10: E203 [*] Whitespace before ':' 177 177 | #: Okay 178 178 | ham[lower +1 :, "columnname"] + Run `ruff check --fix` to apply this fix. + E20.py:181:14: E203 [*] Whitespace before ':' | 180 | #: E203:1:13 @@ -316,7 +346,7 @@ E20.py:181:14: E203 [*] Whitespace before ':' | = help: Remove whitespace before ':' -ℹ Safe fix +Suggested fix: 178 178 | ham[lower +1 :, "columnname"] 179 179 | 180 180 | #: E203:1:13 @@ -326,6 +356,8 @@ E20.py:181:14: E203 [*] Whitespace before ':' 183 183 | #: Okay 184 184 | f"{ham[lower +1 :, "columnname"]}" + Run `ruff check --fix` to apply this fix. + E20.py:187:17: E203 [*] Whitespace before ':' | 186 | #: E203:1:13 @@ -336,7 +368,7 @@ E20.py:187:17: E203 [*] Whitespace before ':' | = help: Remove whitespace before ':' -ℹ Safe fix +Suggested fix: 184 184 | f"{ham[lower +1 :, "columnname"]}" 185 185 | 186 186 | #: E203:1:13 @@ -345,3 +377,5 @@ E20.py:187:17: E203 [*] Whitespace before ':' 188 188 | 189 189 | #: Okay: https://github.com/astral-sh/ruff/issues/12023 190 190 | f"{x = :.2f}" + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E204_E204.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E204_E204.py.snap index 050562950c21b..14662bcff8db9 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E204_E204.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E204_E204.py.snap @@ -11,7 +11,7 @@ E204.py:14:2: E204 [*] Whitespace after decorator | = help: Remove whitespace -ℹ Safe fix +Suggested fix: 11 11 | print('bar') 12 12 | 13 13 | # E204 @@ -21,6 +21,8 @@ E204.py:14:2: E204 [*] Whitespace after decorator 16 16 | print('baz') 17 17 | + Run `ruff check --fix` to apply this fix. + E204.py:25:6: E204 [*] Whitespace after decorator | 24 | # E204 @@ -31,7 +33,7 @@ E204.py:25:6: E204 [*] Whitespace after decorator | = help: Remove whitespace -ℹ Safe fix +Suggested fix: 22 22 | print('bar') 23 23 | 24 24 | # E204 @@ -41,6 +43,8 @@ E204.py:25:6: E204 [*] Whitespace after decorator 27 27 | print('baz') 28 28 | + Run `ruff check --fix` to apply this fix. + E204.py:31:2: E204 [*] Whitespace after decorator | 30 | # E204 @@ -53,7 +57,7 @@ E204.py:31:2: E204 [*] Whitespace after decorator | = help: Remove whitespace -ℹ Safe fix +Suggested fix: 28 28 | 29 29 | 30 30 | # E204 @@ -62,3 +66,5 @@ E204.py:31:2: E204 [*] Whitespace after decorator 31 |+@foo 33 32 | def baz(): 34 33 | print('baz') + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E211_E21.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E211_E21.py.snap index 6c115b53c2636..fb9bac27d5aa4 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E211_E21.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E211_E21.py.snap @@ -11,7 +11,7 @@ E21.py:2:5: E211 [*] Whitespace before '(' | = help: Removed whitespace before '(' -ℹ Safe fix +Suggested fix: 1 1 | #: E211 2 |-spam (1) 2 |+spam(1) @@ -19,6 +19,8 @@ E21.py:2:5: E211 [*] Whitespace before '(' 4 4 | dict ['key'] = list [index] 5 5 | #: E211 + Run `ruff check --fix` to apply this fix. + E21.py:4:5: E211 [*] Whitespace before '[' | 2 | spam (1) @@ -30,7 +32,7 @@ E21.py:4:5: E211 [*] Whitespace before '[' | = help: Removed whitespace before '[' -ℹ Safe fix +Suggested fix: 1 1 | #: E211 2 2 | spam (1) 3 3 | #: E211 E211 @@ -40,6 +42,8 @@ E21.py:4:5: E211 [*] Whitespace before '[' 6 6 | dict['key'] ['subkey'] = list[index] 7 7 | #: Okay + Run `ruff check --fix` to apply this fix. + E21.py:4:20: E211 [*] Whitespace before '[' | 2 | spam (1) @@ -51,7 +55,7 @@ E21.py:4:20: E211 [*] Whitespace before '[' | = help: Removed whitespace before '[' -ℹ Safe fix +Suggested fix: 1 1 | #: E211 2 2 | spam (1) 3 3 | #: E211 E211 @@ -61,6 +65,8 @@ E21.py:4:20: E211 [*] Whitespace before '[' 6 6 | dict['key'] ['subkey'] = list[index] 7 7 | #: Okay + Run `ruff check --fix` to apply this fix. + E21.py:6:12: E211 [*] Whitespace before '[' | 4 | dict ['key'] = list [index] @@ -72,7 +78,7 @@ E21.py:6:12: E211 [*] Whitespace before '[' | = help: Removed whitespace before '[' -ℹ Safe fix +Suggested fix: 3 3 | #: E211 E211 4 4 | dict ['key'] = list [index] 5 5 | #: E211 @@ -82,6 +88,8 @@ E21.py:6:12: E211 [*] Whitespace before '[' 8 8 | spam(1) 9 9 | dict['key'] = list[index] + Run `ruff check --fix` to apply this fix. + E21.py:17:15: E211 [*] Whitespace before '(' | 17 | def fetch_name () -> Union[str, None]: @@ -90,7 +98,7 @@ E21.py:17:15: E211 [*] Whitespace before '(' | = help: Removed whitespace before '(' -ℹ Safe fix +Suggested fix: 14 14 | pass 15 15 | 16 16 | @@ -100,6 +108,8 @@ E21.py:17:15: E211 [*] Whitespace before '(' 19 19 | 20 20 | Returns: + Run `ruff check --fix` to apply this fix. + E21.py:27:19: E211 [*] Whitespace before '(' | 25 | # test commented code @@ -111,7 +121,7 @@ E21.py:27:19: E211 [*] Whitespace before '(' | = help: Removed whitespace before '(' -ℹ Safe fix +Suggested fix: 24 24 | Logger.info(test) 25 25 | # test commented code 26 26 | # Logger.info("test code") @@ -121,6 +131,8 @@ E21.py:27:19: E211 [*] Whitespace before '(' 29 29 | return sys.argv[i + 1] 30 30 | return None + Run `ruff check --fix` to apply this fix. + E21.py:27:27: E211 [*] Whitespace before '(' | 25 | # test commented code @@ -132,7 +144,7 @@ E21.py:27:27: E211 [*] Whitespace before '(' | = help: Removed whitespace before '(' -ℹ Safe fix +Suggested fix: 24 24 | Logger.info(test) 25 25 | # test commented code 26 26 | # Logger.info("test code") @@ -142,4 +154,4 @@ E21.py:27:27: E211 [*] Whitespace before '(' 29 29 | return sys.argv[i + 1] 30 30 | return None - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E221_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E221_E22.py.snap index ec75229e10a6b..18c1606757d2c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E221_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E221_E22.py.snap @@ -12,7 +12,7 @@ E22.py:3:6: E221 [*] Multiple spaces before operator | = help: Replace with single space -ℹ Safe fix +Suggested fix: 1 1 | #: E221 2 2 | a = 12 + 3 3 |-b = 4 + 5 @@ -21,6 +21,8 @@ E22.py:3:6: E221 [*] Multiple spaces before operator 5 5 | x = 1 6 6 | y = 2 + Run `ruff check --fix` to apply this fix. + E22.py:5:2: E221 [*] Multiple spaces before operator | 3 | b = 4 + 5 @@ -32,7 +34,7 @@ E22.py:5:2: E221 [*] Multiple spaces before operator | = help: Replace with single space -ℹ Safe fix +Suggested fix: 2 2 | a = 12 + 3 3 3 | b = 4 + 5 4 4 | #: E221 E221 @@ -42,6 +44,8 @@ E22.py:5:2: E221 [*] Multiple spaces before operator 7 7 | long_variable = 3 8 8 | #: E221 E221 + Run `ruff check --fix` to apply this fix. + E22.py:6:2: E221 [*] Multiple spaces before operator | 4 | #: E221 E221 @@ -53,7 +57,7 @@ E22.py:6:2: E221 [*] Multiple spaces before operator | = help: Replace with single space -ℹ Safe fix +Suggested fix: 3 3 | b = 4 + 5 4 4 | #: E221 E221 5 5 | x = 1 @@ -63,6 +67,8 @@ E22.py:6:2: E221 [*] Multiple spaces before operator 8 8 | #: E221 E221 9 9 | x[0] = 1 + Run `ruff check --fix` to apply this fix. + E22.py:9:5: E221 [*] Multiple spaces before operator | 7 | long_variable = 3 @@ -74,7 +80,7 @@ E22.py:9:5: E221 [*] Multiple spaces before operator | = help: Replace with single space -ℹ Safe fix +Suggested fix: 6 6 | y = 2 7 7 | long_variable = 3 8 8 | #: E221 E221 @@ -84,6 +90,8 @@ E22.py:9:5: E221 [*] Multiple spaces before operator 11 11 | long_variable = 3 12 12 | #: E221 E221 + Run `ruff check --fix` to apply this fix. + E22.py:10:5: E221 [*] Multiple spaces before operator | 8 | #: E221 E221 @@ -95,7 +103,7 @@ E22.py:10:5: E221 [*] Multiple spaces before operator | = help: Replace with single space -ℹ Safe fix +Suggested fix: 7 7 | long_variable = 3 8 8 | #: E221 E221 9 9 | x[0] = 1 @@ -105,6 +113,8 @@ E22.py:10:5: E221 [*] Multiple spaces before operator 12 12 | #: E221 E221 13 13 | x = f(x) + 1 + Run `ruff check --fix` to apply this fix. + E22.py:13:9: E221 [*] Multiple spaces before operator | 11 | long_variable = 3 @@ -116,7 +126,7 @@ E22.py:13:9: E221 [*] Multiple spaces before operator | = help: Replace with single space -ℹ Safe fix +Suggested fix: 10 10 | x[1] = 2 11 11 | long_variable = 3 12 12 | #: E221 E221 @@ -126,6 +136,8 @@ E22.py:13:9: E221 [*] Multiple spaces before operator 15 15 | z = x[0] + 3 16 16 | #: E221:3:14 + Run `ruff check --fix` to apply this fix. + E22.py:15:9: E221 [*] Multiple spaces before operator | 13 | x = f(x) + 1 @@ -137,7 +149,7 @@ E22.py:15:9: E221 [*] Multiple spaces before operator | = help: Replace with single space -ℹ Safe fix +Suggested fix: 12 12 | #: E221 E221 13 13 | x = f(x) + 1 14 14 | y = long_variable + 2 @@ -147,6 +159,8 @@ E22.py:15:9: E221 [*] Multiple spaces before operator 17 17 | text = """ 18 18 | bar + Run `ruff check --fix` to apply this fix. + E22.py:19:14: E221 [*] Multiple spaces before operator | 17 | text = """ @@ -158,7 +172,7 @@ E22.py:19:14: E221 [*] Multiple spaces before operator | = help: Replace with single space -ℹ Safe fix +Suggested fix: 16 16 | #: E221:3:14 17 17 | text = """ 18 18 | bar @@ -168,4 +182,4 @@ E22.py:19:14: E221 [*] Multiple spaces before operator 21 21 | x = 1 22 22 | y = 2 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E222_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E222_E22.py.snap index 52ec6b7ed6831..bf309e886f530 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E222_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E222_E22.py.snap @@ -11,7 +11,7 @@ E22.py:28:8: E222 [*] Multiple spaces after operator | = help: Replace with single space -ℹ Safe fix +Suggested fix: 25 25 | 26 26 | 27 27 | #: E222 @@ -21,6 +21,8 @@ E22.py:28:8: E222 [*] Multiple spaces after operator 30 30 | #: E222 E222 31 31 | x = -1 + Run `ruff check --fix` to apply this fix. + E22.py:31:4: E222 [*] Multiple spaces after operator | 29 | b = b + 10 @@ -32,7 +34,7 @@ E22.py:31:4: E222 [*] Multiple spaces after operator | = help: Replace with single space -ℹ Safe fix +Suggested fix: 28 28 | a = a + 1 29 29 | b = b + 10 30 30 | #: E222 E222 @@ -42,6 +44,8 @@ E22.py:31:4: E222 [*] Multiple spaces after operator 33 33 | long_variable = 3 34 34 | #: E222 E222 + Run `ruff check --fix` to apply this fix. + E22.py:32:4: E222 [*] Multiple spaces after operator | 30 | #: E222 E222 @@ -53,7 +57,7 @@ E22.py:32:4: E222 [*] Multiple spaces after operator | = help: Replace with single space -ℹ Safe fix +Suggested fix: 29 29 | b = b + 10 30 30 | #: E222 E222 31 31 | x = -1 @@ -63,6 +67,8 @@ E22.py:32:4: E222 [*] Multiple spaces after operator 34 34 | #: E222 E222 35 35 | x[0] = 1 + Run `ruff check --fix` to apply this fix. + E22.py:35:7: E222 [*] Multiple spaces after operator | 33 | long_variable = 3 @@ -74,7 +80,7 @@ E22.py:35:7: E222 [*] Multiple spaces after operator | = help: Replace with single space -ℹ Safe fix +Suggested fix: 32 32 | y = -2 33 33 | long_variable = 3 34 34 | #: E222 E222 @@ -84,6 +90,8 @@ E22.py:35:7: E222 [*] Multiple spaces after operator 37 37 | long_variable = 3 38 38 | #: + Run `ruff check --fix` to apply this fix. + E22.py:36:7: E222 [*] Multiple spaces after operator | 34 | #: E222 E222 @@ -95,7 +103,7 @@ E22.py:36:7: E222 [*] Multiple spaces after operator | = help: Replace with single space -ℹ Safe fix +Suggested fix: 33 33 | long_variable = 3 34 34 | #: E222 E222 35 35 | x[0] = 1 @@ -105,4 +113,4 @@ E22.py:36:7: E222 [*] Multiple spaces after operator 38 38 | #: 39 39 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E223_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E223_E22.py.snap index 363c9b3855b6e..f99f1ffd21f01 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E223_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E223_E22.py.snap @@ -11,7 +11,7 @@ E22.py:43:2: E223 [*] Tab before operator | = help: Replace with single space -ℹ Safe fix +Suggested fix: 40 40 | 41 41 | #: E223 42 42 | foobart = 4 @@ -21,4 +21,4 @@ E22.py:43:2: E223 [*] Tab before operator 45 45 | 46 46 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E224_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E224_E22.py.snap index 4f268d558377e..fabf8a09a6dbd 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E224_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E224_E22.py.snap @@ -11,7 +11,7 @@ E22.py:48:5: E224 [*] Tab after operator | = help: Replace with single space -ℹ Safe fix +Suggested fix: 45 45 | 46 46 | 47 47 | #: E224 @@ -21,4 +21,4 @@ E22.py:48:5: E224 [*] Tab after operator 50 50 | #: 51 51 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E225_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E225_E22.py.snap index 26ef6f3c70256..6b38000cf339f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E225_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E225_E22.py.snap @@ -11,7 +11,7 @@ E22.py:54:11: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 51 51 | 52 52 | 53 53 | #: E225 @@ -21,6 +21,8 @@ E22.py:54:11: E225 [*] Missing whitespace around operator 56 56 | submitted+= 1 57 57 | #: E225 + Run `ruff check --fix` to apply this fix. + E22.py:56:10: E225 [*] Missing whitespace around operator | 54 | submitted +=1 @@ -32,7 +34,7 @@ E22.py:56:10: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 53 53 | #: E225 54 54 | submitted +=1 55 55 | #: E225 @@ -42,6 +44,8 @@ E22.py:56:10: E225 [*] Missing whitespace around operator 58 58 | c =-1 59 59 | #: E225 + Run `ruff check --fix` to apply this fix. + E22.py:58:3: E225 [*] Missing whitespace around operator | 56 | submitted+= 1 @@ -53,7 +57,7 @@ E22.py:58:3: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 55 55 | #: E225 56 56 | submitted+= 1 57 57 | #: E225 @@ -63,6 +67,8 @@ E22.py:58:3: E225 [*] Missing whitespace around operator 60 60 | x = x /2 - 1 61 61 | #: E225 + Run `ruff check --fix` to apply this fix. + E22.py:76:2: E225 [*] Missing whitespace around operator | 74 | _1kB = _1MB>> 10 @@ -74,7 +80,7 @@ E22.py:76:2: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 73 73 | #: E225 74 74 | _1kB = _1MB>> 10 75 75 | #: E225 E225 @@ -84,6 +90,8 @@ E22.py:76:2: E225 [*] Missing whitespace around operator 78 78 | i=i +1 79 79 | #: E225 + Run `ruff check --fix` to apply this fix. + E22.py:78:2: E225 [*] Missing whitespace around operator | 76 | i=i+ 1 @@ -95,7 +103,7 @@ E22.py:78:2: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 75 75 | #: E225 E225 76 76 | i=i+ 1 77 77 | #: E225 E225 @@ -105,6 +113,8 @@ E22.py:78:2: E225 [*] Missing whitespace around operator 80 80 | i = 1and 1 81 81 | #: E225 + Run `ruff check --fix` to apply this fix. + E22.py:80:6: E225 [*] Missing whitespace around operator | 78 | i=i +1 @@ -116,7 +126,7 @@ E22.py:80:6: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 77 77 | #: E225 E225 78 78 | i=i +1 79 79 | #: E225 @@ -126,6 +136,8 @@ E22.py:80:6: E225 [*] Missing whitespace around operator 82 82 | i = 1or 0 83 83 | #: E225 + Run `ruff check --fix` to apply this fix. + E22.py:82:6: E225 [*] Missing whitespace around operator | 80 | i = 1and 1 @@ -137,7 +149,7 @@ E22.py:82:6: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 79 79 | #: E225 80 80 | i = 1and 1 81 81 | #: E225 @@ -147,6 +159,8 @@ E22.py:82:6: E225 [*] Missing whitespace around operator 84 84 | 1is 1 85 85 | #: E225 + Run `ruff check --fix` to apply this fix. + E22.py:84:2: E225 [*] Missing whitespace around operator | 82 | i = 1or 0 @@ -158,7 +172,7 @@ E22.py:84:2: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 81 81 | #: E225 82 82 | i = 1or 0 83 83 | #: E225 @@ -168,6 +182,8 @@ E22.py:84:2: E225 [*] Missing whitespace around operator 86 86 | 1in [] 87 87 | #: E225 + Run `ruff check --fix` to apply this fix. + E22.py:86:2: E225 [*] Missing whitespace around operator | 84 | 1is 1 @@ -179,7 +195,7 @@ E22.py:86:2: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 83 83 | #: E225 84 84 | 1is 1 85 85 | #: E225 @@ -189,6 +205,8 @@ E22.py:86:2: E225 [*] Missing whitespace around operator 88 88 | i = 1 @2 89 89 | #: E225 + Run `ruff check --fix` to apply this fix. + E22.py:92:2: E225 [*] Missing whitespace around operator | 90 | i = 1@ 2 @@ -200,7 +218,7 @@ E22.py:92:2: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 89 89 | #: E225 90 90 | i = 1@ 2 91 91 | #: E225 E226 @@ -210,6 +228,8 @@ E22.py:92:2: E225 [*] Missing whitespace around operator 94 94 | i =i+1 95 95 | #: E225 E226 + Run `ruff check --fix` to apply this fix. + E22.py:94:3: E225 [*] Missing whitespace around operator | 92 | i=i+1 @@ -221,7 +241,7 @@ E22.py:94:3: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 91 91 | #: E225 E226 92 92 | i=i+1 93 93 | #: E225 E226 @@ -231,6 +251,8 @@ E22.py:94:3: E225 [*] Missing whitespace around operator 96 96 | i= i+1 97 97 | #: E225 E226 + Run `ruff check --fix` to apply this fix. + E22.py:96:2: E225 [*] Missing whitespace around operator | 94 | i =i+1 @@ -242,7 +264,7 @@ E22.py:96:2: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 93 93 | #: E225 E226 94 94 | i =i+1 95 95 | #: E225 E226 @@ -252,4 +274,4 @@ E22.py:96:2: E225 [*] Missing whitespace around operator 98 98 | c = (a +b)*(a - b) 99 99 | #: E225 E226 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E226_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E226_E22.py.snap index 881986bcc5329..7e51d33c7934f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E226_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E226_E22.py.snap @@ -12,7 +12,7 @@ E22.py:60:7: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 57 57 | #: E225 58 58 | c =-1 59 59 | #: E225 @@ -22,6 +22,8 @@ E22.py:60:7: E226 [*] Missing whitespace around arithmetic operator 62 62 | c = alpha -4 63 63 | #: E225 + Run `ruff check --fix` to apply this fix. + E22.py:62:11: E226 [*] Missing whitespace around arithmetic operator | 60 | x = x /2 - 1 @@ -33,7 +35,7 @@ E22.py:62:11: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 59 59 | #: E225 60 60 | x = x /2 - 1 61 61 | #: E225 @@ -43,6 +45,8 @@ E22.py:62:11: E226 [*] Missing whitespace around arithmetic operator 64 64 | c = alpha- 4 65 65 | #: E225 + Run `ruff check --fix` to apply this fix. + E22.py:64:10: E226 [*] Missing whitespace around arithmetic operator | 62 | c = alpha -4 @@ -54,7 +58,7 @@ E22.py:64:10: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 61 61 | #: E225 62 62 | c = alpha -4 63 63 | #: E225 @@ -64,6 +68,8 @@ E22.py:64:10: E226 [*] Missing whitespace around arithmetic operator 66 66 | z = x **y 67 67 | #: E225 + Run `ruff check --fix` to apply this fix. + E22.py:66:7: E226 [*] Missing whitespace around arithmetic operator | 64 | c = alpha- 4 @@ -75,7 +81,7 @@ E22.py:66:7: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 63 63 | #: E225 64 64 | c = alpha- 4 65 65 | #: E225 @@ -85,6 +91,8 @@ E22.py:66:7: E226 [*] Missing whitespace around arithmetic operator 68 68 | z = (x + 1) **y 69 69 | #: E225 + Run `ruff check --fix` to apply this fix. + E22.py:68:13: E226 [*] Missing whitespace around arithmetic operator | 66 | z = x **y @@ -96,7 +104,7 @@ E22.py:68:13: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 65 65 | #: E225 66 66 | z = x **y 67 67 | #: E225 @@ -106,6 +114,8 @@ E22.py:68:13: E226 [*] Missing whitespace around arithmetic operator 70 70 | z = (x + 1)** y 71 71 | #: E225 + Run `ruff check --fix` to apply this fix. + E22.py:70:12: E226 [*] Missing whitespace around arithmetic operator | 68 | z = (x + 1) **y @@ -117,7 +127,7 @@ E22.py:70:12: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 67 67 | #: E225 68 68 | z = (x + 1) **y 69 69 | #: E225 @@ -127,6 +137,8 @@ E22.py:70:12: E226 [*] Missing whitespace around arithmetic operator 72 72 | _1kB = _1MB >>10 73 73 | #: E225 + Run `ruff check --fix` to apply this fix. + E22.py:76:4: E226 [*] Missing whitespace around arithmetic operator | 74 | _1kB = _1MB>> 10 @@ -138,7 +150,7 @@ E22.py:76:4: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 73 73 | #: E225 74 74 | _1kB = _1MB>> 10 75 75 | #: E225 E225 @@ -148,6 +160,8 @@ E22.py:76:4: E226 [*] Missing whitespace around arithmetic operator 78 78 | i=i +1 79 79 | #: E225 + Run `ruff check --fix` to apply this fix. + E22.py:78:5: E226 [*] Missing whitespace around arithmetic operator | 76 | i=i+ 1 @@ -159,7 +173,7 @@ E22.py:78:5: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 75 75 | #: E225 E225 76 76 | i=i+ 1 77 77 | #: E225 E225 @@ -169,6 +183,8 @@ E22.py:78:5: E226 [*] Missing whitespace around arithmetic operator 80 80 | i = 1and 1 81 81 | #: E225 + Run `ruff check --fix` to apply this fix. + E22.py:88:7: E226 [*] Missing whitespace around arithmetic operator | 86 | 1in [] @@ -180,7 +196,7 @@ E22.py:88:7: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 85 85 | #: E225 86 86 | 1in [] 87 87 | #: E225 @@ -190,6 +206,8 @@ E22.py:88:7: E226 [*] Missing whitespace around arithmetic operator 90 90 | i = 1@ 2 91 91 | #: E225 E226 + Run `ruff check --fix` to apply this fix. + E22.py:90:6: E226 [*] Missing whitespace around arithmetic operator | 88 | i = 1 @2 @@ -201,7 +219,7 @@ E22.py:90:6: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 87 87 | #: E225 88 88 | i = 1 @2 89 89 | #: E225 @@ -211,6 +229,8 @@ E22.py:90:6: E226 [*] Missing whitespace around arithmetic operator 92 92 | i=i+1 93 93 | #: E225 E226 + Run `ruff check --fix` to apply this fix. + E22.py:92:4: E226 [*] Missing whitespace around arithmetic operator | 90 | i = 1@ 2 @@ -222,7 +242,7 @@ E22.py:92:4: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 89 89 | #: E225 90 90 | i = 1@ 2 91 91 | #: E225 E226 @@ -232,6 +252,8 @@ E22.py:92:4: E226 [*] Missing whitespace around arithmetic operator 94 94 | i =i+1 95 95 | #: E225 E226 + Run `ruff check --fix` to apply this fix. + E22.py:94:5: E226 [*] Missing whitespace around arithmetic operator | 92 | i=i+1 @@ -243,7 +265,7 @@ E22.py:94:5: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 91 91 | #: E225 E226 92 92 | i=i+1 93 93 | #: E225 E226 @@ -253,6 +275,8 @@ E22.py:94:5: E226 [*] Missing whitespace around arithmetic operator 96 96 | i= i+1 97 97 | #: E225 E226 + Run `ruff check --fix` to apply this fix. + E22.py:96:5: E226 [*] Missing whitespace around arithmetic operator | 94 | i =i+1 @@ -264,7 +288,7 @@ E22.py:96:5: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 93 93 | #: E225 E226 94 94 | i =i+1 95 95 | #: E225 E226 @@ -274,6 +298,8 @@ E22.py:96:5: E226 [*] Missing whitespace around arithmetic operator 98 98 | c = (a +b)*(a - b) 99 99 | #: E225 E226 + Run `ruff check --fix` to apply this fix. + E22.py:98:8: E226 [*] Missing whitespace around arithmetic operator | 96 | i= i+1 @@ -285,7 +311,7 @@ E22.py:98:8: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 95 95 | #: E225 E226 96 96 | i= i+1 97 97 | #: E225 E226 @@ -295,6 +321,8 @@ E22.py:98:8: E226 [*] Missing whitespace around arithmetic operator 100 100 | c = (a+ b)*(a - b) 101 101 | #: + Run `ruff check --fix` to apply this fix. + E22.py:98:11: E226 [*] Missing whitespace around arithmetic operator | 96 | i= i+1 @@ -306,7 +334,7 @@ E22.py:98:11: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 95 95 | #: E225 E226 96 96 | i= i+1 97 97 | #: E225 E226 @@ -316,6 +344,8 @@ E22.py:98:11: E226 [*] Missing whitespace around arithmetic operator 100 100 | c = (a+ b)*(a - b) 101 101 | #: + Run `ruff check --fix` to apply this fix. + E22.py:100:7: E226 [*] Missing whitespace around arithmetic operator | 98 | c = (a +b)*(a - b) @@ -326,7 +356,7 @@ E22.py:100:7: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 97 97 | #: E225 E226 98 98 | c = (a +b)*(a - b) 99 99 | #: E225 E226 @@ -336,6 +366,8 @@ E22.py:100:7: E226 [*] Missing whitespace around arithmetic operator 102 102 | 103 103 | #: E226 + Run `ruff check --fix` to apply this fix. + E22.py:100:11: E226 [*] Missing whitespace around arithmetic operator | 98 | c = (a +b)*(a - b) @@ -346,7 +378,7 @@ E22.py:100:11: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 97 97 | #: E225 E226 98 98 | c = (a +b)*(a - b) 99 99 | #: E225 E226 @@ -356,6 +388,8 @@ E22.py:100:11: E226 [*] Missing whitespace around arithmetic operator 102 102 | 103 103 | #: E226 + Run `ruff check --fix` to apply this fix. + E22.py:104:6: E226 [*] Missing whitespace around arithmetic operator | 103 | #: E226 @@ -366,7 +400,7 @@ E22.py:104:6: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 101 101 | #: 102 102 | 103 103 | #: E226 @@ -376,6 +410,8 @@ E22.py:104:6: E226 [*] Missing whitespace around arithmetic operator 106 106 | c = (a+b) * (a-b) 107 107 | #: E226 + Run `ruff check --fix` to apply this fix. + E22.py:106:7: E226 [*] Missing whitespace around arithmetic operator | 104 | z = 2//30 @@ -387,7 +423,7 @@ E22.py:106:7: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 103 103 | #: E226 104 104 | z = 2//30 105 105 | #: E226 E226 @@ -397,6 +433,8 @@ E22.py:106:7: E226 [*] Missing whitespace around arithmetic operator 108 108 | norman = True+False 109 109 | #: E226 + Run `ruff check --fix` to apply this fix. + E22.py:106:15: E226 [*] Missing whitespace around arithmetic operator | 104 | z = 2//30 @@ -408,7 +446,7 @@ E22.py:106:15: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 103 103 | #: E226 104 104 | z = 2//30 105 105 | #: E226 E226 @@ -418,6 +456,8 @@ E22.py:106:15: E226 [*] Missing whitespace around arithmetic operator 108 108 | norman = True+False 109 109 | #: E226 + Run `ruff check --fix` to apply this fix. + E22.py:110:6: E226 [*] Missing whitespace around arithmetic operator | 108 | norman = True+False @@ -429,7 +469,7 @@ E22.py:110:6: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 107 107 | #: E226 108 108 | norman = True+False 109 109 | #: E226 @@ -439,6 +479,8 @@ E22.py:110:6: E226 [*] Missing whitespace around arithmetic operator 112 112 | x = x/2 - 1 113 113 | #: E226 E226 + Run `ruff check --fix` to apply this fix. + E22.py:112:6: E226 [*] Missing whitespace around arithmetic operator | 110 | x = x*2 - 1 @@ -450,7 +492,7 @@ E22.py:112:6: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 109 109 | #: E226 110 110 | x = x*2 - 1 111 111 | #: E226 @@ -460,6 +502,8 @@ E22.py:112:6: E226 [*] Missing whitespace around arithmetic operator 114 114 | hypot2 = x*x + y*y 115 115 | #: E226 + Run `ruff check --fix` to apply this fix. + E22.py:114:11: E226 [*] Missing whitespace around arithmetic operator | 112 | x = x/2 - 1 @@ -471,7 +515,7 @@ E22.py:114:11: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 111 111 | #: E226 112 112 | x = x/2 - 1 113 113 | #: E226 E226 @@ -481,6 +525,8 @@ E22.py:114:11: E226 [*] Missing whitespace around arithmetic operator 116 116 | c = (a + b)*(a - b) 117 117 | #: E226 + Run `ruff check --fix` to apply this fix. + E22.py:114:17: E226 [*] Missing whitespace around arithmetic operator | 112 | x = x/2 - 1 @@ -492,7 +538,7 @@ E22.py:114:17: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 111 111 | #: E226 112 112 | x = x/2 - 1 113 113 | #: E226 E226 @@ -502,6 +548,8 @@ E22.py:114:17: E226 [*] Missing whitespace around arithmetic operator 116 116 | c = (a + b)*(a - b) 117 117 | #: E226 + Run `ruff check --fix` to apply this fix. + E22.py:116:12: E226 [*] Missing whitespace around arithmetic operator | 114 | hypot2 = x*x + y*y @@ -513,7 +561,7 @@ E22.py:116:12: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 113 113 | #: E226 E226 114 114 | hypot2 = x*x + y*y 115 115 | #: E226 @@ -523,6 +571,8 @@ E22.py:116:12: E226 [*] Missing whitespace around arithmetic operator 118 118 | def halves(n): 119 119 | return (i//2 for i in range(n)) + Run `ruff check --fix` to apply this fix. + E22.py:119:14: E226 [*] Missing whitespace around arithmetic operator | 117 | #: E226 @@ -534,7 +584,7 @@ E22.py:119:14: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 116 116 | c = (a + b)*(a - b) 117 117 | #: E226 118 118 | def halves(n): @@ -544,4 +594,4 @@ E22.py:119:14: E226 [*] Missing whitespace around arithmetic operator 121 121 | _1kB = _1MB>>10 122 122 | #: E227 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E227_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E227_E22.py.snap index 8edf3984b36c8..74034ac50cab3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E227_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E227_E22.py.snap @@ -12,7 +12,7 @@ E22.py:72:13: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 69 69 | #: E225 70 70 | z = (x + 1)** y 71 71 | #: E225 @@ -22,6 +22,8 @@ E22.py:72:13: E227 [*] Missing whitespace around bitwise or shift operator 74 74 | _1kB = _1MB>> 10 75 75 | #: E225 E225 + Run `ruff check --fix` to apply this fix. + E22.py:74:12: E227 [*] Missing whitespace around bitwise or shift operator | 72 | _1kB = _1MB >>10 @@ -33,7 +35,7 @@ E22.py:74:12: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 71 71 | #: E225 72 72 | _1kB = _1MB >>10 73 73 | #: E225 @@ -43,6 +45,8 @@ E22.py:74:12: E227 [*] Missing whitespace around bitwise or shift operator 76 76 | i=i+ 1 77 77 | #: E225 E225 + Run `ruff check --fix` to apply this fix. + E22.py:121:12: E227 [*] Missing whitespace around bitwise or shift operator | 119 | return (i//2 for i in range(n)) @@ -54,7 +58,7 @@ E22.py:121:12: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 118 118 | def halves(n): 119 119 | return (i//2 for i in range(n)) 120 120 | #: E227 @@ -64,6 +68,8 @@ E22.py:121:12: E227 [*] Missing whitespace around bitwise or shift operator 123 123 | _1MB = _1kB<<10 124 124 | #: E227 + Run `ruff check --fix` to apply this fix. + E22.py:123:12: E227 [*] Missing whitespace around bitwise or shift operator | 121 | _1kB = _1MB>>10 @@ -75,7 +81,7 @@ E22.py:123:12: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 120 120 | #: E227 121 121 | _1kB = _1MB>>10 122 122 | #: E227 @@ -85,6 +91,8 @@ E22.py:123:12: E227 [*] Missing whitespace around bitwise or shift operator 125 125 | a = b|c 126 126 | #: E227 + Run `ruff check --fix` to apply this fix. + E22.py:125:6: E227 [*] Missing whitespace around bitwise or shift operator | 123 | _1MB = _1kB<<10 @@ -96,7 +104,7 @@ E22.py:125:6: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 122 122 | #: E227 123 123 | _1MB = _1kB<<10 124 124 | #: E227 @@ -106,6 +114,8 @@ E22.py:125:6: E227 [*] Missing whitespace around bitwise or shift operator 127 127 | b = c&a 128 128 | #: E227 + Run `ruff check --fix` to apply this fix. + E22.py:127:6: E227 [*] Missing whitespace around bitwise or shift operator | 125 | a = b|c @@ -117,7 +127,7 @@ E22.py:127:6: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 124 124 | #: E227 125 125 | a = b|c 126 126 | #: E227 @@ -127,6 +137,8 @@ E22.py:127:6: E227 [*] Missing whitespace around bitwise or shift operator 129 129 | c = b^a 130 130 | #: E228 + Run `ruff check --fix` to apply this fix. + E22.py:129:6: E227 [*] Missing whitespace around bitwise or shift operator | 127 | b = c&a @@ -138,7 +150,7 @@ E22.py:129:6: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 126 126 | #: E227 127 127 | b = c&a 128 128 | #: E227 @@ -148,6 +160,8 @@ E22.py:129:6: E227 [*] Missing whitespace around bitwise or shift operator 131 131 | a = b%c 132 132 | #: E228 + Run `ruff check --fix` to apply this fix. + E22.py:154:11: E227 [*] Missing whitespace around bitwise or shift operator | 152 | func2(lambda a, b=h[:], c=0: (a, b, c)) @@ -159,7 +173,7 @@ E22.py:154:11: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 151 151 | func1(lambda *args, **kw: (args, kw)) 152 152 | func2(lambda a, b=h[:], c=0: (a, b, c)) 153 153 | if not -5 < x < +5: @@ -169,4 +183,4 @@ E22.py:154:11: E227 [*] Missing whitespace around bitwise or shift operator 156 156 | x = x / 2 - 1 157 157 | x = 1 @ 2 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E228_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E228_E22.py.snap index fd9f368f63bea..e86d004857cfe 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E228_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E228_E22.py.snap @@ -12,7 +12,7 @@ E22.py:131:6: E228 [*] Missing whitespace around modulo operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 128 128 | #: E227 129 129 | c = b^a 130 130 | #: E228 @@ -22,6 +22,8 @@ E22.py:131:6: E228 [*] Missing whitespace around modulo operator 133 133 | msg = fmt%(errno, errmsg) 134 134 | #: E228 + Run `ruff check --fix` to apply this fix. + E22.py:133:10: E228 [*] Missing whitespace around modulo operator | 131 | a = b%c @@ -33,7 +35,7 @@ E22.py:133:10: E228 [*] Missing whitespace around modulo operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 130 130 | #: E228 131 131 | a = b%c 132 132 | #: E228 @@ -43,6 +45,8 @@ E22.py:133:10: E228 [*] Missing whitespace around modulo operator 135 135 | msg = "Error %d occurred"%errno 136 136 | #: + Run `ruff check --fix` to apply this fix. + E22.py:135:26: E228 [*] Missing whitespace around modulo operator | 133 | msg = fmt%(errno, errmsg) @@ -53,7 +57,7 @@ E22.py:135:26: E228 [*] Missing whitespace around modulo operator | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 132 132 | #: E228 133 133 | msg = fmt%(errno, errmsg) 134 134 | #: E228 @@ -63,4 +67,4 @@ E22.py:135:26: E228 [*] Missing whitespace around modulo operator 137 137 | 138 138 | #: Okay - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap index 62abb9df58ccb..131088d038eaf 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap @@ -11,7 +11,7 @@ E23.py:2:7: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 1 1 | #: E231 2 |-a = (1,2) 2 |+a = (1, 2) @@ -19,6 +19,8 @@ E23.py:2:7: E231 [*] Missing whitespace after ',' 4 4 | a[b1,:] 5 5 | #: E231 + Run `ruff check --fix` to apply this fix. + E23.py:4:5: E231 [*] Missing whitespace after ',' | 2 | a = (1,2) @@ -30,7 +32,7 @@ E23.py:4:5: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 1 1 | #: E231 2 2 | a = (1,2) 3 3 | #: E231 @@ -40,6 +42,8 @@ E23.py:4:5: E231 [*] Missing whitespace after ',' 6 6 | a = [{'a':''}] 7 7 | #: Okay + Run `ruff check --fix` to apply this fix. + E23.py:6:10: E231 [*] Missing whitespace after ':' | 4 | a[b1,:] @@ -51,7 +55,7 @@ E23.py:6:10: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 3 3 | #: E231 4 4 | a[b1,:] 5 5 | #: E231 @@ -61,6 +65,8 @@ E23.py:6:10: E231 [*] Missing whitespace after ':' 8 8 | a = (4,) 9 9 | b = (5, ) + Run `ruff check --fix` to apply this fix. + E23.py:19:10: E231 [*] Missing whitespace after ',' | 17 | def foo() -> None: @@ -71,7 +77,7 @@ E23.py:19:10: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 16 16 | 17 17 | def foo() -> None: 18 18 | #: E231 @@ -81,6 +87,8 @@ E23.py:19:10: E231 [*] Missing whitespace after ',' 21 21 | 22 22 | #: Okay + Run `ruff check --fix` to apply this fix. + E23.py:29:20: E231 [*] Missing whitespace after ':' | 27 | mdtypes_template = { @@ -91,7 +99,7 @@ E23.py:29:20: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 26 26 | #: E231:2:20 27 27 | mdtypes_template = { 28 28 | 'tag_full': [('mdtype', 'u4'), ('byte_count', 'u4')], @@ -101,6 +109,8 @@ E23.py:29:20: E231 [*] Missing whitespace after ':' 31 31 | 32 32 | # E231 + Run `ruff check --fix` to apply this fix. + E23.py:33:6: E231 [*] Missing whitespace after ',' | 32 | # E231 @@ -111,7 +121,7 @@ E23.py:33:6: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 30 30 | } 31 31 | 32 32 | # E231 @@ -121,6 +131,8 @@ E23.py:33:6: E231 [*] Missing whitespace after ',' 35 35 | # Okay because it's hard to differentiate between the usages of a colon in a f-string 36 36 | f"{a:=1}" + Run `ruff check --fix` to apply this fix. + E23.py:47:37: E231 [*] Missing whitespace after ':' | 46 | #: E231 @@ -131,7 +143,7 @@ E23.py:47:37: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 44 44 | snapshot.file_uri[len(f's3://{self.s3_bucket_name}/'):] 45 45 | 46 46 | #: E231 @@ -141,6 +153,8 @@ E23.py:47:37: E231 [*] Missing whitespace after ':' 49 49 | #: Okay 50 50 | a = (1,) + Run `ruff check --fix` to apply this fix. + E23.py:60:13: E231 [*] Missing whitespace after ':' | 58 | results = { @@ -152,7 +166,7 @@ E23.py:60:13: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 57 57 | """Primary function.""" 58 58 | results = { 59 59 | "k1": [1], @@ -162,6 +176,8 @@ E23.py:60:13: E231 [*] Missing whitespace after ':' 62 62 | results_in_tuple = ( 63 63 | { + Run `ruff check --fix` to apply this fix. + E23.py:65:17: E231 [*] Missing whitespace after ':' | 63 | { @@ -173,7 +189,7 @@ E23.py:65:17: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 62 62 | results_in_tuple = ( 63 63 | { 64 64 | "k1": [1], @@ -183,6 +199,8 @@ E23.py:65:17: E231 [*] Missing whitespace after ':' 67 67 | ) 68 68 | results_in_list = [ + Run `ruff check --fix` to apply this fix. + E23.py:71:17: E231 [*] Missing whitespace after ':' | 69 | { @@ -194,7 +212,7 @@ E23.py:71:17: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 68 68 | results_in_list = [ 69 69 | { 70 70 | "k1": [1], @@ -204,6 +222,8 @@ E23.py:71:17: E231 [*] Missing whitespace after ':' 73 73 | ] 74 74 | results_in_list_first = [ + Run `ruff check --fix` to apply this fix. + E23.py:76:17: E231 [*] Missing whitespace after ':' | 74 | results_in_list_first = [ @@ -215,7 +235,7 @@ E23.py:76:17: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 73 73 | ] 74 74 | results_in_list_first = [ 75 75 | { @@ -225,6 +245,8 @@ E23.py:76:17: E231 [*] Missing whitespace after ':' 78 78 | ] 79 79 | + Run `ruff check --fix` to apply this fix. + E23.py:82:13: E231 [*] Missing whitespace after ':' | 80 | x = [ @@ -236,7 +258,7 @@ E23.py:82:13: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 79 79 | 80 80 | x = [ 81 81 | { @@ -246,6 +268,8 @@ E23.py:82:13: E231 [*] Missing whitespace after ':' 84 84 | "k3":[2], # E231 85 85 | "k4": [2], + Run `ruff check --fix` to apply this fix. + E23.py:84:13: E231 [*] Missing whitespace after ':' | 82 | "k1":[2], # E231 @@ -257,7 +281,7 @@ E23.py:84:13: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 81 81 | { 82 82 | "k1":[2], # E231 83 83 | "k2": x[2:4], @@ -267,6 +291,8 @@ E23.py:84:13: E231 [*] Missing whitespace after ':' 86 86 | "k5": [2], 87 87 | "k6": [1, 2, 3, 4,5,6,7] # E231 + Run `ruff check --fix` to apply this fix. + E23.py:87:26: E231 [*] Missing whitespace after ',' | 85 | "k4": [2], @@ -278,7 +304,7 @@ E23.py:87:26: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 84 84 | "k3":[2], # E231 85 85 | "k4": [2], 86 86 | "k5": [2], @@ -288,6 +314,8 @@ E23.py:87:26: E231 [*] Missing whitespace after ',' 89 89 | { 90 90 | "k1": [ + Run `ruff check --fix` to apply this fix. + E23.py:87:28: E231 [*] Missing whitespace after ',' | 85 | "k4": [2], @@ -299,7 +327,7 @@ E23.py:87:28: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 84 84 | "k3":[2], # E231 85 85 | "k4": [2], 86 86 | "k5": [2], @@ -309,6 +337,8 @@ E23.py:87:28: E231 [*] Missing whitespace after ',' 89 89 | { 90 90 | "k1": [ + Run `ruff check --fix` to apply this fix. + E23.py:87:30: E231 [*] Missing whitespace after ',' | 85 | "k4": [2], @@ -320,7 +350,7 @@ E23.py:87:30: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 84 84 | "k3":[2], # E231 85 85 | "k4": [2], 86 86 | "k5": [2], @@ -330,6 +360,8 @@ E23.py:87:30: E231 [*] Missing whitespace after ',' 89 89 | { 90 90 | "k1": [ + Run `ruff check --fix` to apply this fix. + E23.py:92:21: E231 [*] Missing whitespace after ':' | 90 | "k1": [ @@ -341,7 +373,7 @@ E23.py:92:21: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 89 89 | { 90 90 | "k1": [ 91 91 | { @@ -351,6 +383,8 @@ E23.py:92:21: E231 [*] Missing whitespace after ':' 94 94 | { 95 95 | "kb": [2,3], # E231 + Run `ruff check --fix` to apply this fix. + E23.py:92:24: E231 [*] Missing whitespace after ',' | 90 | "k1": [ @@ -362,7 +396,7 @@ E23.py:92:24: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 89 89 | { 90 90 | "k1": [ 91 91 | { @@ -372,6 +406,8 @@ E23.py:92:24: E231 [*] Missing whitespace after ',' 94 94 | { 95 95 | "kb": [2,3], # E231 + Run `ruff check --fix` to apply this fix. + E23.py:95:25: E231 [*] Missing whitespace after ',' | 93 | }, @@ -383,7 +419,7 @@ E23.py:95:25: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 92 92 | "ka":[2,3], # E231 93 93 | }, 94 94 | { @@ -393,6 +429,8 @@ E23.py:95:25: E231 [*] Missing whitespace after ',' 97 97 | { 98 98 | "ka":[2, 3], # E231 + Run `ruff check --fix` to apply this fix. + E23.py:98:21: E231 [*] Missing whitespace after ':' | 96 | }, @@ -404,7 +442,7 @@ E23.py:98:21: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 95 95 | "kb": [2,3], # E231 96 96 | }, 97 97 | { @@ -414,6 +452,8 @@ E23.py:98:21: E231 [*] Missing whitespace after ':' 100 100 | "kc": [2, 3], # Ok 101 101 | "kd": [2,3], # E231 + Run `ruff check --fix` to apply this fix. + E23.py:101:25: E231 [*] Missing whitespace after ',' | 99 | "kb": [2, 3], # Ok @@ -425,7 +465,7 @@ E23.py:101:25: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 98 98 | "ka":[2, 3], # E231 99 99 | "kb": [2, 3], # Ok 100 100 | "kc": [2, 3], # Ok @@ -435,6 +475,8 @@ E23.py:101:25: E231 [*] Missing whitespace after ',' 103 103 | }, 104 104 | ] + Run `ruff check --fix` to apply this fix. + E23.py:102:21: E231 [*] Missing whitespace after ':' | 100 | "kc": [2, 3], # Ok @@ -446,7 +488,7 @@ E23.py:102:21: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 99 99 | "kb": [2, 3], # Ok 100 100 | "kc": [2, 3], # Ok 101 101 | "kd": [2,3], # E231 @@ -456,6 +498,8 @@ E23.py:102:21: E231 [*] Missing whitespace after ':' 104 104 | ] 105 105 | } + Run `ruff check --fix` to apply this fix. + E23.py:102:24: E231 [*] Missing whitespace after ',' | 100 | "kc": [2, 3], # Ok @@ -467,7 +511,7 @@ E23.py:102:24: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 99 99 | "kb": [2, 3], # Ok 100 100 | "kc": [2, 3], # Ok 101 101 | "kd": [2,3], # E231 @@ -476,3 +520,5 @@ E23.py:102:24: E231 [*] Missing whitespace after ',' 103 103 | }, 104 104 | ] 105 105 | } + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E241_E24.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E241_E24.py.snap index dba2129ca812e..4817a48a74df3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E241_E24.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E241_E24.py.snap @@ -11,7 +11,7 @@ E24.py:2:8: E241 [*] Multiple spaces after comma | = help: Replace with single space -ℹ Safe fix +Suggested fix: 1 1 | #: E241 2 |-a = (1, 2) 2 |+a = (1, 2) @@ -19,6 +19,8 @@ E24.py:2:8: E241 [*] Multiple spaces after comma 4 4 | b = (1, 20) 5 5 | #: E242 + Run `ruff check --fix` to apply this fix. + E24.py:11:18: E241 [*] Multiple spaces after comma | 9 | #: E241 E241 E241 @@ -30,7 +32,7 @@ E24.py:11:18: E241 [*] Multiple spaces after comma | = help: Replace with single space -ℹ Safe fix +Suggested fix: 8 8 | b = (1, 20) # space before 20 9 9 | #: E241 E241 E241 10 10 | # issue 135 @@ -39,6 +41,8 @@ E24.py:11:18: E241 [*] Multiple spaces after comma 12 12 | ef, +h, 13 13 | c, -d] + Run `ruff check --fix` to apply this fix. + E24.py:12:19: E241 [*] Multiple spaces after comma | 10 | # issue 135 @@ -49,7 +53,7 @@ E24.py:12:19: E241 [*] Multiple spaces after comma | = help: Replace with single space -ℹ Safe fix +Suggested fix: 9 9 | #: E241 E241 E241 10 10 | # issue 135 11 11 | more_spaces = [a, b, @@ -57,6 +61,8 @@ E24.py:12:19: E241 [*] Multiple spaces after comma 12 |+ ef, +h, 13 13 | c, -d] + Run `ruff check --fix` to apply this fix. + E24.py:13:18: E241 [*] Multiple spaces after comma | 11 | more_spaces = [a, b, @@ -66,11 +72,11 @@ E24.py:13:18: E241 [*] Multiple spaces after comma | = help: Replace with single space -ℹ Safe fix +Suggested fix: 10 10 | # issue 135 11 11 | more_spaces = [a, b, 12 12 | ef, +h, 13 |- c, -d] 13 |+ c, -d] - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E242_E24.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E242_E24.py.snap index bf93c26308780..df2b2b1b71f6b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E242_E24.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E242_E24.py.snap @@ -12,7 +12,7 @@ E24.py:6:8: E242 [*] Tab after comma | = help: Replace with single space -ℹ Safe fix +Suggested fix: 3 3 | #: Okay 4 4 | b = (1, 20) 5 5 | #: E242 @@ -22,4 +22,4 @@ E24.py:6:8: E242 [*] Tab after comma 8 8 | b = (1, 20) # space before 20 9 9 | #: E241 E241 E241 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E251_E25.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E251_E25.py.snap index a87bcdff5586b..c38f7e2608136 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E251_E25.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E251_E25.py.snap @@ -11,7 +11,7 @@ E25.py:2:12: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -ℹ Safe fix +Suggested fix: 1 1 | #: E251 E251 2 |-def foo(bar = False): 2 |+def foo(bar= False): @@ -19,6 +19,8 @@ E25.py:2:12: E251 [*] Unexpected spaces around keyword / parameter equals 4 4 | pass 5 5 | #: E251 + Run `ruff check --fix` to apply this fix. + E25.py:2:14: E251 [*] Unexpected spaces around keyword / parameter equals | 1 | #: E251 E251 @@ -29,7 +31,7 @@ E25.py:2:14: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -ℹ Safe fix +Suggested fix: 1 1 | #: E251 E251 2 |-def foo(bar = False): 2 |+def foo(bar =False): @@ -37,6 +39,8 @@ E25.py:2:14: E251 [*] Unexpected spaces around keyword / parameter equals 4 4 | pass 5 5 | #: E251 + Run `ruff check --fix` to apply this fix. + E25.py:6:9: E251 [*] Unexpected spaces around keyword / parameter equals | 4 | pass @@ -48,7 +52,7 @@ E25.py:6:9: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -ℹ Safe fix +Suggested fix: 3 3 | '''Test function with an error in declaration''' 4 4 | pass 5 5 | #: E251 @@ -58,6 +62,8 @@ E25.py:6:9: E251 [*] Unexpected spaces around keyword / parameter equals 8 8 | foo(bar =True) 9 9 | #: E251 E251 + Run `ruff check --fix` to apply this fix. + E25.py:8:8: E251 [*] Unexpected spaces around keyword / parameter equals | 6 | foo(bar= True) @@ -69,7 +75,7 @@ E25.py:8:8: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -ℹ Safe fix +Suggested fix: 5 5 | #: E251 6 6 | foo(bar= True) 7 7 | #: E251 @@ -79,6 +85,8 @@ E25.py:8:8: E251 [*] Unexpected spaces around keyword / parameter equals 10 10 | foo(bar = True) 11 11 | #: E251 + Run `ruff check --fix` to apply this fix. + E25.py:10:8: E251 [*] Unexpected spaces around keyword / parameter equals | 8 | foo(bar =True) @@ -90,7 +98,7 @@ E25.py:10:8: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -ℹ Safe fix +Suggested fix: 7 7 | #: E251 8 8 | foo(bar =True) 9 9 | #: E251 E251 @@ -100,6 +108,8 @@ E25.py:10:8: E251 [*] Unexpected spaces around keyword / parameter equals 12 12 | y = bar(root= "sdasd") 13 13 | #: E251:2:29 + Run `ruff check --fix` to apply this fix. + E25.py:10:10: E251 [*] Unexpected spaces around keyword / parameter equals | 8 | foo(bar =True) @@ -111,7 +121,7 @@ E25.py:10:10: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -ℹ Safe fix +Suggested fix: 7 7 | #: E251 8 8 | foo(bar =True) 9 9 | #: E251 E251 @@ -121,6 +131,8 @@ E25.py:10:10: E251 [*] Unexpected spaces around keyword / parameter equals 12 12 | y = bar(root= "sdasd") 13 13 | #: E251:2:29 + Run `ruff check --fix` to apply this fix. + E25.py:12:14: E251 [*] Unexpected spaces around keyword / parameter equals | 10 | foo(bar = True) @@ -132,7 +144,7 @@ E25.py:12:14: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -ℹ Safe fix +Suggested fix: 9 9 | #: E251 E251 10 10 | foo(bar = True) 11 11 | #: E251 @@ -142,6 +154,8 @@ E25.py:12:14: E251 [*] Unexpected spaces around keyword / parameter equals 14 14 | parser.add_argument('--long-option', 15 15 | default= + Run `ruff check --fix` to apply this fix. + E25.py:15:29: E251 [*] Unexpected spaces around keyword / parameter equals | 13 | #: E251:2:29 @@ -155,7 +169,7 @@ E25.py:15:29: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -ℹ Safe fix +Suggested fix: 12 12 | y = bar(root= "sdasd") 13 13 | #: E251:2:29 14 14 | parser.add_argument('--long-option', @@ -166,6 +180,8 @@ E25.py:15:29: E251 [*] Unexpected spaces around keyword / parameter equals 18 17 | parser.add_argument('--long-option', default 19 18 | ="/rather/long/filesystem/path/here/blah/blah/blah") + Run `ruff check --fix` to apply this fix. + E25.py:18:45: E251 [*] Unexpected spaces around keyword / parameter equals | 16 | "/rather/long/filesystem/path/here/blah/blah/blah") @@ -179,7 +195,7 @@ E25.py:18:45: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -ℹ Safe fix +Suggested fix: 15 15 | default= 16 16 | "/rather/long/filesystem/path/here/blah/blah/blah") 17 17 | #: E251:1:45 @@ -190,6 +206,8 @@ E25.py:18:45: E251 [*] Unexpected spaces around keyword / parameter equals 21 20 | foo(True, 22 21 | baz=(1, 2), + Run `ruff check --fix` to apply this fix. + E25.py:23:8: E251 [*] Unexpected spaces around keyword / parameter equals | 21 | foo(True, @@ -201,7 +219,7 @@ E25.py:23:8: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -ℹ Safe fix +Suggested fix: 20 20 | #: E251:3:8 E251:3:10 21 21 | foo(True, 22 22 | baz=(1, 2), @@ -211,6 +229,8 @@ E25.py:23:8: E251 [*] Unexpected spaces around keyword / parameter equals 25 25 | #: Okay 26 26 | foo(bar=(1 == 1)) + Run `ruff check --fix` to apply this fix. + E25.py:23:10: E251 [*] Unexpected spaces around keyword / parameter equals | 21 | foo(True, @@ -222,7 +242,7 @@ E25.py:23:10: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -ℹ Safe fix +Suggested fix: 20 20 | #: E251:3:8 E251:3:10 21 21 | foo(True, 22 22 | baz=(1, 2), @@ -232,4 +252,4 @@ E25.py:23:10: E251 [*] Unexpected spaces around keyword / parameter equals 25 25 | #: Okay 26 26 | foo(bar=(1 == 1)) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E252_E25.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E252_E25.py.snap index 54c129811470f..ad127391f307f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E252_E25.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E252_E25.py.snap @@ -12,7 +12,7 @@ E25.py:46:15: E252 [*] Missing whitespace around parameter equals | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 43 43 | async def add(a: int = 0, b: int = 0) -> int: 44 44 | return a + b 45 45 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 @@ -22,6 +22,8 @@ E25.py:46:15: E252 [*] Missing whitespace around parameter equals 48 48 | #: Okay 49 49 | def add(a: int = _default(name='f')): + Run `ruff check --fix` to apply this fix. + E25.py:46:15: E252 [*] Missing whitespace around parameter equals | 44 | return a + b @@ -33,7 +35,7 @@ E25.py:46:15: E252 [*] Missing whitespace around parameter equals | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 43 43 | async def add(a: int = 0, b: int = 0) -> int: 44 44 | return a + b 45 45 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 @@ -43,6 +45,8 @@ E25.py:46:15: E252 [*] Missing whitespace around parameter equals 48 48 | #: Okay 49 49 | def add(a: int = _default(name='f')): + Run `ruff check --fix` to apply this fix. + E25.py:46:26: E252 [*] Missing whitespace around parameter equals | 44 | return a + b @@ -54,7 +58,7 @@ E25.py:46:26: E252 [*] Missing whitespace around parameter equals | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 43 43 | async def add(a: int = 0, b: int = 0) -> int: 44 44 | return a + b 45 45 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 @@ -64,6 +68,8 @@ E25.py:46:26: E252 [*] Missing whitespace around parameter equals 48 48 | #: Okay 49 49 | def add(a: int = _default(name='f')): + Run `ruff check --fix` to apply this fix. + E25.py:46:36: E252 [*] Missing whitespace around parameter equals | 44 | return a + b @@ -75,7 +81,7 @@ E25.py:46:36: E252 [*] Missing whitespace around parameter equals | = help: Add missing whitespace -ℹ Safe fix +Suggested fix: 43 43 | async def add(a: int = 0, b: int = 0) -> int: 44 44 | return a + b 45 45 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 @@ -85,4 +91,4 @@ E25.py:46:36: E252 [*] Missing whitespace around parameter equals 48 48 | #: Okay 49 49 | def add(a: int = _default(name='f')): - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E261_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E261_E26.py.snap index d9b8a7679c0f4..a3d64ec4bf7f3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E261_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E261_E26.py.snap @@ -11,7 +11,7 @@ E26.py:2:5: E261 [*] Insert at least two spaces before an inline comment | = help: Insert spaces -ℹ Safe fix +Suggested fix: 1 1 | #: E261:1:5 2 |-pass # an inline comment 2 |+pass # an inline comment @@ -19,4 +19,4 @@ E26.py:2:5: E261 [*] Insert at least two spaces before an inline comment 4 4 | x = x + 1 #Increment x 5 5 | #: E262:1:12 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap index 658391acdc36b..2190347b94ae9 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap @@ -12,7 +12,7 @@ E26.py:4:12: E262 [*] Inline comment should start with `# ` | = help: Format space -ℹ Safe fix +Suggested fix: 1 1 | #: E261:1:5 2 2 | pass # an inline comment 3 3 | #: E262:1:12 @@ -22,6 +22,8 @@ E26.py:4:12: E262 [*] Inline comment should start with `# ` 6 6 | x = x + 1 # Increment x 7 7 | #: E262:1:12 + Run `ruff check --fix` to apply this fix. + E26.py:6:12: E262 [*] Inline comment should start with `# ` | 4 | x = x + 1 #Increment x @@ -33,7 +35,7 @@ E26.py:6:12: E262 [*] Inline comment should start with `# ` | = help: Format space -ℹ Safe fix +Suggested fix: 3 3 | #: E262:1:12 4 4 | x = x + 1 #Increment x 5 5 | #: E262:1:12 @@ -43,6 +45,8 @@ E26.py:6:12: E262 [*] Inline comment should start with `# ` 8 8 | x = y + 1 #: Increment x 9 9 | #: E265:1:1 + Run `ruff check --fix` to apply this fix. + E26.py:8:12: E262 [*] Inline comment should start with `# ` | 6 | x = x + 1 # Increment x @@ -54,7 +58,7 @@ E26.py:8:12: E262 [*] Inline comment should start with `# ` | = help: Format space -ℹ Safe fix +Suggested fix: 5 5 | #: E262:1:12 6 6 | x = x + 1 # Increment x 7 7 | #: E262:1:12 @@ -64,6 +68,8 @@ E26.py:8:12: E262 [*] Inline comment should start with `# ` 10 10 | #Block comment 11 11 | a = 1 + Run `ruff check --fix` to apply this fix. + E26.py:63:9: E262 [*] Inline comment should start with `# ` | 61 | # -*- coding: utf8 -*- @@ -75,7 +81,7 @@ E26.py:63:9: E262 [*] Inline comment should start with `# ` | = help: Format space -ℹ Safe fix +Suggested fix: 60 60 | #: E262:3:9 61 61 | # -*- coding: utf8 -*- 62 62 | #  (One space one NBSP) Ok for block comment @@ -85,6 +91,8 @@ E26.py:63:9: E262 [*] Inline comment should start with `# ` 65 65 | # (Two spaces) Ok for block comment 66 66 | a = 42 # (Two spaces) + Run `ruff check --fix` to apply this fix. + E26.py:66:9: E262 [*] Inline comment should start with `# ` | 64 | #: E262:2:9 @@ -96,7 +104,7 @@ E26.py:66:9: E262 [*] Inline comment should start with `# ` | = help: Format space -ℹ Safe fix +Suggested fix: 63 63 | a = 42 #  (One space one NBSP) 64 64 | #: E262:2:9 65 65 | # (Two spaces) Ok for block comment @@ -106,6 +114,8 @@ E26.py:66:9: E262 [*] Inline comment should start with `# ` 68 68 | #: E265:5:1 69 69 | ### Means test is not done yet + Run `ruff check --fix` to apply this fix. + E26.py:84:8: E262 [*] Inline comment should start with `# ` | 82 | ## Foo @@ -117,7 +127,7 @@ E26.py:84:8: E262 [*] Inline comment should start with `# ` | = help: Format space -ℹ Safe fix +Suggested fix: 81 81 | #: E266:1:3 82 82 | ## Foo 83 83 | @@ -126,6 +136,8 @@ E26.py:84:8: E262 [*] Inline comment should start with `# ` 85 85 | 86 86 | a = 1 #:Foo + Run `ruff check --fix` to apply this fix. + E26.py:86:8: E262 [*] Inline comment should start with `# ` | 84 | a = 1 ## Foo @@ -135,11 +147,11 @@ E26.py:86:8: E262 [*] Inline comment should start with `# ` | = help: Format space -ℹ Safe fix +Suggested fix: 83 83 | 84 84 | a = 1 ## Foo 85 85 | 86 |-a = 1 #:Foo 86 |+a = 1 #: Foo - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap index 92b25ccb212b6..05ee6766a7180 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap @@ -12,7 +12,7 @@ E26.py:10:1: E265 [*] Block comment should start with `# ` | = help: Format space -ℹ Safe fix +Suggested fix: 7 7 | #: E262:1:12 8 8 | x = y + 1 #: Increment x 9 9 | #: E265:1:1 @@ -22,6 +22,8 @@ E26.py:10:1: E265 [*] Block comment should start with `# ` 12 12 | #: E265:2:1 13 13 | m = 42 + Run `ruff check --fix` to apply this fix. + E26.py:14:1: E265 [*] Block comment should start with `# ` | 12 | #: E265:2:1 @@ -33,7 +35,7 @@ E26.py:14:1: E265 [*] Block comment should start with `# ` | = help: Format space -ℹ Safe fix +Suggested fix: 11 11 | a = 1 12 12 | #: E265:2:1 13 13 | m = 42 @@ -43,6 +45,8 @@ E26.py:14:1: E265 [*] Block comment should start with `# ` 16 16 | #: E266:3:5 E266:6:5 17 17 | def how_it_feel(r): + Run `ruff check --fix` to apply this fix. + E26.py:25:1: E265 [*] Block comment should start with `# ` | 23 | return @@ -54,7 +58,7 @@ E26.py:25:1: E265 [*] Block comment should start with `# ` | = help: Format space -ℹ Safe fix +Suggested fix: 22 22 | ### Of course it is unused 23 23 | return 24 24 | #: E265:1:1 E266:2:1 @@ -64,6 +68,8 @@ E26.py:25:1: E265 [*] Block comment should start with `# ` 27 27 | #: W291:1:42 28 28 | ######################################### + Run `ruff check --fix` to apply this fix. + E26.py:32:1: E265 [*] Block comment should start with `# ` | 31 | #: Okay @@ -74,7 +80,7 @@ E26.py:32:1: E265 [*] Block comment should start with `# ` | = help: Format space -ℹ Safe fix +Suggested fix: 29 29 | #: 30 30 | 31 31 | #: Okay @@ -84,6 +90,8 @@ E26.py:32:1: E265 [*] Block comment should start with `# ` 34 34 | pass # an inline comment 35 35 | x = x + 1 # Increment x + Run `ruff check --fix` to apply this fix. + E26.py:73:1: E265 [*] Block comment should start with `# ` | 71 | # F Means test is failing (F) @@ -94,7 +102,7 @@ E26.py:73:1: E265 [*] Block comment should start with `# ` | = help: Format space -ℹ Safe fix +Suggested fix: 70 70 | # E Means test is giving error (E) 71 71 | # F Means test is failing (F) 72 72 | # EF Means test is giving error and Failing @@ -104,6 +112,8 @@ E26.py:73:1: E265 [*] Block comment should start with `# ` 75 75 | 76 76 | #: Colon prefix is okay + Run `ruff check --fix` to apply this fix. + E26.py:78:1: E265 [*] Block comment should start with `# ` | 76 | #: Colon prefix is okay @@ -115,7 +125,7 @@ E26.py:78:1: E265 [*] Block comment should start with `# ` | = help: Format space -ℹ Safe fix +Suggested fix: 75 75 | 76 76 | #: Colon prefix is okay 77 77 | @@ -125,4 +135,4 @@ E26.py:78:1: E265 [*] Block comment should start with `# ` 80 80 | # We should strip the space, but preserve the hashes. 81 81 | #: E266:1:3 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap index 4469e1b225d64..3d582186b09f6 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap @@ -11,7 +11,7 @@ E26.py:19:5: E266 [*] Too many leading `#` before block comment | = help: Remove leading `#` -ℹ Safe fix +Suggested fix: 16 16 | #: E266:3:5 E266:6:5 17 17 | def how_it_feel(r): 18 18 | @@ -21,6 +21,8 @@ E26.py:19:5: E266 [*] Too many leading `#` before block comment 21 21 | 22 22 | ### Of course it is unused + Run `ruff check --fix` to apply this fix. + E26.py:22:5: E266 [*] Too many leading `#` before block comment | 20 | a = 42 @@ -32,7 +34,7 @@ E26.py:22:5: E266 [*] Too many leading `#` before block comment | = help: Remove leading `#` -ℹ Safe fix +Suggested fix: 19 19 | ### This is a variable ### 20 20 | a = 42 21 21 | @@ -42,6 +44,8 @@ E26.py:22:5: E266 [*] Too many leading `#` before block comment 24 24 | #: E265:1:1 E266:2:1 25 25 | ##if DEBUG: + Run `ruff check --fix` to apply this fix. + E26.py:26:1: E266 [*] Too many leading `#` before block comment | 24 | #: E265:1:1 E266:2:1 @@ -53,7 +57,7 @@ E26.py:26:1: E266 [*] Too many leading `#` before block comment | = help: Remove leading `#` -ℹ Safe fix +Suggested fix: 23 23 | return 24 24 | #: E265:1:1 E266:2:1 25 25 | ##if DEBUG: @@ -63,6 +67,8 @@ E26.py:26:1: E266 [*] Too many leading `#` before block comment 28 28 | ######################################### 29 29 | #: + Run `ruff check --fix` to apply this fix. + E26.py:69:1: E266 [*] Too many leading `#` before block comment | 68 | #: E265:5:1 @@ -73,7 +79,7 @@ E26.py:69:1: E266 [*] Too many leading `#` before block comment | = help: Remove leading `#` -ℹ Safe fix +Suggested fix: 66 66 | a = 42 # (Two spaces) 67 67 | 68 68 | #: E265:5:1 @@ -83,6 +89,8 @@ E26.py:69:1: E266 [*] Too many leading `#` before block comment 71 71 | # F Means test is failing (F) 72 72 | # EF Means test is giving error and Failing + Run `ruff check --fix` to apply this fix. + E26.py:82:1: E266 [*] Too many leading `#` before block comment | 80 | # We should strip the space, but preserve the hashes. @@ -94,7 +102,7 @@ E26.py:82:1: E266 [*] Too many leading `#` before block comment | = help: Remove leading `#` -ℹ Safe fix +Suggested fix: 79 79 | 80 80 | # We should strip the space, but preserve the hashes. 81 81 | #: E266:1:3 @@ -104,4 +112,4 @@ E26.py:82:1: E266 [*] Too many leading `#` before block comment 84 84 | a = 1 ## Foo 85 85 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap index ffd296ba6a802..96548873e4c95 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap @@ -12,7 +12,7 @@ E27.py:4:9: E271 [*] Multiple spaces after keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 1 1 | #: Okay 2 2 | True and False 3 3 | #: E271 @@ -22,6 +22,8 @@ E27.py:4:9: E271 [*] Multiple spaces after keyword 6 6 | True and False 7 7 | #: E271 + Run `ruff check --fix` to apply this fix. + E27.py:6:5: E271 [*] Multiple spaces after keyword | 4 | True and False @@ -33,7 +35,7 @@ E27.py:6:5: E271 [*] Multiple spaces after keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 3 3 | #: E271 4 4 | True and False 5 5 | #: E272 @@ -43,6 +45,8 @@ E27.py:6:5: E271 [*] Multiple spaces after keyword 8 8 | if 1: 9 9 | pass + Run `ruff check --fix` to apply this fix. + E27.py:8:3: E271 [*] Multiple spaces after keyword | 6 | True and False @@ -54,7 +58,7 @@ E27.py:8:3: E271 [*] Multiple spaces after keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 5 5 | #: E272 6 6 | True and False 7 7 | #: E271 @@ -64,6 +68,8 @@ E27.py:8:3: E271 [*] Multiple spaces after keyword 10 10 | #: E273 11 11 | True and False + Run `ruff check --fix` to apply this fix. + E27.py:15:6: E271 [*] Multiple spaces after keyword | 13 | True and False @@ -75,7 +81,7 @@ E27.py:15:6: E271 [*] Multiple spaces after keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 12 12 | #: E273 E274 13 13 | True and False 14 14 | #: E271 @@ -85,6 +91,8 @@ E27.py:15:6: E271 [*] Multiple spaces after keyword 17 17 | 1 and b 18 18 | #: E271 + Run `ruff check --fix` to apply this fix. + E27.py:17:6: E271 [*] Multiple spaces after keyword | 15 | a and b @@ -96,7 +104,7 @@ E27.py:17:6: E271 [*] Multiple spaces after keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 14 14 | #: E271 15 15 | a and b 16 16 | #: E271 @@ -106,6 +114,8 @@ E27.py:17:6: E271 [*] Multiple spaces after keyword 19 19 | a and 2 20 20 | #: E271 E272 + Run `ruff check --fix` to apply this fix. + E27.py:19:6: E271 [*] Multiple spaces after keyword | 17 | 1 and b @@ -117,7 +127,7 @@ E27.py:19:6: E271 [*] Multiple spaces after keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 16 16 | #: E271 17 17 | 1 and b 18 18 | #: E271 @@ -127,6 +137,8 @@ E27.py:19:6: E271 [*] Multiple spaces after keyword 21 21 | 1 and b 22 22 | #: E271 E272 + Run `ruff check --fix` to apply this fix. + E27.py:21:7: E271 [*] Multiple spaces after keyword | 19 | a and 2 @@ -138,7 +150,7 @@ E27.py:21:7: E271 [*] Multiple spaces after keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 18 18 | #: E271 19 19 | a and 2 20 20 | #: E271 E272 @@ -148,6 +160,8 @@ E27.py:21:7: E271 [*] Multiple spaces after keyword 23 23 | a and 2 24 24 | #: E272 + Run `ruff check --fix` to apply this fix. + E27.py:23:7: E271 [*] Multiple spaces after keyword | 21 | 1 and b @@ -159,7 +173,7 @@ E27.py:23:7: E271 [*] Multiple spaces after keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 20 20 | #: E271 E272 21 21 | 1 and b 22 22 | #: E271 E272 @@ -169,6 +183,8 @@ E27.py:23:7: E271 [*] Multiple spaces after keyword 25 25 | this and False 26 26 | #: E273 + Run `ruff check --fix` to apply this fix. + E27.py:36:14: E271 [*] Multiple spaces after keyword | 34 | from v import c, d @@ -180,7 +196,7 @@ E27.py:36:14: E271 [*] Multiple spaces after keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 33 33 | from u import (a, b) 34 34 | from v import c, d 35 35 | #: E271 @@ -190,6 +206,8 @@ E27.py:36:14: E271 [*] Multiple spaces after keyword 38 38 | from w import(e, f) 39 39 | #: E275 + Run `ruff check --fix` to apply this fix. + E27.py:71:5: E271 [*] Multiple spaces after keyword | 70 | #: E271 @@ -200,7 +218,7 @@ E27.py:71:5: E271 [*] Multiple spaces after keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 68 68 | # Soft keywords 69 69 | 70 70 | #: E271 @@ -209,3 +227,5 @@ E27.py:71:5: E271 [*] Multiple spaces after keyword 72 72 | 73 73 | #: E273 74 74 | type Number = int + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E272_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E272_E27.py.snap index c9f27f6f2a97c..1cc5186885e61 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E272_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E272_E27.py.snap @@ -12,7 +12,7 @@ E27.py:21:2: E272 [*] Multiple spaces before keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 18 18 | #: E271 19 19 | a and 2 20 20 | #: E271 E272 @@ -22,6 +22,8 @@ E27.py:21:2: E272 [*] Multiple spaces before keyword 23 23 | a and 2 24 24 | #: E272 + Run `ruff check --fix` to apply this fix. + E27.py:23:2: E272 [*] Multiple spaces before keyword | 21 | 1 and b @@ -33,7 +35,7 @@ E27.py:23:2: E272 [*] Multiple spaces before keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 20 20 | #: E271 E272 21 21 | 1 and b 22 22 | #: E271 E272 @@ -43,6 +45,8 @@ E27.py:23:2: E272 [*] Multiple spaces before keyword 25 25 | this and False 26 26 | #: E273 + Run `ruff check --fix` to apply this fix. + E27.py:25:5: E272 [*] Multiple spaces before keyword | 23 | a and 2 @@ -54,7 +58,7 @@ E27.py:25:5: E272 [*] Multiple spaces before keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 22 22 | #: E271 E272 23 23 | a and 2 24 24 | #: E272 @@ -63,3 +67,5 @@ E27.py:25:5: E272 [*] Multiple spaces before keyword 26 26 | #: E273 27 27 | a and b 28 28 | #: E274 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E273_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E273_E27.py.snap index ecdb9d3a290e7..7658cbe23833d 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E273_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E273_E27.py.snap @@ -12,7 +12,7 @@ E27.py:11:9: E273 [*] Tab after keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 8 8 | if 1: 9 9 | pass 10 10 | #: E273 @@ -22,6 +22,8 @@ E27.py:11:9: E273 [*] Tab after keyword 13 13 | True and False 14 14 | #: E271 + Run `ruff check --fix` to apply this fix. + E27.py:13:5: E273 [*] Tab after keyword | 11 | True and False @@ -33,7 +35,7 @@ E27.py:13:5: E273 [*] Tab after keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 10 10 | #: E273 11 11 | True and False 12 12 | #: E273 E274 @@ -43,6 +45,8 @@ E27.py:13:5: E273 [*] Tab after keyword 15 15 | a and b 16 16 | #: E271 + Run `ruff check --fix` to apply this fix. + E27.py:13:10: E273 [*] Tab after keyword | 11 | True and False @@ -54,7 +58,7 @@ E27.py:13:10: E273 [*] Tab after keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 10 10 | #: E273 11 11 | True and False 12 12 | #: E273 E274 @@ -64,6 +68,8 @@ E27.py:13:10: E273 [*] Tab after keyword 15 15 | a and b 16 16 | #: E271 + Run `ruff check --fix` to apply this fix. + E27.py:27:6: E273 [*] Tab after keyword | 25 | this and False @@ -75,7 +81,7 @@ E27.py:27:6: E273 [*] Tab after keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 24 24 | #: E272 25 25 | this and False 26 26 | #: E273 @@ -85,6 +91,8 @@ E27.py:27:6: E273 [*] Tab after keyword 29 29 | a and b 30 30 | #: E273 E274 + Run `ruff check --fix` to apply this fix. + E27.py:31:10: E273 [*] Tab after keyword | 29 | a and b @@ -96,7 +104,7 @@ E27.py:31:10: E273 [*] Tab after keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 28 28 | #: E274 29 29 | a and b 30 30 | #: E273 E274 @@ -106,6 +114,8 @@ E27.py:31:10: E273 [*] Tab after keyword 33 33 | from u import (a, b) 34 34 | from v import c, d + Run `ruff check --fix` to apply this fix. + E27.py:74:5: E273 [*] Tab after keyword | 73 | #: E273 @@ -116,7 +126,7 @@ E27.py:74:5: E273 [*] Tab after keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 71 71 | type Number = int 72 72 | 73 73 | #: E273 @@ -125,3 +135,5 @@ E27.py:74:5: E273 [*] Tab after keyword 75 75 | 76 76 | #: E275 77 77 | match(foo): + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E274_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E274_E27.py.snap index 062a61bebf50d..3ee9524798118 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E274_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E274_E27.py.snap @@ -12,7 +12,7 @@ E27.py:29:2: E274 [*] Tab before keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 26 26 | #: E273 27 27 | a and b 28 28 | #: E274 @@ -22,6 +22,8 @@ E27.py:29:2: E274 [*] Tab before keyword 31 31 | this and False 32 32 | #: Okay + Run `ruff check --fix` to apply this fix. + E27.py:31:5: E274 [*] Tab before keyword | 29 | a and b @@ -33,7 +35,7 @@ E27.py:31:5: E274 [*] Tab before keyword | = help: Replace with single space -ℹ Safe fix +Suggested fix: 28 28 | #: E274 29 29 | a and b 30 30 | #: E273 E274 @@ -42,3 +44,5 @@ E27.py:31:5: E274 [*] Tab before keyword 32 32 | #: Okay 33 33 | from u import (a, b) 34 34 | from v import c, d + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E275_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E275_E27.py.snap index 0d0cc6d0dfe56..1860286af5822 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E275_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E275_E27.py.snap @@ -12,7 +12,7 @@ E27.py:38:8: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -ℹ Safe fix +Suggested fix: 35 35 | #: E271 36 36 | from w import (e, f) 37 37 | #: E275 @@ -22,6 +22,8 @@ E27.py:38:8: E275 [*] Missing whitespace after keyword 40 40 | from importable.module import(e, f) 41 41 | #: E275 + Run `ruff check --fix` to apply this fix. + E27.py:40:24: E275 [*] Missing whitespace after keyword | 38 | from w import(e, f) @@ -33,7 +35,7 @@ E27.py:40:24: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -ℹ Safe fix +Suggested fix: 37 37 | #: E275 38 38 | from w import(e, f) 39 39 | #: E275 @@ -43,6 +45,8 @@ E27.py:40:24: E275 [*] Missing whitespace after keyword 42 42 | try: 43 43 | from importable.module import(e, f) + Run `ruff check --fix` to apply this fix. + E27.py:43:28: E275 [*] Missing whitespace after keyword | 41 | #: E275 @@ -54,7 +58,7 @@ E27.py:43:28: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -ℹ Safe fix +Suggested fix: 40 40 | from importable.module import(e, f) 41 41 | #: E275 42 42 | try: @@ -64,6 +68,8 @@ E27.py:43:28: E275 [*] Missing whitespace after keyword 45 45 | pass 46 46 | #: E275 + Run `ruff check --fix` to apply this fix. + E27.py:47:1: E275 [*] Missing whitespace after keyword | 45 | pass @@ -75,7 +81,7 @@ E27.py:47:1: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -ℹ Safe fix +Suggested fix: 44 44 | except ImportError: 45 45 | pass 46 46 | #: E275 @@ -85,6 +91,8 @@ E27.py:47:1: E275 [*] Missing whitespace after keyword 49 49 | else: 50 50 | pass + Run `ruff check --fix` to apply this fix. + E27.py:55:5: E275 [*] Missing whitespace after keyword | 53 | #: E275:2:11 @@ -96,7 +104,7 @@ E27.py:55:5: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -ℹ Safe fix +Suggested fix: 52 52 | matched = {"true": True, "false": False} 53 53 | #: E275:2:11 54 54 | if True: @@ -106,6 +114,8 @@ E27.py:55:5: E275 [*] Missing whitespace after keyword 57 57 | def f(): 58 58 | print((yield)) + Run `ruff check --fix` to apply this fix. + E27.py:77:1: E275 [*] Missing whitespace after keyword | 76 | #: E275 @@ -116,7 +126,7 @@ E27.py:77:1: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -ℹ Safe fix +Suggested fix: 74 74 | type Number = int 75 75 | 76 76 | #: E275 @@ -126,6 +136,8 @@ E27.py:77:1: E275 [*] Missing whitespace after keyword 79 79 | pass 80 80 | + Run `ruff check --fix` to apply this fix. + E27.py:78:5: E275 [*] Missing whitespace after keyword | 76 | #: E275 @@ -136,7 +148,7 @@ E27.py:78:5: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -ℹ Safe fix +Suggested fix: 75 75 | 76 76 | #: E275 77 77 | match(foo): @@ -145,3 +157,5 @@ E27.py:78:5: E275 [*] Missing whitespace after keyword 79 79 | pass 80 80 | 81 81 | # https://github.com/astral-sh/ruff/issues/12094 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30.py.snap index c224ebbeb7806..dae7fc542a2cd 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30.py.snap @@ -12,7 +12,7 @@ E30.py:478:5: E301 [*] Expected 1 blank line, found 0 | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 475 475 | 476 476 | def func1(): 477 477 | pass @@ -21,6 +21,8 @@ E30.py:478:5: E301 [*] Expected 1 blank line, found 0 479 480 | pass 480 481 | # end + Run `ruff check --fix` to apply this fix. + E30.py:489:5: E301 [*] Expected 1 blank line, found 0 | 487 | pass @@ -32,7 +34,7 @@ E30.py:489:5: E301 [*] Expected 1 blank line, found 0 | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 485 485 | 486 486 | def fn1(): 487 487 | pass @@ -41,6 +43,8 @@ E30.py:489:5: E301 [*] Expected 1 blank line, found 0 489 490 | def fn2(): 490 491 | pass + Run `ruff check --fix` to apply this fix. + E30.py:499:5: E301 [*] Expected 1 blank line, found 0 | 498 | columns = [] @@ -51,7 +55,7 @@ E30.py:499:5: E301 [*] Expected 1 blank line, found 0 | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 496 496 | """Class for minimal repo.""" 497 497 | 498 498 | columns = [] @@ -60,6 +64,8 @@ E30.py:499:5: E301 [*] Expected 1 blank line, found 0 500 501 | def cls_method(cls) -> None: 501 502 | pass + Run `ruff check --fix` to apply this fix. + E30.py:511:5: E301 [*] Expected 1 blank line, found 0 | 509 | def method(cls) -> None: @@ -71,7 +77,7 @@ E30.py:511:5: E301 [*] Expected 1 blank line, found 0 | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 508 508 | 509 509 | def method(cls) -> None: 510 510 | pass @@ -80,6 +86,8 @@ E30.py:511:5: E301 [*] Expected 1 blank line, found 0 512 513 | def cls_method(cls) -> None: 513 514 | pass + Run `ruff check --fix` to apply this fix. + E30.py:526:5: E301 [*] Expected 1 blank line, found 0 | 524 | def bar(self, x: str) -> str: @@ -91,7 +99,7 @@ E30.py:526:5: E301 [*] Expected 1 blank line, found 0 | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 523 523 | @overload 524 524 | def bar(self, x: str) -> str: 525 525 | ... @@ -99,3 +107,5 @@ E30.py:526:5: E301 [*] Expected 1 blank line, found 0 526 527 | def bar(self, x: int | str) -> int | str: 527 528 | return x 528 529 | # end + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap index 3ae60bb0da739..ca166b6480717 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap @@ -12,7 +12,7 @@ E30.py:533:1: E302 [*] Expected 2 blank lines, found 0 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 530 530 | 531 531 | # E302 532 532 | """Main module.""" @@ -22,6 +22,8 @@ E30.py:533:1: E302 [*] Expected 2 blank lines, found 0 534 536 | pass 535 537 | # end + Run `ruff check --fix` to apply this fix. + E30.py:540:1: E302 [*] Expected 2 blank lines, found 0 | 538 | # E302 @@ -33,7 +35,7 @@ E30.py:540:1: E302 [*] Expected 2 blank lines, found 0 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 537 537 | 538 538 | # E302 539 539 | import sys @@ -43,6 +45,8 @@ E30.py:540:1: E302 [*] Expected 2 blank lines, found 0 541 543 | return sys.path 542 544 | # end + Run `ruff check --fix` to apply this fix. + E30.py:549:1: E302 [*] Expected 2 blank lines, found 1 | 547 | pass @@ -54,7 +58,7 @@ E30.py:549:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 546 546 | def a(): 547 547 | pass 548 548 | @@ -63,6 +67,8 @@ E30.py:549:1: E302 [*] Expected 2 blank lines, found 1 550 551 | pass 551 552 | # end + Run `ruff check --fix` to apply this fix. + E30.py:560:1: E302 [*] Expected 2 blank lines, found 1 | 558 | # comment @@ -74,7 +80,7 @@ E30.py:560:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 557 557 | 558 558 | # comment 559 559 | @@ -83,6 +89,8 @@ E30.py:560:1: E302 [*] Expected 2 blank lines, found 1 561 562 | pass 562 563 | # end + Run `ruff check --fix` to apply this fix. + E30.py:569:1: E302 [*] Expected 2 blank lines, found 1 | 567 | pass @@ -94,7 +102,7 @@ E30.py:569:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 566 566 | def a(): 567 567 | pass 568 568 | @@ -103,6 +111,8 @@ E30.py:569:1: E302 [*] Expected 2 blank lines, found 1 570 571 | pass 571 572 | # end + Run `ruff check --fix` to apply this fix. + E30.py:578:1: E302 [*] Expected 2 blank lines, found 1 | 576 | pass @@ -114,7 +124,7 @@ E30.py:578:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 575 575 | async def x(): 576 576 | pass 577 577 | @@ -123,6 +133,8 @@ E30.py:578:1: E302 [*] Expected 2 blank lines, found 1 579 580 | pass 580 581 | # end + Run `ruff check --fix` to apply this fix. + E30.py:586:1: E302 [*] Expected 2 blank lines, found 0 | 584 | def bar(): @@ -133,7 +145,7 @@ E30.py:586:1: E302 [*] Expected 2 blank lines, found 0 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 583 583 | # E302 584 584 | def bar(): 585 585 | pass @@ -143,6 +155,8 @@ E30.py:586:1: E302 [*] Expected 2 blank lines, found 0 587 589 | # end 588 590 | + Run `ruff check --fix` to apply this fix. + E30.py:592:1: E302 [*] Expected 2 blank lines, found 0 | 590 | # E302 @@ -154,7 +168,7 @@ E30.py:592:1: E302 [*] Expected 2 blank lines, found 0 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 589 589 | 590 590 | # E302 591 591 | def bar(): pass @@ -164,6 +178,8 @@ E30.py:592:1: E302 [*] Expected 2 blank lines, found 0 593 595 | pass 594 596 | # end + Run `ruff check --fix` to apply this fix. + E30.py:602:1: E302 [*] Expected 2 blank lines, found 1 | 601 | # comment @@ -174,7 +190,7 @@ E30.py:602:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 598 598 | def f(): 599 599 | pass 600 600 | @@ -184,6 +200,8 @@ E30.py:602:1: E302 [*] Expected 2 blank lines, found 1 602 604 | @decorator 603 605 | def g(): + Run `ruff check --fix` to apply this fix. + E30.py:624:1: E302 [*] Expected 2 blank lines, found 0 | 622 | # E302 @@ -194,7 +212,7 @@ E30.py:624:1: E302 [*] Expected 2 blank lines, found 0 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 621 621 | 622 622 | # E302 623 623 | class A:... @@ -204,6 +222,8 @@ E30.py:624:1: E302 [*] Expected 2 blank lines, found 0 625 627 | # end 626 628 | + Run `ruff check --fix` to apply this fix. + E30.py:634:1: E302 [*] Expected 2 blank lines, found 1 | 632 | def fn(a: str) -> str: ... @@ -215,7 +235,7 @@ E30.py:634:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 631 631 | @overload 632 632 | def fn(a: str) -> str: ... 633 633 | @@ -223,3 +243,5 @@ E30.py:634:1: E302 [*] Expected 2 blank lines, found 1 634 635 | def fn(a: int | str) -> int | str: 635 636 | ... 636 637 | # end + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap index 4fa4accc0cf4c..213239e29b24c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap @@ -11,9 +11,11 @@ E302_first_line_docstring.py:3:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 1 1 | """Test where the error is after the module's docstring.""" 2 2 | 3 |+ 3 4 | def fn(): 4 5 | pass + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap index 9cd8779d1b6f7..2781a2731d8c9 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap @@ -11,9 +11,11 @@ E302_first_line_expression.py:3:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 1 1 | "Test where the first line is a comment, " + "and the rule violation follows it." 2 2 | 3 |+ 3 4 | def fn(): 4 5 | pass + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap index a847c86079c7a..127622c1120ac 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap @@ -11,10 +11,12 @@ E302_first_line_function.py:4:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 1 1 | def fn1(): 2 2 | pass 3 3 | 4 |+ 4 5 | def fn2(): 5 6 | pass + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap index a4736c7dd4e63..fd0eb470a0b5e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap @@ -11,9 +11,11 @@ E302_first_line_statement.py:3:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 1 1 | print("Test where the first line is a statement, and the rule violation follows it.") 2 2 | 3 |+ 3 4 | def fn(): 4 5 | pass + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap index a5f47acd9e976..2ae243a2ab943 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap @@ -10,7 +10,7 @@ E30.py:617:2: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 613 613 | def method1(): 614 614 | return 1 615 615 | @@ -19,6 +19,8 @@ E30.py:617:2: E303 [*] Too many blank lines (2) 618 617 | return 22 619 618 | # end + Run `ruff check --fix` to apply this fix. + E30.py:644:5: E303 [*] Too many blank lines (2) | 644 | # arbitrary comment @@ -28,7 +30,7 @@ E30.py:644:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 640 640 | def fn(): 641 641 | _ = None 642 642 | @@ -37,6 +39,8 @@ E30.py:644:5: E303 [*] Too many blank lines (2) 645 644 | 646 645 | def inner(): # E306 not expected (pycodestyle detects E306) + Run `ruff check --fix` to apply this fix. + E30.py:656:5: E303 [*] Too many blank lines (2) | 656 | # arbitrary comment @@ -46,7 +50,7 @@ E30.py:656:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 652 652 | def fn(): 653 653 | _ = None 654 654 | @@ -55,6 +59,8 @@ E30.py:656:5: E303 [*] Too many blank lines (2) 657 656 | def inner(): # E306 not expected (pycodestyle detects E306) 658 657 | pass + Run `ruff check --fix` to apply this fix. + E30.py:667:1: E303 [*] Too many blank lines (3) | 667 | print() @@ -63,7 +69,7 @@ E30.py:667:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 663 663 | print() 664 664 | 665 665 | @@ -72,6 +78,8 @@ E30.py:667:1: E303 [*] Too many blank lines (3) 668 667 | # end 669 668 | + Run `ruff check --fix` to apply this fix. + E30.py:676:1: E303 [*] Too many blank lines (3) | 676 | # comment @@ -81,7 +89,7 @@ E30.py:676:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 672 672 | print() 673 673 | 674 674 | @@ -90,6 +98,8 @@ E30.py:676:1: E303 [*] Too many blank lines (3) 677 676 | 678 677 | print() + Run `ruff check --fix` to apply this fix. + E30.py:687:5: E303 [*] Too many blank lines (2) | 687 | # comment @@ -97,7 +107,7 @@ E30.py:687:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 683 683 | def a(): 684 684 | print() 685 685 | @@ -106,6 +116,8 @@ E30.py:687:5: E303 [*] Too many blank lines (2) 688 687 | 689 688 | + Run `ruff check --fix` to apply this fix. + E30.py:690:5: E303 [*] Too many blank lines (2) | 690 | # another comment @@ -115,7 +127,7 @@ E30.py:690:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 686 686 | 687 687 | # comment 688 688 | @@ -124,6 +136,8 @@ E30.py:690:5: E303 [*] Too many blank lines (2) 691 690 | 692 691 | print() + Run `ruff check --fix` to apply this fix. + E30.py:701:1: E303 [*] Too many blank lines (3) | 701 | / """This class docstring comes on line 5. @@ -134,7 +148,7 @@ E30.py:701:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 697 697 | #!python 698 698 | 699 699 | @@ -143,6 +157,8 @@ E30.py:701:1: E303 [*] Too many blank lines (3) 702 701 | It gives error E303: too many blank lines (3) 703 702 | """ + Run `ruff check --fix` to apply this fix. + E30.py:713:5: E303 [*] Too many blank lines (2) | 713 | def b(self): @@ -152,7 +168,7 @@ E30.py:713:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 709 709 | def a(self): 710 710 | pass 711 711 | @@ -161,6 +177,8 @@ E30.py:713:5: E303 [*] Too many blank lines (2) 714 713 | pass 715 714 | # end + Run `ruff check --fix` to apply this fix. + E30.py:723:5: E303 [*] Too many blank lines (2) | 723 | a = 2 @@ -169,7 +187,7 @@ E30.py:723:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 719 719 | if True: 720 720 | a = 1 721 721 | @@ -178,6 +196,8 @@ E30.py:723:5: E303 [*] Too many blank lines (2) 724 723 | # end 725 724 | + Run `ruff check --fix` to apply this fix. + E30.py:731:5: E303 [*] Too many blank lines (2) | 731 | # comment @@ -185,7 +205,7 @@ E30.py:731:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 727 727 | # E303 728 728 | class Test: 729 729 | @@ -194,6 +214,8 @@ E30.py:731:5: E303 [*] Too many blank lines (2) 732 731 | 733 732 | + Run `ruff check --fix` to apply this fix. + E30.py:734:5: E303 [*] Too many blank lines (2) | 734 | # another comment @@ -203,7 +225,7 @@ E30.py:734:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 730 730 | 731 731 | # comment 732 732 | @@ -212,6 +234,8 @@ E30.py:734:5: E303 [*] Too many blank lines (2) 735 734 | 736 735 | def test(self): pass + Run `ruff check --fix` to apply this fix. + E30.py:748:5: E303 [*] Too many blank lines (2) | 748 | def b(self): @@ -221,7 +245,7 @@ E30.py:748:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 744 744 | 745 745 | # wrongly indented comment 746 746 | @@ -230,6 +254,8 @@ E30.py:748:5: E303 [*] Too many blank lines (2) 749 748 | pass 750 749 | # end + Run `ruff check --fix` to apply this fix. + E30.py:758:5: E303 [*] Too many blank lines (2) | 758 | pass @@ -238,11 +264,13 @@ E30.py:758:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 754 754 | def fn(): 755 755 | pass 756 756 | 757 |- 758 757 | pass 759 758 | # end -760 759 | +760 759 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_comment.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_comment.py.snap index 0494356fb0a58..c5dcc09cef3b3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_comment.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_comment.py.snap @@ -9,10 +9,12 @@ E303_first_line_comment.py:5:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 1 1 | # Test where the first line is a comment, and the rule violation follows it. 2 2 | 3 3 | 4 |- 5 4 | def fn(): 6 5 | pass + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_docstring.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_docstring.py.snap index d709f904ddbd6..aebb989cf551c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_docstring.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_docstring.py.snap @@ -9,10 +9,12 @@ E303_first_line_docstring.py:5:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 1 1 | """Test where the error is after the module's docstring.""" 2 2 | 3 3 | 4 |- 5 4 | def fn(): 6 5 | pass + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_expression.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_expression.py.snap index d81f9098c5312..6646ea6c5a12f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_expression.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_expression.py.snap @@ -9,10 +9,12 @@ E303_first_line_expression.py:5:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 1 1 | "Test where the first line is a comment, " + "and the rule violation follows it." 2 2 | 3 3 | 4 |- 5 4 | def fn(): 6 5 | pass + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_statement.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_statement.py.snap index 7197d3e13338d..80f014d4cac1c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_statement.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_statement.py.snap @@ -9,10 +9,12 @@ E303_first_line_statement.py:5:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 1 1 | print("Test where the first line is a statement, and the rule violation follows it.") 2 2 | 3 3 | 4 |- 5 4 | def fn(): 6 5 | pass + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap index 2c53c6bbf7092..27658a231c174 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap @@ -12,7 +12,7 @@ E30.py:765:1: E304 [*] Blank lines found after function decorator (1) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 761 761 | 762 762 | # E304 763 763 | @decorator @@ -21,6 +21,8 @@ E30.py:765:1: E304 [*] Blank lines found after function decorator (1) 766 765 | pass 767 766 | # end + Run `ruff check --fix` to apply this fix. + E30.py:774:1: E304 [*] Blank lines found after function decorator (1) | 773 | # comment E304 not expected @@ -31,7 +33,7 @@ E30.py:774:1: E304 [*] Blank lines found after function decorator (1) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 769 769 | 770 770 | # E304 771 771 | @decorator @@ -40,6 +42,8 @@ E30.py:774:1: E304 [*] Blank lines found after function decorator (1) 774 773 | def function(): 775 774 | pass + Run `ruff check --fix` to apply this fix. + E30.py:786:1: E304 [*] Blank lines found after function decorator (2) | 785 | # second comment E304 not expected @@ -50,7 +54,7 @@ E30.py:786:1: E304 [*] Blank lines found after function decorator (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 778 778 | 779 779 | # E304 780 780 | @decorator @@ -61,3 +65,5 @@ E30.py:786:1: E304 [*] Blank lines found after function decorator (2) 785 782 | # second comment E304 not expected 786 783 | def function(): 787 784 | pass + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap index 6ebd457fc2509..0bb2d72a34d4b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap @@ -10,7 +10,7 @@ E30.py:798:1: E305 [*] Expected 2 blank lines after class or function definition | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 795 795 | # comment 796 796 | 797 797 | # another comment @@ -20,6 +20,8 @@ E30.py:798:1: E305 [*] Expected 2 blank lines after class or function definition 799 801 | # end 800 802 | + Run `ruff check --fix` to apply this fix. + E30.py:809:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) | 808 | # another comment @@ -29,7 +31,7 @@ E30.py:809:1: E305 [*] Expected 2 blank lines after class or function definition | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 806 806 | # comment 807 807 | 808 808 | # another comment @@ -39,6 +41,8 @@ E30.py:809:1: E305 [*] Expected 2 blank lines after class or function definition 810 812 | # end 811 813 | + Run `ruff check --fix` to apply this fix. + E30.py:821:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) | 819 | # another comment @@ -50,7 +54,7 @@ E30.py:821:1: E305 [*] Expected 2 blank lines after class or function definition | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 818 818 | 819 819 | # another comment 820 820 | @@ -59,6 +63,8 @@ E30.py:821:1: E305 [*] Expected 2 blank lines after class or function definition 822 823 | fn() 823 824 | except Exception: + Run `ruff check --fix` to apply this fix. + E30.py:833:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) | 832 | # Two spaces before comments, too. @@ -69,7 +75,7 @@ E30.py:833:1: E305 [*] Expected 2 blank lines after class or function definition | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 830 830 | print() 831 831 | 832 832 | # Two spaces before comments, too. @@ -79,6 +85,8 @@ E30.py:833:1: E305 [*] Expected 2 blank lines after class or function definition 834 836 | a() 835 837 | # end + Run `ruff check --fix` to apply this fix. + E30.py:846:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) | 844 | blah, blah @@ -90,7 +98,7 @@ E30.py:846:1: E305 [*] Expected 2 blank lines after class or function definition | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 843 843 | def main(): 844 844 | blah, blah 845 845 | @@ -98,3 +106,5 @@ E30.py:846:1: E305 [*] Expected 2 blank lines after class or function definition 846 847 | if __name__ == '__main__': 847 848 | main() 848 849 | # end + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30.py.snap index 8f83acc86f9d3..1da9a9adaf932 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30.py.snap @@ -12,7 +12,7 @@ E30.py:854:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 851 851 | # E306:3:5 852 852 | def a(): 853 853 | x = 1 @@ -21,6 +21,8 @@ E30.py:854:5: E306 [*] Expected 1 blank line before a nested definition, found 0 855 856 | pass 856 857 | # end + Run `ruff check --fix` to apply this fix. + E30.py:862:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 860 | async def a(): @@ -32,7 +34,7 @@ E30.py:862:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 859 859 | #: E306:3:5 860 860 | async def a(): 861 861 | x = 1 @@ -41,6 +43,8 @@ E30.py:862:5: E306 [*] Expected 1 blank line before a nested definition, found 0 863 864 | pass 864 865 | # end + Run `ruff check --fix` to apply this fix. + E30.py:870:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 868 | def a(): @@ -52,7 +56,7 @@ E30.py:870:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 867 867 | #: E306:3:5 E306:5:9 868 868 | def a(): 869 869 | x = 2 @@ -61,6 +65,8 @@ E30.py:870:5: E306 [*] Expected 1 blank line before a nested definition, found 0 871 872 | x = 1 872 873 | def c(): + Run `ruff check --fix` to apply this fix. + E30.py:872:9: E306 [*] Expected 1 blank line before a nested definition, found 0 | 870 | def b(): @@ -72,7 +78,7 @@ E30.py:872:9: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 869 869 | x = 2 870 870 | def b(): 871 871 | x = 1 @@ -81,6 +87,8 @@ E30.py:872:9: E306 [*] Expected 1 blank line before a nested definition, found 0 873 874 | pass 874 875 | # end + Run `ruff check --fix` to apply this fix. + E30.py:880:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 878 | def a(): @@ -92,7 +100,7 @@ E30.py:880:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 877 877 | # E306:3:5 E306:6:5 878 878 | def a(): 879 879 | x = 1 @@ -101,6 +109,8 @@ E30.py:880:5: E306 [*] Expected 1 blank line before a nested definition, found 0 881 882 | pass 882 883 | x = 2 + Run `ruff check --fix` to apply this fix. + E30.py:883:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 881 | pass @@ -112,7 +122,7 @@ E30.py:883:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 880 880 | class C: 881 881 | pass 882 882 | x = 2 @@ -121,6 +131,8 @@ E30.py:883:5: E306 [*] Expected 1 blank line before a nested definition, found 0 884 885 | pass 885 886 | # end + Run `ruff check --fix` to apply this fix. + E30.py:892:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 890 | def bar(): @@ -131,7 +143,7 @@ E30.py:892:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 889 889 | def foo(): 890 890 | def bar(): 891 891 | pass @@ -140,6 +152,8 @@ E30.py:892:5: E306 [*] Expected 1 blank line before a nested definition, found 0 893 894 | # end 894 895 | + Run `ruff check --fix` to apply this fix. + E30.py:899:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 897 | def foo(): @@ -151,7 +165,7 @@ E30.py:899:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 896 896 | # E306:3:5 897 897 | def foo(): 898 898 | def bar(): pass @@ -160,6 +174,8 @@ E30.py:899:5: E306 [*] Expected 1 blank line before a nested definition, found 0 900 901 | pass 901 902 | # end + Run `ruff check --fix` to apply this fix. + E30.py:907:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 905 | def a(): @@ -171,7 +187,7 @@ E30.py:907:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 904 904 | # E306 905 905 | def a(): 906 906 | x = 2 @@ -180,6 +196,8 @@ E30.py:907:5: E306 [*] Expected 1 blank line before a nested definition, found 0 908 909 | def b(): 909 910 | pass + Run `ruff check --fix` to apply this fix. + E30.py:916:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 914 | def a(): @@ -191,7 +209,7 @@ E30.py:916:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 913 913 | # E306 914 914 | def a(): 915 915 | x = 2 @@ -200,6 +218,8 @@ E30.py:916:5: E306 [*] Expected 1 blank line before a nested definition, found 0 917 918 | async def b(): 918 919 | pass + Run `ruff check --fix` to apply this fix. + E30.py:925:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 923 | def a(): @@ -211,7 +231,7 @@ E30.py:925:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 922 922 | # E306 923 923 | def a(): 924 924 | x = 2 @@ -219,3 +239,5 @@ E30.py:925:5: E306 [*] Expected 1 blank line before a nested definition, found 0 925 926 | async def b(): 926 927 | pass 927 928 | # end + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap index 165907675e5bc..d911b80f06080 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap @@ -11,7 +11,7 @@ E40.py:2:1: E401 [*] Multiple imports on one line | = help: Split imports -ℹ Safe fix +Suggested fix: 1 1 | #: E401 2 |-import os, sys 2 |+import os @@ -20,6 +20,8 @@ E40.py:2:1: E401 [*] Multiple imports on one line 4 5 | #: Okay 5 6 | import os + Run `ruff check --fix` to apply this fix. + E40.py:65:1: E401 [*] Multiple imports on one line | 64 | #: E401 @@ -29,7 +31,7 @@ E40.py:65:1: E401 [*] Multiple imports on one line | = help: Split imports -ℹ Safe fix +Suggested fix: 62 62 | import bar 63 63 | 64 64 | #: E401 @@ -40,6 +42,8 @@ E40.py:65:1: E401 [*] Multiple imports on one line 67 68 | 68 69 | x = 1; import re as regex, string + Run `ruff check --fix` to apply this fix. + E40.py:66:1: E401 [*] Multiple imports on one line | 64 | #: E401 @@ -51,7 +55,7 @@ E40.py:66:1: E401 [*] Multiple imports on one line | = help: Split imports -ℹ Safe fix +Suggested fix: 63 63 | 64 64 | #: E401 65 65 | import re as regex, string # also with a comment! @@ -61,6 +65,8 @@ E40.py:66:1: E401 [*] Multiple imports on one line 68 68 | x = 1; import re as regex, string 69 69 | + Run `ruff check --fix` to apply this fix. + E40.py:68:8: E401 [*] Multiple imports on one line | 66 | import re as regex, string; x = 1 @@ -70,7 +76,7 @@ E40.py:68:8: E401 [*] Multiple imports on one line | = help: Split imports -ℹ Safe fix +Suggested fix: 65 65 | import re as regex, string # also with a comment! 66 66 | import re as regex, string; x = 1 67 67 | @@ -80,6 +86,8 @@ E40.py:68:8: E401 [*] Multiple imports on one line 70 70 | 71 71 | def blah(): + Run `ruff check --fix` to apply this fix. + E40.py:72:5: E401 [*] Multiple imports on one line | 71 | def blah(): @@ -90,7 +98,7 @@ E40.py:72:5: E401 [*] Multiple imports on one line | = help: Split imports -ℹ Safe fix +Suggested fix: 69 69 | 70 70 | 71 71 | def blah(): @@ -101,6 +109,8 @@ E40.py:72:5: E401 [*] Multiple imports on one line 74 75 | def nested_and_tested(): 75 76 | import builtins, textwrap as tw + Run `ruff check --fix` to apply this fix. + E40.py:75:9: E401 [*] Multiple imports on one line | 74 | def nested_and_tested(): @@ -111,7 +121,7 @@ E40.py:75:9: E401 [*] Multiple imports on one line | = help: Split imports -ℹ Safe fix +Suggested fix: 72 72 | import datetime as dt, copy 73 73 | 74 74 | def nested_and_tested(): @@ -122,6 +132,8 @@ E40.py:75:9: E401 [*] Multiple imports on one line 77 78 | x = 1; import re as regex, string 78 79 | import re as regex, string; x = 1 + Run `ruff check --fix` to apply this fix. + E40.py:77:16: E401 [*] Multiple imports on one line | 75 | import builtins, textwrap as tw @@ -132,7 +144,7 @@ E40.py:77:16: E401 [*] Multiple imports on one line | = help: Split imports -ℹ Safe fix +Suggested fix: 74 74 | def nested_and_tested(): 75 75 | import builtins, textwrap as tw 76 76 | @@ -142,6 +154,8 @@ E40.py:77:16: E401 [*] Multiple imports on one line 79 79 | 80 80 | if True: import re as regex, string + Run `ruff check --fix` to apply this fix. + E40.py:78:9: E401 [*] Multiple imports on one line | 77 | x = 1; import re as regex, string @@ -152,7 +166,7 @@ E40.py:78:9: E401 [*] Multiple imports on one line | = help: Split imports -ℹ Safe fix +Suggested fix: 75 75 | import builtins, textwrap as tw 76 76 | 77 77 | x = 1; import re as regex, string @@ -161,6 +175,8 @@ E40.py:78:9: E401 [*] Multiple imports on one line 79 79 | 80 80 | if True: import re as regex, string + Run `ruff check --fix` to apply this fix. + E40.py:80:14: E401 [*] Multiple imports on one line | 78 | import re as regex, string; x = 1 @@ -170,11 +186,11 @@ E40.py:80:14: E401 [*] Multiple imports on one line | = help: Split imports -ℹ Safe fix +Suggested fix: 77 77 | x = 1; import re as regex, string 78 78 | import re as regex, string; x = 1 79 79 | 80 |- if True: import re as regex, string 80 |+ if True: import re as regex; import string - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E70.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E70.py.snap index 712fd8e14bddd..269c59cf96355 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E70.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E70.py.snap @@ -12,7 +12,7 @@ E70.py:10:13: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -ℹ Safe fix +Suggested fix: 7 7 | #: E702:1:17 8 8 | import bdist_egg; bdist_egg.write_safety_flag(cmd.egg_info, safe) 9 9 | #: E703:1:13 @@ -22,6 +22,8 @@ E70.py:10:13: E703 [*] Statement ends with an unnecessary semicolon 12 12 | del a[:]; a.append(42); 13 13 | #: E704:1:1 + Run `ruff check --fix` to apply this fix. + E70.py:12:23: E703 [*] Statement ends with an unnecessary semicolon | 10 | import shlex; @@ -33,7 +35,7 @@ E70.py:12:23: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -ℹ Safe fix +Suggested fix: 9 9 | #: E703:1:13 10 10 | import shlex; 11 11 | #: E702:1:9 E703:1:23 @@ -43,6 +45,8 @@ E70.py:12:23: E703 [*] Statement ends with an unnecessary semicolon 14 14 | def f(x): return 2 15 15 | #: E704:1:1 + Run `ruff check --fix` to apply this fix. + E70.py:25:14: E703 [*] Statement ends with an unnecessary semicolon | 23 | def f(x): return 2*x @@ -54,7 +58,7 @@ E70.py:25:14: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -ℹ Safe fix +Suggested fix: 22 22 | while all is round: 23 23 | def f(x): return 2*x 24 24 | #: E704:1:8 E702:1:11 E703:1:14 @@ -64,6 +68,8 @@ E70.py:25:14: E703 [*] Statement ends with an unnecessary semicolon 27 27 | if True: lambda a: b 28 28 | #: E701:1:10 + Run `ruff check --fix` to apply this fix. + E70.py:68:1: E703 [*] Statement ends with an unnecessary semicolon | 66 | #: E703:2:1 @@ -75,7 +81,7 @@ E70.py:68:1: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -ℹ Safe fix +Suggested fix: 64 64 | while 1: 65 65 | 1;... 66 66 | #: E703:2:1 @@ -86,6 +92,8 @@ E70.py:68:1: E703 [*] Statement ends with an unnecessary semicolon 70 69 | a = \ 71 70 | 5; + Run `ruff check --fix` to apply this fix. + E70.py:71:4: E703 [*] Statement ends with an unnecessary semicolon | 69 | #: E701:2:3 @@ -97,7 +105,7 @@ E70.py:71:4: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -ℹ Safe fix +Suggested fix: 68 68 | ; 69 69 | #: E701:2:3 70 70 | a = \ @@ -106,4 +114,4 @@ E70.py:71:4: E703 [*] Statement ends with an unnecessary semicolon 72 72 | #: 73 73 | with x(y) as z: ... - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E703.ipynb.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E703.ipynb.snap index 068f245637b5c..b7ccb55cc192f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E703.ipynb.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E703.ipynb.snap @@ -12,7 +12,7 @@ E703.ipynb:5:2: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -ℹ Safe fix +Suggested fix: 2 2 | # Simple case 3 3 | x; 4 4 | # Only skip the last expression @@ -22,6 +22,8 @@ E703.ipynb:5:2: E703 [*] Statement ends with an unnecessary semicolon 7 7 | # Nested expressions isn't relevant 8 8 | if True: + Run `ruff check --fix` to apply this fix. + E703.ipynb:9:6: E703 [*] Statement ends with an unnecessary semicolon | 7 | # Nested expressions isn't relevant @@ -33,7 +35,7 @@ E703.ipynb:9:6: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -ℹ Safe fix +Suggested fix: 6 6 | x; 7 7 | # Nested expressions isn't relevant 8 8 | if True: @@ -43,4 +45,4 @@ E703.ipynb:9:6: E703 [*] Statement ends with an unnecessary semicolon 11 11 | x; x; 12 12 | # Comments, newlines and whitespace - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap index ebb91bb228c00..46984e9b68f63 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap @@ -11,7 +11,7 @@ E711.py:2:11: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -ℹ Unsafe fix +Suggested fix: 1 1 | #: E711 2 |-if res == None: 2 |+if res is None: @@ -19,6 +19,8 @@ E711.py:2:11: E711 [*] Comparison to `None` should be `cond is None` 4 4 | #: E711 5 5 | if res != None: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E711.py:5:11: E711 [*] Comparison to `None` should be `cond is not None` | 3 | pass @@ -30,7 +32,7 @@ E711.py:5:11: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -ℹ Unsafe fix +Suggested fix: 2 2 | if res == None: 3 3 | pass 4 4 | #: E711 @@ -40,6 +42,8 @@ E711.py:5:11: E711 [*] Comparison to `None` should be `cond is not None` 7 7 | #: E711 8 8 | if None == res: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E711.py:8:4: E711 [*] Comparison to `None` should be `cond is None` | 6 | pass @@ -51,7 +55,7 @@ E711.py:8:4: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -ℹ Unsafe fix +Suggested fix: 5 5 | if res != None: 6 6 | pass 7 7 | #: E711 @@ -61,6 +65,8 @@ E711.py:8:4: E711 [*] Comparison to `None` should be `cond is None` 10 10 | #: E711 11 11 | if None != res: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E711.py:11:4: E711 [*] Comparison to `None` should be `cond is not None` | 9 | pass @@ -72,7 +78,7 @@ E711.py:11:4: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -ℹ Unsafe fix +Suggested fix: 8 8 | if None == res: 9 9 | pass 10 10 | #: E711 @@ -82,6 +88,8 @@ E711.py:11:4: E711 [*] Comparison to `None` should be `cond is not None` 13 13 | #: E711 14 14 | if res[1] == None: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E711.py:14:14: E711 [*] Comparison to `None` should be `cond is None` | 12 | pass @@ -93,7 +101,7 @@ E711.py:14:14: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -ℹ Unsafe fix +Suggested fix: 11 11 | if None != res: 12 12 | pass 13 13 | #: E711 @@ -103,6 +111,8 @@ E711.py:14:14: E711 [*] Comparison to `None` should be `cond is None` 16 16 | #: E711 17 17 | if res[1] != None: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E711.py:17:14: E711 [*] Comparison to `None` should be `cond is not None` | 15 | pass @@ -114,7 +124,7 @@ E711.py:17:14: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -ℹ Unsafe fix +Suggested fix: 14 14 | if res[1] == None: 15 15 | pass 16 16 | #: E711 @@ -124,6 +134,8 @@ E711.py:17:14: E711 [*] Comparison to `None` should be `cond is not None` 19 19 | #: E711 20 20 | if None != res[1]: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E711.py:20:4: E711 [*] Comparison to `None` should be `cond is not None` | 18 | pass @@ -135,7 +147,7 @@ E711.py:20:4: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -ℹ Unsafe fix +Suggested fix: 17 17 | if res[1] != None: 18 18 | pass 19 19 | #: E711 @@ -145,6 +157,8 @@ E711.py:20:4: E711 [*] Comparison to `None` should be `cond is not None` 22 22 | #: E711 23 23 | if None == res[1]: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E711.py:23:4: E711 [*] Comparison to `None` should be `cond is None` | 21 | pass @@ -155,7 +169,7 @@ E711.py:23:4: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -ℹ Unsafe fix +Suggested fix: 20 20 | if None != res[1]: 21 21 | pass 22 22 | #: E711 @@ -165,6 +179,8 @@ E711.py:23:4: E711 [*] Comparison to `None` should be `cond is None` 25 25 | 26 26 | if x == None != None: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E711.py:26:9: E711 [*] Comparison to `None` should be `cond is None` | 24 | pass @@ -175,7 +191,7 @@ E711.py:26:9: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -ℹ Unsafe fix +Suggested fix: 23 23 | if None == res[1]: 24 24 | pass 25 25 | @@ -185,6 +201,8 @@ E711.py:26:9: E711 [*] Comparison to `None` should be `cond is None` 28 28 | 29 29 | #: Okay + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E711.py:26:17: E711 [*] Comparison to `None` should be `cond is not None` | 24 | pass @@ -195,7 +213,7 @@ E711.py:26:17: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -ℹ Unsafe fix +Suggested fix: 23 23 | if None == res[1]: 24 24 | pass 25 25 | @@ -205,4 +223,4 @@ E711.py:26:17: E711 [*] Comparison to `None` should be `cond is not None` 28 28 | 29 29 | #: Okay - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap index 0c98438051b37..0d8d57d925aac 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap @@ -11,7 +11,7 @@ E712.py:2:4: E712 [*] Avoid equality comparisons to `True`; use `if res:` for tr | = help: Replace with `res` -ℹ Unsafe fix +Suggested fix: 1 1 | #: E712 2 |-if res == True: 2 |+if res is True: @@ -19,6 +19,8 @@ E712.py:2:4: E712 [*] Avoid equality comparisons to `True`; use `if res:` for tr 4 4 | #: E712 5 5 | if res != False: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E712.py:5:4: E712 [*] Avoid inequality comparisons to `False`; use `if res:` for truth checks | 3 | pass @@ -30,7 +32,7 @@ E712.py:5:4: E712 [*] Avoid inequality comparisons to `False`; use `if res:` for | = help: Replace with `res` -ℹ Unsafe fix +Suggested fix: 2 2 | if res == True: 3 3 | pass 4 4 | #: E712 @@ -40,6 +42,8 @@ E712.py:5:4: E712 [*] Avoid inequality comparisons to `False`; use `if res:` for 7 7 | #: E712 8 8 | if True != res: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E712.py:8:4: E712 [*] Avoid inequality comparisons to `True`; use `if not res:` for false checks | 6 | pass @@ -51,7 +55,7 @@ E712.py:8:4: E712 [*] Avoid inequality comparisons to `True`; use `if not res:` | = help: Replace with `not res` -ℹ Unsafe fix +Suggested fix: 5 5 | if res != False: 6 6 | pass 7 7 | #: E712 @@ -61,6 +65,8 @@ E712.py:8:4: E712 [*] Avoid inequality comparisons to `True`; use `if not res:` 10 10 | #: E712 11 11 | if False == res: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E712.py:11:4: E712 [*] Avoid equality comparisons to `False`; use `if not res:` for false checks | 9 | pass @@ -72,7 +78,7 @@ E712.py:11:4: E712 [*] Avoid equality comparisons to `False`; use `if not res:` | = help: Replace with `not res` -ℹ Unsafe fix +Suggested fix: 8 8 | if True != res: 9 9 | pass 10 10 | #: E712 @@ -82,6 +88,8 @@ E712.py:11:4: E712 [*] Avoid equality comparisons to `False`; use `if not res:` 13 13 | #: E712 14 14 | if res[1] == True: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E712.py:14:4: E712 [*] Avoid equality comparisons to `True`; use `if res[1]:` for truth checks | 12 | pass @@ -93,7 +101,7 @@ E712.py:14:4: E712 [*] Avoid equality comparisons to `True`; use `if res[1]:` fo | = help: Replace with `res[1]` -ℹ Unsafe fix +Suggested fix: 11 11 | if False == res: 12 12 | pass 13 13 | #: E712 @@ -103,6 +111,8 @@ E712.py:14:4: E712 [*] Avoid equality comparisons to `True`; use `if res[1]:` fo 16 16 | #: E712 17 17 | if res[1] != False: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E712.py:17:4: E712 [*] Avoid inequality comparisons to `False`; use `if res[1]:` for truth checks | 15 | pass @@ -114,7 +124,7 @@ E712.py:17:4: E712 [*] Avoid inequality comparisons to `False`; use `if res[1]:` | = help: Replace with `res[1]` -ℹ Unsafe fix +Suggested fix: 14 14 | if res[1] == True: 15 15 | pass 16 16 | #: E712 @@ -124,6 +134,8 @@ E712.py:17:4: E712 [*] Avoid inequality comparisons to `False`; use `if res[1]:` 19 19 | #: E712 20 20 | var = 1 if cond == True else -1 if cond == False else cond + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E712.py:20:12: E712 [*] Avoid equality comparisons to `True`; use `if cond:` for truth checks | 18 | pass @@ -135,7 +147,7 @@ E712.py:20:12: E712 [*] Avoid equality comparisons to `True`; use `if cond:` for | = help: Replace with `cond` -ℹ Unsafe fix +Suggested fix: 17 17 | if res[1] != False: 18 18 | pass 19 19 | #: E712 @@ -145,6 +157,8 @@ E712.py:20:12: E712 [*] Avoid equality comparisons to `True`; use `if cond:` for 22 22 | if (True) == TrueElement or x == TrueElement: 23 23 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E712.py:20:36: E712 [*] Avoid equality comparisons to `False`; use `if not cond:` for false checks | 18 | pass @@ -156,7 +170,7 @@ E712.py:20:36: E712 [*] Avoid equality comparisons to `False`; use `if not cond: | = help: Replace with `not cond` -ℹ Unsafe fix +Suggested fix: 17 17 | if res[1] != False: 18 18 | pass 19 19 | #: E712 @@ -166,6 +180,8 @@ E712.py:20:36: E712 [*] Avoid equality comparisons to `False`; use `if not cond: 22 22 | if (True) == TrueElement or x == TrueElement: 23 23 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E712.py:22:4: E712 [*] Avoid equality comparisons to `True`; use `if TrueElement:` for truth checks | 20 | var = 1 if cond == True else -1 if cond == False else cond @@ -176,7 +192,7 @@ E712.py:22:4: E712 [*] Avoid equality comparisons to `True`; use `if TrueElement | = help: Replace with `TrueElement` -ℹ Unsafe fix +Suggested fix: 19 19 | #: E712 20 20 | var = 1 if cond == True else -1 if cond == False else cond 21 21 | #: E712 @@ -186,6 +202,8 @@ E712.py:22:4: E712 [*] Avoid equality comparisons to `True`; use `if TrueElement 24 24 | 25 25 | if res == True != False: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E712.py:25:4: E712 [*] Avoid equality comparisons to `True` or `False` | 23 | pass @@ -196,7 +214,7 @@ E712.py:25:4: E712 [*] Avoid equality comparisons to `True` or `False` | = help: Replace comparison -ℹ Unsafe fix +Suggested fix: 22 22 | if (True) == TrueElement or x == TrueElement: 23 23 | pass 24 24 | @@ -206,6 +224,8 @@ E712.py:25:4: E712 [*] Avoid equality comparisons to `True` or `False` 27 27 | 28 28 | if(True) == TrueElement or x == TrueElement: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E712.py:25:4: E712 [*] Avoid equality comparisons to `True` or `False` | 23 | pass @@ -216,7 +236,7 @@ E712.py:25:4: E712 [*] Avoid equality comparisons to `True` or `False` | = help: Replace comparison -ℹ Unsafe fix +Suggested fix: 22 22 | if (True) == TrueElement or x == TrueElement: 23 23 | pass 24 24 | @@ -226,6 +246,8 @@ E712.py:25:4: E712 [*] Avoid equality comparisons to `True` or `False` 27 27 | 28 28 | if(True) == TrueElement or x == TrueElement: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E712.py:28:3: E712 [*] Avoid equality comparisons to `True`; use `if TrueElement:` for truth checks | 26 | pass @@ -236,7 +258,7 @@ E712.py:28:3: E712 [*] Avoid equality comparisons to `True`; use `if TrueElement | = help: Replace with `TrueElement` -ℹ Unsafe fix +Suggested fix: 25 25 | if res == True != False: 26 26 | pass 27 27 | @@ -246,6 +268,8 @@ E712.py:28:3: E712 [*] Avoid equality comparisons to `True`; use `if TrueElement 30 30 | 31 31 | if (yield i) == True: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E712.py:31:4: E712 [*] Avoid equality comparisons to `True`; use `if yield i:` for truth checks | 29 | pass @@ -256,7 +280,7 @@ E712.py:31:4: E712 [*] Avoid equality comparisons to `True`; use `if yield i:` f | = help: Replace with `yield i` -ℹ Unsafe fix +Suggested fix: 28 28 | if(True) == TrueElement or x == TrueElement: 29 29 | pass 30 30 | @@ -265,3 +289,5 @@ E712.py:31:4: E712 [*] Avoid equality comparisons to `True`; use `if yield i:` f 32 32 | print("even") 33 33 | 34 34 | #: Okay + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E713_E713.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E713_E713.py.snap index 44f8669d0f35b..2bd3b258880bb 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E713_E713.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E713_E713.py.snap @@ -11,7 +11,7 @@ E713.py:2:8: E713 [*] Test for membership should be `not in` | = help: Convert to `not in` -ℹ Safe fix +Suggested fix: 1 1 | #: E713 2 |-if not X in Y: 2 |+if X not in Y: @@ -19,6 +19,8 @@ E713.py:2:8: E713 [*] Test for membership should be `not in` 4 4 | #: E713 5 5 | if not X.B in Y: + Run `ruff check --fix` to apply this fix. + E713.py:5:8: E713 [*] Test for membership should be `not in` | 3 | pass @@ -30,7 +32,7 @@ E713.py:5:8: E713 [*] Test for membership should be `not in` | = help: Convert to `not in` -ℹ Safe fix +Suggested fix: 2 2 | if not X in Y: 3 3 | pass 4 4 | #: E713 @@ -40,6 +42,8 @@ E713.py:5:8: E713 [*] Test for membership should be `not in` 7 7 | #: E713 8 8 | if not X in Y and Z == "zero": + Run `ruff check --fix` to apply this fix. + E713.py:8:8: E713 [*] Test for membership should be `not in` | 6 | pass @@ -51,7 +55,7 @@ E713.py:8:8: E713 [*] Test for membership should be `not in` | = help: Convert to `not in` -ℹ Safe fix +Suggested fix: 5 5 | if not X.B in Y: 6 6 | pass 7 7 | #: E713 @@ -61,6 +65,8 @@ E713.py:8:8: E713 [*] Test for membership should be `not in` 10 10 | #: E713 11 11 | if X == "zero" or not Y in Z: + Run `ruff check --fix` to apply this fix. + E713.py:11:23: E713 [*] Test for membership should be `not in` | 9 | pass @@ -72,7 +78,7 @@ E713.py:11:23: E713 [*] Test for membership should be `not in` | = help: Convert to `not in` -ℹ Safe fix +Suggested fix: 8 8 | if not X in Y and Z == "zero": 9 9 | pass 10 10 | #: E713 @@ -82,6 +88,8 @@ E713.py:11:23: E713 [*] Test for membership should be `not in` 13 13 | #: E713 14 14 | if not (X in Y): + Run `ruff check --fix` to apply this fix. + E713.py:14:9: E713 [*] Test for membership should be `not in` | 12 | pass @@ -92,7 +100,7 @@ E713.py:14:9: E713 [*] Test for membership should be `not in` | = help: Convert to `not in` -ℹ Safe fix +Suggested fix: 11 11 | if X == "zero" or not Y in Z: 12 12 | pass 13 13 | #: E713 @@ -102,6 +110,8 @@ E713.py:14:9: E713 [*] Test for membership should be `not in` 16 16 | 17 17 | #: Okay + Run `ruff check --fix` to apply this fix. + E713.py:40:12: E713 [*] Test for membership should be `not in` | 38 | assert [42, not foo] in bar @@ -111,11 +121,11 @@ E713.py:40:12: E713 [*] Test for membership should be `not in` | = help: Convert to `not in` -ℹ Safe fix +Suggested fix: 37 37 | assert {"x": not foo} in bar 38 38 | assert [42, not foo] in bar 39 39 | assert not (re.search(r"^.:\\Users\\[^\\]*\\Downloads\\.*") is None) 40 |-assert not('name' in request)or not request['name'] 40 |+assert 'name' not in request or not request['name'] - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E714_E714.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E714_E714.py.snap index fb009a75859a2..40938154e41c8 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E714_E714.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E714_E714.py.snap @@ -11,7 +11,7 @@ E714.py:2:8: E714 [*] Test for object identity should be `is not` | = help: Convert to `is not` -ℹ Safe fix +Suggested fix: 1 1 | #: E714 2 |-if not X is Y: 2 |+if X is not Y: @@ -19,6 +19,8 @@ E714.py:2:8: E714 [*] Test for object identity should be `is not` 4 4 | #: E714 5 5 | if not X.B is Y: + Run `ruff check --fix` to apply this fix. + E714.py:5:8: E714 [*] Test for object identity should be `is not` | 3 | pass @@ -29,7 +31,7 @@ E714.py:5:8: E714 [*] Test for object identity should be `is not` | = help: Convert to `is not` -ℹ Safe fix +Suggested fix: 2 2 | if not X is Y: 3 3 | pass 4 4 | #: E714 @@ -39,6 +41,8 @@ E714.py:5:8: E714 [*] Test for object identity should be `is not` 7 7 | 8 8 | #: Okay + Run `ruff check --fix` to apply this fix. + E714.py:39:13: E714 [*] Test for object identity should be `is not` | 37 | assert {"x": not foo} in bar @@ -48,11 +52,11 @@ E714.py:39:13: E714 [*] Test for object identity should be `is not` | = help: Convert to `is not` -ℹ Safe fix +Suggested fix: 36 36 | assert (not foo) in bar 37 37 | assert {"x": not foo} in bar 38 38 | assert [42, not foo] in bar 39 |-assert not (re.search(r"^.:\\Users\\[^\\]*\\Downloads\\.*") is None) 39 |+assert re.search(r"^.:\\Users\\[^\\]*\\Downloads\\.*") is not None - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap index 32d034f1e76d7..e0be1920a31f6 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap @@ -10,7 +10,7 @@ E731.py:3:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Unsafe fix +Suggested fix: 1 1 | def scope(): 2 2 | # E731 3 |- f = lambda x: 2 * x @@ -20,6 +20,8 @@ E731.py:3:5: E731 [*] Do not assign a `lambda` expression, use a `def` 5 6 | 6 7 | def scope(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E731.py:8:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 6 | def scope(): @@ -29,7 +31,7 @@ E731.py:8:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Unsafe fix +Suggested fix: 5 5 | 6 6 | def scope(): 7 7 | # E731 @@ -40,6 +42,8 @@ E731.py:8:5: E731 [*] Do not assign a `lambda` expression, use a `def` 10 11 | 11 12 | def scope(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E731.py:14:9: E731 [*] Do not assign a `lambda` expression, use a `def` | 12 | # E731 @@ -49,7 +53,7 @@ E731.py:14:9: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `this` as a `def` -ℹ Unsafe fix +Suggested fix: 11 11 | def scope(): 12 12 | # E731 13 13 | while False: @@ -60,6 +64,8 @@ E731.py:14:9: E731 [*] Do not assign a `lambda` expression, use a `def` 16 17 | 17 18 | def scope(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E731.py:19:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 17 | def scope(): @@ -69,7 +75,7 @@ E731.py:19:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Unsafe fix +Suggested fix: 16 16 | 17 17 | def scope(): 18 18 | # E731 @@ -80,6 +86,8 @@ E731.py:19:5: E731 [*] Do not assign a `lambda` expression, use a `def` 21 22 | 22 23 | def scope(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E731.py:24:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 22 | def scope(): @@ -89,7 +97,7 @@ E731.py:24:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Unsafe fix +Suggested fix: 21 21 | 22 22 | def scope(): 23 23 | # E731 @@ -100,6 +108,8 @@ E731.py:24:5: E731 [*] Do not assign a `lambda` expression, use a `def` 26 27 | 27 28 | def scope(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E731.py:57:5: E731 Do not assign a `lambda` expression, use a `def` | 55 | class Scope: @@ -109,7 +119,7 @@ E731.py:57:5: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Display-only fix +Suggested fix: 54 54 | 55 55 | class Scope: 56 56 | # E731 @@ -120,6 +130,8 @@ E731.py:57:5: E731 Do not assign a `lambda` expression, use a `def` 59 60 | 60 61 | class Scope: + Ruff cannot safely apply this fix. + E731.py:73:9: E731 Do not assign a `lambda` expression, use a `def` | 71 | x: Callable[[int], int] @@ -131,7 +143,7 @@ E731.py:73:9: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `x` as a `def` -ℹ Display-only fix +Suggested fix: 70 70 | 71 71 | x: Callable[[int], int] 72 72 | if True: @@ -142,6 +154,8 @@ E731.py:73:9: E731 Do not assign a `lambda` expression, use a `def` 75 76 | x = lambda: 2 76 77 | return x + Ruff cannot safely apply this fix. + E731.py:75:9: E731 Do not assign a `lambda` expression, use a `def` | 73 | x = lambda: 1 @@ -152,7 +166,7 @@ E731.py:75:9: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `x` as a `def` -ℹ Display-only fix +Suggested fix: 72 72 | if True: 73 73 | x = lambda: 1 74 74 | else: @@ -163,6 +177,8 @@ E731.py:75:9: E731 Do not assign a `lambda` expression, use a `def` 77 78 | 78 79 | + Ruff cannot safely apply this fix. + E731.py:86:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 84 | # ParamSpec cannot be used in this context, so do not preserve the annotation. @@ -172,7 +188,7 @@ E731.py:86:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Unsafe fix +Suggested fix: 83 83 | 84 84 | # ParamSpec cannot be used in this context, so do not preserve the annotation. 85 85 | P = ParamSpec("P") @@ -183,6 +199,8 @@ E731.py:86:5: E731 [*] Do not assign a `lambda` expression, use a `def` 88 89 | 89 90 | def scope(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E731.py:94:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 92 | from typing import Callable @@ -192,7 +210,7 @@ E731.py:94:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Unsafe fix +Suggested fix: 91 91 | 92 92 | from typing import Callable 93 93 | @@ -203,6 +221,8 @@ E731.py:94:5: E731 [*] Do not assign a `lambda` expression, use a `def` 96 97 | 97 98 | def scope(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E731.py:102:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 100 | from typing import Callable @@ -212,7 +232,7 @@ E731.py:102:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Unsafe fix +Suggested fix: 99 99 | 100 100 | from typing import Callable 101 101 | @@ -223,6 +243,8 @@ E731.py:102:5: E731 [*] Do not assign a `lambda` expression, use a `def` 104 105 | 105 106 | def scope(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E731.py:110:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 108 | from typing import Callable @@ -232,7 +254,7 @@ E731.py:110:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Unsafe fix +Suggested fix: 107 107 | 108 108 | from typing import Callable 109 109 | @@ -243,6 +265,8 @@ E731.py:110:5: E731 [*] Do not assign a `lambda` expression, use a `def` 112 113 | 113 114 | # Let's use the `Callable` type from `collections.abc` instead. + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E731.py:119:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 117 | from collections.abc import Callable @@ -252,7 +276,7 @@ E731.py:119:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Unsafe fix +Suggested fix: 116 116 | 117 117 | from collections.abc import Callable 118 118 | @@ -263,6 +287,8 @@ E731.py:119:5: E731 [*] Do not assign a `lambda` expression, use a `def` 121 122 | 122 123 | def scope(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E731.py:127:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 125 | from collections.abc import Callable @@ -272,7 +298,7 @@ E731.py:127:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Unsafe fix +Suggested fix: 124 124 | 125 125 | from collections.abc import Callable 126 126 | @@ -283,6 +309,8 @@ E731.py:127:5: E731 [*] Do not assign a `lambda` expression, use a `def` 129 130 | 130 131 | def scope(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E731.py:135:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 133 | from collections.abc import Callable @@ -292,7 +320,7 @@ E731.py:135:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Unsafe fix +Suggested fix: 132 132 | 133 133 | from collections.abc import Callable 134 134 | @@ -303,6 +331,8 @@ E731.py:135:5: E731 [*] Do not assign a `lambda` expression, use a `def` 137 138 | 138 139 | class TemperatureScales(Enum): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + E731.py:139:5: E731 Do not assign a `lambda` expression, use a `def` | 138 | class TemperatureScales(Enum): @@ -312,7 +342,7 @@ E731.py:139:5: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `CELSIUS` as a `def` -ℹ Display-only fix +Suggested fix: 136 136 | 137 137 | 138 138 | class TemperatureScales(Enum): @@ -323,6 +353,8 @@ E731.py:139:5: E731 Do not assign a `lambda` expression, use a `def` 141 142 | 142 143 | + Ruff cannot safely apply this fix. + E731.py:140:5: E731 Do not assign a `lambda` expression, use a `def` | 138 | class TemperatureScales(Enum): @@ -332,7 +364,7 @@ E731.py:140:5: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `FAHRENHEIT` as a `def` -ℹ Display-only fix +Suggested fix: 137 137 | 138 138 | class TemperatureScales(Enum): 139 139 | CELSIUS = (lambda deg_c: deg_c) @@ -343,6 +375,8 @@ E731.py:140:5: E731 Do not assign a `lambda` expression, use a `def` 142 143 | 143 144 | # Regression test for: https://github.com/astral-sh/ruff/issues/7141 + Ruff cannot safely apply this fix. + E731.py:147:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 145 | # E731 @@ -355,7 +389,7 @@ E731.py:147:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Unsafe fix +Suggested fix: 144 144 | def scope(): 145 145 | # E731 146 146 | @@ -367,3 +401,5 @@ E731.py:147:5: E731 [*] Do not assign a `lambda` expression, use a `def` 150 149 | 151 150 | 152 151 | from dataclasses import dataclass + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W29.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W29.py.snap index f2e3a64a92a9d..e23a9f26632c8 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W29.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W29.py.snap @@ -12,7 +12,7 @@ W29.py:4:6: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -ℹ Safe fix +Suggested fix: 1 1 | #: Okay 2 2 | # 情 3 3 | #: W291:1:6 @@ -22,6 +22,8 @@ W29.py:4:6: W291 [*] Trailing whitespace 6 6 | class Foo(object): 7 7 | + Run `ruff check --fix` to apply this fix. + W29.py:11:35: W291 [*] Trailing whitespace | 9 | #: W291:2:35 @@ -33,7 +35,7 @@ W29.py:11:35: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -ℹ Safe fix +Suggested fix: 8 8 | bang = 12 9 9 | #: W291:2:35 10 10 | '''multiline @@ -43,6 +45,8 @@ W29.py:11:35: W291 [*] Trailing whitespace 13 13 | x = 1 14 14 | #: W191 W292 noeol + Run `ruff check --fix` to apply this fix. + W29.py:13:6: W291 [*] Trailing whitespace | 11 | string with trailing whitespace''' @@ -54,7 +58,7 @@ W29.py:13:6: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -ℹ Safe fix +Suggested fix: 10 10 | '''multiline 11 11 | string with trailing whitespace''' 12 12 | #: W291 W292 noeol @@ -64,4 +68,4 @@ W29.py:13:6: W291 [*] Trailing whitespace 15 15 | if False: 16 16 | pass # indented with tabs - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap index 44f7a2f7aec58..32ccdc6b6cd2f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap @@ -9,13 +9,15 @@ W291.py:1:23: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -ℹ Unsafe fix +Suggested fix: 1 |-'''trailing whitespace 1 |+'''trailing whitespace 2 2 | inside a multiline string''' 3 3 | 4 4 | f'''trailing whitespace + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + W291.py:4:24: W291 [*] Trailing whitespace | 2 | inside a multiline string''' @@ -26,7 +28,7 @@ W291.py:4:24: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -ℹ Unsafe fix +Suggested fix: 1 1 | '''trailing whitespace 2 2 | inside a multiline string''' 3 3 | @@ -36,6 +38,8 @@ W291.py:4:24: W291 [*] Trailing whitespace 6 6 | 7 7 | # Trailing whitespace after `{` + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + W291.py:8:8: W291 [*] Trailing whitespace | 7 | # Trailing whitespace after `{` @@ -46,7 +50,7 @@ W291.py:8:8: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -ℹ Safe fix +Suggested fix: 5 5 | inside a multiline f-string''' 6 6 | 7 7 | # Trailing whitespace after `{` @@ -56,6 +60,8 @@ W291.py:8:8: W291 [*] Trailing whitespace 10 10 | }' 11 11 | + Run `ruff check --fix` to apply this fix. + W291.py:14:10: W291 [*] Trailing whitespace | 12 | # Trailing whitespace after `2` @@ -66,7 +72,7 @@ W291.py:14:10: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -ℹ Safe fix +Suggested fix: 11 11 | 12 12 | # Trailing whitespace after `2` 13 13 | f'abc { @@ -74,4 +80,4 @@ W291.py:14:10: W291 [*] Trailing whitespace 14 |+ 1 + 2 15 15 | }' - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W292_W292_0.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W292_W292_0.py.snap index efd7799b3a5c5..d45a3bf622cd2 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W292_W292_0.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W292_W292_0.py.snap @@ -9,9 +9,9 @@ W292_0.py:2:9: W292 [*] No newline at end of file | = help: Add trailing newline -ℹ Safe fix +Suggested fix: 1 1 | def fn() -> None: 2 |- pass 2 |+ pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W29.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W29.py.snap index 7ff31152150c0..9e9571af3684e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W29.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W29.py.snap @@ -12,7 +12,7 @@ W29.py:7:1: W293 [*] Blank line contains whitespace | = help: Remove whitespace from blank line -ℹ Safe fix +Suggested fix: 4 4 | print 5 5 | #: W293:2:1 6 6 | class Foo(object): @@ -22,4 +22,4 @@ W29.py:7:1: W293 [*] Blank line contains whitespace 9 9 | #: W291:2:35 10 10 | '''multiline - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap index a8f5782d43578..54eea3f8ce757 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap @@ -11,7 +11,7 @@ W293.py:4:1: W293 [*] Blank line contains whitespace | = help: Remove whitespace from blank line -ℹ Unsafe fix +Suggested fix: 1 1 | # See: https://github.com/astral-sh/ruff/issues/9323 2 2 | class Chassis(RobotModuleTemplate): 3 3 | """底盘信息推送控制 @@ -21,6 +21,8 @@ W293.py:4:1: W293 [*] Blank line contains whitespace 6 6 | 7 7 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + W293.py:10:1: W293 [*] Blank line contains whitespace | 8 | """""" \ @@ -30,7 +32,7 @@ W293.py:10:1: W293 [*] Blank line contains whitespace | = help: Remove whitespace from blank line -ℹ Safe fix +Suggested fix: 5 5 | """\ 6 6 | 7 7 | @@ -42,6 +44,8 @@ W293.py:10:1: W293 [*] Blank line contains whitespace 12 10 | 13 11 | "abc\ + Run `ruff check --fix` to apply this fix. + W293.py:16:1: W293 [*] Blank line contains whitespace | 14 | " \ @@ -52,7 +56,7 @@ W293.py:16:1: W293 [*] Blank line contains whitespace | = help: Remove whitespace from blank line -ℹ Safe fix +Suggested fix: 11 11 | 12 12 | 13 13 | "abc\ @@ -64,6 +68,8 @@ W293.py:16:1: W293 [*] Blank line contains whitespace 18 16 | 19 17 | inside a multiline string''' + Run `ruff check --fix` to apply this fix. + W293.py:18:1: W293 [*] Blank line contains whitespace | 17 | '''blank line with whitespace @@ -73,7 +79,7 @@ W293.py:18:1: W293 [*] Blank line contains whitespace | = help: Remove whitespace from blank line -ℹ Unsafe fix +Suggested fix: 15 15 | \ 16 16 | 17 17 | '''blank line with whitespace @@ -81,4 +87,4 @@ W293.py:18:1: W293 [*] Blank line contains whitespace 18 |+ 19 19 | inside a multiline string''' - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_0.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_0.py.snap index 9ce7ff2bca06e..e27211e490d63 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_0.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_0.py.snap @@ -11,7 +11,7 @@ W605_0.py:2:10: W605 [*] Invalid escape sequence: `\.` | = help: Use a raw string literal -ℹ Safe fix +Suggested fix: 1 1 | #: W605:1:10 2 |-regex = '\.png$' 2 |+regex = r'\.png$' @@ -19,6 +19,8 @@ W605_0.py:2:10: W605 [*] Invalid escape sequence: `\.` 4 4 | #: W605:2:1 5 5 | regex = ''' + Run `ruff check --fix` to apply this fix. + W605_0.py:6:1: W605 [*] Invalid escape sequence: `\.` | 4 | #: W605:2:1 @@ -29,7 +31,7 @@ W605_0.py:6:1: W605 [*] Invalid escape sequence: `\.` | = help: Use a raw string literal -ℹ Safe fix +Suggested fix: 2 2 | regex = '\.png$' 3 3 | 4 4 | #: W605:2:1 @@ -39,6 +41,8 @@ W605_0.py:6:1: W605 [*] Invalid escape sequence: `\.` 7 7 | ''' 8 8 | + Run `ruff check --fix` to apply this fix. + W605_0.py:11:6: W605 [*] Invalid escape sequence: `\_` | 9 | #: W605:2:6 @@ -49,7 +53,7 @@ W605_0.py:11:6: W605 [*] Invalid escape sequence: `\_` | = help: Use a raw string literal -ℹ Safe fix +Suggested fix: 8 8 | 9 9 | #: W605:2:6 10 10 | f( @@ -59,6 +63,8 @@ W605_0.py:11:6: W605 [*] Invalid escape sequence: `\_` 13 13 | 14 14 | #: W605:4:6 + Run `ruff check --fix` to apply this fix. + W605_0.py:18:6: W605 [*] Invalid escape sequence: `\_` | 16 | multi-line @@ -70,7 +76,7 @@ W605_0.py:18:6: W605 [*] Invalid escape sequence: `\_` | = help: Use a raw string literal -ℹ Safe fix +Suggested fix: 12 12 | ) 13 13 | 14 14 | #: W605:4:6 @@ -80,6 +86,8 @@ W605_0.py:18:6: W605 [*] Invalid escape sequence: `\_` 17 17 | literal 18 18 | with \_ somewhere + Run `ruff check --fix` to apply this fix. + W605_0.py:23:39: W605 [*] Invalid escape sequence: `\_` | 22 | #: W605:1:38 @@ -88,7 +96,7 @@ W605_0.py:23:39: W605 [*] Invalid escape sequence: `\_` | = help: Add backslash to escape sequence -ℹ Safe fix +Suggested fix: 20 20 | """ 21 21 | 22 22 | #: W605:1:38 @@ -98,6 +106,8 @@ W605_0.py:23:39: W605 [*] Invalid escape sequence: `\_` 25 25 | 26 26 | def f(): + Run `ruff check --fix` to apply this fix. + W605_0.py:28:12: W605 [*] Invalid escape sequence: `\.` | 26 | def f(): @@ -109,7 +119,7 @@ W605_0.py:28:12: W605 [*] Invalid escape sequence: `\.` | = help: Use a raw string literal -ℹ Safe fix +Suggested fix: 25 25 | 26 26 | def f(): 27 27 | #: W605:1:11 @@ -119,6 +129,8 @@ W605_0.py:28:12: W605 [*] Invalid escape sequence: `\.` 30 30 | #: Okay 31 31 | regex = r'\.png$' + Run `ruff check --fix` to apply this fix. + W605_0.py:45:12: W605 [*] Invalid escape sequence: `\_` | 43 | ''' # noqa @@ -130,7 +142,7 @@ W605_0.py:45:12: W605 [*] Invalid escape sequence: `\_` | = help: Add backslash to escape sequence -ℹ Safe fix +Suggested fix: 42 42 | \w 43 43 | ''' # noqa 44 44 | @@ -140,6 +152,8 @@ W605_0.py:45:12: W605 [*] Invalid escape sequence: `\_` 47 47 | #: W605:1:7 48 48 | u'foo\ bar' + Run `ruff check --fix` to apply this fix. + W605_0.py:48:6: W605 [*] Invalid escape sequence: `\ ` | 47 | #: W605:1:7 @@ -150,7 +164,7 @@ W605_0.py:48:6: W605 [*] Invalid escape sequence: `\ ` | = help: Use a raw string literal -ℹ Safe fix +Suggested fix: 45 45 | regex = '\\\_' 46 46 | 47 47 | #: W605:1:7 @@ -160,6 +174,8 @@ W605_0.py:48:6: W605 [*] Invalid escape sequence: `\ ` 50 50 | #: W605:1:13 51 51 | ( + Run `ruff check --fix` to apply this fix. + W605_0.py:53:9: W605 [*] Invalid escape sequence: `\.` | 51 | ( @@ -170,7 +186,7 @@ W605_0.py:53:9: W605 [*] Invalid escape sequence: `\.` | = help: Add backslash to escape sequence -ℹ Safe fix +Suggested fix: 50 50 | #: W605:1:13 51 51 | ( 52 52 | "foo \ @@ -180,6 +196,8 @@ W605_0.py:53:9: W605 [*] Invalid escape sequence: `\.` 55 55 | 56 56 | #: W605:1:6 + Run `ruff check --fix` to apply this fix. + W605_0.py:57:6: W605 [*] Invalid escape sequence: `\.` | 56 | #: W605:1:6 @@ -190,7 +208,7 @@ W605_0.py:57:6: W605 [*] Invalid escape sequence: `\.` | = help: Add backslash to escape sequence -ℹ Safe fix +Suggested fix: 54 54 | ) 55 55 | 56 56 | #: W605:1:6 @@ -200,6 +218,8 @@ W605_0.py:57:6: W605 [*] Invalid escape sequence: `\.` 59 59 | #: W605:1:13 60 60 | "foo \t bar \." + Run `ruff check --fix` to apply this fix. + W605_0.py:60:13: W605 [*] Invalid escape sequence: `\.` | 59 | #: W605:1:13 @@ -208,9 +228,11 @@ W605_0.py:60:13: W605 [*] Invalid escape sequence: `\.` | = help: Add backslash to escape sequence -ℹ Safe fix +Suggested fix: 57 57 | "foo \. bar \t" 58 58 | 59 59 | #: W605:1:13 60 |-"foo \t bar \." 60 |+"foo \t bar \\." + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_1.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_1.py.snap index ea0ced5b4fbb0..edfa987216b11 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_1.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_1.py.snap @@ -11,7 +11,7 @@ W605_1.py:4:11: W605 [*] Invalid escape sequence: `\.` | = help: Use a raw string literal -ℹ Safe fix +Suggested fix: 1 1 | # Same as `W605_0.py` but using f-strings instead. 2 2 | 3 3 | #: W605:1:10 @@ -21,6 +21,8 @@ W605_1.py:4:11: W605 [*] Invalid escape sequence: `\.` 6 6 | #: W605:2:1 7 7 | regex = f''' + Run `ruff check --fix` to apply this fix. + W605_1.py:8:1: W605 [*] Invalid escape sequence: `\.` | 6 | #: W605:2:1 @@ -31,7 +33,7 @@ W605_1.py:8:1: W605 [*] Invalid escape sequence: `\.` | = help: Use a raw string literal -ℹ Safe fix +Suggested fix: 4 4 | regex = f'\.png$' 5 5 | 6 6 | #: W605:2:1 @@ -41,6 +43,8 @@ W605_1.py:8:1: W605 [*] Invalid escape sequence: `\.` 9 9 | ''' 10 10 | + Run `ruff check --fix` to apply this fix. + W605_1.py:13:7: W605 [*] Invalid escape sequence: `\_` | 11 | #: W605:2:6 @@ -51,7 +55,7 @@ W605_1.py:13:7: W605 [*] Invalid escape sequence: `\_` | = help: Use a raw string literal -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | #: W605:2:6 12 12 | f( @@ -61,6 +65,8 @@ W605_1.py:13:7: W605 [*] Invalid escape sequence: `\_` 15 15 | 16 16 | #: W605:4:6 + Run `ruff check --fix` to apply this fix. + W605_1.py:20:6: W605 [*] Invalid escape sequence: `\_` | 18 | multi-line @@ -72,7 +78,7 @@ W605_1.py:20:6: W605 [*] Invalid escape sequence: `\_` | = help: Use a raw string literal -ℹ Safe fix +Suggested fix: 14 14 | ) 15 15 | 16 16 | #: W605:4:6 @@ -82,6 +88,8 @@ W605_1.py:20:6: W605 [*] Invalid escape sequence: `\_` 19 19 | literal 20 20 | with \_ somewhere + Run `ruff check --fix` to apply this fix. + W605_1.py:25:40: W605 [*] Invalid escape sequence: `\_` | 24 | #: W605:1:38 @@ -90,7 +98,7 @@ W605_1.py:25:40: W605 [*] Invalid escape sequence: `\_` | = help: Add backslash to escape sequence -ℹ Safe fix +Suggested fix: 22 22 | """ 23 23 | 24 24 | #: W605:1:38 @@ -100,6 +108,8 @@ W605_1.py:25:40: W605 [*] Invalid escape sequence: `\_` 27 27 | 28 28 | #: Okay + Run `ruff check --fix` to apply this fix. + W605_1.py:43:13: W605 [*] Invalid escape sequence: `\_` | 41 | ''' # noqa @@ -111,7 +121,7 @@ W605_1.py:43:13: W605 [*] Invalid escape sequence: `\_` | = help: Add backslash to escape sequence -ℹ Safe fix +Suggested fix: 40 40 | \w 41 41 | ''' # noqa 42 42 | @@ -121,6 +131,8 @@ W605_1.py:43:13: W605 [*] Invalid escape sequence: `\_` 45 45 | value = f'\{1}' 46 46 | value = f'{1:\}' + Run `ruff check --fix` to apply this fix. + W605_1.py:44:11: W605 [*] Invalid escape sequence: `\{` | 43 | regex = f'\\\_' @@ -131,7 +143,7 @@ W605_1.py:44:11: W605 [*] Invalid escape sequence: `\{` | = help: Use a raw string literal -ℹ Safe fix +Suggested fix: 41 41 | ''' # noqa 42 42 | 43 43 | regex = f'\\\_' @@ -141,6 +153,8 @@ W605_1.py:44:11: W605 [*] Invalid escape sequence: `\{` 46 46 | value = f'{1:\}' 47 47 | value = f"{f"\{1}"}" + Run `ruff check --fix` to apply this fix. + W605_1.py:45:11: W605 [*] Invalid escape sequence: `\{` | 43 | regex = f'\\\_' @@ -152,7 +166,7 @@ W605_1.py:45:11: W605 [*] Invalid escape sequence: `\{` | = help: Use a raw string literal -ℹ Safe fix +Suggested fix: 42 42 | 43 43 | regex = f'\\\_' 44 44 | value = f'\{{1}}' @@ -162,6 +176,8 @@ W605_1.py:45:11: W605 [*] Invalid escape sequence: `\{` 47 47 | value = f"{f"\{1}"}" 48 48 | value = rf"{f"\{1}"}" + Run `ruff check --fix` to apply this fix. + W605_1.py:46:14: W605 [*] Invalid escape sequence: `\}` | 44 | value = f'\{{1}}' @@ -173,7 +189,7 @@ W605_1.py:46:14: W605 [*] Invalid escape sequence: `\}` | = help: Use a raw string literal -ℹ Safe fix +Suggested fix: 43 43 | regex = f'\\\_' 44 44 | value = f'\{{1}}' 45 45 | value = f'\{1}' @@ -183,6 +199,8 @@ W605_1.py:46:14: W605 [*] Invalid escape sequence: `\}` 48 48 | value = rf"{f"\{1}"}" 49 49 | + Run `ruff check --fix` to apply this fix. + W605_1.py:47:14: W605 [*] Invalid escape sequence: `\{` | 45 | value = f'\{1}' @@ -193,7 +211,7 @@ W605_1.py:47:14: W605 [*] Invalid escape sequence: `\{` | = help: Use a raw string literal -ℹ Safe fix +Suggested fix: 44 44 | value = f'\{{1}}' 45 45 | value = f'\{1}' 46 46 | value = f'{1:\}' @@ -203,6 +221,8 @@ W605_1.py:47:14: W605 [*] Invalid escape sequence: `\{` 49 49 | 50 50 | # Okay + Run `ruff check --fix` to apply this fix. + W605_1.py:48:15: W605 [*] Invalid escape sequence: `\{` | 46 | value = f'{1:\}' @@ -214,7 +234,7 @@ W605_1.py:48:15: W605 [*] Invalid escape sequence: `\{` | = help: Use a raw string literal -ℹ Safe fix +Suggested fix: 45 45 | value = f'\{1}' 46 46 | value = f'{1:\}' 47 47 | value = f"{f"\{1}"}" @@ -224,6 +244,8 @@ W605_1.py:48:15: W605 [*] Invalid escape sequence: `\{` 50 50 | # Okay 51 51 | value = rf'\{{1}}' + Run `ruff check --fix` to apply this fix. + W605_1.py:57:9: W605 [*] Invalid escape sequence: `\d` | 56 | # Regression tests for https://github.com/astral-sh/ruff/issues/10434 @@ -234,7 +256,7 @@ W605_1.py:57:9: W605 [*] Invalid escape sequence: `\d` | = help: Use a raw string literal -ℹ Safe fix +Suggested fix: 54 54 | value = f"{rf"\{1}"}" 55 55 | 56 56 | # Regression tests for https://github.com/astral-sh/ruff/issues/10434 @@ -243,6 +265,8 @@ W605_1.py:57:9: W605 [*] Invalid escape sequence: `\d` 58 58 | f"\n{{}}+-\d+" 59 59 | f"\n{{}}�+-\d+" + Run `ruff check --fix` to apply this fix. + W605_1.py:58:11: W605 [*] Invalid escape sequence: `\d` | 56 | # Regression tests for https://github.com/astral-sh/ruff/issues/10434 @@ -253,7 +277,7 @@ W605_1.py:58:11: W605 [*] Invalid escape sequence: `\d` | = help: Add backslash to escape sequence -ℹ Safe fix +Suggested fix: 55 55 | 56 56 | # Regression tests for https://github.com/astral-sh/ruff/issues/10434 57 57 | f"{{}}+-\d" @@ -261,6 +285,8 @@ W605_1.py:58:11: W605 [*] Invalid escape sequence: `\d` 58 |+f"\n{{}}+-\\d+" 59 59 | f"\n{{}}�+-\d+" + Run `ruff check --fix` to apply this fix. + W605_1.py:59:12: W605 [*] Invalid escape sequence: `\d` | 57 | f"{{}}+-\d" @@ -270,9 +296,11 @@ W605_1.py:59:12: W605 [*] Invalid escape sequence: `\d` | = help: Add backslash to escape sequence -ℹ Safe fix +Suggested fix: 56 56 | # Regression tests for https://github.com/astral-sh/ruff/issues/10434 57 57 | f"{{}}+-\d" 58 58 | f"\n{{}}+-\d+" 59 |-f"\n{{}}�+-\d+" 59 |+f"\n{{}}�+-\\d+" + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E301_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E301_notebook.snap index b128dda953eff..9bb2bd91a1854 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E301_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E301_notebook.snap @@ -12,7 +12,7 @@ E30.ipynb:13:5: E301 [*] Expected 1 blank line, found 0 | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | def method(cls) -> None: 12 12 | pass @@ -20,3 +20,5 @@ E30.ipynb:13:5: E301 [*] Expected 1 blank line, found 0 13 14 | @classmethod 14 15 | def cls_method(cls) -> None: 15 16 | pass + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap index eada536b020d9..72d32965f8fa8 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap @@ -12,7 +12,7 @@ E30.ipynb:21:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 18 18 | def a(): 19 19 | pass 20 20 | @@ -20,3 +20,5 @@ E30.ipynb:21:1: E302 [*] Expected 2 blank lines, found 1 21 22 | def b(): 22 23 | pass 23 24 | # end + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap index ce20914578b92..c56bcbd2e0e37 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap @@ -10,7 +10,7 @@ E30.ipynb:29:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 25 25 | def fn(): 26 26 | _ = None 27 27 | @@ -19,6 +19,8 @@ E30.ipynb:29:5: E303 [*] Too many blank lines (2) 30 29 | 31 30 | def inner(): # E306 not expected (pycodestyle detects E306) + Run `ruff check --fix` to apply this fix. + E30.ipynb:39:1: E303 [*] Too many blank lines (4) | 39 | def fn(): @@ -28,7 +30,7 @@ E30.ipynb:39:1: E303 [*] Too many blank lines (4) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 34 34 | # E303 35 35 | 36 36 | @@ -37,3 +39,5 @@ E30.ipynb:39:1: E303 [*] Too many blank lines (4) 39 37 | def fn(): 40 38 | pass 41 39 | # end + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_typing_stub.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_typing_stub.snap index 520a83ea86ff2..f1b784f863b9b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_typing_stub.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_typing_stub.snap @@ -10,7 +10,7 @@ E30.pyi:17:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 13 13 | @overload 14 14 | def a(arg: int, name: str): ... 15 15 | @@ -19,6 +19,8 @@ E30.pyi:17:1: E303 [*] Too many blank lines (2) 18 17 | def grouped2(): ... 19 18 | def grouped3( ): ... + Run `ruff check --fix` to apply this fix. + E30.pyi:22:1: E303 [*] Too many blank lines (2) | 22 | class BackendProxy: @@ -28,7 +30,7 @@ E30.pyi:22:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 18 18 | def grouped2(): ... 19 19 | def grouped3( ): ... 20 20 | @@ -37,6 +39,8 @@ E30.pyi:22:1: E303 [*] Too many blank lines (2) 23 22 | backend_module: str 24 23 | backend_object: str | None + Run `ruff check --fix` to apply this fix. + E30.pyi:35:5: E303 [*] Too many blank lines (2) | 35 | def ungrouped(): ... @@ -45,7 +49,7 @@ E30.pyi:35:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 31 31 | 32 32 | def with_blank_line(): ... 33 33 | @@ -54,6 +58,8 @@ E30.pyi:35:5: E303 [*] Too many blank lines (2) 36 35 | a = "test" 37 36 | + Run `ruff check --fix` to apply this fix. + E30.pyi:43:1: E303 [*] Too many blank lines (2) | 43 | def outer(): @@ -63,7 +69,7 @@ E30.pyi:43:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 39 39 | pass 40 40 | b = "test" 41 41 | @@ -71,3 +77,5 @@ E30.pyi:43:1: E303 [*] Too many blank lines (2) 43 42 | def outer(): 44 43 | def inner(): 45 44 | pass + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap index 7e09f8d244ca7..8d8c2e29b290b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap @@ -12,7 +12,7 @@ E30.ipynb:45:1: E304 [*] Blank lines found after function decorator (1) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 41 41 | # end 42 42 | # E304 43 43 | @decorator @@ -20,3 +20,5 @@ E30.ipynb:45:1: E304 [*] Blank lines found after function decorator (1) 45 44 | def function(): 46 45 | pass 47 46 | # end + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_typing_stub.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_typing_stub.snap index 565eeed36e6a6..b2cdc81225968 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_typing_stub.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_typing_stub.snap @@ -10,11 +10,13 @@ E30.pyi:32:5: E304 [*] Blank lines found after function decorator (1) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 28 28 | def grouped2(): ... 29 29 | def grouped3( ): ... 30 30 | @decorated 31 |- 32 31 | def with_blank_line(): ... 33 32 | -34 33 | +34 33 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E305_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E305_notebook.snap index 9672329251a92..9ccffc3176133 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E305_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E305_notebook.snap @@ -11,7 +11,7 @@ E30.ipynb:55:1: E305 [*] Expected 2 blank lines after class or function definiti | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 52 52 | # comment 53 53 | 54 54 | # another comment @@ -20,3 +20,5 @@ E30.ipynb:55:1: E305 [*] Expected 2 blank lines after class or function definiti 55 57 | fn() 56 58 | # end 57 59 | # E306:3:5 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E306_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E306_notebook.snap index 7f1131c23f394..94f0ef101befc 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E306_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E306_notebook.snap @@ -12,7 +12,7 @@ E30.ipynb:60:5: E306 [*] Expected 1 blank line before a nested definition, found | = help: Add missing blank line -ℹ Safe fix +Suggested fix: 57 57 | # E306:3:5 58 58 | def a(): 59 59 | x = 1 @@ -20,3 +20,5 @@ E30.ipynb:60:5: E306 [*] Expected 1 blank line before a nested definition, found 60 61 | def b(): 61 62 | pass 62 63 | # end + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(-1)-between(0).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(-1)-between(0).snap index 7b01f96447d7e..0c6cec371514c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(-1)-between(0).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(-1)-between(0).snap @@ -15,7 +15,7 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import json 2 |- 3 |- @@ -24,6 +24,8 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted 6 3 | 7 4 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 | 21 | abcd.foo() @@ -35,7 +37,7 @@ E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 20 20 | 21 21 | abcd.foo() 22 22 | @@ -44,6 +46,8 @@ E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 24 25 | 25 26 | if TYPE_CHECKING: + Run `ruff check --fix` to apply this fix. + E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -59,7 +63,7 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -69,6 +73,8 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 | 33 | abcd.foo() @@ -79,7 +85,7 @@ E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 32 32 | 33 33 | abcd.foo() 34 34 | @@ -88,6 +94,8 @@ E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 36 37 | ... 37 38 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 | 39 | from typing_extensions import TypeAlias @@ -98,7 +106,7 @@ E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 38 38 | if TYPE_CHECKING: 39 39 | from typing_extensions import TypeAlias 40 40 | @@ -107,6 +115,8 @@ E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 42 43 | ... 43 44 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | 60 | / from typing import Any, Sequence @@ -116,13 +126,15 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 59 59 | 60 60 | from typing import Any, Sequence 61 61 | 62 |+ 62 63 | class MissingCommand(TypeError): ... # noqa: N818 + Run `ruff check --fix` to apply this fix. + E30_isort.py:62:1: E302 [*] Expected 2 blank lines, found 1 | 60 | from typing import Any, Sequence @@ -132,9 +144,11 @@ E30_isort.py:62:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 59 59 | 60 60 | from typing import Any, Sequence 61 61 | 62 |+ 62 63 | class MissingCommand(TypeError): ... # noqa: N818 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(0)-between(0).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(0)-between(0).snap index 92e7ce4e2e43f..4788064b64e77 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(0)-between(0).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(0)-between(0).snap @@ -15,7 +15,7 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import json 2 |- 3 |- @@ -27,6 +27,8 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted 9 4 | 10 5 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 | 21 | abcd.foo() @@ -38,7 +40,7 @@ E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 20 20 | 21 21 | abcd.foo() 22 22 | @@ -47,6 +49,8 @@ E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 24 25 | 25 26 | if TYPE_CHECKING: + Run `ruff check --fix` to apply this fix. + E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -62,7 +66,7 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -72,6 +76,8 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 | 33 | abcd.foo() @@ -82,7 +88,7 @@ E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 32 32 | 33 33 | abcd.foo() 34 34 | @@ -91,6 +97,8 @@ E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 36 37 | ... 37 38 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 | 39 | from typing_extensions import TypeAlias @@ -101,7 +109,7 @@ E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 38 38 | if TYPE_CHECKING: 39 39 | from typing_extensions import TypeAlias 40 40 | @@ -110,6 +118,8 @@ E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 42 43 | ... 43 44 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | 60 | / from typing import Any, Sequence @@ -119,9 +129,11 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 58 58 | 59 59 | 60 60 | from typing import Any, Sequence 61 |- 62 61 | class MissingCommand(TypeError): ... # noqa: N818 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(1)-between(1).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(1)-between(1).snap index 2e8fed4bd6c27..084a92f2d74a4 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(1)-between(1).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(1)-between(1).snap @@ -15,7 +15,7 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import json 2 2 | 3 |- @@ -26,6 +26,8 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted 8 5 | class MissingCommand(TypeError): ... # noqa: N818 9 6 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 | 21 | abcd.foo() @@ -37,7 +39,7 @@ E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 20 20 | 21 21 | abcd.foo() 22 22 | @@ -46,6 +48,8 @@ E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 24 25 | 25 26 | if TYPE_CHECKING: + Run `ruff check --fix` to apply this fix. + E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -61,7 +65,7 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -71,6 +75,8 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 | 33 | abcd.foo() @@ -81,7 +87,7 @@ E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 32 32 | 33 33 | abcd.foo() 34 34 | @@ -90,6 +96,8 @@ E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 36 37 | ... 37 38 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 | 39 | from typing_extensions import TypeAlias @@ -100,11 +108,13 @@ E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 38 38 | if TYPE_CHECKING: 39 39 | from typing_extensions import TypeAlias 40 40 | 41 |+ 41 42 | def __call__2(self, name: str, *args: Any, **kwargs: Any) -> Any: 42 43 | ... -43 44 | +43 44 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(4)-between(4).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(4)-between(4).snap index c24ef9e346b1d..e93791d6944de 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(4)-between(4).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(4)-between(4).snap @@ -15,7 +15,7 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | 4 4 | @@ -29,6 +29,8 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted 9 12 | 10 13 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:8:1: E302 [*] Expected 4 blank lines, found 2 | 8 | class MissingCommand(TypeError): ... # noqa: N818 @@ -36,7 +38,7 @@ E30_isort.py:8:1: E302 [*] Expected 4 blank lines, found 2 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 5 5 | from typing import Any, Sequence 6 6 | 7 7 | @@ -46,6 +48,8 @@ E30_isort.py:8:1: E302 [*] Expected 4 blank lines, found 2 9 11 | 10 12 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 | 21 | abcd.foo() @@ -57,7 +61,7 @@ E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 20 20 | 21 21 | abcd.foo() 22 22 | @@ -66,6 +70,8 @@ E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 24 25 | 25 26 | if TYPE_CHECKING: + Run `ruff check --fix` to apply this fix. + E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -81,7 +87,7 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -91,6 +97,8 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 | 33 | abcd.foo() @@ -101,7 +109,7 @@ E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 32 32 | 33 33 | abcd.foo() 34 34 | @@ -110,6 +118,8 @@ E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 36 37 | ... 37 38 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 | 39 | from typing_extensions import TypeAlias @@ -120,7 +130,7 @@ E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 38 38 | if TYPE_CHECKING: 39 39 | from typing_extensions import TypeAlias 40 40 | @@ -129,6 +139,8 @@ E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 42 43 | ... 43 44 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | 60 | / from typing import Any, Sequence @@ -138,7 +150,7 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 59 59 | 60 60 | from typing import Any, Sequence 61 61 | @@ -147,6 +159,8 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted 64 |+ 62 65 | class MissingCommand(TypeError): ... # noqa: N818 + Run `ruff check --fix` to apply this fix. + E30_isort.py:62:1: E302 [*] Expected 4 blank lines, found 1 | 60 | from typing import Any, Sequence @@ -156,7 +170,7 @@ E30_isort.py:62:1: E302 [*] Expected 4 blank lines, found 1 | = help: Add missing blank line(s) -ℹ Safe fix +Suggested fix: 59 59 | 60 60 | from typing import Any, Sequence 61 61 | @@ -164,3 +178,5 @@ E30_isort.py:62:1: E302 [*] Expected 4 blank lines, found 1 63 |+ 64 |+ 62 65 | class MissingCommand(TypeError): ... # noqa: N818 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_typing_stub_isort.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_typing_stub_isort.snap index ea026fcf0733a..d252a2d6bbdd7 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_typing_stub_isort.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_typing_stub_isort.snap @@ -15,7 +15,7 @@ E30_isort.pyi:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import json 2 |- 3 |- @@ -26,6 +26,8 @@ E30_isort.pyi:1:1: I001 [*] Import block is un-sorted or un-formatted 8 4 | class MissingCommand(TypeError): ... # noqa: N818 9 5 | + Run `ruff check --fix` to apply this fix. + E30_isort.pyi:5:1: E303 [*] Too many blank lines (3) | 5 | from typing import Any, Sequence @@ -33,7 +35,7 @@ E30_isort.pyi:5:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 1 1 | import json 2 2 | 3 |- @@ -42,6 +44,8 @@ E30_isort.pyi:5:1: E303 [*] Too many blank lines (3) 6 4 | 7 5 | + Run `ruff check --fix` to apply this fix. + E30_isort.pyi:8:1: E303 [*] Too many blank lines (2) | 8 | class MissingCommand(TypeError): ... # noqa: N818 @@ -49,7 +53,7 @@ E30_isort.pyi:8:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | from typing import Any, Sequence 6 6 | @@ -58,6 +62,8 @@ E30_isort.pyi:8:1: E303 [*] Too many blank lines (2) 9 8 | 10 9 | + Run `ruff check --fix` to apply this fix. + E30_isort.pyi:11:1: E303 [*] Too many blank lines (2) | 11 | class BackendProxy: @@ -67,7 +73,7 @@ E30_isort.pyi:11:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 7 7 | 8 8 | class MissingCommand(TypeError): ... # noqa: N818 9 9 | @@ -76,6 +82,8 @@ E30_isort.pyi:11:1: E303 [*] Too many blank lines (2) 12 11 | backend_module: str 13 12 | backend_object: str | None + Run `ruff check --fix` to apply this fix. + E30_isort.pyi:17:1: E303 [*] Too many blank lines (2) | 17 | if __name__ == "__main__": @@ -84,7 +92,7 @@ E30_isort.pyi:17:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 13 13 | backend_object: str | None 14 14 | backend: Any 15 15 | @@ -93,6 +101,8 @@ E30_isort.pyi:17:1: E303 [*] Too many blank lines (2) 18 17 | import abcd 19 18 | + Run `ruff check --fix` to apply this fix. + E30_isort.pyi:21:5: E303 [*] Too many blank lines (2) | 21 | abcd.foo() @@ -102,7 +112,7 @@ E30_isort.pyi:21:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 17 17 | if __name__ == "__main__": 18 18 | import abcd 19 19 | @@ -111,6 +121,8 @@ E30_isort.pyi:21:5: E303 [*] Too many blank lines (2) 22 21 | 23 22 | def __init__(self, backend_module: str, backend_obj: str | None) -> None: ... + Run `ruff check --fix` to apply this fix. + E30_isort.pyi:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -126,7 +138,7 @@ E30_isort.pyi:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -136,6 +148,8 @@ E30_isort.pyi:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | + Run `ruff check --fix` to apply this fix. + E30_isort.pyi:30:5: E303 [*] Too many blank lines (3) | 30 | from typing_extensions import TypeAlias @@ -143,7 +157,7 @@ E30_isort.pyi:30:5: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -153,6 +167,8 @@ E30_isort.pyi:30:5: E303 [*] Too many blank lines (3) 31 29 | 32 30 | + Run `ruff check --fix` to apply this fix. + E30_isort.pyi:33:5: E303 [*] Too many blank lines (2) | 33 | abcd.foo() @@ -162,7 +178,7 @@ E30_isort.pyi:33:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 29 29 | 30 30 | from typing_extensions import TypeAlias 31 31 | @@ -171,6 +187,8 @@ E30_isort.pyi:33:5: E303 [*] Too many blank lines (2) 34 33 | 35 34 | def __call__(self, name: str, *args: Any, **kwargs: Any) -> Any: + Run `ruff check --fix` to apply this fix. + E30_isort.pyi:45:1: E303 [*] Too many blank lines (2) | 45 | def _exit(self) -> None: ... @@ -178,7 +196,7 @@ E30_isort.pyi:45:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 41 41 | def __call__2(self, name: str, *args: Any, **kwargs: Any) -> Any: 42 42 | ... 43 43 | @@ -187,6 +205,8 @@ E30_isort.pyi:45:1: E303 [*] Too many blank lines (2) 46 45 | 47 46 | + Run `ruff check --fix` to apply this fix. + E30_isort.pyi:48:1: E303 [*] Too many blank lines (2) | 48 | def _optional_commands(self) -> dict[str, bool]: ... @@ -194,7 +214,7 @@ E30_isort.pyi:48:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 44 44 | 45 45 | def _exit(self) -> None: ... 46 46 | @@ -203,6 +223,8 @@ E30_isort.pyi:48:1: E303 [*] Too many blank lines (2) 49 48 | 50 49 | + Run `ruff check --fix` to apply this fix. + E30_isort.pyi:51:1: E303 [*] Too many blank lines (2) | 51 | def run(argv: Sequence[str]) -> int: ... @@ -210,7 +232,7 @@ E30_isort.pyi:51:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 47 47 | 48 48 | def _optional_commands(self) -> dict[str, bool]: ... 49 49 | @@ -219,6 +241,8 @@ E30_isort.pyi:51:1: E303 [*] Too many blank lines (2) 52 51 | 53 52 | + Run `ruff check --fix` to apply this fix. + E30_isort.pyi:54:1: E303 [*] Too many blank lines (2) | 54 | def read_line(fd: int = 0) -> bytearray: ... @@ -226,7 +250,7 @@ E30_isort.pyi:54:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 50 50 | 51 51 | def run(argv: Sequence[str]) -> int: ... 52 52 | @@ -235,6 +259,8 @@ E30_isort.pyi:54:1: E303 [*] Too many blank lines (2) 55 54 | 56 55 | + Run `ruff check --fix` to apply this fix. + E30_isort.pyi:57:1: E303 [*] Too many blank lines (2) | 57 | def flush() -> None: ... @@ -242,7 +268,7 @@ E30_isort.pyi:57:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 53 53 | 54 54 | def read_line(fd: int = 0) -> bytearray: ... 55 55 | @@ -251,6 +277,8 @@ E30_isort.pyi:57:1: E303 [*] Too many blank lines (2) 58 57 | 59 58 | + Run `ruff check --fix` to apply this fix. + E30_isort.pyi:60:1: E303 [*] Too many blank lines (2) | 60 | from typing import Any, Sequence @@ -260,7 +288,7 @@ E30_isort.pyi:60:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 56 56 | 57 57 | def flush() -> None: ... 58 58 | @@ -268,3 +296,5 @@ E30_isort.pyi:60:1: E303 [*] Too many blank lines (2) 60 59 | from typing import Any, Sequence 61 60 | 62 61 | class MissingCommand(TypeError): ... # noqa: N818 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap index 83478872dfd16..695ffa8571581 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap @@ -12,7 +12,7 @@ constant_literals.py:4:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 1 1 | ### 2 2 | # Errors 3 3 | ### @@ -22,6 +22,8 @@ constant_literals.py:4:4: F632 [*] Use `==` to compare constant literals 6 6 | if "abc" is None: # F632 (fix, but leaves behind unfixable E711) 7 7 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:6:4: F632 [*] Use `==` to compare constant literals | 4 | if "abc" is "def": # F632 (fix) @@ -33,7 +35,7 @@ constant_literals.py:6:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 3 3 | ### 4 4 | if "abc" is "def": # F632 (fix) 5 5 | pass @@ -43,6 +45,8 @@ constant_literals.py:6:4: F632 [*] Use `==` to compare constant literals 8 8 | if None is "abc": # F632 (fix, but leaves behind unfixable E711) 9 9 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:8:4: F632 [*] Use `==` to compare constant literals | 6 | if "abc" is None: # F632 (fix, but leaves behind unfixable E711) @@ -54,7 +58,7 @@ constant_literals.py:8:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 5 5 | pass 6 6 | if "abc" is None: # F632 (fix, but leaves behind unfixable E711) 7 7 | pass @@ -64,6 +68,8 @@ constant_literals.py:8:4: F632 [*] Use `==` to compare constant literals 10 10 | if "abc" is False: # F632 (fix, but leaves behind unfixable E712) 11 11 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:10:4: F632 [*] Use `==` to compare constant literals | 8 | if None is "abc": # F632 (fix, but leaves behind unfixable E711) @@ -75,7 +81,7 @@ constant_literals.py:10:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 7 7 | pass 8 8 | if None is "abc": # F632 (fix, but leaves behind unfixable E711) 9 9 | pass @@ -85,6 +91,8 @@ constant_literals.py:10:4: F632 [*] Use `==` to compare constant literals 12 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) 13 13 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:12:4: F632 [*] Use `==` to compare constant literals | 10 | if "abc" is False: # F632 (fix, but leaves behind unfixable E712) @@ -96,7 +104,7 @@ constant_literals.py:12:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 9 9 | pass 10 10 | if "abc" is False: # F632 (fix, but leaves behind unfixable E712) 11 11 | pass @@ -106,6 +114,8 @@ constant_literals.py:12:4: F632 [*] Use `==` to compare constant literals 14 14 | if False == None: # E711, E712 (fix) 15 15 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:14:4: E712 [*] Avoid equality comparisons to `False`; use `if not None:` for false checks | 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) @@ -117,7 +127,7 @@ constant_literals.py:14:4: E712 [*] Avoid equality comparisons to `False`; use ` | = help: Replace with `not None` -ℹ Unsafe fix +Suggested fix: 11 11 | pass 12 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) 13 13 | pass @@ -127,6 +137,8 @@ constant_literals.py:14:4: E712 [*] Avoid equality comparisons to `False`; use ` 16 16 | if None == False: # E711, E712 (fix) 17 17 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + constant_literals.py:14:13: E711 [*] Comparison to `None` should be `cond is None` | 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) @@ -138,7 +150,7 @@ constant_literals.py:14:13: E711 [*] Comparison to `None` should be `cond is Non | = help: Replace with `cond is None` -ℹ Unsafe fix +Suggested fix: 11 11 | pass 12 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) 13 13 | pass @@ -148,6 +160,8 @@ constant_literals.py:14:13: E711 [*] Comparison to `None` should be `cond is Non 16 16 | if None == False: # E711, E712 (fix) 17 17 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + constant_literals.py:16:4: E711 [*] Comparison to `None` should be `cond is None` | 14 | if False == None: # E711, E712 (fix) @@ -158,7 +172,7 @@ constant_literals.py:16:4: E711 [*] Comparison to `None` should be `cond is None | = help: Replace with `cond is None` -ℹ Unsafe fix +Suggested fix: 13 13 | pass 14 14 | if False == None: # E711, E712 (fix) 15 15 | pass @@ -168,6 +182,8 @@ constant_literals.py:16:4: E711 [*] Comparison to `None` should be `cond is None 18 18 | 19 19 | named_var = [] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + constant_literals.py:16:4: E712 [*] Avoid equality comparisons to `False`; use `if not None:` for false checks | 14 | if False == None: # E711, E712 (fix) @@ -178,7 +194,7 @@ constant_literals.py:16:4: E712 [*] Avoid equality comparisons to `False`; use ` | = help: Replace with `not None` -ℹ Unsafe fix +Suggested fix: 13 13 | pass 14 14 | if False == None: # E711, E712 (fix) 15 15 | pass @@ -188,6 +204,8 @@ constant_literals.py:16:4: E712 [*] Avoid equality comparisons to `False`; use ` 18 18 | 19 19 | named_var = [] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + constant_literals.py:20:4: F632 [*] Use `==` to compare constant literals | 19 | named_var = [] @@ -198,7 +216,7 @@ constant_literals.py:20:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 17 17 | pass 18 18 | 19 19 | named_var = [] @@ -208,6 +226,8 @@ constant_literals.py:20:4: F632 [*] Use `==` to compare constant literals 22 22 | if named_var is []: # F632 (fix) 23 23 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:22:4: F632 [*] Use `==` to compare constant literals | 20 | if [] is []: # F632 (fix) @@ -219,7 +239,7 @@ constant_literals.py:22:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 19 19 | named_var = [] 20 20 | if [] is []: # F632 (fix) 21 21 | pass @@ -229,6 +249,8 @@ constant_literals.py:22:4: F632 [*] Use `==` to compare constant literals 24 24 | if [] is named_var: # F632 (fix) 25 25 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:24:4: F632 [*] Use `==` to compare constant literals | 22 | if named_var is []: # F632 (fix) @@ -240,7 +262,7 @@ constant_literals.py:24:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 21 21 | pass 22 22 | if named_var is []: # F632 (fix) 23 23 | pass @@ -250,6 +272,8 @@ constant_literals.py:24:4: F632 [*] Use `==` to compare constant literals 26 26 | if named_var is [1]: # F632 (fix) 27 27 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:26:4: F632 [*] Use `==` to compare constant literals | 24 | if [] is named_var: # F632 (fix) @@ -261,7 +285,7 @@ constant_literals.py:26:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 23 23 | pass 24 24 | if [] is named_var: # F632 (fix) 25 25 | pass @@ -271,6 +295,8 @@ constant_literals.py:26:4: F632 [*] Use `==` to compare constant literals 28 28 | if [1] is named_var: # F632 (fix) 29 29 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:28:4: F632 [*] Use `==` to compare constant literals | 26 | if named_var is [1]: # F632 (fix) @@ -282,7 +308,7 @@ constant_literals.py:28:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 25 25 | pass 26 26 | if named_var is [1]: # F632 (fix) 27 27 | pass @@ -292,6 +318,8 @@ constant_literals.py:28:4: F632 [*] Use `==` to compare constant literals 30 30 | if named_var is [i for i in [1]]: # F632 (fix) 31 31 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:30:4: F632 [*] Use `==` to compare constant literals | 28 | if [1] is named_var: # F632 (fix) @@ -302,7 +330,7 @@ constant_literals.py:30:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 27 27 | pass 28 28 | if [1] is named_var: # F632 (fix) 29 29 | pass @@ -312,6 +340,8 @@ constant_literals.py:30:4: F632 [*] Use `==` to compare constant literals 32 32 | 33 33 | named_var = {} + Run `ruff check --fix` to apply this fix. + constant_literals.py:34:4: F632 [*] Use `==` to compare constant literals | 33 | named_var = {} @@ -322,7 +352,7 @@ constant_literals.py:34:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 31 31 | pass 32 32 | 33 33 | named_var = {} @@ -332,6 +362,8 @@ constant_literals.py:34:4: F632 [*] Use `==` to compare constant literals 36 36 | if named_var is {}: # F632 (fix) 37 37 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:36:4: F632 [*] Use `==` to compare constant literals | 34 | if {} is {}: # F632 (fix) @@ -343,7 +375,7 @@ constant_literals.py:36:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 33 33 | named_var = {} 34 34 | if {} is {}: # F632 (fix) 35 35 | pass @@ -353,6 +385,8 @@ constant_literals.py:36:4: F632 [*] Use `==` to compare constant literals 38 38 | if {} is named_var: # F632 (fix) 39 39 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:38:4: F632 [*] Use `==` to compare constant literals | 36 | if named_var is {}: # F632 (fix) @@ -364,7 +398,7 @@ constant_literals.py:38:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 35 35 | pass 36 36 | if named_var is {}: # F632 (fix) 37 37 | pass @@ -374,6 +408,8 @@ constant_literals.py:38:4: F632 [*] Use `==` to compare constant literals 40 40 | if named_var is {1}: # F632 (fix) 41 41 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:40:4: F632 [*] Use `==` to compare constant literals | 38 | if {} is named_var: # F632 (fix) @@ -385,7 +421,7 @@ constant_literals.py:40:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 37 37 | pass 38 38 | if {} is named_var: # F632 (fix) 39 39 | pass @@ -395,6 +431,8 @@ constant_literals.py:40:4: F632 [*] Use `==` to compare constant literals 42 42 | if {1} is named_var: # F632 (fix) 43 43 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:42:4: F632 [*] Use `==` to compare constant literals | 40 | if named_var is {1}: # F632 (fix) @@ -406,7 +444,7 @@ constant_literals.py:42:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 39 39 | pass 40 40 | if named_var is {1}: # F632 (fix) 41 41 | pass @@ -416,6 +454,8 @@ constant_literals.py:42:4: F632 [*] Use `==` to compare constant literals 44 44 | if named_var is {i for i in [1]}: # F632 (fix) 45 45 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:44:4: F632 [*] Use `==` to compare constant literals | 42 | if {1} is named_var: # F632 (fix) @@ -426,7 +466,7 @@ constant_literals.py:44:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 41 41 | pass 42 42 | if {1} is named_var: # F632 (fix) 43 43 | pass @@ -436,6 +476,8 @@ constant_literals.py:44:4: F632 [*] Use `==` to compare constant literals 46 46 | 47 47 | named_var = {1: 1} + Run `ruff check --fix` to apply this fix. + constant_literals.py:48:4: F632 [*] Use `==` to compare constant literals | 47 | named_var = {1: 1} @@ -446,7 +488,7 @@ constant_literals.py:48:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 45 45 | pass 46 46 | 47 47 | named_var = {1: 1} @@ -456,6 +498,8 @@ constant_literals.py:48:4: F632 [*] Use `==` to compare constant literals 50 50 | if named_var is {1: 1}: # F632 (fix) 51 51 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:50:4: F632 [*] Use `==` to compare constant literals | 48 | if {1: 1} is {1: 1}: # F632 (fix) @@ -467,7 +511,7 @@ constant_literals.py:50:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 47 47 | named_var = {1: 1} 48 48 | if {1: 1} is {1: 1}: # F632 (fix) 49 49 | pass @@ -477,6 +521,8 @@ constant_literals.py:50:4: F632 [*] Use `==` to compare constant literals 52 52 | if {1: 1} is named_var: # F632 (fix) 53 53 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:52:4: F632 [*] Use `==` to compare constant literals | 50 | if named_var is {1: 1}: # F632 (fix) @@ -488,7 +534,7 @@ constant_literals.py:52:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 49 49 | pass 50 50 | if named_var is {1: 1}: # F632 (fix) 51 51 | pass @@ -498,6 +544,8 @@ constant_literals.py:52:4: F632 [*] Use `==` to compare constant literals 54 54 | if named_var is {1: 1}: # F632 (fix) 55 55 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:54:4: F632 [*] Use `==` to compare constant literals | 52 | if {1: 1} is named_var: # F632 (fix) @@ -509,7 +557,7 @@ constant_literals.py:54:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 51 51 | pass 52 52 | if {1: 1} is named_var: # F632 (fix) 53 53 | pass @@ -519,6 +567,8 @@ constant_literals.py:54:4: F632 [*] Use `==` to compare constant literals 56 56 | if {1: 1} is named_var: # F632 (fix) 57 57 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:56:4: F632 [*] Use `==` to compare constant literals | 54 | if named_var is {1: 1}: # F632 (fix) @@ -530,7 +580,7 @@ constant_literals.py:56:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 53 53 | pass 54 54 | if named_var is {1: 1}: # F632 (fix) 55 55 | pass @@ -540,6 +590,8 @@ constant_literals.py:56:4: F632 [*] Use `==` to compare constant literals 58 58 | if named_var is {i: 1 for i in [1]}: # F632 (fix) 59 59 | pass + Run `ruff check --fix` to apply this fix. + constant_literals.py:58:4: F632 [*] Use `==` to compare constant literals | 56 | if {1: 1} is named_var: # F632 (fix) @@ -550,7 +602,7 @@ constant_literals.py:58:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 55 55 | pass 56 56 | if {1: 1} is named_var: # F632 (fix) 57 57 | pass @@ -559,3 +611,5 @@ constant_literals.py:58:4: F632 [*] Use `==` to compare constant literals 59 59 | pass 60 60 | 61 61 | ### + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap index 6862f6161fdb1..99b85c95560c1 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap @@ -12,7 +12,7 @@ E502.py:9:9: E502 [*] Redundant backslash | = help: Remove redundant backslash -ℹ Safe fix +Suggested fix: 6 6 | 3 \ 7 7 | + 4 8 8 | @@ -22,6 +22,8 @@ E502.py:9:9: E502 [*] Redundant backslash 11 11 | 7) 12 12 | + Run `ruff check --fix` to apply this fix. + E502.py:10:11: E502 [*] Redundant backslash | 9 | a = (3 -\ @@ -31,7 +33,7 @@ E502.py:10:11: E502 [*] Redundant backslash | = help: Remove redundant backslash -ℹ Safe fix +Suggested fix: 7 7 | + 4 8 8 | 9 9 | a = (3 -\ @@ -41,6 +43,8 @@ E502.py:10:11: E502 [*] Redundant backslash 12 12 | 13 13 | z = 5 + \ + Run `ruff check --fix` to apply this fix. + E502.py:14:9: E502 [*] Redundant backslash | 13 | z = 5 + \ @@ -51,7 +55,7 @@ E502.py:14:9: E502 [*] Redundant backslash | = help: Remove redundant backslash -ℹ Safe fix +Suggested fix: 11 11 | 7) 12 12 | 13 13 | z = 5 + \ @@ -61,6 +65,8 @@ E502.py:14:9: E502 [*] Redundant backslash 16 16 | 7) + \ 17 17 | 4 + Run `ruff check --fix` to apply this fix. + E502.py:15:11: E502 [*] Redundant backslash | 13 | z = 5 + \ @@ -72,7 +78,7 @@ E502.py:15:11: E502 [*] Redundant backslash | = help: Remove redundant backslash -ℹ Safe fix +Suggested fix: 12 12 | 13 13 | z = 5 + \ 14 14 | (3 -\ @@ -82,6 +88,8 @@ E502.py:15:11: E502 [*] Redundant backslash 17 17 | 4 18 18 | + Run `ruff check --fix` to apply this fix. + E502.py:23:17: E502 [*] Redundant backslash | 22 | b = [ @@ -92,7 +100,7 @@ E502.py:23:17: E502 [*] Redundant backslash | = help: Remove redundant backslash -ℹ Safe fix +Suggested fix: 20 20 | 2] 21 21 | 22 22 | b = [ @@ -102,6 +110,8 @@ E502.py:23:17: E502 [*] Redundant backslash 25 25 | - 5 26 26 | ] + Run `ruff check --fix` to apply this fix. + E502.py:24:8: E502 [*] Redundant backslash | 22 | b = [ @@ -113,7 +123,7 @@ E502.py:24:8: E502 [*] Redundant backslash | = help: Remove redundant backslash -ℹ Safe fix +Suggested fix: 21 21 | 22 22 | b = [ 23 23 | 2 + 4 + 5 + \ @@ -123,6 +133,8 @@ E502.py:24:8: E502 [*] Redundant backslash 26 26 | ] 27 27 | + Run `ruff check --fix` to apply this fix. + E502.py:29:11: E502 [*] Redundant backslash | 28 | c = (True and @@ -133,7 +145,7 @@ E502.py:29:11: E502 [*] Redundant backslash | = help: Remove redundant backslash -ℹ Safe fix +Suggested fix: 26 26 | ] 27 27 | 28 28 | c = (True and @@ -143,6 +155,8 @@ E502.py:29:11: E502 [*] Redundant backslash 31 31 | and True \ 32 32 | ) + Run `ruff check --fix` to apply this fix. + E502.py:30:14: E502 [*] Redundant backslash | 28 | c = (True and @@ -154,7 +168,7 @@ E502.py:30:14: E502 [*] Redundant backslash | = help: Remove redundant backslash -ℹ Safe fix +Suggested fix: 27 27 | 28 28 | c = (True and 29 29 | False \ @@ -164,6 +178,8 @@ E502.py:30:14: E502 [*] Redundant backslash 32 32 | ) 33 33 | + Run `ruff check --fix` to apply this fix. + E502.py:31:14: E502 [*] Redundant backslash | 29 | False \ @@ -174,7 +190,7 @@ E502.py:31:14: E502 [*] Redundant backslash | = help: Remove redundant backslash -ℹ Safe fix +Suggested fix: 28 28 | c = (True and 29 29 | False \ 30 30 | or False \ @@ -184,6 +200,8 @@ E502.py:31:14: E502 [*] Redundant backslash 33 33 | 34 34 | c = (True and + Run `ruff check --fix` to apply this fix. + E502.py:44:14: E502 [*] Redundant backslash | 43 | s = { @@ -194,7 +212,7 @@ E502.py:44:14: E502 [*] Redundant backslash | = help: Remove redundant backslash -ℹ Safe fix +Suggested fix: 41 41 | 42 42 | 43 43 | s = { @@ -204,6 +222,8 @@ E502.py:44:14: E502 [*] Redundant backslash 46 46 | } 47 47 | + Run `ruff check --fix` to apply this fix. + E502.py:55:12: E502 [*] Redundant backslash | 55 | x = {2 + 4 \ @@ -212,7 +232,7 @@ E502.py:55:12: E502 [*] Redundant backslash | = help: Remove redundant backslash -ℹ Safe fix +Suggested fix: 52 52 | } 53 53 | 54 54 | @@ -222,6 +242,8 @@ E502.py:55:12: E502 [*] Redundant backslash 57 57 | 58 58 | y = ( + Run `ruff check --fix` to apply this fix. + E502.py:61:9: E502 [*] Redundant backslash | 59 | 2 + 2 # \ @@ -233,7 +255,7 @@ E502.py:61:9: E502 [*] Redundant backslash | = help: Remove redundant backslash -ℹ Safe fix +Suggested fix: 58 58 | y = ( 59 59 | 2 + 2 # \ 60 60 | + 3 # \ @@ -243,6 +265,8 @@ E502.py:61:9: E502 [*] Redundant backslash 63 63 | ) 64 64 | + Run `ruff check --fix` to apply this fix. + E502.py:82:12: E502 [*] Redundant backslash | 80 | "xyz" @@ -253,7 +277,7 @@ E502.py:82:12: E502 [*] Redundant backslash | = help: Remove redundant backslash -ℹ Safe fix +Suggested fix: 79 79 | x = "abc" \ 80 80 | "xyz" 81 81 | @@ -263,6 +287,8 @@ E502.py:82:12: E502 [*] Redundant backslash 84 84 | 85 85 | + Run `ruff check --fix` to apply this fix. + E502.py:87:14: E502 [*] Redundant backslash | 86 | def foo(): @@ -272,10 +298,12 @@ E502.py:87:14: E502 [*] Redundant backslash | = help: Remove redundant backslash -ℹ Safe fix +Suggested fix: 84 84 | 85 85 | 86 86 | def foo(): 87 |- x = (a + \ 87 |+ x = (a + 88 88 | 2) + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap index 643743f66be96..498775fcb05a2 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap @@ -10,8 +10,10 @@ W391_0.py:14:1: W391 [*] Extra newline at end of file | = help: Remove trailing newline -ℹ Safe fix +Suggested fix: 11 11 | if __name__ == '__main__': 12 12 | foo() 13 13 | bar() 14 |- + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_2.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_2.py.snap index 8ca9ecd0c1458..cbc5775ea65bb 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_2.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_2.py.snap @@ -12,7 +12,7 @@ W391_2.py:14:1: W391 [*] Too many newlines at end of file | = help: Remove trailing newlines -ℹ Safe fix +Suggested fix: 11 11 | if __name__ == '__main__': 12 12 | foo() 13 13 | bar() @@ -20,3 +20,5 @@ W391_2.py:14:1: W391 [*] Too many newlines at end of file 15 |- 16 |- 17 |- + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__shebang.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__shebang.snap index fa3897bebc056..a75fec953b699 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__shebang.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__shebang.snap @@ -11,11 +11,11 @@ shebang.py:3:1: E265 [*] Block comment should start with `# ` | = help: Format space -ℹ Safe fix +Suggested fix: 1 1 | #!/usr/bin/python 2 2 | # 3 |-#! 3 |+# ! 4 4 | #: - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(-1)-between(0).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(-1)-between(0).snap index 8e0ac4d6f2f6e..980336738e245 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(-1)-between(0).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(-1)-between(0).snap @@ -15,7 +15,7 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import json 2 |- 3 |- @@ -24,6 +24,8 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted 6 3 | 7 4 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:5:1: E303 [*] Too many blank lines (3) | 5 | from typing import Any, Sequence @@ -31,7 +33,7 @@ E30_isort.py:5:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 1 1 | import json 2 2 | 3 3 | @@ -40,6 +42,8 @@ E30_isort.py:5:1: E303 [*] Too many blank lines (3) 6 5 | 7 6 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:21:5: E303 [*] Too many blank lines (2) | 21 | abcd.foo() @@ -49,7 +53,7 @@ E30_isort.py:21:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 17 17 | if __name__ == "__main__": 18 18 | import abcd 19 19 | @@ -58,6 +62,8 @@ E30_isort.py:21:5: E303 [*] Too many blank lines (2) 22 21 | 23 22 | def __init__(self, backend_module: str, backend_obj: str | None) -> None: ... + Run `ruff check --fix` to apply this fix. + E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -73,7 +79,7 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -83,6 +89,8 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:30:5: E303 [*] Too many blank lines (3) | 30 | from typing_extensions import TypeAlias @@ -90,7 +98,7 @@ E30_isort.py:30:5: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -100,6 +108,8 @@ E30_isort.py:30:5: E303 [*] Too many blank lines (3) 31 29 | 32 30 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:33:5: E303 [*] Too many blank lines (2) | 33 | abcd.foo() @@ -109,7 +119,7 @@ E30_isort.py:33:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 29 29 | 30 30 | from typing_extensions import TypeAlias 31 31 | @@ -118,6 +128,8 @@ E30_isort.py:33:5: E303 [*] Too many blank lines (2) 34 33 | 35 34 | def __call__(self, name: str, *args: Any, **kwargs: Any) -> Any: + Run `ruff check --fix` to apply this fix. + E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | 60 | / from typing import Any, Sequence @@ -127,9 +139,11 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 59 59 | 60 60 | from typing import Any, Sequence 61 61 | 62 |+ 62 63 | class MissingCommand(TypeError): ... # noqa: N818 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(0)-between(0).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(0)-between(0).snap index 092f7ecbde343..906f14df95850 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(0)-between(0).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(0)-between(0).snap @@ -15,7 +15,7 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import json 2 |- 3 |- @@ -27,6 +27,8 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted 9 4 | 10 5 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:5:1: E303 [*] Too many blank lines (3) | 5 | from typing import Any, Sequence @@ -34,7 +36,7 @@ E30_isort.py:5:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 1 1 | import json 2 2 | 3 3 | @@ -43,6 +45,8 @@ E30_isort.py:5:1: E303 [*] Too many blank lines (3) 6 5 | 7 6 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:8:1: E303 [*] Too many blank lines (2) | 8 | class MissingCommand(TypeError): ... # noqa: N818 @@ -50,7 +54,7 @@ E30_isort.py:8:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | 5 5 | from typing import Any, Sequence @@ -60,6 +64,8 @@ E30_isort.py:8:1: E303 [*] Too many blank lines (2) 9 7 | 10 8 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:21:5: E303 [*] Too many blank lines (2) | 21 | abcd.foo() @@ -69,7 +75,7 @@ E30_isort.py:21:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 17 17 | if __name__ == "__main__": 18 18 | import abcd 19 19 | @@ -78,6 +84,8 @@ E30_isort.py:21:5: E303 [*] Too many blank lines (2) 22 21 | 23 22 | def __init__(self, backend_module: str, backend_obj: str | None) -> None: ... + Run `ruff check --fix` to apply this fix. + E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -93,7 +101,7 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -103,6 +111,8 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:30:5: E303 [*] Too many blank lines (3) | 30 | from typing_extensions import TypeAlias @@ -110,7 +120,7 @@ E30_isort.py:30:5: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -120,6 +130,8 @@ E30_isort.py:30:5: E303 [*] Too many blank lines (3) 31 29 | 32 30 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:33:5: E303 [*] Too many blank lines (2) | 33 | abcd.foo() @@ -129,7 +141,7 @@ E30_isort.py:33:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 29 29 | 30 30 | from typing_extensions import TypeAlias 31 31 | @@ -138,6 +150,8 @@ E30_isort.py:33:5: E303 [*] Too many blank lines (2) 34 33 | 35 34 | def __call__(self, name: str, *args: Any, **kwargs: Any) -> Any: + Run `ruff check --fix` to apply this fix. + E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | 60 | / from typing import Any, Sequence @@ -147,13 +161,15 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 58 58 | 59 59 | 60 60 | from typing import Any, Sequence 61 |- 62 61 | class MissingCommand(TypeError): ... # noqa: N818 + Run `ruff check --fix` to apply this fix. + E30_isort.py:62:1: E303 [*] Too many blank lines (1) | 60 | from typing import Any, Sequence @@ -163,9 +179,11 @@ E30_isort.py:62:1: E303 [*] Too many blank lines (1) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 58 58 | 59 59 | 60 60 | from typing import Any, Sequence 61 |- 62 61 | class MissingCommand(TypeError): ... # noqa: N818 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(1)-between(1).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(1)-between(1).snap index 3ba9a6f5e8c21..df3d7f2b44733 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(1)-between(1).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(1)-between(1).snap @@ -15,7 +15,7 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | import json 2 2 | 3 |- @@ -26,6 +26,8 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted 8 5 | class MissingCommand(TypeError): ... # noqa: N818 9 6 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:5:1: E303 [*] Too many blank lines (3) | 5 | from typing import Any, Sequence @@ -33,7 +35,7 @@ E30_isort.py:5:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 1 1 | import json 2 2 | 3 3 | @@ -42,6 +44,8 @@ E30_isort.py:5:1: E303 [*] Too many blank lines (3) 6 5 | 7 6 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:8:1: E303 [*] Too many blank lines (2) | 8 | class MissingCommand(TypeError): ... # noqa: N818 @@ -49,7 +53,7 @@ E30_isort.py:8:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | from typing import Any, Sequence 6 6 | @@ -58,6 +62,8 @@ E30_isort.py:8:1: E303 [*] Too many blank lines (2) 9 8 | 10 9 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:21:5: E303 [*] Too many blank lines (2) | 21 | abcd.foo() @@ -67,7 +73,7 @@ E30_isort.py:21:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 17 17 | if __name__ == "__main__": 18 18 | import abcd 19 19 | @@ -76,6 +82,8 @@ E30_isort.py:21:5: E303 [*] Too many blank lines (2) 22 21 | 23 22 | def __init__(self, backend_module: str, backend_obj: str | None) -> None: ... + Run `ruff check --fix` to apply this fix. + E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -91,7 +99,7 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -101,6 +109,8 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:30:5: E303 [*] Too many blank lines (3) | 30 | from typing_extensions import TypeAlias @@ -108,7 +118,7 @@ E30_isort.py:30:5: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -118,6 +128,8 @@ E30_isort.py:30:5: E303 [*] Too many blank lines (3) 31 29 | 32 30 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:33:5: E303 [*] Too many blank lines (2) | 33 | abcd.foo() @@ -127,7 +139,7 @@ E30_isort.py:33:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 29 29 | 30 30 | from typing_extensions import TypeAlias 31 31 | @@ -135,3 +147,5 @@ E30_isort.py:33:5: E303 [*] Too many blank lines (2) 33 32 | abcd.foo() 34 33 | 35 34 | def __call__(self, name: str, *args: Any, **kwargs: Any) -> Any: + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(4)-between(4).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(4)-between(4).snap index b4ebcc11a63ce..ae7a1683aa67c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(4)-between(4).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(4)-between(4).snap @@ -15,7 +15,7 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | 4 4 | @@ -29,6 +29,8 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted 9 12 | 10 13 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:21:5: E303 [*] Too many blank lines (2) | 21 | abcd.foo() @@ -38,7 +40,7 @@ E30_isort.py:21:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 17 17 | if __name__ == "__main__": 18 18 | import abcd 19 19 | @@ -47,6 +49,8 @@ E30_isort.py:21:5: E303 [*] Too many blank lines (2) 22 21 | 23 22 | def __init__(self, backend_module: str, backend_obj: str | None) -> None: ... + Run `ruff check --fix` to apply this fix. + E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -62,7 +66,7 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -72,6 +76,8 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | + Run `ruff check --fix` to apply this fix. + E30_isort.py:33:5: E303 [*] Too many blank lines (2) | 33 | abcd.foo() @@ -81,7 +87,7 @@ E30_isort.py:33:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -ℹ Safe fix +Suggested fix: 29 29 | 30 30 | from typing_extensions import TypeAlias 31 31 | @@ -90,6 +96,8 @@ E30_isort.py:33:5: E303 [*] Too many blank lines (2) 34 33 | 35 34 | def __call__(self, name: str, *args: Any, **kwargs: Any) -> Any: + Run `ruff check --fix` to apply this fix. + E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | 60 | / from typing import Any, Sequence @@ -99,7 +107,7 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 59 59 | 60 60 | from typing import Any, Sequence 61 61 | @@ -107,3 +115,5 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted 63 |+ 64 |+ 62 65 | class MissingCommand(TypeError): ... # noqa: N818 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__w292_4.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__w292_4.snap index 8761934c7442c..7128563a5e66a 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__w292_4.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__w292_4.snap @@ -8,8 +8,8 @@ W292_4.py:1:2: W292 [*] No newline at end of file | = help: Add trailing newline -ℹ Safe fix +Suggested fix: 1 |- 1 |+ - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap index 85ada6d00fdb2..c369e24f23007 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap @@ -13,7 +13,7 @@ D.py:129:5: D200 [*] One-line docstring should fit on one line | = help: Reformat to one line -ℹ Unsafe fix +Suggested fix: 126 126 | '(found 3)') 127 127 | @expect('D212: Multi-line docstring summary should start at the first line') 128 128 | def asdlkfasd(): @@ -25,6 +25,8 @@ D.py:129:5: D200 [*] One-line docstring should fit on one line 133 131 | 134 132 | @expect('D201: No blank lines allowed before function docstring (found 1)') + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:597:5: D200 [*] One-line docstring should fit on one line | 595 | @expect('D212: Multi-line docstring summary should start at the first line') @@ -37,7 +39,7 @@ D.py:597:5: D200 [*] One-line docstring should fit on one line | = help: Reformat to one line -ℹ Unsafe fix +Suggested fix: 594 594 | '(found 3)') 595 595 | @expect('D212: Multi-line docstring summary should start at the first line') 596 596 | def one_liner(): @@ -49,6 +51,8 @@ D.py:597:5: D200 [*] One-line docstring should fit on one line 601 599 | 602 600 | @expect('D200: One-line docstring should fit on one line with quotes ' + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:606:5: D200 [*] One-line docstring should fit on one line | 604 | @expect('D212: Multi-line docstring summary should start at the first line') @@ -61,7 +65,7 @@ D.py:606:5: D200 [*] One-line docstring should fit on one line | = help: Reformat to one line -ℹ Unsafe fix +Suggested fix: 603 603 | '(found 3)') 604 604 | @expect('D212: Multi-line docstring summary should start at the first line') 605 605 | def one_liner(): @@ -73,6 +77,8 @@ D.py:606:5: D200 [*] One-line docstring should fit on one line 610 608 | 611 609 | @expect('D200: One-line docstring should fit on one line with quotes ' + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:615:5: D200 One-line docstring should fit on one line | 613 | @expect('D212: Multi-line docstring summary should start at the first line') @@ -108,5 +114,3 @@ D.py:645:5: D200 One-line docstring should fit on one line 648 | class StatementOnSameLineAsDocstring: | = help: Reformat to one line - - diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap index 9cae5fd5f9deb..8fead4c9eca31 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap @@ -21,7 +21,7 @@ D200.py:7:5: D200 [*] One-line docstring should fit on one line | = help: Reformat to one line -ℹ Unsafe fix +Suggested fix: 4 4 | 5 5 | 6 6 | def func(): @@ -32,6 +32,8 @@ D200.py:7:5: D200 [*] One-line docstring should fit on one line 10 9 | 11 10 | def func(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D200.py:12:5: D200 One-line docstring should fit on one line | 11 | def func(): @@ -41,5 +43,3 @@ D200.py:12:5: D200 One-line docstring should fit on one line | |_______^ D200 | = help: Reformat to one line - - diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D201_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D201_D.py.snap index 977ac47b9d93c..22bbbbe9f6722 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D201_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D201_D.py.snap @@ -10,7 +10,7 @@ D.py:137:5: D201 [*] No blank lines allowed before function docstring (found 1) | = help: Remove blank line(s) before function docstring -ℹ Safe fix +Suggested fix: 133 133 | 134 134 | @expect('D201: No blank lines allowed before function docstring (found 1)') 135 135 | def leading_space(): @@ -19,6 +19,8 @@ D.py:137:5: D201 [*] No blank lines allowed before function docstring (found 1) 138 137 | 139 138 | + Run `ruff check --fix` to apply this fix. + D.py:151:5: D201 [*] No blank lines allowed before function docstring (found 1) | 149 | def trailing_and_leading_space(): @@ -30,7 +32,7 @@ D.py:151:5: D201 [*] No blank lines allowed before function docstring (found 1) | = help: Remove blank line(s) before function docstring -ℹ Safe fix +Suggested fix: 147 147 | @expect('D201: No blank lines allowed before function docstring (found 1)') 148 148 | @expect('D202: No blank lines allowed after function docstring (found 1)') 149 149 | def trailing_and_leading_space(): @@ -39,6 +41,8 @@ D.py:151:5: D201 [*] No blank lines allowed before function docstring (found 1) 152 151 | 153 152 | pass + Run `ruff check --fix` to apply this fix. + D.py:546:5: D201 [*] No blank lines allowed before function docstring (found 1) | 544 | def multiline_leading_space(): @@ -52,7 +56,7 @@ D.py:546:5: D201 [*] No blank lines allowed before function docstring (found 1) | = help: Remove blank line(s) before function docstring -ℹ Safe fix +Suggested fix: 542 542 | @expect('D201: No blank lines allowed before function docstring (found 1)') 543 543 | @expect('D213: Multi-line docstring summary should start at the second line') 544 544 | def multiline_leading_space(): @@ -61,6 +65,8 @@ D.py:546:5: D201 [*] No blank lines allowed before function docstring (found 1) 547 546 | 548 547 | More content. + Run `ruff check --fix` to apply this fix. + D.py:568:5: D201 [*] No blank lines allowed before function docstring (found 1) | 566 | def multiline_trailing_and_leading_space(): @@ -76,7 +82,7 @@ D.py:568:5: D201 [*] No blank lines allowed before function docstring (found 1) | = help: Remove blank line(s) before function docstring -ℹ Safe fix +Suggested fix: 564 564 | @expect('D202: No blank lines allowed after function docstring (found 1)') 565 565 | @expect('D213: Multi-line docstring summary should start at the second line') 566 566 | def multiline_trailing_and_leading_space(): @@ -85,4 +91,4 @@ D.py:568:5: D201 [*] No blank lines allowed before function docstring (found 1) 569 568 | 570 569 | More content. - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D.py.snap index 8a67b2b1762d9..2b1b840b81a03 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D.py.snap @@ -12,7 +12,7 @@ D.py:142:5: D202 [*] No blank lines allowed after function docstring (found 1) | = help: Remove blank line(s) after function docstring -ℹ Safe fix +Suggested fix: 140 140 | @expect('D202: No blank lines allowed after function docstring (found 1)') 141 141 | def trailing_space(): 142 142 | """Leading space.""" @@ -21,6 +21,8 @@ D.py:142:5: D202 [*] No blank lines allowed after function docstring (found 1) 145 144 | 146 145 | + Run `ruff check --fix` to apply this fix. + D.py:151:5: D202 [*] No blank lines allowed after function docstring (found 1) | 149 | def trailing_and_leading_space(): @@ -32,7 +34,7 @@ D.py:151:5: D202 [*] No blank lines allowed after function docstring (found 1) | = help: Remove blank line(s) after function docstring -ℹ Safe fix +Suggested fix: 149 149 | def trailing_and_leading_space(): 150 150 | 151 151 | """Trailing and leading space.""" @@ -41,6 +43,8 @@ D.py:151:5: D202 [*] No blank lines allowed after function docstring (found 1) 154 153 | 155 154 | + Run `ruff check --fix` to apply this fix. + D.py:555:5: D202 [*] No blank lines allowed after function docstring (found 1) | 553 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -56,7 +60,7 @@ D.py:555:5: D202 [*] No blank lines allowed after function docstring (found 1) | = help: Remove blank line(s) after function docstring -ℹ Safe fix +Suggested fix: 556 556 | 557 557 | More content. 558 558 | """ @@ -65,6 +69,8 @@ D.py:555:5: D202 [*] No blank lines allowed after function docstring (found 1) 561 560 | 562 561 | + Run `ruff check --fix` to apply this fix. + D.py:568:5: D202 [*] No blank lines allowed after function docstring (found 1) | 566 | def multiline_trailing_and_leading_space(): @@ -80,7 +86,7 @@ D.py:568:5: D202 [*] No blank lines allowed after function docstring (found 1) | = help: Remove blank line(s) after function docstring -ℹ Safe fix +Suggested fix: 569 569 | 570 570 | More content. 571 571 | """ @@ -89,4 +95,4 @@ D.py:568:5: D202 [*] No blank lines allowed after function docstring (found 1) 574 573 | 575 574 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D202.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D202.py.snap index 90e915d1022aa..95514dfc21901 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D202.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D202.py.snap @@ -10,7 +10,7 @@ D202.py:57:5: D202 [*] No blank lines allowed after function docstring (found 2) | = help: Remove blank line(s) after function docstring -ℹ Safe fix +Suggested fix: 55 55 | # D202 56 56 | def outer(): 57 57 | """This is a docstring.""" @@ -20,6 +20,8 @@ D202.py:57:5: D202 [*] No blank lines allowed after function docstring (found 2) 61 59 | return 62 60 | + Run `ruff check --fix` to apply this fix. + D202.py:68:5: D202 [*] No blank lines allowed after function docstring (found 2) | 66 | # D202 @@ -29,7 +31,7 @@ D202.py:68:5: D202 [*] No blank lines allowed after function docstring (found 2) | = help: Remove blank line(s) after function docstring -ℹ Safe fix +Suggested fix: 66 66 | # D202 67 67 | def outer(): 68 68 | """This is a docstring.""" @@ -39,6 +41,8 @@ D202.py:68:5: D202 [*] No blank lines allowed after function docstring (found 2) 72 70 | def inner(): 73 71 | return + Run `ruff check --fix` to apply this fix. + D202.py:80:5: D202 [*] No blank lines allowed after function docstring (found 1) | 78 | # D202 @@ -50,7 +54,7 @@ D202.py:80:5: D202 [*] No blank lines allowed after function docstring (found 1) | = help: Remove blank line(s) after function docstring -ℹ Safe fix +Suggested fix: 78 78 | # D202 79 79 | def outer(): 80 80 | """This is a docstring.""" @@ -59,4 +63,4 @@ D202.py:80:5: D202 [*] No blank lines allowed after function docstring (found 1) 83 82 | 84 83 | def inner(): - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D203_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D203_D.py.snap index 3ef6f3205fec5..daa9034a4f6fd 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D203_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D203_D.py.snap @@ -9,7 +9,7 @@ D.py:161:5: D203 [*] 1 blank line required before class docstring | = help: Insert 1 blank line before class docstring -ℹ Safe fix +Suggested fix: 158 158 | 159 159 | 160 160 | class LeadingSpaceMissing: @@ -18,6 +18,8 @@ D.py:161:5: D203 [*] 1 blank line required before class docstring 162 163 | 163 164 | + Run `ruff check --fix` to apply this fix. + D.py:192:5: D203 [*] 1 blank line required before class docstring | 191 | class LeadingAndTrailingSpaceMissing: @@ -27,7 +29,7 @@ D.py:192:5: D203 [*] 1 blank line required before class docstring | = help: Insert 1 blank line before class docstring -ℹ Safe fix +Suggested fix: 189 189 | 190 190 | 191 191 | class LeadingAndTrailingSpaceMissing: @@ -36,6 +38,8 @@ D.py:192:5: D203 [*] 1 blank line required before class docstring 193 194 | pass 194 195 | + Run `ruff check --fix` to apply this fix. + D.py:526:5: D203 [*] 1 blank line required before class docstring | 524 | # parameters as functions for Google / Numpy conventions. @@ -54,7 +58,7 @@ D.py:526:5: D203 [*] 1 blank line required before class docstring | = help: Insert 1 blank line before class docstring -ℹ Safe fix +Suggested fix: 523 523 | # This is reproducing a bug where AttributeError is raised when parsing class 524 524 | # parameters as functions for Google / Numpy conventions. 525 525 | class Blah: # noqa: D203,D213 @@ -63,6 +67,8 @@ D.py:526:5: D203 [*] 1 blank line required before class docstring 527 528 | 528 529 | Parameters + Run `ruff check --fix` to apply this fix. + D.py:649:5: D203 [*] 1 blank line required before class docstring | 648 | class StatementOnSameLineAsDocstring: @@ -73,7 +79,7 @@ D.py:649:5: D203 [*] 1 blank line required before class docstring | = help: Insert 1 blank line before class docstring -ℹ Safe fix +Suggested fix: 646 646 | " 647 647 | 648 648 | class StatementOnSameLineAsDocstring: @@ -82,6 +88,8 @@ D.py:649:5: D203 [*] 1 blank line required before class docstring 650 651 | def sort_services(self): 651 652 | pass + Run `ruff check --fix` to apply this fix. + D.py:654:5: D203 [*] 1 blank line required before class docstring | 653 | class StatementOnSameLineAsDocstring: @@ -90,7 +98,7 @@ D.py:654:5: D203 [*] 1 blank line required before class docstring | = help: Insert 1 blank line before class docstring -ℹ Safe fix +Suggested fix: 651 651 | pass 652 652 | 653 653 | class StatementOnSameLineAsDocstring: @@ -99,6 +107,8 @@ D.py:654:5: D203 [*] 1 blank line required before class docstring 655 656 | 656 657 | + Run `ruff check --fix` to apply this fix. + D.py:658:5: D203 [*] 1 blank line required before class docstring | 657 | class CommentAfterDocstring: @@ -109,7 +119,7 @@ D.py:658:5: D203 [*] 1 blank line required before class docstring | = help: Insert 1 blank line before class docstring -ℹ Safe fix +Suggested fix: 655 655 | 656 656 | 657 657 | class CommentAfterDocstring: @@ -118,4 +128,4 @@ D.py:658:5: D203 [*] 1 blank line required before class docstring 659 660 | def sort_services(self): 660 661 | pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D204_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D204_D.py.snap index 425f22147bb85..b6f73c9140c6f 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D204_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D204_D.py.snap @@ -11,7 +11,7 @@ D.py:181:5: D204 [*] 1 blank line required after class docstring | = help: Insert 1 blank line after class docstring -ℹ Safe fix +Suggested fix: 179 179 | class TrailingSpace: 180 180 | 181 181 | """TrailingSpace.""" @@ -20,6 +20,8 @@ D.py:181:5: D204 [*] 1 blank line required after class docstring 183 184 | 184 185 | + Run `ruff check --fix` to apply this fix. + D.py:192:5: D204 [*] 1 blank line required after class docstring | 191 | class LeadingAndTrailingSpaceMissing: @@ -29,7 +31,7 @@ D.py:192:5: D204 [*] 1 blank line required after class docstring | = help: Insert 1 blank line after class docstring -ℹ Safe fix +Suggested fix: 190 190 | 191 191 | class LeadingAndTrailingSpaceMissing: 192 192 | """Leading and trailing space missing.""" @@ -38,6 +40,8 @@ D.py:192:5: D204 [*] 1 blank line required after class docstring 194 195 | 195 196 | + Run `ruff check --fix` to apply this fix. + D.py:649:5: D204 [*] 1 blank line required after class docstring | 648 | class StatementOnSameLineAsDocstring: @@ -48,7 +52,7 @@ D.py:649:5: D204 [*] 1 blank line required after class docstring | = help: Insert 1 blank line after class docstring -ℹ Safe fix +Suggested fix: 646 646 | " 647 647 | 648 648 | class StatementOnSameLineAsDocstring: @@ -60,6 +64,8 @@ D.py:649:5: D204 [*] 1 blank line required after class docstring 651 653 | pass 652 654 | + Run `ruff check --fix` to apply this fix. + D.py:654:5: D204 [*] 1 blank line required after class docstring | 653 | class StatementOnSameLineAsDocstring: @@ -68,7 +74,7 @@ D.py:654:5: D204 [*] 1 blank line required after class docstring | = help: Insert 1 blank line after class docstring -ℹ Safe fix +Suggested fix: 651 651 | pass 652 652 | 653 653 | class StatementOnSameLineAsDocstring: @@ -80,6 +86,8 @@ D.py:654:5: D204 [*] 1 blank line required after class docstring 656 658 | 657 659 | class CommentAfterDocstring: + Run `ruff check --fix` to apply this fix. + D.py:658:5: D204 [*] 1 blank line required after class docstring | 657 | class CommentAfterDocstring: @@ -90,7 +98,7 @@ D.py:658:5: D204 [*] 1 blank line required after class docstring | = help: Insert 1 blank line after class docstring -ℹ Safe fix +Suggested fix: 656 656 | 657 657 | class CommentAfterDocstring: 658 658 | "After this docstring there's a comment." # priorities=1 @@ -99,4 +107,4 @@ D.py:658:5: D204 [*] 1 blank line required after class docstring 660 661 | pass 661 662 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D205_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D205_D.py.snap index 290cd8a05fccd..ffd97b59c2e08 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D205_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D205_D.py.snap @@ -29,7 +29,7 @@ D.py:210:5: D205 [*] 1 blank line required between summary line and description | = help: Insert single blank line -ℹ Safe fix +Suggested fix: 209 209 | def multi_line_two_separating_blanks(): 210 210 | """Summary. 211 211 | @@ -38,4 +38,4 @@ D.py:210:5: D205 [*] 1 blank line required between summary line and description 214 213 | 215 214 | """ - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D207_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D207_D.py.snap index d70f30883a4a4..873d546cc53d2 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D207_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D207_D.py.snap @@ -12,7 +12,7 @@ D.py:232:1: D207 [*] Docstring is under-indented | = help: Increase indentation -ℹ Safe fix +Suggested fix: 229 229 | def asdfsdf(): 230 230 | """Summary. 231 231 | @@ -22,6 +22,8 @@ D.py:232:1: D207 [*] Docstring is under-indented 234 234 | """ 235 235 | + Run `ruff check --fix` to apply this fix. + D.py:244:1: D207 [*] Docstring is under-indented | 242 | Description. @@ -31,7 +33,7 @@ D.py:244:1: D207 [*] Docstring is under-indented | = help: Increase indentation -ℹ Safe fix +Suggested fix: 241 241 | 242 242 | Description. 243 243 | @@ -41,6 +43,8 @@ D.py:244:1: D207 [*] Docstring is under-indented 246 246 | 247 247 | @expect('D208: Docstring is over-indented') + Run `ruff check --fix` to apply this fix. + D.py:440:1: D207 [*] Docstring is under-indented | 438 | def docstring_start_in_same_line(): """First Line. @@ -51,7 +55,7 @@ D.py:440:1: D207 [*] Docstring is under-indented | = help: Increase indentation -ℹ Safe fix +Suggested fix: 437 437 | @expect('D213: Multi-line docstring summary should start at the second line') 438 438 | def docstring_start_in_same_line(): """First Line. 439 439 | @@ -61,6 +65,8 @@ D.py:440:1: D207 [*] Docstring is under-indented 442 442 | 443 443 | + Run `ruff check --fix` to apply this fix. + D.py:441:1: D207 [*] Docstring is under-indented | 440 | Second Line @@ -69,7 +75,7 @@ D.py:441:1: D207 [*] Docstring is under-indented | = help: Increase indentation -ℹ Safe fix +Suggested fix: 438 438 | def docstring_start_in_same_line(): """First Line. 439 439 | 440 440 | Second Line @@ -79,4 +85,4 @@ D.py:441:1: D207 [*] Docstring is under-indented 443 443 | 444 444 | def function_with_lambda_arg(x=lambda y: y): - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D.py.snap index 5048d030c7dcd..affeff64014cb 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D.py.snap @@ -12,7 +12,7 @@ D.py:252:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 249 249 | def asdfsdsdf24(): 250 250 | """Summary. 251 251 | @@ -22,6 +22,8 @@ D.py:252:1: D208 [*] Docstring is over-indented 254 254 | """ 255 255 | + Run `ruff check --fix` to apply this fix. + D.py:264:1: D208 [*] Docstring is over-indented | 262 | Description. @@ -31,7 +33,7 @@ D.py:264:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 261 261 | 262 262 | Description. 263 263 | @@ -41,6 +43,8 @@ D.py:264:1: D208 [*] Docstring is over-indented 266 266 | 267 267 | @expect('D208: Docstring is over-indented') + Run `ruff check --fix` to apply this fix. + D.py:272:1: D208 [*] Docstring is over-indented | 270 | """Summary. @@ -52,7 +56,7 @@ D.py:272:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 269 269 | def asdfsdfsdsdsdfsdf24(): 270 270 | """Summary. 271 271 | @@ -62,6 +66,8 @@ D.py:272:1: D208 [*] Docstring is over-indented 274 274 | """ 275 275 | + Run `ruff check --fix` to apply this fix. + D.py:673:1: D208 [*] Docstring is over-indented | 671 | """Summary. @@ -73,7 +79,7 @@ D.py:673:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 670 670 | def retain_extra_whitespace(): 671 671 | """Summary. 672 672 | @@ -83,6 +89,8 @@ D.py:673:1: D208 [*] Docstring is over-indented 675 675 | to the one before 676 676 | """ + Run `ruff check --fix` to apply this fix. + D.py:674:1: D208 [*] Docstring is over-indented | 673 | This is overindented @@ -93,7 +101,7 @@ D.py:674:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 671 671 | """Summary. 672 672 | 673 673 | This is overindented @@ -103,6 +111,8 @@ D.py:674:1: D208 [*] Docstring is over-indented 676 676 | """ 677 677 | + Run `ruff check --fix` to apply this fix. + D.py:675:1: D208 [*] Docstring is over-indented | 673 | This is overindented @@ -113,7 +123,7 @@ D.py:675:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 672 672 | 673 673 | This is overindented 674 674 | And so is this, but it we should preserve the extra space on this line relative @@ -123,6 +133,8 @@ D.py:675:1: D208 [*] Docstring is over-indented 677 677 | 678 678 | + Run `ruff check --fix` to apply this fix. + D.py:682:1: D208 [*] Docstring is over-indented | 680 | """Summary. @@ -134,7 +146,7 @@ D.py:682:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 679 679 | def retain_extra_whitespace_multiple(): 680 680 | """Summary. 681 681 | @@ -144,6 +156,8 @@ D.py:682:1: D208 [*] Docstring is over-indented 684 684 | to the one before 685 685 | This is also overindented + Run `ruff check --fix` to apply this fix. + D.py:683:1: D208 [*] Docstring is over-indented | 682 | This is overindented @@ -154,7 +168,7 @@ D.py:683:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 680 680 | """Summary. 681 681 | 682 682 | This is overindented @@ -164,6 +178,8 @@ D.py:683:1: D208 [*] Docstring is over-indented 685 685 | This is also overindented 686 686 | And so is this, but it we should preserve the extra space on this line relative + Run `ruff check --fix` to apply this fix. + D.py:684:1: D208 [*] Docstring is over-indented | 682 | This is overindented @@ -175,7 +191,7 @@ D.py:684:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 681 681 | 682 682 | This is overindented 683 683 | And so is this, but it we should preserve the extra space on this line relative @@ -185,6 +201,8 @@ D.py:684:1: D208 [*] Docstring is over-indented 686 686 | And so is this, but it we should preserve the extra space on this line relative 687 687 | to the one before + Run `ruff check --fix` to apply this fix. + D.py:685:1: D208 [*] Docstring is over-indented | 683 | And so is this, but it we should preserve the extra space on this line relative @@ -196,7 +214,7 @@ D.py:685:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 682 682 | This is overindented 683 683 | And so is this, but it we should preserve the extra space on this line relative 684 684 | to the one before @@ -206,6 +224,8 @@ D.py:685:1: D208 [*] Docstring is over-indented 687 687 | to the one before 688 688 | """ + Run `ruff check --fix` to apply this fix. + D.py:686:1: D208 [*] Docstring is over-indented | 684 | to the one before @@ -217,7 +237,7 @@ D.py:686:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 683 683 | And so is this, but it we should preserve the extra space on this line relative 684 684 | to the one before 685 685 | This is also overindented @@ -227,6 +247,8 @@ D.py:686:1: D208 [*] Docstring is over-indented 688 688 | """ 689 689 | + Run `ruff check --fix` to apply this fix. + D.py:687:1: D208 [*] Docstring is over-indented | 685 | This is also overindented @@ -237,7 +259,7 @@ D.py:687:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 684 684 | to the one before 685 685 | This is also overindented 686 686 | And so is this, but it we should preserve the extra space on this line relative @@ -247,6 +269,8 @@ D.py:687:1: D208 [*] Docstring is over-indented 689 689 | 690 690 | + Run `ruff check --fix` to apply this fix. + D.py:695:1: D208 [*] Docstring is over-indented | 693 | """Summary. @@ -258,7 +282,7 @@ D.py:695:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 692 692 | def retain_extra_whitespace_deeper(): 693 693 | """Summary. 694 694 | @@ -268,6 +292,8 @@ D.py:695:1: D208 [*] Docstring is over-indented 697 697 | to the one before 698 698 | And the relative indent here should be preserved too + Run `ruff check --fix` to apply this fix. + D.py:696:1: D208 [*] Docstring is over-indented | 695 | This is overindented @@ -278,7 +304,7 @@ D.py:696:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 693 693 | """Summary. 694 694 | 695 695 | This is overindented @@ -288,6 +314,8 @@ D.py:696:1: D208 [*] Docstring is over-indented 698 698 | And the relative indent here should be preserved too 699 699 | """ + Run `ruff check --fix` to apply this fix. + D.py:697:1: D208 [*] Docstring is over-indented | 695 | This is overindented @@ -299,7 +327,7 @@ D.py:697:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 694 694 | 695 695 | This is overindented 696 696 | And so is this, but it we should preserve the extra space on this line relative @@ -309,6 +337,8 @@ D.py:697:1: D208 [*] Docstring is over-indented 699 699 | """ 700 700 | + Run `ruff check --fix` to apply this fix. + D.py:698:1: D208 [*] Docstring is over-indented | 696 | And so is this, but it we should preserve the extra space on this line relative @@ -319,7 +349,7 @@ D.py:698:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 695 695 | This is overindented 696 696 | And so is this, but it we should preserve the extra space on this line relative 697 697 | to the one before @@ -329,6 +359,8 @@ D.py:698:1: D208 [*] Docstring is over-indented 700 700 | 701 701 | def retain_extra_whitespace_followed_by_same_offset(): + Run `ruff check --fix` to apply this fix. + D.py:704:1: D208 [*] Docstring is over-indented | 702 | """Summary. @@ -340,7 +372,7 @@ D.py:704:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 701 701 | def retain_extra_whitespace_followed_by_same_offset(): 702 702 | """Summary. 703 703 | @@ -350,6 +382,8 @@ D.py:704:1: D208 [*] Docstring is over-indented 706 706 | This is overindented 707 707 | This is overindented + Run `ruff check --fix` to apply this fix. + D.py:705:1: D208 [*] Docstring is over-indented | 704 | This is overindented @@ -360,7 +394,7 @@ D.py:705:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 702 702 | """Summary. 703 703 | 704 704 | This is overindented @@ -370,6 +404,8 @@ D.py:705:1: D208 [*] Docstring is over-indented 707 707 | This is overindented 708 708 | """ + Run `ruff check --fix` to apply this fix. + D.py:706:1: D208 [*] Docstring is over-indented | 704 | This is overindented @@ -381,7 +417,7 @@ D.py:706:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 703 703 | 704 704 | This is overindented 705 705 | And so is this, but it we should preserve the extra space on this line relative @@ -391,6 +427,8 @@ D.py:706:1: D208 [*] Docstring is over-indented 708 708 | """ 709 709 | + Run `ruff check --fix` to apply this fix. + D.py:707:1: D208 [*] Docstring is over-indented | 705 | And so is this, but it we should preserve the extra space on this line relative @@ -401,7 +439,7 @@ D.py:707:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 704 704 | This is overindented 705 705 | And so is this, but it we should preserve the extra space on this line relative 706 706 | This is overindented @@ -411,6 +449,8 @@ D.py:707:1: D208 [*] Docstring is over-indented 709 709 | 710 710 | + Run `ruff check --fix` to apply this fix. + D.py:723:1: D208 [*] Docstring is over-indented | 721 | """There's a non-breaking space (2-bytes) after 3 spaces (https://github.com/astral-sh/ruff/issues/9080). @@ -421,7 +461,7 @@ D.py:723:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 720 720 | def inconsistent_indent_byte_size(): 721 721 | """There's a non-breaking space (2-bytes) after 3 spaces (https://github.com/astral-sh/ruff/issues/9080). 722 722 | @@ -429,4 +469,4 @@ D.py:723:1: D208 [*] Docstring is over-indented 723 |+ Returns: 724 724 | """ - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D208.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D208.py.snap index 517dc3802e1ec..c67210248eaa6 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D208.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D208.py.snap @@ -10,7 +10,7 @@ D208.py:2:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 1 1 | """ 2 |- Author 2 |+Author @@ -18,6 +18,8 @@ D208.py:2:1: D208 [*] Docstring is over-indented 4 4 | 5 5 | + Run `ruff check --fix` to apply this fix. + D208.py:8:1: D208 [*] Docstring is over-indented | 6 | class Platform: @@ -29,7 +31,7 @@ D208.py:8:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | class Platform: 7 7 | """ Remove sampler @@ -39,6 +41,8 @@ D208.py:8:1: D208 [*] Docstring is over-indented 10 10 | """ 11 11 | + Run `ruff check --fix` to apply this fix. + D208.py:9:1: D208 [*] Docstring is over-indented | 7 | """ Remove sampler @@ -49,7 +53,7 @@ D208.py:9:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 6 6 | class Platform: 7 7 | """ Remove sampler 8 8 | Args: @@ -59,6 +63,8 @@ D208.py:9:1: D208 [*] Docstring is over-indented 11 11 | 12 12 | + Run `ruff check --fix` to apply this fix. + D208.py:10:1: D208 [*] Docstring is over-indented | 8 | Args: @@ -68,7 +74,7 @@ D208.py:10:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Safe fix +Suggested fix: 7 7 | """ Remove sampler 8 8 | Args: 9 9 |     Returns: @@ -78,4 +84,4 @@ D208.py:10:1: D208 [*] Docstring is over-indented 12 12 | 13 13 | def memory_test(): - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D209_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D209_D.py.snap index 97495aa3191e7..51008577bacd2 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D209_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D209_D.py.snap @@ -13,7 +13,7 @@ D.py:281:5: D209 [*] Multi-line docstring closing quotes should be on a separate | = help: Move closing quotes to new line -ℹ Safe fix +Suggested fix: 280 280 | def asdfljdf24(): 281 281 | """Summary. 282 282 | @@ -24,6 +24,8 @@ D.py:281:5: D209 [*] Multi-line docstring closing quotes should be on a separate 285 286 | 286 287 | @expect('D210: No whitespaces allowed surrounding docstring text') + Run `ruff check --fix` to apply this fix. + D.py:588:5: D209 [*] Multi-line docstring closing quotes should be on a separate line | 586 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -36,7 +38,7 @@ D.py:588:5: D209 [*] Multi-line docstring closing quotes should be on a separate | = help: Move closing quotes to new line -ℹ Safe fix +Suggested fix: 587 587 | def asdfljdjgf24(): 588 588 | """Summary. 589 589 | @@ -47,4 +49,4 @@ D.py:588:5: D209 [*] Multi-line docstring closing quotes should be on a separate 592 593 | 593 594 | @expect('D200: One-line docstring should fit on one line with quotes ' - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D210_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D210_D.py.snap index 29b6fe31604c9..13deeaca76d22 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D210_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D210_D.py.snap @@ -10,7 +10,7 @@ D.py:288:5: D210 [*] No whitespaces allowed surrounding docstring text | = help: Trim surrounding whitespace -ℹ Safe fix +Suggested fix: 285 285 | 286 286 | @expect('D210: No whitespaces allowed surrounding docstring text') 287 287 | def endswith(): @@ -20,6 +20,8 @@ D.py:288:5: D210 [*] No whitespaces allowed surrounding docstring text 290 290 | 291 291 | @expect('D210: No whitespaces allowed surrounding docstring text') + Run `ruff check --fix` to apply this fix. + D.py:293:5: D210 [*] No whitespaces allowed surrounding docstring text | 291 | @expect('D210: No whitespaces allowed surrounding docstring text') @@ -29,7 +31,7 @@ D.py:293:5: D210 [*] No whitespaces allowed surrounding docstring text | = help: Trim surrounding whitespace -ℹ Safe fix +Suggested fix: 290 290 | 291 291 | @expect('D210: No whitespaces allowed surrounding docstring text') 292 292 | def around(): @@ -39,6 +41,8 @@ D.py:293:5: D210 [*] No whitespaces allowed surrounding docstring text 295 295 | 296 296 | @expect('D210: No whitespaces allowed surrounding docstring text') + Run `ruff check --fix` to apply this fix. + D.py:299:5: D210 [*] No whitespaces allowed surrounding docstring text | 297 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -52,7 +56,7 @@ D.py:299:5: D210 [*] No whitespaces allowed surrounding docstring text | = help: Trim surrounding whitespace -ℹ Safe fix +Suggested fix: 296 296 | @expect('D210: No whitespaces allowed surrounding docstring text') 297 297 | @expect('D213: Multi-line docstring summary should start at the second line') 298 298 | def multiline(): @@ -62,6 +66,8 @@ D.py:299:5: D210 [*] No whitespaces allowed surrounding docstring text 301 301 | This is the end. 302 302 | """ + Run `ruff check --fix` to apply this fix. + D.py:581:5: D210 No whitespaces allowed surrounding docstring text | 579 | "or exclamation point (not '\"')") @@ -70,5 +76,3 @@ D.py:581:5: D210 No whitespaces allowed surrounding docstring text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D210 | = help: Trim surrounding whitespace - - diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D211_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D211_D.py.snap index f89dc69584eeb..282cada7287a4 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D211_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D211_D.py.snap @@ -10,7 +10,7 @@ D.py:170:5: D211 [*] No blank lines allowed before class docstring | = help: Remove blank line(s) before class docstring -ℹ Safe fix +Suggested fix: 166 166 | 167 167 | 168 168 | class WithLeadingSpace: @@ -19,6 +19,8 @@ D.py:170:5: D211 [*] No blank lines allowed before class docstring 171 170 | 172 171 | + Run `ruff check --fix` to apply this fix. + D.py:181:5: D211 [*] No blank lines allowed before class docstring | 179 | class TrailingSpace: @@ -29,7 +31,7 @@ D.py:181:5: D211 [*] No blank lines allowed before class docstring | = help: Remove blank line(s) before class docstring -ℹ Safe fix +Suggested fix: 177 177 | 178 178 | 179 179 | class TrailingSpace: @@ -38,4 +40,4 @@ D.py:181:5: D211 [*] No blank lines allowed before class docstring 182 181 | pass 183 182 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D212_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D212_D.py.snap index c37abb9572d59..41334443c68c2 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D212_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D212_D.py.snap @@ -13,7 +13,7 @@ D.py:129:5: D212 [*] Multi-line docstring summary should start at the first line | = help: Remove whitespace after opening quotes -ℹ Safe fix +Suggested fix: 126 126 | '(found 3)') 127 127 | @expect('D212: Multi-line docstring summary should start at the first line') 128 128 | def asdlkfasd(): @@ -24,6 +24,8 @@ D.py:129:5: D212 [*] Multi-line docstring summary should start at the first line 132 131 | 133 132 | + Run `ruff check --fix` to apply this fix. + D.py:597:5: D212 [*] Multi-line docstring summary should start at the first line | 595 | @expect('D212: Multi-line docstring summary should start at the first line') @@ -36,7 +38,7 @@ D.py:597:5: D212 [*] Multi-line docstring summary should start at the first line | = help: Remove whitespace after opening quotes -ℹ Safe fix +Suggested fix: 594 594 | '(found 3)') 595 595 | @expect('D212: Multi-line docstring summary should start at the first line') 596 596 | def one_liner(): @@ -48,6 +50,8 @@ D.py:597:5: D212 [*] Multi-line docstring summary should start at the first line 601 599 | 602 600 | @expect('D200: One-line docstring should fit on one line with quotes ' + Run `ruff check --fix` to apply this fix. + D.py:624:5: D212 [*] Multi-line docstring summary should start at the first line | 622 | @expect('D212: Multi-line docstring summary should start at the first line') @@ -60,7 +64,7 @@ D.py:624:5: D212 [*] Multi-line docstring summary should start at the first line | = help: Remove whitespace after opening quotes -ℹ Safe fix +Suggested fix: 621 621 | '(found 3)') 622 622 | @expect('D212: Multi-line docstring summary should start at the first line') 623 623 | def one_liner(): @@ -72,4 +76,4 @@ D.py:624:5: D212 [*] Multi-line docstring summary should start at the first line 628 626 | 629 627 | @expect('D404: First word of the docstring should not be "This"') - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D213_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D213_D.py.snap index 0253bc44cd427..bf3b52ff6a109 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D213_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D213_D.py.snap @@ -14,7 +14,7 @@ D.py:200:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 197 197 | '(found 0)') 198 198 | @expect('D213: Multi-line docstring summary should start at the second line') 199 199 | def multi_line_zero_separating_blanks(): @@ -25,6 +25,8 @@ D.py:200:5: D213 [*] Multi-line docstring summary should start at the second lin 202 203 | 203 204 | """ + Run `ruff check --fix` to apply this fix. + D.py:210:5: D213 [*] Multi-line docstring summary should start at the second line | 208 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -40,7 +42,7 @@ D.py:210:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 207 207 | '(found 2)') 208 208 | @expect('D213: Multi-line docstring summary should start at the second line') 209 209 | def multi_line_two_separating_blanks(): @@ -51,6 +53,8 @@ D.py:210:5: D213 [*] Multi-line docstring summary should start at the second lin 212 213 | 213 214 | Description. + Run `ruff check --fix` to apply this fix. + D.py:220:5: D213 [*] Multi-line docstring summary should start at the second line | 218 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -65,7 +69,7 @@ D.py:220:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 217 217 | 218 218 | @expect('D213: Multi-line docstring summary should start at the second line') 219 219 | def multi_line_one_separating_blanks(): @@ -76,6 +80,8 @@ D.py:220:5: D213 [*] Multi-line docstring summary should start at the second lin 222 223 | Description. 223 224 | + Run `ruff check --fix` to apply this fix. + D.py:230:5: D213 [*] Multi-line docstring summary should start at the second line | 228 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -90,7 +96,7 @@ D.py:230:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 227 227 | @expect('D207: Docstring is under-indented') 228 228 | @expect('D213: Multi-line docstring summary should start at the second line') 229 229 | def asdfsdf(): @@ -101,6 +107,8 @@ D.py:230:5: D213 [*] Multi-line docstring summary should start at the second lin 232 233 | Description. 233 234 | + Run `ruff check --fix` to apply this fix. + D.py:240:5: D213 [*] Multi-line docstring summary should start at the second line | 238 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -115,7 +123,7 @@ D.py:240:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 237 237 | @expect('D207: Docstring is under-indented') 238 238 | @expect('D213: Multi-line docstring summary should start at the second line') 239 239 | def asdsdfsdffsdf(): @@ -126,6 +134,8 @@ D.py:240:5: D213 [*] Multi-line docstring summary should start at the second lin 242 243 | Description. 243 244 | + Run `ruff check --fix` to apply this fix. + D.py:250:5: D213 [*] Multi-line docstring summary should start at the second line | 248 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -140,7 +150,7 @@ D.py:250:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 247 247 | @expect('D208: Docstring is over-indented') 248 248 | @expect('D213: Multi-line docstring summary should start at the second line') 249 249 | def asdfsdsdf24(): @@ -151,6 +161,8 @@ D.py:250:5: D213 [*] Multi-line docstring summary should start at the second lin 252 253 | Description. 253 254 | + Run `ruff check --fix` to apply this fix. + D.py:260:5: D213 [*] Multi-line docstring summary should start at the second line | 258 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -165,7 +177,7 @@ D.py:260:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 257 257 | @expect('D208: Docstring is over-indented') 258 258 | @expect('D213: Multi-line docstring summary should start at the second line') 259 259 | def asdfsdsdfsdf24(): @@ -176,6 +188,8 @@ D.py:260:5: D213 [*] Multi-line docstring summary should start at the second lin 262 263 | Description. 263 264 | + Run `ruff check --fix` to apply this fix. + D.py:270:5: D213 [*] Multi-line docstring summary should start at the second line | 268 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -190,7 +204,7 @@ D.py:270:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 267 267 | @expect('D208: Docstring is over-indented') 268 268 | @expect('D213: Multi-line docstring summary should start at the second line') 269 269 | def asdfsdfsdsdsdfsdf24(): @@ -201,6 +215,8 @@ D.py:270:5: D213 [*] Multi-line docstring summary should start at the second lin 272 273 | Description. 273 274 | + Run `ruff check --fix` to apply this fix. + D.py:281:5: D213 [*] Multi-line docstring summary should start at the second line | 279 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -213,7 +229,7 @@ D.py:281:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 278 278 | 'line') 279 279 | @expect('D213: Multi-line docstring summary should start at the second line') 280 280 | def asdfljdf24(): @@ -224,6 +240,8 @@ D.py:281:5: D213 [*] Multi-line docstring summary should start at the second lin 283 284 | Description.""" 284 285 | + Run `ruff check --fix` to apply this fix. + D.py:299:5: D213 [*] Multi-line docstring summary should start at the second line | 297 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -237,7 +255,7 @@ D.py:299:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 296 296 | @expect('D210: No whitespaces allowed surrounding docstring text') 297 297 | @expect('D213: Multi-line docstring summary should start at the second line') 298 298 | def multiline(): @@ -248,6 +266,8 @@ D.py:299:5: D213 [*] Multi-line docstring summary should start at the second lin 301 302 | This is the end. 302 303 | """ + Run `ruff check --fix` to apply this fix. + D.py:343:5: D213 [*] Multi-line docstring summary should start at the second line | 341 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -263,7 +283,7 @@ D.py:343:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 340 340 | 341 341 | @expect('D213: Multi-line docstring summary should start at the second line') 342 342 | def exceptions_of_D301(): @@ -274,6 +294,8 @@ D.py:343:5: D213 [*] Multi-line docstring summary should start at the second lin 345 346 | In particular, line continuations \ 346 347 | and unicode literals \u0394 and \N{GREEK CAPITAL LETTER DELTA}. + Run `ruff check --fix` to apply this fix. + D.py:383:5: D213 [*] Multi-line docstring summary should start at the second line | 381 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -288,7 +310,7 @@ D.py:383:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 380 380 | 381 381 | @expect('D213: Multi-line docstring summary should start at the second line') 382 382 | def new_209(): @@ -299,6 +321,8 @@ D.py:383:5: D213 [*] Multi-line docstring summary should start at the second lin 385 386 | More lines. 386 387 | """ + Run `ruff check --fix` to apply this fix. + D.py:392:5: D213 [*] Multi-line docstring summary should start at the second line | 390 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -313,7 +337,7 @@ D.py:392:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 389 389 | 390 390 | @expect('D213: Multi-line docstring summary should start at the second line') 391 391 | def old_209(): @@ -324,6 +348,8 @@ D.py:392:5: D213 [*] Multi-line docstring summary should start at the second lin 394 395 | Multi-line comments. OK to have extra blank line 395 396 | + Run `ruff check --fix` to apply this fix. + D.py:438:37: D213 [*] Multi-line docstring summary should start at the second line | 436 | @expect("D207: Docstring is under-indented") @@ -337,7 +363,7 @@ D.py:438:37: D213 [*] Multi-line docstring summary should start at the second li | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 435 435 | 436 436 | @expect("D207: Docstring is under-indented") 437 437 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -348,6 +374,8 @@ D.py:438:37: D213 [*] Multi-line docstring summary should start at the second li 440 441 | Second Line 441 442 | """ + Run `ruff check --fix` to apply this fix. + D.py:450:5: D213 [*] Multi-line docstring summary should start at the second line | 448 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -362,7 +390,7 @@ D.py:450:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 447 447 | 448 448 | @expect('D213: Multi-line docstring summary should start at the second line') 449 449 | def a_following_valid_function(x=None): @@ -373,6 +401,8 @@ D.py:450:5: D213 [*] Multi-line docstring summary should start at the second lin 452 453 | The assertion was caused in the next function, so this one is necessary. 453 454 | + Run `ruff check --fix` to apply this fix. + D.py:526:5: D213 [*] Multi-line docstring summary should start at the second line | 524 | # parameters as functions for Google / Numpy conventions. @@ -391,7 +421,7 @@ D.py:526:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 523 523 | # This is reproducing a bug where AttributeError is raised when parsing class 524 524 | # parameters as functions for Google / Numpy conventions. 525 525 | class Blah: # noqa: D203,D213 @@ -402,6 +432,8 @@ D.py:526:5: D213 [*] Multi-line docstring summary should start at the second lin 528 529 | Parameters 529 530 | ---------- + Run `ruff check --fix` to apply this fix. + D.py:546:5: D213 [*] Multi-line docstring summary should start at the second line | 544 | def multiline_leading_space(): @@ -415,7 +447,7 @@ D.py:546:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 543 543 | @expect('D213: Multi-line docstring summary should start at the second line') 544 544 | def multiline_leading_space(): 545 545 | @@ -426,6 +458,8 @@ D.py:546:5: D213 [*] Multi-line docstring summary should start at the second lin 548 549 | More content. 549 550 | """ + Run `ruff check --fix` to apply this fix. + D.py:555:5: D213 [*] Multi-line docstring summary should start at the second line | 553 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -441,7 +475,7 @@ D.py:555:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 552 552 | @expect('D202: No blank lines allowed after function docstring (found 1)') 553 553 | @expect('D213: Multi-line docstring summary should start at the second line') 554 554 | def multiline_trailing_space(): @@ -452,6 +486,8 @@ D.py:555:5: D213 [*] Multi-line docstring summary should start at the second lin 557 558 | More content. 558 559 | """ + Run `ruff check --fix` to apply this fix. + D.py:568:5: D213 [*] Multi-line docstring summary should start at the second line | 566 | def multiline_trailing_and_leading_space(): @@ -467,7 +503,7 @@ D.py:568:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 565 565 | @expect('D213: Multi-line docstring summary should start at the second line') 566 566 | def multiline_trailing_and_leading_space(): 567 567 | @@ -478,6 +514,8 @@ D.py:568:5: D213 [*] Multi-line docstring summary should start at the second lin 570 571 | More content. 571 572 | """ + Run `ruff check --fix` to apply this fix. + D.py:588:5: D213 [*] Multi-line docstring summary should start at the second line | 586 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -490,7 +528,7 @@ D.py:588:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 585 585 | 'line') 586 586 | @expect('D213: Multi-line docstring summary should start at the second line') 587 587 | def asdfljdjgf24(): @@ -501,6 +539,8 @@ D.py:588:5: D213 [*] Multi-line docstring summary should start at the second lin 590 591 | Description. """ 591 592 | + Run `ruff check --fix` to apply this fix. + D.py:606:5: D213 [*] Multi-line docstring summary should start at the second line | 604 | @expect('D212: Multi-line docstring summary should start at the first line') @@ -513,7 +553,7 @@ D.py:606:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 603 603 | '(found 3)') 604 604 | @expect('D212: Multi-line docstring summary should start at the first line') 605 605 | def one_liner(): @@ -524,6 +564,8 @@ D.py:606:5: D213 [*] Multi-line docstring summary should start at the second lin 608 609 | """ 609 610 | + Run `ruff check --fix` to apply this fix. + D.py:615:5: D213 [*] Multi-line docstring summary should start at the second line | 613 | @expect('D212: Multi-line docstring summary should start at the first line') @@ -536,7 +578,7 @@ D.py:615:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 612 612 | '(found 3)') 613 613 | @expect('D212: Multi-line docstring summary should start at the first line') 614 614 | def one_liner(): @@ -547,6 +589,8 @@ D.py:615:5: D213 [*] Multi-line docstring summary should start at the second lin 617 618 | """ 618 619 | + Run `ruff check --fix` to apply this fix. + D.py:671:5: D213 [*] Multi-line docstring summary should start at the second line | 670 | def retain_extra_whitespace(): @@ -561,7 +605,7 @@ D.py:671:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 668 668 | 669 669 | 670 670 | def retain_extra_whitespace(): @@ -572,6 +616,8 @@ D.py:671:5: D213 [*] Multi-line docstring summary should start at the second lin 673 674 | This is overindented 674 675 | And so is this, but it we should preserve the extra space on this line relative + Run `ruff check --fix` to apply this fix. + D.py:680:5: D213 [*] Multi-line docstring summary should start at the second line | 679 | def retain_extra_whitespace_multiple(): @@ -589,7 +635,7 @@ D.py:680:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 677 677 | 678 678 | 679 679 | def retain_extra_whitespace_multiple(): @@ -600,6 +646,8 @@ D.py:680:5: D213 [*] Multi-line docstring summary should start at the second lin 682 683 | This is overindented 683 684 | And so is this, but it we should preserve the extra space on this line relative + Run `ruff check --fix` to apply this fix. + D.py:693:5: D213 [*] Multi-line docstring summary should start at the second line | 692 | def retain_extra_whitespace_deeper(): @@ -617,7 +665,7 @@ D.py:693:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 690 690 | 691 691 | 692 692 | def retain_extra_whitespace_deeper(): @@ -628,6 +676,8 @@ D.py:693:5: D213 [*] Multi-line docstring summary should start at the second lin 695 696 | This is overindented 696 697 | And so is this, but it we should preserve the extra space on this line relative + Run `ruff check --fix` to apply this fix. + D.py:702:5: D213 [*] Multi-line docstring summary should start at the second line | 701 | def retain_extra_whitespace_followed_by_same_offset(): @@ -643,7 +693,7 @@ D.py:702:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 699 699 | """ 700 700 | 701 701 | def retain_extra_whitespace_followed_by_same_offset(): @@ -654,6 +704,8 @@ D.py:702:5: D213 [*] Multi-line docstring summary should start at the second lin 704 705 | This is overindented 705 706 | And so is this, but it we should preserve the extra space on this line relative + Run `ruff check --fix` to apply this fix. + D.py:712:5: D213 [*] Multi-line docstring summary should start at the second line | 711 | def retain_extra_whitespace_not_overindented(): @@ -668,7 +720,7 @@ D.py:712:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 709 709 | 710 710 | 711 711 | def retain_extra_whitespace_not_overindented(): @@ -679,6 +731,8 @@ D.py:712:5: D213 [*] Multi-line docstring summary should start at the second lin 714 715 | This is not overindented 715 716 | This is overindented, but since one line is not overindented this should not raise + Run `ruff check --fix` to apply this fix. + D.py:721:5: D213 [*] Multi-line docstring summary should start at the second line | 720 | def inconsistent_indent_byte_size(): @@ -691,7 +745,7 @@ D.py:721:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -ℹ Safe fix +Suggested fix: 718 718 | 719 719 | 720 720 | def inconsistent_indent_byte_size(): @@ -702,4 +756,4 @@ D.py:721:5: D213 [*] Multi-line docstring summary should start at the second lin 723 724 |     Returns: 724 725 | """ - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_D214_module.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_D214_module.py.snap index c95abffdad67b..bb5960fc2d15a 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_D214_module.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_D214_module.py.snap @@ -12,7 +12,7 @@ D214_module.py:3:5: D214 [*] Section is over-indented ("Returns") | = help: Remove over-indentation from "Returns" -ℹ Safe fix +Suggested fix: 1 1 | """A module docstring with D214 violations 2 2 | 3 |- Returns @@ -21,6 +21,8 @@ D214_module.py:3:5: D214 [*] Section is over-indented ("Returns") 5 5 | valid returns 6 6 | + Run `ruff check --fix` to apply this fix. + D214_module.py:7:5: D214 [*] Section is over-indented ("Args") | 5 | valid returns @@ -32,7 +34,7 @@ D214_module.py:7:5: D214 [*] Section is over-indented ("Args") | = help: Remove over-indentation from "Args" -ℹ Safe fix +Suggested fix: 4 4 | ----- 5 5 | valid returns 6 6 | @@ -41,3 +43,5 @@ D214_module.py:7:5: D214 [*] Section is over-indented ("Args") 8 8 | ----- 9 9 | valid args 10 10 | """ + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_sections.py.snap index 89f47fa2c67b6..e5a4c231e5370 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_sections.py.snap @@ -12,7 +12,7 @@ sections.py:146:9: D214 [*] Section is over-indented ("Returns") | = help: Remove over-indentation from "Returns" -ℹ Safe fix +Suggested fix: 143 143 | def section_overindented(): # noqa: D416 144 144 | """Toggle the gizmo. 145 145 | @@ -22,6 +22,8 @@ sections.py:146:9: D214 [*] Section is over-indented ("Returns") 148 148 | A value of some sort. 149 149 | + Run `ruff check --fix` to apply this fix. + sections.py:563:9: D214 [*] Section is over-indented ("Returns") | 561 | Here's a note. @@ -32,7 +34,7 @@ sections.py:563:9: D214 [*] Section is over-indented ("Returns") | = help: Remove over-indentation from "Returns" -ℹ Safe fix +Suggested fix: 560 560 | Args: 561 561 | Here's a note. 562 562 | @@ -40,4 +42,6 @@ sections.py:563:9: D214 [*] Section is over-indented ("Returns") 563 |+ Returns: 564 564 | """ 565 565 | -566 566 | +566 566 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_D215.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_D215.py.snap index b93074fda8c98..4db3eea4ce59c 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_D215.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_D215.py.snap @@ -11,9 +11,11 @@ D215.py:3:5: D215 [*] Section underline is over-indented ("TODO") | = help: Remove over-indentation from "TODO" underline -ℹ Safe fix +Suggested fix: 1 1 | """ 2 2 | TODO: 3 |- - 3 |+ 4 4 | """ + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_sections.py.snap index afbd747fbd769..9958081b070a3 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_sections.py.snap @@ -10,7 +10,7 @@ sections.py:159:9: D215 [*] Section underline is over-indented ("Returns") | = help: Remove over-indentation from "Returns" underline -ℹ Safe fix +Suggested fix: 156 156 | """Toggle the gizmo. 157 157 | 158 158 | Returns @@ -20,6 +20,8 @@ sections.py:159:9: D215 [*] Section underline is over-indented ("Returns") 161 161 | 162 162 | """ + Run `ruff check --fix` to apply this fix. + sections.py:173:9: D215 [*] Section underline is over-indented ("Returns") | 172 | Returns @@ -29,7 +31,7 @@ sections.py:173:9: D215 [*] Section underline is over-indented ("Returns") | = help: Remove over-indentation from "Returns" underline -ℹ Safe fix +Suggested fix: 170 170 | """Toggle the gizmo. 171 171 | 172 172 | Returns @@ -37,4 +39,6 @@ sections.py:173:9: D215 [*] Section underline is over-indented ("Returns") 173 |+ ------ 174 174 | """ 175 175 | -176 176 | +176 176 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap index 7f14c7fe4c8ca..8f6951b28568f 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap @@ -10,7 +10,7 @@ D.py:307:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Safe fix +Suggested fix: 304 304 | 305 305 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') 306 306 | def triple_single_quotes_raw(): @@ -20,6 +20,8 @@ D.py:307:5: D300 [*] Use triple double quotes `"""` 309 309 | 310 310 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') + Run `ruff check --fix` to apply this fix. + D.py:312:5: D300 [*] Use triple double quotes `"""` | 310 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') @@ -29,7 +31,7 @@ D.py:312:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Safe fix +Suggested fix: 309 309 | 310 310 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') 311 311 | def triple_single_quotes_raw_uppercase(): @@ -39,6 +41,8 @@ D.py:312:5: D300 [*] Use triple double quotes `"""` 314 314 | 315 315 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') + Run `ruff check --fix` to apply this fix. + D.py:317:5: D300 [*] Use triple double quotes `"""` | 315 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') @@ -48,7 +52,7 @@ D.py:317:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Safe fix +Suggested fix: 314 314 | 315 315 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') 316 316 | def single_quotes_raw(): @@ -58,6 +62,8 @@ D.py:317:5: D300 [*] Use triple double quotes `"""` 319 319 | 320 320 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') + Run `ruff check --fix` to apply this fix. + D.py:322:5: D300 [*] Use triple double quotes `"""` | 320 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') @@ -67,7 +73,7 @@ D.py:322:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Safe fix +Suggested fix: 319 319 | 320 320 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') 321 321 | def single_quotes_raw_uppercase(): @@ -77,6 +83,8 @@ D.py:322:5: D300 [*] Use triple double quotes `"""` 324 324 | 325 325 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') + Run `ruff check --fix` to apply this fix. + D.py:328:5: D300 [*] Use triple double quotes `"""` | 326 | @expect('D301: Use r""" if any backslashes in a docstring') @@ -86,7 +94,7 @@ D.py:328:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Safe fix +Suggested fix: 325 325 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') 326 326 | @expect('D301: Use r""" if any backslashes in a docstring') 327 327 | def single_quotes_raw_uppercase_backslash(): @@ -96,6 +104,8 @@ D.py:328:5: D300 [*] Use triple double quotes `"""` 330 330 | 331 331 | @expect('D301: Use r""" if any backslashes in a docstring') + Run `ruff check --fix` to apply this fix. + D.py:645:5: D300 [*] Use triple double quotes `"""` | 644 | def single_line_docstring_with_an_escaped_backslash(): @@ -108,7 +118,7 @@ D.py:645:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Safe fix +Suggested fix: 642 642 | 643 643 | 644 644 | def single_line_docstring_with_an_escaped_backslash(): @@ -120,6 +130,8 @@ D.py:645:5: D300 [*] Use triple double quotes `"""` 648 648 | class StatementOnSameLineAsDocstring: 649 649 | "After this docstring there's another statement on the same line separated by a semicolon." ; priorities=1 + Run `ruff check --fix` to apply this fix. + D.py:649:5: D300 [*] Use triple double quotes `"""` | 648 | class StatementOnSameLineAsDocstring: @@ -130,7 +142,7 @@ D.py:649:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Safe fix +Suggested fix: 646 646 | " 647 647 | 648 648 | class StatementOnSameLineAsDocstring: @@ -140,6 +152,8 @@ D.py:649:5: D300 [*] Use triple double quotes `"""` 651 651 | pass 652 652 | + Run `ruff check --fix` to apply this fix. + D.py:654:5: D300 [*] Use triple double quotes `"""` | 653 | class StatementOnSameLineAsDocstring: @@ -148,7 +162,7 @@ D.py:654:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Safe fix +Suggested fix: 651 651 | pass 652 652 | 653 653 | class StatementOnSameLineAsDocstring: @@ -158,6 +172,8 @@ D.py:654:5: D300 [*] Use triple double quotes `"""` 656 656 | 657 657 | class CommentAfterDocstring: + Run `ruff check --fix` to apply this fix. + D.py:658:5: D300 [*] Use triple double quotes `"""` | 657 | class CommentAfterDocstring: @@ -168,7 +184,7 @@ D.py:658:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Safe fix +Suggested fix: 655 655 | 656 656 | 657 657 | class CommentAfterDocstring: @@ -178,6 +194,8 @@ D.py:658:5: D300 [*] Use triple double quotes `"""` 660 660 | pass 661 661 | + Run `ruff check --fix` to apply this fix. + D.py:664:5: D300 [*] Use triple double quotes `"""` | 663 | def newline_after_closing_quote(self): @@ -188,7 +206,7 @@ D.py:664:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Safe fix +Suggested fix: 661 661 | 662 662 | 663 663 | def newline_after_closing_quote(self): @@ -200,4 +218,4 @@ D.py:664:5: D300 [*] Use triple double quotes `"""` 667 667 | 668 668 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap index 2e3fedcf3d496..eb0bdbd320c51 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap @@ -17,7 +17,7 @@ D300.py:10:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Safe fix +Suggested fix: 7 7 | 8 8 | 9 9 | def contains_quote(): @@ -27,4 +27,4 @@ D300.py:10:5: D300 [*] Use triple double quotes `"""` 12 12 | 13 13 | # OK - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.py.snap index 8c21aeac86c68..b101454b81747 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.py.snap @@ -10,7 +10,7 @@ D.py:333:5: D301 [*] Use `r"""` if any backslashes in a docstring | = help: Add `r` prefix -ℹ Unsafe fix +Suggested fix: 330 330 | 331 331 | @expect('D301: Use r""" if any backslashes in a docstring') 332 332 | def double_quotes_backslash(): @@ -20,4 +20,4 @@ D.py:333:5: D301 [*] Use `r"""` if any backslashes in a docstring 335 335 | 336 336 | @expect('D301: Use r""" if any backslashes in a docstring') - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D301.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D301.py.snap index 2d729186933d7..7333e055a6640 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D301.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D301.py.snap @@ -9,7 +9,7 @@ D301.py:2:5: D301 [*] Use `r"""` if any backslashes in a docstring | = help: Add `r` prefix -ℹ Unsafe fix +Suggested fix: 1 1 | def double_quotes_backslash(): 2 |- """Sum\\mary.""" 2 |+ r"""Sum\\mary.""" @@ -17,6 +17,8 @@ D301.py:2:5: D301 [*] Use `r"""` if any backslashes in a docstring 4 4 | 5 5 | def double_quotes_backslash_raw(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D301.py:37:5: D301 Use `r"""` if any backslashes in a docstring | 36 | def shouldnt_add_raw_here2(): @@ -36,7 +38,7 @@ D301.py:93:5: D301 [*] Use `r"""` if any backslashes in a docstring | = help: Add `r` prefix -ℹ Unsafe fix +Suggested fix: 90 90 | 91 91 | 92 92 | def should_add_raw_for_single_double_quote_escape(): @@ -46,6 +48,8 @@ D301.py:93:5: D301 [*] Use `r"""` if any backslashes in a docstring 95 95 | """ 96 96 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D301.py:99:5: D301 [*] Use `r"""` if any backslashes in a docstring | 98 | def should_add_raw_for_single_single_quote_escape(): @@ -57,7 +61,7 @@ D301.py:99:5: D301 [*] Use `r"""` if any backslashes in a docstring | = help: Add `r` prefix -ℹ Unsafe fix +Suggested fix: 96 96 | 97 97 | 98 98 | def should_add_raw_for_single_single_quote_escape(): @@ -65,3 +69,5 @@ D301.py:99:5: D301 [*] Use `r"""` if any backslashes in a docstring 99 |+ r''' 100 100 | This is single quote escape \'. 101 101 | ''' + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap index aacdb3584bcfe..7cab5b122a5d3 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap @@ -10,7 +10,7 @@ D.py:355:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 352 352 | @expect("D415: First line should end with a period, question mark, " 353 353 | "or exclamation point (not 'y')") 354 354 | def lwnlkjl(): @@ -20,6 +20,8 @@ D.py:355:5: D400 [*] First line should end with a period 357 357 | 358 358 | @expect("D401: First line should be in imperative mood " + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:406:25: D400 [*] First line should end with a period | 404 | @expect("D415: First line should end with a period, question mark," @@ -29,7 +31,7 @@ D.py:406:25: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 403 403 | @expect("D400: First line should end with a period (not 'r')") 404 404 | @expect("D415: First line should end with a period, question mark," 405 405 | " or exclamation point (not 'r')") @@ -39,6 +41,8 @@ D.py:406:25: D400 [*] First line should end with a period 408 408 | 409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:410:5: D400 [*] First line should end with a period | 409 | def ignored_decorator(func): # noqa: D400,D401,D415 @@ -49,7 +53,7 @@ D.py:410:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 407 407 | 408 408 | 409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 @@ -59,6 +63,8 @@ D.py:410:5: D400 [*] First line should end with a period 412 412 | pass 413 413 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:416:5: D400 [*] First line should end with a period | 415 | def decorator_for_test(func): # noqa: D400,D401,D415 @@ -69,7 +75,7 @@ D.py:416:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 413 413 | 414 414 | 415 415 | def decorator_for_test(func): # noqa: D400,D401,D415 @@ -79,6 +85,8 @@ D.py:416:5: D400 [*] First line should end with a period 418 418 | pass 419 419 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:422:35: D400 [*] First line should end with a period | 421 | @ignored_decorator @@ -87,7 +95,7 @@ D.py:422:35: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 419 419 | 420 420 | 421 421 | @ignored_decorator @@ -97,6 +105,8 @@ D.py:422:35: D400 [*] First line should end with a period 424 424 | 425 425 | @decorator_for_test + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:429:49: D400 [*] First line should end with a period | 427 | @expect("D415: First line should end with a period, question mark," @@ -106,7 +116,7 @@ D.py:429:49: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 426 426 | @expect("D400: First line should end with a period (not 'r')") 427 427 | @expect("D415: First line should end with a period, question mark," 428 428 | " or exclamation point (not 'r')") @@ -116,6 +126,8 @@ D.py:429:49: D400 [*] First line should end with a period 431 431 | 432 432 | @decorator_for_test + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:470:5: D400 [*] First line should end with a period | 468 | "or exclamation point (not 'g')") @@ -126,7 +138,7 @@ D.py:470:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 467 467 | @expect("D415: First line should end with a period, question mark, " 468 468 | "or exclamation point (not 'g')") 469 469 | def docstring_bad(): @@ -136,6 +148,8 @@ D.py:470:5: D400 [*] First line should end with a period 472 472 | 473 473 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:475:5: D400 [*] First line should end with a period | 474 | def docstring_bad_ignore_all(): # noqa @@ -145,7 +159,7 @@ D.py:475:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 472 472 | 473 473 | 474 474 | def docstring_bad_ignore_all(): # noqa @@ -155,6 +169,8 @@ D.py:475:5: D400 [*] First line should end with a period 477 477 | 478 478 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:480:5: D400 [*] First line should end with a period | 479 | def docstring_bad_ignore_one(): # noqa: D400,D401,D415 @@ -164,7 +180,7 @@ D.py:480:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 477 477 | 478 478 | 479 479 | def docstring_bad_ignore_one(): # noqa: D400,D401,D415 @@ -174,6 +190,8 @@ D.py:480:5: D400 [*] First line should end with a period 482 482 | 483 483 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:487:5: D400 [*] First line should end with a period | 485 | "(perhaps 'Run', not 'Runs')") @@ -184,7 +202,7 @@ D.py:487:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 484 484 | @expect("D401: First line should be in imperative mood " 485 485 | "(perhaps 'Run', not 'Runs')") 486 486 | def docstring_ignore_some_violations_but_catch_D401(): # noqa: E501,D400,D415 @@ -194,6 +212,8 @@ D.py:487:5: D400 [*] First line should end with a period 489 489 | 490 490 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:514:5: D400 [*] First line should end with a period | 513 | def valid_google_string(): # noqa: D400 @@ -202,7 +222,7 @@ D.py:514:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 511 511 | 512 512 | 513 513 | def valid_google_string(): # noqa: D400 @@ -212,6 +232,8 @@ D.py:514:5: D400 [*] First line should end with a period 516 516 | 517 517 | @expect("D415: First line should end with a period, question mark, " + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:520:5: D400 [*] First line should end with a period | 518 | "or exclamation point (not 'g')") @@ -221,7 +243,7 @@ D.py:520:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 517 517 | @expect("D415: First line should end with a period, question mark, " 518 518 | "or exclamation point (not 'g')") 519 519 | def bad_google_string(): # noqa: D400 @@ -231,6 +253,8 @@ D.py:520:5: D400 [*] First line should end with a period 522 522 | 523 523 | # This is reproducing a bug where AttributeError is raised when parsing class + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:581:5: D400 [*] First line should end with a period | 579 | "or exclamation point (not '\"')") @@ -240,7 +264,7 @@ D.py:581:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 578 578 | @expect("D415: First line should end with a period, question mark, " 579 579 | "or exclamation point (not '\"')") 580 580 | def endswith_quote(): @@ -250,6 +274,8 @@ D.py:581:5: D400 [*] First line should end with a period 583 583 | 584 584 | @expect('D209: Multi-line docstring closing quotes should be on a separate ' + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:615:5: D400 [*] First line should end with a period | 613 | @expect('D212: Multi-line docstring summary should start at the first line') @@ -262,7 +288,7 @@ D.py:615:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 612 612 | '(found 3)') 613 613 | @expect('D212: Multi-line docstring summary should start at the first line') 614 614 | def one_liner(): @@ -272,6 +298,8 @@ D.py:615:5: D400 [*] First line should end with a period 617 617 | """ 618 618 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:639:17: D400 [*] First line should end with a period | 639 | class SameLine: """This is a docstring on the same line""" @@ -281,7 +309,7 @@ D.py:639:17: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 636 636 | """ This is a docstring that starts with a space.""" # noqa: D210 637 637 | 638 638 | @@ -291,6 +319,8 @@ D.py:639:17: D400 [*] First line should end with a period 641 641 | def same_line(): """This is a docstring on the same line""" 642 642 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:641:18: D400 [*] First line should end with a period | 639 | class SameLine: """This is a docstring on the same line""" @@ -300,7 +330,7 @@ D.py:641:18: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 638 638 | 639 639 | class SameLine: """This is a docstring on the same line""" 640 640 | @@ -310,6 +340,8 @@ D.py:641:18: D400 [*] First line should end with a period 643 643 | 644 644 | def single_line_docstring_with_an_escaped_backslash(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:664:5: D400 [*] First line should end with a period | 663 | def newline_after_closing_quote(self): @@ -320,7 +352,7 @@ D.py:664:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 662 662 | 663 663 | def newline_after_closing_quote(self): 664 664 | "We enforce a newline after the closing quote for a multi-line docstring \ @@ -330,4 +362,4 @@ D.py:664:5: D400 [*] First line should end with a period 667 667 | 668 668 | - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap index f7a9059cce9bd..5ff0896f71448 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap @@ -10,7 +10,7 @@ D400.py:2:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 1 1 | def f(): 2 |- "Here's a line without a period" 2 |+ "Here's a line without a period." @@ -18,6 +18,8 @@ D400.py:2:5: D400 [*] First line should end with a period 4 4 | 5 5 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D400.py:7:5: D400 [*] First line should end with a period | 6 | def f(): @@ -27,7 +29,7 @@ D400.py:7:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 4 4 | 5 5 | 6 6 | def f(): @@ -37,6 +39,8 @@ D400.py:7:5: D400 [*] First line should end with a period 9 9 | 10 10 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D400.py:12:5: D400 [*] First line should end with a period | 11 | def f(): @@ -50,7 +54,7 @@ D400.py:12:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 11 11 | def f(): 12 12 | """ 13 13 | Here's a line without a period, @@ -60,6 +64,8 @@ D400.py:12:5: D400 [*] First line should end with a period 16 16 | ... 17 17 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D400.py:20:5: D400 [*] First line should end with a period | 19 | def f(): @@ -69,7 +75,7 @@ D400.py:20:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 17 17 | 18 18 | 19 19 | def f(): @@ -79,6 +85,8 @@ D400.py:20:5: D400 [*] First line should end with a period 22 22 | 23 23 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D400.py:25:5: D400 [*] First line should end with a period | 24 | def f(): @@ -91,7 +99,7 @@ D400.py:25:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 24 24 | def f(): 25 25 | """ 26 26 | Here's a line without a period, @@ -101,6 +109,8 @@ D400.py:25:5: D400 [*] First line should end with a period 29 29 | 30 30 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D400.py:32:5: D400 [*] First line should end with a period | 31 | def f(): @@ -113,7 +123,7 @@ D400.py:32:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 31 31 | def f(): 32 32 | """ 33 33 | Here's a line without a period, @@ -123,6 +133,8 @@ D400.py:32:5: D400 [*] First line should end with a period 36 36 | 37 37 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D400.py:39:5: D400 [*] First line should end with a period | 38 | def f(): @@ -132,7 +144,7 @@ D400.py:39:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 36 36 | 37 37 | 38 38 | def f(): @@ -142,6 +154,8 @@ D400.py:39:5: D400 [*] First line should end with a period 41 41 | 42 42 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D400.py:44:5: D400 [*] First line should end with a period | 43 | def f(): @@ -151,7 +165,7 @@ D400.py:44:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 41 41 | 42 42 | 43 43 | def f(): @@ -161,6 +175,8 @@ D400.py:44:5: D400 [*] First line should end with a period 46 46 | 47 47 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D400.py:49:5: D400 [*] First line should end with a period | 48 | def f(): @@ -174,7 +190,7 @@ D400.py:49:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 48 48 | def f(): 49 49 | r""" 50 50 | Here's a line without a period, @@ -184,6 +200,8 @@ D400.py:49:5: D400 [*] First line should end with a period 53 53 | ... 54 54 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D400.py:57:5: D400 [*] First line should end with a period | 56 | def f(): @@ -193,7 +211,7 @@ D400.py:57:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 54 54 | 55 55 | 56 56 | def f(): @@ -203,6 +221,8 @@ D400.py:57:5: D400 [*] First line should end with a period 59 59 | 60 60 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D400.py:62:5: D400 [*] First line should end with a period | 61 | def f(): @@ -215,7 +235,7 @@ D400.py:62:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 61 61 | def f(): 62 62 | r""" 63 63 | Here's a line without a period, @@ -225,6 +245,8 @@ D400.py:62:5: D400 [*] First line should end with a period 66 66 | 67 67 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D400.py:69:5: D400 [*] First line should end with a period | 68 | def f(): @@ -237,7 +259,7 @@ D400.py:69:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 68 68 | def f(): 69 69 | r""" 70 70 | Here's a line without a period, @@ -247,6 +269,8 @@ D400.py:69:5: D400 [*] First line should end with a period 73 73 | 74 74 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D400.py:97:5: D400 [*] First line should end with a period | 96 | def f(): @@ -261,7 +285,7 @@ D400.py:97:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 95 95 | 96 96 | def f(): 97 97 | """ @@ -271,4 +295,4 @@ D400.py:97:5: D400 [*] First line should end with a period 100 100 | 101 101 | My example explanation - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D403_D403.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D403_D403.py.snap index 07a0589fb11fc..34c9897b9f9dc 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D403_D403.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D403_D403.py.snap @@ -11,7 +11,7 @@ D403.py:2:5: D403 [*] First word of the first line should be capitalized: `this` | = help: Capitalize `this` to `This` -ℹ Safe fix +Suggested fix: 1 1 | def bad_function(): 2 |- """this docstring is not capitalized""" 2 |+ """This docstring is not capitalized""" @@ -19,6 +19,8 @@ D403.py:2:5: D403 [*] First word of the first line should be capitalized: `this` 4 4 | def good_function(): 5 5 | """This docstring is capitalized.""" + Run `ruff check --fix` to apply this fix. + D403.py:30:5: D403 [*] First word of the first line should be capitalized: `singleword` -> `Singleword` | 29 | def single_word(): @@ -29,7 +31,7 @@ D403.py:30:5: D403 [*] First word of the first line should be capitalized: `sing | = help: Capitalize `singleword` to `Singleword` -ℹ Safe fix +Suggested fix: 27 27 | """th•s is not capitalized.""" 28 28 | 29 29 | def single_word(): @@ -39,6 +41,8 @@ D403.py:30:5: D403 [*] First word of the first line should be capitalized: `sing 32 32 | def single_word_no_dot(): 33 33 | """singleword""" + Run `ruff check --fix` to apply this fix. + D403.py:33:5: D403 [*] First word of the first line should be capitalized: `singleword` -> `Singleword` | 32 | def single_word_no_dot(): @@ -47,9 +51,11 @@ D403.py:33:5: D403 [*] First word of the first line should be capitalized: `sing | = help: Capitalize `singleword` to `Singleword` -ℹ Safe fix +Suggested fix: 30 30 | """singleword.""" 31 31 | 32 32 | def single_word_no_dot(): 33 |- """singleword""" 33 |+ """Singleword""" + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D405_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D405_sections.py.snap index 2aff3caaa0427..61e2b39889f5f 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D405_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D405_sections.py.snap @@ -12,7 +12,7 @@ sections.py:19:5: D405 [*] Section name should be properly capitalized ("returns | = help: Capitalize "returns" -ℹ Safe fix +Suggested fix: 16 16 | def not_capitalized(): # noqa: D416 17 17 | """Toggle the gizmo. 18 18 | @@ -22,6 +22,8 @@ sections.py:19:5: D405 [*] Section name should be properly capitalized ("returns 21 21 | A value of some sort. 22 22 | + Run `ruff check --fix` to apply this fix. + sections.py:218:5: D405 [*] Section name should be properly capitalized ("Short summary") | 216 | """Toggle the gizmo. @@ -32,7 +34,7 @@ sections.py:218:5: D405 [*] Section name should be properly capitalized ("Short | = help: Capitalize "Short summary" -ℹ Safe fix +Suggested fix: 215 215 | def multiple_sections(): # noqa: D416 216 216 | """Toggle the gizmo. 217 217 | @@ -41,3 +43,5 @@ sections.py:218:5: D405 [*] Section name should be properly capitalized ("Short 219 219 | ------------- 220 220 | 221 221 | This is the function's description, which will also specify what it + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D406_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D406_sections.py.snap index b64a36dc51e68..5e22d4fe73007 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D406_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D406_sections.py.snap @@ -12,7 +12,7 @@ sections.py:32:5: D406 [*] Section name should end with a newline ("Returns") | = help: Add newline after "Returns" -ℹ Safe fix +Suggested fix: 29 29 | def superfluous_suffix(): # noqa: D416 30 30 | """Toggle the gizmo. 31 31 | @@ -22,6 +22,8 @@ sections.py:32:5: D406 [*] Section name should end with a newline ("Returns") 34 34 | A value of some sort. 35 35 | + Run `ruff check --fix` to apply this fix. + sections.py:227:5: D406 [*] Section name should end with a newline ("Raises") | 225 | ------ @@ -32,7 +34,7 @@ sections.py:227:5: D406 [*] Section name should end with a newline ("Raises") | = help: Add newline after "Raises" -ℹ Safe fix +Suggested fix: 224 224 | Returns 225 225 | ------ 226 226 | Many many wonderful things. @@ -42,6 +44,8 @@ sections.py:227:5: D406 [*] Section name should end with a newline ("Raises") 229 229 | 230 230 | """ + Run `ruff check --fix` to apply this fix. + sections.py:590:5: D406 [*] Section name should end with a newline ("Parameters") | 588 | """Test that lower case subsection header is valid even if it has the same name as section kind. @@ -53,7 +57,7 @@ sections.py:590:5: D406 [*] Section name should end with a newline ("Parameters" | = help: Add newline after "Parameters" -ℹ Safe fix +Suggested fix: 587 587 | def test_lowercase_sub_section_header_should_be_valid(parameters: list[str], value: int): # noqa: D213 588 588 | """Test that lower case subsection header is valid even if it has the same name as section kind. 589 589 | @@ -62,3 +66,5 @@ sections.py:590:5: D406 [*] Section name should end with a newline ("Parameters" 591 591 | ---------- 592 592 | parameters: 593 593 | A list of string parameters + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D407_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D407_sections.py.snap index 61fe5b4c6da24..6f6ce5e78a2b9 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D407_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D407_sections.py.snap @@ -11,7 +11,7 @@ sections.py:44:5: D407 [*] Missing dashed underline after section ("Returns") | = help: Add dashed line under "Returns" -ℹ Safe fix +Suggested fix: 42 42 | """Toggle the gizmo. 43 43 | 44 44 | Returns @@ -20,6 +20,8 @@ sections.py:44:5: D407 [*] Missing dashed underline after section ("Returns") 46 47 | 47 48 | """ + Run `ruff check --fix` to apply this fix. + sections.py:56:5: D407 [*] Missing dashed underline after section ("Returns") | 54 | """Toggle the gizmo. @@ -31,7 +33,7 @@ sections.py:56:5: D407 [*] Missing dashed underline after section ("Returns") | = help: Add dashed line under "Returns" -ℹ Safe fix +Suggested fix: 54 54 | """Toggle the gizmo. 55 55 | 56 56 | Returns @@ -40,6 +42,8 @@ sections.py:56:5: D407 [*] Missing dashed underline after section ("Returns") 58 59 | """ 59 60 | + Run `ruff check --fix` to apply this fix. + sections.py:67:5: D407 [*] Missing dashed underline after section ("Returns") | 65 | """Toggle the gizmo. @@ -49,7 +53,7 @@ sections.py:67:5: D407 [*] Missing dashed underline after section ("Returns") | = help: Add dashed line under "Returns" -ℹ Safe fix +Suggested fix: 64 64 | def no_underline_and_no_newline(): # noqa: D416 65 65 | """Toggle the gizmo. 66 66 | @@ -60,6 +64,8 @@ sections.py:67:5: D407 [*] Missing dashed underline after section ("Returns") 69 70 | 70 71 | @expect(_D213) + Run `ruff check --fix` to apply this fix. + sections.py:227:5: D407 [*] Missing dashed underline after section ("Raises") | 225 | ------ @@ -70,7 +76,7 @@ sections.py:227:5: D407 [*] Missing dashed underline after section ("Raises") | = help: Add dashed line under "Raises" -ℹ Safe fix +Suggested fix: 225 225 | ------ 226 226 | Many many wonderful things. 227 227 | Raises: @@ -79,6 +85,8 @@ sections.py:227:5: D407 [*] Missing dashed underline after section ("Raises") 229 230 | 230 231 | """ + Run `ruff check --fix` to apply this fix. + sections.py:263:5: D407 [*] Missing dashed underline after section ("Args") | 261 | """Toggle the gizmo. @@ -89,7 +97,7 @@ sections.py:263:5: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Safe fix +Suggested fix: 261 261 | """Toggle the gizmo. 262 262 | 263 263 | Args: @@ -98,6 +106,8 @@ sections.py:263:5: D407 [*] Missing dashed underline after section ("Args") 265 266 | 266 267 | Returns: + Run `ruff check --fix` to apply this fix. + sections.py:266:5: D407 [*] Missing dashed underline after section ("Returns") | 264 | note: A random string. @@ -109,7 +119,7 @@ sections.py:266:5: D407 [*] Missing dashed underline after section ("Returns") | = help: Add dashed line under "Returns" -ℹ Safe fix +Suggested fix: 264 264 | note: A random string. 265 265 | 266 266 | Returns: @@ -118,6 +128,8 @@ sections.py:266:5: D407 [*] Missing dashed underline after section ("Returns") 268 269 | Raises: 269 270 | RandomError: A random error that occurs randomly. + Run `ruff check --fix` to apply this fix. + sections.py:268:5: D407 [*] Missing dashed underline after section ("Raises") | 266 | Returns: @@ -128,7 +140,7 @@ sections.py:268:5: D407 [*] Missing dashed underline after section ("Raises") | = help: Add dashed line under "Raises" -ℹ Safe fix +Suggested fix: 266 266 | Returns: 267 267 | 268 268 | Raises: @@ -137,6 +149,8 @@ sections.py:268:5: D407 [*] Missing dashed underline after section ("Raises") 270 271 | 271 272 | """ + Run `ruff check --fix` to apply this fix. + sections.py:280:5: D407 [*] Missing dashed underline after section ("Args") | 278 | """Toggle the gizmo. @@ -147,7 +161,7 @@ sections.py:280:5: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Safe fix +Suggested fix: 278 278 | """Toggle the gizmo. 279 279 | 280 280 | Args @@ -156,6 +170,8 @@ sections.py:280:5: D407 [*] Missing dashed underline after section ("Args") 282 283 | 283 284 | """ + Run `ruff check --fix` to apply this fix. + sections.py:297:9: D407 [*] Missing dashed underline after section ("Args") | 295 | Will this work when referencing x? @@ -167,7 +183,7 @@ sections.py:297:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Safe fix +Suggested fix: 295 295 | Will this work when referencing x? 296 296 | 297 297 | Args: @@ -176,6 +192,8 @@ sections.py:297:9: D407 [*] Missing dashed underline after section ("Args") 299 300 | that is broken. 300 301 | + Run `ruff check --fix` to apply this fix. + sections.py:312:5: D407 [*] Missing dashed underline after section ("Args") | 310 | """Toggle the gizmo. @@ -186,7 +204,7 @@ sections.py:312:5: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Safe fix +Suggested fix: 310 310 | """Toggle the gizmo. 311 311 | 312 312 | Args: @@ -195,6 +213,8 @@ sections.py:312:5: D407 [*] Missing dashed underline after section ("Args") 314 315 | 315 316 | """ + Run `ruff check --fix` to apply this fix. + sections.py:324:9: D407 [*] Missing dashed underline after section ("Args") | 322 | """Test a valid args section. @@ -206,7 +226,7 @@ sections.py:324:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Safe fix +Suggested fix: 322 322 | """Test a valid args section. 323 323 | 324 324 | Args: @@ -215,6 +235,8 @@ sections.py:324:9: D407 [*] Missing dashed underline after section ("Args") 326 327 | another_test: Another parameter. 327 328 | + Run `ruff check --fix` to apply this fix. + sections.py:336:9: D407 [*] Missing dashed underline after section ("Args") | 334 | """Test a valid args section. @@ -225,7 +247,7 @@ sections.py:336:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Safe fix +Suggested fix: 334 334 | """Test a valid args section. 335 335 | 336 336 | Args: @@ -234,6 +256,8 @@ sections.py:336:9: D407 [*] Missing dashed underline after section ("Args") 338 339 | 339 340 | """ + Run `ruff check --fix` to apply this fix. + sections.py:348:9: D407 [*] Missing dashed underline after section ("Args") | 346 | """Test a valid args section. @@ -245,7 +269,7 @@ sections.py:348:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Safe fix +Suggested fix: 346 346 | """Test a valid args section. 347 347 | 348 348 | Args: @@ -254,6 +278,8 @@ sections.py:348:9: D407 [*] Missing dashed underline after section ("Args") 350 351 | y: 351 352 | + Run `ruff check --fix` to apply this fix. + sections.py:361:9: D407 [*] Missing dashed underline after section ("Args") | 359 | """Test a valid args section. @@ -264,7 +290,7 @@ sections.py:361:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Safe fix +Suggested fix: 359 359 | """Test a valid args section. 360 360 | 361 361 | Args: @@ -273,6 +299,8 @@ sections.py:361:9: D407 [*] Missing dashed underline after section ("Args") 363 364 | 364 365 | """ + Run `ruff check --fix` to apply this fix. + sections.py:373:9: D407 [*] Missing dashed underline after section ("Args") | 371 | """Test a valid args section. @@ -283,7 +311,7 @@ sections.py:373:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Safe fix +Suggested fix: 371 371 | """Test a valid args section. 372 372 | 373 373 | Args: @@ -292,6 +320,8 @@ sections.py:373:9: D407 [*] Missing dashed underline after section ("Args") 375 376 | 376 377 | """ + Run `ruff check --fix` to apply this fix. + sections.py:382:9: D407 [*] Missing dashed underline after section ("Args") | 380 | """Do stuff. @@ -303,7 +333,7 @@ sections.py:382:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Safe fix +Suggested fix: 380 380 | """Do stuff. 381 381 | 382 382 | Args: @@ -312,6 +342,8 @@ sections.py:382:9: D407 [*] Missing dashed underline after section ("Args") 384 385 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. 385 386 | Etiam at tellus a tellus faucibus maximus. Curabitur tellus + Run `ruff check --fix` to apply this fix. + sections.py:503:9: D407 [*] Missing dashed underline after section ("Args") | 501 | Testing this incorrectly indented docstring. @@ -322,7 +354,7 @@ sections.py:503:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Safe fix +Suggested fix: 501 501 | Testing this incorrectly indented docstring. 502 502 | 503 503 | Args: @@ -331,6 +363,8 @@ sections.py:503:9: D407 [*] Missing dashed underline after section ("Args") 505 506 | 506 507 | """ + Run `ruff check --fix` to apply this fix. + sections.py:522:5: D407 [*] Missing dashed underline after section ("Parameters") | 521 | Parameters @@ -340,7 +374,7 @@ sections.py:522:5: D407 [*] Missing dashed underline after section ("Parameters" | = help: Add dashed line under "Parameters" -ℹ Safe fix +Suggested fix: 519 519 | """Equal length equals should be replaced with dashes. 520 520 | 521 521 | Parameters @@ -350,6 +384,8 @@ sections.py:522:5: D407 [*] Missing dashed underline after section ("Parameters" 524 524 | 525 525 | + Run `ruff check --fix` to apply this fix. + sections.py:530:5: D407 [*] Missing dashed underline after section ("Parameters") | 529 | Parameters @@ -359,7 +395,7 @@ sections.py:530:5: D407 [*] Missing dashed underline after section ("Parameters" | = help: Add dashed line under "Parameters" -ℹ Safe fix +Suggested fix: 527 527 | """Here, the length of equals is not the same. 528 528 | 529 529 | Parameters @@ -369,6 +405,8 @@ sections.py:530:5: D407 [*] Missing dashed underline after section ("Parameters" 532 532 | 533 533 | + Run `ruff check --fix` to apply this fix. + sections.py:550:5: D407 [*] Missing dashed underline after section ("Args") | 548 | """Below, `returns:` should _not_ be considered a section header. @@ -379,7 +417,7 @@ sections.py:550:5: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Safe fix +Suggested fix: 548 548 | """Below, `returns:` should _not_ be considered a section header. 549 549 | 550 550 | Args: @@ -388,6 +426,8 @@ sections.py:550:5: D407 [*] Missing dashed underline after section ("Args") 552 553 | 553 554 | returns: + Run `ruff check --fix` to apply this fix. + sections.py:560:5: D407 [*] Missing dashed underline after section ("Args") | 558 | """Below, `Returns:` should be considered a section header. @@ -398,7 +438,7 @@ sections.py:560:5: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Safe fix +Suggested fix: 558 558 | """Below, `Returns:` should be considered a section header. 559 559 | 560 560 | Args: @@ -407,6 +447,8 @@ sections.py:560:5: D407 [*] Missing dashed underline after section ("Args") 562 563 | 563 564 | Returns: + Run `ruff check --fix` to apply this fix. + sections.py:563:9: D407 [*] Missing dashed underline after section ("Returns") | 561 | Here's a note. @@ -417,7 +459,7 @@ sections.py:563:9: D407 [*] Missing dashed underline after section ("Returns") | = help: Add dashed line under "Returns" -ℹ Safe fix +Suggested fix: 561 561 | Here's a note. 562 562 | 563 563 | Returns: @@ -426,6 +468,8 @@ sections.py:563:9: D407 [*] Missing dashed underline after section ("Returns") 565 566 | 566 567 | + Run `ruff check --fix` to apply this fix. + sections.py:602:4: D407 [*] Missing dashed underline after section ("Parameters") | 600 | """Test that lower case subsection header is valid even if it is of a different kind. @@ -437,7 +481,7 @@ sections.py:602:4: D407 [*] Missing dashed underline after section ("Parameters" | = help: Add dashed line under "Parameters" -ℹ Safe fix +Suggested fix: 600 600 | """Test that lower case subsection header is valid even if it is of a different kind. 601 601 | 602 602 | Parameters @@ -445,3 +489,5 @@ sections.py:602:4: D407 [*] Missing dashed underline after section ("Parameters" 603 604 | -‐----------------- 604 605 | returns: 605 606 | some value + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D408_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D408_sections.py.snap index 38bec4612b427..e3e6037e3e1d0 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D408_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D408_sections.py.snap @@ -11,11 +11,13 @@ sections.py:98:5: D408 [*] Section underline should be in the line following the | = help: Add underline to "Returns" -ℹ Safe fix +Suggested fix: 94 94 | """Toggle the gizmo. 95 95 | 96 96 | Returns 97 |- 98 97 | ------- 99 98 | A value of some sort. -100 99 | +100 99 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D409_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D409_sections.py.snap index 1b59fad56deee..7fe772992929d 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D409_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D409_sections.py.snap @@ -10,7 +10,7 @@ sections.py:111:5: D409 [*] Section underline should match the length of its nam | = help: Adjust underline length to match "Returns" -ℹ Safe fix +Suggested fix: 108 108 | """Toggle the gizmo. 109 109 | 110 110 | Returns @@ -20,6 +20,8 @@ sections.py:111:5: D409 [*] Section underline should match the length of its nam 113 113 | 114 114 | """ + Run `ruff check --fix` to apply this fix. + sections.py:225:5: D409 [*] Section underline should match the length of its name ("Returns") | 224 | Returns @@ -30,7 +32,7 @@ sections.py:225:5: D409 [*] Section underline should match the length of its nam | = help: Adjust underline length to match "Returns" -ℹ Safe fix +Suggested fix: 222 222 | returns. 223 223 | 224 224 | Returns @@ -40,6 +42,8 @@ sections.py:225:5: D409 [*] Section underline should match the length of its nam 227 227 | Raises: 228 228 | My attention. + Run `ruff check --fix` to apply this fix. + sections.py:578:5: D409 [*] Section underline should match the length of its name ("Other Parameters") | 577 | Other Parameters @@ -50,7 +54,7 @@ sections.py:578:5: D409 [*] Section underline should match the length of its nam | = help: Adjust underline length to match "Other Parameters" -ℹ Safe fix +Suggested fix: 575 575 | A dictionary of string attributes 576 576 | 577 577 | Other Parameters @@ -59,3 +63,5 @@ sections.py:578:5: D409 [*] Section underline should match the length of its nam 579 579 | other_parameters: 580 580 | A dictionary of string attributes 581 581 | parameters: + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_D410.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_D410.py.snap index 2f7b0e4f92977..f1914505ddc36 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_D410.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_D410.py.snap @@ -12,7 +12,7 @@ D410.py:4:5: D410 [*] Missing blank line after section ("Parameters") | = help: Add blank line after "Parameters" -ℹ Safe fix +Suggested fix: 7 7 | _description_ 8 8 | b : int 9 9 | _description_ @@ -21,6 +21,8 @@ D410.py:4:5: D410 [*] Missing blank line after section ("Parameters") 11 12 | ------- 12 13 | int + Run `ruff check --fix` to apply this fix. + D410.py:21:5: D410 [*] Missing blank line after section ("Parameters") | 19 | """Showcase function. @@ -32,7 +34,7 @@ D410.py:21:5: D410 [*] Missing blank line after section ("Parameters") | = help: Add blank line after "Parameters" -ℹ Safe fix +Suggested fix: 20 20 | 21 21 | Parameters 22 22 | ---------- @@ -40,3 +42,5 @@ D410.py:21:5: D410 [*] Missing blank line after section ("Parameters") 23 24 | Returns 24 25 | ------- 25 26 | """ + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_sections.py.snap index e8c466e1387ca..4743ab09231f1 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_sections.py.snap @@ -12,7 +12,7 @@ sections.py:78:5: D410 [*] Missing blank line after section ("Returns") | = help: Add blank line after "Returns" -ℹ Safe fix +Suggested fix: 77 77 | 78 78 | Returns 79 79 | ------- @@ -21,6 +21,8 @@ sections.py:78:5: D410 [*] Missing blank line after section ("Returns") 81 82 | ------ 82 83 | + Run `ruff check --fix` to apply this fix. + sections.py:224:5: D410 [*] Missing blank line after section ("Returns") | 222 | returns. @@ -32,11 +34,13 @@ sections.py:224:5: D410 [*] Missing blank line after section ("Returns") | = help: Add blank line after "Returns" -ℹ Safe fix +Suggested fix: 224 224 | Returns 225 225 | ------ 226 226 | Many many wonderful things. 227 |+ 227 228 | Raises: 228 229 | My attention. -229 230 | +229 230 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D411_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D411_sections.py.snap index b516028f32fe3..8371223a2bb06 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D411_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D411_sections.py.snap @@ -11,7 +11,7 @@ sections.py:80:5: D411 [*] Missing blank line before section ("Yields") | = help: Add blank line before "Yields" -ℹ Safe fix +Suggested fix: 77 77 | 78 78 | Returns 79 79 | ------- @@ -20,6 +20,8 @@ sections.py:80:5: D411 [*] Missing blank line before section ("Yields") 81 82 | ------ 82 83 | + Run `ruff check --fix` to apply this fix. + sections.py:134:5: D411 [*] Missing blank line before section ("Returns") | 133 | The function's description. @@ -30,7 +32,7 @@ sections.py:134:5: D411 [*] Missing blank line before section ("Returns") | = help: Add blank line before "Returns" -ℹ Safe fix +Suggested fix: 131 131 | """Toggle the gizmo. 132 132 | 133 133 | The function's description. @@ -39,6 +41,8 @@ sections.py:134:5: D411 [*] Missing blank line before section ("Returns") 135 136 | ------- 136 137 | A value of some sort. + Run `ruff check --fix` to apply this fix. + sections.py:227:5: D411 [*] Missing blank line before section ("Raises") | 225 | ------ @@ -49,11 +53,13 @@ sections.py:227:5: D411 [*] Missing blank line before section ("Raises") | = help: Add blank line before "Raises" -ℹ Safe fix +Suggested fix: 224 224 | Returns 225 225 | ------ 226 226 | Many many wonderful things. 227 |+ 227 228 | Raises: 228 229 | My attention. -229 230 | +229 230 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sections.py.snap index a6461d2987661..45ddeccf61e0b 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sections.py.snap @@ -11,11 +11,13 @@ sections.py:218:5: D412 [*] No blank lines allowed between a section header and | = help: Remove blank line(s) -ℹ Safe fix +Suggested fix: 217 217 | 218 218 | Short summary 219 219 | ------------- 220 |- 221 220 | This is the function's description, which will also specify what it 222 221 | returns. -223 222 | +223 222 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sphinx.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sphinx.py.snap index 8c9f7c45dccad..8d0d05639e3c2 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sphinx.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sphinx.py.snap @@ -10,7 +10,7 @@ sphinx.py:13:5: D412 [*] No blank lines allowed between a section header and its | = help: Remove blank line(s) -ℹ Safe fix +Suggested fix: 12 12 | """ 13 13 | Example: 14 14 | @@ -19,6 +19,8 @@ sphinx.py:13:5: D412 [*] No blank lines allowed between a section header and its 17 16 | 18 17 | import foo + Run `ruff check --fix` to apply this fix. + sphinx.py:24:5: D412 [*] No blank lines allowed between a section header and its content ("Example") | 22 | def func(): @@ -28,7 +30,7 @@ sphinx.py:24:5: D412 [*] No blank lines allowed between a section header and its | = help: Remove blank line(s) -ℹ Safe fix +Suggested fix: 23 23 | """ 24 24 | Example: 25 25 | @@ -38,6 +40,8 @@ sphinx.py:24:5: D412 [*] No blank lines allowed between a section header and its 29 27 | 30 28 | import foo + Run `ruff check --fix` to apply this fix. + sphinx.py:47:5: D412 [*] No blank lines allowed between a section header and its content ("Example") | 45 | def func(): @@ -48,7 +52,7 @@ sphinx.py:47:5: D412 [*] No blank lines allowed between a section header and its | = help: Remove blank line(s) -ℹ Safe fix +Suggested fix: 47 47 | Example 48 48 | ------- 49 49 | @@ -57,6 +61,8 @@ sphinx.py:47:5: D412 [*] No blank lines allowed between a section header and its 52 51 | 53 52 | import foo + Run `ruff check --fix` to apply this fix. + sphinx.py:59:5: D412 [*] No blank lines allowed between a section header and its content ("Example") | 57 | def func(): @@ -67,7 +73,7 @@ sphinx.py:59:5: D412 [*] No blank lines allowed between a section header and its | = help: Remove blank line(s) -ℹ Safe fix +Suggested fix: 59 59 | Example 60 60 | ------- 61 61 | @@ -76,3 +82,5 @@ sphinx.py:59:5: D412 [*] No blank lines allowed between a section header and its 64 62 | .. code-block:: python 65 63 | 66 64 | import foo + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap index a2a831d93e752..96eb74cddffd3 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap @@ -12,7 +12,7 @@ D413.py:7:1: D413 [*] Missing blank line after last section ("Returns") | = help: Add blank line after "Returns" -ℹ Safe fix +Suggested fix: 6 6 | 7 7 | Returns: 8 8 | the value @@ -21,6 +21,8 @@ D413.py:7:1: D413 [*] Missing blank line after last section ("Returns") 10 11 | 11 12 | + Run `ruff check --fix` to apply this fix. + D413.py:19:5: D413 [*] Missing blank line after last section ("Returns") | 17 | with a hanging indent @@ -32,7 +34,7 @@ D413.py:19:5: D413 [*] Missing blank line after last section ("Returns") | = help: Add blank line after "Returns" -ℹ Safe fix +Suggested fix: 18 18 | 19 19 | Returns: 20 20 | the value @@ -41,6 +43,8 @@ D413.py:19:5: D413 [*] Missing blank line after last section ("Returns") 22 23 | 23 24 | + Run `ruff check --fix` to apply this fix. + D413.py:58:5: D413 [*] Missing blank line after last section ("Returns") | 56 | with a hanging indent @@ -51,7 +55,7 @@ D413.py:58:5: D413 [*] Missing blank line after last section ("Returns") | = help: Add blank line after "Returns" -ℹ Safe fix +Suggested fix: 56 56 | with a hanging indent 57 57 | 58 58 | Returns: @@ -63,6 +67,8 @@ D413.py:58:5: D413 [*] Missing blank line after last section ("Returns") 61 63 | 62 64 | def func(): + Run `ruff check --fix` to apply this fix. + D413.py:69:5: D413 [*] Missing blank line after last section ("Returns") | 67 | with a hanging indent @@ -74,10 +80,12 @@ D413.py:69:5: D413 [*] Missing blank line after last section ("Returns") | = help: Add blank line after "Returns" -ℹ Safe fix +Suggested fix: 68 68 | 69 69 | Returns: 70 70 | the value 71 |- """ 71 |+ 72 |+ """ + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap index 223c7c38218af..da2d033ba7000 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap @@ -10,7 +10,7 @@ sections.py:67:5: D413 [*] Missing blank line after last section ("Returns") | = help: Add blank line after "Returns" -ℹ Safe fix +Suggested fix: 64 64 | def no_underline_and_no_newline(): # noqa: D416 65 65 | """Toggle the gizmo. 66 66 | @@ -22,6 +22,8 @@ sections.py:67:5: D413 [*] Missing blank line after last section ("Returns") 69 71 | 70 72 | @expect(_D213) + Run `ruff check --fix` to apply this fix. + sections.py:122:5: D413 [*] Missing blank line after last section ("Returns") | 120 | """Toggle the gizmo. @@ -33,7 +35,7 @@ sections.py:122:5: D413 [*] Missing blank line after last section ("Returns") | = help: Add blank line after "Returns" -ℹ Safe fix +Suggested fix: 122 122 | Returns 123 123 | ------- 124 124 | A value of some sort. @@ -42,6 +44,8 @@ sections.py:122:5: D413 [*] Missing blank line after last section ("Returns") 126 127 | 127 128 | + Run `ruff check --fix` to apply this fix. + sections.py:172:5: D413 [*] Missing blank line after last section ("Returns") | 170 | """Toggle the gizmo. @@ -53,7 +57,7 @@ sections.py:172:5: D413 [*] Missing blank line after last section ("Returns") | = help: Add blank line after "Returns" -ℹ Safe fix +Suggested fix: 171 171 | 172 172 | Returns 173 173 | ------- @@ -62,6 +66,8 @@ sections.py:172:5: D413 [*] Missing blank line after last section ("Returns") 175 176 | 176 177 | + Run `ruff check --fix` to apply this fix. + sections.py:521:5: D413 [*] Missing blank line after last section ("Parameters") | 519 | """Equal length equals should be replaced with dashes. @@ -73,7 +79,7 @@ sections.py:521:5: D413 [*] Missing blank line after last section ("Parameters") | = help: Add blank line after "Parameters" -ℹ Safe fix +Suggested fix: 520 520 | 521 521 | Parameters 522 522 | ========== @@ -82,6 +88,8 @@ sections.py:521:5: D413 [*] Missing blank line after last section ("Parameters") 524 525 | 525 526 | + Run `ruff check --fix` to apply this fix. + sections.py:529:5: D413 [*] Missing blank line after last section ("Parameters") | 527 | """Here, the length of equals is not the same. @@ -93,7 +101,7 @@ sections.py:529:5: D413 [*] Missing blank line after last section ("Parameters") | = help: Add blank line after "Parameters" -ℹ Safe fix +Suggested fix: 528 528 | 529 529 | Parameters 530 530 | =========== @@ -102,6 +110,8 @@ sections.py:529:5: D413 [*] Missing blank line after last section ("Parameters") 532 533 | 533 534 | + Run `ruff check --fix` to apply this fix. + sections.py:550:5: D413 [*] Missing blank line after last section ("Args") | 548 | """Below, `returns:` should _not_ be considered a section header. @@ -112,7 +122,7 @@ sections.py:550:5: D413 [*] Missing blank line after last section ("Args") | = help: Add blank line after "Args" -ℹ Safe fix +Suggested fix: 551 551 | Here's a note. 552 552 | 553 553 | returns: @@ -121,6 +131,8 @@ sections.py:550:5: D413 [*] Missing blank line after last section ("Args") 555 556 | 556 557 | + Run `ruff check --fix` to apply this fix. + sections.py:563:9: D413 [*] Missing blank line after last section ("Returns") | 561 | Here's a note. @@ -131,7 +143,7 @@ sections.py:563:9: D413 [*] Missing blank line after last section ("Returns") | = help: Add blank line after "Returns" -ℹ Safe fix +Suggested fix: 561 561 | Here's a note. 562 562 | 563 563 | Returns: @@ -140,6 +152,8 @@ sections.py:563:9: D413 [*] Missing blank line after last section ("Returns") 565 566 | 566 567 | + Run `ruff check --fix` to apply this fix. + sections.py:590:5: D413 [*] Missing blank line after last section ("Parameters") | 588 | """Test that lower case subsection header is valid even if it has the same name as section kind. @@ -151,11 +165,13 @@ sections.py:590:5: D413 [*] Missing blank line after last section ("Parameters") | = help: Add blank line after "Parameters" -ℹ Safe fix +Suggested fix: 593 593 | A list of string parameters 594 594 | value: 595 595 | Some value 596 |+ 596 597 | """ 597 598 | -598 599 | +598 599 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap index c563e9541455a..88c2c4e777dbd 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap @@ -10,7 +10,7 @@ D.py:355:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Unsafe fix +Suggested fix: 352 352 | @expect("D415: First line should end with a period, question mark, " 353 353 | "or exclamation point (not 'y')") 354 354 | def lwnlkjl(): @@ -20,6 +20,8 @@ D.py:355:5: D415 [*] First line should end with a period, question mark, or excl 357 357 | 358 358 | @expect("D401: First line should be in imperative mood " + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:406:25: D415 [*] First line should end with a period, question mark, or exclamation point | 404 | @expect("D415: First line should end with a period, question mark," @@ -29,7 +31,7 @@ D.py:406:25: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -ℹ Unsafe fix +Suggested fix: 403 403 | @expect("D400: First line should end with a period (not 'r')") 404 404 | @expect("D415: First line should end with a period, question mark," 405 405 | " or exclamation point (not 'r')") @@ -39,6 +41,8 @@ D.py:406:25: D415 [*] First line should end with a period, question mark, or exc 408 408 | 409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:410:5: D415 [*] First line should end with a period, question mark, or exclamation point | 409 | def ignored_decorator(func): # noqa: D400,D401,D415 @@ -49,7 +53,7 @@ D.py:410:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Unsafe fix +Suggested fix: 407 407 | 408 408 | 409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 @@ -59,6 +63,8 @@ D.py:410:5: D415 [*] First line should end with a period, question mark, or excl 412 412 | pass 413 413 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:416:5: D415 [*] First line should end with a period, question mark, or exclamation point | 415 | def decorator_for_test(func): # noqa: D400,D401,D415 @@ -69,7 +75,7 @@ D.py:416:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Unsafe fix +Suggested fix: 413 413 | 414 414 | 415 415 | def decorator_for_test(func): # noqa: D400,D401,D415 @@ -79,6 +85,8 @@ D.py:416:5: D415 [*] First line should end with a period, question mark, or excl 418 418 | pass 419 419 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:422:35: D415 [*] First line should end with a period, question mark, or exclamation point | 421 | @ignored_decorator @@ -87,7 +95,7 @@ D.py:422:35: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -ℹ Unsafe fix +Suggested fix: 419 419 | 420 420 | 421 421 | @ignored_decorator @@ -97,6 +105,8 @@ D.py:422:35: D415 [*] First line should end with a period, question mark, or exc 424 424 | 425 425 | @decorator_for_test + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:429:49: D415 [*] First line should end with a period, question mark, or exclamation point | 427 | @expect("D415: First line should end with a period, question mark," @@ -106,7 +116,7 @@ D.py:429:49: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -ℹ Unsafe fix +Suggested fix: 426 426 | @expect("D400: First line should end with a period (not 'r')") 427 427 | @expect("D415: First line should end with a period, question mark," 428 428 | " or exclamation point (not 'r')") @@ -116,6 +126,8 @@ D.py:429:49: D415 [*] First line should end with a period, question mark, or exc 431 431 | 432 432 | @decorator_for_test + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:470:5: D415 [*] First line should end with a period, question mark, or exclamation point | 468 | "or exclamation point (not 'g')") @@ -126,7 +138,7 @@ D.py:470:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Unsafe fix +Suggested fix: 467 467 | @expect("D415: First line should end with a period, question mark, " 468 468 | "or exclamation point (not 'g')") 469 469 | def docstring_bad(): @@ -136,6 +148,8 @@ D.py:470:5: D415 [*] First line should end with a period, question mark, or excl 472 472 | 473 473 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:475:5: D415 [*] First line should end with a period, question mark, or exclamation point | 474 | def docstring_bad_ignore_all(): # noqa @@ -145,7 +159,7 @@ D.py:475:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Unsafe fix +Suggested fix: 472 472 | 473 473 | 474 474 | def docstring_bad_ignore_all(): # noqa @@ -155,6 +169,8 @@ D.py:475:5: D415 [*] First line should end with a period, question mark, or excl 477 477 | 478 478 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:480:5: D415 [*] First line should end with a period, question mark, or exclamation point | 479 | def docstring_bad_ignore_one(): # noqa: D400,D401,D415 @@ -164,7 +180,7 @@ D.py:480:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Unsafe fix +Suggested fix: 477 477 | 478 478 | 479 479 | def docstring_bad_ignore_one(): # noqa: D400,D401,D415 @@ -174,6 +190,8 @@ D.py:480:5: D415 [*] First line should end with a period, question mark, or excl 482 482 | 483 483 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:487:5: D415 [*] First line should end with a period, question mark, or exclamation point | 485 | "(perhaps 'Run', not 'Runs')") @@ -184,7 +202,7 @@ D.py:487:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Unsafe fix +Suggested fix: 484 484 | @expect("D401: First line should be in imperative mood " 485 485 | "(perhaps 'Run', not 'Runs')") 486 486 | def docstring_ignore_some_violations_but_catch_D401(): # noqa: E501,D400,D415 @@ -194,6 +212,8 @@ D.py:487:5: D415 [*] First line should end with a period, question mark, or excl 489 489 | 490 490 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:520:5: D415 [*] First line should end with a period, question mark, or exclamation point | 518 | "or exclamation point (not 'g')") @@ -203,7 +223,7 @@ D.py:520:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Unsafe fix +Suggested fix: 517 517 | @expect("D415: First line should end with a period, question mark, " 518 518 | "or exclamation point (not 'g')") 519 519 | def bad_google_string(): # noqa: D400 @@ -213,6 +233,8 @@ D.py:520:5: D415 [*] First line should end with a period, question mark, or excl 522 522 | 523 523 | # This is reproducing a bug where AttributeError is raised when parsing class + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:581:5: D415 [*] First line should end with a period, question mark, or exclamation point | 579 | "or exclamation point (not '\"')") @@ -222,7 +244,7 @@ D.py:581:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Unsafe fix +Suggested fix: 578 578 | @expect("D415: First line should end with a period, question mark, " 579 579 | "or exclamation point (not '\"')") 580 580 | def endswith_quote(): @@ -232,6 +254,8 @@ D.py:581:5: D415 [*] First line should end with a period, question mark, or excl 583 583 | 584 584 | @expect('D209: Multi-line docstring closing quotes should be on a separate ' + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:615:5: D415 [*] First line should end with a period, question mark, or exclamation point | 613 | @expect('D212: Multi-line docstring summary should start at the first line') @@ -244,7 +268,7 @@ D.py:615:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Unsafe fix +Suggested fix: 612 612 | '(found 3)') 613 613 | @expect('D212: Multi-line docstring summary should start at the first line') 614 614 | def one_liner(): @@ -254,6 +278,8 @@ D.py:615:5: D415 [*] First line should end with a period, question mark, or excl 617 617 | """ 618 618 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:639:17: D415 [*] First line should end with a period, question mark, or exclamation point | 639 | class SameLine: """This is a docstring on the same line""" @@ -263,7 +289,7 @@ D.py:639:17: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -ℹ Unsafe fix +Suggested fix: 636 636 | """ This is a docstring that starts with a space.""" # noqa: D210 637 637 | 638 638 | @@ -273,6 +299,8 @@ D.py:639:17: D415 [*] First line should end with a period, question mark, or exc 641 641 | def same_line(): """This is a docstring on the same line""" 642 642 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:641:18: D415 [*] First line should end with a period, question mark, or exclamation point | 639 | class SameLine: """This is a docstring on the same line""" @@ -282,7 +310,7 @@ D.py:641:18: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -ℹ Unsafe fix +Suggested fix: 638 638 | 639 639 | class SameLine: """This is a docstring on the same line""" 640 640 | @@ -292,6 +320,8 @@ D.py:641:18: D415 [*] First line should end with a period, question mark, or exc 643 643 | 644 644 | def single_line_docstring_with_an_escaped_backslash(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + D.py:664:5: D415 [*] First line should end with a period, question mark, or exclamation point | 663 | def newline_after_closing_quote(self): @@ -302,7 +332,7 @@ D.py:664:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Unsafe fix +Suggested fix: 662 662 | 663 663 | def newline_after_closing_quote(self): 664 664 | "We enforce a newline after the closing quote for a multi-line docstring \ @@ -312,4 +342,4 @@ D.py:664:5: D415 [*] First line should end with a period, question mark, or excl 667 667 | 668 668 | - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap index bf80e65243b0c..81b0ff61f40ec 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap @@ -8,8 +8,8 @@ bom.py:1:1: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Safe fix +Suggested fix: 1 |-''' SAM macro definitions ''' 1 |+""" SAM macro definitions """ - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap index 02a19f057d2c5..eef6ed5e461ce 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap @@ -11,13 +11,15 @@ D209_D400.py:2:5: D209 [*] Multi-line docstring closing quotes should be on a se | = help: Move closing quotes to new line -ℹ Safe fix +Suggested fix: 1 1 | def lorem(): 2 2 | """lorem ipsum dolor sit amet consectetur adipiscing elit 3 |- sed do eiusmod tempor incididunt ut labore et dolore magna aliqua""" 3 |+ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua 4 |+ """ + Run `ruff check --fix` to apply this fix. + D209_D400.py:2:5: D400 [*] First line should end with a period | 1 | def lorem(): @@ -28,10 +30,10 @@ D209_D400.py:2:5: D400 [*] First line should end with a period | = help: Add period -ℹ Unsafe fix +Suggested fix: 1 1 | def lorem(): 2 2 | """lorem ipsum dolor sit amet consectetur adipiscing elit 3 |- sed do eiusmod tempor incididunt ut labore et dolore magna aliqua""" 3 |+ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.""" - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_0.py.snap index 433865de23481..ef08dd13aed84 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_0.py.snap @@ -11,7 +11,7 @@ F401_0.py:2:8: F401 [*] `functools` imported but unused | = help: Remove unused import: `functools` -ℹ Safe fix +Suggested fix: 1 1 | from __future__ import all_feature_names 2 |-import functools, os 2 |+import os @@ -19,6 +19,8 @@ F401_0.py:2:8: F401 [*] `functools` imported but unused 4 4 | from collections import ( 5 5 | Counter, + Run `ruff check --fix` to apply this fix. + F401_0.py:6:5: F401 [*] `collections.OrderedDict` imported but unused | 4 | from collections import ( @@ -30,7 +32,7 @@ F401_0.py:6:5: F401 [*] `collections.OrderedDict` imported but unused | = help: Remove unused import: `collections.OrderedDict` -ℹ Safe fix +Suggested fix: 3 3 | from datetime import datetime 4 4 | from collections import ( 5 5 | Counter, @@ -39,6 +41,8 @@ F401_0.py:6:5: F401 [*] `collections.OrderedDict` imported but unused 8 7 | ) 9 8 | import multiprocessing.pool + Run `ruff check --fix` to apply this fix. + F401_0.py:12:8: F401 [*] `logging.handlers` imported but unused | 10 | import multiprocessing.process @@ -50,7 +54,7 @@ F401_0.py:12:8: F401 [*] `logging.handlers` imported but unused | = help: Remove unused import: `logging.handlers` -ℹ Safe fix +Suggested fix: 9 9 | import multiprocessing.pool 10 10 | import multiprocessing.process 11 11 | import logging.config @@ -59,6 +63,8 @@ F401_0.py:12:8: F401 [*] `logging.handlers` imported but unused 14 13 | TYPE_CHECKING, 15 14 | NamedTuple, + Run `ruff check --fix` to apply this fix. + F401_0.py:32:12: F401 [*] `shelve` imported but unused | 31 | if TYPE_CHECKING: @@ -68,7 +74,7 @@ F401_0.py:32:12: F401 [*] `shelve` imported but unused | = help: Remove unused import: `shelve` -ℹ Safe fix +Suggested fix: 29 29 | from models import Fruit, Nut, Vegetable 30 30 | 31 31 | if TYPE_CHECKING: @@ -77,6 +83,8 @@ F401_0.py:32:12: F401 [*] `shelve` imported but unused 34 33 | 35 34 | if TYPE_CHECKING: + Run `ruff check --fix` to apply this fix. + F401_0.py:33:12: F401 [*] `importlib` imported but unused | 31 | if TYPE_CHECKING: @@ -88,7 +96,7 @@ F401_0.py:33:12: F401 [*] `importlib` imported but unused | = help: Remove unused import: `importlib` -ℹ Safe fix +Suggested fix: 30 30 | 31 31 | if TYPE_CHECKING: 32 32 | import shelve @@ -97,6 +105,8 @@ F401_0.py:33:12: F401 [*] `importlib` imported but unused 35 34 | if TYPE_CHECKING: 36 35 | """Hello, world!""" + Run `ruff check --fix` to apply this fix. + F401_0.py:37:12: F401 [*] `pathlib` imported but unused | 35 | if TYPE_CHECKING: @@ -108,7 +118,7 @@ F401_0.py:37:12: F401 [*] `pathlib` imported but unused | = help: Remove unused import: `pathlib` -ℹ Safe fix +Suggested fix: 34 34 | 35 35 | if TYPE_CHECKING: 36 36 | """Hello, world!""" @@ -117,6 +127,8 @@ F401_0.py:37:12: F401 [*] `pathlib` imported but unused 39 38 | z = 1 40 39 | + Run `ruff check --fix` to apply this fix. + F401_0.py:52:16: F401 [*] `pickle` imported but unused | 51 | def b(self) -> None: @@ -125,7 +137,7 @@ F401_0.py:52:16: F401 [*] `pickle` imported but unused | = help: Remove unused import: `pickle` -ℹ Safe fix +Suggested fix: 49 49 | z = multiprocessing.pool.ThreadPool() 50 50 | 51 51 | def b(self) -> None: @@ -135,6 +147,8 @@ F401_0.py:52:16: F401 [*] `pickle` imported but unused 54 54 | 55 55 | __all__ = ["ClassA"] + ["ClassB"] + Run `ruff check --fix` to apply this fix. + F401_0.py:93:16: F401 [*] `x` imported but unused | 91 | match *0, 1, *2: @@ -145,7 +159,7 @@ F401_0.py:93:16: F401 [*] `x` imported but unused | = help: Remove unused import: `x` -ℹ Safe fix +Suggested fix: 90 90 | # Test: match statements. 91 91 | match *0, 1, *2: 92 92 | case 0,: @@ -154,6 +168,8 @@ F401_0.py:93:16: F401 [*] `x` imported but unused 95 94 | 96 95 | + Run `ruff check --fix` to apply this fix. + F401_0.py:94:16: F401 [*] `y` imported but unused | 92 | case 0,: @@ -163,7 +179,7 @@ F401_0.py:94:16: F401 [*] `y` imported but unused | = help: Remove unused import: `y` -ℹ Safe fix +Suggested fix: 91 91 | match *0, 1, *2: 92 92 | case 0,: 93 93 | import x @@ -172,6 +188,8 @@ F401_0.py:94:16: F401 [*] `y` imported but unused 96 95 | 97 96 | # Test: access a sub-importation via an alias. + Run `ruff check --fix` to apply this fix. + F401_0.py:99:8: F401 [*] `foo.bar.baz` imported but unused | 97 | # Test: access a sub-importation via an alias. @@ -183,7 +201,7 @@ F401_0.py:99:8: F401 [*] `foo.bar.baz` imported but unused | = help: Remove unused import: `foo.bar.baz` -ℹ Safe fix +Suggested fix: 96 96 | 97 97 | # Test: access a sub-importation via an alias. 98 98 | import foo.bar as bop @@ -192,6 +210,8 @@ F401_0.py:99:8: F401 [*] `foo.bar.baz` imported but unused 101 100 | print(bop.baz.read_csv("test.csv")) 102 101 | + Run `ruff check --fix` to apply this fix. + F401_0.py:105:12: F401 [*] `a1` imported but unused | 103 | # Test: isolated deletions. @@ -203,7 +223,7 @@ F401_0.py:105:12: F401 [*] `a1` imported but unused | = help: Remove unused import: `a1` -ℹ Safe fix +Suggested fix: 102 102 | 103 103 | # Test: isolated deletions. 104 104 | if TYPE_CHECKING: @@ -212,6 +232,8 @@ F401_0.py:105:12: F401 [*] `a1` imported but unused 107 106 | import a2 108 107 | + Run `ruff check --fix` to apply this fix. + F401_0.py:107:12: F401 [*] `a2` imported but unused | 105 | import a1 @@ -221,7 +243,7 @@ F401_0.py:107:12: F401 [*] `a2` imported but unused | = help: Remove unused import: `a2` -ℹ Safe fix +Suggested fix: 104 104 | if TYPE_CHECKING: 105 105 | import a1 106 106 | @@ -230,6 +252,8 @@ F401_0.py:107:12: F401 [*] `a2` imported but unused 109 108 | 110 109 | match *0, 1, *2: + Run `ruff check --fix` to apply this fix. + F401_0.py:112:16: F401 [*] `b1` imported but unused | 110 | match *0, 1, *2: @@ -241,7 +265,7 @@ F401_0.py:112:16: F401 [*] `b1` imported but unused | = help: Remove unused import: `b1` -ℹ Safe fix +Suggested fix: 109 109 | 110 110 | match *0, 1, *2: 111 111 | case 0,: @@ -250,6 +274,8 @@ F401_0.py:112:16: F401 [*] `b1` imported but unused 114 113 | import b2 115 114 | + Run `ruff check --fix` to apply this fix. + F401_0.py:114:16: F401 [*] `b2` imported but unused | 112 | import b1 @@ -259,7 +285,7 @@ F401_0.py:114:16: F401 [*] `b2` imported but unused | = help: Remove unused import: `b2` -ℹ Safe fix +Suggested fix: 111 111 | case 0,: 112 112 | import b1 113 113 | @@ -268,6 +294,8 @@ F401_0.py:114:16: F401 [*] `b2` imported but unused 116 115 | 117 116 | # Regression test for: https://github.com/astral-sh/ruff/issues/7244 + Run `ruff check --fix` to apply this fix. + F401_0.py:122:1: F401 [*] `datameta_client_lib.model_helpers.noqa` imported but unused | 121 | from datameta_client_lib.model_helpers import ( @@ -276,11 +304,11 @@ F401_0.py:122:1: F401 [*] `datameta_client_lib.model_helpers.noqa` imported but | = help: Remove unused import: `datameta_client_lib.model_helpers.noqa` -ℹ Safe fix +Suggested fix: 118 118 | from datameta_client_lib.model_utils import ( # noqa: F401 119 119 | noqa ) 120 120 | 121 |-from datameta_client_lib.model_helpers import ( 122 |-noqa ) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_11.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_11.py.snap index 39c9b95a011e2..74cd36fee92a0 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_11.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_11.py.snap @@ -9,7 +9,7 @@ F401_11.py:4:27: F401 [*] `pathlib.PurePath` imported but unused | = help: Remove unused import: `pathlib.PurePath` -ℹ Safe fix +Suggested fix: 1 1 | """Test: parsing of nested string annotations.""" 2 2 | 3 3 | from typing import List @@ -19,4 +19,4 @@ F401_11.py:4:27: F401 [*] `pathlib.PurePath` imported but unused 6 6 | 7 7 | x: """List['Path']""" = [] - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_15.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_15.py.snap index cd5526e8f4fde..569aa08e02d65 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_15.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_15.py.snap @@ -9,7 +9,7 @@ F401_15.py:5:25: F401 [*] `pathlib.Path` imported but unused | = help: Remove unused import: `pathlib.Path` -ℹ Safe fix +Suggested fix: 2 2 | from django.db.models import ForeignKey 3 3 | 4 4 | if TYPE_CHECKING: @@ -19,4 +19,4 @@ F401_15.py:5:25: F401 [*] `pathlib.Path` imported but unused 7 7 | 8 8 | class Foo: - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_17.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_17.py.snap index caf5d2c6767c3..1b94137781220 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_17.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_17.py.snap @@ -11,7 +11,7 @@ F401_17.py:12:27: F401 [*] `threading.Thread` imported but unused | = help: Remove unused import: `threading.Thread` -ℹ Safe fix +Suggested fix: 9 9 | 10 10 | 11 11 | def fn(thread: Thread): @@ -20,6 +20,8 @@ F401_17.py:12:27: F401 [*] `threading.Thread` imported but unused 14 13 | # The `Thread` on the left-hand side should resolve to the `Thread` imported at the 15 14 | # top level. + Run `ruff check --fix` to apply this fix. + F401_17.py:20:27: F401 [*] `threading.Thread` imported but unused | 19 | def fn(thread: Thread): @@ -30,7 +32,7 @@ F401_17.py:20:27: F401 [*] `threading.Thread` imported but unused | = help: Remove unused import: `threading.Thread` -ℹ Safe fix +Suggested fix: 17 17 | 18 18 | 19 19 | def fn(thread: Thread): @@ -39,4 +41,4 @@ F401_17.py:20:27: F401 [*] `threading.Thread` imported but unused 22 21 | # The `Thread` on the left-hand side should resolve to the `Thread` imported at the 23 22 | # top level. - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_18.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_18.py.snap index 33647bd2bf029..c8fc75027baeb 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_18.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_18.py.snap @@ -9,7 +9,7 @@ F401_18.py:5:12: F401 [*] `__future__` imported but unused | = help: Remove unused import: `__future__` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | 4 4 | def f(): @@ -19,4 +19,4 @@ F401_18.py:5:12: F401 [*] `__future__` imported but unused 7 7 | 8 8 | def f(): - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_23.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_23.py.snap index afde9e550a87d..8724bbed817f3 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_23.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_23.py.snap @@ -10,7 +10,7 @@ F401_23.py:4:16: F401 [*] `re.RegexFlag` imported but unused | = help: Remove unused import: `re.RegexFlag` -ℹ Safe fix +Suggested fix: 1 1 | """Test: ensure that we treat strings in `typing.Annotation` as type definitions.""" 2 2 | 3 3 | from pathlib import Path @@ -18,3 +18,5 @@ F401_23.py:4:16: F401 [*] `re.RegexFlag` imported but unused 5 4 | from typing import Annotated 6 5 | 7 6 | p: Annotated["Path", int] = 1 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_5.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_5.py.snap index e4317c5d195e7..a9248fdea650d 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_5.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_5.py.snap @@ -11,13 +11,15 @@ F401_5.py:2:17: F401 [*] `a.b.c` imported but unused | = help: Remove unused import: `a.b.c` -ℹ Safe fix +Suggested fix: 1 1 | """Test: removal of multi-segment and aliases imports.""" 2 |-from a.b import c 3 2 | from d.e import f as g 4 3 | import h.i 5 4 | import j.k as l + Run `ruff check --fix` to apply this fix. + F401_5.py:3:22: F401 [*] `d.e.f` imported but unused | 1 | """Test: removal of multi-segment and aliases imports.""" @@ -29,13 +31,15 @@ F401_5.py:3:22: F401 [*] `d.e.f` imported but unused | = help: Remove unused import: `d.e.f` -ℹ Safe fix +Suggested fix: 1 1 | """Test: removal of multi-segment and aliases imports.""" 2 2 | from a.b import c 3 |-from d.e import f as g 4 3 | import h.i 5 4 | import j.k as l + Run `ruff check --fix` to apply this fix. + F401_5.py:4:8: F401 [*] `h.i` imported but unused | 2 | from a.b import c @@ -46,13 +50,15 @@ F401_5.py:4:8: F401 [*] `h.i` imported but unused | = help: Remove unused import: `h.i` -ℹ Safe fix +Suggested fix: 1 1 | """Test: removal of multi-segment and aliases imports.""" 2 2 | from a.b import c 3 3 | from d.e import f as g 4 |-import h.i 5 4 | import j.k as l + Run `ruff check --fix` to apply this fix. + F401_5.py:5:15: F401 [*] `j.k` imported but unused | 3 | from d.e import f as g @@ -62,10 +68,10 @@ F401_5.py:5:15: F401 [*] `j.k` imported but unused | = help: Remove unused import: `j.k` -ℹ Safe fix +Suggested fix: 2 2 | from a.b import c 3 3 | from d.e import f as g 4 4 | import h.i 5 |-import j.k as l - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_6.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_6.py.snap index d0db5ee40d5df..b623c432a946a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_6.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_6.py.snap @@ -11,7 +11,7 @@ F401_6.py:7:25: F401 [*] `.background.BackgroundTasks` imported but unused | = help: Remove unused import: `.background.BackgroundTasks` -ℹ Safe fix +Suggested fix: 4 4 | from .applications import FastAPI as FastAPI 5 5 | 6 6 | # F401 `background.BackgroundTasks` imported but unused @@ -20,6 +20,8 @@ F401_6.py:7:25: F401 [*] `.background.BackgroundTasks` imported but unused 9 8 | # F401 `datastructures.UploadFile` imported but unused 10 9 | from .datastructures import UploadFile as FileUpload + Run `ruff check --fix` to apply this fix. + F401_6.py:10:43: F401 [*] `.datastructures.UploadFile` imported but unused | 9 | # F401 `datastructures.UploadFile` imported but unused @@ -30,7 +32,7 @@ F401_6.py:10:43: F401 [*] `.datastructures.UploadFile` imported but unused | = help: Remove unused import: `.datastructures.UploadFile` -ℹ Safe fix +Suggested fix: 7 7 | from .background import BackgroundTasks 8 8 | 9 9 | # F401 `datastructures.UploadFile` imported but unused @@ -39,6 +41,8 @@ F401_6.py:10:43: F401 [*] `.datastructures.UploadFile` imported but unused 12 11 | # OK 13 12 | import applications as applications + Run `ruff check --fix` to apply this fix. + F401_6.py:16:8: F401 [*] `background` imported but unused | 15 | # F401 `background` imported but unused @@ -49,7 +53,7 @@ F401_6.py:16:8: F401 [*] `background` imported but unused | = help: Remove unused import: `background` -ℹ Safe fix +Suggested fix: 13 13 | import applications as applications 14 14 | 15 15 | # F401 `background` imported but unused @@ -58,6 +62,8 @@ F401_6.py:16:8: F401 [*] `background` imported but unused 18 17 | # F401 `datastructures` imported but unused 19 18 | import datastructures as structures + Run `ruff check --fix` to apply this fix. + F401_6.py:19:26: F401 [*] `datastructures` imported but unused | 18 | # F401 `datastructures` imported but unused @@ -66,10 +72,10 @@ F401_6.py:19:26: F401 [*] `datastructures` imported but unused | = help: Remove unused import: `datastructures` -ℹ Safe fix +Suggested fix: 16 16 | import background 17 17 | 18 18 | # F401 `datastructures` imported but unused 19 |-import datastructures as structures - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_7.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_7.py.snap index cb4ec75028592..19238d0e467b5 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_7.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_7.py.snap @@ -11,7 +11,7 @@ F401_7.py:30:5: F401 [*] `typing.Union` imported but unused | = help: Remove unused import: `typing.Union` -ℹ Safe fix +Suggested fix: 27 27 | # This should ignore the first error. 28 28 | from typing import ( 29 29 | Mapping, # noqa: F401 @@ -22,6 +22,8 @@ F401_7.py:30:5: F401 [*] `typing.Union` imported but unused 33 32 | # This should ignore both errors. 34 33 | from typing import ( # noqa + Run `ruff check --fix` to apply this fix. + F401_7.py:66:20: F401 [*] `typing.Awaitable` imported but unused | 65 | # This should mark F501 as unused. @@ -30,12 +32,14 @@ F401_7.py:66:20: F401 [*] `typing.Awaitable` imported but unused | = help: Remove unused import -ℹ Safe fix +Suggested fix: 63 63 | from typing import AsyncIterable, AsyncGenerator # noqa 64 64 | 65 65 | # This should mark F501 as unused. 66 |-from typing import Awaitable, AwaitableGenerator # noqa: F501 + Run `ruff check --fix` to apply this fix. + F401_7.py:66:31: F401 [*] `typing.AwaitableGenerator` imported but unused | 65 | # This should mark F501 as unused. @@ -44,10 +48,10 @@ F401_7.py:66:31: F401 [*] `typing.AwaitableGenerator` imported but unused | = help: Remove unused import -ℹ Safe fix +Suggested fix: 63 63 | from typing import AsyncIterable, AsyncGenerator # noqa 64 64 | 65 65 | # This should mark F501 as unused. 66 |-from typing import Awaitable, AwaitableGenerator # noqa: F501 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_9.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_9.py.snap index c7071cc24fbfa..eb23d63cad473 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_9.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_9.py.snap @@ -9,11 +9,11 @@ F401_9.py:4:22: F401 [*] `foo.baz` imported but unused | = help: Remove unused import: `foo.baz` -ℹ Safe fix +Suggested fix: 1 1 | """Test: late-binding of `__all__`.""" 2 2 | 3 3 | __all__ = ("bar",) 4 |-from foo import bar, baz 4 |+from foo import bar - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_24____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_24____init__.py.snap index 019ddc0195896..9bf626c5a068d 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_24____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_24____init__.py.snap @@ -8,7 +8,7 @@ __init__.py:19:8: F401 [*] `sys` imported but unused | = help: Remove unused import: `sys` -ℹ Unsafe fix +Suggested fix: 16 16 | import argparse as argparse # Ok: is redundant alias 17 17 | 18 18 | @@ -17,6 +17,8 @@ __init__.py:19:8: F401 [*] `sys` imported but unused 21 20 | 22 21 | # first-party + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + __init__.py:33:15: F401 [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 33 | from . import unused # F401: change to redundant alias @@ -24,7 +26,7 @@ __init__.py:33:15: F401 [*] `.unused` imported but unused; consider removing, ad | = help: Remove unused import: `.unused` -ℹ Unsafe fix +Suggested fix: 30 30 | from . import aliased as aliased # Ok: is redundant alias 31 31 | 32 32 | @@ -33,6 +35,8 @@ __init__.py:33:15: F401 [*] `.unused` imported but unused; consider removing, ad 35 34 | 36 35 | from . import renamed as bees # F401: no fix + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + __init__.py:36:26: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 36 | from . import renamed as bees # F401: no fix @@ -40,8 +44,10 @@ __init__.py:36:26: F401 [*] `.renamed` imported but unused; consider removing, a | = help: Remove unused import: `.renamed` -ℹ Unsafe fix +Suggested fix: 33 33 | from . import unused # F401: change to redundant alias 34 34 | 35 35 | 36 |-from . import renamed as bees # F401: no fix + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_25__all_nonempty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_25__all_nonempty____init__.py.snap index 2d1d54e3488e5..37017a60dd6b1 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_25__all_nonempty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_25__all_nonempty____init__.py.snap @@ -8,7 +8,7 @@ __init__.py:19:8: F401 [*] `sys` imported but unused | = help: Remove unused import: `sys` -ℹ Unsafe fix +Suggested fix: 16 16 | import argparse # Ok: is exported in __all__ 17 17 | 18 18 | @@ -17,6 +17,8 @@ __init__.py:19:8: F401 [*] `sys` imported but unused 21 20 | 22 21 | # first-party + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + __init__.py:36:15: F401 [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 36 | from . import unused # F401: add to __all__ @@ -24,7 +26,7 @@ __init__.py:36:15: F401 [*] `.unused` imported but unused; consider removing, ad | = help: Remove unused import: `.unused` -ℹ Unsafe fix +Suggested fix: 33 33 | from . import exported # Ok: is exported in __all__ 34 34 | 35 35 | @@ -33,6 +35,8 @@ __init__.py:36:15: F401 [*] `.unused` imported but unused; consider removing, ad 38 37 | 39 38 | from . import renamed as bees # F401: add to __all__ + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + __init__.py:39:26: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 39 | from . import renamed as bees # F401: add to __all__ @@ -40,7 +44,7 @@ __init__.py:39:26: F401 [*] `.renamed` imported but unused; consider removing, a | = help: Remove unused import: `.renamed` -ℹ Unsafe fix +Suggested fix: 36 36 | from . import unused # F401: add to __all__ 37 37 | 38 38 | @@ -48,3 +52,5 @@ __init__.py:39:26: F401 [*] `.renamed` imported but unused; consider removing, a 40 39 | 41 40 | 42 41 | __all__ = ["argparse", "exported"] + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_26__all_empty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_26__all_empty____init__.py.snap index 0fa48cf5f179e..4a98e21b26252 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_26__all_empty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_26__all_empty____init__.py.snap @@ -8,7 +8,7 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add | = help: Remove unused import: `.unused` -ℹ Unsafe fix +Suggested fix: 2 2 | """ 3 3 | 4 4 | @@ -17,6 +17,8 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add 7 6 | 8 7 | from . import renamed as bees # F401: add to __all__ + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + __init__.py:8:26: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 8 | from . import renamed as bees # F401: add to __all__ @@ -24,7 +26,7 @@ __init__.py:8:26: F401 [*] `.renamed` imported but unused; consider removing, ad | = help: Remove unused import: `.renamed` -ℹ Unsafe fix +Suggested fix: 5 5 | from . import unused # F401: add to __all__ 6 6 | 7 7 | @@ -32,3 +34,5 @@ __init__.py:8:26: F401 [*] `.renamed` imported but unused; consider removing, ad 9 8 | 10 9 | 11 10 | __all__ = [] + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_27__all_mistyped____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_27__all_mistyped____init__.py.snap index a4f1d557bdef4..6a5c48aa83d98 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_27__all_mistyped____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_27__all_mistyped____init__.py.snap @@ -8,7 +8,7 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add | = help: Remove unused import: `.unused` -ℹ Unsafe fix +Suggested fix: 2 2 | """ 3 3 | 4 4 | @@ -17,6 +17,8 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add 7 6 | 8 7 | from . import renamed as bees # F401: recommend add to all w/o fix + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + __init__.py:8:26: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 8 | from . import renamed as bees # F401: recommend add to all w/o fix @@ -24,7 +26,7 @@ __init__.py:8:26: F401 [*] `.renamed` imported but unused; consider removing, ad | = help: Remove unused import: `.renamed` -ℹ Unsafe fix +Suggested fix: 5 5 | from . import unused # F401: recommend add to all w/o fix 6 6 | 7 7 | @@ -32,3 +34,5 @@ __init__.py:8:26: F401 [*] `.renamed` imported but unused; consider removing, ad 9 8 | 10 9 | 11 10 | __all__ = None + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_28__all_multiple____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_28__all_multiple____init__.py.snap index daeee1984e4aa..d0b11ad06e44e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_28__all_multiple____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_28__all_multiple____init__.py.snap @@ -8,7 +8,7 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add | = help: Remove unused import -ℹ Unsafe fix +Suggested fix: 2 2 | """ 3 3 | 4 4 | @@ -17,6 +17,8 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add 7 6 | 8 7 | __all__ = []; + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + __init__.py:5:34: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 5 | from . import unused, renamed as bees # F401: add to __all__ @@ -24,7 +26,7 @@ __init__.py:5:34: F401 [*] `.renamed` imported but unused; consider removing, ad | = help: Remove unused import -ℹ Unsafe fix +Suggested fix: 2 2 | """ 3 3 | 4 4 | @@ -32,3 +34,5 @@ __init__.py:5:34: F401 [*] `.renamed` imported but unused; consider removing, ad 6 5 | 7 6 | 8 7 | __all__ = []; + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap index 392a58cf7aa16..2d03b8c755293 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap @@ -12,7 +12,7 @@ __init__.py:8:15: F401 [*] `.unused` imported but unused; consider removing, add | = help: Remove unused import -ℹ Unsafe fix +Suggested fix: 5 5 | 6 6 | import sys 7 7 | @@ -22,6 +22,8 @@ __init__.py:8:15: F401 [*] `.unused` imported but unused; consider removing, add 10 10 | if sys.version_info > (3, 9): 11 11 | from . import also_exported + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + __init__.py:8:44: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 6 | import sys @@ -33,7 +35,7 @@ __init__.py:8:44: F401 [*] `.renamed` imported but unused; consider removing, ad | = help: Remove unused import -ℹ Unsafe fix +Suggested fix: 5 5 | 6 6 | import sys 7 7 | @@ -42,3 +44,5 @@ __init__.py:8:44: F401 [*] `.renamed` imported but unused; consider removing, ad 9 9 | 10 10 | if sys.version_info > (3, 9): 11 11 | from . import also_exported + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F504.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F504.py.snap index a04af93d12ad3..ed1ab01707841 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F504.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F504.py.snap @@ -12,7 +12,7 @@ F504.py:3:1: F504 [*] `%`-format string has unused named argument(s): b | = help: Remove extra named arguments: b -ℹ Safe fix +Suggested fix: 1 1 | # Ruff has no way of knowing if the following are F505s 2 2 | a = "wrong" 3 |-"%(a)s %(c)s" % {a: "?", "b": "!"} # F504 ("b" not used) @@ -21,6 +21,8 @@ F504.py:3:1: F504 [*] `%`-format string has unused named argument(s): b 5 5 | hidden = {"a": "!"} 6 6 | "%(a)s %(c)s" % {"x": 1, **hidden} # Ok (cannot see through splat) + Run `ruff check --fix` to apply this fix. + F504.py:8:1: F504 [*] `%`-format string has unused named argument(s): b | 6 | "%(a)s %(c)s" % {"x": 1, **hidden} # Ok (cannot see through splat) @@ -31,7 +33,7 @@ F504.py:8:1: F504 [*] `%`-format string has unused named argument(s): b | = help: Remove extra named arguments: b -ℹ Safe fix +Suggested fix: 5 5 | hidden = {"a": "!"} 6 6 | "%(a)s %(c)s" % {"x": 1, **hidden} # Ok (cannot see through splat) 7 7 | @@ -41,6 +43,8 @@ F504.py:8:1: F504 [*] `%`-format string has unused named argument(s): b 10 10 | 11 11 | '' % {'a''b' : ''} # F504 ("ab" not used) + Run `ruff check --fix` to apply this fix. + F504.py:9:1: F504 [*] `%`-format string has unused named argument(s): b | 8 | "%(a)s" % {"a": 1, r"b": "!"} # F504 ("b" not used) @@ -51,7 +55,7 @@ F504.py:9:1: F504 [*] `%`-format string has unused named argument(s): b | = help: Remove extra named arguments: b -ℹ Safe fix +Suggested fix: 6 6 | "%(a)s %(c)s" % {"x": 1, **hidden} # Ok (cannot see through splat) 7 7 | 8 8 | "%(a)s" % {"a": 1, r"b": "!"} # F504 ("b" not used) @@ -61,6 +65,8 @@ F504.py:9:1: F504 [*] `%`-format string has unused named argument(s): b 11 11 | '' % {'a''b' : ''} # F504 ("ab" not used) 12 12 | + Run `ruff check --fix` to apply this fix. + F504.py:11:1: F504 [*] `%`-format string has unused named argument(s): ab | 9 | "%(a)s" % {'a': 1, u"b": "!"} # F504 ("b" not used) @@ -72,7 +78,7 @@ F504.py:11:1: F504 [*] `%`-format string has unused named argument(s): ab | = help: Remove extra named arguments: ab -ℹ Safe fix +Suggested fix: 8 8 | "%(a)s" % {"a": 1, r"b": "!"} # F504 ("b" not used) 9 9 | "%(a)s" % {'a': 1, u"b": "!"} # F504 ("b" not used) 10 10 | @@ -82,6 +88,8 @@ F504.py:11:1: F504 [*] `%`-format string has unused named argument(s): ab 13 13 | # https://github.com/astral-sh/ruff/issues/4899 14 14 | "" % { + Run `ruff check --fix` to apply this fix. + F504.py:14:1: F504 [*] `%`-format string has unused named argument(s): test1, test2 | 13 | # https://github.com/astral-sh/ruff/issues/4899 @@ -92,7 +100,7 @@ F504.py:14:1: F504 [*] `%`-format string has unused named argument(s): test1, te | = help: Remove extra named arguments: test1, test2 -ℹ Safe fix +Suggested fix: 12 12 | 13 13 | # https://github.com/astral-sh/ruff/issues/4899 14 14 | "" % { @@ -100,4 +108,4 @@ F504.py:14:1: F504 [*] `%`-format string has unused named argument(s): test1, te 15 |+ 17 16 | } - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F50x.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F50x.py.snap index 8bcd33a080e3e..60beaf494a76a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F50x.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F50x.py.snap @@ -12,7 +12,7 @@ F50x.py:8:1: F504 [*] `%`-format string has unused named argument(s): baz | = help: Remove extra named arguments: baz -ℹ Safe fix +Suggested fix: 5 5 | '%s %s' % (1,) # F507 6 6 | '%s %s' % (1, 2, 3) # F507 7 7 | '%(bar)s' % {} # F505 @@ -22,4 +22,4 @@ F50x.py:8:1: F504 [*] `%`-format string has unused named argument(s): baz 10 10 | '%s %s' % {'k': 'v'} # F503 11 11 | '%(bar)*s' % {'bar': 'baz'} # F506, F508 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F522_F522.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F522_F522.py.snap index 5e33645d06379..d9662ec8288aa 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F522_F522.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F522_F522.py.snap @@ -10,13 +10,15 @@ F522.py:1:1: F522 [*] `.format` call has unused named argument(s): bar | = help: Remove extra named arguments: bar -ℹ Safe fix +Suggested fix: 1 |-"{}".format(1, bar=2) # F522 1 |+"{}".format(1, ) # F522 2 2 | "{bar}{}".format(1, bar=2, spam=3) # F522 3 3 | "{bar:{spam}}".format(bar=2, spam=3) # No issues 4 4 | "{bar:{spam}}".format(bar=2, spam=3, eggs=4, ham=5) # F522 + Run `ruff check --fix` to apply this fix. + F522.py:2:1: F522 [*] `.format` call has unused named argument(s): spam | 1 | "{}".format(1, bar=2) # F522 @@ -27,7 +29,7 @@ F522.py:2:1: F522 [*] `.format` call has unused named argument(s): spam | = help: Remove extra named arguments: spam -ℹ Safe fix +Suggested fix: 1 1 | "{}".format(1, bar=2) # F522 2 |-"{bar}{}".format(1, bar=2, spam=3) # F522 2 |+"{bar}{}".format(1, bar=2, ) # F522 @@ -35,6 +37,8 @@ F522.py:2:1: F522 [*] `.format` call has unused named argument(s): spam 4 4 | "{bar:{spam}}".format(bar=2, spam=3, eggs=4, ham=5) # F522 5 5 | ('' + Run `ruff check --fix` to apply this fix. + F522.py:4:1: F522 [*] `.format` call has unused named argument(s): eggs, ham | 2 | "{bar}{}".format(1, bar=2, spam=3) # F522 @@ -46,7 +50,7 @@ F522.py:4:1: F522 [*] `.format` call has unused named argument(s): eggs, ham | = help: Remove extra named arguments: eggs, ham -ℹ Safe fix +Suggested fix: 1 1 | "{}".format(1, bar=2) # F522 2 2 | "{bar}{}".format(1, bar=2, spam=3) # F522 3 3 | "{bar:{spam}}".format(bar=2, spam=3) # No issues @@ -55,6 +59,8 @@ F522.py:4:1: F522 [*] `.format` call has unused named argument(s): eggs, ham 5 5 | ('' 6 6 | .format(x=2)) # F522 + Run `ruff check --fix` to apply this fix. + F522.py:5:2: F522 [*] `.format` call has unused named argument(s): x | 3 | "{bar:{spam}}".format(bar=2, spam=3) # No issues @@ -66,11 +72,11 @@ F522.py:5:2: F522 [*] `.format` call has unused named argument(s): x | = help: Remove extra named arguments: x -ℹ Safe fix +Suggested fix: 3 3 | "{bar:{spam}}".format(bar=2, spam=3) # No issues 4 4 | "{bar:{spam}}".format(bar=2, spam=3, eggs=4, ham=5) # F522 5 5 | ('' 6 |- .format(x=2)) # F522 6 |+ .format()) # F522 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F523_F523.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F523_F523.py.snap index 48ecf84655537..4d7387ce1c4a5 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F523_F523.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F523_F523.py.snap @@ -11,7 +11,7 @@ F523.py:2:1: F523 [*] `.format` call has unused arguments at position(s): 1 | = help: Remove extra positional arguments at position(s): 1 -ℹ Safe fix +Suggested fix: 1 1 | # With indexes 2 |-"{0}".format(1, 2) # F523 2 |+"{0}".format(1, ) # F523 @@ -19,6 +19,8 @@ F523.py:2:1: F523 [*] `.format` call has unused arguments at position(s): 1 4 4 | "{1:{0}}".format(1, 2) # No issues 5 5 | "{1:{0}}".format(1, 2, 3) # F523 + Run `ruff check --fix` to apply this fix. + F523.py:3:1: F523 `.format` call has unused arguments at position(s): 0, 2 | 1 | # With indexes @@ -41,7 +43,7 @@ F523.py:5:1: F523 [*] `.format` call has unused arguments at position(s): 2 | = help: Remove extra positional arguments at position(s): 2 -ℹ Safe fix +Suggested fix: 2 2 | "{0}".format(1, 2) # F523 3 3 | "{1}".format(1, 2, 3) # F523 4 4 | "{1:{0}}".format(1, 2) # No issues @@ -51,6 +53,8 @@ F523.py:5:1: F523 [*] `.format` call has unused arguments at position(s): 2 7 7 | "{1.arg[1]!r:0{2['arg']}{1}}".format(1, 2, 3, 4) # F523 8 8 | + Run `ruff check --fix` to apply this fix. + F523.py:6:1: F523 [*] `.format` call has unused arguments at position(s): 1 | 4 | "{1:{0}}".format(1, 2) # No issues @@ -61,7 +65,7 @@ F523.py:6:1: F523 [*] `.format` call has unused arguments at position(s): 1 | = help: Remove extra positional arguments at position(s): 1 -ℹ Safe fix +Suggested fix: 3 3 | "{1}".format(1, 2, 3) # F523 4 4 | "{1:{0}}".format(1, 2) # No issues 5 5 | "{1:{0}}".format(1, 2, 3) # F523 @@ -71,6 +75,8 @@ F523.py:6:1: F523 [*] `.format` call has unused arguments at position(s): 1 8 8 | 9 9 | # With no indexes + Run `ruff check --fix` to apply this fix. + F523.py:7:1: F523 `.format` call has unused arguments at position(s): 0, 3 | 5 | "{1:{0}}".format(1, 2, 3) # F523 @@ -92,7 +98,7 @@ F523.py:10:1: F523 [*] `.format` call has unused arguments at position(s): 1 | = help: Remove extra positional arguments at position(s): 1 -ℹ Safe fix +Suggested fix: 7 7 | "{1.arg[1]!r:0{2['arg']}{1}}".format(1, 2, 3, 4) # F523 8 8 | 9 9 | # With no indexes @@ -102,6 +108,8 @@ F523.py:10:1: F523 [*] `.format` call has unused arguments at position(s): 1 12 12 | "{:{}}".format(1, 2) # No issues 13 13 | "{:{}}".format(1, 2, 3) # F523 + Run `ruff check --fix` to apply this fix. + F523.py:11:1: F523 [*] `.format` call has unused arguments at position(s): 1, 2 | 9 | # With no indexes @@ -113,7 +121,7 @@ F523.py:11:1: F523 [*] `.format` call has unused arguments at position(s): 1, 2 | = help: Remove extra positional arguments at position(s): 1, 2 -ℹ Safe fix +Suggested fix: 8 8 | 9 9 | # With no indexes 10 10 | "{}".format(1, 2) # F523 @@ -123,6 +131,8 @@ F523.py:11:1: F523 [*] `.format` call has unused arguments at position(s): 1, 2 13 13 | "{:{}}".format(1, 2, 3) # F523 14 14 | + Run `ruff check --fix` to apply this fix. + F523.py:13:1: F523 [*] `.format` call has unused arguments at position(s): 2 | 11 | "{}".format(1, 2, 3) # F523 @@ -134,7 +144,7 @@ F523.py:13:1: F523 [*] `.format` call has unused arguments at position(s): 2 | = help: Remove extra positional arguments at position(s): 2 -ℹ Safe fix +Suggested fix: 10 10 | "{}".format(1, 2) # F523 11 11 | "{}".format(1, 2, 3) # F523 12 12 | "{:{}}".format(1, 2) # No issues @@ -144,6 +154,8 @@ F523.py:13:1: F523 [*] `.format` call has unused arguments at position(s): 2 15 15 | # With *args 16 16 | "{0}{1}".format(*args) # No issues + Run `ruff check --fix` to apply this fix. + F523.py:19:1: F523 `.format` call has unused arguments at position(s): 2 | 17 | "{0}{1}".format(1, *args) # No issues @@ -165,7 +177,7 @@ F523.py:22:1: F523 [*] `.format` call has unused arguments at position(s): 1, 2 | = help: Remove extra positional arguments at position(s): 1, 2 -ℹ Safe fix +Suggested fix: 19 19 | "{0}{1}".format(1, 2, 3, *args) # F523 20 20 | 21 21 | # With nested quotes @@ -175,6 +187,8 @@ F523.py:22:1: F523 [*] `.format` call has unused arguments at position(s): 1, 2 24 24 | '""{1}{0}'.format(1, 2, 3) # F523 25 25 | + Run `ruff check --fix` to apply this fix. + F523.py:23:1: F523 [*] `.format` call has unused arguments at position(s): 2 | 21 | # With nested quotes @@ -185,7 +199,7 @@ F523.py:23:1: F523 [*] `.format` call has unused arguments at position(s): 2 | = help: Remove extra positional arguments at position(s): 2 -ℹ Safe fix +Suggested fix: 20 20 | 21 21 | # With nested quotes 22 22 | "''1{0}".format(1, 2, 3) # F523 @@ -195,6 +209,8 @@ F523.py:23:1: F523 [*] `.format` call has unused arguments at position(s): 2 25 25 | 26 26 | # With modified indexes + Run `ruff check --fix` to apply this fix. + F523.py:24:1: F523 [*] `.format` call has unused arguments at position(s): 2 | 22 | "''1{0}".format(1, 2, 3) # F523 @@ -206,7 +222,7 @@ F523.py:24:1: F523 [*] `.format` call has unused arguments at position(s): 2 | = help: Remove extra positional arguments at position(s): 2 -ℹ Safe fix +Suggested fix: 21 21 | # With nested quotes 22 22 | "''1{0}".format(1, 2, 3) # F523 23 23 | "\"\"{1}{0}".format(1, 2, 3) # F523 @@ -216,6 +232,8 @@ F523.py:24:1: F523 [*] `.format` call has unused arguments at position(s): 2 26 26 | # With modified indexes 27 27 | "{1}{2}".format(1, 2, 3) # F523, # F524 + Run `ruff check --fix` to apply this fix. + F523.py:27:1: F523 `.format` call has unused arguments at position(s): 0 | 26 | # With modified indexes @@ -257,11 +275,11 @@ F523.py:32:2: F523 [*] `.format` call has unused arguments at position(s): 0 | = help: Remove extra positional arguments at position(s): 0 -ℹ Safe fix +Suggested fix: 30 30 | 31 31 | # Multiline 32 32 | ('' 33 |-.format(2)) 33 |+.format()) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F541_F541.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F541_F541.py.snap index ab3ce59d46ec8..e93e634b11304 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F541_F541.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F541_F541.py.snap @@ -11,7 +11,7 @@ F541.py:6:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 3 3 | b = f"ghi{'jkl'}" 4 4 | 5 5 | # Errors @@ -21,6 +21,8 @@ F541.py:6:5: F541 [*] f-string without any placeholders 8 8 | e = ( 9 9 | f"def" + + Run `ruff check --fix` to apply this fix. + F541.py:7:5: F541 [*] f-string without any placeholders | 5 | # Errors @@ -32,7 +34,7 @@ F541.py:7:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | # Errors 6 6 | c = f"def" @@ -42,6 +44,8 @@ F541.py:7:5: F541 [*] f-string without any placeholders 9 9 | f"def" + 10 10 | "ghi" + Run `ruff check --fix` to apply this fix. + F541.py:9:5: F541 [*] f-string without any placeholders | 7 | d = f"def" + "ghi" @@ -53,7 +57,7 @@ F541.py:9:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 6 6 | c = f"def" 7 7 | d = f"def" + "ghi" 8 8 | e = ( @@ -63,6 +67,8 @@ F541.py:9:5: F541 [*] f-string without any placeholders 11 11 | ) 12 12 | f = ( + Run `ruff check --fix` to apply this fix. + F541.py:13:5: F541 [*] f-string without any placeholders | 11 | ) @@ -74,7 +80,7 @@ F541.py:13:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 10 10 | "ghi" 11 11 | ) 12 12 | f = ( @@ -84,6 +90,8 @@ F541.py:13:5: F541 [*] f-string without any placeholders 15 15 | "c" 16 16 | rf"d" + Run `ruff check --fix` to apply this fix. + F541.py:14:5: F541 [*] f-string without any placeholders | 12 | f = ( @@ -95,7 +103,7 @@ F541.py:14:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 11 11 | ) 12 12 | f = ( 13 13 | f"a" @@ -105,6 +113,8 @@ F541.py:14:5: F541 [*] f-string without any placeholders 16 16 | rf"d" 17 17 | fr"e" + Run `ruff check --fix` to apply this fix. + F541.py:16:5: F541 [*] f-string without any placeholders | 14 | F"b" @@ -116,7 +126,7 @@ F541.py:16:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 13 13 | f"a" 14 14 | F"b" 15 15 | "c" @@ -126,6 +136,8 @@ F541.py:16:5: F541 [*] f-string without any placeholders 18 18 | ) 19 19 | g = f"" + Run `ruff check --fix` to apply this fix. + F541.py:17:5: F541 [*] f-string without any placeholders | 15 | "c" @@ -137,7 +149,7 @@ F541.py:17:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 14 14 | F"b" 15 15 | "c" 16 16 | rf"d" @@ -147,6 +159,8 @@ F541.py:17:5: F541 [*] f-string without any placeholders 19 19 | g = f"" 20 20 | + Run `ruff check --fix` to apply this fix. + F541.py:19:5: F541 [*] f-string without any placeholders | 17 | fr"e" @@ -158,7 +172,7 @@ F541.py:19:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 16 16 | rf"d" 17 17 | fr"e" 18 18 | ) @@ -168,6 +182,8 @@ F541.py:19:5: F541 [*] f-string without any placeholders 21 21 | # OK 22 22 | g = f"ghi{123:{45}}" + Run `ruff check --fix` to apply this fix. + F541.py:25:13: F541 [*] f-string without any placeholders | 24 | # Error @@ -178,7 +194,7 @@ F541.py:25:13: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 22 22 | g = f"ghi{123:{45}}" 23 23 | 24 24 | # Error @@ -188,6 +204,8 @@ F541.py:25:13: F541 [*] f-string without any placeholders 27 27 | v = 23.234234 28 28 | + Run `ruff check --fix` to apply this fix. + F541.py:34:7: F541 [*] f-string without any placeholders | 33 | # Errors @@ -198,7 +216,7 @@ F541.py:34:7: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 31 31 | f"{f'{v:0.2f}'}" 32 32 | 33 33 | # Errors @@ -208,6 +226,8 @@ F541.py:34:7: F541 [*] f-string without any placeholders 36 36 | f"{{test}}" 37 37 | f'{{ 40 }}' + Run `ruff check --fix` to apply this fix. + F541.py:35:4: F541 [*] f-string without any placeholders | 33 | # Errors @@ -219,7 +239,7 @@ F541.py:35:4: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 32 32 | 33 33 | # Errors 34 34 | f"{v:{f'0.2f'}}" @@ -229,6 +249,8 @@ F541.py:35:4: F541 [*] f-string without any placeholders 37 37 | f'{{ 40 }}' 38 38 | f"{{a {{x}}" + Run `ruff check --fix` to apply this fix. + F541.py:36:1: F541 [*] f-string without any placeholders | 34 | f"{v:{f'0.2f'}}" @@ -240,7 +262,7 @@ F541.py:36:1: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 33 33 | # Errors 34 34 | f"{v:{f'0.2f'}}" 35 35 | f"{f''}" @@ -250,6 +272,8 @@ F541.py:36:1: F541 [*] f-string without any placeholders 38 38 | f"{{a {{x}}" 39 39 | f"{{{{x}}}}" + Run `ruff check --fix` to apply this fix. + F541.py:37:1: F541 [*] f-string without any placeholders | 35 | f"{f''}" @@ -261,7 +285,7 @@ F541.py:37:1: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 34 34 | f"{v:{f'0.2f'}}" 35 35 | f"{f''}" 36 36 | f"{{test}}" @@ -271,6 +295,8 @@ F541.py:37:1: F541 [*] f-string without any placeholders 39 39 | f"{{{{x}}}}" 40 40 | ""f"" + Run `ruff check --fix` to apply this fix. + F541.py:38:1: F541 [*] f-string without any placeholders | 36 | f"{{test}}" @@ -282,7 +308,7 @@ F541.py:38:1: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 35 35 | f"{f''}" 36 36 | f"{{test}}" 37 37 | f'{{ 40 }}' @@ -292,6 +318,8 @@ F541.py:38:1: F541 [*] f-string without any placeholders 40 40 | ""f"" 41 41 | ''f"" + Run `ruff check --fix` to apply this fix. + F541.py:39:1: F541 [*] f-string without any placeholders | 37 | f'{{ 40 }}' @@ -303,7 +331,7 @@ F541.py:39:1: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 36 36 | f"{{test}}" 37 37 | f'{{ 40 }}' 38 38 | f"{{a {{x}}" @@ -313,6 +341,8 @@ F541.py:39:1: F541 [*] f-string without any placeholders 41 41 | ''f"" 42 42 | (""f""r"") + Run `ruff check --fix` to apply this fix. + F541.py:40:3: F541 [*] f-string without any placeholders | 38 | f"{{a {{x}}" @@ -324,7 +354,7 @@ F541.py:40:3: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 37 37 | f'{{ 40 }}' 38 38 | f"{{a {{x}}" 39 39 | f"{{{{x}}}}" @@ -334,6 +364,8 @@ F541.py:40:3: F541 [*] f-string without any placeholders 42 42 | (""f""r"") 43 43 | f"{v:{f"0.2f"}}" + Run `ruff check --fix` to apply this fix. + F541.py:41:3: F541 [*] f-string without any placeholders | 39 | f"{{{{x}}}}" @@ -345,7 +377,7 @@ F541.py:41:3: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 38 38 | f"{{a {{x}}" 39 39 | f"{{{{x}}}}" 40 40 | ""f"" @@ -355,6 +387,8 @@ F541.py:41:3: F541 [*] f-string without any placeholders 43 43 | f"{v:{f"0.2f"}}" 44 44 | f"\{{x}}" + Run `ruff check --fix` to apply this fix. + F541.py:42:4: F541 [*] f-string without any placeholders | 40 | ""f"" @@ -366,7 +400,7 @@ F541.py:42:4: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 39 39 | f"{{{{x}}}}" 40 40 | ""f"" 41 41 | ''f"" @@ -375,6 +409,8 @@ F541.py:42:4: F541 [*] f-string without any placeholders 43 43 | f"{v:{f"0.2f"}}" 44 44 | f"\{{x}}" + Run `ruff check --fix` to apply this fix. + F541.py:43:7: F541 [*] f-string without any placeholders | 41 | ''f"" @@ -385,7 +421,7 @@ F541.py:43:7: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 40 40 | ""f"" 41 41 | ''f"" 42 42 | (""f""r"") @@ -393,6 +429,8 @@ F541.py:43:7: F541 [*] f-string without any placeholders 43 |+f"{v:{"0.2f"}}" 44 44 | f"\{{x}}" + Run `ruff check --fix` to apply this fix. + F541.py:44:1: F541 [*] f-string without any placeholders | 42 | (""f""r"") @@ -402,11 +440,11 @@ F541.py:44:1: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Safe fix +Suggested fix: 41 41 | ''f"" 42 42 | (""f""r"") 43 43 | f"{v:{f"0.2f"}}" 44 |-f"\{{x}}" 44 |+"\{x}" - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap index ace4761b43cbd..4364601a59d14 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap @@ -76,7 +76,7 @@ F601.py:18:5: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -ℹ Unsafe fix +Suggested fix: 15 15 | "a": 1, 16 16 | "a": 2, 17 17 | "a": 3, @@ -85,6 +85,8 @@ F601.py:18:5: F601 [*] Dictionary key literal `"a"` repeated 20 19 | 21 20 | x = { + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F601.py:23:5: F601 Dictionary key literal `"a"` repeated | 21 | x = { @@ -118,7 +120,7 @@ F601.py:25:5: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -ℹ Unsafe fix +Suggested fix: 22 22 | "a": 1, 23 23 | "a": 2, 24 24 | "a": 3, @@ -127,6 +129,8 @@ F601.py:25:5: F601 [*] Dictionary key literal `"a"` repeated 27 26 | } 28 27 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F601.py:26:5: F601 Dictionary key literal `"a"` repeated | 24 | "a": 3, @@ -148,7 +152,7 @@ F601.py:31:5: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -ℹ Unsafe fix +Suggested fix: 28 28 | 29 29 | x = { 30 30 | "a": 1, @@ -157,6 +161,8 @@ F601.py:31:5: F601 [*] Dictionary key literal `"a"` repeated 33 32 | "a": 3, 34 33 | "a": 4, + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F601.py:32:5: F601 Dictionary key literal `"a"` repeated | 30 | "a": 1, @@ -222,7 +228,7 @@ F601.py:45:5: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -ℹ Unsafe fix +Suggested fix: 42 42 | a: 2, 43 43 | "a": 3, 44 44 | a: 3, @@ -231,6 +237,8 @@ F601.py:45:5: F601 [*] Dictionary key literal `"a"` repeated 47 46 | } 48 47 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F601.py:49:14: F601 [*] Dictionary key literal `"a"` repeated | 47 | } @@ -241,7 +249,7 @@ F601.py:49:14: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -ℹ Unsafe fix +Suggested fix: 46 46 | a: 4, 47 47 | } 48 48 | @@ -251,6 +259,8 @@ F601.py:49:14: F601 [*] Dictionary key literal `"a"` repeated 51 51 | 52 52 | x = { + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F601.py:50:22: F601 [*] Dictionary key literal `"a"` repeated | 49 | x = {"a": 1, "a": 1} @@ -261,7 +271,7 @@ F601.py:50:22: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -ℹ Unsafe fix +Suggested fix: 47 47 | } 48 48 | 49 49 | x = {"a": 1, "a": 1} @@ -271,6 +281,8 @@ F601.py:50:22: F601 [*] Dictionary key literal `"a"` repeated 52 52 | x = { 53 53 | ('a', 'b'): 'asdf', + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F601.py:54:5: F601 Dictionary key literal `('a', 'b')` repeated | 52 | x = { @@ -291,7 +303,7 @@ F601.py:58:19: F601 [*] Dictionary key literal `"x"` repeated | = help: Remove repeated key literal `"x"` -ℹ Unsafe fix +Suggested fix: 55 55 | } 56 56 | 57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/4897 @@ -300,6 +312,8 @@ F601.py:58:19: F601 [*] Dictionary key literal `"x"` repeated 59 59 | 60 60 | t={"x":("test123"), "x":"test123"} + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F601.py:60:21: F601 [*] Dictionary key literal `"x"` repeated | 58 | t={"x":"test123", "x":("test123")} @@ -309,11 +323,11 @@ F601.py:60:21: F601 [*] Dictionary key literal `"x"` repeated | = help: Remove repeated key literal `"x"` -ℹ Unsafe fix +Suggested fix: 57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/4897 58 58 | t={"x":"test123", "x":("test123")} 59 59 | 60 |-t={"x":("test123"), "x":"test123"} 60 |+t={"x":("test123")} - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap index c092beeb97607..15fefe7ed3d69 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap @@ -44,7 +44,7 @@ F602.py:13:5: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -ℹ Unsafe fix +Suggested fix: 10 10 | a: 1, 11 11 | a: 2, 12 12 | a: 3, @@ -53,6 +53,8 @@ F602.py:13:5: F602 [*] Dictionary key `a` repeated 15 14 | 16 15 | x = { + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F602.py:18:5: F602 Dictionary key `a` repeated | 16 | x = { @@ -86,7 +88,7 @@ F602.py:20:5: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -ℹ Unsafe fix +Suggested fix: 17 17 | a: 1, 18 18 | a: 2, 19 19 | a: 3, @@ -95,6 +97,8 @@ F602.py:20:5: F602 [*] Dictionary key `a` repeated 22 21 | } 23 22 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F602.py:21:5: F602 Dictionary key `a` repeated | 19 | a: 3, @@ -116,7 +120,7 @@ F602.py:26:5: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -ℹ Unsafe fix +Suggested fix: 23 23 | 24 24 | x = { 25 25 | a: 1, @@ -125,6 +129,8 @@ F602.py:26:5: F602 [*] Dictionary key `a` repeated 28 27 | a: 3, 29 28 | a: 4, + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F602.py:27:5: F602 Dictionary key `a` repeated | 25 | a: 1, @@ -168,7 +174,7 @@ F602.py:35:5: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -ℹ Unsafe fix +Suggested fix: 32 32 | x = { 33 33 | a: 1, 34 34 | "a": 1, @@ -177,6 +183,8 @@ F602.py:35:5: F602 [*] Dictionary key `a` repeated 37 36 | a: 2, 38 37 | "a": 3, + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F602.py:37:5: F602 Dictionary key `a` repeated | 35 | a: 1, @@ -219,7 +227,7 @@ F602.py:44:12: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -ℹ Unsafe fix +Suggested fix: 41 41 | a: 4, 42 42 | } 43 43 | @@ -227,6 +235,8 @@ F602.py:44:12: F602 [*] Dictionary key `a` repeated 44 |+x = {a: 1} 45 45 | x = {a: 1, b: 2, a: 1} + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F602.py:45:18: F602 [*] Dictionary key `a` repeated | 44 | x = {a: 1, a: 1} @@ -235,11 +245,11 @@ F602.py:45:18: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -ℹ Unsafe fix +Suggested fix: 42 42 | } 43 43 | 44 44 | x = {a: 1, a: 1} 45 |-x = {a: 1, b: 2, a: 1} 45 |+x = {a: 1, b: 2} - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F632_F632.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F632_F632.py.snap index a20f5d5c45f5f..17f9bfa08edc2 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F632_F632.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F632_F632.py.snap @@ -9,13 +9,15 @@ F632.py:1:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 1 |-if x is "abc": 1 |+if x == "abc": 2 2 | pass 3 3 | 4 4 | if 123 is not y: + Run `ruff check --fix` to apply this fix. + F632.py:4:4: F632 [*] Use `!=` to compare constant literals | 2 | pass @@ -26,7 +28,7 @@ F632.py:4:4: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -ℹ Safe fix +Suggested fix: 1 1 | if x is "abc": 2 2 | pass 3 3 | @@ -36,6 +38,8 @@ F632.py:4:4: F632 [*] Use `!=` to compare constant literals 6 6 | 7 7 | if 123 is \ + Run `ruff check --fix` to apply this fix. + F632.py:7:4: F632 [*] Use `!=` to compare constant literals | 5 | pass @@ -48,7 +52,7 @@ F632.py:7:4: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -ℹ Safe fix +Suggested fix: 4 4 | if 123 is not y: 5 5 | pass 6 6 | @@ -59,6 +63,8 @@ F632.py:7:4: F632 [*] Use `!=` to compare constant literals 10 9 | 11 10 | if "123" is x < 3: + Run `ruff check --fix` to apply this fix. + F632.py:11:4: F632 [*] Use `==` to compare constant literals | 9 | pass @@ -69,7 +75,7 @@ F632.py:11:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 8 8 | not y: 9 9 | pass 10 10 | @@ -79,6 +85,8 @@ F632.py:11:4: F632 [*] Use `==` to compare constant literals 13 13 | 14 14 | if "123" != x is 3: + Run `ruff check --fix` to apply this fix. + F632.py:14:4: F632 [*] Use `==` to compare constant literals | 12 | pass @@ -89,7 +97,7 @@ F632.py:14:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 11 11 | if "123" is x < 3: 12 12 | pass 13 13 | @@ -99,6 +107,8 @@ F632.py:14:4: F632 [*] Use `==` to compare constant literals 16 16 | 17 17 | if ("123" != x) is 3: + Run `ruff check --fix` to apply this fix. + F632.py:17:4: F632 [*] Use `==` to compare constant literals | 15 | pass @@ -109,7 +119,7 @@ F632.py:17:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 14 14 | if "123" != x is 3: 15 15 | pass 16 16 | @@ -119,6 +129,8 @@ F632.py:17:4: F632 [*] Use `==` to compare constant literals 19 19 | 20 20 | if "123" != (x is 3): + Run `ruff check --fix` to apply this fix. + F632.py:20:14: F632 [*] Use `==` to compare constant literals | 18 | pass @@ -129,7 +141,7 @@ F632.py:20:14: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Safe fix +Suggested fix: 17 17 | if ("123" != x) is 3: 18 18 | pass 19 19 | @@ -139,6 +151,8 @@ F632.py:20:14: F632 [*] Use `==` to compare constant literals 22 22 | 23 23 | {2 is + Run `ruff check --fix` to apply this fix. + F632.py:23:2: F632 [*] Use `!=` to compare constant literals | 21 | pass @@ -152,7 +166,7 @@ F632.py:23:2: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -ℹ Safe fix +Suggested fix: 20 20 | if "123" != (x is 3): 21 21 | pass 22 22 | @@ -163,6 +177,8 @@ F632.py:23:2: F632 [*] Use `!=` to compare constant literals 26 25 | {2 is 27 26 | not ''} + Run `ruff check --fix` to apply this fix. + F632.py:26:2: F632 [*] Use `!=` to compare constant literals | 24 | not ''} @@ -176,7 +192,7 @@ F632.py:26:2: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -ℹ Safe fix +Suggested fix: 23 23 | {2 is 24 24 | not ''} 25 25 | @@ -187,6 +203,8 @@ F632.py:26:2: F632 [*] Use `!=` to compare constant literals 29 28 | # Regression test for 30 29 | if values[1is not None ] is not '-': + Run `ruff check --fix` to apply this fix. + F632.py:30:4: F632 [*] Use `!=` to compare constant literals | 29 | # Regression test for @@ -196,7 +214,7 @@ F632.py:30:4: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -ℹ Safe fix +Suggested fix: 27 27 | not ''} 28 28 | 29 29 | # Regression test for @@ -206,6 +224,8 @@ F632.py:30:4: F632 [*] Use `!=` to compare constant literals 32 32 | 33 33 | # Regression test for https://github.com/astral-sh/ruff/issues/11736 + Run `ruff check --fix` to apply this fix. + F632.py:30:11: F632 [*] Use `!=` to compare constant literals | 29 | # Regression test for @@ -215,7 +235,7 @@ F632.py:30:11: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -ℹ Safe fix +Suggested fix: 27 27 | not ''} 28 28 | 29 29 | # Regression test for @@ -225,6 +245,8 @@ F632.py:30:11: F632 [*] Use `!=` to compare constant literals 32 32 | 33 33 | # Regression test for https://github.com/astral-sh/ruff/issues/11736 + Run `ruff check --fix` to apply this fix. + F632.py:34:12: F632 [*] Use `!=` to compare constant literals | 33 | # Regression test for https://github.com/astral-sh/ruff/issues/11736 @@ -233,9 +255,11 @@ F632.py:34:12: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -ℹ Safe fix +Suggested fix: 31 31 | pass 32 32 | 33 33 | # Regression test for https://github.com/astral-sh/ruff/issues/11736 34 |-variable: "123 is not y" 34 |+variable: "123 != y" + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap index b2e62e8597fb6..ecb33301c94de 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap @@ -11,7 +11,7 @@ F811_17.py:6:12: F811 [*] Redefinition of unused `fu` from line 2 | = help: Remove definition: `fu` -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | 5 5 | def bar(): @@ -20,6 +20,8 @@ F811_17.py:6:12: F811 [*] Redefinition of unused `fu` from line 2 8 7 | def baz(): 9 8 | def fu(): + Run `ruff check --fix` to apply this fix. + F811_17.py:9:13: F811 Redefinition of unused `fu` from line 6 | 8 | def baz(): @@ -28,5 +30,3 @@ F811_17.py:9:13: F811 Redefinition of unused `fu` from line 6 10 | pass | = help: Remove definition: `fu` - - diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_21.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_21.py.snap index 6d0405c66f566..e90997bfc4fc6 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_21.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_21.py.snap @@ -11,7 +11,7 @@ F811_21.py:32:5: F811 [*] Redefinition of unused `Sequence` from line 26 | = help: Remove definition: `Sequence` -ℹ Safe fix +Suggested fix: 29 29 | # This should ignore the first error. 30 30 | from typing import ( 31 31 | List, # noqa: F811 @@ -22,4 +22,4 @@ F811_21.py:32:5: F811 [*] Redefinition of unused `Sequence` from line 26 35 34 | # This should ignore both errors. 36 35 | from typing import ( # noqa - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_6.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_6.py.snap index 92fc67263100e..5e1f027a4b139 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_6.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_6.py.snap @@ -11,11 +11,11 @@ F811_6.py:6:12: F811 [*] Redefinition of unused `os` from line 5 | = help: Remove definition: `os` -ℹ Safe fix +Suggested fix: 3 3 | i = 2 4 4 | if i == 1: 5 5 | import os 6 |- import os 7 6 | os.path - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_8.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_8.py.snap index 07e8aeb1e6324..b0751f68623c4 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_8.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_8.py.snap @@ -12,7 +12,7 @@ F811_8.py:5:12: F811 [*] Redefinition of unused `os` from line 4 | = help: Remove definition: `os` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | try: 4 4 | import os @@ -21,4 +21,4 @@ F811_8.py:5:12: F811 [*] Redefinition of unused `os` from line 4 7 6 | pass 8 7 | os.path - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap index 7e1b2458bfa3f..27df95f7a68c1 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap @@ -11,7 +11,7 @@ F841_0.py:3:22: F841 [*] Local variable `e` is assigned to but never used | = help: Remove assignment to unused variable `e` -ℹ Safe fix +Suggested fix: 1 1 | try: 2 2 | 1 / 0 3 |-except ValueError as e: @@ -20,6 +20,8 @@ F841_0.py:3:22: F841 [*] Local variable `e` is assigned to but never used 5 5 | 6 6 | + Run `ruff check --fix` to apply this fix. + F841_0.py:16:5: F841 [*] Local variable `z` is assigned to but never used | 14 | x = 1 @@ -29,7 +31,7 @@ F841_0.py:16:5: F841 [*] Local variable `z` is assigned to but never used | = help: Remove assignment to unused variable `z` -ℹ Unsafe fix +Suggested fix: 13 13 | def f(): 14 14 | x = 1 15 15 | y = 2 @@ -39,6 +41,8 @@ F841_0.py:16:5: F841 [*] Local variable `z` is assigned to but never used 18 18 | 19 19 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used | 19 | def f(): @@ -48,7 +52,7 @@ F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used | = help: Remove assignment to unused variable `foo` -ℹ Unsafe fix +Suggested fix: 17 17 | 18 18 | 19 19 | def f(): @@ -57,6 +61,8 @@ F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used 22 21 | 23 22 | bar = (1, 2) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:21:6: F841 [*] Local variable `a` is assigned to but never used | 19 | def f(): @@ -68,7 +74,7 @@ F841_0.py:21:6: F841 [*] Local variable `a` is assigned to but never used | = help: Remove assignment to unused variable `a` -ℹ Unsafe fix +Suggested fix: 18 18 | 19 19 | def f(): 20 20 | foo = (1, 2) @@ -78,6 +84,8 @@ F841_0.py:21:6: F841 [*] Local variable `a` is assigned to but never used 23 23 | bar = (1, 2) 24 24 | (c, d) = bar + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:21:9: F841 [*] Local variable `b` is assigned to but never used | 19 | def f(): @@ -89,7 +97,7 @@ F841_0.py:21:9: F841 [*] Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -ℹ Unsafe fix +Suggested fix: 18 18 | 19 19 | def f(): 20 20 | foo = (1, 2) @@ -99,6 +107,8 @@ F841_0.py:21:9: F841 [*] Local variable `b` is assigned to but never used 23 23 | bar = (1, 2) 24 24 | (c, d) = bar + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used | 24 | (c, d) = bar @@ -108,7 +118,7 @@ F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used | = help: Remove assignment to unused variable `baz` -ℹ Unsafe fix +Suggested fix: 23 23 | bar = (1, 2) 24 24 | (c, d) = bar 25 25 | @@ -118,6 +128,8 @@ F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used 28 28 | 29 29 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used | 49 | def c(): @@ -129,7 +141,7 @@ F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -ℹ Unsafe fix +Suggested fix: 48 48 | 49 49 | def c(): 50 50 | # F841 @@ -139,6 +151,8 @@ F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used 53 53 | def d(): 54 54 | nonlocal b + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used | 78 | def f(): @@ -148,7 +162,7 @@ F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used | = help: Remove assignment to unused variable `my_file` -ℹ Unsafe fix +Suggested fix: 76 76 | 77 77 | 78 78 | def f(): @@ -158,6 +172,8 @@ F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used 81 81 | 82 82 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used | 83 | def f(): @@ -169,7 +185,7 @@ F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used | = help: Remove assignment to unused variable `my_file` -ℹ Unsafe fix +Suggested fix: 82 82 | 83 83 | def f(): 84 84 | with ( @@ -179,6 +195,8 @@ F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used 87 87 | ): 88 88 | print("hello") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used | 100 | msg1 = "Hello, world!" @@ -190,7 +208,7 @@ F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used | = help: Remove assignment to unused variable `msg3` -ℹ Unsafe fix +Suggested fix: 99 99 | def f(x: int): 100 100 | msg1 = "Hello, world!" 101 101 | msg2 = "Hello, world!" @@ -199,6 +217,8 @@ F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used 104 103 | case 1: 105 104 | print(msg1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used | 113 | Foo = enum.Enum("Foo", "A B") @@ -210,7 +230,7 @@ F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used | = help: Remove assignment to unused variable `Baz` -ℹ Unsafe fix +Suggested fix: 112 112 | 113 113 | Foo = enum.Enum("Foo", "A B") 114 114 | Bar = enum.Enum("Bar", "A B") @@ -220,6 +240,8 @@ F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used 117 117 | match x: 118 118 | case (Foo.A): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:122:14: F841 Local variable `y` is assigned to but never used | 120 | case [Bar.A, *_]: @@ -238,5 +260,3 @@ F841_0.py:127:21: F841 Local variable `value` is assigned to but never used 128 | print(key) | = help: Remove assignment to unused variable `value` - - diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap index 9cb0b013fd00e..f91d7ab3ac756 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap @@ -9,7 +9,7 @@ F841_1.py:6:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | 5 5 | def f(): @@ -19,6 +19,8 @@ F841_1.py:6:5: F841 [*] Local variable `x` is assigned to but never used 8 8 | 9 9 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_1.py:6:8: F841 [*] Local variable `y` is assigned to but never used | 5 | def f(): @@ -27,7 +29,7 @@ F841_1.py:6:8: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | 5 5 | def f(): @@ -37,6 +39,8 @@ F841_1.py:6:8: F841 [*] Local variable `y` is assigned to but never used 8 8 | 9 9 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_1.py:16:14: F841 [*] Local variable `coords` is assigned to but never used | 15 | def f(): @@ -45,7 +49,7 @@ F841_1.py:16:14: F841 [*] Local variable `coords` is assigned to but never used | = help: Remove assignment to unused variable `coords` -ℹ Unsafe fix +Suggested fix: 13 13 | 14 14 | 15 15 | def f(): @@ -55,6 +59,8 @@ F841_1.py:16:14: F841 [*] Local variable `coords` is assigned to but never used 18 18 | 19 19 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_1.py:20:5: F841 [*] Local variable `coords` is assigned to but never used | 19 | def f(): @@ -63,7 +69,7 @@ F841_1.py:20:5: F841 [*] Local variable `coords` is assigned to but never used | = help: Remove assignment to unused variable `coords` -ℹ Unsafe fix +Suggested fix: 17 17 | 18 18 | 19 19 | def f(): @@ -73,6 +79,8 @@ F841_1.py:20:5: F841 [*] Local variable `coords` is assigned to but never used 22 22 | 23 23 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_1.py:24:6: F841 [*] Local variable `a` is assigned to but never used | 23 | def f(): @@ -81,13 +89,15 @@ F841_1.py:24:6: F841 [*] Local variable `a` is assigned to but never used | = help: Remove assignment to unused variable `a` -ℹ Unsafe fix +Suggested fix: 21 21 | 22 22 | 23 23 | def f(): 24 |- (a, b) = (x, y) = 1, 2 # this triggers F841 on everything 24 |+ (_a, b) = (x, y) = 1, 2 # this triggers F841 on everything + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_1.py:24:9: F841 [*] Local variable `b` is assigned to but never used | 23 | def f(): @@ -96,13 +106,15 @@ F841_1.py:24:9: F841 [*] Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -ℹ Unsafe fix +Suggested fix: 21 21 | 22 22 | 23 23 | def f(): 24 |- (a, b) = (x, y) = 1, 2 # this triggers F841 on everything 24 |+ (a, _b) = (x, y) = 1, 2 # this triggers F841 on everything + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_1.py:24:15: F841 [*] Local variable `x` is assigned to but never used | 23 | def f(): @@ -111,13 +123,15 @@ F841_1.py:24:15: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -ℹ Unsafe fix +Suggested fix: 21 21 | 22 22 | 23 23 | def f(): 24 |- (a, b) = (x, y) = 1, 2 # this triggers F841 on everything 24 |+ (a, b) = (_x, y) = 1, 2 # this triggers F841 on everything + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_1.py:24:18: F841 [*] Local variable `y` is assigned to but never used | 23 | def f(): @@ -126,11 +140,11 @@ F841_1.py:24:18: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -ℹ Unsafe fix +Suggested fix: 21 21 | 22 22 | 23 23 | def f(): 24 |- (a, b) = (x, y) = 1, 2 # this triggers F841 on everything 24 |+ (a, b) = (x, _y) = 1, 2 # this triggers F841 on everything - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap index 8b60f4da8a24c..919d4d3b61bf5 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap @@ -10,7 +10,7 @@ F841_3.py:5:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | 4 4 | def f(): @@ -19,6 +19,8 @@ F841_3.py:5:5: F841 [*] Local variable `x` is assigned to but never used 7 6 | 8 7 | z = 3 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:6:5: F841 [*] Local variable `y` is assigned to but never used | 4 | def f(): @@ -30,7 +32,7 @@ F841_3.py:6:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | def f(): 5 5 | x = 1 @@ -39,6 +41,8 @@ F841_3.py:6:5: F841 [*] Local variable `y` is assigned to but never used 8 7 | z = 3 9 8 | print(z) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:13:5: F841 [*] Local variable `x` is assigned to but never used | 12 | def f(): @@ -48,7 +52,7 @@ F841_3.py:13:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -ℹ Unsafe fix +Suggested fix: 10 10 | 11 11 | 12 12 | def f(): @@ -57,6 +61,8 @@ F841_3.py:13:5: F841 [*] Local variable `x` is assigned to but never used 15 14 | 16 15 | z: int = 3 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:14:5: F841 [*] Local variable `y` is assigned to but never used | 12 | def f(): @@ -68,7 +74,7 @@ F841_3.py:14:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -ℹ Unsafe fix +Suggested fix: 11 11 | 12 12 | def f(): 13 13 | x: int = 1 @@ -77,6 +83,8 @@ F841_3.py:14:5: F841 [*] Local variable `y` is assigned to but never used 16 15 | z: int = 3 17 16 | print(z) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:21:19: F841 [*] Local variable `x1` is assigned to but never used | 20 | def f(): @@ -86,7 +94,7 @@ F841_3.py:21:19: F841 [*] Local variable `x1` is assigned to but never used | = help: Remove assignment to unused variable `x1` -ℹ Unsafe fix +Suggested fix: 18 18 | 19 19 | 20 20 | def f(): @@ -96,6 +104,8 @@ F841_3.py:21:19: F841 [*] Local variable `x1` is assigned to but never used 23 23 | 24 24 | with foo() as (x2, y2): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:27:20: F841 [*] Local variable `x3` is assigned to but never used | 25 | pass @@ -106,7 +116,7 @@ F841_3.py:27:20: F841 [*] Local variable `x3` is assigned to but never used | = help: Remove assignment to unused variable `x3` -ℹ Unsafe fix +Suggested fix: 24 24 | with foo() as (x2, y2): 25 25 | pass 26 26 | @@ -116,6 +126,8 @@ F841_3.py:27:20: F841 [*] Local variable `x3` is assigned to but never used 29 29 | 30 30 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:27:33: F841 [*] Local variable `y3` is assigned to but never used | 25 | pass @@ -126,7 +138,7 @@ F841_3.py:27:33: F841 [*] Local variable `y3` is assigned to but never used | = help: Remove assignment to unused variable `y3` -ℹ Unsafe fix +Suggested fix: 24 24 | with foo() as (x2, y2): 25 25 | pass 26 26 | @@ -136,6 +148,8 @@ F841_3.py:27:33: F841 [*] Local variable `y3` is assigned to but never used 29 29 | 30 30 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:27:46: F841 [*] Local variable `z3` is assigned to but never used | 25 | pass @@ -146,7 +160,7 @@ F841_3.py:27:46: F841 [*] Local variable `z3` is assigned to but never used | = help: Remove assignment to unused variable `z3` -ℹ Unsafe fix +Suggested fix: 24 24 | with foo() as (x2, y2): 25 25 | pass 26 26 | @@ -156,6 +170,8 @@ F841_3.py:27:46: F841 [*] Local variable `z3` is assigned to but never used 29 29 | 30 30 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:32:6: F841 [*] Local variable `x1` is assigned to but never used | 31 | def f(): @@ -166,7 +182,7 @@ F841_3.py:32:6: F841 [*] Local variable `x1` is assigned to but never used | = help: Remove assignment to unused variable `x1` -ℹ Unsafe fix +Suggested fix: 29 29 | 30 30 | 31 31 | def f(): @@ -176,6 +192,8 @@ F841_3.py:32:6: F841 [*] Local variable `x1` is assigned to but never used 34 34 | coords3 = (x3, y3) = (1, 2) 35 35 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:32:10: F841 [*] Local variable `y1` is assigned to but never used | 31 | def f(): @@ -186,7 +204,7 @@ F841_3.py:32:10: F841 [*] Local variable `y1` is assigned to but never used | = help: Remove assignment to unused variable `y1` -ℹ Unsafe fix +Suggested fix: 29 29 | 30 30 | 31 31 | def f(): @@ -196,6 +214,8 @@ F841_3.py:32:10: F841 [*] Local variable `y1` is assigned to but never used 34 34 | coords3 = (x3, y3) = (1, 2) 35 35 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:33:16: F841 [*] Local variable `coords2` is assigned to but never used | 31 | def f(): @@ -206,7 +226,7 @@ F841_3.py:33:16: F841 [*] Local variable `coords2` is assigned to but never used | = help: Remove assignment to unused variable `coords2` -ℹ Unsafe fix +Suggested fix: 30 30 | 31 31 | def f(): 32 32 | (x1, y1) = (1, 2) @@ -216,6 +236,8 @@ F841_3.py:33:16: F841 [*] Local variable `coords2` is assigned to but never used 35 35 | 36 36 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:34:5: F841 [*] Local variable `coords3` is assigned to but never used | 32 | (x1, y1) = (1, 2) @@ -225,7 +247,7 @@ F841_3.py:34:5: F841 [*] Local variable `coords3` is assigned to but never used | = help: Remove assignment to unused variable `coords3` -ℹ Unsafe fix +Suggested fix: 31 31 | def f(): 32 32 | (x1, y1) = (1, 2) 33 33 | (x2, y2) = coords2 = (1, 2) @@ -235,6 +257,8 @@ F841_3.py:34:5: F841 [*] Local variable `coords3` is assigned to but never used 36 36 | 37 37 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:40:26: F841 [*] Local variable `x1` is assigned to but never used | 38 | try: @@ -245,7 +269,7 @@ F841_3.py:40:26: F841 [*] Local variable `x1` is assigned to but never used | = help: Remove assignment to unused variable `x1` -ℹ Safe fix +Suggested fix: 37 37 | def f(): 38 38 | try: 39 39 | 1 / 0 @@ -255,6 +279,8 @@ F841_3.py:40:26: F841 [*] Local variable `x1` is assigned to but never used 42 42 | 43 43 | try: + Run `ruff check --fix` to apply this fix. + F841_3.py:45:47: F841 [*] Local variable `x2` is assigned to but never used | 43 | try: @@ -265,7 +291,7 @@ F841_3.py:45:47: F841 [*] Local variable `x2` is assigned to but never used | = help: Remove assignment to unused variable `x2` -ℹ Safe fix +Suggested fix: 42 42 | 43 43 | try: 44 44 | 1 / 0 @@ -275,6 +301,8 @@ F841_3.py:45:47: F841 [*] Local variable `x2` is assigned to but never used 47 47 | 48 48 | + Run `ruff check --fix` to apply this fix. + F841_3.py:50:5: F841 [*] Local variable `x` is assigned to but never used | 49 | def f(a, b): @@ -285,7 +313,7 @@ F841_3.py:50:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -ℹ Unsafe fix +Suggested fix: 47 47 | 48 48 | 49 49 | def f(a, b): @@ -295,6 +323,8 @@ F841_3.py:50:5: F841 [*] Local variable `x` is assigned to but never used 52 52 | if a is not None 53 53 | else b + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:56:5: F841 [*] Local variable `y` is assigned to but never used | 54 | ) @@ -305,7 +335,7 @@ F841_3.py:56:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -ℹ Unsafe fix +Suggested fix: 53 53 | else b 54 54 | ) 55 55 | @@ -316,6 +346,8 @@ F841_3.py:56:5: F841 [*] Local variable `y` is assigned to but never used 59 58 | 60 59 | def f(a, b): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:61:5: F841 [*] Local variable `x` is assigned to but never used | 60 | def f(a, b): @@ -326,7 +358,7 @@ F841_3.py:61:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -ℹ Unsafe fix +Suggested fix: 58 58 | 59 59 | 60 60 | def f(a, b): @@ -339,6 +371,8 @@ F841_3.py:61:5: F841 [*] Local variable `x` is assigned to but never used 67 62 | y = \ 68 63 | a if a is not None else b + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:67:5: F841 [*] Local variable `y` is assigned to but never used | 65 | ) @@ -349,7 +383,7 @@ F841_3.py:67:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -ℹ Unsafe fix +Suggested fix: 64 64 | else b 65 65 | ) 66 66 | @@ -359,6 +393,8 @@ F841_3.py:67:5: F841 [*] Local variable `y` is assigned to but never used 70 68 | 71 69 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:72:24: F841 [*] Local variable `cm` is assigned to but never used | 71 | def f(): @@ -368,7 +404,7 @@ F841_3.py:72:24: F841 [*] Local variable `cm` is assigned to but never used | = help: Remove assignment to unused variable `cm` -ℹ Unsafe fix +Suggested fix: 69 69 | 70 70 | 71 71 | def f(): @@ -378,6 +414,8 @@ F841_3.py:72:24: F841 [*] Local variable `cm` is assigned to but never used 74 74 | 75 75 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:77:25: F841 [*] Local variable `cm` is assigned to but never used | 76 | def f(): @@ -387,7 +425,7 @@ F841_3.py:77:25: F841 [*] Local variable `cm` is assigned to but never used | = help: Remove assignment to unused variable `cm` -ℹ Unsafe fix +Suggested fix: 74 74 | 75 75 | 76 76 | def f(): @@ -397,6 +435,8 @@ F841_3.py:77:25: F841 [*] Local variable `cm` is assigned to but never used 79 79 | 80 80 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:87:26: F841 [*] Local variable `cm` is assigned to but never used | 86 | def f(): @@ -406,7 +446,7 @@ F841_3.py:87:26: F841 [*] Local variable `cm` is assigned to but never used | = help: Remove assignment to unused variable `cm` -ℹ Unsafe fix +Suggested fix: 84 84 | 85 85 | 86 86 | def f(): @@ -416,6 +456,8 @@ F841_3.py:87:26: F841 [*] Local variable `cm` is assigned to but never used 89 89 | 90 90 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:92:5: F841 [*] Local variable `toplevel` is assigned to but never used | 91 | def f(): @@ -426,7 +468,7 @@ F841_3.py:92:5: F841 [*] Local variable `toplevel` is assigned to but never used | = help: Remove assignment to unused variable `toplevel` -ℹ Unsafe fix +Suggested fix: 89 89 | 90 90 | 91 91 | def f(): @@ -436,6 +478,8 @@ F841_3.py:92:5: F841 [*] Local variable `toplevel` is assigned to but never used 94 94 | break 95 95 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:98:5: F841 [*] Local variable `toplevel` is assigned to but never used | 97 | def f(): @@ -444,7 +488,7 @@ F841_3.py:98:5: F841 [*] Local variable `toplevel` is assigned to but never used | = help: Remove assignment to unused variable `toplevel` -ℹ Unsafe fix +Suggested fix: 95 95 | 96 96 | 97 97 | def f(): @@ -454,6 +498,8 @@ F841_3.py:98:5: F841 [*] Local variable `toplevel` is assigned to but never used 100 100 | 101 101 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:98:16: F841 [*] Local variable `tt` is assigned to but never used | 97 | def f(): @@ -462,7 +508,7 @@ F841_3.py:98:16: F841 [*] Local variable `tt` is assigned to but never used | = help: Remove assignment to unused variable `tt` -ℹ Unsafe fix +Suggested fix: 95 95 | 96 96 | 97 97 | def f(): @@ -472,6 +518,8 @@ F841_3.py:98:16: F841 [*] Local variable `tt` is assigned to but never used 100 100 | 101 101 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:102:5: F841 [*] Local variable `toplevel` is assigned to but never used | 101 | def f(): @@ -480,7 +528,7 @@ F841_3.py:102:5: F841 [*] Local variable `toplevel` is assigned to but never use | = help: Remove assignment to unused variable `toplevel` -ℹ Unsafe fix +Suggested fix: 99 99 | 100 100 | 101 101 | def f(): @@ -490,6 +538,8 @@ F841_3.py:102:5: F841 [*] Local variable `toplevel` is assigned to but never use 104 104 | 105 105 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:106:14: F841 [*] Local variable `toplevel` is assigned to but never used | 105 | def f(): @@ -498,7 +548,7 @@ F841_3.py:106:14: F841 [*] Local variable `toplevel` is assigned to but never us | = help: Remove assignment to unused variable `toplevel` -ℹ Unsafe fix +Suggested fix: 103 103 | 104 104 | 105 105 | def f(): @@ -508,6 +558,8 @@ F841_3.py:106:14: F841 [*] Local variable `toplevel` is assigned to but never us 108 108 | 109 109 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:110:5: F841 [*] Local variable `toplevel` is assigned to but never used | 109 | def f(): @@ -516,7 +568,7 @@ F841_3.py:110:5: F841 [*] Local variable `toplevel` is assigned to but never use | = help: Remove assignment to unused variable `toplevel` -ℹ Unsafe fix +Suggested fix: 107 107 | 108 108 | 109 109 | def f(): @@ -526,6 +578,8 @@ F841_3.py:110:5: F841 [*] Local variable `toplevel` is assigned to but never use 112 112 | 113 113 | def f(provided: int) -> int: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:110:16: F841 [*] Local variable `tt` is assigned to but never used | 109 | def f(): @@ -534,7 +588,7 @@ F841_3.py:110:16: F841 [*] Local variable `tt` is assigned to but never used | = help: Remove assignment to unused variable `tt` -ℹ Unsafe fix +Suggested fix: 107 107 | 108 108 | 109 109 | def f(): @@ -544,6 +598,8 @@ F841_3.py:110:16: F841 [*] Local variable `tt` is assigned to but never used 112 112 | 113 113 | def f(provided: int) -> int: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:115:19: F841 Local variable `x` is assigned to but never used | 113 | def f(provided: int) -> int: @@ -614,7 +670,7 @@ F841_3.py:155:17: F841 [*] Local variable `e` is assigned to but never used | = help: Remove assignment to unused variable `e` -ℹ Safe fix +Suggested fix: 152 152 | def f() -> None: 153 153 | try: 154 154 | print("hello") @@ -624,6 +680,8 @@ F841_3.py:155:17: F841 [*] Local variable `e` is assigned to but never used 157 157 | 158 158 | + Run `ruff check --fix` to apply this fix. + F841_3.py:160:5: F841 [*] Local variable `x` is assigned to but never used | 159 | def f(): @@ -633,7 +691,7 @@ F841_3.py:160:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -ℹ Unsafe fix +Suggested fix: 157 157 | 158 158 | 159 159 | def f(): @@ -642,6 +700,8 @@ F841_3.py:160:5: F841 [*] Local variable `x` is assigned to but never used 162 161 | 163 162 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:161:5: F841 [*] Local variable `y` is assigned to but never used | 159 | def f(): @@ -651,7 +711,7 @@ F841_3.py:161:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -ℹ Unsafe fix +Suggested fix: 158 158 | 159 159 | def f(): 160 160 | x = 1 @@ -660,6 +720,8 @@ F841_3.py:161:5: F841 [*] Local variable `y` is assigned to but never used 163 162 | 164 163 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:165:5: F841 [*] Local variable `x` is assigned to but never used | 164 | def f(): @@ -670,7 +732,7 @@ F841_3.py:165:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -ℹ Unsafe fix +Suggested fix: 162 162 | 163 163 | 164 164 | def f(): @@ -679,6 +741,8 @@ F841_3.py:165:5: F841 [*] Local variable `x` is assigned to but never used 167 166 | y = 2 168 167 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:167:5: F841 [*] Local variable `y` is assigned to but never used | 165 | x = 1 @@ -688,7 +752,7 @@ F841_3.py:167:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -ℹ Unsafe fix +Suggested fix: 164 164 | def f(): 165 165 | x = 1 166 166 | @@ -697,6 +761,8 @@ F841_3.py:167:5: F841 [*] Local variable `y` is assigned to but never used 169 168 | 170 169 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_3.py:173:6: F841 [*] Local variable `x` is assigned to but never used | 171 | (x) = foo() @@ -706,11 +772,11 @@ F841_3.py:173:6: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -ℹ Unsafe fix +Suggested fix: 170 170 | def f(): 171 171 | (x) = foo() 172 172 | ((x)) = foo() 173 |- (x) = (y.z) = foo() 173 |+ (y.z) = foo() - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_4.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_4.py.snap index f5f7f03e018d6..575541f4ffd71 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_4.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_4.py.snap @@ -10,7 +10,7 @@ F841_4.py:12:5: F841 [*] Local variable `a` is assigned to but never used | = help: Remove assignment to unused variable `a` -ℹ Unsafe fix +Suggested fix: 9 9 | 10 10 | 11 11 | def bar(): @@ -20,4 +20,4 @@ F841_4.py:12:5: F841 [*] Local variable `a` is assigned to but never used 14 14 | 15 15 | - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F901_F901.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F901_F901.py.snap index 33261837366b8..607ba00e08df9 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F901_F901.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F901_F901.py.snap @@ -9,7 +9,7 @@ F901.py:2:11: F901 [*] `raise NotImplemented` should be `raise NotImplementedErr | = help: Use `raise NotImplementedError` -ℹ Safe fix +Suggested fix: 1 1 | def f() -> None: 2 |- raise NotImplemented() 2 |+ raise NotImplementedError() @@ -17,6 +17,8 @@ F901.py:2:11: F901 [*] `raise NotImplemented` should be `raise NotImplementedErr 4 4 | 5 5 | def g() -> None: + Run `ruff check --fix` to apply this fix. + F901.py:6:11: F901 [*] `raise NotImplemented` should be `raise NotImplementedError` | 5 | def g() -> None: @@ -25,7 +27,7 @@ F901.py:6:11: F901 [*] `raise NotImplemented` should be `raise NotImplementedErr | = help: Use `raise NotImplementedError` -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | 5 5 | def g() -> None: @@ -35,6 +37,8 @@ F901.py:6:11: F901 [*] `raise NotImplemented` should be `raise NotImplementedErr 8 8 | 9 9 | def h() -> None: + Run `ruff check --fix` to apply this fix. + F901.py:11:11: F901 [*] `raise NotImplemented` should be `raise NotImplementedError` | 9 | def h() -> None: @@ -44,7 +48,7 @@ F901.py:11:11: F901 [*] `raise NotImplemented` should be `raise NotImplementedEr | = help: Use `raise NotImplementedError` -ℹ Safe fix +Suggested fix: 1 |+import builtins 1 2 | def f() -> None: 2 3 | raise NotImplemented() @@ -55,3 +59,5 @@ F901.py:11:11: F901 [*] `raise NotImplemented` should be `raise NotImplementedEr 10 11 | NotImplementedError = "foo" 11 |- raise NotImplemented 12 |+ raise builtins.NotImplementedError + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_global_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_global_scope.snap index 2ac6d0d48702d..997efecd66b90 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_global_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_global_scope.snap @@ -11,7 +11,7 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove unused import: `os` -ℹ Safe fix +Suggested fix: 2 2 | import os 3 3 | 4 4 | def f(): @@ -21,4 +21,4 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 7 7 | # Despite this `del`, `import os` in `f` should still be flagged as shadowing an unused 8 8 | # import. (This is a false negative, but is consistent with Pyflakes.) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_local_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_local_scope.snap index a419b0ee52fdd..247ccf8a73331 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_local_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_local_scope.snap @@ -10,13 +10,15 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove unused import: `os` -ℹ Safe fix +Suggested fix: 1 1 | 2 |-import os 3 2 | 4 3 | def f(): 5 4 | import os + Run `ruff check --fix` to apply this fix. + :5:12: F811 [*] Redefinition of unused `os` from line 2 | 4 | def f(): @@ -27,7 +29,7 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove definition: `os` -ℹ Safe fix +Suggested fix: 2 2 | import os 3 3 | 4 4 | def f(): @@ -36,4 +38,4 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 7 6 | # Despite this `del`, `import os` in `f` should still be flagged as shadowing an unused 8 7 | # import. - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_import_shadow_in_local_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_import_shadow_in_local_scope.snap index 9dfb6527c7f9b..c0aeb30762798 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_import_shadow_in_local_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_import_shadow_in_local_scope.snap @@ -10,13 +10,15 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove unused import: `os` -ℹ Safe fix +Suggested fix: 1 1 | 2 |-import os 3 2 | 4 3 | def f(): 5 4 | os = 1 + Run `ruff check --fix` to apply this fix. + :5:5: F811 Redefinition of unused `os` from line 2 | 4 | def f(): @@ -25,5 +27,3 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 6 | print(os) | = help: Remove definition: `os` - - diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap index df130cc6e8937..3c0bca8f776a9 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap @@ -12,7 +12,7 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove definition: `os` -ℹ Safe fix +Suggested fix: 1 1 | 2 2 | def f(): 3 3 | import os @@ -21,4 +21,4 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 6 5 | # Despite this `del`, `import os` should still be flagged as shadowing an unused 7 6 | # import. - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap index 360b3028862ec..aebcff605cd7e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap @@ -11,7 +11,7 @@ F841_0.py:3:22: F841 [*] Local variable `e` is assigned to but never used | = help: Remove assignment to unused variable `e` -ℹ Safe fix +Suggested fix: 1 1 | try: 2 2 | 1 / 0 3 |-except ValueError as e: @@ -20,6 +20,8 @@ F841_0.py:3:22: F841 [*] Local variable `e` is assigned to but never used 5 5 | 6 6 | + Run `ruff check --fix` to apply this fix. + F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used | 19 | def f(): @@ -29,7 +31,7 @@ F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used | = help: Remove assignment to unused variable `foo` -ℹ Unsafe fix +Suggested fix: 17 17 | 18 18 | 19 19 | def f(): @@ -38,6 +40,8 @@ F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used 22 21 | 23 22 | bar = (1, 2) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:21:6: F841 Local variable `a` is assigned to but never used | 19 | def f(): @@ -69,7 +73,7 @@ F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used | = help: Remove assignment to unused variable `baz` -ℹ Unsafe fix +Suggested fix: 23 23 | bar = (1, 2) 24 24 | (c, d) = bar 25 25 | @@ -79,6 +83,8 @@ F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used 28 28 | 29 29 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:35:5: F841 [*] Local variable `_` is assigned to but never used | 34 | def f(): @@ -89,7 +95,7 @@ F841_0.py:35:5: F841 [*] Local variable `_` is assigned to but never used | = help: Remove assignment to unused variable `_` -ℹ Unsafe fix +Suggested fix: 32 32 | 33 33 | 34 34 | def f(): @@ -98,6 +104,8 @@ F841_0.py:35:5: F841 [*] Local variable `_` is assigned to but never used 37 36 | _discarded = 1 38 37 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:36:5: F841 [*] Local variable `__` is assigned to but never used | 34 | def f(): @@ -108,7 +116,7 @@ F841_0.py:36:5: F841 [*] Local variable `__` is assigned to but never used | = help: Remove assignment to unused variable `__` -ℹ Unsafe fix +Suggested fix: 33 33 | 34 34 | def f(): 35 35 | _ = 1 @@ -117,6 +125,8 @@ F841_0.py:36:5: F841 [*] Local variable `__` is assigned to but never used 38 37 | 39 38 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:37:5: F841 [*] Local variable `_discarded` is assigned to but never used | 35 | _ = 1 @@ -126,7 +136,7 @@ F841_0.py:37:5: F841 [*] Local variable `_discarded` is assigned to but never us | = help: Remove assignment to unused variable `_discarded` -ℹ Unsafe fix +Suggested fix: 34 34 | def f(): 35 35 | _ = 1 36 36 | __ = 1 @@ -135,6 +145,8 @@ F841_0.py:37:5: F841 [*] Local variable `_discarded` is assigned to but never us 39 38 | 40 39 | a = 1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used | 49 | def c(): @@ -146,7 +158,7 @@ F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -ℹ Unsafe fix +Suggested fix: 48 48 | 49 49 | def c(): 50 50 | # F841 @@ -156,6 +168,8 @@ F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used 53 53 | def d(): 54 54 | nonlocal b + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used | 78 | def f(): @@ -165,7 +179,7 @@ F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used | = help: Remove assignment to unused variable `my_file` -ℹ Unsafe fix +Suggested fix: 76 76 | 77 77 | 78 78 | def f(): @@ -175,6 +189,8 @@ F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used 81 81 | 82 82 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used | 83 | def f(): @@ -186,7 +202,7 @@ F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used | = help: Remove assignment to unused variable `my_file` -ℹ Unsafe fix +Suggested fix: 82 82 | 83 83 | def f(): 84 84 | with ( @@ -196,6 +212,8 @@ F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used 87 87 | ): 88 88 | print("hello") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used | 100 | msg1 = "Hello, world!" @@ -207,7 +225,7 @@ F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used | = help: Remove assignment to unused variable `msg3` -ℹ Unsafe fix +Suggested fix: 99 99 | def f(x: int): 100 100 | msg1 = "Hello, world!" 101 101 | msg2 = "Hello, world!" @@ -216,6 +234,8 @@ F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used 104 103 | case 1: 105 104 | print(msg1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used | 113 | Foo = enum.Enum("Foo", "A B") @@ -227,7 +247,7 @@ F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used | = help: Remove assignment to unused variable `Baz` -ℹ Unsafe fix +Suggested fix: 112 112 | 113 113 | Foo = enum.Enum("Foo", "A B") 114 114 | Bar = enum.Enum("Bar", "A B") @@ -237,6 +257,8 @@ F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used 117 117 | match x: 118 118 | case (Foo.A): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_0.py:122:14: F841 Local variable `y` is assigned to but never used | 120 | case [Bar.A, *_]: @@ -266,7 +288,7 @@ F841_0.py:152:25: F841 [*] Local variable `_` is assigned to but never used | = help: Remove assignment to unused variable `_` -ℹ Safe fix +Suggested fix: 149 149 | def f(): 150 150 | try: 151 151 | pass @@ -274,4 +296,4 @@ F841_0.py:152:25: F841 [*] Local variable `_` is assigned to but never used 152 |+ except Exception: 153 153 | pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__future_annotations.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__future_annotations.snap index 5a15b089872bd..dfc692d780557 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__future_annotations.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__future_annotations.snap @@ -11,7 +11,7 @@ future_annotations.py:8:5: F401 [*] `models.Nut` imported but unused | = help: Remove unused import: `models.Nut` -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | from models import ( 7 7 | Fruit, @@ -20,6 +20,8 @@ future_annotations.py:8:5: F401 [*] `models.Nut` imported but unused 10 9 | 11 10 | + Run `ruff check --fix` to apply this fix. + future_annotations.py:26:19: F821 Undefined name `Bar` | 25 | @classmethod @@ -27,5 +29,3 @@ future_annotations.py:26:19: F821 Undefined name `Bar` | ^^^ F821 27 | return cls(x=0, y=0) | - - diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_multiple_unbinds_from_module_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_multiple_unbinds_from_module_scope.snap index 8963cbc2ec14e..1fad839e9da69 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_multiple_unbinds_from_module_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_multiple_unbinds_from_module_scope.snap @@ -11,7 +11,7 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -ℹ Safe fix +Suggested fix: 4 4 | def f(): 5 5 | try: 6 6 | pass @@ -21,6 +21,8 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 9 9 | 10 10 | try: + Run `ruff check --fix` to apply this fix. + :12:26: F841 [*] Local variable `x` is assigned to but never used | 10 | try: @@ -31,7 +33,7 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -ℹ Safe fix +Suggested fix: 9 9 | 10 10 | try: 11 11 | pass @@ -41,4 +43,4 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 14 14 | 15 15 | # This should resolve to the `x` in `x = 1`. - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_class_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_class_scope.snap index 30714ade296db..ca50e1cba3fbb 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_class_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_class_scope.snap @@ -11,7 +11,7 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -ℹ Safe fix +Suggested fix: 5 5 | def f(): 6 6 | try: 7 7 | pass @@ -21,6 +21,8 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 10 10 | 11 11 | # This should raise an F821 error, rather than resolving to the + Run `ruff check --fix` to apply this fix. + :13:15: F821 Undefined name `x` | 11 | # This should raise an F821 error, rather than resolving to the @@ -28,5 +30,3 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 13 | print(x) | ^ F821 | - - diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_module_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_module_scope.snap index 1a45bebe8c475..95ccc929b258b 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_module_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_module_scope.snap @@ -11,7 +11,7 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -ℹ Safe fix +Suggested fix: 4 4 | def f(): 5 5 | try: 6 6 | pass @@ -21,4 +21,4 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 9 9 | 10 10 | # This should resolve to the `x` in `x = 1`. - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_nested_module_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_nested_module_scope.snap index f2885ba2b58cd..f38b9262d3366 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_nested_module_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_nested_module_scope.snap @@ -11,7 +11,7 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -ℹ Safe fix +Suggested fix: 4 4 | def f(): 5 5 | try: 6 6 | pass @@ -21,6 +21,8 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 9 9 | 10 10 | def g(): + Run `ruff check --fix` to apply this fix. + :13:30: F841 [*] Local variable `x` is assigned to but never used | 11 | try: @@ -31,7 +33,7 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -ℹ Safe fix +Suggested fix: 10 10 | def g(): 11 11 | try: 12 12 | pass @@ -41,4 +43,4 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 15 15 | 16 16 | # This should resolve to the `x` in `x = 1`. - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__multi_statement_lines.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__multi_statement_lines.snap index c2e289a7ef4d0..01fd17ba548ba 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__multi_statement_lines.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__multi_statement_lines.snap @@ -10,7 +10,7 @@ multi_statement_lines.py:2:12: F401 [*] `foo1` imported but unused | = help: Remove unused import: `foo1` -ℹ Safe fix +Suggested fix: 1 1 | if True: 2 |- import foo1; x = 1 2 |+ x = 1 @@ -18,6 +18,8 @@ multi_statement_lines.py:2:12: F401 [*] `foo1` imported but unused 4 4 | 5 5 | if True: + Run `ruff check --fix` to apply this fix. + multi_statement_lines.py:3:12: F401 [*] `foo2` imported but unused | 1 | if True: @@ -29,7 +31,7 @@ multi_statement_lines.py:3:12: F401 [*] `foo2` imported but unused | = help: Remove unused import: `foo2` -ℹ Safe fix +Suggested fix: 1 1 | if True: 2 2 | import foo1; x = 1 3 |- import foo2; x = 1 @@ -38,6 +40,8 @@ multi_statement_lines.py:3:12: F401 [*] `foo2` imported but unused 5 5 | if True: 6 6 | import foo3; \ + Run `ruff check --fix` to apply this fix. + multi_statement_lines.py:6:12: F401 [*] `foo3` imported but unused | 5 | if True: @@ -47,7 +51,7 @@ multi_statement_lines.py:6:12: F401 [*] `foo3` imported but unused | = help: Remove unused import: `foo3` -ℹ Safe fix +Suggested fix: 3 3 | import foo2; x = 1 4 4 | 5 5 | if True: @@ -58,6 +62,8 @@ multi_statement_lines.py:6:12: F401 [*] `foo3` imported but unused 9 8 | if True: 10 9 | import foo4 \ + Run `ruff check --fix` to apply this fix. + multi_statement_lines.py:10:12: F401 [*] `foo4` imported but unused | 9 | if True: @@ -67,7 +73,7 @@ multi_statement_lines.py:10:12: F401 [*] `foo4` imported but unused | = help: Remove unused import: `foo4` -ℹ Safe fix +Suggested fix: 7 7 | x = 1 8 8 | 9 9 | if True: @@ -78,6 +84,8 @@ multi_statement_lines.py:10:12: F401 [*] `foo4` imported but unused 13 12 | if True: 14 13 | x = 1; import foo5 + Run `ruff check --fix` to apply this fix. + multi_statement_lines.py:14:19: F401 [*] `foo5` imported but unused | 13 | if True: @@ -86,7 +94,7 @@ multi_statement_lines.py:14:19: F401 [*] `foo5` imported but unused | = help: Remove unused import: `foo5` -ℹ Safe fix +Suggested fix: 11 11 | ; x = 1 12 12 | 13 13 | if True: @@ -96,6 +104,8 @@ multi_statement_lines.py:14:19: F401 [*] `foo5` imported but unused 16 16 | 17 17 | if True: + Run `ruff check --fix` to apply this fix. + multi_statement_lines.py:19:17: F401 [*] `foo6` imported but unused | 17 | if True: @@ -107,7 +117,7 @@ multi_statement_lines.py:19:17: F401 [*] `foo6` imported but unused | = help: Remove unused import: `foo6` -ℹ Safe fix +Suggested fix: 15 15 | 16 16 | 17 17 | if True: @@ -118,6 +128,8 @@ multi_statement_lines.py:19:17: F401 [*] `foo6` imported but unused 21 20 | if True: 22 21 | x = 1 \ + Run `ruff check --fix` to apply this fix. + multi_statement_lines.py:23:18: F401 [*] `foo7` imported but unused | 21 | if True: @@ -129,7 +141,7 @@ multi_statement_lines.py:23:18: F401 [*] `foo7` imported but unused | = help: Remove unused import: `foo7` -ℹ Safe fix +Suggested fix: 20 20 | 21 21 | if True: 22 22 | x = 1 \ @@ -139,6 +151,8 @@ multi_statement_lines.py:23:18: F401 [*] `foo7` imported but unused 25 25 | if True: 26 26 | x = 1; import foo8; x = 1 + Run `ruff check --fix` to apply this fix. + multi_statement_lines.py:26:19: F401 [*] `foo8` imported but unused | 25 | if True: @@ -148,7 +162,7 @@ multi_statement_lines.py:26:19: F401 [*] `foo8` imported but unused | = help: Remove unused import: `foo8` -ℹ Safe fix +Suggested fix: 23 23 | ; import foo7 24 24 | 25 25 | if True: @@ -158,6 +172,8 @@ multi_statement_lines.py:26:19: F401 [*] `foo8` imported but unused 28 28 | 29 29 | if True: + Run `ruff check --fix` to apply this fix. + multi_statement_lines.py:27:23: F401 [*] `foo9` imported but unused | 25 | if True: @@ -169,7 +185,7 @@ multi_statement_lines.py:27:23: F401 [*] `foo9` imported but unused | = help: Remove unused import: `foo9` -ℹ Safe fix +Suggested fix: 24 24 | 25 25 | if True: 26 26 | x = 1; import foo8; x = 1 @@ -179,6 +195,8 @@ multi_statement_lines.py:27:23: F401 [*] `foo9` imported but unused 29 29 | if True: 30 30 | x = 1; \ + Run `ruff check --fix` to apply this fix. + multi_statement_lines.py:31:16: F401 [*] `foo10` imported but unused | 29 | if True: @@ -189,7 +207,7 @@ multi_statement_lines.py:31:16: F401 [*] `foo10` imported but unused | = help: Remove unused import: `foo10` -ℹ Safe fix +Suggested fix: 28 28 | 29 29 | if True: 30 30 | x = 1; \ @@ -200,6 +218,8 @@ multi_statement_lines.py:31:16: F401 [*] `foo10` imported but unused 34 33 | if True: 35 34 | x = 1 \ + Run `ruff check --fix` to apply this fix. + multi_statement_lines.py:36:17: F401 [*] `foo11` imported but unused | 34 | if True: @@ -210,7 +230,7 @@ multi_statement_lines.py:36:17: F401 [*] `foo11` imported but unused | = help: Remove unused import: `foo11` -ℹ Safe fix +Suggested fix: 33 33 | 34 34 | if True: 35 35 | x = 1 \ @@ -219,6 +239,8 @@ multi_statement_lines.py:36:17: F401 [*] `foo11` imported but unused 38 37 | 39 38 | if True: + Run `ruff check --fix` to apply this fix. + multi_statement_lines.py:42:16: F401 [*] `foo12` imported but unused | 40 | x = 1; \ @@ -230,7 +252,7 @@ multi_statement_lines.py:42:16: F401 [*] `foo12` imported but unused | = help: Remove unused import: `foo12` -ℹ Safe fix +Suggested fix: 37 37 | ;x = 1 38 38 | 39 39 | if True: @@ -242,6 +264,8 @@ multi_statement_lines.py:42:16: F401 [*] `foo12` imported but unused 44 42 | if True: 45 43 | x = 1; \ + Run `ruff check --fix` to apply this fix. + multi_statement_lines.py:47:12: F401 [*] `foo13` imported but unused | 45 | x = 1; \ @@ -251,7 +275,7 @@ multi_statement_lines.py:47:12: F401 [*] `foo13` imported but unused | = help: Remove unused import: `foo13` -ℹ Safe fix +Suggested fix: 42 42 | import foo12 43 43 | 44 44 | if True: @@ -263,6 +287,8 @@ multi_statement_lines.py:47:12: F401 [*] `foo13` imported but unused 49 47 | 50 48 | if True: + Run `ruff check --fix` to apply this fix. + multi_statement_lines.py:53:12: F401 [*] `foo14` imported but unused | 51 | x = 1; \ @@ -274,7 +300,7 @@ multi_statement_lines.py:53:12: F401 [*] `foo14` imported but unused | = help: Remove unused import: `foo14` -ℹ Safe fix +Suggested fix: 50 50 | if True: 51 51 | x = 1; \ 52 52 | # \ @@ -283,6 +309,8 @@ multi_statement_lines.py:53:12: F401 [*] `foo14` imported but unused 55 54 | # Continuation, but not as the last content in the file. 56 55 | x = 1; \ + Run `ruff check --fix` to apply this fix. + multi_statement_lines.py:57:8: F401 [*] `foo15` imported but unused | 55 | # Continuation, but not as the last content in the file. @@ -294,7 +322,7 @@ multi_statement_lines.py:57:8: F401 [*] `foo15` imported but unused | = help: Remove unused import: `foo15` -ℹ Safe fix +Suggested fix: 53 53 | import foo14 54 54 | 55 55 | # Continuation, but not as the last content in the file. @@ -305,6 +333,8 @@ multi_statement_lines.py:57:8: F401 [*] `foo15` imported but unused 59 58 | # Continuation, followed by end-of-file. (Removing `import foo` would cause a syntax 60 59 | # error.) + Run `ruff check --fix` to apply this fix. + multi_statement_lines.py:62:8: F401 [*] `foo16` imported but unused | 60 | # error.) @@ -314,7 +344,7 @@ multi_statement_lines.py:62:8: F401 [*] `foo16` imported but unused | = help: Remove unused import: `foo16` -ℹ Safe fix +Suggested fix: 58 58 | 59 59 | # Continuation, followed by end-of-file. (Removing `import foo` would cause a syntax 60 60 | # error.) @@ -322,4 +352,4 @@ multi_statement_lines.py:62:8: F401 [*] `foo16` imported but unused 62 |-import foo16 61 |+x = 1; - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap index 1c7ce2e8a7a8b..6114e9113259e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap @@ -8,7 +8,7 @@ __init__.py:19:8: F401 [*] `sys` imported but unused | = help: Remove unused import: `sys` -ℹ Unsafe fix +Suggested fix: 16 16 | import argparse as argparse # Ok: is redundant alias 17 17 | 18 18 | @@ -17,6 +17,8 @@ __init__.py:19:8: F401 [*] `sys` imported but unused 21 20 | 22 21 | # first-party + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + __init__.py:33:15: F401 [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 33 | from . import unused # F401: change to redundant alias @@ -24,7 +26,7 @@ __init__.py:33:15: F401 [*] `.unused` imported but unused; consider removing, ad | = help: Use an explicit re-export: `unused as unused` -ℹ Safe fix +Suggested fix: 30 30 | from . import aliased as aliased # Ok: is redundant alias 31 31 | 32 32 | @@ -34,6 +36,8 @@ __init__.py:33:15: F401 [*] `.unused` imported but unused; consider removing, ad 35 35 | 36 36 | from . import renamed as bees # F401: no fix + Run `ruff check --fix` to apply this fix. + __init__.py:36:26: F401 `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 36 | from . import renamed as bees # F401: no fix diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap index cb3e3848d5a93..24bf30beac4f4 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap @@ -8,7 +8,7 @@ __init__.py:19:8: F401 [*] `sys` imported but unused | = help: Remove unused import: `sys` -ℹ Unsafe fix +Suggested fix: 16 16 | import argparse # Ok: is exported in __all__ 17 17 | 18 18 | @@ -17,6 +17,8 @@ __init__.py:19:8: F401 [*] `sys` imported but unused 21 20 | 22 21 | # first-party + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + __init__.py:36:15: F401 [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 36 | from . import unused # F401: add to __all__ @@ -24,13 +26,15 @@ __init__.py:36:15: F401 [*] `.unused` imported but unused; consider removing, ad | = help: Add unused import `unused` to __all__ -ℹ Safe fix +Suggested fix: 39 39 | from . import renamed as bees # F401: add to __all__ 40 40 | 41 41 | 42 |-__all__ = ["argparse", "exported"] 42 |+__all__ = ["argparse", "exported", "unused"] + Run `ruff check --fix` to apply this fix. + __init__.py:39:26: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 39 | from . import renamed as bees # F401: add to __all__ @@ -38,9 +42,11 @@ __init__.py:39:26: F401 [*] `.renamed` imported but unused; consider removing, a | = help: Add unused import `bees` to __all__ -ℹ Safe fix +Suggested fix: 39 39 | from . import renamed as bees # F401: add to __all__ 40 40 | 41 41 | 42 |-__all__ = ["argparse", "exported"] 42 |+__all__ = ["argparse", "exported", "bees"] + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_26__all_empty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_26__all_empty____init__.py.snap index 6c393f0fbfce9..5418d94b1907f 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_26__all_empty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_26__all_empty____init__.py.snap @@ -8,13 +8,15 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add | = help: Add unused import `unused` to __all__ -ℹ Safe fix +Suggested fix: 8 8 | from . import renamed as bees # F401: add to __all__ 9 9 | 10 10 | 11 |-__all__ = [] 11 |+__all__ = ["unused"] + Run `ruff check --fix` to apply this fix. + __init__.py:8:26: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 8 | from . import renamed as bees # F401: add to __all__ @@ -22,9 +24,11 @@ __init__.py:8:26: F401 [*] `.renamed` imported but unused; consider removing, ad | = help: Add unused import `bees` to __all__ -ℹ Safe fix +Suggested fix: 8 8 | from . import renamed as bees # F401: add to __all__ 9 9 | 10 10 | 11 |-__all__ = [] 11 |+__all__ = ["bees"] + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_28__all_multiple____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_28__all_multiple____init__.py.snap index a77b95641d619..f05ec9469c125 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_28__all_multiple____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_28__all_multiple____init__.py.snap @@ -8,13 +8,15 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add | = help: Add unused import `unused` to __all__ -ℹ Safe fix +Suggested fix: 5 5 | from . import unused, renamed as bees # F401: add to __all__ 6 6 | 7 7 | 8 |-__all__ = []; 8 |+__all__ = ["bees", "unused"]; + Run `ruff check --fix` to apply this fix. + __init__.py:5:34: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 5 | from . import unused, renamed as bees # F401: add to __all__ @@ -22,9 +24,11 @@ __init__.py:5:34: F401 [*] `.renamed` imported but unused; consider removing, ad | = help: Add unused import `bees` to __all__ -ℹ Safe fix +Suggested fix: 5 5 | from . import unused, renamed as bees # F401: add to __all__ 6 6 | 7 7 | 8 |-__all__ = []; 8 |+__all__ = ["bees", "unused"]; + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap index 3f4855817c4b1..52f8bc5dd1ba8 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap @@ -10,8 +10,10 @@ __init__.py:1:8: F401 [*] `os` imported but unused | = help: Remove unused import: `os` -ℹ Unsafe fix +Suggested fix: 1 |-import os 2 1 | 3 2 | print(__path__) -4 3 | +4 3 | + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F841_F841_4.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F841_F841_4.py.snap index 661343dd141da..e218cfda8bcbc 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F841_F841_4.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F841_F841_4.py.snap @@ -10,7 +10,7 @@ F841_4.py:12:5: F841 [*] Local variable `a` is assigned to but never used | = help: Remove assignment to unused variable `a` -ℹ Unsafe fix +Suggested fix: 9 9 | 10 10 | 11 11 | def bar(): @@ -20,6 +20,8 @@ F841_4.py:12:5: F841 [*] Local variable `a` is assigned to but never used 14 14 | 15 15 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_4.py:13:5: F841 [*] Local variable `b` is assigned to but never used | 11 | def bar(): @@ -29,7 +31,7 @@ F841_4.py:13:5: F841 [*] Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -ℹ Unsafe fix +Suggested fix: 10 10 | 11 11 | def bar(): 12 12 | a = foo() @@ -39,6 +41,8 @@ F841_4.py:13:5: F841 [*] Local variable `b` is assigned to but never used 15 15 | 16 16 | def baz(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + F841_4.py:13:8: F841 [*] Local variable `c` is assigned to but never used | 11 | def bar(): @@ -48,7 +52,7 @@ F841_4.py:13:8: F841 [*] Local variable `c` is assigned to but never used | = help: Remove assignment to unused variable `c` -ℹ Unsafe fix +Suggested fix: 10 10 | 11 11 | def bar(): 12 12 | a = foo() @@ -58,4 +62,4 @@ F841_4.py:13:8: F841 [*] Local variable `c` is assigned to but never used 15 15 | 16 16 | def baz(): - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_double_shadowing_except.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_double_shadowing_except.snap index 45cdf09182aca..46f6aad63755b 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_double_shadowing_except.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_double_shadowing_except.snap @@ -12,7 +12,7 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | try: 6 6 | 1 / 0 @@ -22,6 +22,8 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 9 9 | except ImportError as x: 10 10 | pass + Run `ruff check --fix` to apply this fix. + :9:27: F841 [*] Local variable `x` is assigned to but never used | 7 | except ValueError as x: @@ -32,7 +34,7 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -ℹ Safe fix +Suggested fix: 6 6 | 1 / 0 7 7 | except ValueError as x: 8 8 | pass @@ -42,4 +44,4 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 11 11 | 12 12 | # No error here, though it should arguably be an F821 error. `x` will - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_shadowing_except.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_shadowing_except.snap index 32d67c366975e..301f56b4431c6 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_shadowing_except.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_shadowing_except.snap @@ -11,7 +11,7 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | try: 6 6 | 1 / 0 @@ -21,4 +21,4 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 9 9 | 10 10 | # No error here, though it should arguably be an F821 error. `x` will - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap index 5c4e0772479d1..16f4decf9e714 100644 --- a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap +++ b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap @@ -39,7 +39,7 @@ PGH004_0.py:18:8: PGH004 [*] Use a colon when specifying `noqa` rule codes | = help: Add missing colon -ℹ Unsafe fix +Suggested fix: 15 15 | x = 2 # noqa:X100 16 16 | 17 17 | # PGH004 @@ -49,6 +49,8 @@ PGH004_0.py:18:8: PGH004 [*] Use a colon when specifying `noqa` rule codes 20 20 | # PGH004 21 21 | x = 2 # noqa X100, X200 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PGH004_0.py:21:8: PGH004 [*] Use a colon when specifying `noqa` rule codes | 20 | # PGH004 @@ -59,7 +61,7 @@ PGH004_0.py:21:8: PGH004 [*] Use a colon when specifying `noqa` rule codes | = help: Add missing colon -ℹ Unsafe fix +Suggested fix: 18 18 | x = 2 # noqa X100 19 19 | 20 20 | # PGH004 @@ -69,6 +71,8 @@ PGH004_0.py:21:8: PGH004 [*] Use a colon when specifying `noqa` rule codes 23 23 | # PGH004 24 24 | x = 2 # noqa : X300 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PGH004_0.py:24:8: PGH004 [*] Do not add spaces between `noqa` and its colon | 23 | # PGH004 @@ -79,7 +83,7 @@ PGH004_0.py:24:8: PGH004 [*] Do not add spaces between `noqa` and its colon | = help: Remove space(s) before colon -ℹ Unsafe fix +Suggested fix: 21 21 | x = 2 # noqa X100, X200 22 22 | 23 23 | # PGH004 @@ -89,6 +93,8 @@ PGH004_0.py:24:8: PGH004 [*] Do not add spaces between `noqa` and its colon 26 26 | # PGH004 27 27 | x = 2 # noqa : X400 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PGH004_0.py:27:8: PGH004 [*] Do not add spaces between `noqa` and its colon | 26 | # PGH004 @@ -99,7 +105,7 @@ PGH004_0.py:27:8: PGH004 [*] Do not add spaces between `noqa` and its colon | = help: Remove space(s) before colon -ℹ Unsafe fix +Suggested fix: 24 24 | x = 2 # noqa : X300 25 25 | 26 26 | # PGH004 @@ -109,6 +115,8 @@ PGH004_0.py:27:8: PGH004 [*] Do not add spaces between `noqa` and its colon 29 29 | # PGH004 30 30 | x = 2 # noqa :X500 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + PGH004_0.py:30:8: PGH004 [*] Do not add spaces between `noqa` and its colon | 29 | # PGH004 @@ -117,9 +125,11 @@ PGH004_0.py:30:8: PGH004 [*] Do not add spaces between `noqa` and its colon | = help: Remove space(s) before colon -ℹ Unsafe fix +Suggested fix: 27 27 | x = 2 # noqa : X400 28 28 | 29 29 | # PGH004 30 |-x = 2 # noqa :X500 30 |+x = 2 # noqa:X500 + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0208_iteration_over_set.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0208_iteration_over_set.py.snap index 68b9aa856d41c..c821d7dce0f4c 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0208_iteration_over_set.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0208_iteration_over_set.py.snap @@ -11,7 +11,7 @@ iteration_over_set.py:3:13: PLC0208 [*] Use a sequence type instead of a `set` w | = help: Convert to `tuple` -ℹ Safe fix +Suggested fix: 1 1 | # Errors 2 2 | 3 |-for item in {1}: @@ -20,6 +20,8 @@ iteration_over_set.py:3:13: PLC0208 [*] Use a sequence type instead of a `set` w 5 5 | 6 6 | for item in {"apples", "lemons", "water"}: # flags in-line set literals + Run `ruff check --fix` to apply this fix. + iteration_over_set.py:6:13: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 4 | print(f"I can count to {item}!") @@ -30,7 +32,7 @@ iteration_over_set.py:6:13: PLC0208 [*] Use a sequence type instead of a `set` w | = help: Convert to `tuple` -ℹ Safe fix +Suggested fix: 3 3 | for item in {1}: 4 4 | print(f"I can count to {item}!") 5 5 | @@ -40,6 +42,8 @@ iteration_over_set.py:6:13: PLC0208 [*] Use a sequence type instead of a `set` w 8 8 | 9 9 | for item in {1,}: + Run `ruff check --fix` to apply this fix. + iteration_over_set.py:9:13: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 7 | print(f"I like {item}.") @@ -50,7 +54,7 @@ iteration_over_set.py:9:13: PLC0208 [*] Use a sequence type instead of a `set` w | = help: Convert to `tuple` -ℹ Safe fix +Suggested fix: 6 6 | for item in {"apples", "lemons", "water"}: # flags in-line set literals 7 7 | print(f"I like {item}.") 8 8 | @@ -60,6 +64,8 @@ iteration_over_set.py:9:13: PLC0208 [*] Use a sequence type instead of a `set` w 11 11 | 12 12 | for item in { + Run `ruff check --fix` to apply this fix. + iteration_over_set.py:12:13: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 10 | print(f"I can count to {item}!") @@ -73,7 +79,7 @@ iteration_over_set.py:12:13: PLC0208 [*] Use a sequence type instead of a `set` | = help: Convert to `tuple` -ℹ Safe fix +Suggested fix: 9 9 | for item in {1,}: 10 10 | print(f"I can count to {item}!") 11 11 | @@ -86,6 +92,8 @@ iteration_over_set.py:12:13: PLC0208 [*] Use a sequence type instead of a `set` 16 16 | 17 17 | numbers_list = [i for i in {1, 2, 3}] # flags sets in list comprehensions + Run `ruff check --fix` to apply this fix. + iteration_over_set.py:17:28: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 15 | print(f"I like {item}.") @@ -97,7 +105,7 @@ iteration_over_set.py:17:28: PLC0208 [*] Use a sequence type instead of a `set` | = help: Convert to `tuple` -ℹ Safe fix +Suggested fix: 14 14 | }: # flags in-line set literals 15 15 | print(f"I like {item}.") 16 16 | @@ -107,6 +115,8 @@ iteration_over_set.py:17:28: PLC0208 [*] Use a sequence type instead of a `set` 19 19 | numbers_set = {i for i in {1, 2, 3}} # flags sets in set comprehensions 20 20 | + Run `ruff check --fix` to apply this fix. + iteration_over_set.py:19:27: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 17 | numbers_list = [i for i in {1, 2, 3}] # flags sets in list comprehensions @@ -118,7 +128,7 @@ iteration_over_set.py:19:27: PLC0208 [*] Use a sequence type instead of a `set` | = help: Convert to `tuple` -ℹ Safe fix +Suggested fix: 16 16 | 17 17 | numbers_list = [i for i in {1, 2, 3}] # flags sets in list comprehensions 18 18 | @@ -128,6 +138,8 @@ iteration_over_set.py:19:27: PLC0208 [*] Use a sequence type instead of a `set` 21 21 | numbers_dict = {str(i): i for i in {1, 2, 3}} # flags sets in dict comprehensions 22 22 | + Run `ruff check --fix` to apply this fix. + iteration_over_set.py:21:36: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 19 | numbers_set = {i for i in {1, 2, 3}} # flags sets in set comprehensions @@ -139,7 +151,7 @@ iteration_over_set.py:21:36: PLC0208 [*] Use a sequence type instead of a `set` | = help: Convert to `tuple` -ℹ Safe fix +Suggested fix: 18 18 | 19 19 | numbers_set = {i for i in {1, 2, 3}} # flags sets in set comprehensions 20 20 | @@ -149,6 +161,8 @@ iteration_over_set.py:21:36: PLC0208 [*] Use a sequence type instead of a `set` 23 23 | numbers_gen = (i for i in {1, 2, 3}) # flags sets in generator expressions 24 24 | + Run `ruff check --fix` to apply this fix. + iteration_over_set.py:23:27: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 21 | numbers_dict = {str(i): i for i in {1, 2, 3}} # flags sets in dict comprehensions @@ -160,7 +174,7 @@ iteration_over_set.py:23:27: PLC0208 [*] Use a sequence type instead of a `set` | = help: Convert to `tuple` -ℹ Safe fix +Suggested fix: 20 20 | 21 21 | numbers_dict = {str(i): i for i in {1, 2, 3}} # flags sets in dict comprehensions 22 22 | @@ -170,4 +184,4 @@ iteration_over_set.py:23:27: PLC0208 [*] Use a sequence type instead of a `set` 25 25 | # Non-errors 26 26 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap index ac761dd336862..b67a3ed633433 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap @@ -12,7 +12,7 @@ import_aliasing.py:6:8: PLC0414 [*] Import alias does not rename original packag | = help: Remove import alias -ℹ Unsafe fix +Suggested fix: 3 3 | # 1. useless-import-alias 4 4 | # 2. consider-using-from-import 5 5 | @@ -22,6 +22,8 @@ import_aliasing.py:6:8: PLC0414 [*] Import alias does not rename original packag 8 8 | from collections import OrderedDict as o_dict 9 9 | import os.path as path # [consider-using-from-import] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + import_aliasing.py:7:25: PLC0414 [*] Import alias does not rename original package | 6 | import collections as collections # [useless-import-alias] @@ -32,7 +34,7 @@ import_aliasing.py:7:25: PLC0414 [*] Import alias does not rename original packa | = help: Remove import alias -ℹ Unsafe fix +Suggested fix: 4 4 | # 2. consider-using-from-import 5 5 | 6 6 | import collections as collections # [useless-import-alias] @@ -42,6 +44,8 @@ import_aliasing.py:7:25: PLC0414 [*] Import alias does not rename original packa 9 9 | import os.path as path # [consider-using-from-import] 10 10 | import os.path as p + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + import_aliasing.py:16:15: PLC0414 [*] Import alias does not rename original package | 14 | import os as OS @@ -53,7 +57,7 @@ import_aliasing.py:16:15: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -ℹ Unsafe fix +Suggested fix: 13 13 | import os 14 14 | import os as OS 15 15 | from sys import version @@ -63,6 +67,8 @@ import_aliasing.py:16:15: PLC0414 [*] Import alias does not rename original pack 18 18 | from . import bar 19 19 | from ..foo import bar as bar # [useless-import-alias] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + import_aliasing.py:19:19: PLC0414 [*] Import alias does not rename original package | 17 | from . import bar as Bar @@ -74,7 +80,7 @@ import_aliasing.py:19:19: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -ℹ Unsafe fix +Suggested fix: 16 16 | from . import bar as bar # [useless-import-alias] 17 17 | from . import bar as Bar 18 18 | from . import bar @@ -84,6 +90,8 @@ import_aliasing.py:19:19: PLC0414 [*] Import alias does not rename original pack 21 21 | from ..foo.bar import foobar as anotherfoobar 22 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + import_aliasing.py:20:23: PLC0414 [*] Import alias does not rename original package | 18 | from . import bar @@ -95,7 +103,7 @@ import_aliasing.py:20:23: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -ℹ Unsafe fix +Suggested fix: 17 17 | from . import bar as Bar 18 18 | from . import bar 19 19 | from ..foo import bar as bar # [useless-import-alias] @@ -105,6 +113,8 @@ import_aliasing.py:20:23: PLC0414 [*] Import alias does not rename original pack 22 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] 23 23 | from . import foo as bar, foo2 as foo2 # [useless-import-alias] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + import_aliasing.py:22:15: PLC0414 [*] Import alias does not rename original package | 20 | from ..foo.bar import foobar as foobar # [useless-import-alias] @@ -116,7 +126,7 @@ import_aliasing.py:22:15: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -ℹ Unsafe fix +Suggested fix: 19 19 | from ..foo import bar as bar # [useless-import-alias] 20 20 | from ..foo.bar import foobar as foobar # [useless-import-alias] 21 21 | from ..foo.bar import foobar as anotherfoobar @@ -126,6 +136,8 @@ import_aliasing.py:22:15: PLC0414 [*] Import alias does not rename original pack 24 24 | from . import foo as bar, foo2 as bar2 25 25 | from foo.bar import foobar as foobar # [useless-import-alias] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + import_aliasing.py:23:27: PLC0414 [*] Import alias does not rename original package | 21 | from ..foo.bar import foobar as anotherfoobar @@ -137,7 +149,7 @@ import_aliasing.py:23:27: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -ℹ Unsafe fix +Suggested fix: 20 20 | from ..foo.bar import foobar as foobar # [useless-import-alias] 21 21 | from ..foo.bar import foobar as anotherfoobar 22 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] @@ -147,6 +159,8 @@ import_aliasing.py:23:27: PLC0414 [*] Import alias does not rename original pack 25 25 | from foo.bar import foobar as foobar # [useless-import-alias] 26 26 | from foo.bar import foobar as foo + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + import_aliasing.py:25:21: PLC0414 [*] Import alias does not rename original package | 23 | from . import foo as bar, foo2 as foo2 # [useless-import-alias] @@ -158,7 +172,7 @@ import_aliasing.py:25:21: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -ℹ Unsafe fix +Suggested fix: 22 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] 23 23 | from . import foo as bar, foo2 as foo2 # [useless-import-alias] 24 24 | from . import foo as bar, foo2 as bar2 @@ -168,4 +182,4 @@ import_aliasing.py:25:21: PLC0414 [*] Import alias does not rename original pack 27 27 | from .foo.bar import f as foobar 28 28 | from ............a import b # [relative-beyond-top-level] - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap index 48923d03a102d..f88002221efb7 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap @@ -11,7 +11,7 @@ unnecessary_dunder_call.py:4:7: PLC2801 [*] Unnecessary dunder call to `__add__` | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 1 1 | from typing import Any 2 2 | 3 3 | a = 2 @@ -21,6 +21,8 @@ unnecessary_dunder_call.py:4:7: PLC2801 [*] Unnecessary dunder call to `__add__` 6 6 | print((3.0).__mul__(4.0)) # PLC2801 7 7 | print((3.0).__truediv__(4.0)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:5:7: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | 3 | a = 2 @@ -32,7 +34,7 @@ unnecessary_dunder_call.py:5:7: PLC2801 [*] Unnecessary dunder call to `__sub__` | = help: Use `-` operator -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | a = 2 4 4 | print((3.0).__add__(4.0)) # PLC2801 @@ -42,6 +44,8 @@ unnecessary_dunder_call.py:5:7: PLC2801 [*] Unnecessary dunder call to `__sub__` 7 7 | print((3.0).__truediv__(4.0)) # PLC2801 8 8 | print((3.0).__floordiv__(4.0)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:6:7: PLC2801 [*] Unnecessary dunder call to `__mul__`. Use `*` operator. | 4 | print((3.0).__add__(4.0)) # PLC2801 @@ -53,7 +57,7 @@ unnecessary_dunder_call.py:6:7: PLC2801 [*] Unnecessary dunder call to `__mul__` | = help: Use `*` operator -ℹ Unsafe fix +Suggested fix: 3 3 | a = 2 4 4 | print((3.0).__add__(4.0)) # PLC2801 5 5 | print((3.0).__sub__(4.0)) # PLC2801 @@ -63,6 +67,8 @@ unnecessary_dunder_call.py:6:7: PLC2801 [*] Unnecessary dunder call to `__mul__` 8 8 | print((3.0).__floordiv__(4.0)) # PLC2801 9 9 | print((3.0).__mod__(4.0)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:7:7: PLC2801 [*] Unnecessary dunder call to `__truediv__`. Use `/` operator. | 5 | print((3.0).__sub__(4.0)) # PLC2801 @@ -74,7 +80,7 @@ unnecessary_dunder_call.py:7:7: PLC2801 [*] Unnecessary dunder call to `__truedi | = help: Use `/` operator -ℹ Unsafe fix +Suggested fix: 4 4 | print((3.0).__add__(4.0)) # PLC2801 5 5 | print((3.0).__sub__(4.0)) # PLC2801 6 6 | print((3.0).__mul__(4.0)) # PLC2801 @@ -84,6 +90,8 @@ unnecessary_dunder_call.py:7:7: PLC2801 [*] Unnecessary dunder call to `__truedi 9 9 | print((3.0).__mod__(4.0)) # PLC2801 10 10 | print((3.0).__eq__(4.0)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:8:7: PLC2801 [*] Unnecessary dunder call to `__floordiv__`. Use `//` operator. | 6 | print((3.0).__mul__(4.0)) # PLC2801 @@ -95,7 +103,7 @@ unnecessary_dunder_call.py:8:7: PLC2801 [*] Unnecessary dunder call to `__floord | = help: Use `//` operator -ℹ Unsafe fix +Suggested fix: 5 5 | print((3.0).__sub__(4.0)) # PLC2801 6 6 | print((3.0).__mul__(4.0)) # PLC2801 7 7 | print((3.0).__truediv__(4.0)) # PLC2801 @@ -105,6 +113,8 @@ unnecessary_dunder_call.py:8:7: PLC2801 [*] Unnecessary dunder call to `__floord 10 10 | print((3.0).__eq__(4.0)) # PLC2801 11 11 | print((3.0).__ne__(4.0)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:9:7: PLC2801 [*] Unnecessary dunder call to `__mod__`. Use `%` operator. | 7 | print((3.0).__truediv__(4.0)) # PLC2801 @@ -116,7 +126,7 @@ unnecessary_dunder_call.py:9:7: PLC2801 [*] Unnecessary dunder call to `__mod__` | = help: Use `%` operator -ℹ Unsafe fix +Suggested fix: 6 6 | print((3.0).__mul__(4.0)) # PLC2801 7 7 | print((3.0).__truediv__(4.0)) # PLC2801 8 8 | print((3.0).__floordiv__(4.0)) # PLC2801 @@ -126,6 +136,8 @@ unnecessary_dunder_call.py:9:7: PLC2801 [*] Unnecessary dunder call to `__mod__` 11 11 | print((3.0).__ne__(4.0)) # PLC2801 12 12 | print((3.0).__lt__(4.0)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:10:7: PLC2801 [*] Unnecessary dunder call to `__eq__`. Use `==` operator. | 8 | print((3.0).__floordiv__(4.0)) # PLC2801 @@ -137,7 +149,7 @@ unnecessary_dunder_call.py:10:7: PLC2801 [*] Unnecessary dunder call to `__eq__` | = help: Use `==` operator -ℹ Unsafe fix +Suggested fix: 7 7 | print((3.0).__truediv__(4.0)) # PLC2801 8 8 | print((3.0).__floordiv__(4.0)) # PLC2801 9 9 | print((3.0).__mod__(4.0)) # PLC2801 @@ -147,6 +159,8 @@ unnecessary_dunder_call.py:10:7: PLC2801 [*] Unnecessary dunder call to `__eq__` 12 12 | print((3.0).__lt__(4.0)) # PLC2801 13 13 | print((3.0).__le__(4.0)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:11:7: PLC2801 [*] Unnecessary dunder call to `__ne__`. Use `!=` operator. | 9 | print((3.0).__mod__(4.0)) # PLC2801 @@ -158,7 +172,7 @@ unnecessary_dunder_call.py:11:7: PLC2801 [*] Unnecessary dunder call to `__ne__` | = help: Use `!=` operator -ℹ Unsafe fix +Suggested fix: 8 8 | print((3.0).__floordiv__(4.0)) # PLC2801 9 9 | print((3.0).__mod__(4.0)) # PLC2801 10 10 | print((3.0).__eq__(4.0)) # PLC2801 @@ -168,6 +182,8 @@ unnecessary_dunder_call.py:11:7: PLC2801 [*] Unnecessary dunder call to `__ne__` 13 13 | print((3.0).__le__(4.0)) # PLC2801 14 14 | print((3.0).__gt__(4.0)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:12:7: PLC2801 [*] Unnecessary dunder call to `__lt__`. Use `<` operator. | 10 | print((3.0).__eq__(4.0)) # PLC2801 @@ -179,7 +195,7 @@ unnecessary_dunder_call.py:12:7: PLC2801 [*] Unnecessary dunder call to `__lt__` | = help: Use `<` operator -ℹ Unsafe fix +Suggested fix: 9 9 | print((3.0).__mod__(4.0)) # PLC2801 10 10 | print((3.0).__eq__(4.0)) # PLC2801 11 11 | print((3.0).__ne__(4.0)) # PLC2801 @@ -189,6 +205,8 @@ unnecessary_dunder_call.py:12:7: PLC2801 [*] Unnecessary dunder call to `__lt__` 14 14 | print((3.0).__gt__(4.0)) # PLC2801 15 15 | print((3.0).__ge__(4.0)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:13:7: PLC2801 [*] Unnecessary dunder call to `__le__`. Use `<=` operator. | 11 | print((3.0).__ne__(4.0)) # PLC2801 @@ -200,7 +218,7 @@ unnecessary_dunder_call.py:13:7: PLC2801 [*] Unnecessary dunder call to `__le__` | = help: Use `<=` operator -ℹ Unsafe fix +Suggested fix: 10 10 | print((3.0).__eq__(4.0)) # PLC2801 11 11 | print((3.0).__ne__(4.0)) # PLC2801 12 12 | print((3.0).__lt__(4.0)) # PLC2801 @@ -210,6 +228,8 @@ unnecessary_dunder_call.py:13:7: PLC2801 [*] Unnecessary dunder call to `__le__` 15 15 | print((3.0).__ge__(4.0)) # PLC2801 16 16 | print((3.0).__str__()) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:14:7: PLC2801 [*] Unnecessary dunder call to `__gt__`. Use `>` operator. | 12 | print((3.0).__lt__(4.0)) # PLC2801 @@ -221,7 +241,7 @@ unnecessary_dunder_call.py:14:7: PLC2801 [*] Unnecessary dunder call to `__gt__` | = help: Use `>` operator -ℹ Unsafe fix +Suggested fix: 11 11 | print((3.0).__ne__(4.0)) # PLC2801 12 12 | print((3.0).__lt__(4.0)) # PLC2801 13 13 | print((3.0).__le__(4.0)) # PLC2801 @@ -231,6 +251,8 @@ unnecessary_dunder_call.py:14:7: PLC2801 [*] Unnecessary dunder call to `__gt__` 16 16 | print((3.0).__str__()) # PLC2801 17 17 | print((3.0).__repr__()) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:15:7: PLC2801 [*] Unnecessary dunder call to `__ge__`. Use `>=` operator. | 13 | print((3.0).__le__(4.0)) # PLC2801 @@ -242,7 +264,7 @@ unnecessary_dunder_call.py:15:7: PLC2801 [*] Unnecessary dunder call to `__ge__` | = help: Use `>=` operator -ℹ Unsafe fix +Suggested fix: 12 12 | print((3.0).__lt__(4.0)) # PLC2801 13 13 | print((3.0).__le__(4.0)) # PLC2801 14 14 | print((3.0).__gt__(4.0)) # PLC2801 @@ -252,6 +274,8 @@ unnecessary_dunder_call.py:15:7: PLC2801 [*] Unnecessary dunder call to `__ge__` 17 17 | print((3.0).__repr__()) # PLC2801 18 18 | print([1, 2, 3].__len__()) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:16:7: PLC2801 [*] Unnecessary dunder call to `__str__`. Use `str()` builtin. | 14 | print((3.0).__gt__(4.0)) # PLC2801 @@ -263,7 +287,7 @@ unnecessary_dunder_call.py:16:7: PLC2801 [*] Unnecessary dunder call to `__str__ | = help: Use `str()` builtin -ℹ Unsafe fix +Suggested fix: 13 13 | print((3.0).__le__(4.0)) # PLC2801 14 14 | print((3.0).__gt__(4.0)) # PLC2801 15 15 | print((3.0).__ge__(4.0)) # PLC2801 @@ -273,6 +297,8 @@ unnecessary_dunder_call.py:16:7: PLC2801 [*] Unnecessary dunder call to `__str__ 18 18 | print([1, 2, 3].__len__()) # PLC2801 19 19 | print((1).__neg__()) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:17:7: PLC2801 [*] Unnecessary dunder call to `__repr__`. Use `repr()` builtin. | 15 | print((3.0).__ge__(4.0)) # PLC2801 @@ -284,7 +310,7 @@ unnecessary_dunder_call.py:17:7: PLC2801 [*] Unnecessary dunder call to `__repr_ | = help: Use `repr()` builtin -ℹ Unsafe fix +Suggested fix: 14 14 | print((3.0).__gt__(4.0)) # PLC2801 15 15 | print((3.0).__ge__(4.0)) # PLC2801 16 16 | print((3.0).__str__()) # PLC2801 @@ -294,6 +320,8 @@ unnecessary_dunder_call.py:17:7: PLC2801 [*] Unnecessary dunder call to `__repr_ 19 19 | print((1).__neg__()) # PLC2801 20 20 | print(-a.__sub__(1)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:18:7: PLC2801 [*] Unnecessary dunder call to `__len__`. Use `len()` builtin. | 16 | print((3.0).__str__()) # PLC2801 @@ -305,7 +333,7 @@ unnecessary_dunder_call.py:18:7: PLC2801 [*] Unnecessary dunder call to `__len__ | = help: Use `len()` builtin -ℹ Unsafe fix +Suggested fix: 15 15 | print((3.0).__ge__(4.0)) # PLC2801 16 16 | print((3.0).__str__()) # PLC2801 17 17 | print((3.0).__repr__()) # PLC2801 @@ -315,6 +343,8 @@ unnecessary_dunder_call.py:18:7: PLC2801 [*] Unnecessary dunder call to `__len__ 20 20 | print(-a.__sub__(1)) # PLC2801 21 21 | print(-(a).__sub__(1)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:19:7: PLC2801 Unnecessary dunder call to `__neg__`. Multiply by -1 instead. | 17 | print((3.0).__repr__()) # PLC2801 @@ -337,7 +367,7 @@ unnecessary_dunder_call.py:20:8: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -ℹ Unsafe fix +Suggested fix: 17 17 | print((3.0).__repr__()) # PLC2801 18 18 | print([1, 2, 3].__len__()) # PLC2801 19 19 | print((1).__neg__()) # PLC2801 @@ -347,6 +377,8 @@ unnecessary_dunder_call.py:20:8: PLC2801 [*] Unnecessary dunder call to `__sub__ 22 22 | print(-(-a.__sub__(1))) # PLC2801 23 23 | print((5 - a).__sub__(1)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:21:8: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | 19 | print((1).__neg__()) # PLC2801 @@ -358,7 +390,7 @@ unnecessary_dunder_call.py:21:8: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -ℹ Unsafe fix +Suggested fix: 18 18 | print([1, 2, 3].__len__()) # PLC2801 19 19 | print((1).__neg__()) # PLC2801 20 20 | print(-a.__sub__(1)) # PLC2801 @@ -368,6 +400,8 @@ unnecessary_dunder_call.py:21:8: PLC2801 [*] Unnecessary dunder call to `__sub__ 23 23 | print((5 - a).__sub__(1)) # PLC2801 24 24 | print(-(5 - a).__sub__(1)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:22:10: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | 20 | print(-a.__sub__(1)) # PLC2801 @@ -379,7 +413,7 @@ unnecessary_dunder_call.py:22:10: PLC2801 [*] Unnecessary dunder call to `__sub_ | = help: Use `-` operator -ℹ Unsafe fix +Suggested fix: 19 19 | print((1).__neg__()) # PLC2801 20 20 | print(-a.__sub__(1)) # PLC2801 21 21 | print(-(a).__sub__(1)) # PLC2801 @@ -389,6 +423,8 @@ unnecessary_dunder_call.py:22:10: PLC2801 [*] Unnecessary dunder call to `__sub_ 24 24 | print(-(5 - a).__sub__(1)) # PLC2801 25 25 | print(-(-5 - a).__sub__(1)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:23:7: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | 21 | print(-(a).__sub__(1)) # PLC2801 @@ -400,7 +436,7 @@ unnecessary_dunder_call.py:23:7: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -ℹ Unsafe fix +Suggested fix: 20 20 | print(-a.__sub__(1)) # PLC2801 21 21 | print(-(a).__sub__(1)) # PLC2801 22 22 | print(-(-a.__sub__(1))) # PLC2801 @@ -410,6 +446,8 @@ unnecessary_dunder_call.py:23:7: PLC2801 [*] Unnecessary dunder call to `__sub__ 25 25 | print(-(-5 - a).__sub__(1)) # PLC2801 26 26 | print(+-+-+-a.__sub__(1)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:24:8: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | 22 | print(-(-a.__sub__(1))) # PLC2801 @@ -421,7 +459,7 @@ unnecessary_dunder_call.py:24:8: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -ℹ Unsafe fix +Suggested fix: 21 21 | print(-(a).__sub__(1)) # PLC2801 22 22 | print(-(-a.__sub__(1))) # PLC2801 23 23 | print((5 - a).__sub__(1)) # PLC2801 @@ -431,6 +469,8 @@ unnecessary_dunder_call.py:24:8: PLC2801 [*] Unnecessary dunder call to `__sub__ 26 26 | print(+-+-+-a.__sub__(1)) # PLC2801 27 27 | print(a.__rsub__(2 - 1)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:25:8: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | 23 | print((5 - a).__sub__(1)) # PLC2801 @@ -442,7 +482,7 @@ unnecessary_dunder_call.py:25:8: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -ℹ Unsafe fix +Suggested fix: 22 22 | print(-(-a.__sub__(1))) # PLC2801 23 23 | print((5 - a).__sub__(1)) # PLC2801 24 24 | print(-(5 - a).__sub__(1)) # PLC2801 @@ -452,6 +492,8 @@ unnecessary_dunder_call.py:25:8: PLC2801 [*] Unnecessary dunder call to `__sub__ 27 27 | print(a.__rsub__(2 - 1)) # PLC2801 28 28 | print(a.__sub__(((((1)))))) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:26:13: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | 24 | print(-(5 - a).__sub__(1)) # PLC2801 @@ -463,7 +505,7 @@ unnecessary_dunder_call.py:26:13: PLC2801 [*] Unnecessary dunder call to `__sub_ | = help: Use `-` operator -ℹ Unsafe fix +Suggested fix: 23 23 | print((5 - a).__sub__(1)) # PLC2801 24 24 | print(-(5 - a).__sub__(1)) # PLC2801 25 25 | print(-(-5 - a).__sub__(1)) # PLC2801 @@ -473,6 +515,8 @@ unnecessary_dunder_call.py:26:13: PLC2801 [*] Unnecessary dunder call to `__sub_ 28 28 | print(a.__sub__(((((1)))))) # PLC2801 29 29 | print(a.__sub__(((((2 - 1)))))) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:27:7: PLC2801 [*] Unnecessary dunder call to `__rsub__`. Use `-` operator. | 25 | print(-(-5 - a).__sub__(1)) # PLC2801 @@ -484,7 +528,7 @@ unnecessary_dunder_call.py:27:7: PLC2801 [*] Unnecessary dunder call to `__rsub_ | = help: Use `-` operator -ℹ Unsafe fix +Suggested fix: 24 24 | print(-(5 - a).__sub__(1)) # PLC2801 25 25 | print(-(-5 - a).__sub__(1)) # PLC2801 26 26 | print(+-+-+-a.__sub__(1)) # PLC2801 @@ -494,6 +538,8 @@ unnecessary_dunder_call.py:27:7: PLC2801 [*] Unnecessary dunder call to `__rsub_ 29 29 | print(a.__sub__(((((2 - 1)))))) # PLC2801 30 30 | print(a.__sub__( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:28:7: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | 26 | print(+-+-+-a.__sub__(1)) # PLC2801 @@ -505,7 +551,7 @@ unnecessary_dunder_call.py:28:7: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -ℹ Unsafe fix +Suggested fix: 25 25 | print(-(-5 - a).__sub__(1)) # PLC2801 26 26 | print(+-+-+-a.__sub__(1)) # PLC2801 27 27 | print(a.__rsub__(2 - 1)) # PLC2801 @@ -515,6 +561,8 @@ unnecessary_dunder_call.py:28:7: PLC2801 [*] Unnecessary dunder call to `__sub__ 30 30 | print(a.__sub__( 31 31 | 3 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:29:7: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | 27 | print(a.__rsub__(2 - 1)) # PLC2801 @@ -526,7 +574,7 @@ unnecessary_dunder_call.py:29:7: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -ℹ Unsafe fix +Suggested fix: 26 26 | print(+-+-+-a.__sub__(1)) # PLC2801 27 27 | print(a.__rsub__(2 - 1)) # PLC2801 28 28 | print(a.__sub__(((((1)))))) # PLC2801 @@ -536,6 +584,8 @@ unnecessary_dunder_call.py:29:7: PLC2801 [*] Unnecessary dunder call to `__sub__ 31 31 | 3 32 32 | + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:30:7: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | 28 | print(a.__sub__(((((1)))))) # PLC2801 @@ -552,7 +602,7 @@ unnecessary_dunder_call.py:30:7: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -ℹ Unsafe fix +Suggested fix: 27 27 | print(a.__rsub__(2 - 1)) # PLC2801 28 28 | print(a.__sub__(((((1)))))) # PLC2801 29 29 | print(a.__sub__(((((2 - 1)))))) # PLC2801 @@ -567,6 +617,8 @@ unnecessary_dunder_call.py:30:7: PLC2801 [*] Unnecessary dunder call to `__sub__ 36 34 | 3 37 35 | + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:35:7: PLC2801 [*] Unnecessary dunder call to `__rsub__`. Use `-` operator. | 33 | 4 @@ -583,7 +635,7 @@ unnecessary_dunder_call.py:35:7: PLC2801 [*] Unnecessary dunder call to `__rsub_ | = help: Use `-` operator -ℹ Unsafe fix +Suggested fix: 32 32 | + 33 33 | 4 34 34 | )) @@ -598,6 +650,8 @@ unnecessary_dunder_call.py:35:7: PLC2801 [*] Unnecessary dunder call to `__rsub_ 41 39 | x = 2 * a.__add__(3) # PLC2801 42 40 | x = 2 * -a.__add__(3) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:40:11: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 38 | 4 @@ -609,7 +663,7 @@ unnecessary_dunder_call.py:40:11: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 37 37 | + 38 38 | 4 39 39 | )) @@ -619,6 +673,8 @@ unnecessary_dunder_call.py:40:11: PLC2801 [*] Unnecessary dunder call to `__add_ 42 42 | x = 2 * -a.__add__(3) # PLC2801 43 43 | x = a.__add__(3) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:41:9: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 39 | )) @@ -630,7 +686,7 @@ unnecessary_dunder_call.py:41:9: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 38 38 | 4 39 39 | )) 40 40 | print(2 * a.__add__(3)) # PLC2801 @@ -640,6 +696,8 @@ unnecessary_dunder_call.py:41:9: PLC2801 [*] Unnecessary dunder call to `__add__ 43 43 | x = a.__add__(3) # PLC2801 44 44 | x = -a.__add__(3) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:42:10: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 40 | print(2 * a.__add__(3)) # PLC2801 @@ -651,7 +709,7 @@ unnecessary_dunder_call.py:42:10: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 39 39 | )) 40 40 | print(2 * a.__add__(3)) # PLC2801 41 41 | x = 2 * a.__add__(3) # PLC2801 @@ -661,6 +719,8 @@ unnecessary_dunder_call.py:42:10: PLC2801 [*] Unnecessary dunder call to `__add_ 44 44 | x = -a.__add__(3) # PLC2801 45 45 | x = (-a).__add__(3) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:43:5: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 41 | x = 2 * a.__add__(3) # PLC2801 @@ -672,7 +732,7 @@ unnecessary_dunder_call.py:43:5: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 40 40 | print(2 * a.__add__(3)) # PLC2801 41 41 | x = 2 * a.__add__(3) # PLC2801 42 42 | x = 2 * -a.__add__(3) # PLC2801 @@ -682,6 +742,8 @@ unnecessary_dunder_call.py:43:5: PLC2801 [*] Unnecessary dunder call to `__add__ 45 45 | x = (-a).__add__(3) # PLC2801 46 46 | x = -(-a).__add__(3) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:44:6: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 42 | x = 2 * -a.__add__(3) # PLC2801 @@ -693,7 +755,7 @@ unnecessary_dunder_call.py:44:6: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 41 41 | x = 2 * a.__add__(3) # PLC2801 42 42 | x = 2 * -a.__add__(3) # PLC2801 43 43 | x = a.__add__(3) # PLC2801 @@ -703,6 +765,8 @@ unnecessary_dunder_call.py:44:6: PLC2801 [*] Unnecessary dunder call to `__add__ 46 46 | x = -(-a).__add__(3) # PLC2801 47 47 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:45:5: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 43 | x = a.__add__(3) # PLC2801 @@ -713,7 +777,7 @@ unnecessary_dunder_call.py:45:5: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 42 42 | x = 2 * -a.__add__(3) # PLC2801 43 43 | x = a.__add__(3) # PLC2801 44 44 | x = -a.__add__(3) # PLC2801 @@ -723,6 +787,8 @@ unnecessary_dunder_call.py:45:5: PLC2801 [*] Unnecessary dunder call to `__add__ 47 47 | 48 48 | # Calls + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:46:6: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 44 | x = -a.__add__(3) # PLC2801 @@ -734,7 +800,7 @@ unnecessary_dunder_call.py:46:6: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 43 43 | x = a.__add__(3) # PLC2801 44 44 | x = -a.__add__(3) # PLC2801 45 45 | x = (-a).__add__(3) # PLC2801 @@ -744,6 +810,8 @@ unnecessary_dunder_call.py:46:6: PLC2801 [*] Unnecessary dunder call to `__add__ 48 48 | # Calls 49 49 | print(a.__call__()) # PLC2801 (no fix, intentional) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:49:7: PLC2801 Unnecessary dunder call to `__call__` | 48 | # Calls @@ -763,7 +831,7 @@ unnecessary_dunder_call.py:52:16: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 49 49 | print(a.__call__()) # PLC2801 (no fix, intentional) 50 50 | 51 51 | # Lambda expressions @@ -773,6 +841,8 @@ unnecessary_dunder_call.py:52:16: PLC2801 [*] Unnecessary dunder call to `__add_ 54 54 | # If expressions 55 55 | print(a.__add__(1) if a > 0 else a.__sub__(1)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:55:7: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 54 | # If expressions @@ -783,7 +853,7 @@ unnecessary_dunder_call.py:55:7: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 52 52 | blah = lambda: a.__add__(1) # PLC2801 53 53 | 54 54 | # If expressions @@ -793,6 +863,8 @@ unnecessary_dunder_call.py:55:7: PLC2801 [*] Unnecessary dunder call to `__add__ 57 57 | # Dict/Set/List/Tuple 58 58 | print({"a": a.__add__(1)}) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:55:34: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | 54 | # If expressions @@ -803,7 +875,7 @@ unnecessary_dunder_call.py:55:34: PLC2801 [*] Unnecessary dunder call to `__sub_ | = help: Use `-` operator -ℹ Unsafe fix +Suggested fix: 52 52 | blah = lambda: a.__add__(1) # PLC2801 53 53 | 54 54 | # If expressions @@ -813,6 +885,8 @@ unnecessary_dunder_call.py:55:34: PLC2801 [*] Unnecessary dunder call to `__sub_ 57 57 | # Dict/Set/List/Tuple 58 58 | print({"a": a.__add__(1)}) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:58:13: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 57 | # Dict/Set/List/Tuple @@ -823,7 +897,7 @@ unnecessary_dunder_call.py:58:13: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 55 55 | print(a.__add__(1) if a > 0 else a.__sub__(1)) # PLC2801 56 56 | 57 57 | # Dict/Set/List/Tuple @@ -833,6 +907,8 @@ unnecessary_dunder_call.py:58:13: PLC2801 [*] Unnecessary dunder call to `__add_ 60 60 | print([a.__add__(1)]) # PLC2801 61 61 | print((a.__add__(1),)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:59:8: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 57 | # Dict/Set/List/Tuple @@ -844,7 +920,7 @@ unnecessary_dunder_call.py:59:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 56 56 | 57 57 | # Dict/Set/List/Tuple 58 58 | print({"a": a.__add__(1)}) # PLC2801 @@ -854,6 +930,8 @@ unnecessary_dunder_call.py:59:8: PLC2801 [*] Unnecessary dunder call to `__add__ 61 61 | print((a.__add__(1),)) # PLC2801 62 62 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:60:8: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 58 | print({"a": a.__add__(1)}) # PLC2801 @@ -864,7 +942,7 @@ unnecessary_dunder_call.py:60:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 57 57 | # Dict/Set/List/Tuple 58 58 | print({"a": a.__add__(1)}) # PLC2801 59 59 | print({a.__add__(1)}) # PLC2801 @@ -874,6 +952,8 @@ unnecessary_dunder_call.py:60:8: PLC2801 [*] Unnecessary dunder call to `__add__ 62 62 | 63 63 | # Comprehension variants + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:61:8: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 59 | print({a.__add__(1)}) # PLC2801 @@ -885,7 +965,7 @@ unnecessary_dunder_call.py:61:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 58 58 | print({"a": a.__add__(1)}) # PLC2801 59 59 | print({a.__add__(1)}) # PLC2801 60 60 | print([a.__add__(1)]) # PLC2801 @@ -895,6 +975,8 @@ unnecessary_dunder_call.py:61:8: PLC2801 [*] Unnecessary dunder call to `__add__ 63 63 | # Comprehension variants 64 64 | print({i: i.__add__(1) for i in range(5)}) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:64:11: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 63 | # Comprehension variants @@ -905,7 +987,7 @@ unnecessary_dunder_call.py:64:11: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 61 61 | print((a.__add__(1),)) # PLC2801 62 62 | 63 63 | # Comprehension variants @@ -915,6 +997,8 @@ unnecessary_dunder_call.py:64:11: PLC2801 [*] Unnecessary dunder call to `__add_ 66 66 | print([i.__add__(1) for i in range(5)]) # PLC2801 67 67 | print((i.__add__(1) for i in range(5))) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:65:8: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 63 | # Comprehension variants @@ -926,7 +1010,7 @@ unnecessary_dunder_call.py:65:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 62 62 | 63 63 | # Comprehension variants 64 64 | print({i: i.__add__(1) for i in range(5)}) # PLC2801 @@ -936,6 +1020,8 @@ unnecessary_dunder_call.py:65:8: PLC2801 [*] Unnecessary dunder call to `__add__ 67 67 | print((i.__add__(1) for i in range(5))) # PLC2801 68 68 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:66:8: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 64 | print({i: i.__add__(1) for i in range(5)}) # PLC2801 @@ -946,7 +1032,7 @@ unnecessary_dunder_call.py:66:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 63 63 | # Comprehension variants 64 64 | print({i: i.__add__(1) for i in range(5)}) # PLC2801 65 65 | print({i.__add__(1) for i in range(5)}) # PLC2801 @@ -956,6 +1042,8 @@ unnecessary_dunder_call.py:66:8: PLC2801 [*] Unnecessary dunder call to `__add__ 68 68 | 69 69 | # Generators + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:67:8: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 65 | print({i.__add__(1) for i in range(5)}) # PLC2801 @@ -967,7 +1055,7 @@ unnecessary_dunder_call.py:67:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 64 64 | print({i: i.__add__(1) for i in range(5)}) # PLC2801 65 65 | print({i.__add__(1) for i in range(5)}) # PLC2801 66 66 | print([i.__add__(1) for i in range(5)]) # PLC2801 @@ -977,6 +1065,8 @@ unnecessary_dunder_call.py:67:8: PLC2801 [*] Unnecessary dunder call to `__add__ 69 69 | # Generators 70 70 | gen = (i.__add__(1) for i in range(5)) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:70:8: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 69 | # Generators @@ -986,7 +1076,7 @@ unnecessary_dunder_call.py:70:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 67 67 | print((i.__add__(1) for i in range(5))) # PLC2801 68 68 | 69 69 | # Generators @@ -996,6 +1086,8 @@ unnecessary_dunder_call.py:70:8: PLC2801 [*] Unnecessary dunder call to `__add__ 72 72 | 73 73 | # Subscripts + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:74:13: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 73 | # Subscripts @@ -1006,7 +1098,7 @@ unnecessary_dunder_call.py:74:13: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 71 71 | print(next(gen)) 72 72 | 73 73 | # Subscripts @@ -1016,6 +1108,8 @@ unnecessary_dunder_call.py:74:13: PLC2801 [*] Unnecessary dunder call to `__add_ 76 76 | # Starred 77 77 | print(*[a.__add__(1)]) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:77:9: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 76 | # Starred @@ -1026,7 +1120,7 @@ unnecessary_dunder_call.py:77:9: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 74 74 | print({"a": a.__add__(1)}["a"]) # PLC2801 75 75 | 76 76 | # Starred @@ -1036,6 +1130,8 @@ unnecessary_dunder_call.py:77:9: PLC2801 [*] Unnecessary dunder call to `__add__ 79 79 | # Slices 80 80 | print([a.__add__(1), a.__sub__(1)][0:1]) # PLC2801 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:80:8: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | 79 | # Slices @@ -1044,7 +1140,7 @@ unnecessary_dunder_call.py:80:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -ℹ Unsafe fix +Suggested fix: 77 77 | print(*[a.__add__(1)]) # PLC2801 78 78 | 79 79 | # Slices @@ -1054,6 +1150,8 @@ unnecessary_dunder_call.py:80:8: PLC2801 [*] Unnecessary dunder call to `__add__ 82 82 | 83 83 | class Thing: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:80:22: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | 79 | # Slices @@ -1062,7 +1160,7 @@ unnecessary_dunder_call.py:80:22: PLC2801 [*] Unnecessary dunder call to `__sub_ | = help: Use `-` operator -ℹ Unsafe fix +Suggested fix: 77 77 | print(*[a.__add__(1)]) # PLC2801 78 78 | 79 79 | # Slices @@ -1072,6 +1170,8 @@ unnecessary_dunder_call.py:80:22: PLC2801 [*] Unnecessary dunder call to `__sub_ 82 82 | 83 83 | class Thing: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_dunder_call.py:92:16: PLC2801 Unnecessary dunder call to `__getattribute__`. Access attribute directly or use getattr built-in function. | 91 | def do_thing(self, item): @@ -1081,5 +1181,3 @@ unnecessary_dunder_call.py:92:16: PLC2801 Unnecessary dunder call to `__getattri 94 | def use_descriptor(self, item): | = help: Access attribute directly or use getattr built-in function - - diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0241_duplicate_bases.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0241_duplicate_bases.py.snap index f939250ceb6f3..79e68e06cf85c 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0241_duplicate_bases.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0241_duplicate_bases.py.snap @@ -10,7 +10,7 @@ duplicate_bases.py:13:13: PLE0241 [*] Duplicate base `A` for class `F1` | = help: Remove duplicate base -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | 12 12 | # Duplicate base class is last. @@ -20,6 +20,8 @@ duplicate_bases.py:13:13: PLE0241 [*] Duplicate base `A` for class `F1` 15 15 | 16 16 | + Run `ruff check --fix` to apply this fix. + duplicate_bases.py:17:13: PLE0241 [*] Duplicate base `A` for class `F2` | 17 | class F2(A, A,): @@ -28,7 +30,7 @@ duplicate_bases.py:17:13: PLE0241 [*] Duplicate base `A` for class `F2` | = help: Remove duplicate base -ℹ Safe fix +Suggested fix: 14 14 | ... 15 15 | 16 16 | @@ -38,6 +40,8 @@ duplicate_bases.py:17:13: PLE0241 [*] Duplicate base `A` for class `F2` 19 19 | 20 20 | + Run `ruff check --fix` to apply this fix. + duplicate_bases.py:23:5: PLE0241 [*] Duplicate base `A` for class `F3` | 21 | class F3( @@ -49,7 +53,7 @@ duplicate_bases.py:23:5: PLE0241 [*] Duplicate base `A` for class `F3` | = help: Remove duplicate base -ℹ Safe fix +Suggested fix: 19 19 | 20 20 | 21 21 | class F3( @@ -58,6 +62,8 @@ duplicate_bases.py:23:5: PLE0241 [*] Duplicate base `A` for class `F3` 24 23 | ): 25 24 | ... + Run `ruff check --fix` to apply this fix. + duplicate_bases.py:30:5: PLE0241 [*] Duplicate base `A` for class `F4` | 28 | class F4( @@ -69,7 +75,7 @@ duplicate_bases.py:30:5: PLE0241 [*] Duplicate base `A` for class `F4` | = help: Remove duplicate base -ℹ Safe fix +Suggested fix: 27 27 | 28 28 | class F4( 29 29 | A, @@ -78,6 +84,8 @@ duplicate_bases.py:30:5: PLE0241 [*] Duplicate base `A` for class `F4` 32 31 | ... 33 32 | + Run `ruff check --fix` to apply this fix. + duplicate_bases.py:36:13: PLE0241 [*] Duplicate base `A` for class `G1` | 35 | # Duplicate base class is not last. @@ -87,7 +95,7 @@ duplicate_bases.py:36:13: PLE0241 [*] Duplicate base `A` for class `G1` | = help: Remove duplicate base -ℹ Safe fix +Suggested fix: 33 33 | 34 34 | 35 35 | # Duplicate base class is not last. @@ -97,6 +105,8 @@ duplicate_bases.py:36:13: PLE0241 [*] Duplicate base `A` for class `G1` 38 38 | 39 39 | + Run `ruff check --fix` to apply this fix. + duplicate_bases.py:40:13: PLE0241 [*] Duplicate base `A` for class `G2` | 40 | class G2(A, A, B,): @@ -105,7 +115,7 @@ duplicate_bases.py:40:13: PLE0241 [*] Duplicate base `A` for class `G2` | = help: Remove duplicate base -ℹ Safe fix +Suggested fix: 37 37 | ... 38 38 | 39 39 | @@ -115,6 +125,8 @@ duplicate_bases.py:40:13: PLE0241 [*] Duplicate base `A` for class `G2` 42 42 | 43 43 | + Run `ruff check --fix` to apply this fix. + duplicate_bases.py:46:5: PLE0241 [*] Duplicate base `A` for class `G3` | 44 | class G3( @@ -126,7 +138,7 @@ duplicate_bases.py:46:5: PLE0241 [*] Duplicate base `A` for class `G3` | = help: Remove duplicate base -ℹ Safe fix +Suggested fix: 43 43 | 44 44 | class G3( 45 45 | A, @@ -135,6 +147,8 @@ duplicate_bases.py:46:5: PLE0241 [*] Duplicate base `A` for class `G3` 48 47 | ): 49 48 | ... + Run `ruff check --fix` to apply this fix. + duplicate_bases.py:54:5: PLE0241 [*] Duplicate base `A` for class `G4` | 52 | class G4( @@ -146,7 +160,7 @@ duplicate_bases.py:54:5: PLE0241 [*] Duplicate base `A` for class `G4` | = help: Remove duplicate base -ℹ Safe fix +Suggested fix: 51 51 | 52 52 | class G4( 53 53 | A, @@ -154,3 +168,5 @@ duplicate_bases.py:54:5: PLE0241 [*] Duplicate base `A` for class `G4` 55 54 | B, 56 55 | ): 57 56 | ... + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap index 34684ce92dac2..e9e09f285906f 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap @@ -10,7 +10,7 @@ dict_iter_missing_items.py:13:13: PLE1141 [*] Unpacking a dictionary in iteratio | = help: Add a call to `.items()` -ℹ Safe fix +Suggested fix: 10 10 | s2 = {1, 2, 3} 11 11 | 12 12 | # Errors @@ -20,6 +20,8 @@ dict_iter_missing_items.py:13:13: PLE1141 [*] Unpacking a dictionary in iteratio 15 15 | 16 16 | for k, v in d_tuple_incorrect_tuple: + Run `ruff check --fix` to apply this fix. + dict_iter_missing_items.py:16:13: PLE1141 [*] Unpacking a dictionary in iteration without calling `.items()` | 14 | pass @@ -30,7 +32,7 @@ dict_iter_missing_items.py:16:13: PLE1141 [*] Unpacking a dictionary in iteratio | = help: Add a call to `.items()` -ℹ Safe fix +Suggested fix: 13 13 | for k, v in d: 14 14 | pass 15 15 | @@ -40,4 +42,4 @@ dict_iter_missing_items.py:16:13: PLE1141 [*] Unpacking a dictionary in iteratio 18 18 | 19 19 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap index caa3e35b7c10e..63b5eeb59f03e 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap @@ -11,7 +11,7 @@ singledispatch_method.py:10:5: PLE1519 [*] `@singledispatch` decorator should no | = help: Replace with `@singledispatchmethod` -ℹ Unsafe fix +Suggested fix: 7 7 | 8 8 | 9 9 | class Board: @@ -21,6 +21,8 @@ singledispatch_method.py:10:5: PLE1519 [*] `@singledispatch` decorator should no 12 12 | def convert_position(cls, position): 13 13 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + singledispatch_method.py:15:5: PLE1519 [*] `@singledispatch` decorator should not be used on methods | 13 | pass @@ -32,7 +34,7 @@ singledispatch_method.py:15:5: PLE1519 [*] `@singledispatch` decorator should no | = help: Replace with `@singledispatchmethod` -ℹ Unsafe fix +Suggested fix: 12 12 | def convert_position(cls, position): 13 13 | pass 14 14 | @@ -42,6 +44,8 @@ singledispatch_method.py:15:5: PLE1519 [*] `@singledispatch` decorator should no 17 17 | pass 18 18 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + singledispatch_method.py:23:5: PLE1519 [*] `@singledispatch` decorator should not be used on methods | 21 | pass @@ -53,7 +57,7 @@ singledispatch_method.py:23:5: PLE1519 [*] `@singledispatch` decorator should no | = help: Replace with `@singledispatchmethod` -ℹ Unsafe fix +Suggested fix: 20 20 | def place(self, position): 21 21 | pass 22 22 | @@ -62,3 +66,5 @@ singledispatch_method.py:23:5: PLE1519 [*] `@singledispatch` decorator should no 24 24 | @staticmethod 25 25 | def do(position): 26 26 | pass + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1520_singledispatchmethod_function.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1520_singledispatchmethod_function.py.snap index 1507083e5817f..aaaa8c2367839 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1520_singledispatchmethod_function.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1520_singledispatchmethod_function.py.snap @@ -10,7 +10,7 @@ singledispatchmethod_function.py:4:1: PLE1520 [*] `@singledispatchmethod` decora | = help: Replace with `@singledispatch` -ℹ Unsafe fix +Suggested fix: 1 |-from functools import singledispatchmethod 1 |+from functools import singledispatchmethod, singledispatch 2 2 | @@ -19,4 +19,6 @@ singledispatchmethod_function.py:4:1: PLE1520 [*] `@singledispatchmethod` decora 4 |+@singledispatch # [singledispatchmethod-function] 5 5 | def convert_position(position): 6 6 | pass -7 7 | +7 7 | + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters.py.snap index 3f23d12764d77..76bff19c45454 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters.py.snap @@ -11,7 +11,7 @@ invalid_characters.py:15:6: PLE2510 [*] Invalid unescaped character backspace, u | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 12 12 | # (Pylint, "C0414") => Rule::UselessImportAlias, 13 13 | # (Pylint, "C3002") => Rule::UnnecessaryDirectLambdaCall, 14 14 | #foo = 'hi' @@ -21,6 +21,8 @@ invalid_characters.py:15:6: PLE2510 [*] Invalid unescaped character backspace, u 17 17 | 18 18 | b_ok = '\\b' + Run `ruff check --fix` to apply this fix. + invalid_characters.py:16:7: PLE2510 [*] Invalid unescaped character backspace, use "\b" instead | 14 | #foo = 'hi' @@ -32,7 +34,7 @@ invalid_characters.py:16:7: PLE2510 [*] Invalid unescaped character backspace, u | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 13 13 | # (Pylint, "C3002") => Rule::UnnecessaryDirectLambdaCall, 14 14 | #foo = 'hi' 15 15 | b = '␈' @@ -42,6 +44,8 @@ invalid_characters.py:16:7: PLE2510 [*] Invalid unescaped character backspace, u 18 18 | b_ok = '\\b' 19 19 | b_ok = f'\\b' + Run `ruff check --fix` to apply this fix. + invalid_characters.py:55:21: PLE2510 [*] Invalid unescaped character backspace, use "\b" instead | 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" @@ -53,7 +57,7 @@ invalid_characters.py:55:21: PLE2510 [*] Invalid unescaped character backspace, | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 54 54 | @@ -62,3 +66,5 @@ invalid_characters.py:55:21: PLE2510 [*] Invalid unescaped character backspace, 56 56 | 57 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 58 58 | x = f"""}}ab""" + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2512_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2512_invalid_characters.py.snap index 3ef59bd9291bd..3429c28be497a 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2512_invalid_characters.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2512_invalid_characters.py.snap @@ -11,7 +11,7 @@ invalid_characters.py:24:12: PLE2512 [*] Invalid unescaped character SUB, use "\ | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 21 21 | cr_ok = '\\r' 22 22 | cr_ok = f'\\r' 23 23 | @@ -21,6 +21,8 @@ invalid_characters.py:24:12: PLE2512 [*] Invalid unescaped character SUB, use "\ 26 26 | 27 27 | sub_ok = '\x1a' + Run `ruff check --fix` to apply this fix. + invalid_characters.py:25:13: PLE2512 [*] Invalid unescaped character SUB, use "\x1A" instead | 24 | sub = 'sub ' @@ -31,7 +33,7 @@ invalid_characters.py:25:13: PLE2512 [*] Invalid unescaped character SUB, use "\ | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 22 22 | cr_ok = f'\\r' 23 23 | 24 24 | sub = 'sub ' @@ -41,6 +43,8 @@ invalid_characters.py:25:13: PLE2512 [*] Invalid unescaped character SUB, use "\ 27 27 | sub_ok = '\x1a' 28 28 | sub_ok = f'\x1a' + Run `ruff check --fix` to apply this fix. + invalid_characters.py:55:25: PLE2512 [*] Invalid unescaped character SUB, use "\x1A" instead | 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" @@ -52,7 +56,7 @@ invalid_characters.py:55:25: PLE2512 [*] Invalid unescaped character SUB, use "\ | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 54 54 | @@ -62,6 +66,8 @@ invalid_characters.py:55:25: PLE2512 [*] Invalid unescaped character SUB, use "\ 57 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 58 58 | x = f"""}}ab""" + Run `ruff check --fix` to apply this fix. + invalid_characters.py:58:12: PLE2512 [*] Invalid unescaped character SUB, use "\x1A" instead | 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 @@ -72,7 +78,7 @@ invalid_characters.py:58:12: PLE2512 [*] Invalid unescaped character SUB, use "\ | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 55 55 | nested_fstrings = f'␈{f'{f'␛'}'}' 56 56 | 57 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 @@ -80,3 +86,5 @@ invalid_characters.py:58:12: PLE2512 [*] Invalid unescaped character SUB, use "\ 58 |+x = f"""}}a\x1Ab""" 59 59 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998256 60 60 | x = f"""}}a␛b""" + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2513_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2513_invalid_characters.py.snap index 993c89041e59f..73b9d4c4121d0 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2513_invalid_characters.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2513_invalid_characters.py.snap @@ -11,7 +11,7 @@ invalid_characters.py:30:16: PLE2513 [*] Invalid unescaped character ESC, use "\ | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 27 27 | sub_ok = '\x1a' 28 28 | sub_ok = f'\x1a' 29 29 | @@ -21,6 +21,8 @@ invalid_characters.py:30:16: PLE2513 [*] Invalid unescaped character ESC, use "\ 32 32 | 33 33 | esc_ok = '\x1b' + Run `ruff check --fix` to apply this fix. + invalid_characters.py:31:17: PLE2513 [*] Invalid unescaped character ESC, use "\x1B" instead | 30 | esc = 'esc esc ␛' @@ -31,7 +33,7 @@ invalid_characters.py:31:17: PLE2513 [*] Invalid unescaped character ESC, use "\ | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 28 28 | sub_ok = f'\x1a' 29 29 | 30 30 | esc = 'esc esc ␛' @@ -41,6 +43,8 @@ invalid_characters.py:31:17: PLE2513 [*] Invalid unescaped character ESC, use "\ 33 33 | esc_ok = '\x1b' 34 34 | esc_ok = f'\x1b' + Run `ruff check --fix` to apply this fix. + invalid_characters.py:55:29: PLE2513 [*] Invalid unescaped character ESC, use "\x1B" instead | 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" @@ -52,7 +56,7 @@ invalid_characters.py:55:29: PLE2513 [*] Invalid unescaped character ESC, use "\ | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 54 54 | @@ -62,6 +66,8 @@ invalid_characters.py:55:29: PLE2513 [*] Invalid unescaped character ESC, use "\ 57 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 58 58 | x = f"""}}ab""" + Run `ruff check --fix` to apply this fix. + invalid_characters.py:60:12: PLE2513 [*] Invalid unescaped character ESC, use "\x1B" instead | 58 | x = f"""}}ab""" @@ -71,9 +77,11 @@ invalid_characters.py:60:12: PLE2513 [*] Invalid unescaped character ESC, use "\ | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 57 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 58 58 | x = f"""}}ab""" 59 59 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998256 60 |-x = f"""}}a␛b""" 60 |+x = f"""}}a\x1Bb""" + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2514_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2514_invalid_characters.py.snap index 3ab1a52ec4958bb83546a3b43e2f688ca4a4c373..c959cf2b898640c175e5e41b7479375cf55b859d 100644 GIT binary patch delta 142 zcmZ3<*2%s>l#wsEG(A1FxFj`2AuY4QYO*3@o2~*71eN9~BovjVr70w5q$X!8=;{Kc l6BJ7F6%q>yaw-){GBS%nI`k$lWqgKi$aJQOdL$Xb1pqz2FYo{W delta 47 rcmeBVU&*#Xl#%CA%T9&h#I#g}w9Jah%8YH3Z!kVV6+Fc>k&z1ktPv6L diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2515_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2515_invalid_characters.py.snap index bf097d02f2cec..8f9f822fd9048 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2515_invalid_characters.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2515_invalid_characters.py.snap @@ -11,7 +11,7 @@ invalid_characters.py:44:13: PLE2515 [*] Invalid unescaped character zero-width- | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 41 41 | nul_ok = '\0' 42 42 | nul_ok = f'\0' 43 43 | @@ -21,6 +21,8 @@ invalid_characters.py:44:13: PLE2515 [*] Invalid unescaped character zero-width- 46 46 | 47 47 | zwsp_ok = '\u200b' + Run `ruff check --fix` to apply this fix. + invalid_characters.py:45:14: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead | 44 | zwsp = 'zero​width' @@ -31,7 +33,7 @@ invalid_characters.py:45:14: PLE2515 [*] Invalid unescaped character zero-width- | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 42 42 | nul_ok = f'\0' 43 43 | 44 44 | zwsp = 'zero​width' @@ -41,6 +43,8 @@ invalid_characters.py:45:14: PLE2515 [*] Invalid unescaped character zero-width- 47 47 | zwsp_ok = '\u200b' 48 48 | zwsp_ok = f'\u200b' + Run `ruff check --fix` to apply this fix. + invalid_characters.py:50:36: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead | 48 | zwsp_ok = f'\u200b' @@ -52,7 +56,7 @@ invalid_characters.py:50:36: PLE2515 [*] Invalid unescaped character zero-width- | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 47 47 | zwsp_ok = '\u200b' 48 48 | zwsp_ok = f'\u200b' 49 49 | @@ -62,6 +66,8 @@ invalid_characters.py:50:36: PLE2515 [*] Invalid unescaped character zero-width- 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" + Run `ruff check --fix` to apply this fix. + invalid_characters.py:51:37: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead | 50 | zwsp_after_multibyte_character = "ಫ​" @@ -72,7 +78,7 @@ invalid_characters.py:51:37: PLE2515 [*] Invalid unescaped character zero-width- | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 48 48 | zwsp_ok = f'\u200b' 49 49 | 50 50 | zwsp_after_multibyte_character = "ಫ​" @@ -82,6 +88,8 @@ invalid_characters.py:51:37: PLE2515 [*] Invalid unescaped character zero-width- 53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 54 54 | + Run `ruff check --fix` to apply this fix. + invalid_characters.py:52:60: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead | 50 | zwsp_after_multibyte_character = "ಫ​" @@ -92,7 +100,7 @@ invalid_characters.py:52:60: PLE2515 [*] Invalid unescaped character zero-width- | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 49 49 | 50 50 | zwsp_after_multibyte_character = "ಫ​" 51 51 | zwsp_after_multibyte_character = f"ಫ​" @@ -102,6 +110,8 @@ invalid_characters.py:52:60: PLE2515 [*] Invalid unescaped character zero-width- 54 54 | 55 55 | nested_fstrings = f'␈{f'{f'␛'}'}' + Run `ruff check --fix` to apply this fix. + invalid_characters.py:52:61: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead | 50 | zwsp_after_multibyte_character = "ಫ​" @@ -112,7 +122,7 @@ invalid_characters.py:52:61: PLE2515 [*] Invalid unescaped character zero-width- | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 49 49 | 50 50 | zwsp_after_multibyte_character = "ಫ​" 51 51 | zwsp_after_multibyte_character = f"ಫ​" @@ -122,6 +132,8 @@ invalid_characters.py:52:61: PLE2515 [*] Invalid unescaped character zero-width- 54 54 | 55 55 | nested_fstrings = f'␈{f'{f'␛'}'}' + Run `ruff check --fix` to apply this fix. + invalid_characters.py:53:61: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead | 51 | zwsp_after_multibyte_character = f"ಫ​" @@ -133,7 +145,7 @@ invalid_characters.py:53:61: PLE2515 [*] Invalid unescaped character zero-width- | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 50 50 | zwsp_after_multibyte_character = "ಫ​" 51 51 | zwsp_after_multibyte_character = f"ಫ​" 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" @@ -143,6 +155,8 @@ invalid_characters.py:53:61: PLE2515 [*] Invalid unescaped character zero-width- 55 55 | nested_fstrings = f'␈{f'{f'␛'}'}' 56 56 | + Run `ruff check --fix` to apply this fix. + invalid_characters.py:53:62: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead | 51 | zwsp_after_multibyte_character = f"ಫ​" @@ -154,7 +168,7 @@ invalid_characters.py:53:62: PLE2515 [*] Invalid unescaped character zero-width- | = help: Replace with escape sequence -ℹ Safe fix +Suggested fix: 50 50 | zwsp_after_multibyte_character = "ಫ​" 51 51 | zwsp_after_multibyte_character = f"ಫ​" 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" @@ -162,4 +176,6 @@ invalid_characters.py:53:62: PLE2515 [*] Invalid unescaped character zero-width- 53 |+zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​\u200b" 54 54 | 55 55 | nested_fstrings = f'␈{f'{f'␛'}'}' -56 56 | +56 56 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap index 0af466fe72d09..bde36377e5ceb 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap @@ -12,7 +12,7 @@ modified_iterating_set.py:4:1: PLE4703 [*] Iterated set `nums` is modified withi | = help: Iterate over a copy of `nums` -ℹ Unsafe fix +Suggested fix: 1 1 | # Errors 2 2 | 3 3 | nums = {1, 2, 3} @@ -22,6 +22,8 @@ modified_iterating_set.py:4:1: PLE4703 [*] Iterated set `nums` is modified withi 6 6 | 7 7 | animals = {"dog", "cat", "cow"} + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + modified_iterating_set.py:8:1: PLE4703 [*] Iterated set `animals` is modified within the `for` loop | 7 | animals = {"dog", "cat", "cow"} @@ -33,7 +35,7 @@ modified_iterating_set.py:8:1: PLE4703 [*] Iterated set `animals` is modified wi | = help: Iterate over a copy of `animals` -ℹ Unsafe fix +Suggested fix: 5 5 | nums.add(num + 1) 6 6 | 7 7 | animals = {"dog", "cat", "cow"} @@ -43,6 +45,8 @@ modified_iterating_set.py:8:1: PLE4703 [*] Iterated set `animals` is modified wi 10 10 | 11 11 | fruits = {"apple", "orange", "grape"} + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + modified_iterating_set.py:12:1: PLE4703 [*] Iterated set `fruits` is modified within the `for` loop | 11 | fruits = {"apple", "orange", "grape"} @@ -54,7 +58,7 @@ modified_iterating_set.py:12:1: PLE4703 [*] Iterated set `fruits` is modified wi | = help: Iterate over a copy of `fruits` -ℹ Unsafe fix +Suggested fix: 9 9 | animals.pop("cow") 10 10 | 11 11 | fruits = {"apple", "orange", "grape"} @@ -64,6 +68,8 @@ modified_iterating_set.py:12:1: PLE4703 [*] Iterated set `fruits` is modified wi 14 14 | 15 15 | planets = {"mercury", "venus", "earth"} + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + modified_iterating_set.py:16:1: PLE4703 [*] Iterated set `planets` is modified within the `for` loop | 15 | planets = {"mercury", "venus", "earth"} @@ -75,7 +81,7 @@ modified_iterating_set.py:16:1: PLE4703 [*] Iterated set `planets` is modified w | = help: Iterate over a copy of `planets` -ℹ Unsafe fix +Suggested fix: 13 13 | fruits.clear() 14 14 | 15 15 | planets = {"mercury", "venus", "earth"} @@ -85,6 +91,8 @@ modified_iterating_set.py:16:1: PLE4703 [*] Iterated set `planets` is modified w 18 18 | 19 19 | colors = {"red", "green", "blue"} + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + modified_iterating_set.py:20:1: PLE4703 [*] Iterated set `colors` is modified within the `for` loop | 19 | colors = {"red", "green", "blue"} @@ -96,7 +104,7 @@ modified_iterating_set.py:20:1: PLE4703 [*] Iterated set `colors` is modified wi | = help: Iterate over a copy of `colors` -ℹ Unsafe fix +Suggested fix: 17 17 | planets.discard("mercury") 18 18 | 19 19 | colors = {"red", "green", "blue"} @@ -106,6 +114,8 @@ modified_iterating_set.py:20:1: PLE4703 [*] Iterated set `colors` is modified wi 22 22 | 23 23 | odds = {1, 3, 5} + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + modified_iterating_set.py:24:1: PLE4703 [*] Iterated set `odds` is modified within the `for` loop | 23 | odds = {1, 3, 5} @@ -118,7 +128,7 @@ modified_iterating_set.py:24:1: PLE4703 [*] Iterated set `odds` is modified with | = help: Iterate over a copy of `odds` -ℹ Unsafe fix +Suggested fix: 21 21 | colors.remove("red") 22 22 | 23 23 | odds = {1, 3, 5} @@ -126,4 +136,6 @@ modified_iterating_set.py:24:1: PLE4703 [*] Iterated set `odds` is modified with 24 |+for num in odds.copy(): 25 25 | if num > 1: 26 26 | odds.add(num + 1) -27 27 | +27 27 | + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0202_no_method_decorator.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0202_no_method_decorator.py.snap index 8824f3dd57915..d9c44b4931ae7 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0202_no_method_decorator.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0202_no_method_decorator.py.snap @@ -12,7 +12,7 @@ no_method_decorator.py:9:5: PLR0202 [*] Class method defined without decorator | = help: Add @classmethod decorator -ℹ Safe fix +Suggested fix: 6 6 | def __init__(self, color): 7 7 | self.color = color 8 8 | @@ -26,6 +26,8 @@ no_method_decorator.py:9:5: PLR0202 [*] Class method defined without decorator 15 15 | def pick_one_color(): # [no-staticmethod-decorator] 16 16 | """staticmethod to pick one fruit color""" + Run `ruff check --fix` to apply this fix. + no_method_decorator.py:22:5: PLR0202 [*] Class method defined without decorator | 21 | class Class: @@ -35,7 +37,7 @@ no_method_decorator.py:22:5: PLR0202 [*] Class method defined without decorator | = help: Add @classmethod decorator -ℹ Safe fix +Suggested fix: 19 19 | pick_one_color = staticmethod(pick_one_color) 20 20 | 21 21 | class Class: @@ -48,3 +50,5 @@ no_method_decorator.py:22:5: PLR0202 [*] Class method defined without decorator 26 27 | 27 28 | def static_method(): 28 29 | pass + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0203_no_method_decorator.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0203_no_method_decorator.py.snap index c4f9d811b4552..f30159f2f7178 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0203_no_method_decorator.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0203_no_method_decorator.py.snap @@ -12,7 +12,7 @@ no_method_decorator.py:15:5: PLR0203 [*] Static method defined without decorator | = help: Add @staticmethod decorator -ℹ Safe fix +Suggested fix: 12 12 | 13 13 | pick_colors = classmethod(pick_colors) 14 14 | @@ -26,6 +26,8 @@ no_method_decorator.py:15:5: PLR0203 [*] Static method defined without decorator 21 21 | class Class: 22 22 | def class_method(cls): + Run `ruff check --fix` to apply this fix. + no_method_decorator.py:27:5: PLR0203 [*] Static method defined without decorator | 25 | class_method = classmethod(class_method);another_statement @@ -36,7 +38,7 @@ no_method_decorator.py:27:5: PLR0203 [*] Static method defined without decorator | = help: Add @staticmethod decorator -ℹ Safe fix +Suggested fix: 24 24 | 25 25 | class_method = classmethod(class_method);another_statement 26 26 | @@ -45,4 +47,6 @@ no_method_decorator.py:27:5: PLR0203 [*] Static method defined without decorator 28 29 | pass 29 30 | 30 |- static_method = staticmethod(static_method); - 31 |+ + 31 |+ + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0402_import_aliasing.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0402_import_aliasing.py.snap index 75384428f6ca1..b06ab4c295bf8 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0402_import_aliasing.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0402_import_aliasing.py.snap @@ -12,7 +12,7 @@ import_aliasing.py:9:8: PLR0402 [*] Use `from os import path` in lieu of alias | = help: Replace with `from os import path` -ℹ Safe fix +Suggested fix: 6 6 | import collections as collections # [useless-import-alias] 7 7 | from collections import OrderedDict as OrderedDict # [useless-import-alias] 8 8 | from collections import OrderedDict as o_dict @@ -22,6 +22,8 @@ import_aliasing.py:9:8: PLR0402 [*] Use `from os import path` in lieu of alias 11 11 | import foo.bar.foobar as foobar # [consider-using-from-import] 12 12 | import foo.bar.foobar as foobar, sys # [consider-using-from-import] + Run `ruff check --fix` to apply this fix. + import_aliasing.py:11:8: PLR0402 [*] Use `from foo.bar import foobar` in lieu of alias | 9 | import os.path as path # [consider-using-from-import] @@ -33,7 +35,7 @@ import_aliasing.py:11:8: PLR0402 [*] Use `from foo.bar import foobar` in lieu of | = help: Replace with `from foo.bar import foobar` -ℹ Safe fix +Suggested fix: 8 8 | from collections import OrderedDict as o_dict 9 9 | import os.path as path # [consider-using-from-import] 10 10 | import os.path as p @@ -43,6 +45,8 @@ import_aliasing.py:11:8: PLR0402 [*] Use `from foo.bar import foobar` in lieu of 13 13 | import os 14 14 | import os as OS + Run `ruff check --fix` to apply this fix. + import_aliasing.py:12:8: PLR0402 Use `from foo.bar import foobar` in lieu of alias | 10 | import os.path as p @@ -53,5 +57,3 @@ import_aliasing.py:12:8: PLR0402 Use `from foo.bar import foobar` in lieu of ali 14 | import os as OS | = help: Replace with `from foo.bar import foobar` - - diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1711_useless_return.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1711_useless_return.py.snap index cf914458f4c8b..042fcaab4c246 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1711_useless_return.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1711_useless_return.py.snap @@ -10,7 +10,7 @@ useless_return.py:6:5: PLR1711 [*] Useless `return` statement at end of function | = help: Remove useless `return` statement -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | def print_python_version(): 5 5 | print(sys.version) @@ -19,6 +19,8 @@ useless_return.py:6:5: PLR1711 [*] Useless `return` statement at end of function 8 7 | 9 8 | def print_python_version(): + Run `ruff check --fix` to apply this fix. + useless_return.py:11:5: PLR1711 [*] Useless `return` statement at end of function | 9 | def print_python_version(): @@ -28,7 +30,7 @@ useless_return.py:11:5: PLR1711 [*] Useless `return` statement at end of functio | = help: Remove useless `return` statement -ℹ Safe fix +Suggested fix: 8 8 | 9 9 | def print_python_version(): 10 10 | print(sys.version) @@ -37,6 +39,8 @@ useless_return.py:11:5: PLR1711 [*] Useless `return` statement at end of functio 13 12 | 14 13 | def print_python_version(): + Run `ruff check --fix` to apply this fix. + useless_return.py:16:5: PLR1711 [*] Useless `return` statement at end of function | 14 | def print_python_version(): @@ -46,7 +50,7 @@ useless_return.py:16:5: PLR1711 [*] Useless `return` statement at end of functio | = help: Remove useless `return` statement -ℹ Safe fix +Suggested fix: 13 13 | 14 14 | def print_python_version(): 15 15 | print(sys.version) @@ -55,6 +59,8 @@ useless_return.py:16:5: PLR1711 [*] Useless `return` statement at end of functio 18 17 | 19 18 | class SomeClass: + Run `ruff check --fix` to apply this fix. + useless_return.py:22:9: PLR1711 [*] Useless `return` statement at end of function | 20 | def print_python_version(self): @@ -64,7 +70,7 @@ useless_return.py:22:9: PLR1711 [*] Useless `return` statement at end of functio | = help: Remove useless `return` statement -ℹ Safe fix +Suggested fix: 19 19 | class SomeClass: 20 20 | def print_python_version(self): 21 21 | print(sys.version) @@ -73,6 +79,8 @@ useless_return.py:22:9: PLR1711 [*] Useless `return` statement at end of functio 24 23 | 25 24 | def print_python_version(): + Run `ruff check --fix` to apply this fix. + useless_return.py:50:5: PLR1711 [*] Useless `return` statement at end of function | 48 | """This function returns None.""" @@ -82,7 +90,7 @@ useless_return.py:50:5: PLR1711 [*] Useless `return` statement at end of functio | = help: Remove useless `return` statement -ℹ Safe fix +Suggested fix: 47 47 | def print_python_version(): 48 48 | """This function returns None.""" 49 49 | print(sys.version) @@ -91,6 +99,8 @@ useless_return.py:50:5: PLR1711 [*] Useless `return` statement at end of functio 52 51 | 53 52 | class BaseCache: + Run `ruff check --fix` to apply this fix. + useless_return.py:60:9: PLR1711 [*] Useless `return` statement at end of function | 58 | def get(self, key: str) -> None: @@ -100,10 +110,10 @@ useless_return.py:60:9: PLR1711 [*] Useless `return` statement at end of functio | = help: Remove useless `return` statement -ℹ Safe fix +Suggested fix: 57 57 | 58 58 | def get(self, key: str) -> None: 59 59 | print(f"{key} not found") 60 |- return None - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1714_repeated_equality_comparison.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1714_repeated_equality_comparison.py.snap index 0c02246b06b19..95232292ff921 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1714_repeated_equality_comparison.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1714_repeated_equality_comparison.py.snap @@ -11,7 +11,7 @@ repeated_equality_comparison.py:2:1: PLR1714 [*] Consider merging multiple compa | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 1 1 | # Errors. 2 |-foo == "a" or foo == "b" 2 |+foo in ("a", "b") @@ -19,6 +19,8 @@ repeated_equality_comparison.py:2:1: PLR1714 [*] Consider merging multiple compa 4 4 | foo != "a" and foo != "b" 5 5 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + repeated_equality_comparison.py:4:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in ("a", "b")`. Use a `set` if the elements are hashable. | 2 | foo == "a" or foo == "b" @@ -30,7 +32,7 @@ repeated_equality_comparison.py:4:1: PLR1714 [*] Consider merging multiple compa | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 1 1 | # Errors. 2 2 | foo == "a" or foo == "b" 3 3 | @@ -40,6 +42,8 @@ repeated_equality_comparison.py:4:1: PLR1714 [*] Consider merging multiple compa 6 6 | foo == "a" or foo == "b" or foo == "c" 7 7 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + repeated_equality_comparison.py:6:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. | 4 | foo != "a" and foo != "b" @@ -51,7 +55,7 @@ repeated_equality_comparison.py:6:1: PLR1714 [*] Consider merging multiple compa | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | foo != "a" and foo != "b" 5 5 | @@ -61,6 +65,8 @@ repeated_equality_comparison.py:6:1: PLR1714 [*] Consider merging multiple compa 8 8 | foo != "a" and foo != "b" and foo != "c" 9 9 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + repeated_equality_comparison.py:8:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in ("a", "b", "c")`. Use a `set` if the elements are hashable. | 6 | foo == "a" or foo == "b" or foo == "c" @@ -72,7 +78,7 @@ repeated_equality_comparison.py:8:1: PLR1714 [*] Consider merging multiple compa | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 5 5 | 6 6 | foo == "a" or foo == "b" or foo == "c" 7 7 | @@ -82,6 +88,8 @@ repeated_equality_comparison.py:8:1: PLR1714 [*] Consider merging multiple compa 10 10 | foo == a or foo == "b" or foo == 3 # Mixed types. 11 11 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + repeated_equality_comparison.py:10:1: PLR1714 [*] Consider merging multiple comparisons: `foo in (a, "b", 3)`. Use a `set` if the elements are hashable. | 8 | foo != "a" and foo != "b" and foo != "c" @@ -93,7 +101,7 @@ repeated_equality_comparison.py:10:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 7 7 | 8 8 | foo != "a" and foo != "b" and foo != "c" 9 9 | @@ -103,6 +111,8 @@ repeated_equality_comparison.py:10:1: PLR1714 [*] Consider merging multiple comp 12 12 | "a" == foo or "b" == foo or "c" == foo 13 13 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + repeated_equality_comparison.py:12:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. | 10 | foo == a or foo == "b" or foo == 3 # Mixed types. @@ -114,7 +124,7 @@ repeated_equality_comparison.py:12:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 9 9 | 10 10 | foo == a or foo == "b" or foo == 3 # Mixed types. 11 11 | @@ -124,6 +134,8 @@ repeated_equality_comparison.py:12:1: PLR1714 [*] Consider merging multiple comp 14 14 | "a" != foo and "b" != foo and "c" != foo 15 15 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + repeated_equality_comparison.py:14:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in ("a", "b", "c")`. Use a `set` if the elements are hashable. | 12 | "a" == foo or "b" == foo or "c" == foo @@ -135,7 +147,7 @@ repeated_equality_comparison.py:14:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 11 11 | 12 12 | "a" == foo or "b" == foo or "c" == foo 13 13 | @@ -145,6 +157,8 @@ repeated_equality_comparison.py:14:1: PLR1714 [*] Consider merging multiple comp 16 16 | "a" == foo or foo == "b" or "c" == foo 17 17 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + repeated_equality_comparison.py:16:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. | 14 | "a" != foo and "b" != foo and "c" != foo @@ -156,7 +170,7 @@ repeated_equality_comparison.py:16:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 13 13 | 14 14 | "a" != foo and "b" != foo and "c" != foo 15 15 | @@ -166,6 +180,8 @@ repeated_equality_comparison.py:16:1: PLR1714 [*] Consider merging multiple comp 18 18 | foo == bar or baz == foo or qux == foo 19 19 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + repeated_equality_comparison.py:18:1: PLR1714 [*] Consider merging multiple comparisons: `foo in (bar, baz, qux)`. Use a `set` if the elements are hashable. | 16 | "a" == foo or foo == "b" or "c" == foo @@ -177,7 +193,7 @@ repeated_equality_comparison.py:18:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 15 15 | 16 16 | "a" == foo or foo == "b" or "c" == foo 17 17 | @@ -187,6 +203,8 @@ repeated_equality_comparison.py:18:1: PLR1714 [*] Consider merging multiple comp 20 20 | foo == "a" or "b" == foo or foo == "c" 21 21 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + repeated_equality_comparison.py:20:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. | 18 | foo == bar or baz == foo or qux == foo @@ -198,7 +216,7 @@ repeated_equality_comparison.py:20:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 17 17 | 18 18 | foo == bar or baz == foo or qux == foo 19 19 | @@ -208,6 +226,8 @@ repeated_equality_comparison.py:20:1: PLR1714 [*] Consider merging multiple comp 22 22 | foo != "a" and "b" != foo and foo != "c" 23 23 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + repeated_equality_comparison.py:22:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in ("a", "b", "c")`. Use a `set` if the elements are hashable. | 20 | foo == "a" or "b" == foo or foo == "c" @@ -219,7 +239,7 @@ repeated_equality_comparison.py:22:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 19 19 | 20 20 | foo == "a" or "b" == foo or foo == "c" 21 21 | @@ -229,6 +249,8 @@ repeated_equality_comparison.py:22:1: PLR1714 [*] Consider merging multiple comp 24 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets 25 25 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b")`. Use a `set` if the elements are hashable. | 22 | foo != "a" and "b" != foo and foo != "c" @@ -240,7 +262,7 @@ repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 21 21 | 22 22 | foo != "a" and "b" != foo and foo != "c" 23 23 | @@ -250,6 +272,8 @@ repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comp 26 26 | foo.bar == "a" or foo.bar == "b" # Attributes. 27 27 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comparisons: `bar in ("c", "d")`. Use a `set` if the elements are hashable. | 22 | foo != "a" and "b" != foo and foo != "c" @@ -261,7 +285,7 @@ repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 21 21 | 22 22 | foo != "a" and "b" != foo and foo != "c" 23 23 | @@ -271,6 +295,8 @@ repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comp 26 26 | foo.bar == "a" or foo.bar == "b" # Attributes. 27 27 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + repeated_equality_comparison.py:26:1: PLR1714 [*] Consider merging multiple comparisons: `foo.bar in ("a", "b")`. Use a `set` if the elements are hashable. | 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets @@ -282,7 +308,7 @@ repeated_equality_comparison.py:26:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 23 23 | 24 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets 25 25 | @@ -292,6 +318,8 @@ repeated_equality_comparison.py:26:1: PLR1714 [*] Consider merging multiple comp 28 28 | # OK 29 29 | foo == "a" and foo == "b" and foo == "c" # `and` mixed with `==`. + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + repeated_equality_comparison.py:61:16: PLR1714 [*] Consider merging multiple comparisons: `bar in ("c", "d")`. Use a `set` if the elements are hashable. | 59 | foo == "a" or "c" == bar or foo == "b" or "d" == bar # Multiple targets @@ -303,7 +331,7 @@ repeated_equality_comparison.py:61:16: PLR1714 [*] Consider merging multiple com | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 58 58 | 59 59 | foo == "a" or "c" == bar or foo == "b" or "d" == bar # Multiple targets 60 60 | @@ -313,6 +341,8 @@ repeated_equality_comparison.py:61:16: PLR1714 [*] Consider merging multiple com 63 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets 64 64 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + repeated_equality_comparison.py:63:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b")`. Use a `set` if the elements are hashable. | 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets @@ -324,7 +354,7 @@ repeated_equality_comparison.py:63:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 60 60 | 61 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets 62 62 | @@ -334,6 +364,8 @@ repeated_equality_comparison.py:63:1: PLR1714 [*] Consider merging multiple comp 65 65 | foo == "a" or ("c" != bar and "d" != bar) or foo == "b" # Multiple targets 66 66 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + repeated_equality_comparison.py:63:29: PLR1714 [*] Consider merging multiple comparisons: `bar not in ("c", "d")`. Use a `set` if the elements are hashable. | 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets @@ -345,7 +377,7 @@ repeated_equality_comparison.py:63:29: PLR1714 [*] Consider merging multiple com | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 60 60 | 61 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets 62 62 | @@ -355,6 +387,8 @@ repeated_equality_comparison.py:63:29: PLR1714 [*] Consider merging multiple com 65 65 | foo == "a" or ("c" != bar and "d" != bar) or foo == "b" # Multiple targets 66 66 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + repeated_equality_comparison.py:65:16: PLR1714 [*] Consider merging multiple comparisons: `bar not in ("c", "d")`. Use a `set` if the elements are hashable. | 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets @@ -366,7 +400,7 @@ repeated_equality_comparison.py:65:16: PLR1714 [*] Consider merging multiple com | = help: Merge multiple comparisons -ℹ Unsafe fix +Suggested fix: 62 62 | 63 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets 64 64 | @@ -374,3 +408,5 @@ repeated_equality_comparison.py:65:16: PLR1714 [*] Consider merging multiple com 65 |+foo == "a" or (bar not in ("c", "d")) or foo == "b" # Multiple targets 66 66 | 67 67 | foo == "a" and "c" != bar or foo == "b" and "d" != bar # Multiple targets + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap index 290c2cc893219..d3696081527b4 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap @@ -9,7 +9,7 @@ sys_exit_alias_0.py:1:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 |-exit(0) 1 |+import sys 2 |+sys.exit(0) @@ -17,6 +17,8 @@ sys_exit_alias_0.py:1:1: PLR1722 [*] Use `sys.exit()` instead of `exit` 3 4 | 4 5 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_0.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | 1 | exit(0) @@ -25,7 +27,7 @@ sys_exit_alias_0.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 |+import sys 1 2 | exit(0) 2 |-quit(0) @@ -34,6 +36,8 @@ sys_exit_alias_0.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` 4 5 | 5 6 | def main(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_0.py:6:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | 5 | def main(): @@ -43,7 +47,7 @@ sys_exit_alias_0.py:6:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 |+import sys 1 2 | exit(0) 2 3 | quit(0) @@ -54,6 +58,8 @@ sys_exit_alias_0.py:6:5: PLR1722 [*] Use `sys.exit()` instead of `exit` 7 |+ sys.exit(2) 7 8 | quit(2) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_0.py:7:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | 5 | def main(): @@ -63,7 +69,7 @@ sys_exit_alias_0.py:7:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 |+import sys 1 2 | exit(0) 2 3 | quit(0) @@ -74,4 +80,4 @@ sys_exit_alias_0.py:7:5: PLR1722 [*] Use `sys.exit()` instead of `quit` 7 |- quit(2) 8 |+ sys.exit(2) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap index f2124e8dedb5d..10e1785f6ab10 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap @@ -11,7 +11,7 @@ sys_exit_alias_1.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 1 | import sys 2 2 | 3 |-exit(0) @@ -20,6 +20,8 @@ sys_exit_alias_1.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` 5 5 | 6 6 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_1.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | 3 | exit(0) @@ -28,7 +30,7 @@ sys_exit_alias_1.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 1 | import sys 2 2 | 3 3 | exit(0) @@ -38,6 +40,8 @@ sys_exit_alias_1.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` 6 6 | 7 7 | def main(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_1.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | 7 | def main(): @@ -47,7 +51,7 @@ sys_exit_alias_1.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 5 5 | 6 6 | 7 7 | def main(): @@ -57,6 +61,8 @@ sys_exit_alias_1.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` 10 10 | 11 11 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_1.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | 7 | def main(): @@ -66,7 +72,7 @@ sys_exit_alias_1.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 6 6 | 7 7 | def main(): 8 8 | exit(1) @@ -76,6 +82,8 @@ sys_exit_alias_1.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` 11 11 | 12 12 | def main(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_1.py:15:5: PLR1722 Use `sys.exit()` instead of `exit` | 13 | sys = 1 @@ -93,5 +101,3 @@ sys_exit_alias_1.py:16:5: PLR1722 Use `sys.exit()` instead of `quit` | ^^^^ PLR1722 | = help: Replace `quit` with `sys.exit()` - - diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap index 4f537fcd13484..95d56d4db0f92 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap @@ -10,11 +10,11 @@ sys_exit_alias_11.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 1 | from sys import * 2 |+import sys 2 3 | 3 |-exit(0) 4 |+sys.exit(0) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap index 8221f82db5848..5834deaadc7e7 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap @@ -10,11 +10,11 @@ sys_exit_alias_12.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 |-import os \ 1 |+import os; import sys \ 2 2 | 3 |-exit(0) 3 |+sys.exit(0) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap index d5faaa92dafae..975062776f8c4 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap @@ -11,7 +11,7 @@ sys_exit_alias_2.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 1 | import sys as sys2 2 2 | 3 |-exit(0) @@ -20,6 +20,8 @@ sys_exit_alias_2.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` 5 5 | 6 6 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_2.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | 3 | exit(0) @@ -28,7 +30,7 @@ sys_exit_alias_2.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 1 | import sys as sys2 2 2 | 3 3 | exit(0) @@ -38,6 +40,8 @@ sys_exit_alias_2.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` 6 6 | 7 7 | def main(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_2.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | 7 | def main(): @@ -47,7 +51,7 @@ sys_exit_alias_2.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 5 5 | 6 6 | 7 7 | def main(): @@ -55,6 +59,8 @@ sys_exit_alias_2.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` 8 |+ sys2.exit(1) 9 9 | quit(1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_2.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | 7 | def main(): @@ -64,11 +70,11 @@ sys_exit_alias_2.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 6 6 | 7 7 | def main(): 8 8 | exit(1) 9 |- quit(1) 9 |+ sys2.exit(1) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap index c7faa956b3164..1279304c106a0 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap @@ -9,7 +9,7 @@ sys_exit_alias_3.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 1 | from sys import exit 2 2 | 3 3 | exit(0) @@ -19,6 +19,8 @@ sys_exit_alias_3.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` 6 6 | 7 7 | def main(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_3.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | 7 | def main(): @@ -28,7 +30,7 @@ sys_exit_alias_3.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 6 6 | 7 7 | def main(): 8 8 | exit(1) @@ -38,6 +40,8 @@ sys_exit_alias_3.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` 11 11 | 12 12 | def main(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_3.py:16:5: PLR1722 Use `sys.exit()` instead of `quit` | 15 | exit(1) @@ -45,5 +49,3 @@ sys_exit_alias_3.py:16:5: PLR1722 Use `sys.exit()` instead of `quit` | ^^^^ PLR1722 | = help: Replace `quit` with `sys.exit()` - - diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap index 9a41754444964..4fb6fffbcd1b7 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap @@ -11,7 +11,7 @@ sys_exit_alias_4.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 1 | from sys import exit as exit2 2 2 | 3 |-exit(0) @@ -20,6 +20,8 @@ sys_exit_alias_4.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` 5 5 | 6 6 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_4.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | 3 | exit(0) @@ -28,7 +30,7 @@ sys_exit_alias_4.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 1 | from sys import exit as exit2 2 2 | 3 3 | exit(0) @@ -38,6 +40,8 @@ sys_exit_alias_4.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` 6 6 | 7 7 | def main(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_4.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | 7 | def main(): @@ -47,7 +51,7 @@ sys_exit_alias_4.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 5 5 | 6 6 | 7 7 | def main(): @@ -55,6 +59,8 @@ sys_exit_alias_4.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` 8 |+ exit2(1) 9 9 | quit(1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_4.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | 7 | def main(): @@ -64,11 +70,11 @@ sys_exit_alias_4.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 6 6 | 7 7 | def main(): 8 8 | exit(1) 9 |- quit(1) 9 |+ exit2(1) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap index 8a6bbc5f3eadd..bb5b903b9a421 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap @@ -11,7 +11,7 @@ sys_exit_alias_5.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 1 | from sys import * 2 |+import sys 2 3 | @@ -21,6 +21,8 @@ sys_exit_alias_5.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` 5 6 | 6 7 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_5.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | 3 | exit(0) @@ -29,7 +31,7 @@ sys_exit_alias_5.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 1 | from sys import * 2 |+import sys 2 3 | @@ -40,6 +42,8 @@ sys_exit_alias_5.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` 6 7 | 7 8 | def main(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_5.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | 7 | def main(): @@ -49,7 +53,7 @@ sys_exit_alias_5.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 1 | from sys import * 2 |+import sys 2 3 | @@ -62,6 +66,8 @@ sys_exit_alias_5.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` 9 |+ sys.exit(1) 9 10 | quit(1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_5.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | 7 | def main(): @@ -71,7 +77,7 @@ sys_exit_alias_5.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 1 | from sys import * 2 |+import sys 2 3 | @@ -84,4 +90,4 @@ sys_exit_alias_5.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` 9 |- quit(1) 10 |+ sys.exit(1) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap index 87119e06653e7..aae23399b13a6 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap @@ -9,7 +9,7 @@ sys_exit_alias_6.py:1:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 |-exit(0) 1 |+import sys 2 |+sys.exit(0) @@ -17,6 +17,8 @@ sys_exit_alias_6.py:1:1: PLR1722 [*] Use `sys.exit()` instead of `exit` 3 4 | 4 5 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + sys_exit_alias_6.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | 1 | exit(0) @@ -25,7 +27,7 @@ sys_exit_alias_6.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 |+import sys 1 2 | exit(0) 2 |-quit(0) @@ -34,4 +36,4 @@ sys_exit_alias_6.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` 4 5 | 5 6 | def exit(e): - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap index 4c32e7cc3a49e..6f0af913c8041 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap @@ -9,7 +9,7 @@ sys_exit_alias_7.py:2:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 |+import sys 1 2 | def main(): 2 |- exit(0) @@ -18,4 +18,4 @@ sys_exit_alias_7.py:2:5: PLR1722 [*] Use `sys.exit()` instead of `exit` 4 5 | 5 6 | import functools - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap index 1423a41dba204..284bc6b8a9b0d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap @@ -9,11 +9,11 @@ sys_exit_alias_8.py:5:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 |-from sys import argv 1 |+from sys import argv, exit 2 2 | 3 3 | 4 4 | def main(): - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap index 23107f606658f..864b5eab2290f 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap @@ -9,7 +9,7 @@ sys_exit_alias_9.py:2:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Unsafe fix +Suggested fix: 1 |+import sys 1 2 | def main(): 2 |- exit(0) @@ -18,4 +18,4 @@ sys_exit_alias_9.py:2:5: PLR1722 [*] Use `sys.exit()` instead of `exit` 4 5 | 5 6 | from sys import argv - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1730_if_stmt_min_max.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1730_if_stmt_min_max.py.snap index 52baee302a31d..bc14269c7db00 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1730_if_stmt_min_max.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1730_if_stmt_min_max.py.snap @@ -12,7 +12,7 @@ if_stmt_min_max.py:8:1: PLR1730 [*] Replace `if` statement with `value = max(val | = help: Replace with `value = max(value, 10)` -ℹ Safe fix +Suggested fix: 5 5 | value3 = 3 6 6 | 7 7 | # Positive @@ -23,6 +23,8 @@ if_stmt_min_max.py:8:1: PLR1730 [*] Replace `if` statement with `value = max(val 11 10 | if value <= 10: # [max-instead-of-if] 12 11 | value = 10 + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:11:1: PLR1730 [*] Replace `if` statement with `value = max(10, value)` | 9 | value = 10 @@ -35,7 +37,7 @@ if_stmt_min_max.py:11:1: PLR1730 [*] Replace `if` statement with `value = max(10 | = help: Replace with `value = max(10, value)` -ℹ Safe fix +Suggested fix: 8 8 | if value < 10: # [max-instead-of-if] 9 9 | value = 10 10 10 | @@ -46,6 +48,8 @@ if_stmt_min_max.py:11:1: PLR1730 [*] Replace `if` statement with `value = max(10 14 13 | if value < value2: # [max-instead-of-if] 15 14 | value = value2 + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:14:1: PLR1730 [*] Replace `if` statement with `value = max(value, value2)` | 12 | value = 10 @@ -58,7 +62,7 @@ if_stmt_min_max.py:14:1: PLR1730 [*] Replace `if` statement with `value = max(va | = help: Replace with `value = max(value, value2)` -ℹ Safe fix +Suggested fix: 11 11 | if value <= 10: # [max-instead-of-if] 12 12 | value = 10 13 13 | @@ -69,6 +73,8 @@ if_stmt_min_max.py:14:1: PLR1730 [*] Replace `if` statement with `value = max(va 17 16 | if value > 10: # [min-instead-of-if] 18 17 | value = 10 + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:17:1: PLR1730 [*] Replace `if` statement with `value = min(value, 10)` | 15 | value = value2 @@ -81,7 +87,7 @@ if_stmt_min_max.py:17:1: PLR1730 [*] Replace `if` statement with `value = min(va | = help: Replace with `value = min(value, 10)` -ℹ Safe fix +Suggested fix: 14 14 | if value < value2: # [max-instead-of-if] 15 15 | value = value2 16 16 | @@ -92,6 +98,8 @@ if_stmt_min_max.py:17:1: PLR1730 [*] Replace `if` statement with `value = min(va 20 19 | if value >= 10: # [min-instead-of-if] 21 20 | value = 10 + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:20:1: PLR1730 [*] Replace `if` statement with `value = min(10, value)` | 18 | value = 10 @@ -104,7 +112,7 @@ if_stmt_min_max.py:20:1: PLR1730 [*] Replace `if` statement with `value = min(10 | = help: Replace with `value = min(10, value)` -ℹ Safe fix +Suggested fix: 17 17 | if value > 10: # [min-instead-of-if] 18 18 | value = 10 19 19 | @@ -115,6 +123,8 @@ if_stmt_min_max.py:20:1: PLR1730 [*] Replace `if` statement with `value = min(10 23 22 | if value > value2: # [min-instead-of-if] 24 23 | value = value2 + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:23:1: PLR1730 [*] Replace `if` statement with `value = min(value, value2)` | 21 | value = 10 @@ -125,7 +135,7 @@ if_stmt_min_max.py:23:1: PLR1730 [*] Replace `if` statement with `value = min(va | = help: Replace with `value = min(value, value2)` -ℹ Safe fix +Suggested fix: 20 20 | if value >= 10: # [min-instead-of-if] 21 21 | value = 10 22 22 | @@ -136,6 +146,8 @@ if_stmt_min_max.py:23:1: PLR1730 [*] Replace `if` statement with `value = min(va 26 25 | 27 26 | class A: + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:33:1: PLR1730 [*] Replace `if` statement with `A1.value = max(A1.value, 10)` | 32 | A1 = A() @@ -147,7 +159,7 @@ if_stmt_min_max.py:33:1: PLR1730 [*] Replace `if` statement with `A1.value = max | = help: Replace with `A1.value = max(A1.value, 10)` -ℹ Safe fix +Suggested fix: 30 30 | 31 31 | 32 32 | A1 = A() @@ -158,6 +170,8 @@ if_stmt_min_max.py:33:1: PLR1730 [*] Replace `if` statement with `A1.value = max 36 35 | if A1.value > 10: # [min-instead-of-if] 37 36 | A1.value = 10 + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:36:1: PLR1730 [*] Replace `if` statement with `A1.value = min(A1.value, 10)` | 34 | A1.value = 10 @@ -168,7 +182,7 @@ if_stmt_min_max.py:36:1: PLR1730 [*] Replace `if` statement with `A1.value = min | = help: Replace with `A1.value = min(A1.value, 10)` -ℹ Safe fix +Suggested fix: 33 33 | if A1.value < 10: # [max-instead-of-if] 34 34 | A1.value = 10 35 35 | @@ -179,6 +193,8 @@ if_stmt_min_max.py:36:1: PLR1730 [*] Replace `if` statement with `A1.value = min 39 38 | 40 39 | class AA: + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:60:1: PLR1730 [*] Replace `if` statement with `A2 = max(A2, A1)` | 58 | A2 = AA(3) @@ -191,7 +207,7 @@ if_stmt_min_max.py:60:1: PLR1730 [*] Replace `if` statement with `A2 = max(A2, A | = help: Replace with `A2 = max(A2, A1)` -ℹ Safe fix +Suggested fix: 57 57 | A1 = AA(0) 58 58 | A2 = AA(3) 59 59 | @@ -202,6 +218,8 @@ if_stmt_min_max.py:60:1: PLR1730 [*] Replace `if` statement with `A2 = max(A2, A 63 62 | if A2 <= A1: # [max-instead-of-if] 64 63 | A2 = A1 + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:63:1: PLR1730 [*] Replace `if` statement with `A2 = max(A1, A2)` | 61 | A2 = A1 @@ -214,7 +232,7 @@ if_stmt_min_max.py:63:1: PLR1730 [*] Replace `if` statement with `A2 = max(A1, A | = help: Replace with `A2 = max(A1, A2)` -ℹ Safe fix +Suggested fix: 60 60 | if A2 < A1: # [max-instead-of-if] 61 61 | A2 = A1 62 62 | @@ -225,6 +243,8 @@ if_stmt_min_max.py:63:1: PLR1730 [*] Replace `if` statement with `A2 = max(A1, A 66 65 | if A2 > A1: # [min-instead-of-if] 67 66 | A2 = A1 + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:66:1: PLR1730 [*] Replace `if` statement with `A2 = min(A2, A1)` | 64 | A2 = A1 @@ -237,7 +257,7 @@ if_stmt_min_max.py:66:1: PLR1730 [*] Replace `if` statement with `A2 = min(A2, A | = help: Replace with `A2 = min(A2, A1)` -ℹ Safe fix +Suggested fix: 63 63 | if A2 <= A1: # [max-instead-of-if] 64 64 | A2 = A1 65 65 | @@ -248,6 +268,8 @@ if_stmt_min_max.py:66:1: PLR1730 [*] Replace `if` statement with `A2 = min(A2, A 69 68 | if A2 >= A1: # [min-instead-of-if] 70 69 | A2 = A1 + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:69:1: PLR1730 [*] Replace `if` statement with `A2 = min(A1, A2)` | 67 | A2 = A1 @@ -260,7 +282,7 @@ if_stmt_min_max.py:69:1: PLR1730 [*] Replace `if` statement with `A2 = min(A1, A | = help: Replace with `A2 = min(A1, A2)` -ℹ Safe fix +Suggested fix: 66 66 | if A2 > A1: # [min-instead-of-if] 67 67 | A2 = A1 68 68 | @@ -271,6 +293,8 @@ if_stmt_min_max.py:69:1: PLR1730 [*] Replace `if` statement with `A2 = min(A1, A 72 71 | # Negative 73 72 | if value < 10: + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:132:1: PLR1730 [*] Replace `if` statement with `min` call | 131 | # Parenthesized expressions @@ -285,7 +309,7 @@ if_stmt_min_max.py:132:1: PLR1730 [*] Replace `if` statement with `min` call | = help: Replace with `min` call -ℹ Safe fix +Suggested fix: 129 129 | value = 2 130 130 | 131 131 | # Parenthesized expressions @@ -300,6 +324,8 @@ if_stmt_min_max.py:132:1: PLR1730 [*] Replace `if` statement with `min` call 138 137 | class Foo: 139 138 | _min = 0 + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:143:9: PLR1730 [*] Replace `if` statement with `self._min = min(value, self._min)` | 142 | def foo(self, value) -> None: @@ -312,7 +338,7 @@ if_stmt_min_max.py:143:9: PLR1730 [*] Replace `if` statement with `self._min = m | = help: Replace with `self._min = min(value, self._min)` -ℹ Safe fix +Suggested fix: 140 140 | _max = 0 141 141 | 142 142 | def foo(self, value) -> None: @@ -323,6 +349,8 @@ if_stmt_min_max.py:143:9: PLR1730 [*] Replace `if` statement with `self._min = m 146 145 | self._max = value 147 146 | + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:145:9: PLR1730 [*] Replace `if` statement with `self._max = max(value, self._max)` | 143 | if value < self._min: @@ -336,7 +364,7 @@ if_stmt_min_max.py:145:9: PLR1730 [*] Replace `if` statement with `self._max = m | = help: Replace with `self._max = max(value, self._max)` -ℹ Safe fix +Suggested fix: 142 142 | def foo(self, value) -> None: 143 143 | if value < self._min: 144 144 | self._min = value @@ -347,6 +375,8 @@ if_stmt_min_max.py:145:9: PLR1730 [*] Replace `if` statement with `self._max = m 148 147 | if self._min < value: 149 148 | self._min = value + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:148:9: PLR1730 [*] Replace `if` statement with `self._min = max(self._min, value)` | 146 | self._max = value @@ -360,7 +390,7 @@ if_stmt_min_max.py:148:9: PLR1730 [*] Replace `if` statement with `self._min = m | = help: Replace with `self._min = max(self._min, value)` -ℹ Safe fix +Suggested fix: 145 145 | if value > self._max: 146 146 | self._max = value 147 147 | @@ -371,6 +401,8 @@ if_stmt_min_max.py:148:9: PLR1730 [*] Replace `if` statement with `self._min = m 151 150 | self._max = value 152 151 | + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:150:9: PLR1730 [*] Replace `if` statement with `self._max = min(self._max, value)` | 148 | if self._min < value: @@ -384,7 +416,7 @@ if_stmt_min_max.py:150:9: PLR1730 [*] Replace `if` statement with `self._max = m | = help: Replace with `self._max = min(self._max, value)` -ℹ Safe fix +Suggested fix: 147 147 | 148 148 | if self._min < value: 149 149 | self._min = value @@ -395,6 +427,8 @@ if_stmt_min_max.py:150:9: PLR1730 [*] Replace `if` statement with `self._max = m 153 152 | if value <= self._min: 154 153 | self._min = value + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:153:9: PLR1730 [*] Replace `if` statement with `self._min = min(self._min, value)` | 151 | self._max = value @@ -408,7 +442,7 @@ if_stmt_min_max.py:153:9: PLR1730 [*] Replace `if` statement with `self._min = m | = help: Replace with `self._min = min(self._min, value)` -ℹ Safe fix +Suggested fix: 150 150 | if self._max > value: 151 151 | self._max = value 152 152 | @@ -419,6 +453,8 @@ if_stmt_min_max.py:153:9: PLR1730 [*] Replace `if` statement with `self._min = m 156 155 | self._max = value 157 156 | + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:155:9: PLR1730 [*] Replace `if` statement with `self._max = max(self._max, value)` | 153 | if value <= self._min: @@ -432,7 +468,7 @@ if_stmt_min_max.py:155:9: PLR1730 [*] Replace `if` statement with `self._max = m | = help: Replace with `self._max = max(self._max, value)` -ℹ Safe fix +Suggested fix: 152 152 | 153 153 | if value <= self._min: 154 154 | self._min = value @@ -443,6 +479,8 @@ if_stmt_min_max.py:155:9: PLR1730 [*] Replace `if` statement with `self._max = m 158 157 | if self._min <= value: 159 158 | self._min = value + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:158:9: PLR1730 [*] Replace `if` statement with `self._min = max(value, self._min)` | 156 | self._max = value @@ -456,7 +494,7 @@ if_stmt_min_max.py:158:9: PLR1730 [*] Replace `if` statement with `self._min = m | = help: Replace with `self._min = max(value, self._min)` -ℹ Safe fix +Suggested fix: 155 155 | if value >= self._max: 156 156 | self._max = value 157 157 | @@ -466,6 +504,8 @@ if_stmt_min_max.py:158:9: PLR1730 [*] Replace `if` statement with `self._min = m 160 159 | if self._max >= value: 161 160 | self._max = value + Run `ruff check --fix` to apply this fix. + if_stmt_min_max.py:160:9: PLR1730 [*] Replace `if` statement with `self._max = min(value, self._max)` | 158 | if self._min <= value: @@ -477,10 +517,12 @@ if_stmt_min_max.py:160:9: PLR1730 [*] Replace `if` statement with `self._max = m | = help: Replace with `self._max = min(value, self._max)` -ℹ Safe fix +Suggested fix: 157 157 | 158 158 | if self._min <= value: 159 159 | self._min = value 160 |- if self._max >= value: 161 |- self._max = value 160 |+ self._max = min(value, self._max) + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap index 1f52c2ffe1329..dd5d6e7294efb 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap @@ -11,7 +11,7 @@ unnecessary_dict_index_lookup.py:4:6: PLR1733 [*] Unnecessary lookup of dictiona | = help: Use existing variable -ℹ Safe fix +Suggested fix: 1 1 | FRUITS = {"apple": 1, "orange": 10, "berry": 22} 2 2 | 3 3 | def fix_these(): @@ -21,6 +21,8 @@ unnecessary_dict_index_lookup.py:4:6: PLR1733 [*] Unnecessary lookup of dictiona 6 6 | {fruit_name: FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()} # PLR1733 7 7 | + Run `ruff check --fix` to apply this fix. + unnecessary_dict_index_lookup.py:5:6: PLR1733 [*] Unnecessary lookup of dictionary value by key | 3 | def fix_these(): @@ -31,7 +33,7 @@ unnecessary_dict_index_lookup.py:5:6: PLR1733 [*] Unnecessary lookup of dictiona | = help: Use existing variable -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | def fix_these(): 4 4 | [FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()] # PLR1733 @@ -41,6 +43,8 @@ unnecessary_dict_index_lookup.py:5:6: PLR1733 [*] Unnecessary lookup of dictiona 7 7 | 8 8 | for fruit_name, fruit_count in FRUITS.items(): + Run `ruff check --fix` to apply this fix. + unnecessary_dict_index_lookup.py:6:18: PLR1733 [*] Unnecessary lookup of dictionary value by key | 4 | [FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()] # PLR1733 @@ -52,7 +56,7 @@ unnecessary_dict_index_lookup.py:6:18: PLR1733 [*] Unnecessary lookup of diction | = help: Use existing variable -ℹ Safe fix +Suggested fix: 3 3 | def fix_these(): 4 4 | [FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()] # PLR1733 5 5 | {FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()} # PLR1733 @@ -62,6 +66,8 @@ unnecessary_dict_index_lookup.py:6:18: PLR1733 [*] Unnecessary lookup of diction 8 8 | for fruit_name, fruit_count in FRUITS.items(): 9 9 | print(FRUITS[fruit_name]) # PLR1733 + Run `ruff check --fix` to apply this fix. + unnecessary_dict_index_lookup.py:9:15: PLR1733 [*] Unnecessary lookup of dictionary value by key | 8 | for fruit_name, fruit_count in FRUITS.items(): @@ -72,7 +78,7 @@ unnecessary_dict_index_lookup.py:9:15: PLR1733 [*] Unnecessary lookup of diction | = help: Use existing variable -ℹ Safe fix +Suggested fix: 6 6 | {fruit_name: FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()} # PLR1733 7 7 | 8 8 | for fruit_name, fruit_count in FRUITS.items(): @@ -82,6 +88,8 @@ unnecessary_dict_index_lookup.py:9:15: PLR1733 [*] Unnecessary lookup of diction 11 11 | assert FRUITS[fruit_name] == "pear" # PLR1733 12 12 | + Run `ruff check --fix` to apply this fix. + unnecessary_dict_index_lookup.py:10:16: PLR1733 [*] Unnecessary lookup of dictionary value by key | 8 | for fruit_name, fruit_count in FRUITS.items(): @@ -92,7 +100,7 @@ unnecessary_dict_index_lookup.py:10:16: PLR1733 [*] Unnecessary lookup of dictio | = help: Use existing variable -ℹ Safe fix +Suggested fix: 7 7 | 8 8 | for fruit_name, fruit_count in FRUITS.items(): 9 9 | print(FRUITS[fruit_name]) # PLR1733 @@ -102,6 +110,8 @@ unnecessary_dict_index_lookup.py:10:16: PLR1733 [*] Unnecessary lookup of dictio 12 12 | 13 13 | + Run `ruff check --fix` to apply this fix. + unnecessary_dict_index_lookup.py:11:16: PLR1733 [*] Unnecessary lookup of dictionary value by key | 9 | print(FRUITS[fruit_name]) # PLR1733 @@ -111,7 +121,7 @@ unnecessary_dict_index_lookup.py:11:16: PLR1733 [*] Unnecessary lookup of dictio | = help: Use existing variable -ℹ Safe fix +Suggested fix: 8 8 | for fruit_name, fruit_count in FRUITS.items(): 9 9 | print(FRUITS[fruit_name]) # PLR1733 10 10 | blah = FRUITS[fruit_name] # PLR1733 @@ -121,4 +131,4 @@ unnecessary_dict_index_lookup.py:11:16: PLR1733 [*] Unnecessary lookup of dictio 13 13 | 14 14 | def dont_fix_these(): - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap index a212e600b2cf7..8dc794434b2a1 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap @@ -11,7 +11,7 @@ unnecessary_list_index_lookup.py:7:6: PLR1736 [*] List index lookup in `enumerat | = help: Use the loop variable directly -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | 6 6 | def fix_these(): @@ -21,6 +21,8 @@ unnecessary_list_index_lookup.py:7:6: PLR1736 [*] List index lookup in `enumerat 9 9 | {letter: letters[index] for index, letter in enumerate(letters)} # PLR1736 10 10 | + Run `ruff check --fix` to apply this fix. + unnecessary_list_index_lookup.py:8:6: PLR1736 [*] List index lookup in `enumerate()` loop | 6 | def fix_these(): @@ -31,7 +33,7 @@ unnecessary_list_index_lookup.py:8:6: PLR1736 [*] List index lookup in `enumerat | = help: Use the loop variable directly -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | def fix_these(): 7 7 | [letters[index] for index, letter in enumerate(letters)] # PLR1736 @@ -41,6 +43,8 @@ unnecessary_list_index_lookup.py:8:6: PLR1736 [*] List index lookup in `enumerat 10 10 | 11 11 | for index, letter in enumerate(letters): + Run `ruff check --fix` to apply this fix. + unnecessary_list_index_lookup.py:9:14: PLR1736 [*] List index lookup in `enumerate()` loop | 7 | [letters[index] for index, letter in enumerate(letters)] # PLR1736 @@ -52,7 +56,7 @@ unnecessary_list_index_lookup.py:9:14: PLR1736 [*] List index lookup in `enumera | = help: Use the loop variable directly -ℹ Safe fix +Suggested fix: 6 6 | def fix_these(): 7 7 | [letters[index] for index, letter in enumerate(letters)] # PLR1736 8 8 | {letters[index] for index, letter in enumerate(letters)} # PLR1736 @@ -62,6 +66,8 @@ unnecessary_list_index_lookup.py:9:14: PLR1736 [*] List index lookup in `enumera 11 11 | for index, letter in enumerate(letters): 12 12 | print(letters[index]) # PLR1736 + Run `ruff check --fix` to apply this fix. + unnecessary_list_index_lookup.py:12:15: PLR1736 [*] List index lookup in `enumerate()` loop | 11 | for index, letter in enumerate(letters): @@ -72,7 +78,7 @@ unnecessary_list_index_lookup.py:12:15: PLR1736 [*] List index lookup in `enumer | = help: Use the loop variable directly -ℹ Safe fix +Suggested fix: 9 9 | {letter: letters[index] for index, letter in enumerate(letters)} # PLR1736 10 10 | 11 11 | for index, letter in enumerate(letters): @@ -82,6 +88,8 @@ unnecessary_list_index_lookup.py:12:15: PLR1736 [*] List index lookup in `enumer 14 14 | assert letters[index] == "d" # PLR1736 15 15 | + Run `ruff check --fix` to apply this fix. + unnecessary_list_index_lookup.py:13:16: PLR1736 [*] List index lookup in `enumerate()` loop | 11 | for index, letter in enumerate(letters): @@ -92,7 +100,7 @@ unnecessary_list_index_lookup.py:13:16: PLR1736 [*] List index lookup in `enumer | = help: Use the loop variable directly -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | for index, letter in enumerate(letters): 12 12 | print(letters[index]) # PLR1736 @@ -102,6 +110,8 @@ unnecessary_list_index_lookup.py:13:16: PLR1736 [*] List index lookup in `enumer 15 15 | 16 16 | for index, letter in builtins.enumerate(letters): + Run `ruff check --fix` to apply this fix. + unnecessary_list_index_lookup.py:14:16: PLR1736 [*] List index lookup in `enumerate()` loop | 12 | print(letters[index]) # PLR1736 @@ -113,7 +123,7 @@ unnecessary_list_index_lookup.py:14:16: PLR1736 [*] List index lookup in `enumer | = help: Use the loop variable directly -ℹ Safe fix +Suggested fix: 11 11 | for index, letter in enumerate(letters): 12 12 | print(letters[index]) # PLR1736 13 13 | blah = letters[index] # PLR1736 @@ -123,6 +133,8 @@ unnecessary_list_index_lookup.py:14:16: PLR1736 [*] List index lookup in `enumer 16 16 | for index, letter in builtins.enumerate(letters): 17 17 | print(letters[index]) # PLR1736 + Run `ruff check --fix` to apply this fix. + unnecessary_list_index_lookup.py:17:15: PLR1736 [*] List index lookup in `enumerate()` loop | 16 | for index, letter in builtins.enumerate(letters): @@ -133,7 +145,7 @@ unnecessary_list_index_lookup.py:17:15: PLR1736 [*] List index lookup in `enumer | = help: Use the loop variable directly -ℹ Safe fix +Suggested fix: 14 14 | assert letters[index] == "d" # PLR1736 15 15 | 16 16 | for index, letter in builtins.enumerate(letters): @@ -143,6 +155,8 @@ unnecessary_list_index_lookup.py:17:15: PLR1736 [*] List index lookup in `enumer 19 19 | assert letters[index] == "d" # PLR1736 20 20 | + Run `ruff check --fix` to apply this fix. + unnecessary_list_index_lookup.py:18:16: PLR1736 [*] List index lookup in `enumerate()` loop | 16 | for index, letter in builtins.enumerate(letters): @@ -153,7 +167,7 @@ unnecessary_list_index_lookup.py:18:16: PLR1736 [*] List index lookup in `enumer | = help: Use the loop variable directly -ℹ Safe fix +Suggested fix: 15 15 | 16 16 | for index, letter in builtins.enumerate(letters): 17 17 | print(letters[index]) # PLR1736 @@ -163,6 +177,8 @@ unnecessary_list_index_lookup.py:18:16: PLR1736 [*] List index lookup in `enumer 20 20 | 21 21 | + Run `ruff check --fix` to apply this fix. + unnecessary_list_index_lookup.py:19:16: PLR1736 [*] List index lookup in `enumerate()` loop | 17 | print(letters[index]) # PLR1736 @@ -172,7 +188,7 @@ unnecessary_list_index_lookup.py:19:16: PLR1736 [*] List index lookup in `enumer | = help: Use the loop variable directly -ℹ Safe fix +Suggested fix: 16 16 | for index, letter in builtins.enumerate(letters): 17 17 | print(letters[index]) # PLR1736 18 18 | blah = letters[index] # PLR1736 @@ -181,3 +197,5 @@ unnecessary_list_index_lookup.py:19:16: PLR1736 [*] List index lookup in `enumer 20 20 | 21 21 | 22 22 | def dont_fix_these(): + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap index 94bb9acab3d1c..183725b382fc3 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap @@ -12,7 +12,7 @@ empty_comment.py:3:1: PLR2044 [*] Line with empty comment | = help: Delete the empty comment -ℹ Safe fix +Suggested fix: 1 1 | # this line has a non-empty comment and is OK 2 2 | # this line is also OK, but the three following lines are not 3 |-# @@ -20,6 +20,8 @@ empty_comment.py:3:1: PLR2044 [*] Line with empty comment 5 4 | # 6 5 | + Run `ruff check --fix` to apply this fix. + empty_comment.py:4:5: PLR2044 [*] Line with empty comment | 2 | # this line is also OK, but the three following lines are not @@ -30,7 +32,7 @@ empty_comment.py:4:5: PLR2044 [*] Line with empty comment | = help: Delete the empty comment -ℹ Safe fix +Suggested fix: 1 1 | # this line has a non-empty comment and is OK 2 2 | # this line is also OK, but the three following lines are not 3 3 | # @@ -39,6 +41,8 @@ empty_comment.py:4:5: PLR2044 [*] Line with empty comment 6 5 | 7 6 | # this non-empty comment has trailing whitespace and is OK + Run `ruff check --fix` to apply this fix. + empty_comment.py:5:9: PLR2044 [*] Line with empty comment | 3 | # @@ -50,7 +54,7 @@ empty_comment.py:5:9: PLR2044 [*] Line with empty comment | = help: Delete the empty comment -ℹ Safe fix +Suggested fix: 2 2 | # this line is also OK, but the three following lines are not 3 3 | # 4 4 | # @@ -59,6 +63,8 @@ empty_comment.py:5:9: PLR2044 [*] Line with empty comment 7 6 | # this non-empty comment has trailing whitespace and is OK 8 7 | + Run `ruff check --fix` to apply this fix. + empty_comment.py:18:11: PLR2044 [*] Line with empty comment | 17 | def foo(): # this comment is OK, the one below is not @@ -67,7 +73,7 @@ empty_comment.py:18:11: PLR2044 [*] Line with empty comment | = help: Delete the empty comment -ℹ Safe fix +Suggested fix: 15 15 | 16 16 | 17 17 | def foo(): # this comment is OK, the one below is not @@ -77,6 +83,8 @@ empty_comment.py:18:11: PLR2044 [*] Line with empty comment 20 20 | 21 21 | # the lines below have no comments and are OK + Run `ruff check --fix` to apply this fix. + empty_comment.py:44:1: PLR2044 [*] Line with empty comment | 42 | # These should be removed, despite being an empty "block comment". @@ -87,7 +95,7 @@ empty_comment.py:44:1: PLR2044 [*] Line with empty comment | = help: Delete the empty comment -ℹ Safe fix +Suggested fix: 42 42 | # These should be removed, despite being an empty "block comment". 43 43 | 44 44 | # @@ -96,6 +104,8 @@ empty_comment.py:44:1: PLR2044 [*] Line with empty comment 47 46 | # These should also be removed. 48 47 | + Run `ruff check --fix` to apply this fix. + empty_comment.py:45:1: PLR2044 [*] Line with empty comment | 44 | # @@ -106,7 +116,7 @@ empty_comment.py:45:1: PLR2044 [*] Line with empty comment | = help: Delete the empty comment -ℹ Safe fix +Suggested fix: 42 42 | # These should be removed, despite being an empty "block comment". 43 43 | 44 44 | # @@ -115,6 +125,8 @@ empty_comment.py:45:1: PLR2044 [*] Line with empty comment 47 46 | # These should also be removed. 48 47 | + Run `ruff check --fix` to apply this fix. + empty_comment.py:58:2: PLR2044 [*] Line with empty comment | 57 | α = 1 @@ -123,11 +135,11 @@ empty_comment.py:58:2: PLR2044 [*] Line with empty comment | = help: Delete the empty comment -ℹ Safe fix +Suggested fix: 55 55 | # This should be removed. 56 56 | 57 57 | α = 1 58 |-α# 58 |+α - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR5501_collapsible_else_if.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR5501_collapsible_else_if.py.snap index 4d13e11126c9a..76f5b2a9d4297 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR5501_collapsible_else_if.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR5501_collapsible_else_if.py.snap @@ -13,7 +13,7 @@ collapsible_else_if.py:37:5: PLR5501 [*] Use `elif` instead of `else` then `if`, | = help: Convert to `elif` -ℹ Safe fix +Suggested fix: 34 34 | def not_ok0(): 35 35 | if 1: 36 36 | pass @@ -26,6 +26,8 @@ collapsible_else_if.py:37:5: PLR5501 [*] Use `elif` instead of `else` then `if`, 41 40 | 42 41 | def not_ok1(): + Run `ruff check --fix` to apply this fix. + collapsible_else_if.py:45:5: PLR5501 [*] Use `elif` instead of `else` then `if`, to reduce indentation | 43 | if 1: @@ -39,7 +41,7 @@ collapsible_else_if.py:45:5: PLR5501 [*] Use `elif` instead of `else` then `if`, | = help: Convert to `elif` -ℹ Safe fix +Suggested fix: 42 42 | def not_ok1(): 43 43 | if 1: 44 44 | pass @@ -55,6 +57,8 @@ collapsible_else_if.py:45:5: PLR5501 [*] Use `elif` instead of `else` then `if`, 51 50 | 52 51 | def not_ok1_with_comments(): + Run `ruff check --fix` to apply this fix. + collapsible_else_if.py:55:5: PLR5501 [*] Use `elif` instead of `else` then `if`, to reduce indentation | 53 | if 1: @@ -69,7 +73,7 @@ collapsible_else_if.py:55:5: PLR5501 [*] Use `elif` instead of `else` then `if`, | = help: Convert to `elif` -ℹ Safe fix +Suggested fix: 52 52 | def not_ok1_with_comments(): 53 53 | if 1: 54 54 | pass @@ -86,6 +90,8 @@ collapsible_else_if.py:55:5: PLR5501 [*] Use `elif` instead of `else` then `if`, 62 60 | 63 61 | # Regression test for https://github.com/apache/airflow/blob/f1e1cdcc3b2826e68ba133f350300b5065bbca33/airflow/models/dag.py#L1737 + Run `ruff check --fix` to apply this fix. + collapsible_else_if.py:69:5: PLR5501 [*] Use `elif` instead of `else` then `if`, to reduce indentation | 67 | elif True: @@ -99,7 +105,7 @@ collapsible_else_if.py:69:5: PLR5501 [*] Use `elif` instead of `else` then `if`, | = help: Convert to `elif` -ℹ Safe fix +Suggested fix: 66 66 | print(1) 67 67 | elif True: 68 68 | print(2) @@ -115,6 +121,8 @@ collapsible_else_if.py:69:5: PLR5501 [*] Use `elif` instead of `else` then `if`, 75 74 | 76 75 | def not_ok3(): + Run `ruff check --fix` to apply this fix. + collapsible_else_if.py:79:5: PLR5501 [*] Use `elif` instead of `else` then `if`, to reduce indentation | 77 | if 1: @@ -127,7 +135,7 @@ collapsible_else_if.py:79:5: PLR5501 [*] Use `elif` instead of `else` then `if`, | = help: Convert to `elif` -ℹ Safe fix +Suggested fix: 76 76 | def not_ok3(): 77 77 | if 1: 78 78 | pass @@ -140,6 +148,8 @@ collapsible_else_if.py:79:5: PLR5501 [*] Use `elif` instead of `else` then `if`, 83 82 | 84 83 | def not_ok4(): + Run `ruff check --fix` to apply this fix. + collapsible_else_if.py:87:5: PLR5501 [*] Use `elif` instead of `else` then `if`, to reduce indentation | 85 | if 1: @@ -153,7 +163,7 @@ collapsible_else_if.py:87:5: PLR5501 [*] Use `elif` instead of `else` then `if`, | = help: Convert to `elif` -ℹ Safe fix +Suggested fix: 84 84 | def not_ok4(): 85 85 | if 1: 86 86 | pass @@ -167,6 +177,8 @@ collapsible_else_if.py:87:5: PLR5501 [*] Use `elif` instead of `else` then `if`, 92 91 | 93 92 | def not_ok5(): + Run `ruff check --fix` to apply this fix. + collapsible_else_if.py:96:5: PLR5501 [*] Use `elif` instead of `else` then `if`, to reduce indentation | 94 | if 1: @@ -180,7 +192,7 @@ collapsible_else_if.py:96:5: PLR5501 [*] Use `elif` instead of `else` then `if`, | = help: Convert to `elif` -ℹ Safe fix +Suggested fix: 93 93 | def not_ok5(): 94 94 | if 1: 95 95 | pass @@ -192,4 +204,4 @@ collapsible_else_if.py:96:5: PLR5501 [*] Use `elif` instead of `else` then `if`, 97 |+ pass 98 |+ else: pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap index a676c83cb8bae..0b6977b48c4f2 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap @@ -12,7 +12,7 @@ non_augmented_assignment.py:16:1: PLR6104 [*] Use `+=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 13 13 | some_set = {"elem"} 14 14 | mat1, mat2 = None, None 15 15 | @@ -22,6 +22,8 @@ non_augmented_assignment.py:16:1: PLR6104 [*] Use `+=` to perform an augmented a 18 18 | a_list = a_list + ["to concat"] 19 19 | some_set = some_set | {"to concat"} + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:17:1: PLR6104 [*] Use `-=` to perform an augmented assignment directly | 16 | some_string = some_string + "a very long end of string" @@ -32,7 +34,7 @@ non_augmented_assignment.py:17:1: PLR6104 [*] Use `-=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 14 14 | mat1, mat2 = None, None 15 15 | 16 16 | some_string = some_string + "a very long end of string" @@ -42,6 +44,8 @@ non_augmented_assignment.py:17:1: PLR6104 [*] Use `-=` to perform an augmented a 19 19 | some_set = some_set | {"to concat"} 20 20 | to_multiply = to_multiply * 5 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:18:1: PLR6104 [*] Use `+=` to perform an augmented assignment directly | 16 | some_string = some_string + "a very long end of string" @@ -53,7 +57,7 @@ non_augmented_assignment.py:18:1: PLR6104 [*] Use `+=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 15 15 | 16 16 | some_string = some_string + "a very long end of string" 17 17 | index = index - 1 @@ -63,6 +67,8 @@ non_augmented_assignment.py:18:1: PLR6104 [*] Use `+=` to perform an augmented a 20 20 | to_multiply = to_multiply * 5 21 21 | to_multiply = 5 * to_multiply + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:19:1: PLR6104 [*] Use `|=` to perform an augmented assignment directly | 17 | index = index - 1 @@ -74,7 +80,7 @@ non_augmented_assignment.py:19:1: PLR6104 [*] Use `|=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 16 16 | some_string = some_string + "a very long end of string" 17 17 | index = index - 1 18 18 | a_list = a_list + ["to concat"] @@ -84,6 +90,8 @@ non_augmented_assignment.py:19:1: PLR6104 [*] Use `|=` to perform an augmented a 21 21 | to_multiply = 5 * to_multiply 22 22 | to_multiply = to_multiply * to_multiply + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:20:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | 18 | a_list = a_list + ["to concat"] @@ -95,7 +103,7 @@ non_augmented_assignment.py:20:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 17 17 | index = index - 1 18 18 | a_list = a_list + ["to concat"] 19 19 | some_set = some_set | {"to concat"} @@ -105,6 +113,8 @@ non_augmented_assignment.py:20:1: PLR6104 [*] Use `*=` to perform an augmented a 22 22 | to_multiply = to_multiply * to_multiply 23 23 | to_divide = to_divide / 5 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:21:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | 19 | some_set = some_set | {"to concat"} @@ -116,7 +126,7 @@ non_augmented_assignment.py:21:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 18 18 | a_list = a_list + ["to concat"] 19 19 | some_set = some_set | {"to concat"} 20 20 | to_multiply = to_multiply * 5 @@ -126,6 +136,8 @@ non_augmented_assignment.py:21:1: PLR6104 [*] Use `*=` to perform an augmented a 23 23 | to_divide = to_divide / 5 24 24 | to_divide = to_divide // 5 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:22:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | 20 | to_multiply = to_multiply * 5 @@ -137,7 +149,7 @@ non_augmented_assignment.py:22:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 19 19 | some_set = some_set | {"to concat"} 20 20 | to_multiply = to_multiply * 5 21 21 | to_multiply = 5 * to_multiply @@ -147,6 +159,8 @@ non_augmented_assignment.py:22:1: PLR6104 [*] Use `*=` to perform an augmented a 24 24 | to_divide = to_divide // 5 25 25 | to_cube = to_cube**3 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:23:1: PLR6104 [*] Use `/=` to perform an augmented assignment directly | 21 | to_multiply = 5 * to_multiply @@ -158,7 +172,7 @@ non_augmented_assignment.py:23:1: PLR6104 [*] Use `/=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 20 20 | to_multiply = to_multiply * 5 21 21 | to_multiply = 5 * to_multiply 22 22 | to_multiply = to_multiply * to_multiply @@ -168,6 +182,8 @@ non_augmented_assignment.py:23:1: PLR6104 [*] Use `/=` to perform an augmented a 25 25 | to_cube = to_cube**3 26 26 | to_cube = 3**to_cube + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:24:1: PLR6104 [*] Use `//=` to perform an augmented assignment directly | 22 | to_multiply = to_multiply * to_multiply @@ -179,7 +195,7 @@ non_augmented_assignment.py:24:1: PLR6104 [*] Use `//=` to perform an augmented | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 21 21 | to_multiply = 5 * to_multiply 22 22 | to_multiply = to_multiply * to_multiply 23 23 | to_divide = to_divide / 5 @@ -189,6 +205,8 @@ non_augmented_assignment.py:24:1: PLR6104 [*] Use `//=` to perform an augmented 26 26 | to_cube = 3**to_cube 27 27 | to_cube = to_cube**to_cube + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:25:1: PLR6104 [*] Use `**=` to perform an augmented assignment directly | 23 | to_divide = to_divide / 5 @@ -200,7 +218,7 @@ non_augmented_assignment.py:25:1: PLR6104 [*] Use `**=` to perform an augmented | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 22 22 | to_multiply = to_multiply * to_multiply 23 23 | to_divide = to_divide / 5 24 24 | to_divide = to_divide // 5 @@ -210,6 +228,8 @@ non_augmented_assignment.py:25:1: PLR6104 [*] Use `**=` to perform an augmented 27 27 | to_cube = to_cube**to_cube 28 28 | timeDiffSeconds = timeDiffSeconds % 60 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:27:1: PLR6104 [*] Use `**=` to perform an augmented assignment directly | 25 | to_cube = to_cube**3 @@ -221,7 +241,7 @@ non_augmented_assignment.py:27:1: PLR6104 [*] Use `**=` to perform an augmented | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 24 24 | to_divide = to_divide // 5 25 25 | to_cube = to_cube**3 26 26 | to_cube = 3**to_cube @@ -231,6 +251,8 @@ non_augmented_assignment.py:27:1: PLR6104 [*] Use `**=` to perform an augmented 29 29 | flags = flags & 0x1 30 30 | flags = flags | 0x1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:28:1: PLR6104 [*] Use `%=` to perform an augmented assignment directly | 26 | to_cube = 3**to_cube @@ -242,7 +264,7 @@ non_augmented_assignment.py:28:1: PLR6104 [*] Use `%=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 25 25 | to_cube = to_cube**3 26 26 | to_cube = 3**to_cube 27 27 | to_cube = to_cube**to_cube @@ -252,6 +274,8 @@ non_augmented_assignment.py:28:1: PLR6104 [*] Use `%=` to perform an augmented a 30 30 | flags = flags | 0x1 31 31 | flags = flags ^ 0x1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:29:1: PLR6104 [*] Use `&=` to perform an augmented assignment directly | 27 | to_cube = to_cube**to_cube @@ -263,7 +287,7 @@ non_augmented_assignment.py:29:1: PLR6104 [*] Use `&=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 26 26 | to_cube = 3**to_cube 27 27 | to_cube = to_cube**to_cube 28 28 | timeDiffSeconds = timeDiffSeconds % 60 @@ -273,6 +297,8 @@ non_augmented_assignment.py:29:1: PLR6104 [*] Use `&=` to perform an augmented a 31 31 | flags = flags ^ 0x1 32 32 | flags = flags << 1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:30:1: PLR6104 [*] Use `|=` to perform an augmented assignment directly | 28 | timeDiffSeconds = timeDiffSeconds % 60 @@ -284,7 +310,7 @@ non_augmented_assignment.py:30:1: PLR6104 [*] Use `|=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 27 27 | to_cube = to_cube**to_cube 28 28 | timeDiffSeconds = timeDiffSeconds % 60 29 29 | flags = flags & 0x1 @@ -294,6 +320,8 @@ non_augmented_assignment.py:30:1: PLR6104 [*] Use `|=` to perform an augmented a 32 32 | flags = flags << 1 33 33 | flags = flags >> 1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:31:1: PLR6104 [*] Use `^=` to perform an augmented assignment directly | 29 | flags = flags & 0x1 @@ -305,7 +333,7 @@ non_augmented_assignment.py:31:1: PLR6104 [*] Use `^=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 28 28 | timeDiffSeconds = timeDiffSeconds % 60 29 29 | flags = flags & 0x1 30 30 | flags = flags | 0x1 @@ -315,6 +343,8 @@ non_augmented_assignment.py:31:1: PLR6104 [*] Use `^=` to perform an augmented a 33 33 | flags = flags >> 1 34 34 | mat1 = mat1 @ mat2 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:32:1: PLR6104 [*] Use `<<=` to perform an augmented assignment directly | 30 | flags = flags | 0x1 @@ -326,7 +356,7 @@ non_augmented_assignment.py:32:1: PLR6104 [*] Use `<<=` to perform an augmented | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 29 29 | flags = flags & 0x1 30 30 | flags = flags | 0x1 31 31 | flags = flags ^ 0x1 @@ -336,6 +366,8 @@ non_augmented_assignment.py:32:1: PLR6104 [*] Use `<<=` to perform an augmented 34 34 | mat1 = mat1 @ mat2 35 35 | a_list[1] = a_list[1] + 1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:33:1: PLR6104 [*] Use `>>=` to perform an augmented assignment directly | 31 | flags = flags ^ 0x1 @@ -347,7 +379,7 @@ non_augmented_assignment.py:33:1: PLR6104 [*] Use `>>=` to perform an augmented | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 30 30 | flags = flags | 0x1 31 31 | flags = flags ^ 0x1 32 32 | flags = flags << 1 @@ -357,6 +389,8 @@ non_augmented_assignment.py:33:1: PLR6104 [*] Use `>>=` to perform an augmented 35 35 | a_list[1] = a_list[1] + 1 36 36 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:34:1: PLR6104 [*] Use `@=` to perform an augmented assignment directly | 32 | flags = flags << 1 @@ -367,7 +401,7 @@ non_augmented_assignment.py:34:1: PLR6104 [*] Use `@=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 31 31 | flags = flags ^ 0x1 32 32 | flags = flags << 1 33 33 | flags = flags >> 1 @@ -377,6 +411,8 @@ non_augmented_assignment.py:34:1: PLR6104 [*] Use `@=` to perform an augmented a 36 36 | 37 37 | a_list[0:2] = a_list[0:2] * 3 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:35:1: PLR6104 [*] Use `+=` to perform an augmented assignment directly | 33 | flags = flags >> 1 @@ -388,7 +424,7 @@ non_augmented_assignment.py:35:1: PLR6104 [*] Use `+=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 32 32 | flags = flags << 1 33 33 | flags = flags >> 1 34 34 | mat1 = mat1 @ mat2 @@ -398,6 +434,8 @@ non_augmented_assignment.py:35:1: PLR6104 [*] Use `+=` to perform an augmented a 37 37 | a_list[0:2] = a_list[0:2] * 3 38 38 | a_list[:2] = a_list[:2] * 3 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:37:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | 35 | a_list[1] = a_list[1] + 1 @@ -409,7 +447,7 @@ non_augmented_assignment.py:37:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 34 34 | mat1 = mat1 @ mat2 35 35 | a_list[1] = a_list[1] + 1 36 36 | @@ -419,6 +457,8 @@ non_augmented_assignment.py:37:1: PLR6104 [*] Use `*=` to perform an augmented a 39 39 | a_list[1:] = a_list[1:] * 3 40 40 | a_list[:] = a_list[:] * 3 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:38:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | 37 | a_list[0:2] = a_list[0:2] * 3 @@ -429,7 +469,7 @@ non_augmented_assignment.py:38:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 35 35 | a_list[1] = a_list[1] + 1 36 36 | 37 37 | a_list[0:2] = a_list[0:2] * 3 @@ -439,6 +479,8 @@ non_augmented_assignment.py:38:1: PLR6104 [*] Use `*=` to perform an augmented a 40 40 | a_list[:] = a_list[:] * 3 41 41 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:39:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | 37 | a_list[0:2] = a_list[0:2] * 3 @@ -449,7 +491,7 @@ non_augmented_assignment.py:39:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 36 36 | 37 37 | a_list[0:2] = a_list[0:2] * 3 38 38 | a_list[:2] = a_list[:2] * 3 @@ -459,6 +501,8 @@ non_augmented_assignment.py:39:1: PLR6104 [*] Use `*=` to perform an augmented a 41 41 | 42 42 | index = index * (index + 10) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:40:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | 38 | a_list[:2] = a_list[:2] * 3 @@ -470,7 +514,7 @@ non_augmented_assignment.py:40:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 37 37 | a_list[0:2] = a_list[0:2] * 3 38 38 | a_list[:2] = a_list[:2] * 3 39 39 | a_list[1:] = a_list[1:] * 3 @@ -480,6 +524,8 @@ non_augmented_assignment.py:40:1: PLR6104 [*] Use `*=` to perform an augmented a 42 42 | index = index * (index + 10) 43 43 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:42:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | 40 | a_list[:] = a_list[:] * 3 @@ -489,7 +535,7 @@ non_augmented_assignment.py:42:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 39 39 | a_list[1:] = a_list[1:] * 3 40 40 | a_list[:] = a_list[:] * 3 41 41 | @@ -499,6 +545,8 @@ non_augmented_assignment.py:42:1: PLR6104 [*] Use `*=` to perform an augmented a 44 44 | 45 45 | class T: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:47:9: PLR6104 [*] Use `+=` to perform an augmented assignment directly | 45 | class T: @@ -508,7 +556,7 @@ non_augmented_assignment.py:47:9: PLR6104 [*] Use `+=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 44 44 | 45 45 | class T: 46 46 | def t(self): @@ -518,6 +566,8 @@ non_augmented_assignment.py:47:9: PLR6104 [*] Use `+=` to perform an augmented a 49 49 | 50 50 | obj = T() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + non_augmented_assignment.py:51:1: PLR6104 [*] Use `+=` to perform an augmented assignment directly | 50 | obj = T() @@ -528,7 +578,7 @@ non_augmented_assignment.py:51:1: PLR6104 [*] Use `+=` to perform an augmented a | = help: Replace with augmented assignment -ℹ Unsafe fix +Suggested fix: 48 48 | 49 49 | 50 50 | obj = T() @@ -537,3 +587,5 @@ non_augmented_assignment.py:51:1: PLR6104 [*] Use `+=` to perform an augmented a 52 52 | 53 53 | # OK 54 54 | a_list[0] = a_list[:] * 3 + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6201_literal_membership.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6201_literal_membership.py.snap index 98cd73be366af..7db505fc27a9e 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6201_literal_membership.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6201_literal_membership.py.snap @@ -11,7 +11,7 @@ literal_membership.py:2:6: PLR6201 [*] Use a set literal when testing for member | = help: Convert to `set` -ℹ Unsafe fix +Suggested fix: 1 1 | # Errors 2 |-1 in [1, 2, 3] 2 |+1 in {1, 2, 3} @@ -19,6 +19,8 @@ literal_membership.py:2:6: PLR6201 [*] Use a set literal when testing for member 4 4 | 1 in ( 5 5 | 1, 2, 3 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + literal_membership.py:3:6: PLR6201 [*] Use a set literal when testing for membership | 1 | # Errors @@ -30,7 +32,7 @@ literal_membership.py:3:6: PLR6201 [*] Use a set literal when testing for member | = help: Convert to `set` -ℹ Unsafe fix +Suggested fix: 1 1 | # Errors 2 2 | 1 in [1, 2, 3] 3 |-1 in (1, 2, 3) @@ -39,6 +41,8 @@ literal_membership.py:3:6: PLR6201 [*] Use a set literal when testing for member 5 5 | 1, 2, 3 6 6 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + literal_membership.py:4:6: PLR6201 [*] Use a set literal when testing for membership | 2 | 1 in [1, 2, 3] @@ -53,7 +57,7 @@ literal_membership.py:4:6: PLR6201 [*] Use a set literal when testing for member | = help: Convert to `set` -ℹ Unsafe fix +Suggested fix: 1 1 | # Errors 2 2 | 1 in [1, 2, 3] 3 3 | 1 in (1, 2, 3) @@ -66,6 +70,8 @@ literal_membership.py:4:6: PLR6201 [*] Use a set literal when testing for member 8 8 | "cherry" in fruits 9 9 | _ = {key: value for key, value in {"a": 1, "b": 2}.items() if key in ("a", "b")} + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + literal_membership.py:9:70: PLR6201 [*] Use a set literal when testing for membership | 7 | fruits = ["cherry", "grapes"] @@ -77,7 +83,7 @@ literal_membership.py:9:70: PLR6201 [*] Use a set literal when testing for membe | = help: Convert to `set` -ℹ Unsafe fix +Suggested fix: 6 6 | ) 7 7 | fruits = ["cherry", "grapes"] 8 8 | "cherry" in fruits @@ -86,3 +92,5 @@ literal_membership.py:9:70: PLR6201 [*] Use a set literal when testing for membe 10 10 | 11 11 | # OK 12 12 | fruits in [[1, 2, 3], [4, 5, 6]] + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap index 74af7a647f7b6..d4e5184f9ca05 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap @@ -9,13 +9,15 @@ unnecessary_lambda.py:1:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -ℹ Unsafe fix +Suggested fix: 1 |-_ = lambda: print() # [unnecessary-lambda] 1 |+_ = print # [unnecessary-lambda] 2 2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda] 3 3 | 4 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_lambda.py:2:5: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function | 1 | _ = lambda: print() # [unnecessary-lambda] @@ -26,7 +28,7 @@ unnecessary_lambda.py:2:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -ℹ Unsafe fix +Suggested fix: 1 1 | _ = lambda: print() # [unnecessary-lambda] 2 |-_ = lambda x, y: min(x, y) # [unnecessary-lambda] 2 |+_ = min # [unnecessary-lambda] @@ -34,6 +36,8 @@ unnecessary_lambda.py:2:5: PLW0108 [*] Lambda may be unnecessary; consider inlin 4 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] 5 5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_lambda.py:4:5: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function | 2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda] @@ -45,7 +49,7 @@ unnecessary_lambda.py:4:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -ℹ Unsafe fix +Suggested fix: 1 1 | _ = lambda: print() # [unnecessary-lambda] 2 2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda] 3 3 | @@ -55,6 +59,8 @@ unnecessary_lambda.py:4:5: PLW0108 [*] Lambda may be unnecessary; consider inlin 6 6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda] 7 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_lambda.py:5:5: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function | 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] @@ -65,7 +71,7 @@ unnecessary_lambda.py:5:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -ℹ Unsafe fix +Suggested fix: 2 2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda] 3 3 | 4 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] @@ -75,6 +81,8 @@ unnecessary_lambda.py:5:5: PLW0108 [*] Lambda may be unnecessary; consider inlin 7 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] 8 8 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_lambda.py:6:5: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function | 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] @@ -85,7 +93,7 @@ unnecessary_lambda.py:6:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] 5 5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda] @@ -95,6 +103,8 @@ unnecessary_lambda.py:6:5: PLW0108 [*] Lambda may be unnecessary; consider inlin 8 8 | 9 9 | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_lambda.py:7:5: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function | 5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda] @@ -106,7 +116,7 @@ unnecessary_lambda.py:7:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -ℹ Unsafe fix +Suggested fix: 4 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] 5 5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda] 6 6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda] @@ -116,6 +126,8 @@ unnecessary_lambda.py:7:5: PLW0108 [*] Lambda may be unnecessary; consider inlin 9 9 | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda] 10 10 | _ = lambda x, y: f(lambda x, y: x + y)(x, y) # [unnecessary-lambda] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_lambda.py:9:5: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function | 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] @@ -126,7 +138,7 @@ unnecessary_lambda.py:9:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -ℹ Unsafe fix +Suggested fix: 6 6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda] 7 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] 8 8 | @@ -136,6 +148,8 @@ unnecessary_lambda.py:9:5: PLW0108 [*] Lambda may be unnecessary; consider inlin 11 11 | 12 12 | # default value in lambda parameters + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unnecessary_lambda.py:10:5: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function | 9 | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda] @@ -146,7 +160,7 @@ unnecessary_lambda.py:10:5: PLW0108 [*] Lambda may be unnecessary; consider inli | = help: Inline function call -ℹ Unsafe fix +Suggested fix: 7 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] 8 8 | 9 9 | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda] @@ -155,3 +169,5 @@ unnecessary_lambda.py:10:5: PLW0108 [*] Lambda may be unnecessary; consider inli 11 11 | 12 12 | # default value in lambda parameters 13 13 | _ = lambda x=42: print(x) + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap index ea72439be9eb0..77e90922c540f 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap @@ -12,7 +12,7 @@ useless_else_on_loop.py:9:5: PLW0120 [*] `else` clause on loop without a `break` | = help: Remove `else` -ℹ Safe fix +Suggested fix: 6 6 | for i in range(10): 7 7 | if i % 2: 8 8 | return i @@ -23,6 +23,8 @@ useless_else_on_loop.py:9:5: PLW0120 [*] `else` clause on loop without a `break` 12 11 | 13 12 | + Run `ruff check --fix` to apply this fix. + useless_else_on_loop.py:18:5: PLW0120 [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | 16 | while True: @@ -34,7 +36,7 @@ useless_else_on_loop.py:18:5: PLW0120 [*] `else` clause on loop without a `break | = help: Remove `else` -ℹ Safe fix +Suggested fix: 15 15 | """else + return is not acceptable.""" 16 16 | while True: 17 17 | return 1 @@ -45,6 +47,8 @@ useless_else_on_loop.py:18:5: PLW0120 [*] `else` clause on loop without a `break 21 20 | 22 21 | + Run `ruff check --fix` to apply this fix. + useless_else_on_loop.py:30:1: PLW0120 [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | 28 | break @@ -55,7 +59,7 @@ useless_else_on_loop.py:30:1: PLW0120 [*] `else` clause on loop without a `break | = help: Remove `else` -ℹ Safe fix +Suggested fix: 27 27 | for _ in range(10): 28 28 | break 29 29 | @@ -66,6 +70,8 @@ useless_else_on_loop.py:30:1: PLW0120 [*] `else` clause on loop without a `break 33 32 | 34 33 | while True: + Run `ruff check --fix` to apply this fix. + useless_else_on_loop.py:37:1: PLW0120 [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | 35 | while False: @@ -76,7 +82,7 @@ useless_else_on_loop.py:37:1: PLW0120 [*] `else` clause on loop without a `break | = help: Remove `else` -ℹ Safe fix +Suggested fix: 34 34 | while True: 35 35 | while False: 36 36 | break @@ -87,6 +93,8 @@ useless_else_on_loop.py:37:1: PLW0120 [*] `else` clause on loop without a `break 40 39 | for j in range(10): 41 40 | pass + Run `ruff check --fix` to apply this fix. + useless_else_on_loop.py:42:1: PLW0120 [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | 40 | for j in range(10): @@ -98,7 +106,7 @@ useless_else_on_loop.py:42:1: PLW0120 [*] `else` clause on loop without a `break | = help: Remove `else` -ℹ Safe fix +Suggested fix: 39 39 | 40 40 | for j in range(10): 41 41 | pass @@ -113,6 +121,8 @@ useless_else_on_loop.py:42:1: PLW0120 [*] `else` clause on loop without a `break 47 46 | 48 47 | def test_return_for2(): + Run `ruff check --fix` to apply this fix. + useless_else_on_loop.py:88:5: PLW0120 [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | 86 | else: @@ -124,7 +134,7 @@ useless_else_on_loop.py:88:5: PLW0120 [*] `else` clause on loop without a `break | = help: Remove `else` -ℹ Safe fix +Suggested fix: 85 85 | break 86 86 | else: 87 87 | print("all right") @@ -135,6 +145,8 @@ useless_else_on_loop.py:88:5: PLW0120 [*] `else` clause on loop without a `break 91 90 | 92 91 | + Run `ruff check --fix` to apply this fix. + useless_else_on_loop.py:98:9: PLW0120 [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | 96 | for _ in range(3): @@ -146,7 +158,7 @@ useless_else_on_loop.py:98:9: PLW0120 [*] `else` clause on loop without a `break | = help: Remove `else` -ℹ Safe fix +Suggested fix: 95 95 | for _ in range(10): 96 96 | for _ in range(3): 97 97 | pass @@ -159,6 +171,8 @@ useless_else_on_loop.py:98:9: PLW0120 [*] `else` clause on loop without a `break 102 101 | return True 103 102 | return False + Run `ruff check --fix` to apply this fix. + useless_else_on_loop.py:144:5: PLW0120 [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | 142 | for j in range(10): @@ -170,7 +184,7 @@ useless_else_on_loop.py:144:5: PLW0120 [*] `else` clause on loop without a `brea | = help: Remove `else` -ℹ Safe fix +Suggested fix: 141 141 | """Retain the comment within the `else` block""" 142 142 | for j in range(10): 143 143 | pass @@ -184,4 +198,4 @@ useless_else_on_loop.py:144:5: PLW0120 [*] `else` clause on loop without a `brea 146 |+ for j in range(10): 147 |+ break - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap index 4b5ed1085d6e0..08399d7b2b302 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap @@ -10,7 +10,7 @@ useless_exception_statement.py:7:5: PLW0133 [*] Missing `raise` statement on exc | = help: Add `raise` keyword -ℹ Unsafe fix +Suggested fix: 4 4 | 5 5 | # Test case 1: Useless exception statement 6 6 | def func(): @@ -20,6 +20,8 @@ useless_exception_statement.py:7:5: PLW0133 [*] Missing `raise` statement on exc 9 9 | 10 10 | # Test case 2: Useless exception statement in try-except block + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + useless_exception_statement.py:13:9: PLW0133 [*] Missing `raise` statement on exception | 11 | def func(): @@ -31,7 +33,7 @@ useless_exception_statement.py:13:9: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -ℹ Unsafe fix +Suggested fix: 10 10 | # Test case 2: Useless exception statement in try-except block 11 11 | def func(): 12 12 | try: @@ -41,6 +43,8 @@ useless_exception_statement.py:13:9: PLW0133 [*] Missing `raise` statement on ex 15 15 | pass 16 16 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + useless_exception_statement.py:21:9: PLW0133 [*] Missing `raise` statement on exception | 19 | def func(): @@ -50,7 +54,7 @@ useless_exception_statement.py:21:9: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -ℹ Unsafe fix +Suggested fix: 18 18 | # Test case 3: Useless exception statement in if statement 19 19 | def func(): 20 20 | if True: @@ -60,6 +64,8 @@ useless_exception_statement.py:21:9: PLW0133 [*] Missing `raise` statement on ex 23 23 | 24 24 | # Test case 4: Useless exception statement in class + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + useless_exception_statement.py:28:13: PLW0133 [*] Missing `raise` statement on exception | 26 | class Class: @@ -69,7 +75,7 @@ useless_exception_statement.py:28:13: PLW0133 [*] Missing `raise` statement on e | = help: Add `raise` keyword -ℹ Unsafe fix +Suggested fix: 25 25 | def func(): 26 26 | class Class: 27 27 | def __init__(self): @@ -79,6 +85,8 @@ useless_exception_statement.py:28:13: PLW0133 [*] Missing `raise` statement on e 30 30 | 31 31 | # Test case 5: Useless exception statement in function + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + useless_exception_statement.py:34:9: PLW0133 [*] Missing `raise` statement on exception | 32 | def func(): @@ -90,7 +98,7 @@ useless_exception_statement.py:34:9: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -ℹ Unsafe fix +Suggested fix: 31 31 | # Test case 5: Useless exception statement in function 32 32 | def func(): 33 33 | def inner(): @@ -100,6 +108,8 @@ useless_exception_statement.py:34:9: PLW0133 [*] Missing `raise` statement on ex 36 36 | inner() 37 37 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + useless_exception_statement.py:42:9: PLW0133 [*] Missing `raise` statement on exception | 40 | def func(): @@ -109,7 +119,7 @@ useless_exception_statement.py:42:9: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -ℹ Unsafe fix +Suggested fix: 39 39 | # Test case 6: Useless exception statement in while loop 40 40 | def func(): 41 41 | while True: @@ -119,6 +129,8 @@ useless_exception_statement.py:42:9: PLW0133 [*] Missing `raise` statement on ex 44 44 | 45 45 | # Test case 7: Useless exception statement in abstract class + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + useless_exception_statement.py:50:13: PLW0133 [*] Missing `raise` statement on exception | 48 | @abstractmethod @@ -128,7 +140,7 @@ useless_exception_statement.py:50:13: PLW0133 [*] Missing `raise` statement on e | = help: Add `raise` keyword -ℹ Unsafe fix +Suggested fix: 47 47 | class Class(ABC): 48 48 | @abstractmethod 49 49 | def method(self): @@ -138,6 +150,8 @@ useless_exception_statement.py:50:13: PLW0133 [*] Missing `raise` statement on e 52 52 | 53 53 | # Test case 8: Useless exception statement inside context manager + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + useless_exception_statement.py:56:9: PLW0133 [*] Missing `raise` statement on exception | 54 | def func(): @@ -147,7 +161,7 @@ useless_exception_statement.py:56:9: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -ℹ Unsafe fix +Suggested fix: 53 53 | # Test case 8: Useless exception statement inside context manager 54 54 | def func(): 55 55 | with suppress(AttributeError): @@ -157,6 +171,8 @@ useless_exception_statement.py:56:9: PLW0133 [*] Missing `raise` statement on ex 58 58 | 59 59 | # Test case 9: Useless exception statement in parentheses + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + useless_exception_statement.py:61:5: PLW0133 [*] Missing `raise` statement on exception | 59 | # Test case 9: Useless exception statement in parentheses @@ -166,7 +182,7 @@ useless_exception_statement.py:61:5: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -ℹ Unsafe fix +Suggested fix: 58 58 | 59 59 | # Test case 9: Useless exception statement in parentheses 60 60 | def func(): @@ -176,6 +192,8 @@ useless_exception_statement.py:61:5: PLW0133 [*] Missing `raise` statement on ex 63 63 | 64 64 | # Test case 10: Useless exception statement in continuation + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + useless_exception_statement.py:66:12: PLW0133 [*] Missing `raise` statement on exception | 64 | # Test case 10: Useless exception statement in continuation @@ -185,7 +203,7 @@ useless_exception_statement.py:66:12: PLW0133 [*] Missing `raise` statement on e | = help: Add `raise` keyword -ℹ Unsafe fix +Suggested fix: 63 63 | 64 64 | # Test case 10: Useless exception statement in continuation 65 65 | def func(): @@ -195,6 +213,8 @@ useless_exception_statement.py:66:12: PLW0133 [*] Missing `raise` statement on e 68 68 | 69 69 | # Test case 11: Useless warning statement + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + useless_exception_statement.py:71:5: PLW0133 [*] Missing `raise` statement on exception | 69 | # Test case 11: Useless warning statement @@ -204,7 +224,7 @@ useless_exception_statement.py:71:5: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -ℹ Unsafe fix +Suggested fix: 68 68 | 69 69 | # Test case 11: Useless warning statement 70 70 | def func(): @@ -213,3 +233,5 @@ useless_exception_statement.py:71:5: PLW0133 [*] Missing `raise` statement on ex 72 72 | 73 73 | 74 74 | # Non-violation test cases: PLW0133 + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0245_super_without_brackets.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0245_super_without_brackets.py.snap index d2abe86131b9d..4c3c308f590b0 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0245_super_without_brackets.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0245_super_without_brackets.py.snap @@ -11,7 +11,7 @@ super_without_brackets.py:10:26: PLW0245 [*] `super` call is missing parentheses | = help: Add parentheses to `super` call -ℹ Safe fix +Suggested fix: 7 7 | class BadDog(Animal): 8 8 | @staticmethod 9 9 | def speak(): @@ -21,4 +21,4 @@ super_without_brackets.py:10:26: PLW0245 [*] `super` call is missing parentheses 12 12 | 13 13 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap index 7419c16569584..db9f3f126c3a3 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap @@ -11,7 +11,7 @@ subprocess_run_without_check.py:4:1: PLW1510 [*] `subprocess.run` without explic | = help: Add explicit `check=False` -ℹ Safe fix +Suggested fix: 1 1 | import subprocess 2 2 | 3 3 | # Errors. @@ -21,6 +21,8 @@ subprocess_run_without_check.py:4:1: PLW1510 [*] `subprocess.run` without explic 6 6 | subprocess.run( 7 7 | ["ls"], + Run `ruff check --fix` to apply this fix. + subprocess_run_without_check.py:5:1: PLW1510 [*] `subprocess.run` without explicit `check` argument | 3 | # Errors. @@ -32,7 +34,7 @@ subprocess_run_without_check.py:5:1: PLW1510 [*] `subprocess.run` without explic | = help: Add explicit `check=False` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | # Errors. 4 4 | subprocess.run("ls") @@ -42,6 +44,8 @@ subprocess_run_without_check.py:5:1: PLW1510 [*] `subprocess.run` without explic 7 7 | ["ls"], 8 8 | shell=False, + Run `ruff check --fix` to apply this fix. + subprocess_run_without_check.py:6:1: PLW1510 [*] `subprocess.run` without explicit `check` argument | 4 | subprocess.run("ls") @@ -53,7 +57,7 @@ subprocess_run_without_check.py:6:1: PLW1510 [*] `subprocess.run` without explic | = help: Add explicit `check=False` -ℹ Safe fix +Suggested fix: 5 5 | subprocess.run("ls", shell=True) 6 6 | subprocess.run( 7 7 | ["ls"], @@ -63,6 +67,8 @@ subprocess_run_without_check.py:6:1: PLW1510 [*] `subprocess.run` without explic 10 10 | subprocess.run(["ls"], **kwargs) 11 11 | + Run `ruff check --fix` to apply this fix. + subprocess_run_without_check.py:10:1: PLW1510 [*] `subprocess.run` without explicit `check` argument | 8 | shell=False, @@ -74,7 +80,7 @@ subprocess_run_without_check.py:10:1: PLW1510 [*] `subprocess.run` without expli | = help: Add explicit `check=False` -ℹ Unsafe fix +Suggested fix: 7 7 | ["ls"], 8 8 | shell=False, 9 9 | ) @@ -84,4 +90,4 @@ subprocess_run_without_check.py:10:1: PLW1510 [*] `subprocess.run` without expli 12 12 | # Non-errors. 13 13 | subprocess.run("ls", check=True) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap index 9b6ebb6c85814..eba3ae1705741 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap @@ -11,7 +11,7 @@ unspecified_encoding.py:8:1: PLW1514 [*] `open` in text mode without explicit `e | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 5 5 | import codecs 6 6 | 7 7 | # Errors. @@ -21,6 +21,8 @@ unspecified_encoding.py:8:1: PLW1514 [*] `open` in text mode without explicit `e 10 10 | hugo.TextIOWrapper(hugo.FileIO("test.txt")) 11 11 | tempfile.NamedTemporaryFile("w") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:9:1: PLW1514 [*] `io.TextIOWrapper` without explicit `encoding` argument | 7 | # Errors. @@ -32,7 +34,7 @@ unspecified_encoding.py:9:1: PLW1514 [*] `io.TextIOWrapper` without explicit `en | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 6 6 | 7 7 | # Errors. 8 8 | open("test.txt") @@ -42,6 +44,8 @@ unspecified_encoding.py:9:1: PLW1514 [*] `io.TextIOWrapper` without explicit `en 11 11 | tempfile.NamedTemporaryFile("w") 12 12 | tempfile.TemporaryFile("w") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:10:1: PLW1514 [*] `io.TextIOWrapper` without explicit `encoding` argument | 8 | open("test.txt") @@ -53,7 +57,7 @@ unspecified_encoding.py:10:1: PLW1514 [*] `io.TextIOWrapper` without explicit `e | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 7 7 | # Errors. 8 8 | open("test.txt") 9 9 | io.TextIOWrapper(io.FileIO("test.txt")) @@ -63,6 +67,8 @@ unspecified_encoding.py:10:1: PLW1514 [*] `io.TextIOWrapper` without explicit `e 12 12 | tempfile.TemporaryFile("w") 13 13 | codecs.open("test.txt") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:11:1: PLW1514 [*] `tempfile.NamedTemporaryFile` in text mode without explicit `encoding` argument | 9 | io.TextIOWrapper(io.FileIO("test.txt")) @@ -74,7 +80,7 @@ unspecified_encoding.py:11:1: PLW1514 [*] `tempfile.NamedTemporaryFile` in text | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 8 8 | open("test.txt") 9 9 | io.TextIOWrapper(io.FileIO("test.txt")) 10 10 | hugo.TextIOWrapper(hugo.FileIO("test.txt")) @@ -84,6 +90,8 @@ unspecified_encoding.py:11:1: PLW1514 [*] `tempfile.NamedTemporaryFile` in text 13 13 | codecs.open("test.txt") 14 14 | tempfile.SpooledTemporaryFile(0, "w") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:12:1: PLW1514 [*] `tempfile.TemporaryFile` in text mode without explicit `encoding` argument | 10 | hugo.TextIOWrapper(hugo.FileIO("test.txt")) @@ -95,7 +103,7 @@ unspecified_encoding.py:12:1: PLW1514 [*] `tempfile.TemporaryFile` in text mode | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 9 9 | io.TextIOWrapper(io.FileIO("test.txt")) 10 10 | hugo.TextIOWrapper(hugo.FileIO("test.txt")) 11 11 | tempfile.NamedTemporaryFile("w") @@ -105,6 +113,8 @@ unspecified_encoding.py:12:1: PLW1514 [*] `tempfile.TemporaryFile` in text mode 14 14 | tempfile.SpooledTemporaryFile(0, "w") 15 15 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:13:1: PLW1514 [*] `codecs.open` in text mode without explicit `encoding` argument | 11 | tempfile.NamedTemporaryFile("w") @@ -115,7 +125,7 @@ unspecified_encoding.py:13:1: PLW1514 [*] `codecs.open` in text mode without exp | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 10 10 | hugo.TextIOWrapper(hugo.FileIO("test.txt")) 11 11 | tempfile.NamedTemporaryFile("w") 12 12 | tempfile.TemporaryFile("w") @@ -125,6 +135,8 @@ unspecified_encoding.py:13:1: PLW1514 [*] `codecs.open` in text mode without exp 15 15 | 16 16 | # Non-errors. + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:14:1: PLW1514 [*] `tempfile.SpooledTemporaryFile` in text mode without explicit `encoding` argument | 12 | tempfile.TemporaryFile("w") @@ -136,7 +148,7 @@ unspecified_encoding.py:14:1: PLW1514 [*] `tempfile.SpooledTemporaryFile` in tex | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 11 11 | tempfile.NamedTemporaryFile("w") 12 12 | tempfile.TemporaryFile("w") 13 13 | codecs.open("test.txt") @@ -146,6 +158,8 @@ unspecified_encoding.py:14:1: PLW1514 [*] `tempfile.SpooledTemporaryFile` in tex 16 16 | # Non-errors. 17 17 | open("test.txt", encoding="utf-8") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:46:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | 44 | tempfile.SpooledTemporaryFile(0, ) @@ -157,7 +171,7 @@ unspecified_encoding.py:46:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 43 43 | tempfile.SpooledTemporaryFile(0, "wb") 44 44 | tempfile.SpooledTemporaryFile(0, ) 45 45 | @@ -167,6 +181,8 @@ unspecified_encoding.py:46:1: PLW1514 [*] `open` in text mode without explicit ` 48 48 | open( 49 49 | "test.txt", # comment + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:47:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | 46 | open("test.txt",) @@ -177,7 +193,7 @@ unspecified_encoding.py:47:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 44 44 | tempfile.SpooledTemporaryFile(0, ) 45 45 | 46 46 | open("test.txt",) @@ -187,6 +203,8 @@ unspecified_encoding.py:47:1: PLW1514 [*] `open` in text mode without explicit ` 49 49 | "test.txt", # comment 50 50 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:48:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | 46 | open("test.txt",) @@ -198,7 +216,7 @@ unspecified_encoding.py:48:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 46 46 | open("test.txt",) 47 47 | open() 48 48 | open( @@ -208,6 +226,8 @@ unspecified_encoding.py:48:1: PLW1514 [*] `open` in text mode without explicit ` 51 51 | open( 52 52 | "test.txt", + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:51:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | 49 | "test.txt", # comment @@ -219,7 +239,7 @@ unspecified_encoding.py:51:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 49 49 | "test.txt", # comment 50 50 | ) 51 51 | open( @@ -229,6 +249,8 @@ unspecified_encoding.py:51:1: PLW1514 [*] `open` in text mode without explicit ` 54 54 | ) 55 55 | open(("test.txt"),) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:55:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | 53 | # comment @@ -240,7 +262,7 @@ unspecified_encoding.py:55:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 52 52 | "test.txt", 53 53 | # comment 54 54 | ) @@ -250,6 +272,8 @@ unspecified_encoding.py:55:1: PLW1514 [*] `open` in text mode without explicit ` 57 57 | ("test.txt"), # comment 58 58 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:56:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | 54 | ) @@ -261,7 +285,7 @@ unspecified_encoding.py:56:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 54 54 | ) 55 55 | open(("test.txt"),) 56 56 | open( @@ -271,6 +295,8 @@ unspecified_encoding.py:56:1: PLW1514 [*] `open` in text mode without explicit ` 59 59 | open( 60 60 | ("test.txt"), + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:59:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | 57 | ("test.txt"), # comment @@ -282,7 +308,7 @@ unspecified_encoding.py:59:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 57 57 | ("test.txt"), # comment 58 58 | ) 59 59 | open( @@ -292,6 +318,8 @@ unspecified_encoding.py:59:1: PLW1514 [*] `open` in text mode without explicit ` 62 62 | ) 63 63 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:64:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | 62 | ) @@ -303,7 +331,7 @@ unspecified_encoding.py:64:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 61 61 | # comment 62 62 | ) 63 63 | @@ -313,6 +341,8 @@ unspecified_encoding.py:64:1: PLW1514 [*] `open` in text mode without explicit ` 66 66 | (("test.txt")), # comment 67 67 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:65:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | 64 | open((("test.txt")),) @@ -323,7 +353,7 @@ unspecified_encoding.py:65:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 63 63 | 64 64 | open((("test.txt")),) 65 65 | open( @@ -333,6 +363,8 @@ unspecified_encoding.py:65:1: PLW1514 [*] `open` in text mode without explicit ` 68 68 | open( 69 69 | (("test.txt")), + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:68:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | 66 | (("test.txt")), # comment @@ -344,7 +376,7 @@ unspecified_encoding.py:68:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 66 66 | (("test.txt")), # comment 67 67 | ) 68 68 | open( @@ -354,6 +386,8 @@ unspecified_encoding.py:68:1: PLW1514 [*] `open` in text mode without explicit ` 71 71 | ) 72 72 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:77:1: PLW1514 [*] `pathlib.Path(...).open` in text mode without explicit `encoding` argument | 76 | # Errors. @@ -364,7 +398,7 @@ unspecified_encoding.py:77:1: PLW1514 [*] `pathlib.Path(...).open` in text mode | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 74 74 | from pathlib import Path 75 75 | 76 76 | # Errors. @@ -374,6 +408,8 @@ unspecified_encoding.py:77:1: PLW1514 [*] `pathlib.Path(...).open` in text mode 79 79 | text = Path("foo.txt").read_text() 80 80 | Path("foo.txt").write_text(text) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:78:1: PLW1514 [*] `pathlib.Path(...).open` in text mode without explicit `encoding` argument | 76 | # Errors. @@ -385,7 +421,7 @@ unspecified_encoding.py:78:1: PLW1514 [*] `pathlib.Path(...).open` in text mode | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 75 75 | 76 76 | # Errors. 77 77 | Path("foo.txt").open() @@ -395,6 +431,8 @@ unspecified_encoding.py:78:1: PLW1514 [*] `pathlib.Path(...).open` in text mode 80 80 | Path("foo.txt").write_text(text) 81 81 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:79:8: PLW1514 [*] `pathlib.Path(...).read_text` without explicit `encoding` argument | 77 | Path("foo.txt").open() @@ -405,7 +443,7 @@ unspecified_encoding.py:79:8: PLW1514 [*] `pathlib.Path(...).read_text` without | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 76 76 | # Errors. 77 77 | Path("foo.txt").open() 78 78 | Path("foo.txt").open("w") @@ -415,6 +453,8 @@ unspecified_encoding.py:79:8: PLW1514 [*] `pathlib.Path(...).read_text` without 81 81 | 82 82 | # Non-errors. + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unspecified_encoding.py:80:1: PLW1514 [*] `pathlib.Path(...).write_text` without explicit `encoding` argument | 78 | Path("foo.txt").open("w") @@ -426,7 +466,7 @@ unspecified_encoding.py:80:1: PLW1514 [*] `pathlib.Path(...).write_text` without | = help: Add explicit `encoding` argument -ℹ Unsafe fix +Suggested fix: 77 77 | Path("foo.txt").open() 78 78 | Path("foo.txt").open("w") 79 79 | text = Path("foo.txt").read_text() @@ -435,3 +475,5 @@ unspecified_encoding.py:80:1: PLW1514 [*] `pathlib.Path(...).write_text` without 81 81 | 82 82 | # Non-errors. 83 83 | Path("foo.txt").open(encoding="utf-8") + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap index c30473aea7e73..3ec76d23410fa 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap @@ -11,7 +11,7 @@ nested_min_max.py:2:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -ℹ Unsafe fix +Suggested fix: 1 1 | min(1, 2, 3) 2 |-min(1, min(2, 3)) 2 |+min(1, 2, 3) @@ -19,6 +19,8 @@ nested_min_max.py:2:1: PLW3301 [*] Nested `min` calls can be flattened 4 4 | min(1, foo("a", "b"), min(3, 4)) 5 5 | min(1, max(2, 3)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + nested_min_max.py:3:1: PLW3301 [*] Nested `min` calls can be flattened | 1 | min(1, 2, 3) @@ -30,7 +32,7 @@ nested_min_max.py:3:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -ℹ Unsafe fix +Suggested fix: 1 1 | min(1, 2, 3) 2 2 | min(1, min(2, 3)) 3 |-min(1, min(2, min(3, 4))) @@ -39,6 +41,8 @@ nested_min_max.py:3:1: PLW3301 [*] Nested `min` calls can be flattened 5 5 | min(1, max(2, 3)) 6 6 | max(1, 2, 3) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + nested_min_max.py:3:8: PLW3301 [*] Nested `min` calls can be flattened | 1 | min(1, 2, 3) @@ -50,7 +54,7 @@ nested_min_max.py:3:8: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -ℹ Unsafe fix +Suggested fix: 1 1 | min(1, 2, 3) 2 2 | min(1, min(2, 3)) 3 |-min(1, min(2, min(3, 4))) @@ -59,6 +63,8 @@ nested_min_max.py:3:8: PLW3301 [*] Nested `min` calls can be flattened 5 5 | min(1, max(2, 3)) 6 6 | max(1, 2, 3) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + nested_min_max.py:4:1: PLW3301 [*] Nested `min` calls can be flattened | 2 | min(1, min(2, 3)) @@ -70,7 +76,7 @@ nested_min_max.py:4:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -ℹ Unsafe fix +Suggested fix: 1 1 | min(1, 2, 3) 2 2 | min(1, min(2, 3)) 3 3 | min(1, min(2, min(3, 4))) @@ -80,6 +86,8 @@ nested_min_max.py:4:1: PLW3301 [*] Nested `min` calls can be flattened 6 6 | max(1, 2, 3) 7 7 | max(1, max(2, 3)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + nested_min_max.py:7:1: PLW3301 [*] Nested `max` calls can be flattened | 5 | min(1, max(2, 3)) @@ -91,7 +99,7 @@ nested_min_max.py:7:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -ℹ Unsafe fix +Suggested fix: 4 4 | min(1, foo("a", "b"), min(3, 4)) 5 5 | min(1, max(2, 3)) 6 6 | max(1, 2, 3) @@ -101,6 +109,8 @@ nested_min_max.py:7:1: PLW3301 [*] Nested `max` calls can be flattened 9 9 | max(1, foo("a", "b"), max(3, 4)) 10 10 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + nested_min_max.py:8:1: PLW3301 [*] Nested `max` calls can be flattened | 6 | max(1, 2, 3) @@ -111,7 +121,7 @@ nested_min_max.py:8:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -ℹ Unsafe fix +Suggested fix: 5 5 | min(1, max(2, 3)) 6 6 | max(1, 2, 3) 7 7 | max(1, max(2, 3)) @@ -121,6 +131,8 @@ nested_min_max.py:8:1: PLW3301 [*] Nested `max` calls can be flattened 10 10 | 11 11 | # These should not trigger; we do not flag cases with keyword args. + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + nested_min_max.py:8:8: PLW3301 [*] Nested `max` calls can be flattened | 6 | max(1, 2, 3) @@ -131,7 +143,7 @@ nested_min_max.py:8:8: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -ℹ Unsafe fix +Suggested fix: 5 5 | min(1, max(2, 3)) 6 6 | max(1, 2, 3) 7 7 | max(1, max(2, 3)) @@ -141,6 +153,8 @@ nested_min_max.py:8:8: PLW3301 [*] Nested `max` calls can be flattened 10 10 | 11 11 | # These should not trigger; we do not flag cases with keyword args. + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + nested_min_max.py:9:1: PLW3301 [*] Nested `max` calls can be flattened | 7 | max(1, max(2, 3)) @@ -152,7 +166,7 @@ nested_min_max.py:9:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -ℹ Unsafe fix +Suggested fix: 6 6 | max(1, 2, 3) 7 7 | max(1, max(2, 3)) 8 8 | max(1, max(2, max(3, 4))) @@ -162,6 +176,8 @@ nested_min_max.py:9:1: PLW3301 [*] Nested `max` calls can be flattened 11 11 | # These should not trigger; we do not flag cases with keyword args. 12 12 | min(1, min(2, 3), key=test) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + nested_min_max.py:15:1: PLW3301 [*] Nested `min` calls can be flattened | 13 | min(1, min(2, 3, key=test)) @@ -173,7 +189,7 @@ nested_min_max.py:15:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -ℹ Unsafe fix +Suggested fix: 12 12 | min(1, min(2, 3), key=test) 13 13 | min(1, min(2, 3, key=test)) 14 14 | # This will still trigger, to merge the calls without keyword args. @@ -183,6 +199,8 @@ nested_min_max.py:15:1: PLW3301 [*] Nested `min` calls can be flattened 17 17 | # Don't provide a fix if there are comments within the call. 18 18 | min( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + nested_min_max.py:18:1: PLW3301 Nested `min` calls can be flattened | 17 | # Don't provide a fix if there are comments within the call. @@ -206,7 +224,7 @@ nested_min_max.py:24:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -ℹ Unsafe fix +Suggested fix: 21 21 | ) 22 22 | 23 23 | # Handle iterable expressions. @@ -216,6 +234,8 @@ nested_min_max.py:24:1: PLW3301 [*] Nested `min` calls can be flattened 26 26 | max(1, max(a)) 27 27 | max(1, max(i for i in range(10))) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + nested_min_max.py:25:1: PLW3301 [*] Nested `min` calls can be flattened | 23 | # Handle iterable expressions. @@ -227,7 +247,7 @@ nested_min_max.py:25:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -ℹ Unsafe fix +Suggested fix: 22 22 | 23 23 | # Handle iterable expressions. 24 24 | min(1, min(a)) @@ -237,6 +257,8 @@ nested_min_max.py:25:1: PLW3301 [*] Nested `min` calls can be flattened 27 27 | max(1, max(i for i in range(10))) 28 28 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + nested_min_max.py:26:1: PLW3301 [*] Nested `max` calls can be flattened | 24 | min(1, min(a)) @@ -247,7 +269,7 @@ nested_min_max.py:26:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -ℹ Unsafe fix +Suggested fix: 23 23 | # Handle iterable expressions. 24 24 | min(1, min(a)) 25 25 | min(1, min(i for i in range(10))) @@ -257,6 +279,8 @@ nested_min_max.py:26:1: PLW3301 [*] Nested `max` calls can be flattened 28 28 | 29 29 | tuples_list = [ + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + nested_min_max.py:27:1: PLW3301 [*] Nested `max` calls can be flattened | 25 | min(1, min(i for i in range(10))) @@ -268,7 +292,7 @@ nested_min_max.py:27:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -ℹ Unsafe fix +Suggested fix: 24 24 | min(1, min(a)) 25 25 | min(1, min(i for i in range(10))) 26 26 | max(1, max(a)) @@ -278,6 +302,8 @@ nested_min_max.py:27:1: PLW3301 [*] Nested `max` calls can be flattened 29 29 | tuples_list = [ 30 30 | (1, 2), + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + nested_min_max.py:41:1: PLW3301 [*] Nested `max` calls can be flattened | 40 | # Starred argument should be copied as it is. @@ -288,7 +314,7 @@ nested_min_max.py:41:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -ℹ Unsafe fix +Suggested fix: 38 38 | max(max(tuples_list)) 39 39 | 40 40 | # Starred argument should be copied as it is. @@ -298,6 +324,8 @@ nested_min_max.py:41:1: PLW3301 [*] Nested `max` calls can be flattened 43 43 | import builtins 44 44 | builtins.min(1, min(2, 3)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + nested_min_max.py:44:1: PLW3301 [*] Nested `min` calls can be flattened | 43 | import builtins @@ -306,9 +334,11 @@ nested_min_max.py:44:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -ℹ Unsafe fix +Suggested fix: 41 41 | max(1, max(*a)) 42 42 | 43 43 | import builtins 44 |-builtins.min(1, min(2, 3)) 44 |+builtins.min(1, 2, 3) + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP001.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP001.py.snap index 1b1e0774ee5de..fbac30d5c8534 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP001.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP001.py.snap @@ -9,7 +9,7 @@ UP001.py:2:5: UP001 [*] `__metaclass__ = type` is implied | = help: Remove `__metaclass__ = type` -ℹ Safe fix +Suggested fix: 1 1 | class A: 2 |- __metaclass__ = type 2 |+ pass @@ -17,6 +17,8 @@ UP001.py:2:5: UP001 [*] `__metaclass__ = type` is implied 4 4 | 5 5 | class B: + Run `ruff check --fix` to apply this fix. + UP001.py:6:5: UP001 [*] `__metaclass__ = type` is implied | 5 | class B: @@ -27,7 +29,7 @@ UP001.py:6:5: UP001 [*] `__metaclass__ = type` is implied | = help: Remove `__metaclass__ = type` -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | 5 5 | class B: @@ -36,4 +38,4 @@ UP001.py:6:5: UP001 [*] `__metaclass__ = type` is implied 8 7 | def __init__(self) -> None: 9 8 | pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP003.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP003.py.snap index 4ea8ce149125c..046895dad3a6c 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP003.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP003.py.snap @@ -10,13 +10,15 @@ UP003.py:1:1: UP003 [*] Use `str` instead of `type(...)` | = help: Replace `type(...)` with `str` -ℹ Safe fix +Suggested fix: 1 |-type("") 1 |+str 2 2 | type(b"") 3 3 | type(0) 4 4 | type(0.0) + Run `ruff check --fix` to apply this fix. + UP003.py:2:1: UP003 [*] Use `bytes` instead of `type(...)` | 1 | type("") @@ -27,7 +29,7 @@ UP003.py:2:1: UP003 [*] Use `bytes` instead of `type(...)` | = help: Replace `type(...)` with `bytes` -ℹ Safe fix +Suggested fix: 1 1 | type("") 2 |-type(b"") 2 |+bytes @@ -35,6 +37,8 @@ UP003.py:2:1: UP003 [*] Use `bytes` instead of `type(...)` 4 4 | type(0.0) 5 5 | type(0j) + Run `ruff check --fix` to apply this fix. + UP003.py:3:1: UP003 [*] Use `int` instead of `type(...)` | 1 | type("") @@ -46,7 +50,7 @@ UP003.py:3:1: UP003 [*] Use `int` instead of `type(...)` | = help: Replace `type(...)` with `int` -ℹ Safe fix +Suggested fix: 1 1 | type("") 2 2 | type(b"") 3 |-type(0) @@ -55,6 +59,8 @@ UP003.py:3:1: UP003 [*] Use `int` instead of `type(...)` 5 5 | type(0j) 6 6 | + Run `ruff check --fix` to apply this fix. + UP003.py:4:1: UP003 [*] Use `float` instead of `type(...)` | 2 | type(b"") @@ -65,7 +71,7 @@ UP003.py:4:1: UP003 [*] Use `float` instead of `type(...)` | = help: Replace `type(...)` with `float` -ℹ Safe fix +Suggested fix: 1 1 | type("") 2 2 | type(b"") 3 3 | type(0) @@ -75,6 +81,8 @@ UP003.py:4:1: UP003 [*] Use `float` instead of `type(...)` 6 6 | 7 7 | # OK + Run `ruff check --fix` to apply this fix. + UP003.py:5:1: UP003 [*] Use `complex` instead of `type(...)` | 3 | type(0) @@ -86,7 +94,7 @@ UP003.py:5:1: UP003 [*] Use `complex` instead of `type(...)` | = help: Replace `type(...)` with `complex` -ℹ Safe fix +Suggested fix: 2 2 | type(b"") 3 3 | type(0) 4 4 | type(0.0) @@ -96,6 +104,8 @@ UP003.py:5:1: UP003 [*] Use `complex` instead of `type(...)` 7 7 | # OK 8 8 | type(arg)(" ") + Run `ruff check --fix` to apply this fix. + UP003.py:14:29: UP003 [*] Use `str` instead of `type(...)` | 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459841 @@ -104,11 +114,11 @@ UP003.py:14:29: UP003 [*] Use `str` instead of `type(...)` | = help: Replace `type(...)` with `str` -ℹ Safe fix +Suggested fix: 11 11 | y = x.dtype.type(0.0) 12 12 | 13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459841 14 |-assert isinstance(fullname, type("")is not True) 14 |+assert isinstance(fullname, str is not True) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP004.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP004.py.snap index 0c4b87c5d9dbf..0ccafd3c50a58 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP004.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP004.py.snap @@ -9,7 +9,7 @@ UP004.py:5:9: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 2 2 | ... 3 3 | 4 4 | @@ -19,6 +19,8 @@ UP004.py:5:9: UP004 [*] Class `A` inherits from `object` 7 7 | 8 8 | + Run `ruff check --fix` to apply this fix. + UP004.py:10:5: UP004 [*] Class `A` inherits from `object` | 9 | class A( @@ -29,7 +31,7 @@ UP004.py:10:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 6 6 | ... 7 7 | 8 8 | @@ -41,6 +43,8 @@ UP004.py:10:5: UP004 [*] Class `A` inherits from `object` 13 11 | 14 12 | + Run `ruff check --fix` to apply this fix. + UP004.py:16:5: UP004 [*] Class `A` inherits from `object` | 15 | class A( @@ -51,7 +55,7 @@ UP004.py:16:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 12 12 | ... 13 13 | 14 14 | @@ -64,6 +68,8 @@ UP004.py:16:5: UP004 [*] Class `A` inherits from `object` 20 17 | 21 18 | + Run `ruff check --fix` to apply this fix. + UP004.py:24:5: UP004 [*] Class `A` inherits from `object` | 22 | class A( @@ -75,7 +81,7 @@ UP004.py:24:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 19 19 | ... 20 20 | 21 21 | @@ -88,6 +94,8 @@ UP004.py:24:5: UP004 [*] Class `A` inherits from `object` 27 24 | 28 25 | + Run `ruff check --fix` to apply this fix. + UP004.py:31:5: UP004 [*] Class `A` inherits from `object` | 29 | class A( @@ -99,7 +107,7 @@ UP004.py:31:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 26 26 | ... 27 27 | 28 28 | @@ -112,6 +120,8 @@ UP004.py:31:5: UP004 [*] Class `A` inherits from `object` 34 31 | 35 32 | + Run `ruff check --fix` to apply this fix. + UP004.py:37:5: UP004 [*] Class `A` inherits from `object` | 36 | class A( @@ -122,7 +132,7 @@ UP004.py:37:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 33 33 | ... 34 34 | 35 35 | @@ -135,6 +145,8 @@ UP004.py:37:5: UP004 [*] Class `A` inherits from `object` 41 38 | 42 39 | + Run `ruff check --fix` to apply this fix. + UP004.py:45:5: UP004 [*] Class `A` inherits from `object` | 43 | class A( @@ -146,7 +158,7 @@ UP004.py:45:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 40 40 | ... 41 41 | 42 42 | @@ -160,6 +172,8 @@ UP004.py:45:5: UP004 [*] Class `A` inherits from `object` 49 45 | 50 46 | + Run `ruff check --fix` to apply this fix. + UP004.py:53:5: UP004 [*] Class `A` inherits from `object` | 51 | class A( @@ -171,7 +185,7 @@ UP004.py:53:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 48 48 | ... 49 49 | 50 50 | @@ -185,6 +199,8 @@ UP004.py:53:5: UP004 [*] Class `A` inherits from `object` 57 53 | 58 54 | + Run `ruff check --fix` to apply this fix. + UP004.py:61:5: UP004 [*] Class `A` inherits from `object` | 59 | class A( @@ -196,7 +212,7 @@ UP004.py:61:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 56 56 | ... 57 57 | 58 58 | @@ -210,6 +226,8 @@ UP004.py:61:5: UP004 [*] Class `A` inherits from `object` 65 61 | 66 62 | + Run `ruff check --fix` to apply this fix. + UP004.py:69:5: UP004 [*] Class `A` inherits from `object` | 67 | class A( @@ -221,7 +239,7 @@ UP004.py:69:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 64 64 | ... 65 65 | 66 66 | @@ -235,6 +253,8 @@ UP004.py:69:5: UP004 [*] Class `A` inherits from `object` 73 69 | 74 70 | + Run `ruff check --fix` to apply this fix. + UP004.py:75:12: UP004 [*] Class `B` inherits from `object` | 75 | class B(A, object): @@ -243,7 +263,7 @@ UP004.py:75:12: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 72 72 | ... 73 73 | 74 74 | @@ -253,6 +273,8 @@ UP004.py:75:12: UP004 [*] Class `B` inherits from `object` 77 77 | 78 78 | + Run `ruff check --fix` to apply this fix. + UP004.py:79:9: UP004 [*] Class `B` inherits from `object` | 79 | class B(object, A): @@ -261,7 +283,7 @@ UP004.py:79:9: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 76 76 | ... 77 77 | 78 78 | @@ -271,6 +293,8 @@ UP004.py:79:9: UP004 [*] Class `B` inherits from `object` 81 81 | 82 82 | + Run `ruff check --fix` to apply this fix. + UP004.py:84:5: UP004 [*] Class `B` inherits from `object` | 83 | class B( @@ -281,7 +305,7 @@ UP004.py:84:5: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 81 81 | 82 82 | 83 83 | class B( @@ -290,6 +314,8 @@ UP004.py:84:5: UP004 [*] Class `B` inherits from `object` 86 85 | ): 87 86 | ... + Run `ruff check --fix` to apply this fix. + UP004.py:92:5: UP004 [*] Class `B` inherits from `object` | 90 | class B( @@ -301,7 +327,7 @@ UP004.py:92:5: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 89 89 | 90 90 | class B( 91 91 | A, @@ -310,6 +336,8 @@ UP004.py:92:5: UP004 [*] Class `B` inherits from `object` 94 93 | ... 95 94 | + Run `ruff check --fix` to apply this fix. + UP004.py:98:5: UP004 [*] Class `B` inherits from `object` | 97 | class B( @@ -320,7 +348,7 @@ UP004.py:98:5: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 95 95 | 96 96 | 97 97 | class B( @@ -329,6 +357,8 @@ UP004.py:98:5: UP004 [*] Class `B` inherits from `object` 100 99 | A, 101 100 | ): + Run `ruff check --fix` to apply this fix. + UP004.py:108:5: UP004 [*] Class `B` inherits from `object` | 106 | # Comment on A. @@ -340,7 +370,7 @@ UP004.py:108:5: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 105 105 | class B( 106 106 | # Comment on A. 107 107 | A, @@ -349,6 +379,8 @@ UP004.py:108:5: UP004 [*] Class `B` inherits from `object` 110 109 | ... 111 110 | + Run `ruff check --fix` to apply this fix. + UP004.py:119:5: UP004 [*] Class `A` inherits from `object` | 118 | class A( @@ -359,7 +391,7 @@ UP004.py:119:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 115 115 | ... 116 116 | 117 117 | @@ -371,6 +403,8 @@ UP004.py:119:5: UP004 [*] Class `A` inherits from `object` 122 120 | 123 121 | + Run `ruff check --fix` to apply this fix. + UP004.py:125:5: UP004 [*] Class `A` inherits from `object` | 124 | class A( @@ -381,7 +415,7 @@ UP004.py:125:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 121 121 | ... 122 122 | 123 123 | @@ -393,6 +427,8 @@ UP004.py:125:5: UP004 [*] Class `A` inherits from `object` 128 126 | 129 127 | + Run `ruff check --fix` to apply this fix. + UP004.py:131:5: UP004 [*] Class `A` inherits from `object` | 130 | class A( @@ -403,7 +439,7 @@ UP004.py:131:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 127 127 | ... 128 128 | 129 129 | @@ -416,6 +452,8 @@ UP004.py:131:5: UP004 [*] Class `A` inherits from `object` 135 132 | 136 133 | + Run `ruff check --fix` to apply this fix. + UP004.py:137:9: UP004 [*] Class `A` inherits from `object` | 137 | class A(object, object): @@ -424,7 +462,7 @@ UP004.py:137:9: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 134 134 | ... 135 135 | 136 136 | @@ -434,6 +472,8 @@ UP004.py:137:9: UP004 [*] Class `A` inherits from `object` 139 139 | 140 140 | + Run `ruff check --fix` to apply this fix. + UP004.py:137:17: UP004 [*] Class `A` inherits from `object` | 137 | class A(object, object): @@ -442,7 +482,7 @@ UP004.py:137:17: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 134 134 | ... 135 135 | 136 136 | @@ -452,6 +492,8 @@ UP004.py:137:17: UP004 [*] Class `A` inherits from `object` 139 139 | 140 140 | + Run `ruff check --fix` to apply this fix. + UP004.py:142:9: UP004 [*] Class `A` inherits from `object` | 141 | @decorator() @@ -461,7 +503,7 @@ UP004.py:142:9: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 139 139 | 140 140 | 141 141 | @decorator() @@ -471,6 +513,8 @@ UP004.py:142:9: UP004 [*] Class `A` inherits from `object` 144 144 | 145 145 | @decorator() # class A(object): + Run `ruff check --fix` to apply this fix. + UP004.py:146:9: UP004 [*] Class `A` inherits from `object` | 145 | @decorator() # class A(object): @@ -480,7 +524,7 @@ UP004.py:146:9: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 143 143 | ... 144 144 | 145 145 | @decorator() # class A(object): @@ -490,6 +534,8 @@ UP004.py:146:9: UP004 [*] Class `A` inherits from `object` 148 148 | 149 149 | + Run `ruff check --fix` to apply this fix. + UP004.py:159:15: UP004 [*] Class `Unusual` inherits from `object` | 157 | import builtins @@ -500,10 +546,12 @@ UP004.py:159:15: UP004 [*] Class `Unusual` inherits from `object` | = help: Remove `object` inheritance -ℹ Safe fix +Suggested fix: 156 156 | 157 157 | import builtins 158 158 | 159 |-class Unusual(builtins.object): 159 |+class Unusual: 160 160 | ... + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap index 21d08d5d28243..87fc9c41ac2f8 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap @@ -12,7 +12,7 @@ UP005.py:6:9: UP005 [*] `assertEquals` is deprecated, use `assertEqual` | = help: Replace `assertEqual` with `assertEquals` -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | class Suite(unittest.TestCase): 5 5 | def test(self) -> None: @@ -22,6 +22,8 @@ UP005.py:6:9: UP005 [*] `assertEquals` is deprecated, use `assertEqual` 8 8 | self.assertEqual(3, 4) 9 9 | self.failUnlessAlmostEqual(1, 1.1) + Run `ruff check --fix` to apply this fix. + UP005.py:7:9: UP005 [*] `assertEquals` is deprecated, use `assertEqual` | 5 | def test(self) -> None: @@ -33,7 +35,7 @@ UP005.py:7:9: UP005 [*] `assertEquals` is deprecated, use `assertEqual` | = help: Replace `assertEqual` with `assertEquals` -ℹ Safe fix +Suggested fix: 4 4 | class Suite(unittest.TestCase): 5 5 | def test(self) -> None: 6 6 | self.assertEquals (1, 2) @@ -43,6 +45,8 @@ UP005.py:7:9: UP005 [*] `assertEquals` is deprecated, use `assertEqual` 9 9 | self.failUnlessAlmostEqual(1, 1.1) 10 10 | self.assertNotRegexpMatches("a", "b") + Run `ruff check --fix` to apply this fix. + UP005.py:9:9: UP005 [*] `failUnlessAlmostEqual` is deprecated, use `assertAlmostEqual` | 7 | self.assertEquals(1, 2) @@ -53,7 +57,7 @@ UP005.py:9:9: UP005 [*] `failUnlessAlmostEqual` is deprecated, use `assertAlmost | = help: Replace `assertAlmostEqual` with `failUnlessAlmostEqual` -ℹ Safe fix +Suggested fix: 6 6 | self.assertEquals (1, 2) 7 7 | self.assertEquals(1, 2) 8 8 | self.assertEqual(3, 4) @@ -61,6 +65,8 @@ UP005.py:9:9: UP005 [*] `failUnlessAlmostEqual` is deprecated, use `assertAlmost 9 |+ self.assertAlmostEqual(1, 1.1) 10 10 | self.assertNotRegexpMatches("a", "b") + Run `ruff check --fix` to apply this fix. + UP005.py:10:9: UP005 [*] `assertNotRegexpMatches` is deprecated, use `assertNotRegex` | 8 | self.assertEqual(3, 4) @@ -70,11 +76,11 @@ UP005.py:10:9: UP005 [*] `assertNotRegexpMatches` is deprecated, use `assertNotR | = help: Replace `assertNotRegex` with `assertNotRegexpMatches` -ℹ Safe fix +Suggested fix: 7 7 | self.assertEquals(1, 2) 8 8 | self.assertEqual(3, 4) 9 9 | self.failUnlessAlmostEqual(1, 1.1) 10 |- self.assertNotRegexpMatches("a", "b") 10 |+ self.assertNotRegex("a", "b") - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap index 283b6f1b0c1a4..c55f00adc9e72 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap @@ -9,7 +9,7 @@ UP006_0.py:4:10: UP006 [*] Use `list` instead of `typing.List` for type annotati | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 1 1 | import typing 2 2 | 3 3 | @@ -19,6 +19,8 @@ UP006_0.py:4:10: UP006 [*] Use `list` instead of `typing.List` for type annotati 6 6 | 7 7 | + Run `ruff check --fix` to apply this fix. + UP006_0.py:11:10: UP006 [*] Use `list` instead of `List` for type annotation | 11 | def f(x: List[str]) -> None: @@ -27,7 +29,7 @@ UP006_0.py:11:10: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 8 8 | from typing import List 9 9 | 10 10 | @@ -37,6 +39,8 @@ UP006_0.py:11:10: UP006 [*] Use `list` instead of `List` for type annotation 13 13 | 14 14 | + Run `ruff check --fix` to apply this fix. + UP006_0.py:18:10: UP006 [*] Use `list` instead of `t.List` for type annotation | 18 | def f(x: t.List[str]) -> None: @@ -45,7 +49,7 @@ UP006_0.py:18:10: UP006 [*] Use `list` instead of `t.List` for type annotation | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 15 15 | import typing as t 16 16 | 17 17 | @@ -55,6 +59,8 @@ UP006_0.py:18:10: UP006 [*] Use `list` instead of `t.List` for type annotation 20 20 | 21 21 | + Run `ruff check --fix` to apply this fix. + UP006_0.py:25:10: UP006 [*] Use `list` instead of `IList` for type annotation | 25 | def f(x: IList[str]) -> None: @@ -63,7 +69,7 @@ UP006_0.py:25:10: UP006 [*] Use `list` instead of `IList` for type annotation | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 22 22 | from typing import List as IList 23 23 | 24 24 | @@ -73,6 +79,8 @@ UP006_0.py:25:10: UP006 [*] Use `list` instead of `IList` for type annotation 27 27 | 28 28 | + Run `ruff check --fix` to apply this fix. + UP006_0.py:29:11: UP006 [*] Use `list` instead of `List` for type annotation | 29 | def f(x: "List[str]") -> None: @@ -81,7 +89,7 @@ UP006_0.py:29:11: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 26 26 | ... 27 27 | 28 28 | @@ -91,6 +99,8 @@ UP006_0.py:29:11: UP006 [*] Use `list` instead of `List` for type annotation 31 31 | 32 32 | + Run `ruff check --fix` to apply this fix. + UP006_0.py:33:12: UP006 [*] Use `list` instead of `List` for type annotation | 33 | def f(x: r"List[str]") -> None: @@ -99,7 +109,7 @@ UP006_0.py:33:12: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 30 30 | ... 31 31 | 32 32 | @@ -109,6 +119,8 @@ UP006_0.py:33:12: UP006 [*] Use `list` instead of `List` for type annotation 35 35 | 36 36 | + Run `ruff check --fix` to apply this fix. + UP006_0.py:37:11: UP006 [*] Use `list` instead of `List` for type annotation | 37 | def f(x: "List[str]") -> None: @@ -117,7 +129,7 @@ UP006_0.py:37:11: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 34 34 | ... 35 35 | 36 36 | @@ -127,6 +139,8 @@ UP006_0.py:37:11: UP006 [*] Use `list` instead of `List` for type annotation 39 39 | 40 40 | + Run `ruff check --fix` to apply this fix. + UP006_0.py:41:13: UP006 [*] Use `list` instead of `List` for type annotation | 41 | def f(x: """List[str]""") -> None: @@ -135,7 +149,7 @@ UP006_0.py:41:13: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 38 38 | ... 39 39 | 40 40 | @@ -145,6 +159,8 @@ UP006_0.py:41:13: UP006 [*] Use `list` instead of `List` for type annotation 43 43 | 44 44 | + Run `ruff check --fix` to apply this fix. + UP006_0.py:45:10: UP006 Use `list` instead of `List` for type annotation | 45 | def f(x: "Li" "st[str]") -> None: @@ -161,7 +177,7 @@ UP006_0.py:49:11: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 46 46 | ... 47 47 | 48 48 | @@ -171,6 +187,8 @@ UP006_0.py:49:11: UP006 [*] Use `list` instead of `List` for type annotation 51 51 | 52 52 | + Run `ruff check --fix` to apply this fix. + UP006_0.py:49:17: UP006 [*] Use `list` instead of `List` for type annotation | 49 | def f(x: "List['List[str]']") -> None: @@ -179,7 +197,7 @@ UP006_0.py:49:17: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 46 46 | ... 47 47 | 48 48 | @@ -189,6 +207,8 @@ UP006_0.py:49:17: UP006 [*] Use `list` instead of `List` for type annotation 51 51 | 52 52 | + Run `ruff check --fix` to apply this fix. + UP006_0.py:53:11: UP006 [*] Use `list` instead of `List` for type annotation | 53 | def f(x: "List['Li' 'st[str]']") -> None: @@ -197,7 +217,7 @@ UP006_0.py:53:11: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 50 50 | ... 51 51 | 52 52 | @@ -207,6 +227,8 @@ UP006_0.py:53:11: UP006 [*] Use `list` instead of `List` for type annotation 55 55 | 56 56 | + Run `ruff check --fix` to apply this fix. + UP006_0.py:53:16: UP006 Use `list` instead of `List` for type annotation | 53 | def f(x: "List['Li' 'st[str]']") -> None: @@ -239,7 +261,7 @@ UP006_0.py:61:10: UP006 [*] Use `collections.deque` instead of `typing.Deque` fo | = help: Replace with `collections.deque` -ℹ Safe fix +Suggested fix: 20 20 | 21 21 | 22 22 | from typing import List as IList @@ -257,6 +279,8 @@ UP006_0.py:61:10: UP006 [*] Use `collections.deque` instead of `typing.Deque` fo 63 64 | 64 65 | + Run `ruff check --fix` to apply this fix. + UP006_0.py:65:10: UP006 [*] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation | 65 | def f(x: typing.DefaultDict[str, str]) -> None: @@ -265,7 +289,7 @@ UP006_0.py:65:10: UP006 [*] Use `collections.defaultdict` instead of `typing.Def | = help: Replace with `collections.defaultdict` -ℹ Safe fix +Suggested fix: 20 20 | 21 21 | 22 22 | from typing import List as IList @@ -281,4 +305,4 @@ UP006_0.py:65:10: UP006 [*] Use `collections.defaultdict` instead of `typing.Def 66 |+def f(x: defaultdict[str, str]) -> None: 66 67 | ... - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap index 23d2e79f9a43f..38e58596fbeca 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap @@ -9,7 +9,7 @@ UP006_1.py:9:10: UP006 [*] Use `collections.defaultdict` instead of `typing.Defa | = help: Replace with `collections.defaultdict` -ℹ Safe fix +Suggested fix: 6 6 | from collections import defaultdict 7 7 | 8 8 | @@ -17,4 +17,4 @@ UP006_1.py:9:10: UP006 [*] Use `collections.defaultdict` instead of `typing.Defa 9 |+def f(x: defaultdict[str, str]) -> None: 10 10 | ... - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap index 6e49fa82351ff..8d8fb7e0eba7e 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap @@ -9,7 +9,7 @@ UP006_3.py:7:11: UP006 [*] Use `collections.defaultdict` instead of `typing.Defa | = help: Replace with `collections.defaultdict` -ℹ Safe fix +Suggested fix: 4 4 | from collections import defaultdict 5 5 | 6 6 | @@ -17,4 +17,4 @@ UP006_3.py:7:11: UP006 [*] Use `collections.defaultdict` instead of `typing.Defa 7 |+def f(x: "defaultdict[str, str]") -> None: 8 8 | ... - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap index a607401c39adf..2ed628134f1a6 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap @@ -9,7 +9,7 @@ UP007.py:6:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 3 3 | from typing import Union 4 4 | 5 5 | @@ -19,6 +19,8 @@ UP007.py:6:10: UP007 [*] Use `X | Y` for type annotations 8 8 | 9 9 | + Run `ruff check --fix` to apply this fix. + UP007.py:10:10: UP007 [*] Use `X | Y` for type annotations | 10 | def f(x: typing.Optional[str]) -> None: @@ -27,7 +29,7 @@ UP007.py:10:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 7 7 | ... 8 8 | 9 9 | @@ -37,6 +39,8 @@ UP007.py:10:10: UP007 [*] Use `X | Y` for type annotations 12 12 | 13 13 | + Run `ruff check --fix` to apply this fix. + UP007.py:14:10: UP007 [*] Use `X | Y` for type annotations | 14 | def f(x: Union[str, int, Union[float, bytes]]) -> None: @@ -45,7 +49,7 @@ UP007.py:14:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 11 11 | ... 12 12 | 13 13 | @@ -55,6 +59,8 @@ UP007.py:14:10: UP007 [*] Use `X | Y` for type annotations 16 16 | 17 17 | + Run `ruff check --fix` to apply this fix. + UP007.py:14:26: UP007 [*] Use `X | Y` for type annotations | 14 | def f(x: Union[str, int, Union[float, bytes]]) -> None: @@ -63,7 +69,7 @@ UP007.py:14:26: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 11 11 | ... 12 12 | 13 13 | @@ -73,6 +79,8 @@ UP007.py:14:26: UP007 [*] Use `X | Y` for type annotations 16 16 | 17 17 | + Run `ruff check --fix` to apply this fix. + UP007.py:18:10: UP007 [*] Use `X | Y` for type annotations | 18 | def f(x: typing.Union[str, int]) -> None: @@ -81,7 +89,7 @@ UP007.py:18:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 15 15 | ... 16 16 | 17 17 | @@ -91,6 +99,8 @@ UP007.py:18:10: UP007 [*] Use `X | Y` for type annotations 20 20 | 21 21 | + Run `ruff check --fix` to apply this fix. + UP007.py:22:10: UP007 [*] Use `X | Y` for type annotations | 22 | def f(x: typing.Union[(str, int)]) -> None: @@ -99,7 +109,7 @@ UP007.py:22:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 19 19 | ... 20 20 | 21 21 | @@ -109,6 +119,8 @@ UP007.py:22:10: UP007 [*] Use `X | Y` for type annotations 24 24 | 25 25 | + Run `ruff check --fix` to apply this fix. + UP007.py:26:10: UP007 [*] Use `X | Y` for type annotations | 26 | def f(x: typing.Union[(str, int), float]) -> None: @@ -117,7 +129,7 @@ UP007.py:26:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 23 23 | ... 24 24 | 25 25 | @@ -127,6 +139,8 @@ UP007.py:26:10: UP007 [*] Use `X | Y` for type annotations 28 28 | 29 29 | + Run `ruff check --fix` to apply this fix. + UP007.py:30:10: UP007 [*] Use `X | Y` for type annotations | 30 | def f(x: typing.Union[(int,)]) -> None: @@ -135,7 +149,7 @@ UP007.py:30:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 27 27 | ... 28 28 | 29 29 | @@ -145,6 +159,8 @@ UP007.py:30:10: UP007 [*] Use `X | Y` for type annotations 32 32 | 33 33 | + Run `ruff check --fix` to apply this fix. + UP007.py:34:10: UP007 [*] Use `X | Y` for type annotations | 34 | def f(x: typing.Union[()]) -> None: @@ -153,7 +169,7 @@ UP007.py:34:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 31 31 | ... 32 32 | 33 33 | @@ -163,6 +179,8 @@ UP007.py:34:10: UP007 [*] Use `X | Y` for type annotations 36 36 | 37 37 | + Run `ruff check --fix` to apply this fix. + UP007.py:38:11: UP007 [*] Use `X | Y` for type annotations | 38 | def f(x: "Union[str, int, Union[float, bytes]]") -> None: @@ -171,7 +189,7 @@ UP007.py:38:11: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 35 35 | ... 36 36 | 37 37 | @@ -181,6 +199,8 @@ UP007.py:38:11: UP007 [*] Use `X | Y` for type annotations 40 40 | 41 41 | + Run `ruff check --fix` to apply this fix. + UP007.py:38:27: UP007 [*] Use `X | Y` for type annotations | 38 | def f(x: "Union[str, int, Union[float, bytes]]") -> None: @@ -189,7 +209,7 @@ UP007.py:38:27: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 35 35 | ... 36 36 | 37 37 | @@ -199,6 +219,8 @@ UP007.py:38:27: UP007 [*] Use `X | Y` for type annotations 40 40 | 41 41 | + Run `ruff check --fix` to apply this fix. + UP007.py:42:11: UP007 [*] Use `X | Y` for type annotations | 42 | def f(x: "typing.Union[str, int]") -> None: @@ -207,7 +229,7 @@ UP007.py:42:11: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 39 39 | ... 40 40 | 41 41 | @@ -217,6 +239,8 @@ UP007.py:42:11: UP007 [*] Use `X | Y` for type annotations 44 44 | 45 45 | + Run `ruff check --fix` to apply this fix. + UP007.py:55:8: UP007 [*] Use `X | Y` for type annotations | 54 | def f() -> None: @@ -226,7 +250,7 @@ UP007.py:55:8: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 52 52 | 53 53 | 54 54 | def f() -> None: @@ -236,6 +260,8 @@ UP007.py:55:8: UP007 [*] Use `X | Y` for type annotations 57 57 | 58 58 | x = Union[str, int] + Run `ruff check --fix` to apply this fix. + UP007.py:56:9: UP007 Use `X | Y` for type annotations | 54 | def f() -> None: @@ -268,7 +294,7 @@ UP007.py:60:8: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 57 57 | 58 58 | x = Union[str, int] 59 59 | x = Union["str", "int"] @@ -278,6 +304,8 @@ UP007.py:60:8: UP007 [*] Use `X | Y` for type annotations 62 62 | 63 63 | + Run `ruff check --fix` to apply this fix. + UP007.py:61:8: UP007 [*] Use `X | Y` for type annotations | 59 | x = Union["str", "int"] @@ -287,7 +315,7 @@ UP007.py:61:8: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 58 58 | x = Union[str, int] 59 59 | x = Union["str", "int"] 60 60 | x: Union[str, int] @@ -297,6 +325,8 @@ UP007.py:61:8: UP007 [*] Use `X | Y` for type annotations 63 63 | 64 64 | def f(x: Union[int : float]) -> None: + Run `ruff check --fix` to apply this fix. + UP007.py:64:10: UP007 Use `X | Y` for type annotations | 64 | def f(x: Union[int : float]) -> None: @@ -382,7 +412,7 @@ UP007.py:102:28: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 99 99 | 100 100 | # Regression test for: https://github.com/astral-sh/ruff/issues/7131 101 101 | class ServiceRefOrValue: @@ -395,6 +425,8 @@ UP007.py:102:28: UP007 [*] Use `X | Y` for type annotations 107 104 | 108 105 | # Regression test for: https://github.com/astral-sh/ruff/issues/7201 + Run `ruff check --fix` to apply this fix. + UP007.py:110:28: UP007 [*] Use `X | Y` for type annotations | 108 | # Regression test for: https://github.com/astral-sh/ruff/issues/7201 @@ -404,7 +436,7 @@ UP007.py:110:28: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 107 107 | 108 108 | # Regression test for: https://github.com/astral-sh/ruff/issues/7201 109 109 | class ServiceRefOrValue: @@ -414,6 +446,8 @@ UP007.py:110:28: UP007 [*] Use `X | Y` for type annotations 112 112 | 113 113 | # Regression test for: https://github.com/astral-sh/ruff/issues/7452 + Run `ruff check --fix` to apply this fix. + UP007.py:120:10: UP007 [*] Use `X | Y` for type annotations | 119 | # Regression test for: https://github.com/astral-sh/ruff/issues/8609 @@ -423,7 +457,7 @@ UP007.py:120:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 117 117 | 118 118 | 119 119 | # Regression test for: https://github.com/astral-sh/ruff/issues/8609 @@ -431,4 +465,4 @@ UP007.py:120:10: UP007 [*] Use `X | Y` for type annotations 120 |+def f(x: int | str | bytes) -> None: 121 121 | ... - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_0.py.snap index c4e69c7ea1376..9573c7c72b889 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_0.py.snap @@ -10,9 +10,9 @@ UP009_0.py:1:1: UP009 [*] UTF-8 encoding declaration is unnecessary | = help: Remove unnecessary coding comment -ℹ Safe fix +Suggested fix: 1 |-# coding=utf8 2 1 | 3 2 | print("Hello world") - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_1.py.snap index b1b25e0d3299f..5fbc80587022b 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_1.py.snap @@ -11,10 +11,10 @@ UP009_1.py:2:1: UP009 [*] UTF-8 encoding declaration is unnecessary | = help: Remove unnecessary coding comment -ℹ Safe fix +Suggested fix: 1 1 | #!/usr/bin/python 2 |-# -*- coding: utf-8 -*- 3 2 | 4 3 | print('Hello world') - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_6.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_6.py.snap index 01bbf87c0012d..9f0b065b0bbf9 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_6.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_6.py.snap @@ -9,10 +9,10 @@ UP009_6.py:1:2: UP009 [*] UTF-8 encoding declaration is unnecessary | = help: Remove unnecessary coding comment -ℹ Safe fix +Suggested fix: 1 |- # coding=utf8 2 1 | print("Hello world") 3 2 | 4 3 | """ - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_7.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_7.py.snap index 8439a0715cb29..bbd6be37d42d6 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_7.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_7.py.snap @@ -9,10 +9,10 @@ UP009_7.py:1:2: UP009 [*] UTF-8 encoding declaration is unnecessary | = help: Remove unnecessary coding comment -ℹ Safe fix +Suggested fix: 1 |- # coding=utf8 2 1 | print("Hello world") 3 2 | 4 3 | """ - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap index d72c8e2fbbd25..4a54d87c03004 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap @@ -10,12 +10,14 @@ UP010.py:1:1: UP010 [*] Unnecessary `__future__` imports `generators`, `nested_s | = help: Remove unnecessary `__future__` import -ℹ Safe fix +Suggested fix: 1 |-from __future__ import nested_scopes, generators 2 1 | from __future__ import with_statement, unicode_literals 3 2 | from __future__ import absolute_import, division 4 3 | from __future__ import generator_stop + Run `ruff check --fix` to apply this fix. + UP010.py:2:1: UP010 [*] Unnecessary `__future__` imports `unicode_literals`, `with_statement` for target Python version | 1 | from __future__ import nested_scopes, generators @@ -26,13 +28,15 @@ UP010.py:2:1: UP010 [*] Unnecessary `__future__` imports `unicode_literals`, `wi | = help: Remove unnecessary `__future__` import -ℹ Safe fix +Suggested fix: 1 1 | from __future__ import nested_scopes, generators 2 |-from __future__ import with_statement, unicode_literals 3 2 | from __future__ import absolute_import, division 4 3 | from __future__ import generator_stop 5 4 | from __future__ import print_function, generator_stop + Run `ruff check --fix` to apply this fix. + UP010.py:3:1: UP010 [*] Unnecessary `__future__` imports `absolute_import`, `division` for target Python version | 1 | from __future__ import nested_scopes, generators @@ -44,7 +48,7 @@ UP010.py:3:1: UP010 [*] Unnecessary `__future__` imports `absolute_import`, `div | = help: Remove unnecessary `__future__` import -ℹ Safe fix +Suggested fix: 1 1 | from __future__ import nested_scopes, generators 2 2 | from __future__ import with_statement, unicode_literals 3 |-from __future__ import absolute_import, division @@ -52,6 +56,8 @@ UP010.py:3:1: UP010 [*] Unnecessary `__future__` imports `absolute_import`, `div 5 4 | from __future__ import print_function, generator_stop 6 5 | from __future__ import invalid_module, generators + Run `ruff check --fix` to apply this fix. + UP010.py:4:1: UP010 [*] Unnecessary `__future__` import `generator_stop` for target Python version | 2 | from __future__ import with_statement, unicode_literals @@ -63,7 +69,7 @@ UP010.py:4:1: UP010 [*] Unnecessary `__future__` import `generator_stop` for tar | = help: Remove unnecessary `__future__` import -ℹ Safe fix +Suggested fix: 1 1 | from __future__ import nested_scopes, generators 2 2 | from __future__ import with_statement, unicode_literals 3 3 | from __future__ import absolute_import, division @@ -72,6 +78,8 @@ UP010.py:4:1: UP010 [*] Unnecessary `__future__` import `generator_stop` for tar 6 5 | from __future__ import invalid_module, generators 7 6 | + Run `ruff check --fix` to apply this fix. + UP010.py:5:1: UP010 [*] Unnecessary `__future__` imports `generator_stop`, `print_function` for target Python version | 3 | from __future__ import absolute_import, division @@ -82,7 +90,7 @@ UP010.py:5:1: UP010 [*] Unnecessary `__future__` imports `generator_stop`, `prin | = help: Remove unnecessary `__future__` import -ℹ Safe fix +Suggested fix: 2 2 | from __future__ import with_statement, unicode_literals 3 3 | from __future__ import absolute_import, division 4 4 | from __future__ import generator_stop @@ -91,6 +99,8 @@ UP010.py:5:1: UP010 [*] Unnecessary `__future__` imports `generator_stop`, `prin 7 6 | 8 7 | if True: + Run `ruff check --fix` to apply this fix. + UP010.py:6:1: UP010 [*] Unnecessary `__future__` import `generators` for target Python version | 4 | from __future__ import generator_stop @@ -102,7 +112,7 @@ UP010.py:6:1: UP010 [*] Unnecessary `__future__` import `generators` for target | = help: Remove unnecessary `__future__` import -ℹ Safe fix +Suggested fix: 3 3 | from __future__ import absolute_import, division 4 4 | from __future__ import generator_stop 5 5 | from __future__ import print_function, generator_stop @@ -112,6 +122,8 @@ UP010.py:6:1: UP010 [*] Unnecessary `__future__` import `generators` for target 8 8 | if True: 9 9 | from __future__ import generator_stop + Run `ruff check --fix` to apply this fix. + UP010.py:9:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for target Python version | 8 | if True: @@ -121,7 +133,7 @@ UP010.py:9:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for tar | = help: Remove unnecessary `__future__` import -ℹ Safe fix +Suggested fix: 6 6 | from __future__ import invalid_module, generators 7 7 | 8 8 | if True: @@ -130,6 +142,8 @@ UP010.py:9:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for tar 11 10 | 12 11 | if True: + Run `ruff check --fix` to apply this fix. + UP010.py:10:5: UP010 [*] Unnecessary `__future__` import `generators` for target Python version | 8 | if True: @@ -141,7 +155,7 @@ UP010.py:10:5: UP010 [*] Unnecessary `__future__` import `generators` for target | = help: Remove unnecessary `__future__` import -ℹ Safe fix +Suggested fix: 7 7 | 8 8 | if True: 9 9 | from __future__ import generator_stop @@ -150,6 +164,8 @@ UP010.py:10:5: UP010 [*] Unnecessary `__future__` import `generators` for target 12 11 | if True: 13 12 | from __future__ import generator_stop + Run `ruff check --fix` to apply this fix. + UP010.py:13:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for target Python version | 12 | if True: @@ -159,13 +175,15 @@ UP010.py:13:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for ta | = help: Remove unnecessary `__future__` import -ℹ Safe fix +Suggested fix: 10 10 | from __future__ import generators 11 11 | 12 12 | if True: 13 |- from __future__ import generator_stop 14 13 | from __future__ import invalid_module, generators + Run `ruff check --fix` to apply this fix. + UP010.py:14:5: UP010 [*] Unnecessary `__future__` import `generators` for target Python version | 12 | if True: @@ -175,11 +193,11 @@ UP010.py:14:5: UP010 [*] Unnecessary `__future__` import `generators` for target | = help: Remove unnecessary `__future__` import -ℹ Safe fix +Suggested fix: 11 11 | 12 12 | if True: 13 13 | from __future__ import generator_stop 14 |- from __future__ import invalid_module, generators 14 |+ from __future__ import invalid_module - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP011.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP011.py.snap index e672749216748..b866ae2f00384 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP011.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP011.py.snap @@ -10,7 +10,7 @@ UP011.py:5:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` | = help: Remove unnecessary parentheses -ℹ Safe fix +Suggested fix: 2 2 | from functools import lru_cache 3 3 | 4 4 | @@ -20,6 +20,8 @@ UP011.py:5:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` 7 7 | pass 8 8 | + Run `ruff check --fix` to apply this fix. + UP011.py:10:11: UP011 [*] Unnecessary parentheses to `functools.lru_cache` | 10 | @lru_cache() @@ -29,7 +31,7 @@ UP011.py:10:11: UP011 [*] Unnecessary parentheses to `functools.lru_cache` | = help: Remove unnecessary parentheses -ℹ Safe fix +Suggested fix: 7 7 | pass 8 8 | 9 9 | @@ -39,6 +41,8 @@ UP011.py:10:11: UP011 [*] Unnecessary parentheses to `functools.lru_cache` 12 12 | pass 13 13 | + Run `ruff check --fix` to apply this fix. + UP011.py:16:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` | 15 | @other_decorator @@ -49,7 +53,7 @@ UP011.py:16:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` | = help: Remove unnecessary parentheses -ℹ Safe fix +Suggested fix: 13 13 | 14 14 | 15 15 | @other_decorator @@ -59,6 +63,8 @@ UP011.py:16:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` 18 18 | pass 19 19 | + Run `ruff check --fix` to apply this fix. + UP011.py:21:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` | 21 | @functools.lru_cache() @@ -68,7 +74,7 @@ UP011.py:21:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` | = help: Remove unnecessary parentheses -ℹ Safe fix +Suggested fix: 18 18 | pass 19 19 | 20 20 | @@ -78,4 +84,4 @@ UP011.py:21:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` 23 23 | def fixme(): 24 24 | pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP012.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP012.py.snap index f19df78488866..0d68336762953 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP012.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP012.py.snap @@ -11,7 +11,7 @@ UP012.py:2:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 1 1 | # ASCII literals should be replaced by a bytes literal 2 |-"foo".encode("utf-8") # b"foo" 2 |+b"foo" # b"foo" @@ -19,6 +19,8 @@ UP012.py:2:1: UP012 [*] Unnecessary call to `encode` as UTF-8 4 4 | "foo".encode() # b"foo" 5 5 | "foo".encode("UTF8") # b"foo" + Run `ruff check --fix` to apply this fix. + UP012.py:3:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 1 | # ASCII literals should be replaced by a bytes literal @@ -30,7 +32,7 @@ UP012.py:3:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 1 1 | # ASCII literals should be replaced by a bytes literal 2 2 | "foo".encode("utf-8") # b"foo" 3 |-"foo".encode("u8") # b"foo" @@ -39,6 +41,8 @@ UP012.py:3:1: UP012 [*] Unnecessary call to `encode` as UTF-8 5 5 | "foo".encode("UTF8") # b"foo" 6 6 | U"foo".encode("utf-8") # b"foo" + Run `ruff check --fix` to apply this fix. + UP012.py:4:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 2 | "foo".encode("utf-8") # b"foo" @@ -50,7 +54,7 @@ UP012.py:4:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 1 1 | # ASCII literals should be replaced by a bytes literal 2 2 | "foo".encode("utf-8") # b"foo" 3 3 | "foo".encode("u8") # b"foo" @@ -60,6 +64,8 @@ UP012.py:4:1: UP012 [*] Unnecessary call to `encode` as UTF-8 6 6 | U"foo".encode("utf-8") # b"foo" 7 7 | "foo".encode(encoding="utf-8") # b"foo" + Run `ruff check --fix` to apply this fix. + UP012.py:5:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 3 | "foo".encode("u8") # b"foo" @@ -71,7 +77,7 @@ UP012.py:5:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 2 2 | "foo".encode("utf-8") # b"foo" 3 3 | "foo".encode("u8") # b"foo" 4 4 | "foo".encode() # b"foo" @@ -81,6 +87,8 @@ UP012.py:5:1: UP012 [*] Unnecessary call to `encode` as UTF-8 7 7 | "foo".encode(encoding="utf-8") # b"foo" 8 8 | """ + Run `ruff check --fix` to apply this fix. + UP012.py:6:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 4 | "foo".encode() # b"foo" @@ -92,7 +100,7 @@ UP012.py:6:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 3 3 | "foo".encode("u8") # b"foo" 4 4 | "foo".encode() # b"foo" 5 5 | "foo".encode("UTF8") # b"foo" @@ -102,6 +110,8 @@ UP012.py:6:1: UP012 [*] Unnecessary call to `encode` as UTF-8 8 8 | """ 9 9 | Lorem + Run `ruff check --fix` to apply this fix. + UP012.py:7:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 5 | "foo".encode("UTF8") # b"foo" @@ -113,7 +123,7 @@ UP012.py:7:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 4 4 | "foo".encode() # b"foo" 5 5 | "foo".encode("UTF8") # b"foo" 6 6 | U"foo".encode("utf-8") # b"foo" @@ -123,6 +133,8 @@ UP012.py:7:1: UP012 [*] Unnecessary call to `encode` as UTF-8 9 9 | Lorem 10 10 | + Run `ruff check --fix` to apply this fix. + UP012.py:8:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 6 | U"foo".encode("utf-8") # b"foo" @@ -140,7 +152,7 @@ UP012.py:8:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 5 5 | "foo".encode("UTF8") # b"foo" 6 6 | U"foo".encode("utf-8") # b"foo" 7 7 | "foo".encode(encoding="utf-8") # b"foo" @@ -157,6 +169,8 @@ UP012.py:8:1: UP012 [*] Unnecessary call to `encode` as UTF-8 16 14 | "Lorem " 17 15 | "Ipsum".encode() + Run `ruff check --fix` to apply this fix. + UP012.py:16:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | 14 | ) @@ -170,7 +184,7 @@ UP012.py:16:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 13 13 | "utf-8" 14 14 | ) 15 15 | ( @@ -182,6 +196,8 @@ UP012.py:16:5: UP012 [*] Unnecessary call to `encode` as UTF-8 19 19 | ( 20 20 | "Lorem " # Comment + Run `ruff check --fix` to apply this fix. + UP012.py:20:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | 18 | ) @@ -195,7 +211,7 @@ UP012.py:20:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 17 17 | "Ipsum".encode() 18 18 | ) 19 19 | ( @@ -207,6 +223,8 @@ UP012.py:20:5: UP012 [*] Unnecessary call to `encode` as UTF-8 23 23 | ( 24 24 | "Lorem " "Ipsum".encode() + Run `ruff check --fix` to apply this fix. + UP012.py:24:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | 22 | ) @@ -217,7 +235,7 @@ UP012.py:24:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 21 21 | "Ipsum".encode() # Comment 22 22 | ) 23 23 | ( @@ -227,6 +245,8 @@ UP012.py:24:5: UP012 [*] Unnecessary call to `encode` as UTF-8 26 26 | 27 27 | # `encode` on variables should not be processed. + Run `ruff check --fix` to apply this fix. + UP012.py:32:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | 31 | bar = "bar" @@ -237,7 +257,7 @@ UP012.py:32:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -ℹ Safe fix +Suggested fix: 29 29 | string.encode("utf-8") 30 30 | 31 31 | bar = "bar" @@ -247,6 +267,8 @@ UP012.py:32:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 34 34 | "foo".encode(encoding) 35 35 | f"foo{bar}".encode(encoding) + Run `ruff check --fix` to apply this fix. + UP012.py:36:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | 34 | "foo".encode(encoding) @@ -260,7 +282,7 @@ UP012.py:36:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -ℹ Safe fix +Suggested fix: 33 33 | encoding = "latin" 34 34 | "foo".encode(encoding) 35 35 | f"foo{bar}".encode(encoding) @@ -272,6 +294,8 @@ UP012.py:36:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 40 38 | # `encode` with custom args and kwargs should not be processed. 41 39 | "foo".encode("utf-8", errors="replace") + Run `ruff check --fix` to apply this fix. + UP012.py:53:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | 52 | # Unicode literals should only be stripped of default encoding. @@ -282,7 +306,7 @@ UP012.py:53:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -ℹ Safe fix +Suggested fix: 50 50 | "unicode text©".encode(encoding="utf-8", errors="replace") 51 51 | 52 52 | # Unicode literals should only be stripped of default encoding. @@ -292,6 +316,8 @@ UP012.py:53:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 55 55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode() 56 56 | + Run `ruff check --fix` to apply this fix. + UP012.py:55:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | 53 | "unicode text©".encode("utf-8") # "unicode text©".encode() @@ -303,7 +329,7 @@ UP012.py:55:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -ℹ Safe fix +Suggested fix: 52 52 | # Unicode literals should only be stripped of default encoding. 53 53 | "unicode text©".encode("utf-8") # "unicode text©".encode() 54 54 | "unicode text©".encode() @@ -313,6 +339,8 @@ UP012.py:55:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 57 57 | r"foo\o".encode("utf-8") # br"foo\o" 58 58 | u"foo".encode("utf-8") # b"foo" + Run `ruff check --fix` to apply this fix. + UP012.py:57:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode() @@ -324,7 +352,7 @@ UP012.py:57:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 54 54 | "unicode text©".encode() 55 55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode() 56 56 | @@ -334,6 +362,8 @@ UP012.py:57:1: UP012 [*] Unnecessary call to `encode` as UTF-8 59 59 | R"foo\o".encode("utf-8") # br"foo\o" 60 60 | U"foo".encode("utf-8") # b"foo" + Run `ruff check --fix` to apply this fix. + UP012.py:58:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 57 | r"foo\o".encode("utf-8") # br"foo\o" @@ -344,7 +374,7 @@ UP012.py:58:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 55 55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode() 56 56 | 57 57 | r"foo\o".encode("utf-8") # br"foo\o" @@ -354,6 +384,8 @@ UP012.py:58:1: UP012 [*] Unnecessary call to `encode` as UTF-8 60 60 | U"foo".encode("utf-8") # b"foo" 61 61 | print("foo".encode()) # print(b"foo") + Run `ruff check --fix` to apply this fix. + UP012.py:59:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 57 | r"foo\o".encode("utf-8") # br"foo\o" @@ -365,7 +397,7 @@ UP012.py:59:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 56 56 | 57 57 | r"foo\o".encode("utf-8") # br"foo\o" 58 58 | u"foo".encode("utf-8") # b"foo" @@ -375,6 +407,8 @@ UP012.py:59:1: UP012 [*] Unnecessary call to `encode` as UTF-8 61 61 | print("foo".encode()) # print(b"foo") 62 62 | + Run `ruff check --fix` to apply this fix. + UP012.py:60:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 58 | u"foo".encode("utf-8") # b"foo" @@ -385,7 +419,7 @@ UP012.py:60:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 57 57 | r"foo\o".encode("utf-8") # br"foo\o" 58 58 | u"foo".encode("utf-8") # b"foo" 59 59 | R"foo\o".encode("utf-8") # br"foo\o" @@ -395,6 +429,8 @@ UP012.py:60:1: UP012 [*] Unnecessary call to `encode` as UTF-8 62 62 | 63 63 | # `encode` on parenthesized strings. + Run `ruff check --fix` to apply this fix. + UP012.py:61:7: UP012 [*] Unnecessary call to `encode` as UTF-8 | 59 | R"foo\o".encode("utf-8") # br"foo\o" @@ -406,7 +442,7 @@ UP012.py:61:7: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 58 58 | u"foo".encode("utf-8") # b"foo" 59 59 | R"foo\o".encode("utf-8") # br"foo\o" 60 60 | U"foo".encode("utf-8") # b"foo" @@ -416,6 +452,8 @@ UP012.py:61:7: UP012 [*] Unnecessary call to `encode` as UTF-8 63 63 | # `encode` on parenthesized strings. 64 64 | ( + Run `ruff check --fix` to apply this fix. + UP012.py:64:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 63 | # `encode` on parenthesized strings. @@ -429,7 +467,7 @@ UP012.py:64:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 62 62 | 63 63 | # `encode` on parenthesized strings. 64 64 | ( @@ -443,6 +481,8 @@ UP012.py:64:1: UP012 [*] Unnecessary call to `encode` as UTF-8 69 69 | (( 70 70 | "abc" + Run `ruff check --fix` to apply this fix. + UP012.py:69:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 67 | ).encode() @@ -457,7 +497,7 @@ UP012.py:69:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 67 67 | ).encode() 68 68 | 69 69 | (( @@ -471,6 +511,8 @@ UP012.py:69:1: UP012 [*] Unnecessary call to `encode` as UTF-8 74 74 | (f"foo{bar}").encode("utf-8") 75 75 | (f"foo{bar}").encode(encoding="utf-8") + Run `ruff check --fix` to apply this fix. + UP012.py:74:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | 72 | )).encode() @@ -482,7 +524,7 @@ UP012.py:74:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -ℹ Safe fix +Suggested fix: 71 71 | "def" 72 72 | )).encode() 73 73 | @@ -492,6 +534,8 @@ UP012.py:74:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 76 76 | ("unicode text©").encode("utf-8") 77 77 | ("unicode text©").encode(encoding="utf-8") + Run `ruff check --fix` to apply this fix. + UP012.py:75:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | 74 | (f"foo{bar}").encode("utf-8") @@ -502,7 +546,7 @@ UP012.py:75:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -ℹ Safe fix +Suggested fix: 72 72 | )).encode() 73 73 | 74 74 | (f"foo{bar}").encode("utf-8") @@ -512,6 +556,8 @@ UP012.py:75:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 77 77 | ("unicode text©").encode(encoding="utf-8") 78 78 | + Run `ruff check --fix` to apply this fix. + UP012.py:76:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | 74 | (f"foo{bar}").encode("utf-8") @@ -522,7 +568,7 @@ UP012.py:76:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -ℹ Safe fix +Suggested fix: 73 73 | 74 74 | (f"foo{bar}").encode("utf-8") 75 75 | (f"foo{bar}").encode(encoding="utf-8") @@ -532,6 +578,8 @@ UP012.py:76:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 78 78 | 79 79 | + Run `ruff check --fix` to apply this fix. + UP012.py:77:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | 75 | (f"foo{bar}").encode(encoding="utf-8") @@ -541,7 +589,7 @@ UP012.py:77:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -ℹ Safe fix +Suggested fix: 74 74 | (f"foo{bar}").encode("utf-8") 75 75 | (f"foo{bar}").encode(encoding="utf-8") 76 76 | ("unicode text©").encode("utf-8") @@ -551,6 +599,8 @@ UP012.py:77:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 79 79 | 80 80 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459882 + Run `ruff check --fix` to apply this fix. + UP012.py:82:17: UP012 [*] Unnecessary call to `encode` as UTF-8 | 80 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459882 @@ -562,7 +612,7 @@ UP012.py:82:17: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 79 79 | 80 80 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459882 81 81 | def _match_ignore(line): @@ -572,6 +622,8 @@ UP012.py:82:17: UP012 [*] Unnecessary call to `encode` as UTF-8 84 84 | # Not a valid type annotation but this test shouldn't result in a panic. 85 85 | # Refer: https://github.com/astral-sh/ruff/issues/11736 + Run `ruff check --fix` to apply this fix. + UP012.py:86:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | 84 | # Not a valid type annotation but this test shouldn't result in a panic. @@ -581,9 +633,11 @@ UP012.py:86:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Safe fix +Suggested fix: 83 83 | 84 84 | # Not a valid type annotation but this test shouldn't result in a panic. 85 85 | # Refer: https://github.com/astral-sh/ruff/issues/11736 86 |-x: '"foo".encode("utf-8")' 86 |+x: 'b"foo"' + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap index d03ec38c485f4..e4f7999e05fd5 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap @@ -11,7 +11,7 @@ UP013.py:5:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class sy | = help: Convert `MyType` to class syntax -ℹ Safe fix +Suggested fix: 2 2 | import typing 3 3 | 4 4 | # dict literal @@ -23,6 +23,8 @@ UP013.py:5:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class sy 7 9 | # dict call 8 10 | MyType = TypedDict("MyType", dict(a=int, b=str)) + Run `ruff check --fix` to apply this fix. + UP013.py:8:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 7 | # dict call @@ -33,7 +35,7 @@ UP013.py:8:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class sy | = help: Convert `MyType` to class syntax -ℹ Safe fix +Suggested fix: 5 5 | MyType = TypedDict("MyType", {"a": int, "b": str}) 6 6 | 7 7 | # dict call @@ -45,6 +47,8 @@ UP013.py:8:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class sy 10 12 | # kwargs 11 13 | MyType = TypedDict("MyType", a=int, b=str) + Run `ruff check --fix` to apply this fix. + UP013.py:11:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 10 | # kwargs @@ -55,7 +59,7 @@ UP013.py:11:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Safe fix +Suggested fix: 8 8 | MyType = TypedDict("MyType", dict(a=int, b=str)) 9 9 | 10 10 | # kwargs @@ -67,6 +71,8 @@ UP013.py:11:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 13 15 | # Empty TypedDict 14 16 | MyType = TypedDict("MyType") + Run `ruff check --fix` to apply this fix. + UP013.py:14:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 13 | # Empty TypedDict @@ -77,7 +83,7 @@ UP013.py:14:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Safe fix +Suggested fix: 11 11 | MyType = TypedDict("MyType", a=int, b=str) 12 12 | 13 13 | # Empty TypedDict @@ -88,6 +94,8 @@ UP013.py:14:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 16 17 | # Literal values 17 18 | MyType = TypedDict("MyType", {"a": "hello"}) + Run `ruff check --fix` to apply this fix. + UP013.py:17:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 16 | # Literal values @@ -97,7 +105,7 @@ UP013.py:17:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Safe fix +Suggested fix: 14 14 | MyType = TypedDict("MyType") 15 15 | 16 16 | # Literal values @@ -108,6 +116,8 @@ UP013.py:17:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 19 20 | 20 21 | # NotRequired + Run `ruff check --fix` to apply this fix. + UP013.py:18:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 16 | # Literal values @@ -119,7 +129,7 @@ UP013.py:18:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Safe fix +Suggested fix: 15 15 | 16 16 | # Literal values 17 17 | MyType = TypedDict("MyType", {"a": "hello"}) @@ -130,6 +140,8 @@ UP013.py:18:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 20 21 | # NotRequired 21 22 | MyType = TypedDict("MyType", {"a": NotRequired[dict]}) + Run `ruff check --fix` to apply this fix. + UP013.py:21:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 20 | # NotRequired @@ -140,7 +152,7 @@ UP013.py:21:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Safe fix +Suggested fix: 18 18 | MyType = TypedDict("MyType", a="hello") 19 19 | 20 20 | # NotRequired @@ -151,6 +163,8 @@ UP013.py:21:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 23 24 | # total 24 25 | MyType = TypedDict("MyType", {"x": int, "y": int}, total=False) + Run `ruff check --fix` to apply this fix. + UP013.py:24:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 23 | # total @@ -161,7 +175,7 @@ UP013.py:24:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Safe fix +Suggested fix: 21 21 | MyType = TypedDict("MyType", {"a": NotRequired[dict]}) 22 22 | 23 23 | # total @@ -173,6 +187,8 @@ UP013.py:24:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 26 28 | # using Literal type 27 29 | MyType = TypedDict("MyType", {"key": Literal["value"]}) + Run `ruff check --fix` to apply this fix. + UP013.py:27:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 26 | # using Literal type @@ -183,7 +199,7 @@ UP013.py:27:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Safe fix +Suggested fix: 24 24 | MyType = TypedDict("MyType", {"x": int, "y": int}, total=False) 25 25 | 26 26 | # using Literal type @@ -194,6 +210,8 @@ UP013.py:27:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 29 30 | # using namespace TypedDict 30 31 | MyType = typing.TypedDict("MyType", {"key": int}) + Run `ruff check --fix` to apply this fix. + UP013.py:30:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 29 | # using namespace TypedDict @@ -204,7 +222,7 @@ UP013.py:30:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Safe fix +Suggested fix: 27 27 | MyType = TypedDict("MyType", {"key": Literal["value"]}) 28 28 | 29 29 | # using namespace TypedDict @@ -215,6 +233,8 @@ UP013.py:30:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 32 33 | # invalid identifiers (OK) 33 34 | MyType = TypedDict("MyType", {"in": int, "x-y": int}) + Run `ruff check --fix` to apply this fix. + UP013.py:40:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 39 | # Empty dict literal @@ -225,7 +245,7 @@ UP013.py:40:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Safe fix +Suggested fix: 37 37 | MyType = TypedDict("MyType", {"a": int, "b": str, **c}) 38 38 | 39 39 | # Empty dict literal @@ -236,6 +256,8 @@ UP013.py:40:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 42 43 | # Empty dict call 43 44 | MyType = TypedDict("MyType", dict()) + Run `ruff check --fix` to apply this fix. + UP013.py:43:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 42 | # Empty dict call @@ -244,7 +266,7 @@ UP013.py:43:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Safe fix +Suggested fix: 40 40 | MyType = TypedDict("MyType", {}) 41 41 | 42 42 | # Empty dict call @@ -252,4 +274,4 @@ UP013.py:43:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 43 |+class MyType(TypedDict): 44 |+ pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap index 71ce3308f55a5..773cef6361892 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap @@ -11,7 +11,7 @@ UP014.py:5:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class s | = help: Convert `MyType` to class syntax -ℹ Safe fix +Suggested fix: 2 2 | import typing 3 3 | 4 4 | # with complex annotations @@ -23,6 +23,8 @@ UP014.py:5:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class s 7 9 | # with namespace 8 10 | MyType = typing.NamedTuple("MyType", [("a", int), ("b", str)]) + Run `ruff check --fix` to apply this fix. + UP014.py:8:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax | 7 | # with namespace @@ -33,7 +35,7 @@ UP014.py:8:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class s | = help: Convert `MyType` to class syntax -ℹ Safe fix +Suggested fix: 5 5 | MyType = NamedTuple("MyType", [("a", int), ("b", tuple[str, ...])]) 6 6 | 7 7 | # with namespace @@ -45,6 +47,8 @@ UP014.py:8:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class s 10 12 | # invalid identifiers (OK) 11 13 | MyType = NamedTuple("MyType", [("x-y", int), ("b", tuple[str, ...])]) + Run `ruff check --fix` to apply this fix. + UP014.py:14:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax | 13 | # no fields @@ -55,7 +59,7 @@ UP014.py:14:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class | = help: Convert `MyType` to class syntax -ℹ Safe fix +Suggested fix: 11 11 | MyType = NamedTuple("MyType", [("x-y", int), ("b", tuple[str, ...])]) 12 12 | 13 13 | # no fields @@ -66,6 +70,8 @@ UP014.py:14:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class 16 17 | # empty fields 17 18 | MyType = typing.NamedTuple("MyType", []) + Run `ruff check --fix` to apply this fix. + UP014.py:17:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax | 16 | # empty fields @@ -76,7 +82,7 @@ UP014.py:17:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class | = help: Convert `MyType` to class syntax -ℹ Safe fix +Suggested fix: 14 14 | MyType = typing.NamedTuple("MyType") 15 15 | 16 16 | # empty fields @@ -87,6 +93,8 @@ UP014.py:17:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class 19 20 | # keywords 20 21 | MyType = typing.NamedTuple("MyType", a=int, b=tuple[str, ...]) + Run `ruff check --fix` to apply this fix. + UP014.py:20:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax | 19 | # keywords @@ -97,7 +105,7 @@ UP014.py:20:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class | = help: Convert `MyType` to class syntax -ℹ Safe fix +Suggested fix: 17 17 | MyType = typing.NamedTuple("MyType", []) 18 18 | 19 19 | # keywords @@ -109,4 +117,4 @@ UP014.py:20:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class 22 24 | # unfixable 23 25 | MyType = typing.NamedTuple("MyType", [("a", int)], [("b", str)]) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015.py.snap index d85977a74ec80..785acf0ef8d6a 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015.py.snap @@ -10,13 +10,15 @@ UP015.py:1:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 1 |-open("foo", "U") 1 |+open("foo") 2 2 | open("foo", "Ur") 3 3 | open("foo", "Ub") 4 4 | open("foo", "rUb") + Run `ruff check --fix` to apply this fix. + UP015.py:2:1: UP015 [*] Unnecessary open mode parameters | 1 | open("foo", "U") @@ -27,7 +29,7 @@ UP015.py:2:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 1 1 | open("foo", "U") 2 |-open("foo", "Ur") 2 |+open("foo") @@ -35,6 +37,8 @@ UP015.py:2:1: UP015 [*] Unnecessary open mode parameters 4 4 | open("foo", "rUb") 5 5 | open("foo", "r") + Run `ruff check --fix` to apply this fix. + UP015.py:3:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 1 | open("foo", "U") @@ -46,7 +50,7 @@ UP015.py:3:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 1 1 | open("foo", "U") 2 2 | open("foo", "Ur") 3 |-open("foo", "Ub") @@ -55,6 +59,8 @@ UP015.py:3:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 5 5 | open("foo", "r") 6 6 | open("foo", "rt") + Run `ruff check --fix` to apply this fix. + UP015.py:4:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 2 | open("foo", "Ur") @@ -66,7 +72,7 @@ UP015.py:4:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 1 1 | open("foo", "U") 2 2 | open("foo", "Ur") 3 3 | open("foo", "Ub") @@ -76,6 +82,8 @@ UP015.py:4:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 6 6 | open("foo", "rt") 7 7 | open("f", "r", encoding="UTF-8") + Run `ruff check --fix` to apply this fix. + UP015.py:5:1: UP015 [*] Unnecessary open mode parameters | 3 | open("foo", "Ub") @@ -87,7 +95,7 @@ UP015.py:5:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 2 2 | open("foo", "Ur") 3 3 | open("foo", "Ub") 4 4 | open("foo", "rUb") @@ -97,6 +105,8 @@ UP015.py:5:1: UP015 [*] Unnecessary open mode parameters 7 7 | open("f", "r", encoding="UTF-8") 8 8 | open("f", "wt") + Run `ruff check --fix` to apply this fix. + UP015.py:6:1: UP015 [*] Unnecessary open mode parameters | 4 | open("foo", "rUb") @@ -108,7 +118,7 @@ UP015.py:6:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 3 3 | open("foo", "Ub") 4 4 | open("foo", "rUb") 5 5 | open("foo", "r") @@ -118,6 +128,8 @@ UP015.py:6:1: UP015 [*] Unnecessary open mode parameters 8 8 | open("f", "wt") 9 9 | + Run `ruff check --fix` to apply this fix. + UP015.py:7:1: UP015 [*] Unnecessary open mode parameters | 5 | open("foo", "r") @@ -128,7 +140,7 @@ UP015.py:7:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 4 4 | open("foo", "rUb") 5 5 | open("foo", "r") 6 6 | open("foo", "rt") @@ -138,6 +150,8 @@ UP015.py:7:1: UP015 [*] Unnecessary open mode parameters 9 9 | 10 10 | with open("foo", "U") as f: + Run `ruff check --fix` to apply this fix. + UP015.py:8:1: UP015 [*] Unnecessary open mode parameters, use ""w"" | 6 | open("foo", "rt") @@ -149,7 +163,7 @@ UP015.py:8:1: UP015 [*] Unnecessary open mode parameters, use ""w"" | = help: Replace with ""w"" -ℹ Safe fix +Suggested fix: 5 5 | open("foo", "r") 6 6 | open("foo", "rt") 7 7 | open("f", "r", encoding="UTF-8") @@ -159,6 +173,8 @@ UP015.py:8:1: UP015 [*] Unnecessary open mode parameters, use ""w"" 10 10 | with open("foo", "U") as f: 11 11 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:10:6: UP015 [*] Unnecessary open mode parameters | 8 | open("f", "wt") @@ -170,7 +186,7 @@ UP015.py:10:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 7 7 | open("f", "r", encoding="UTF-8") 8 8 | open("f", "wt") 9 9 | @@ -180,6 +196,8 @@ UP015.py:10:6: UP015 [*] Unnecessary open mode parameters 12 12 | with open("foo", "Ur") as f: 13 13 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:12:6: UP015 [*] Unnecessary open mode parameters | 10 | with open("foo", "U") as f: @@ -191,7 +209,7 @@ UP015.py:12:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 9 9 | 10 10 | with open("foo", "U") as f: 11 11 | pass @@ -201,6 +219,8 @@ UP015.py:12:6: UP015 [*] Unnecessary open mode parameters 14 14 | with open("foo", "Ub") as f: 15 15 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:14:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 12 | with open("foo", "Ur") as f: @@ -212,7 +232,7 @@ UP015.py:14:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 11 11 | pass 12 12 | with open("foo", "Ur") as f: 13 13 | pass @@ -222,6 +242,8 @@ UP015.py:14:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" 16 16 | with open("foo", "rUb") as f: 17 17 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:16:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 14 | with open("foo", "Ub") as f: @@ -233,7 +255,7 @@ UP015.py:16:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 13 13 | pass 14 14 | with open("foo", "Ub") as f: 15 15 | pass @@ -243,6 +265,8 @@ UP015.py:16:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" 18 18 | with open("foo", "r") as f: 19 19 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:18:6: UP015 [*] Unnecessary open mode parameters | 16 | with open("foo", "rUb") as f: @@ -254,7 +278,7 @@ UP015.py:18:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 15 15 | pass 16 16 | with open("foo", "rUb") as f: 17 17 | pass @@ -264,6 +288,8 @@ UP015.py:18:6: UP015 [*] Unnecessary open mode parameters 20 20 | with open("foo", "rt") as f: 21 21 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:20:6: UP015 [*] Unnecessary open mode parameters | 18 | with open("foo", "r") as f: @@ -275,7 +301,7 @@ UP015.py:20:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 17 17 | pass 18 18 | with open("foo", "r") as f: 19 19 | pass @@ -285,6 +311,8 @@ UP015.py:20:6: UP015 [*] Unnecessary open mode parameters 22 22 | with open("foo", "r", encoding="UTF-8") as f: 23 23 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:22:6: UP015 [*] Unnecessary open mode parameters | 20 | with open("foo", "rt") as f: @@ -296,7 +324,7 @@ UP015.py:22:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 19 19 | pass 20 20 | with open("foo", "rt") as f: 21 21 | pass @@ -306,6 +334,8 @@ UP015.py:22:6: UP015 [*] Unnecessary open mode parameters 24 24 | with open("foo", "wt") as f: 25 25 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:24:6: UP015 [*] Unnecessary open mode parameters, use ""w"" | 22 | with open("foo", "r", encoding="UTF-8") as f: @@ -316,7 +346,7 @@ UP015.py:24:6: UP015 [*] Unnecessary open mode parameters, use ""w"" | = help: Replace with ""w"" -ℹ Safe fix +Suggested fix: 21 21 | pass 22 22 | with open("foo", "r", encoding="UTF-8") as f: 23 23 | pass @@ -326,6 +356,8 @@ UP015.py:24:6: UP015 [*] Unnecessary open mode parameters, use ""w"" 26 26 | 27 27 | open(f("a", "b", "c"), "U") + Run `ruff check --fix` to apply this fix. + UP015.py:27:1: UP015 [*] Unnecessary open mode parameters | 25 | pass @@ -336,7 +368,7 @@ UP015.py:27:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 24 24 | with open("foo", "wt") as f: 25 25 | pass 26 26 | @@ -346,6 +378,8 @@ UP015.py:27:1: UP015 [*] Unnecessary open mode parameters 29 29 | 30 30 | with open(f("a", "b", "c"), "U") as f: + Run `ruff check --fix` to apply this fix. + UP015.py:28:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 27 | open(f("a", "b", "c"), "U") @@ -356,7 +390,7 @@ UP015.py:28:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 25 25 | pass 26 26 | 27 27 | open(f("a", "b", "c"), "U") @@ -366,6 +400,8 @@ UP015.py:28:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 30 30 | with open(f("a", "b", "c"), "U") as f: 31 31 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:30:6: UP015 [*] Unnecessary open mode parameters | 28 | open(f("a", "b", "c"), "Ub") @@ -377,7 +413,7 @@ UP015.py:30:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 27 27 | open(f("a", "b", "c"), "U") 28 28 | open(f("a", "b", "c"), "Ub") 29 29 | @@ -387,6 +423,8 @@ UP015.py:30:6: UP015 [*] Unnecessary open mode parameters 32 32 | with open(f("a", "b", "c"), "Ub") as f: 33 33 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:32:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 30 | with open(f("a", "b", "c"), "U") as f: @@ -397,7 +435,7 @@ UP015.py:32:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 29 29 | 30 30 | with open(f("a", "b", "c"), "U") as f: 31 31 | pass @@ -407,6 +445,8 @@ UP015.py:32:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" 34 34 | 35 35 | with open("foo", "U") as fa, open("bar", "U") as fb: + Run `ruff check --fix` to apply this fix. + UP015.py:35:6: UP015 [*] Unnecessary open mode parameters | 33 | pass @@ -418,7 +458,7 @@ UP015.py:35:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 32 32 | with open(f("a", "b", "c"), "Ub") as f: 33 33 | pass 34 34 | @@ -428,6 +468,8 @@ UP015.py:35:6: UP015 [*] Unnecessary open mode parameters 37 37 | with open("foo", "Ub") as fa, open("bar", "Ub") as fb: 38 38 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:35:30: UP015 [*] Unnecessary open mode parameters | 33 | pass @@ -439,7 +481,7 @@ UP015.py:35:30: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 32 32 | with open(f("a", "b", "c"), "Ub") as f: 33 33 | pass 34 34 | @@ -449,6 +491,8 @@ UP015.py:35:30: UP015 [*] Unnecessary open mode parameters 37 37 | with open("foo", "Ub") as fa, open("bar", "Ub") as fb: 38 38 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:37:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 35 | with open("foo", "U") as fa, open("bar", "U") as fb: @@ -459,7 +503,7 @@ UP015.py:37:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 34 34 | 35 35 | with open("foo", "U") as fa, open("bar", "U") as fb: 36 36 | pass @@ -469,6 +513,8 @@ UP015.py:37:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" 39 39 | 40 40 | open("foo", mode="U") + Run `ruff check --fix` to apply this fix. + UP015.py:37:31: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 35 | with open("foo", "U") as fa, open("bar", "U") as fb: @@ -479,7 +525,7 @@ UP015.py:37:31: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 34 34 | 35 35 | with open("foo", "U") as fa, open("bar", "U") as fb: 36 36 | pass @@ -489,6 +535,8 @@ UP015.py:37:31: UP015 [*] Unnecessary open mode parameters, use ""rb"" 39 39 | 40 40 | open("foo", mode="U") + Run `ruff check --fix` to apply this fix. + UP015.py:40:1: UP015 [*] Unnecessary open mode parameters | 38 | pass @@ -500,7 +548,7 @@ UP015.py:40:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 37 37 | with open("foo", "Ub") as fa, open("bar", "Ub") as fb: 38 38 | pass 39 39 | @@ -510,6 +558,8 @@ UP015.py:40:1: UP015 [*] Unnecessary open mode parameters 42 42 | open(mode="U", name="foo") 43 43 | + Run `ruff check --fix` to apply this fix. + UP015.py:41:1: UP015 [*] Unnecessary open mode parameters | 40 | open("foo", mode="U") @@ -519,7 +569,7 @@ UP015.py:41:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 38 38 | pass 39 39 | 40 40 | open("foo", mode="U") @@ -529,6 +579,8 @@ UP015.py:41:1: UP015 [*] Unnecessary open mode parameters 43 43 | 44 44 | with open("foo", mode="U") as f: + Run `ruff check --fix` to apply this fix. + UP015.py:42:1: UP015 [*] Unnecessary open mode parameters | 40 | open("foo", mode="U") @@ -540,7 +592,7 @@ UP015.py:42:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 39 39 | 40 40 | open("foo", mode="U") 41 41 | open(name="foo", mode="U") @@ -550,6 +602,8 @@ UP015.py:42:1: UP015 [*] Unnecessary open mode parameters 44 44 | with open("foo", mode="U") as f: 45 45 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:44:6: UP015 [*] Unnecessary open mode parameters | 42 | open(mode="U", name="foo") @@ -561,7 +615,7 @@ UP015.py:44:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 41 41 | open(name="foo", mode="U") 42 42 | open(mode="U", name="foo") 43 43 | @@ -571,6 +625,8 @@ UP015.py:44:6: UP015 [*] Unnecessary open mode parameters 46 46 | with open(name="foo", mode="U") as f: 47 47 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:46:6: UP015 [*] Unnecessary open mode parameters | 44 | with open("foo", mode="U") as f: @@ -582,7 +638,7 @@ UP015.py:46:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 43 43 | 44 44 | with open("foo", mode="U") as f: 45 45 | pass @@ -592,6 +648,8 @@ UP015.py:46:6: UP015 [*] Unnecessary open mode parameters 48 48 | with open(mode="U", name="foo") as f: 49 49 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:48:6: UP015 [*] Unnecessary open mode parameters | 46 | with open(name="foo", mode="U") as f: @@ -602,7 +660,7 @@ UP015.py:48:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 45 45 | pass 46 46 | with open(name="foo", mode="U") as f: 47 47 | pass @@ -612,6 +670,8 @@ UP015.py:48:6: UP015 [*] Unnecessary open mode parameters 50 50 | 51 51 | open("foo", mode="Ub") + Run `ruff check --fix` to apply this fix. + UP015.py:51:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 49 | pass @@ -623,7 +683,7 @@ UP015.py:51:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 48 48 | with open(mode="U", name="foo") as f: 49 49 | pass 50 50 | @@ -633,6 +693,8 @@ UP015.py:51:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 53 53 | open(mode="Ub", name="foo") 54 54 | + Run `ruff check --fix` to apply this fix. + UP015.py:52:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 51 | open("foo", mode="Ub") @@ -642,7 +704,7 @@ UP015.py:52:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 49 49 | pass 50 50 | 51 51 | open("foo", mode="Ub") @@ -652,6 +714,8 @@ UP015.py:52:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 54 54 | 55 55 | with open("foo", mode="Ub") as f: + Run `ruff check --fix` to apply this fix. + UP015.py:53:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 51 | open("foo", mode="Ub") @@ -663,7 +727,7 @@ UP015.py:53:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 50 50 | 51 51 | open("foo", mode="Ub") 52 52 | open(name="foo", mode="Ub") @@ -673,6 +737,8 @@ UP015.py:53:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 55 55 | with open("foo", mode="Ub") as f: 56 56 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:55:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 53 | open(mode="Ub", name="foo") @@ -684,7 +750,7 @@ UP015.py:55:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 52 52 | open(name="foo", mode="Ub") 53 53 | open(mode="Ub", name="foo") 54 54 | @@ -694,6 +760,8 @@ UP015.py:55:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" 57 57 | with open(name="foo", mode="Ub") as f: 58 58 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:57:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 55 | with open("foo", mode="Ub") as f: @@ -705,7 +773,7 @@ UP015.py:57:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 54 54 | 55 55 | with open("foo", mode="Ub") as f: 56 56 | pass @@ -715,6 +783,8 @@ UP015.py:57:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" 59 59 | with open(mode="Ub", name="foo") as f: 60 60 | pass + Run `ruff check --fix` to apply this fix. + UP015.py:59:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 57 | with open(name="foo", mode="Ub") as f: @@ -725,7 +795,7 @@ UP015.py:59:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 56 56 | pass 57 57 | with open(name="foo", mode="Ub") as f: 58 58 | pass @@ -735,6 +805,8 @@ UP015.py:59:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" 61 61 | 62 62 | open(file="foo", mode='U', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) + Run `ruff check --fix` to apply this fix. + UP015.py:62:1: UP015 [*] Unnecessary open mode parameters | 60 | pass @@ -746,7 +818,7 @@ UP015.py:62:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 59 59 | with open(mode="Ub", name="foo") as f: 60 60 | pass 61 61 | @@ -756,6 +828,8 @@ UP015.py:62:1: UP015 [*] Unnecessary open mode parameters 64 64 | open(file="foo", buffering=-1, encoding=None, errors=None, mode='U', newline=None, closefd=True, opener=None) 65 65 | open(mode='U', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) + Run `ruff check --fix` to apply this fix. + UP015.py:63:1: UP015 [*] Unnecessary open mode parameters | 62 | open(file="foo", mode='U', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) @@ -766,7 +840,7 @@ UP015.py:63:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 60 60 | pass 61 61 | 62 62 | open(file="foo", mode='U', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) @@ -776,6 +850,8 @@ UP015.py:63:1: UP015 [*] Unnecessary open mode parameters 65 65 | open(mode='U', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 66 66 | + Run `ruff check --fix` to apply this fix. + UP015.py:64:1: UP015 [*] Unnecessary open mode parameters | 62 | open(file="foo", mode='U', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) @@ -786,7 +862,7 @@ UP015.py:64:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 61 61 | 62 62 | open(file="foo", mode='U', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 63 63 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='U') @@ -796,6 +872,8 @@ UP015.py:64:1: UP015 [*] Unnecessary open mode parameters 66 66 | 67 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) + Run `ruff check --fix` to apply this fix. + UP015.py:65:1: UP015 [*] Unnecessary open mode parameters | 63 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='U') @@ -807,7 +885,7 @@ UP015.py:65:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 62 62 | open(file="foo", mode='U', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 63 63 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='U') 64 64 | open(file="foo", buffering=-1, encoding=None, errors=None, mode='U', newline=None, closefd=True, opener=None) @@ -817,6 +895,8 @@ UP015.py:65:1: UP015 [*] Unnecessary open mode parameters 67 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 68 68 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='Ub') + Run `ruff check --fix` to apply this fix. + UP015.py:67:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 65 | open(mode='U', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) @@ -828,7 +908,7 @@ UP015.py:67:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 64 64 | open(file="foo", buffering=-1, encoding=None, errors=None, mode='U', newline=None, closefd=True, opener=None) 65 65 | open(mode='U', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 66 66 | @@ -838,6 +918,8 @@ UP015.py:67:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 69 69 | open(file="foo", buffering=-1, encoding=None, errors=None, mode='Ub', newline=None, closefd=True, opener=None) 70 70 | open(mode='Ub', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) + Run `ruff check --fix` to apply this fix. + UP015.py:68:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) @@ -848,7 +930,7 @@ UP015.py:68:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 65 65 | open(mode='U', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 66 66 | 67 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) @@ -858,6 +940,8 @@ UP015.py:68:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 70 70 | open(mode='Ub', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 71 71 | + Run `ruff check --fix` to apply this fix. + UP015.py:69:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) @@ -868,7 +952,7 @@ UP015.py:69:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 66 66 | 67 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 68 68 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='Ub') @@ -878,6 +962,8 @@ UP015.py:69:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 71 71 | 72 72 | open = 1 + Run `ruff check --fix` to apply this fix. + UP015.py:70:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 68 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='Ub') @@ -889,7 +975,7 @@ UP015.py:70:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Safe fix +Suggested fix: 67 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 68 68 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='Ub') 69 69 | open(file="foo", buffering=-1, encoding=None, errors=None, mode='Ub', newline=None, closefd=True, opener=None) @@ -899,4 +985,4 @@ UP015.py:70:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 72 72 | open = 1 73 73 | open("foo", "U") - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015_1.py.snap index 03a9caacb8921..527a088e672a0 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015_1.py.snap @@ -10,9 +10,11 @@ UP015_1.py:3:5: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Safe fix +Suggested fix: 1 1 | # Not a valid type annotation but this test shouldn't result in a panic. 2 2 | # Refer: https://github.com/astral-sh/ruff/issues/11736 3 |-x: 'open("foo", "r")' 3 |+x: 'open("foo")' -4 4 | +4 4 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP018.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP018.py.snap index a0a1f44188172..5b121f87a7833 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP018.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP018.py.snap @@ -11,7 +11,7 @@ UP018.py:37:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) | = help: Replace with string literal -ℹ Safe fix +Suggested fix: 34 34 | int().denominator 35 35 | 36 36 | # These become literals @@ -21,6 +21,8 @@ UP018.py:37:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) 39 39 | str(""" 40 40 | foo""") + Run `ruff check --fix` to apply this fix. + UP018.py:38:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) | 36 | # These become literals @@ -32,7 +34,7 @@ UP018.py:38:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) | = help: Replace with string literal -ℹ Safe fix +Suggested fix: 35 35 | 36 36 | # These become literals 37 37 | str() @@ -42,6 +44,8 @@ UP018.py:38:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) 40 40 | foo""") 41 41 | bytes() + Run `ruff check --fix` to apply this fix. + UP018.py:39:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) | 37 | str() @@ -54,7 +58,7 @@ UP018.py:39:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) | = help: Replace with string literal -ℹ Safe fix +Suggested fix: 36 36 | # These become literals 37 37 | str() 38 38 | str("foo") @@ -66,6 +70,8 @@ UP018.py:39:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) 42 42 | bytes(b"foo") 43 43 | bytes(b""" + Run `ruff check --fix` to apply this fix. + UP018.py:41:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) | 39 | str(""" @@ -77,7 +83,7 @@ UP018.py:41:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) | = help: Replace with bytes literal -ℹ Safe fix +Suggested fix: 38 38 | str("foo") 39 39 | str(""" 40 40 | foo""") @@ -87,6 +93,8 @@ UP018.py:41:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) 43 43 | bytes(b""" 44 44 | foo""") + Run `ruff check --fix` to apply this fix. + UP018.py:42:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) | 40 | foo""") @@ -98,7 +106,7 @@ UP018.py:42:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) | = help: Replace with bytes literal -ℹ Safe fix +Suggested fix: 39 39 | str(""" 40 40 | foo""") 41 41 | bytes() @@ -108,6 +116,8 @@ UP018.py:42:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) 44 44 | foo""") 45 45 | f"{str()}" + Run `ruff check --fix` to apply this fix. + UP018.py:43:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) | 41 | bytes() @@ -120,7 +130,7 @@ UP018.py:43:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) | = help: Replace with bytes literal -ℹ Safe fix +Suggested fix: 40 40 | foo""") 41 41 | bytes() 42 42 | bytes(b"foo") @@ -132,6 +142,8 @@ UP018.py:43:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) 46 46 | int() 47 47 | int(1) + Run `ruff check --fix` to apply this fix. + UP018.py:45:4: UP018 [*] Unnecessary `str` call (rewrite as a literal) | 43 | bytes(b""" @@ -143,7 +155,7 @@ UP018.py:45:4: UP018 [*] Unnecessary `str` call (rewrite as a literal) | = help: Replace with string literal -ℹ Safe fix +Suggested fix: 42 42 | bytes(b"foo") 43 43 | bytes(b""" 44 44 | foo""") @@ -153,6 +165,8 @@ UP018.py:45:4: UP018 [*] Unnecessary `str` call (rewrite as a literal) 47 47 | int(1) 48 48 | float() + Run `ruff check --fix` to apply this fix. + UP018.py:46:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | 44 | foo""") @@ -164,7 +178,7 @@ UP018.py:46:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | = help: Replace with integer literal -ℹ Safe fix +Suggested fix: 43 43 | bytes(b""" 44 44 | foo""") 45 45 | f"{str()}" @@ -174,6 +188,8 @@ UP018.py:46:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) 48 48 | float() 49 49 | float(1.0) + Run `ruff check --fix` to apply this fix. + UP018.py:47:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | 45 | f"{str()}" @@ -185,7 +201,7 @@ UP018.py:47:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | = help: Replace with integer literal -ℹ Safe fix +Suggested fix: 44 44 | foo""") 45 45 | f"{str()}" 46 46 | int() @@ -195,6 +211,8 @@ UP018.py:47:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) 49 49 | float(1.0) 50 50 | bool() + Run `ruff check --fix` to apply this fix. + UP018.py:48:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | 46 | int() @@ -206,7 +224,7 @@ UP018.py:48:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | = help: Replace with float literal -ℹ Safe fix +Suggested fix: 45 45 | f"{str()}" 46 46 | int() 47 47 | int(1) @@ -216,6 +234,8 @@ UP018.py:48:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) 50 50 | bool() 51 51 | bool(True) + Run `ruff check --fix` to apply this fix. + UP018.py:49:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | 47 | int(1) @@ -227,7 +247,7 @@ UP018.py:49:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | = help: Replace with float literal -ℹ Safe fix +Suggested fix: 46 46 | int() 47 47 | int(1) 48 48 | float() @@ -237,6 +257,8 @@ UP018.py:49:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) 51 51 | bool(True) 52 52 | bool(False) + Run `ruff check --fix` to apply this fix. + UP018.py:50:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) | 48 | float() @@ -248,7 +270,7 @@ UP018.py:50:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) | = help: Replace with boolean literal -ℹ Safe fix +Suggested fix: 47 47 | int(1) 48 48 | float() 49 49 | float(1.0) @@ -258,6 +280,8 @@ UP018.py:50:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) 52 52 | bool(False) 53 53 | + Run `ruff check --fix` to apply this fix. + UP018.py:51:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) | 49 | float(1.0) @@ -268,7 +292,7 @@ UP018.py:51:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) | = help: Replace with boolean literal -ℹ Safe fix +Suggested fix: 48 48 | float() 49 49 | float(1.0) 50 50 | bool() @@ -278,6 +302,8 @@ UP018.py:51:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) 53 53 | 54 54 | # These become a literal but retain parentheses + Run `ruff check --fix` to apply this fix. + UP018.py:52:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) | 50 | bool() @@ -289,7 +315,7 @@ UP018.py:52:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) | = help: Replace with boolean literal -ℹ Safe fix +Suggested fix: 49 49 | float(1.0) 50 50 | bool() 51 51 | bool(True) @@ -299,6 +325,8 @@ UP018.py:52:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) 54 54 | # These become a literal but retain parentheses 55 55 | int(1).denominator + Run `ruff check --fix` to apply this fix. + UP018.py:55:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | 54 | # These become a literal but retain parentheses @@ -309,7 +337,7 @@ UP018.py:55:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | = help: Replace with integer literal -ℹ Safe fix +Suggested fix: 52 52 | bool(False) 53 53 | 54 54 | # These become a literal but retain parentheses @@ -319,6 +347,8 @@ UP018.py:55:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) 57 57 | # These too are literals in spirit 58 58 | int(+1) + Run `ruff check --fix` to apply this fix. + UP018.py:58:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | 57 | # These too are literals in spirit @@ -329,7 +359,7 @@ UP018.py:58:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | = help: Replace with integer literal -ℹ Safe fix +Suggested fix: 55 55 | int(1).denominator 56 56 | 57 57 | # These too are literals in spirit @@ -339,6 +369,8 @@ UP018.py:58:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) 60 60 | float(+1.0) 61 61 | float(-1.0) + Run `ruff check --fix` to apply this fix. + UP018.py:59:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | 57 | # These too are literals in spirit @@ -350,7 +382,7 @@ UP018.py:59:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | = help: Replace with integer literal -ℹ Safe fix +Suggested fix: 56 56 | 57 57 | # These too are literals in spirit 58 58 | int(+1) @@ -359,6 +391,8 @@ UP018.py:59:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) 60 60 | float(+1.0) 61 61 | float(-1.0) + Run `ruff check --fix` to apply this fix. + UP018.py:60:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | 58 | int(+1) @@ -369,7 +403,7 @@ UP018.py:60:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | = help: Replace with float literal -ℹ Safe fix +Suggested fix: 57 57 | # These too are literals in spirit 58 58 | int(+1) 59 59 | int(-1) @@ -377,6 +411,8 @@ UP018.py:60:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) 60 |++1.0 61 61 | float(-1.0) + Run `ruff check --fix` to apply this fix. + UP018.py:61:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | 59 | int(-1) @@ -386,11 +422,11 @@ UP018.py:61:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | = help: Replace with float literal -ℹ Safe fix +Suggested fix: 58 58 | int(+1) 59 59 | int(-1) 60 60 | float(+1.0) 61 |-float(-1.0) 61 |+-1.0 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP019.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP019.py.snap index 389ee5e9736a5..50ef49e1b8141 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP019.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP019.py.snap @@ -9,7 +9,7 @@ UP019.py:7:22: UP019 [*] `typing.Text` is deprecated, use `str` | = help: Replace with `str` -ℹ Safe fix +Suggested fix: 4 4 | from typing import Text as Goodbye 5 5 | 6 6 | @@ -19,6 +19,8 @@ UP019.py:7:22: UP019 [*] `typing.Text` is deprecated, use `str` 9 9 | 10 10 | + Run `ruff check --fix` to apply this fix. + UP019.py:11:29: UP019 [*] `typing.Text` is deprecated, use `str` | 11 | def print_second_word(word: typing.Text) -> None: @@ -27,7 +29,7 @@ UP019.py:11:29: UP019 [*] `typing.Text` is deprecated, use `str` | = help: Replace with `str` -ℹ Safe fix +Suggested fix: 8 8 | print(word) 9 9 | 10 10 | @@ -37,6 +39,8 @@ UP019.py:11:29: UP019 [*] `typing.Text` is deprecated, use `str` 13 13 | 14 14 | + Run `ruff check --fix` to apply this fix. + UP019.py:15:28: UP019 [*] `typing.Text` is deprecated, use `str` | 15 | def print_third_word(word: Hello.Text) -> None: @@ -45,7 +49,7 @@ UP019.py:15:28: UP019 [*] `typing.Text` is deprecated, use `str` | = help: Replace with `str` -ℹ Safe fix +Suggested fix: 12 12 | print(word) 13 13 | 14 14 | @@ -55,6 +59,8 @@ UP019.py:15:28: UP019 [*] `typing.Text` is deprecated, use `str` 17 17 | 18 18 | + Run `ruff check --fix` to apply this fix. + UP019.py:19:29: UP019 [*] `typing.Text` is deprecated, use `str` | 19 | def print_fourth_word(word: Goodbye) -> None: @@ -63,7 +69,7 @@ UP019.py:19:29: UP019 [*] `typing.Text` is deprecated, use `str` | = help: Replace with `str` -ℹ Safe fix +Suggested fix: 16 16 | print(word) 17 17 | 18 18 | @@ -71,4 +77,4 @@ UP019.py:19:29: UP019 [*] `typing.Text` is deprecated, use `str` 19 |+def print_fourth_word(word: str) -> None: 20 20 | print(word) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap index d8d5ed3948468..deed6b05160bd 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap @@ -11,7 +11,7 @@ UP020.py:3:6: UP020 [*] Use builtin `open` | = help: Replace with builtin `open` -ℹ Safe fix +Suggested fix: 1 1 | import io 2 2 | 3 |-with io.open("f.txt", mode="r", buffering=-1, **kwargs) as f: @@ -20,6 +20,8 @@ UP020.py:3:6: UP020 [*] Use builtin `open` 5 5 | 6 6 | from io import open + Run `ruff check --fix` to apply this fix. + UP020.py:8:6: UP020 [*] Use builtin `open` | 6 | from io import open @@ -30,7 +32,7 @@ UP020.py:8:6: UP020 [*] Use builtin `open` | = help: Replace with builtin `open` -ℹ Safe fix +Suggested fix: 4 4 | print(f.read()) 5 5 | 6 6 | from io import open @@ -39,3 +41,5 @@ UP020.py:8:6: UP020 [*] Use builtin `open` 8 |-with open("f.txt") as f: 9 |+with builtins.open("f.txt") as f: 9 10 | print(f.read()) + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap index 128a9c9d7396a..251eb3828305e 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap @@ -11,7 +11,7 @@ UP021.py:5:25: UP021 [*] `universal_newlines` is deprecated, use `text` | = help: Replace with `text` keyword argument -ℹ Safe fix +Suggested fix: 2 2 | from subprocess import run 3 3 | 4 4 | # Errors @@ -21,6 +21,8 @@ UP021.py:5:25: UP021 [*] `universal_newlines` is deprecated, use `text` 7 7 | run(["foo"], universal_newlines=True, check=False) 8 8 | + Run `ruff check --fix` to apply this fix. + UP021.py:6:25: UP021 [*] `universal_newlines` is deprecated, use `text` | 4 | # Errors @@ -31,7 +33,7 @@ UP021.py:6:25: UP021 [*] `universal_newlines` is deprecated, use `text` | = help: Replace with `text` keyword argument -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | # Errors 5 5 | subprocess.run(["foo"], universal_newlines=True, check=True) @@ -41,6 +43,8 @@ UP021.py:6:25: UP021 [*] `universal_newlines` is deprecated, use `text` 8 8 | 9 9 | # OK + Run `ruff check --fix` to apply this fix. + UP021.py:7:14: UP021 [*] `universal_newlines` is deprecated, use `text` | 5 | subprocess.run(["foo"], universal_newlines=True, check=True) @@ -52,7 +56,7 @@ UP021.py:7:14: UP021 [*] `universal_newlines` is deprecated, use `text` | = help: Replace with `text` keyword argument -ℹ Safe fix +Suggested fix: 4 4 | # Errors 5 5 | subprocess.run(["foo"], universal_newlines=True, check=True) 6 6 | subprocess.run(["foo"], universal_newlines=True, text=True) @@ -62,4 +66,4 @@ UP021.py:7:14: UP021 [*] `universal_newlines` is deprecated, use `text` 9 9 | # OK 10 10 | subprocess.run(["foo"], check=True) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap index c6680d1ce5277..ff44f225e512b 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap @@ -12,7 +12,7 @@ UP022.py:4:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stde | = help: Replace with `capture_output` keyword argument -ℹ Unsafe fix +Suggested fix: 1 1 | from subprocess import run 2 2 | import subprocess 3 3 | @@ -22,6 +22,8 @@ UP022.py:4:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stde 6 6 | output = subprocess.run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 7 7 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP022.py:6:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | 4 | output = run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -33,7 +35,7 @@ UP022.py:6:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stde | = help: Replace with `capture_output` keyword argument -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | output = run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 5 5 | @@ -43,6 +45,8 @@ UP022.py:6:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stde 8 8 | output = subprocess.run(stdout=subprocess.PIPE, args=["foo"], stderr=subprocess.PIPE) 9 9 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP022.py:8:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | 6 | output = subprocess.run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -54,7 +58,7 @@ UP022.py:8:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stde | = help: Replace with `capture_output` keyword argument -ℹ Unsafe fix +Suggested fix: 5 5 | 6 6 | output = subprocess.run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 7 7 | @@ -64,6 +68,8 @@ UP022.py:8:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stde 10 10 | output = subprocess.run( 11 11 | ["foo"], stdout=subprocess.PIPE, check=True, stderr=subprocess.PIPE + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP022.py:10:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | 8 | output = subprocess.run(stdout=subprocess.PIPE, args=["foo"], stderr=subprocess.PIPE) @@ -78,7 +84,7 @@ UP022.py:10:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `std | = help: Replace with `capture_output` keyword argument -ℹ Unsafe fix +Suggested fix: 8 8 | output = subprocess.run(stdout=subprocess.PIPE, args=["foo"], stderr=subprocess.PIPE) 9 9 | 10 10 | output = subprocess.run( @@ -88,6 +94,8 @@ UP022.py:10:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `std 13 13 | 14 14 | output = subprocess.run( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP022.py:14:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | 12 | ) @@ -102,7 +110,7 @@ UP022.py:14:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `std | = help: Replace with `capture_output` keyword argument -ℹ Unsafe fix +Suggested fix: 12 12 | ) 13 13 | 14 14 | output = subprocess.run( @@ -112,6 +120,8 @@ UP022.py:14:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `std 17 17 | 18 18 | output = subprocess.run( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP022.py:18:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | 16 | ) @@ -132,7 +142,7 @@ UP022.py:18:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `std | = help: Replace with `capture_output` keyword argument -ℹ Unsafe fix +Suggested fix: 17 17 | 18 18 | output = subprocess.run( 19 19 | ["foo"], @@ -144,6 +154,8 @@ UP022.py:18:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `std 24 23 | encoding="utf-8", 25 24 | close_fds=True, + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP022.py:29:14: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | 28 | if output: @@ -162,7 +174,7 @@ UP022.py:29:14: UP022 [*] Prefer `capture_output` over sending `stdout` and `std | = help: Replace with `capture_output` keyword argument -ℹ Unsafe fix +Suggested fix: 28 28 | if output: 29 29 | output = subprocess.run( 30 30 | ["foo"], @@ -174,6 +186,8 @@ UP022.py:29:14: UP022 [*] Prefer `capture_output` over sending `stdout` and `std 35 34 | encoding="utf-8", 36 35 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP022.py:38:10: UP022 Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | 36 | ) @@ -215,5 +229,3 @@ UP022.py:46:10: UP022 Prefer `capture_output` over sending `stdout` and `stderr` 50 | # OK | = help: Replace with `capture_output` keyword argument - - diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap index 2f5d2cb75b5af..8df712e79458e 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap @@ -10,7 +10,7 @@ UP023.py:2:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Safe fix +Suggested fix: 1 1 | # These two imports have something after cElementTree, so they should be fixed. 2 |-from xml.etree.cElementTree import XML, Element, SubElement 2 |+from xml.etree.ElementTree import XML, Element, SubElement @@ -18,6 +18,8 @@ UP023.py:2:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 4 4 | 5 5 | # Weird spacing should not cause issues. + Run `ruff check --fix` to apply this fix. + UP023.py:3:8: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 1 | # These two imports have something after cElementTree, so they should be fixed. @@ -29,7 +31,7 @@ UP023.py:3:8: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Safe fix +Suggested fix: 1 1 | # These two imports have something after cElementTree, so they should be fixed. 2 2 | from xml.etree.cElementTree import XML, Element, SubElement 3 |-import xml.etree.cElementTree as ET @@ -38,6 +40,8 @@ UP023.py:3:8: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 5 5 | # Weird spacing should not cause issues. 6 6 | from xml.etree.cElementTree import XML + Run `ruff check --fix` to apply this fix. + UP023.py:6:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 5 | # Weird spacing should not cause issues. @@ -47,7 +51,7 @@ UP023.py:6:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Safe fix +Suggested fix: 3 3 | import xml.etree.cElementTree as ET 4 4 | 5 5 | # Weird spacing should not cause issues. @@ -57,6 +61,8 @@ UP023.py:6:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 8 8 | 9 9 | # Multi line imports should also work fine. + Run `ruff check --fix` to apply this fix. + UP023.py:7:11: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 5 | # Weird spacing should not cause issues. @@ -68,7 +74,7 @@ UP023.py:7:11: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | # Weird spacing should not cause issues. 6 6 | from xml.etree.cElementTree import XML @@ -78,6 +84,8 @@ UP023.py:7:11: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 9 9 | # Multi line imports should also work fine. 10 10 | from xml.etree.cElementTree import ( + Run `ruff check --fix` to apply this fix. + UP023.py:10:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 9 | # Multi line imports should also work fine. @@ -92,7 +100,7 @@ UP023.py:10:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Safe fix +Suggested fix: 7 7 | import xml.etree.cElementTree as ET 8 8 | 9 9 | # Multi line imports should also work fine. @@ -102,6 +110,8 @@ UP023.py:10:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 12 12 | Element, 13 13 | SubElement, + Run `ruff check --fix` to apply this fix. + UP023.py:16:12: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 14 | ) @@ -112,7 +122,7 @@ UP023.py:16:12: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Safe fix +Suggested fix: 13 13 | SubElement, 14 14 | ) 15 15 | if True: @@ -122,6 +132,8 @@ UP023.py:16:12: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 18 18 | 19 19 | from xml.etree import cElementTree as ET + Run `ruff check --fix` to apply this fix. + UP023.py:17:27: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 15 | if True: @@ -133,7 +145,7 @@ UP023.py:17:27: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Safe fix +Suggested fix: 14 14 | ) 15 15 | if True: 16 16 | import xml.etree.cElementTree as ET @@ -143,6 +155,8 @@ UP023.py:17:27: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 19 19 | from xml.etree import cElementTree as ET 20 20 | + Run `ruff check --fix` to apply this fix. + UP023.py:19:23: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 17 | from xml.etree import cElementTree as CET @@ -154,7 +168,7 @@ UP023.py:19:23: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Safe fix +Suggested fix: 16 16 | import xml.etree.cElementTree as ET 17 17 | from xml.etree import cElementTree as CET 18 18 | @@ -164,6 +178,8 @@ UP023.py:19:23: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 21 21 | import contextlib, xml.etree.cElementTree as ET 22 22 | + Run `ruff check --fix` to apply this fix. + UP023.py:21:20: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 19 | from xml.etree import cElementTree as ET @@ -175,7 +191,7 @@ UP023.py:21:20: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Safe fix +Suggested fix: 18 18 | 19 19 | from xml.etree import cElementTree as ET 20 20 | @@ -185,6 +201,8 @@ UP023.py:21:20: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 23 23 | # This should fix the second, but not the first invocation. 24 24 | import xml.etree.cElementTree, xml.etree.cElementTree as ET + Run `ruff check --fix` to apply this fix. + UP023.py:24:32: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 23 | # This should fix the second, but not the first invocation. @@ -195,7 +213,7 @@ UP023.py:24:32: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Safe fix +Suggested fix: 21 21 | import contextlib, xml.etree.cElementTree as ET 22 22 | 23 23 | # This should fix the second, but not the first invocation. @@ -205,4 +223,4 @@ UP023.py:24:32: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 26 26 | # The below items should NOT be changed. 27 27 | import xml.etree.cElementTree - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_0.py.snap index bb7879fbc7c06..51562dec82951 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_0.py.snap @@ -11,7 +11,7 @@ UP024_0.py:6:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `EnvironmentError` with builtin `OSError` -ℹ Safe fix +Suggested fix: 3 3 | # These should be fixed 4 4 | try: 5 5 | pass @@ -21,6 +21,8 @@ UP024_0.py:6:8: UP024 [*] Replace aliased errors with `OSError` 8 8 | 9 9 | try: + Run `ruff check --fix` to apply this fix. + UP024_0.py:11:8: UP024 [*] Replace aliased errors with `OSError` | 9 | try: @@ -31,7 +33,7 @@ UP024_0.py:11:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `IOError` with builtin `OSError` -ℹ Safe fix +Suggested fix: 8 8 | 9 9 | try: 10 10 | pass @@ -41,6 +43,8 @@ UP024_0.py:11:8: UP024 [*] Replace aliased errors with `OSError` 13 13 | 14 14 | try: + Run `ruff check --fix` to apply this fix. + UP024_0.py:16:8: UP024 [*] Replace aliased errors with `OSError` | 14 | try: @@ -51,7 +55,7 @@ UP024_0.py:16:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `WindowsError` with builtin `OSError` -ℹ Safe fix +Suggested fix: 13 13 | 14 14 | try: 15 15 | pass @@ -61,6 +65,8 @@ UP024_0.py:16:8: UP024 [*] Replace aliased errors with `OSError` 18 18 | 19 19 | try: + Run `ruff check --fix` to apply this fix. + UP024_0.py:21:8: UP024 [*] Replace aliased errors with `OSError` | 19 | try: @@ -71,7 +77,7 @@ UP024_0.py:21:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `mmap.error` with builtin `OSError` -ℹ Safe fix +Suggested fix: 18 18 | 19 19 | try: 20 20 | pass @@ -81,6 +87,8 @@ UP024_0.py:21:8: UP024 [*] Replace aliased errors with `OSError` 23 23 | 24 24 | try: + Run `ruff check --fix` to apply this fix. + UP024_0.py:26:8: UP024 [*] Replace aliased errors with `OSError` | 24 | try: @@ -91,7 +99,7 @@ UP024_0.py:26:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `select.error` with builtin `OSError` -ℹ Safe fix +Suggested fix: 23 23 | 24 24 | try: 25 25 | pass @@ -101,6 +109,8 @@ UP024_0.py:26:8: UP024 [*] Replace aliased errors with `OSError` 28 28 | 29 29 | try: + Run `ruff check --fix` to apply this fix. + UP024_0.py:31:8: UP024 [*] Replace aliased errors with `OSError` | 29 | try: @@ -111,7 +121,7 @@ UP024_0.py:31:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `socket.error` with builtin `OSError` -ℹ Safe fix +Suggested fix: 28 28 | 29 29 | try: 30 30 | pass @@ -121,6 +131,8 @@ UP024_0.py:31:8: UP024 [*] Replace aliased errors with `OSError` 33 33 | 34 34 | try: + Run `ruff check --fix` to apply this fix. + UP024_0.py:36:8: UP024 [*] Replace aliased errors with `OSError` | 34 | try: @@ -131,7 +143,7 @@ UP024_0.py:36:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `error` with builtin `OSError` -ℹ Safe fix +Suggested fix: 33 33 | 34 34 | try: 35 35 | pass @@ -141,6 +153,8 @@ UP024_0.py:36:8: UP024 [*] Replace aliased errors with `OSError` 38 38 | 39 39 | # Should NOT be in parentheses when replaced + Run `ruff check --fix` to apply this fix. + UP024_0.py:43:8: UP024 [*] Replace aliased errors with `OSError` | 41 | try: @@ -152,7 +166,7 @@ UP024_0.py:43:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Safe fix +Suggested fix: 40 40 | 41 41 | try: 42 42 | pass @@ -162,6 +176,8 @@ UP024_0.py:43:8: UP024 [*] Replace aliased errors with `OSError` 45 45 | try: 46 46 | pass + Run `ruff check --fix` to apply this fix. + UP024_0.py:47:8: UP024 [*] Replace aliased errors with `OSError` | 45 | try: @@ -173,7 +189,7 @@ UP024_0.py:47:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Safe fix +Suggested fix: 44 44 | pass 45 45 | try: 46 46 | pass @@ -183,6 +199,8 @@ UP024_0.py:47:8: UP024 [*] Replace aliased errors with `OSError` 49 49 | try: 50 50 | pass + Run `ruff check --fix` to apply this fix. + UP024_0.py:51:8: UP024 [*] Replace aliased errors with `OSError` | 49 | try: @@ -193,7 +211,7 @@ UP024_0.py:51:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Safe fix +Suggested fix: 48 48 | pass 49 49 | try: 50 50 | pass @@ -203,6 +221,8 @@ UP024_0.py:51:8: UP024 [*] Replace aliased errors with `OSError` 53 53 | 54 54 | # Should be kept in parentheses (because multiple) + Run `ruff check --fix` to apply this fix. + UP024_0.py:58:8: UP024 [*] Replace aliased errors with `OSError` | 56 | try: @@ -213,7 +233,7 @@ UP024_0.py:58:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Safe fix +Suggested fix: 55 55 | 56 56 | try: 57 57 | pass @@ -223,6 +243,8 @@ UP024_0.py:58:8: UP024 [*] Replace aliased errors with `OSError` 60 60 | 61 61 | # First should change, second should not + Run `ruff check --fix` to apply this fix. + UP024_0.py:65:8: UP024 [*] Replace aliased errors with `OSError` | 63 | try: @@ -234,7 +256,7 @@ UP024_0.py:65:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Safe fix +Suggested fix: 62 62 | from .mmap import error 63 63 | try: 64 64 | pass @@ -244,6 +266,8 @@ UP024_0.py:65:8: UP024 [*] Replace aliased errors with `OSError` 67 67 | # These should not change 68 68 | + Run `ruff check --fix` to apply this fix. + UP024_0.py:87:8: UP024 [*] Replace aliased errors with `OSError` | 85 | try: @@ -254,7 +278,7 @@ UP024_0.py:87:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `mmap.error` with builtin `OSError` -ℹ Safe fix +Suggested fix: 84 84 | pass 85 85 | try: 86 86 | pass @@ -264,6 +288,8 @@ UP024_0.py:87:8: UP024 [*] Replace aliased errors with `OSError` 89 89 | 90 90 | try: + Run `ruff check --fix` to apply this fix. + UP024_0.py:105:11: UP024 [*] Replace aliased errors with `OSError` | 103 | try: @@ -274,7 +300,7 @@ UP024_0.py:105:11: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Safe fix +Suggested fix: 102 102 | def get_owner_id_from_mac_address(): 103 103 | try: 104 104 | mac_address = get_primary_mac_address() @@ -284,6 +310,8 @@ UP024_0.py:105:11: UP024 [*] Replace aliased errors with `OSError` 107 107 | 108 108 | + Run `ruff check --fix` to apply this fix. + UP024_0.py:114:8: UP024 [*] Replace aliased errors with `OSError` | 112 | try: @@ -294,7 +322,7 @@ UP024_0.py:114:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `os.error` with builtin `OSError` -ℹ Safe fix +Suggested fix: 111 111 | 112 112 | try: 113 113 | pass @@ -302,4 +330,4 @@ UP024_0.py:114:8: UP024 [*] Replace aliased errors with `OSError` 114 |+except OSError: 115 115 | pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_1.py.snap index d0a723a1b9f67..ed5e43c8a3662 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_1.py.snap @@ -12,7 +12,7 @@ UP024_1.py:5:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | try: 4 4 | pass @@ -22,6 +22,8 @@ UP024_1.py:5:8: UP024 [*] Replace aliased errors with `OSError` 7 7 | except (OSError, socket.error, KeyError): 8 8 | pass + Run `ruff check --fix` to apply this fix. + UP024_1.py:7:8: UP024 [*] Replace aliased errors with `OSError` | 5 | except (OSError, mmap.error, IOError): @@ -32,7 +34,7 @@ UP024_1.py:7:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Safe fix +Suggested fix: 4 4 | pass 5 5 | except (OSError, mmap.error, IOError): 6 6 | pass @@ -42,6 +44,8 @@ UP024_1.py:7:8: UP024 [*] Replace aliased errors with `OSError` 9 9 | 10 10 | try: + Run `ruff check --fix` to apply this fix. + UP024_1.py:12:8: UP024 [*] Replace aliased errors with `OSError` | 10 | try: @@ -57,7 +61,7 @@ UP024_1.py:12:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Safe fix +Suggested fix: 9 9 | 10 10 | try: 11 11 | pass @@ -69,4 +73,4 @@ UP024_1.py:12:8: UP024 [*] Replace aliased errors with `OSError` 12 |+except OSError: 17 13 | pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_2.py.snap index eecdf5fea5e17..dab440351e81e 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_2.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_2.py.snap @@ -12,7 +12,7 @@ UP024_2.py:10:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `socket.error` with builtin `OSError` -ℹ Safe fix +Suggested fix: 7 7 | 8 8 | # Testing the modules 9 9 | import socket, mmap, select @@ -22,6 +22,8 @@ UP024_2.py:10:7: UP024 [*] Replace aliased errors with `OSError` 12 12 | raise select.error 13 13 | + Run `ruff check --fix` to apply this fix. + UP024_2.py:11:7: UP024 [*] Replace aliased errors with `OSError` | 9 | import socket, mmap, select @@ -32,7 +34,7 @@ UP024_2.py:11:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `mmap.error` with builtin `OSError` -ℹ Safe fix +Suggested fix: 8 8 | # Testing the modules 9 9 | import socket, mmap, select 10 10 | raise socket.error @@ -42,6 +44,8 @@ UP024_2.py:11:7: UP024 [*] Replace aliased errors with `OSError` 13 13 | 14 14 | raise socket.error() + Run `ruff check --fix` to apply this fix. + UP024_2.py:12:7: UP024 [*] Replace aliased errors with `OSError` | 10 | raise socket.error @@ -53,7 +57,7 @@ UP024_2.py:12:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `select.error` with builtin `OSError` -ℹ Safe fix +Suggested fix: 9 9 | import socket, mmap, select 10 10 | raise socket.error 11 11 | raise mmap.error @@ -63,6 +67,8 @@ UP024_2.py:12:7: UP024 [*] Replace aliased errors with `OSError` 14 14 | raise socket.error() 15 15 | raise mmap.error(1) + Run `ruff check --fix` to apply this fix. + UP024_2.py:14:7: UP024 [*] Replace aliased errors with `OSError` | 12 | raise select.error @@ -74,7 +80,7 @@ UP024_2.py:14:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `socket.error` with builtin `OSError` -ℹ Safe fix +Suggested fix: 11 11 | raise mmap.error 12 12 | raise select.error 13 13 | @@ -84,6 +90,8 @@ UP024_2.py:14:7: UP024 [*] Replace aliased errors with `OSError` 16 16 | raise select.error(1, 2) 17 17 | + Run `ruff check --fix` to apply this fix. + UP024_2.py:15:7: UP024 [*] Replace aliased errors with `OSError` | 14 | raise socket.error() @@ -93,7 +101,7 @@ UP024_2.py:15:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `mmap.error` with builtin `OSError` -ℹ Safe fix +Suggested fix: 12 12 | raise select.error 13 13 | 14 14 | raise socket.error() @@ -103,6 +111,8 @@ UP024_2.py:15:7: UP024 [*] Replace aliased errors with `OSError` 17 17 | 18 18 | raise socket.error( + Run `ruff check --fix` to apply this fix. + UP024_2.py:16:7: UP024 [*] Replace aliased errors with `OSError` | 14 | raise socket.error() @@ -114,7 +124,7 @@ UP024_2.py:16:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `select.error` with builtin `OSError` -ℹ Safe fix +Suggested fix: 13 13 | 14 14 | raise socket.error() 15 15 | raise mmap.error(1) @@ -124,6 +134,8 @@ UP024_2.py:16:7: UP024 [*] Replace aliased errors with `OSError` 18 18 | raise socket.error( 19 19 | 1, + Run `ruff check --fix` to apply this fix. + UP024_2.py:18:7: UP024 [*] Replace aliased errors with `OSError` | 16 | raise select.error(1, 2) @@ -135,7 +147,7 @@ UP024_2.py:18:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `socket.error` with builtin `OSError` -ℹ Safe fix +Suggested fix: 15 15 | raise mmap.error(1) 16 16 | raise select.error(1, 2) 17 17 | @@ -145,6 +157,8 @@ UP024_2.py:18:7: UP024 [*] Replace aliased errors with `OSError` 20 20 | 2, 21 21 | 3, + Run `ruff check --fix` to apply this fix. + UP024_2.py:25:7: UP024 [*] Replace aliased errors with `OSError` | 24 | from mmap import error @@ -155,7 +169,7 @@ UP024_2.py:25:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `error` with builtin `OSError` -ℹ Safe fix +Suggested fix: 22 22 | ) 23 23 | 24 24 | from mmap import error @@ -165,6 +179,8 @@ UP024_2.py:25:7: UP024 [*] Replace aliased errors with `OSError` 27 27 | from socket import error 28 28 | raise error(1) + Run `ruff check --fix` to apply this fix. + UP024_2.py:28:7: UP024 [*] Replace aliased errors with `OSError` | 27 | from socket import error @@ -175,7 +191,7 @@ UP024_2.py:28:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `error` with builtin `OSError` -ℹ Safe fix +Suggested fix: 25 25 | raise error 26 26 | 27 27 | from socket import error @@ -185,6 +201,8 @@ UP024_2.py:28:7: UP024 [*] Replace aliased errors with `OSError` 30 30 | from select import error 31 31 | raise error(1, 2) + Run `ruff check --fix` to apply this fix. + UP024_2.py:31:7: UP024 [*] Replace aliased errors with `OSError` | 30 | from select import error @@ -195,7 +213,7 @@ UP024_2.py:31:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `error` with builtin `OSError` -ℹ Safe fix +Suggested fix: 28 28 | raise error(1) 29 29 | 30 30 | from select import error @@ -205,6 +223,8 @@ UP024_2.py:31:7: UP024 [*] Replace aliased errors with `OSError` 33 33 | # Testing the names 34 34 | raise EnvironmentError + Run `ruff check --fix` to apply this fix. + UP024_2.py:34:7: UP024 [*] Replace aliased errors with `OSError` | 33 | # Testing the names @@ -215,7 +235,7 @@ UP024_2.py:34:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `EnvironmentError` with builtin `OSError` -ℹ Safe fix +Suggested fix: 31 31 | raise error(1, 2) 32 32 | 33 33 | # Testing the names @@ -225,6 +245,8 @@ UP024_2.py:34:7: UP024 [*] Replace aliased errors with `OSError` 36 36 | raise WindowsError 37 37 | + Run `ruff check --fix` to apply this fix. + UP024_2.py:35:7: UP024 [*] Replace aliased errors with `OSError` | 33 | # Testing the names @@ -235,7 +257,7 @@ UP024_2.py:35:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `IOError` with builtin `OSError` -ℹ Safe fix +Suggested fix: 32 32 | 33 33 | # Testing the names 34 34 | raise EnvironmentError @@ -245,6 +267,8 @@ UP024_2.py:35:7: UP024 [*] Replace aliased errors with `OSError` 37 37 | 38 38 | raise EnvironmentError() + Run `ruff check --fix` to apply this fix. + UP024_2.py:36:7: UP024 [*] Replace aliased errors with `OSError` | 34 | raise EnvironmentError @@ -256,7 +280,7 @@ UP024_2.py:36:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `WindowsError` with builtin `OSError` -ℹ Safe fix +Suggested fix: 33 33 | # Testing the names 34 34 | raise EnvironmentError 35 35 | raise IOError @@ -266,6 +290,8 @@ UP024_2.py:36:7: UP024 [*] Replace aliased errors with `OSError` 38 38 | raise EnvironmentError() 39 39 | raise IOError(1) + Run `ruff check --fix` to apply this fix. + UP024_2.py:38:7: UP024 [*] Replace aliased errors with `OSError` | 36 | raise WindowsError @@ -277,7 +303,7 @@ UP024_2.py:38:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `EnvironmentError` with builtin `OSError` -ℹ Safe fix +Suggested fix: 35 35 | raise IOError 36 36 | raise WindowsError 37 37 | @@ -287,6 +313,8 @@ UP024_2.py:38:7: UP024 [*] Replace aliased errors with `OSError` 40 40 | raise WindowsError(1, 2) 41 41 | + Run `ruff check --fix` to apply this fix. + UP024_2.py:39:7: UP024 [*] Replace aliased errors with `OSError` | 38 | raise EnvironmentError() @@ -296,7 +324,7 @@ UP024_2.py:39:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `IOError` with builtin `OSError` -ℹ Safe fix +Suggested fix: 36 36 | raise WindowsError 37 37 | 38 38 | raise EnvironmentError() @@ -306,6 +334,8 @@ UP024_2.py:39:7: UP024 [*] Replace aliased errors with `OSError` 41 41 | 42 42 | raise EnvironmentError( + Run `ruff check --fix` to apply this fix. + UP024_2.py:40:7: UP024 [*] Replace aliased errors with `OSError` | 38 | raise EnvironmentError() @@ -317,7 +347,7 @@ UP024_2.py:40:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `WindowsError` with builtin `OSError` -ℹ Safe fix +Suggested fix: 37 37 | 38 38 | raise EnvironmentError() 39 39 | raise IOError(1) @@ -327,6 +357,8 @@ UP024_2.py:40:7: UP024 [*] Replace aliased errors with `OSError` 42 42 | raise EnvironmentError( 43 43 | 1, + Run `ruff check --fix` to apply this fix. + UP024_2.py:42:7: UP024 [*] Replace aliased errors with `OSError` | 40 | raise WindowsError(1, 2) @@ -338,7 +370,7 @@ UP024_2.py:42:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `EnvironmentError` with builtin `OSError` -ℹ Safe fix +Suggested fix: 39 39 | raise IOError(1) 40 40 | raise WindowsError(1, 2) 41 41 | @@ -348,6 +380,8 @@ UP024_2.py:42:7: UP024 [*] Replace aliased errors with `OSError` 44 44 | 2, 45 45 | 3, + Run `ruff check --fix` to apply this fix. + UP024_2.py:48:7: UP024 [*] Replace aliased errors with `OSError` | 46 | ) @@ -359,7 +393,7 @@ UP024_2.py:48:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `WindowsError` with builtin `OSError` -ℹ Safe fix +Suggested fix: 45 45 | 3, 46 46 | ) 47 47 | @@ -368,6 +402,8 @@ UP024_2.py:48:7: UP024 [*] Replace aliased errors with `OSError` 49 49 | raise EnvironmentError(1) 50 50 | raise IOError(1, 2) + Run `ruff check --fix` to apply this fix. + UP024_2.py:49:7: UP024 [*] Replace aliased errors with `OSError` | 48 | raise WindowsError @@ -377,7 +413,7 @@ UP024_2.py:49:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `EnvironmentError` with builtin `OSError` -ℹ Safe fix +Suggested fix: 46 46 | ) 47 47 | 48 48 | raise WindowsError @@ -385,6 +421,8 @@ UP024_2.py:49:7: UP024 [*] Replace aliased errors with `OSError` 49 |+raise OSError(1) 50 50 | raise IOError(1, 2) + Run `ruff check --fix` to apply this fix. + UP024_2.py:50:7: UP024 [*] Replace aliased errors with `OSError` | 48 | raise WindowsError @@ -394,11 +432,11 @@ UP024_2.py:50:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `IOError` with builtin `OSError` -ℹ Safe fix +Suggested fix: 47 47 | 48 48 | raise WindowsError 49 49 | raise EnvironmentError(1) 50 |-raise IOError(1, 2) 50 |+raise OSError(1, 2) - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_4.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_4.py.snap index 40f6fbea4b00a..c447aa4ea7a71 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_4.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_4.py.snap @@ -11,7 +11,7 @@ UP024_4.py:9:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Safe fix +Suggested fix: 6 6 | conn = Connection(settings.CELERY_BROKER_URL) 7 7 | conn.ensure_connection(max_retries=2) 8 8 | conn._close() @@ -19,4 +19,4 @@ UP024_4.py:9:8: UP024 [*] Replace aliased errors with `OSError` 9 |+except (OSError, exceptions.OperationalError): 10 10 | return HttpResponseServerError("cache: cannot connect to broker.") - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP025.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP025.py.snap index e5cd73cc97314..da34c741b4b70 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP025.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP025.py.snap @@ -10,13 +10,15 @@ UP025.py:1:1: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Safe fix +Suggested fix: 1 |-u"Hello" 1 |+"Hello" 2 2 | 3 3 | x = u"Hello" # UP025 4 4 | + Run `ruff check --fix` to apply this fix. + UP025.py:3:5: UP025 [*] Remove unicode literals from strings | 1 | u"Hello" @@ -28,7 +30,7 @@ UP025.py:3:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Safe fix +Suggested fix: 1 1 | u"Hello" 2 2 | 3 |-x = u"Hello" # UP025 @@ -37,6 +39,8 @@ UP025.py:3:5: UP025 [*] Remove unicode literals from strings 5 5 | u'world' # UP025 6 6 | + Run `ruff check --fix` to apply this fix. + UP025.py:5:1: UP025 [*] Remove unicode literals from strings | 3 | x = u"Hello" # UP025 @@ -48,7 +52,7 @@ UP025.py:5:1: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | x = u"Hello" # UP025 4 4 | @@ -58,6 +62,8 @@ UP025.py:5:1: UP025 [*] Remove unicode literals from strings 7 7 | print(u"Hello") # UP025 8 8 | + Run `ruff check --fix` to apply this fix. + UP025.py:7:7: UP025 [*] Remove unicode literals from strings | 5 | u'world' # UP025 @@ -69,7 +75,7 @@ UP025.py:7:7: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | u'world' # UP025 6 6 | @@ -79,6 +85,8 @@ UP025.py:7:7: UP025 [*] Remove unicode literals from strings 9 9 | print(u'world') # UP025 10 10 | + Run `ruff check --fix` to apply this fix. + UP025.py:9:7: UP025 [*] Remove unicode literals from strings | 7 | print(u"Hello") # UP025 @@ -90,7 +98,7 @@ UP025.py:9:7: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Safe fix +Suggested fix: 6 6 | 7 7 | print(u"Hello") # UP025 8 8 | @@ -100,6 +108,8 @@ UP025.py:9:7: UP025 [*] Remove unicode literals from strings 11 11 | import foo 12 12 | + Run `ruff check --fix` to apply this fix. + UP025.py:13:5: UP025 [*] Remove unicode literals from strings | 11 | import foo @@ -111,7 +121,7 @@ UP025.py:13:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | import foo 12 12 | @@ -121,6 +131,8 @@ UP025.py:13:5: UP025 [*] Remove unicode literals from strings 15 15 | # Retain quotes when fixing. 16 16 | x = u'hello' # UP025 + Run `ruff check --fix` to apply this fix. + UP025.py:13:15: UP025 [*] Remove unicode literals from strings | 11 | import foo @@ -132,7 +144,7 @@ UP025.py:13:15: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | import foo 12 12 | @@ -142,6 +154,8 @@ UP025.py:13:15: UP025 [*] Remove unicode literals from strings 15 15 | # Retain quotes when fixing. 16 16 | x = u'hello' # UP025 + Run `ruff check --fix` to apply this fix. + UP025.py:13:27: UP025 [*] Remove unicode literals from strings | 11 | import foo @@ -153,7 +167,7 @@ UP025.py:13:27: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | import foo 12 12 | @@ -163,6 +177,8 @@ UP025.py:13:27: UP025 [*] Remove unicode literals from strings 15 15 | # Retain quotes when fixing. 16 16 | x = u'hello' # UP025 + Run `ruff check --fix` to apply this fix. + UP025.py:13:39: UP025 [*] Remove unicode literals from strings | 11 | import foo @@ -174,7 +190,7 @@ UP025.py:13:39: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | import foo 12 12 | @@ -184,6 +200,8 @@ UP025.py:13:39: UP025 [*] Remove unicode literals from strings 15 15 | # Retain quotes when fixing. 16 16 | x = u'hello' # UP025 + Run `ruff check --fix` to apply this fix. + UP025.py:16:5: UP025 [*] Remove unicode literals from strings | 15 | # Retain quotes when fixing. @@ -194,7 +212,7 @@ UP025.py:16:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Safe fix +Suggested fix: 13 13 | foo(u"Hello", U"world", a=u"Hello", b=u"world") # UP025 14 14 | 15 15 | # Retain quotes when fixing. @@ -204,6 +222,8 @@ UP025.py:16:5: UP025 [*] Remove unicode literals from strings 18 18 | x = u'''hello''' # UP025 19 19 | x = u'Hello "World"' # UP025 + Run `ruff check --fix` to apply this fix. + UP025.py:17:5: UP025 [*] Remove unicode literals from strings | 15 | # Retain quotes when fixing. @@ -215,7 +235,7 @@ UP025.py:17:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Safe fix +Suggested fix: 14 14 | 15 15 | # Retain quotes when fixing. 16 16 | x = u'hello' # UP025 @@ -225,6 +245,8 @@ UP025.py:17:5: UP025 [*] Remove unicode literals from strings 19 19 | x = u'Hello "World"' # UP025 20 20 | + Run `ruff check --fix` to apply this fix. + UP025.py:18:5: UP025 [*] Remove unicode literals from strings | 16 | x = u'hello' # UP025 @@ -235,7 +257,7 @@ UP025.py:18:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Safe fix +Suggested fix: 15 15 | # Retain quotes when fixing. 16 16 | x = u'hello' # UP025 17 17 | x = u"""hello""" # UP025 @@ -245,6 +267,8 @@ UP025.py:18:5: UP025 [*] Remove unicode literals from strings 20 20 | 21 21 | u = "Hello" # OK + Run `ruff check --fix` to apply this fix. + UP025.py:19:5: UP025 [*] Remove unicode literals from strings | 17 | x = u"""hello""" # UP025 @@ -256,7 +280,7 @@ UP025.py:19:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Safe fix +Suggested fix: 16 16 | x = u'hello' # UP025 17 17 | x = u"""hello""" # UP025 18 18 | x = u'''hello''' # UP025 @@ -266,6 +290,8 @@ UP025.py:19:5: UP025 [*] Remove unicode literals from strings 21 21 | u = "Hello" # OK 22 22 | u = u # OK + Run `ruff check --fix` to apply this fix. + UP025.py:27:7: UP025 [*] Remove unicode literals from strings | 25 | return"Hello" # OK @@ -276,7 +302,7 @@ UP025.py:27:7: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Safe fix +Suggested fix: 24 24 | def hello(): 25 25 | return"Hello" # OK 26 26 | @@ -284,6 +310,8 @@ UP025.py:27:7: UP025 [*] Remove unicode literals from strings 27 |+f"foo""bar" # OK 28 28 | f"foo" u"bar" # OK + Run `ruff check --fix` to apply this fix. + UP025.py:28:8: UP025 [*] Remove unicode literals from strings | 27 | f"foo"u"bar" # OK @@ -292,11 +320,11 @@ UP025.py:28:8: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Safe fix +Suggested fix: 25 25 | return"Hello" # OK 26 26 | 27 27 | f"foo"u"bar" # OK 28 |-f"foo" u"bar" # OK 28 |+f"foo" "bar" # OK - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap index 56d9e70f2cb27..232ad3f0eede8 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap @@ -12,7 +12,7 @@ UP026.py:3:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 1 1 | # Error (`from unittest import mock`) 2 2 | if True: 3 |- import mock @@ -21,6 +21,8 @@ UP026.py:3:12: UP026 [*] `mock` is deprecated, use `unittest.mock` 5 5 | # Error (`from unittest import mock`) 6 6 | if True: + Run `ruff check --fix` to apply this fix. + UP026.py:7:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | 5 | # Error (`from unittest import mock`) @@ -32,7 +34,7 @@ UP026.py:7:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | # Error (`from unittest import mock`) 6 6 | if True: @@ -43,6 +45,8 @@ UP026.py:7:12: UP026 [*] `mock` is deprecated, use `unittest.mock` 9 10 | # Error (`from unittest.mock import *`) 10 11 | if True: + Run `ruff check --fix` to apply this fix. + UP026.py:11:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | 9 | # Error (`from unittest.mock import *`) @@ -54,7 +58,7 @@ UP026.py:11:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 8 8 | 9 9 | # Error (`from unittest.mock import *`) 10 10 | if True: @@ -64,6 +68,8 @@ UP026.py:11:5: UP026 [*] `mock` is deprecated, use `unittest.mock` 13 13 | # Error (`from unittest import mock`) 14 14 | import mock.mock + Run `ruff check --fix` to apply this fix. + UP026.py:14:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | 13 | # Error (`from unittest import mock`) @@ -74,7 +80,7 @@ UP026.py:14:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 11 11 | from mock import * 12 12 | 13 13 | # Error (`from unittest import mock`) @@ -84,6 +90,8 @@ UP026.py:14:8: UP026 [*] `mock` is deprecated, use `unittest.mock` 16 16 | # Error (`from unittest import mock`) 17 17 | import contextlib, mock, sys + Run `ruff check --fix` to apply this fix. + UP026.py:17:20: UP026 [*] `mock` is deprecated, use `unittest.mock` | 16 | # Error (`from unittest import mock`) @@ -94,7 +102,7 @@ UP026.py:17:20: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 14 14 | import mock.mock 15 15 | 16 16 | # Error (`from unittest import mock`) @@ -105,6 +113,8 @@ UP026.py:17:20: UP026 [*] `mock` is deprecated, use `unittest.mock` 19 20 | # Error (`from unittest import mock`) 20 21 | import mock, sys + Run `ruff check --fix` to apply this fix. + UP026.py:20:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | 19 | # Error (`from unittest import mock`) @@ -114,7 +124,7 @@ UP026.py:20:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 17 17 | import contextlib, mock, sys 18 18 | 19 19 | # Error (`from unittest import mock`) @@ -125,6 +135,8 @@ UP026.py:20:8: UP026 [*] `mock` is deprecated, use `unittest.mock` 22 23 | 23 24 | # Error (`from unittest import mock`) + Run `ruff check --fix` to apply this fix. + UP026.py:24:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 23 | # Error (`from unittest import mock`) @@ -135,7 +147,7 @@ UP026.py:24:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 21 21 | x = "This code should be preserved one line below the mock" 22 22 | 23 23 | # Error (`from unittest import mock`) @@ -145,6 +157,8 @@ UP026.py:24:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 26 26 | # Error (keep trailing comma) 27 27 | from mock import ( + Run `ruff check --fix` to apply this fix. + UP026.py:27:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 26 | # Error (keep trailing comma) @@ -160,7 +174,7 @@ UP026.py:27:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 24 24 | from mock import mock 25 25 | 26 26 | # Error (keep trailing comma) @@ -176,6 +190,8 @@ UP026.py:27:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 34 34 | a, 35 35 | b, + Run `ruff check --fix` to apply this fix. + UP026.py:33:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 31 | c, @@ -192,7 +208,7 @@ UP026.py:33:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 30 30 | b, 31 31 | c, 32 32 | ) @@ -208,6 +224,8 @@ UP026.py:33:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 40 40 | # Error (avoid trailing comma) 41 41 | from mock import ( + Run `ruff check --fix` to apply this fix. + UP026.py:41:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 40 | # Error (avoid trailing comma) @@ -223,7 +241,7 @@ UP026.py:41:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 38 38 | ) 39 39 | 40 40 | # Error (avoid trailing comma) @@ -239,6 +257,8 @@ UP026.py:41:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 48 48 | a, 49 49 | b, + Run `ruff check --fix` to apply this fix. + UP026.py:47:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 45 | c @@ -255,7 +275,7 @@ UP026.py:47:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 44 44 | b, 45 45 | c 46 46 | ) @@ -272,6 +292,8 @@ UP026.py:47:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 54 54 | from mock import a, b, c, mock 55 55 | + Run `ruff check --fix` to apply this fix. + UP026.py:53:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 51 | mock @@ -282,7 +304,7 @@ UP026.py:53:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 50 50 | c, 51 51 | mock 52 52 | ) @@ -293,6 +315,8 @@ UP026.py:53:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 55 56 | 56 57 | if True: + Run `ruff check --fix` to apply this fix. + UP026.py:54:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 52 | ) @@ -304,7 +328,7 @@ UP026.py:54:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 51 51 | mock 52 52 | ) 53 53 | from mock import mock, a, b, c @@ -315,6 +339,8 @@ UP026.py:54:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 56 57 | if True: 57 58 | if False: + Run `ruff check --fix` to apply this fix. + UP026.py:58:9: UP026 [*] `mock` is deprecated, use `unittest.mock` | 56 | if True: @@ -332,7 +358,7 @@ UP026.py:58:9: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 55 55 | 56 56 | if True: 57 57 | if False: @@ -348,6 +374,8 @@ UP026.py:58:9: UP026 [*] `mock` is deprecated, use `unittest.mock` 65 65 | # OK 66 66 | import os, io + Run `ruff check --fix` to apply this fix. + UP026.py:69:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | 68 | # Error (`from unittest import mock`) @@ -358,7 +386,7 @@ UP026.py:69:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 66 66 | import os, io 67 67 | 68 68 | # Error (`from unittest import mock`) @@ -369,6 +397,8 @@ UP026.py:69:8: UP026 [*] `mock` is deprecated, use `unittest.mock` 71 72 | # Error (`from unittest import mock as foo`) 72 73 | import mock as foo + Run `ruff check --fix` to apply this fix. + UP026.py:69:14: UP026 [*] `mock` is deprecated, use `unittest.mock` | 68 | # Error (`from unittest import mock`) @@ -379,7 +409,7 @@ UP026.py:69:14: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 66 66 | import os, io 67 67 | 68 68 | # Error (`from unittest import mock`) @@ -390,6 +420,8 @@ UP026.py:69:14: UP026 [*] `mock` is deprecated, use `unittest.mock` 71 72 | # Error (`from unittest import mock as foo`) 72 73 | import mock as foo + Run `ruff check --fix` to apply this fix. + UP026.py:72:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | 71 | # Error (`from unittest import mock as foo`) @@ -400,7 +432,7 @@ UP026.py:72:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 69 69 | import mock, mock 70 70 | 71 71 | # Error (`from unittest import mock as foo`) @@ -410,6 +442,8 @@ UP026.py:72:8: UP026 [*] `mock` is deprecated, use `unittest.mock` 74 74 | # Error (`from unittest import mock as foo`) 75 75 | from mock import mock as foo + Run `ruff check --fix` to apply this fix. + UP026.py:75:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 74 | # Error (`from unittest import mock as foo`) @@ -420,7 +454,7 @@ UP026.py:75:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 72 72 | import mock as foo 73 73 | 74 74 | # Error (`from unittest import mock as foo`) @@ -430,6 +464,8 @@ UP026.py:75:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 77 77 | if True: 78 78 | # This should yield multiple, aliased imports. + Run `ruff check --fix` to apply this fix. + UP026.py:79:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | 77 | if True: @@ -441,7 +477,7 @@ UP026.py:79:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 76 76 | 77 77 | if True: 78 78 | # This should yield multiple, aliased imports. @@ -453,6 +489,8 @@ UP026.py:79:12: UP026 [*] `mock` is deprecated, use `unittest.mock` 81 83 | # This should yield multiple, aliased imports, and preserve `os`. 82 84 | import mock as foo, mock as bar, mock, os + Run `ruff check --fix` to apply this fix. + UP026.py:79:25: UP026 [*] `mock` is deprecated, use `unittest.mock` | 77 | if True: @@ -464,7 +502,7 @@ UP026.py:79:25: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 76 76 | 77 77 | if True: 78 78 | # This should yield multiple, aliased imports. @@ -476,6 +514,8 @@ UP026.py:79:25: UP026 [*] `mock` is deprecated, use `unittest.mock` 81 83 | # This should yield multiple, aliased imports, and preserve `os`. 82 84 | import mock as foo, mock as bar, mock, os + Run `ruff check --fix` to apply this fix. + UP026.py:79:38: UP026 [*] `mock` is deprecated, use `unittest.mock` | 77 | if True: @@ -487,7 +527,7 @@ UP026.py:79:38: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 76 76 | 77 77 | if True: 78 78 | # This should yield multiple, aliased imports. @@ -499,6 +539,8 @@ UP026.py:79:38: UP026 [*] `mock` is deprecated, use `unittest.mock` 81 83 | # This should yield multiple, aliased imports, and preserve `os`. 82 84 | import mock as foo, mock as bar, mock, os + Run `ruff check --fix` to apply this fix. + UP026.py:82:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | 81 | # This should yield multiple, aliased imports, and preserve `os`. @@ -509,7 +551,7 @@ UP026.py:82:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 79 79 | import mock as foo, mock as bar, mock 80 80 | 81 81 | # This should yield multiple, aliased imports, and preserve `os`. @@ -522,6 +564,8 @@ UP026.py:82:12: UP026 [*] `mock` is deprecated, use `unittest.mock` 84 87 | if True: 85 88 | # This should yield multiple, aliased imports. + Run `ruff check --fix` to apply this fix. + UP026.py:82:25: UP026 [*] `mock` is deprecated, use `unittest.mock` | 81 | # This should yield multiple, aliased imports, and preserve `os`. @@ -532,7 +576,7 @@ UP026.py:82:25: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 79 79 | import mock as foo, mock as bar, mock 80 80 | 81 81 | # This should yield multiple, aliased imports, and preserve `os`. @@ -545,6 +589,8 @@ UP026.py:82:25: UP026 [*] `mock` is deprecated, use `unittest.mock` 84 87 | if True: 85 88 | # This should yield multiple, aliased imports. + Run `ruff check --fix` to apply this fix. + UP026.py:82:38: UP026 [*] `mock` is deprecated, use `unittest.mock` | 81 | # This should yield multiple, aliased imports, and preserve `os`. @@ -555,7 +601,7 @@ UP026.py:82:38: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 79 79 | import mock as foo, mock as bar, mock 80 80 | 81 81 | # This should yield multiple, aliased imports, and preserve `os`. @@ -568,6 +614,8 @@ UP026.py:82:38: UP026 [*] `mock` is deprecated, use `unittest.mock` 84 87 | if True: 85 88 | # This should yield multiple, aliased imports. + Run `ruff check --fix` to apply this fix. + UP026.py:86:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | 84 | if True: @@ -577,7 +625,7 @@ UP026.py:86:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Safe fix +Suggested fix: 83 83 | 84 84 | if True: 85 85 | # This should yield multiple, aliased imports. @@ -589,6 +637,8 @@ UP026.py:86:5: UP026 [*] `mock` is deprecated, use `unittest.mock` 88 90 | 89 91 | # OK. + Run `ruff check --fix` to apply this fix. + UP026.py:93:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | 92 | # Error (`mock.Mock()`). @@ -597,11 +647,11 @@ UP026.py:93:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Replace `mock.mock` with `mock` -ℹ Safe fix +Suggested fix: 90 90 | x = mock.Mock() 91 91 | 92 92 | # Error (`mock.Mock()`). 93 |-x = mock.mock.Mock() 93 |+x = mock.Mock() - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap index c177a26b81e2b..9ce8a3b2cd738 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap @@ -11,7 +11,7 @@ UP027.py:2:17: UP027 [*] Replace unpacked list comprehension with a generator ex | = help: Replace with generator expression -ℹ Safe fix +Suggested fix: 1 1 | # Should change 2 |-foo, bar, baz = [fn(x) for x in items] 2 |+foo, bar, baz = (fn(x) for x in items) @@ -19,6 +19,8 @@ UP027.py:2:17: UP027 [*] Replace unpacked list comprehension with a generator ex 4 4 | foo, bar, baz =[fn(x) for x in items] 5 5 | + Run `ruff check --fix` to apply this fix. + UP027.py:4:16: UP027 [*] Replace unpacked list comprehension with a generator expression | 2 | foo, bar, baz = [fn(x) for x in items] @@ -30,7 +32,7 @@ UP027.py:4:16: UP027 [*] Replace unpacked list comprehension with a generator ex | = help: Replace with generator expression -ℹ Safe fix +Suggested fix: 1 1 | # Should change 2 2 | foo, bar, baz = [fn(x) for x in items] 3 3 | @@ -40,6 +42,8 @@ UP027.py:4:16: UP027 [*] Replace unpacked list comprehension with a generator ex 6 6 | foo, bar, baz = [fn(x) for x in items] 7 7 | + Run `ruff check --fix` to apply this fix. + UP027.py:6:26: UP027 [*] Replace unpacked list comprehension with a generator expression | 4 | foo, bar, baz =[fn(x) for x in items] @@ -51,7 +55,7 @@ UP027.py:6:26: UP027 [*] Replace unpacked list comprehension with a generator ex | = help: Replace with generator expression -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | foo, bar, baz =[fn(x) for x in items] 5 5 | @@ -61,6 +65,8 @@ UP027.py:6:26: UP027 [*] Replace unpacked list comprehension with a generator ex 8 8 | foo, bar, baz = [[i for i in fn(x)] for x in items] 9 9 | + Run `ruff check --fix` to apply this fix. + UP027.py:8:17: UP027 [*] Replace unpacked list comprehension with a generator expression | 6 | foo, bar, baz = [fn(x) for x in items] @@ -72,7 +78,7 @@ UP027.py:8:17: UP027 [*] Replace unpacked list comprehension with a generator ex | = help: Replace with generator expression -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | foo, bar, baz = [fn(x) for x in items] 7 7 | @@ -82,6 +88,8 @@ UP027.py:8:17: UP027 [*] Replace unpacked list comprehension with a generator ex 10 10 | foo, bar, baz = [ 11 11 | fn(x) + Run `ruff check --fix` to apply this fix. + UP027.py:10:17: UP027 [*] Replace unpacked list comprehension with a generator expression | 8 | foo, bar, baz = [[i for i in fn(x)] for x in items] @@ -97,7 +105,7 @@ UP027.py:10:17: UP027 [*] Replace unpacked list comprehension with a generator e | = help: Replace with generator expression -ℹ Safe fix +Suggested fix: 7 7 | 8 8 | foo, bar, baz = [[i for i in fn(x)] for x in items] 9 9 | @@ -110,3 +118,5 @@ UP027.py:10:17: UP027 [*] Replace unpacked list comprehension with a generator e 14 14 | 15 15 | # Should not change 16 16 | foo = [fn(x) for x in items] + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap index 8d5334bbd0da6..cec51349939cb 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap @@ -11,7 +11,7 @@ UP028_0.py:2:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Unsafe fix +Suggested fix: 1 1 | def f(): 2 |- for x in y: 3 |- yield x @@ -20,6 +20,8 @@ UP028_0.py:2:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 5 4 | 6 5 | def g(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP028_0.py:7:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 6 | def g(): @@ -30,7 +32,7 @@ UP028_0.py:7:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Unsafe fix +Suggested fix: 4 4 | 5 5 | 6 6 | def g(): @@ -41,6 +43,8 @@ UP028_0.py:7:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 10 9 | 11 10 | def h(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP028_0.py:12:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 11 | def h(): @@ -51,7 +55,7 @@ UP028_0.py:12:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Unsafe fix +Suggested fix: 9 9 | 10 10 | 11 11 | def h(): @@ -62,6 +66,8 @@ UP028_0.py:12:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 15 14 | 16 15 | def i(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP028_0.py:17:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 16 | def i(): @@ -72,7 +78,7 @@ UP028_0.py:17:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Unsafe fix +Suggested fix: 14 14 | 15 15 | 16 16 | def i(): @@ -83,6 +89,8 @@ UP028_0.py:17:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 20 19 | 21 20 | def j(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP028_0.py:22:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 21 | def j(): @@ -93,7 +101,7 @@ UP028_0.py:22:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Unsafe fix +Suggested fix: 19 19 | 20 20 | 21 21 | def j(): @@ -104,6 +112,8 @@ UP028_0.py:22:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 25 24 | 26 25 | def k(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP028_0.py:27:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 26 | def k(): @@ -114,7 +124,7 @@ UP028_0.py:27:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Unsafe fix +Suggested fix: 24 24 | 25 25 | 26 26 | def k(): @@ -125,6 +135,8 @@ UP028_0.py:27:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 30 29 | 31 30 | def f(): # Comment one\n' + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP028_0.py:33:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 31 | def f(): # Comment one\n' @@ -142,7 +154,7 @@ UP028_0.py:33:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Unsafe fix +Suggested fix: 30 30 | 31 31 | def f(): # Comment one\n' 32 32 | # Comment two\n' @@ -159,6 +171,8 @@ UP028_0.py:33:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 41 39 | 42 40 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP028_0.py:44:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 43 | def f(): @@ -169,7 +183,7 @@ UP028_0.py:44:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Unsafe fix +Suggested fix: 41 41 | 42 42 | 43 43 | def f(): @@ -180,6 +194,8 @@ UP028_0.py:44:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 47 46 | 48 47 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP028_0.py:49:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 48 | def f(): @@ -192,7 +208,7 @@ UP028_0.py:49:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Unsafe fix +Suggested fix: 46 46 | 47 47 | 48 48 | def f(): @@ -203,6 +219,8 @@ UP028_0.py:49:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 52 51 | def f(): 53 52 | def func(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP028_0.py:55:9: UP028 [*] Replace `yield` over `for` loop with `yield from` | 53 | def func(): @@ -217,7 +235,7 @@ UP028_0.py:55:9: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Unsafe fix +Suggested fix: 52 52 | def f(): 53 53 | def func(): 54 54 | # This comment is preserved\n' @@ -229,6 +247,8 @@ UP028_0.py:55:9: UP028 [*] Replace `yield` over `for` loop with `yield from` 59 57 | # Comment\n' 60 58 | def g(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP028_0.py:67:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 65 | for x in y: @@ -240,7 +260,7 @@ UP028_0.py:67:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Unsafe fix +Suggested fix: 64 64 | def f(): 65 65 | for x in y: 66 66 | yield x @@ -251,6 +271,8 @@ UP028_0.py:67:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 70 69 | 71 70 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP028_0.py:72:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 71 | def f(): @@ -262,7 +284,7 @@ UP028_0.py:72:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Unsafe fix +Suggested fix: 69 69 | 70 70 | 71 71 | def f(): @@ -273,6 +295,8 @@ UP028_0.py:72:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 75 74 | 76 75 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP028_0.py:79:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 77 | # Regression test for: https://github.com/astral-sh/ruff/issues/7103 @@ -287,7 +311,7 @@ UP028_0.py:79:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Unsafe fix +Suggested fix: 76 76 | 77 77 | # Regression test for: https://github.com/astral-sh/ruff/issues/7103 78 78 | def _serve_method(fn): @@ -299,4 +323,4 @@ UP028_0.py:79:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 83 |- yield h 82 |+ ) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap index 5dcbd5e6c95e8..49966d061f530 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap @@ -10,12 +10,14 @@ UP029.py:1:1: UP029 [*] Unnecessary builtin import: `*` | = help: Remove unnecessary builtin import -ℹ Unsafe fix +Suggested fix: 1 |-from builtins import * 2 1 | from builtins import ascii, bytes, compile 3 2 | from builtins import str as _str 4 3 | from six.moves import filter, zip, zip_longest + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP029.py:2:1: UP029 [*] Unnecessary builtin imports: `ascii`, `bytes` | 1 | from builtins import * @@ -26,7 +28,7 @@ UP029.py:2:1: UP029 [*] Unnecessary builtin imports: `ascii`, `bytes` | = help: Remove unnecessary builtin import -ℹ Unsafe fix +Suggested fix: 1 1 | from builtins import * 2 |-from builtins import ascii, bytes, compile 2 |+from builtins import compile @@ -34,6 +36,8 @@ UP029.py:2:1: UP029 [*] Unnecessary builtin imports: `ascii`, `bytes` 4 4 | from six.moves import filter, zip, zip_longest 5 5 | from io import open + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP029.py:4:1: UP029 [*] Unnecessary builtin imports: `filter`, `zip` | 2 | from builtins import ascii, bytes, compile @@ -45,7 +49,7 @@ UP029.py:4:1: UP029 [*] Unnecessary builtin imports: `filter`, `zip` | = help: Remove unnecessary builtin import -ℹ Unsafe fix +Suggested fix: 1 1 | from builtins import * 2 2 | from builtins import ascii, bytes, compile 3 3 | from builtins import str as _str @@ -55,6 +59,8 @@ UP029.py:4:1: UP029 [*] Unnecessary builtin imports: `filter`, `zip` 6 6 | import io 7 7 | import six + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP029.py:5:1: UP029 [*] Unnecessary builtin import: `open` | 3 | from builtins import str as _str @@ -66,7 +72,7 @@ UP029.py:5:1: UP029 [*] Unnecessary builtin import: `open` | = help: Remove unnecessary builtin import -ℹ Unsafe fix +Suggested fix: 2 2 | from builtins import ascii, bytes, compile 3 3 | from builtins import str as _str 4 4 | from six.moves import filter, zip, zip_longest @@ -75,4 +81,4 @@ UP029.py:5:1: UP029 [*] Unnecessary builtin import: `open` 7 6 | import six 8 7 | import six.moves - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap index 936bfd6887969..7f244a03d4059 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap @@ -12,7 +12,7 @@ UP030_0.py:3:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 1 1 | # Invalid calls; errors expected. 2 2 | 3 |-"{0}" "{1}" "{2}".format(1, 2, 3) @@ -21,6 +21,8 @@ UP030_0.py:3:1: UP030 [*] Use implicit references for positional format fields 5 5 | "a {3} complicated {1} string with {0} {2}".format( 6 6 | "first", "second", "third", "fourth" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:5:1: UP030 [*] Use implicit references for positional format fields | 3 | "{0}" "{1}" "{2}".format(1, 2, 3) @@ -34,7 +36,7 @@ UP030_0.py:5:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | "{0}" "{1}" "{2}".format(1, 2, 3) 4 4 | @@ -46,6 +48,8 @@ UP030_0.py:5:1: UP030 [*] Use implicit references for positional format fields 8 8 | 9 9 | '{0}'.format(1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:9:1: UP030 [*] Use implicit references for positional format fields | 7 | ) @@ -57,7 +61,7 @@ UP030_0.py:9:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 6 6 | "first", "second", "third", "fourth" 7 7 | ) 8 8 | @@ -67,6 +71,8 @@ UP030_0.py:9:1: UP030 [*] Use implicit references for positional format fields 11 11 | '{0:x}'.format(30) 12 12 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:11:1: UP030 [*] Use implicit references for positional format fields | 9 | '{0}'.format(1) @@ -78,7 +84,7 @@ UP030_0.py:11:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 8 8 | 9 9 | '{0}'.format(1) 10 10 | @@ -88,6 +94,8 @@ UP030_0.py:11:1: UP030 [*] Use implicit references for positional format fields 13 13 | x = '{0}'.format(1) 14 14 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:13:5: UP030 [*] Use implicit references for positional format fields | 11 | '{0:x}'.format(30) @@ -99,7 +107,7 @@ UP030_0.py:13:5: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 10 10 | 11 11 | '{0:x}'.format(30) 12 12 | @@ -109,6 +117,8 @@ UP030_0.py:13:5: UP030 [*] Use implicit references for positional format fields 15 15 | '''{0}\n{1}\n'''.format(1, 2) 16 16 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:15:1: UP030 [*] Use implicit references for positional format fields | 13 | x = '{0}'.format(1) @@ -120,7 +130,7 @@ UP030_0.py:15:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 12 12 | 13 13 | x = '{0}'.format(1) 14 14 | @@ -130,6 +140,8 @@ UP030_0.py:15:1: UP030 [*] Use implicit references for positional format fields 17 17 | x = "foo {0}" \ 18 18 | "bar {1}".format(1, 2) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:17:5: UP030 [*] Use implicit references for positional format fields | 15 | '''{0}\n{1}\n'''.format(1, 2) @@ -143,7 +155,7 @@ UP030_0.py:17:5: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 14 14 | 15 15 | '''{0}\n{1}\n'''.format(1, 2) 16 16 | @@ -155,6 +167,8 @@ UP030_0.py:17:5: UP030 [*] Use implicit references for positional format fields 20 20 | ("{0}").format(1) 21 21 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:20:1: UP030 [*] Use implicit references for positional format fields | 18 | "bar {1}".format(1, 2) @@ -166,7 +180,7 @@ UP030_0.py:20:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 17 17 | x = "foo {0}" \ 18 18 | "bar {1}".format(1, 2) 19 19 | @@ -176,6 +190,8 @@ UP030_0.py:20:1: UP030 [*] Use implicit references for positional format fields 22 22 | "\N{snowman} {0}".format(1) 23 23 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:22:1: UP030 [*] Use implicit references for positional format fields | 20 | ("{0}").format(1) @@ -187,7 +203,7 @@ UP030_0.py:22:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 19 19 | 20 20 | ("{0}").format(1) 21 21 | @@ -197,6 +213,8 @@ UP030_0.py:22:1: UP030 [*] Use implicit references for positional format fields 24 24 | print( 25 25 | 'foo{0}' + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:25:5: UP030 [*] Use implicit references for positional format fields | 24 | print( @@ -208,7 +226,7 @@ UP030_0.py:25:5: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 22 22 | "\N{snowman} {0}".format(1) 23 23 | 24 24 | print( @@ -220,6 +238,8 @@ UP030_0.py:25:5: UP030 [*] Use implicit references for positional format fields 28 28 | 29 29 | print( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:30:5: UP030 [*] Use implicit references for positional format fields | 29 | print( @@ -231,7 +251,7 @@ UP030_0.py:30:5: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 27 27 | ) 28 28 | 29 29 | print( @@ -243,6 +263,8 @@ UP030_0.py:30:5: UP030 [*] Use implicit references for positional format fields 33 33 | 34 34 | '{' '0}'.format(1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:34:1: UP030 Use implicit references for positional format fields | 32 | ) @@ -265,7 +287,7 @@ UP030_0.py:39:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 36 36 | args = list(range(10)) 37 37 | kwargs = {x: x for x in range(10)} 38 38 | @@ -275,6 +297,8 @@ UP030_0.py:39:1: UP030 [*] Use implicit references for positional format fields 41 41 | "{0}".format(**kwargs) 42 42 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:41:1: UP030 [*] Use implicit references for positional format fields | 39 | "{0}".format(*args) @@ -286,7 +310,7 @@ UP030_0.py:41:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 38 38 | 39 39 | "{0}".format(*args) 40 40 | @@ -296,6 +320,8 @@ UP030_0.py:41:1: UP030 [*] Use implicit references for positional format fields 43 43 | "{0}_{1}".format(*args) 44 44 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:43:1: UP030 [*] Use implicit references for positional format fields | 41 | "{0}".format(**kwargs) @@ -307,7 +333,7 @@ UP030_0.py:43:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 40 40 | 41 41 | "{0}".format(**kwargs) 42 42 | @@ -317,6 +343,8 @@ UP030_0.py:43:1: UP030 [*] Use implicit references for positional format fields 45 45 | "{0}_{1}".format(1, *args) 46 46 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:45:1: UP030 [*] Use implicit references for positional format fields | 43 | "{0}_{1}".format(*args) @@ -328,7 +356,7 @@ UP030_0.py:45:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 42 42 | 43 43 | "{0}_{1}".format(*args) 44 44 | @@ -338,6 +366,8 @@ UP030_0.py:45:1: UP030 [*] Use implicit references for positional format fields 47 47 | "{0}_{1}".format(1, 2, *args) 48 48 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:47:1: UP030 [*] Use implicit references for positional format fields | 45 | "{0}_{1}".format(1, *args) @@ -349,7 +379,7 @@ UP030_0.py:47:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 44 44 | 45 45 | "{0}_{1}".format(1, *args) 46 46 | @@ -359,6 +389,8 @@ UP030_0.py:47:1: UP030 [*] Use implicit references for positional format fields 49 49 | "{0}_{1}".format(*args, 1, 2) 50 50 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:49:1: UP030 [*] Use implicit references for positional format fields | 47 | "{0}_{1}".format(1, 2, *args) @@ -370,7 +402,7 @@ UP030_0.py:49:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 46 46 | 47 47 | "{0}_{1}".format(1, 2, *args) 48 48 | @@ -380,6 +412,8 @@ UP030_0.py:49:1: UP030 [*] Use implicit references for positional format fields 51 51 | "{0}_{1}_{2}".format(1, **kwargs) 52 52 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:51:1: UP030 [*] Use implicit references for positional format fields | 49 | "{0}_{1}".format(*args, 1, 2) @@ -391,7 +425,7 @@ UP030_0.py:51:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 48 48 | 49 49 | "{0}_{1}".format(*args, 1, 2) 50 50 | @@ -401,6 +435,8 @@ UP030_0.py:51:1: UP030 [*] Use implicit references for positional format fields 53 53 | "{0}_{1}_{2}".format(1, 2, **kwargs) 54 54 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:53:1: UP030 [*] Use implicit references for positional format fields | 51 | "{0}_{1}_{2}".format(1, **kwargs) @@ -412,7 +448,7 @@ UP030_0.py:53:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 50 50 | 51 51 | "{0}_{1}_{2}".format(1, **kwargs) 52 52 | @@ -422,6 +458,8 @@ UP030_0.py:53:1: UP030 [*] Use implicit references for positional format fields 55 55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs) 56 56 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:55:1: UP030 [*] Use implicit references for positional format fields | 53 | "{0}_{1}_{2}".format(1, 2, **kwargs) @@ -433,7 +471,7 @@ UP030_0.py:55:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 52 52 | 53 53 | "{0}_{1}_{2}".format(1, 2, **kwargs) 54 54 | @@ -443,6 +481,8 @@ UP030_0.py:55:1: UP030 [*] Use implicit references for positional format fields 57 57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs) 58 58 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:57:1: UP030 [*] Use implicit references for positional format fields | 55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs) @@ -454,7 +494,7 @@ UP030_0.py:57:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 54 54 | 55 55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs) 56 56 | @@ -464,6 +504,8 @@ UP030_0.py:57:1: UP030 [*] Use implicit references for positional format fields 59 59 | "{1}_{0}".format(1, 2, *args) 60 60 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:59:1: UP030 [*] Use implicit references for positional format fields | 57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs) @@ -475,7 +517,7 @@ UP030_0.py:59:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 56 56 | 57 57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs) 58 58 | @@ -484,6 +526,8 @@ UP030_0.py:59:1: UP030 [*] Use implicit references for positional format fields 60 60 | 61 61 | "{1}_{0}".format(1, 2) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP030_0.py:61:1: UP030 [*] Use implicit references for positional format fields | 59 | "{1}_{0}".format(1, 2, *args) @@ -493,11 +537,11 @@ UP030_0.py:61:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Unsafe fix +Suggested fix: 58 58 | 59 59 | "{1}_{0}".format(1, 2, *args) 60 60 | 61 |-"{1}_{0}".format(1, 2) 61 |+"{}_{}".format(2, 1) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap index 487e05372715f..440878d4fb516 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap @@ -12,7 +12,7 @@ UP032_0.py:5:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 2 2 | # Errors 3 3 | ### 4 4 | @@ -22,6 +22,8 @@ UP032_0.py:5:1: UP032 [*] Use f-string instead of `format` call 7 7 | "{1} {0}".format(a, b) 8 8 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:7:1: UP032 [*] Use f-string instead of `format` call | 5 | "{} {}".format(a, b) @@ -33,7 +35,7 @@ UP032_0.py:7:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | "{} {}".format(a, b) 6 6 | @@ -43,6 +45,8 @@ UP032_0.py:7:1: UP032 [*] Use f-string instead of `format` call 9 9 | "{0} {1} {0}".format(a, b) 10 10 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:9:1: UP032 [*] Use f-string instead of `format` call | 7 | "{1} {0}".format(a, b) @@ -54,7 +58,7 @@ UP032_0.py:9:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 6 6 | 7 7 | "{1} {0}".format(a, b) 8 8 | @@ -64,6 +68,8 @@ UP032_0.py:9:1: UP032 [*] Use f-string instead of `format` call 11 11 | "{x.y}".format(x=z) 12 12 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:11:1: UP032 [*] Use f-string instead of `format` call | 9 | "{0} {1} {0}".format(a, b) @@ -75,7 +81,7 @@ UP032_0.py:11:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 8 8 | 9 9 | "{0} {1} {0}".format(a, b) 10 10 | @@ -85,6 +91,8 @@ UP032_0.py:11:1: UP032 [*] Use f-string instead of `format` call 13 13 | "{x} {y} {x}".format(x=a, y=b) 14 14 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:13:1: UP032 [*] Use f-string instead of `format` call | 11 | "{x.y}".format(x=z) @@ -96,7 +104,7 @@ UP032_0.py:13:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | "{x.y}".format(x=z) 12 12 | @@ -106,6 +114,8 @@ UP032_0.py:13:1: UP032 [*] Use f-string instead of `format` call 15 15 | "{.x} {.y}".format(a, b) 16 16 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:15:1: UP032 [*] Use f-string instead of `format` call | 13 | "{x} {y} {x}".format(x=a, y=b) @@ -117,7 +127,7 @@ UP032_0.py:15:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 12 12 | 13 13 | "{x} {y} {x}".format(x=a, y=b) 14 14 | @@ -127,6 +137,8 @@ UP032_0.py:15:1: UP032 [*] Use f-string instead of `format` call 17 17 | "{} {}".format(a.b, c.d) 18 18 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:17:1: UP032 [*] Use f-string instead of `format` call | 15 | "{.x} {.y}".format(a, b) @@ -138,7 +150,7 @@ UP032_0.py:17:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 14 14 | 15 15 | "{.x} {.y}".format(a, b) 16 16 | @@ -148,6 +160,8 @@ UP032_0.py:17:1: UP032 [*] Use f-string instead of `format` call 19 19 | "{}".format(a()) 20 20 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:19:1: UP032 [*] Use f-string instead of `format` call | 17 | "{} {}".format(a.b, c.d) @@ -159,7 +173,7 @@ UP032_0.py:19:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 16 16 | 17 17 | "{} {}".format(a.b, c.d) 18 18 | @@ -169,6 +183,8 @@ UP032_0.py:19:1: UP032 [*] Use f-string instead of `format` call 21 21 | "{}".format(a.b()) 22 22 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:21:1: UP032 [*] Use f-string instead of `format` call | 19 | "{}".format(a()) @@ -180,7 +196,7 @@ UP032_0.py:21:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 18 18 | 19 19 | "{}".format(a()) 20 20 | @@ -190,6 +206,8 @@ UP032_0.py:21:1: UP032 [*] Use f-string instead of `format` call 23 23 | "{}".format(a.b().c()) 24 24 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:23:1: UP032 [*] Use f-string instead of `format` call | 21 | "{}".format(a.b()) @@ -201,7 +219,7 @@ UP032_0.py:23:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 20 20 | 21 21 | "{}".format(a.b()) 22 22 | @@ -211,6 +229,8 @@ UP032_0.py:23:1: UP032 [*] Use f-string instead of `format` call 25 25 | "hello {}!".format(name) 26 26 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:25:1: UP032 [*] Use f-string instead of `format` call | 23 | "{}".format(a.b().c()) @@ -222,7 +242,7 @@ UP032_0.py:25:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 22 22 | 23 23 | "{}".format(a.b().c()) 24 24 | @@ -232,6 +252,8 @@ UP032_0.py:25:1: UP032 [*] Use f-string instead of `format` call 27 27 | "{}{b}{}".format(a, c, b=b) 28 28 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:27:1: UP032 [*] Use f-string instead of `format` call | 25 | "hello {}!".format(name) @@ -243,7 +265,7 @@ UP032_0.py:27:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 24 24 | 25 25 | "hello {}!".format(name) 26 26 | @@ -253,6 +275,8 @@ UP032_0.py:27:1: UP032 [*] Use f-string instead of `format` call 29 29 | "{}".format(0x0) 30 30 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:29:1: UP032 [*] Use f-string instead of `format` call | 27 | "{}{b}{}".format(a, c, b=b) @@ -264,7 +288,7 @@ UP032_0.py:29:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 26 26 | 27 27 | "{}{b}{}".format(a, c, b=b) 28 28 | @@ -274,6 +298,8 @@ UP032_0.py:29:1: UP032 [*] Use f-string instead of `format` call 31 31 | "{} {}".format(a, b) 32 32 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:31:1: UP032 [*] Use f-string instead of `format` call | 29 | "{}".format(0x0) @@ -285,7 +311,7 @@ UP032_0.py:31:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 28 28 | 29 29 | "{}".format(0x0) 30 30 | @@ -295,6 +321,8 @@ UP032_0.py:31:1: UP032 [*] Use f-string instead of `format` call 33 33 | """{} {}""".format(a, b) 34 34 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:33:1: UP032 [*] Use f-string instead of `format` call | 31 | "{} {}".format(a, b) @@ -306,7 +334,7 @@ UP032_0.py:33:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 30 30 | 31 31 | "{} {}".format(a, b) 32 32 | @@ -316,6 +344,8 @@ UP032_0.py:33:1: UP032 [*] Use f-string instead of `format` call 35 35 | "foo{}".format(1) 36 36 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:35:1: UP032 [*] Use f-string instead of `format` call | 33 | """{} {}""".format(a, b) @@ -327,7 +357,7 @@ UP032_0.py:35:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 32 32 | 33 33 | """{} {}""".format(a, b) 34 34 | @@ -337,6 +367,8 @@ UP032_0.py:35:1: UP032 [*] Use f-string instead of `format` call 37 37 | r"foo{}".format(1) 38 38 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:37:1: UP032 [*] Use f-string instead of `format` call | 35 | "foo{}".format(1) @@ -348,7 +380,7 @@ UP032_0.py:37:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 34 34 | 35 35 | "foo{}".format(1) 36 36 | @@ -358,6 +390,8 @@ UP032_0.py:37:1: UP032 [*] Use f-string instead of `format` call 39 39 | x = "{a}".format(a=1) 40 40 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:39:5: UP032 [*] Use f-string instead of `format` call | 37 | r"foo{}".format(1) @@ -369,7 +403,7 @@ UP032_0.py:39:5: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 36 36 | 37 37 | r"foo{}".format(1) 38 38 | @@ -379,6 +413,8 @@ UP032_0.py:39:5: UP032 [*] Use f-string instead of `format` call 41 41 | print("foo {} ".format(x)) 42 42 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:41:7: UP032 [*] Use f-string instead of `format` call | 39 | x = "{a}".format(a=1) @@ -390,7 +426,7 @@ UP032_0.py:41:7: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 38 38 | 39 39 | x = "{a}".format(a=1) 40 40 | @@ -400,6 +436,8 @@ UP032_0.py:41:7: UP032 [*] Use f-string instead of `format` call 43 43 | "{a[b]}".format(a=a) 44 44 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:43:1: UP032 [*] Use f-string instead of `format` call | 41 | print("foo {} ".format(x)) @@ -411,7 +449,7 @@ UP032_0.py:43:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 40 40 | 41 41 | print("foo {} ".format(x)) 42 42 | @@ -421,6 +459,8 @@ UP032_0.py:43:1: UP032 [*] Use f-string instead of `format` call 45 45 | "{a.a[b]}".format(a=a) 46 46 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:45:1: UP032 [*] Use f-string instead of `format` call | 43 | "{a[b]}".format(a=a) @@ -432,7 +472,7 @@ UP032_0.py:45:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 42 42 | 43 43 | "{a[b]}".format(a=a) 44 44 | @@ -442,6 +482,8 @@ UP032_0.py:45:1: UP032 [*] Use f-string instead of `format` call 47 47 | "{}{{}}{}".format(escaped, y) 48 48 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:47:1: UP032 [*] Use f-string instead of `format` call | 45 | "{a.a[b]}".format(a=a) @@ -453,7 +495,7 @@ UP032_0.py:47:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 44 44 | 45 45 | "{a.a[b]}".format(a=a) 46 46 | @@ -463,6 +505,8 @@ UP032_0.py:47:1: UP032 [*] Use f-string instead of `format` call 49 49 | "{}".format(a) 50 50 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:49:1: UP032 [*] Use f-string instead of `format` call | 47 | "{}{{}}{}".format(escaped, y) @@ -474,7 +518,7 @@ UP032_0.py:49:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 46 46 | 47 47 | "{}{{}}{}".format(escaped, y) 48 48 | @@ -484,6 +528,8 @@ UP032_0.py:49:1: UP032 [*] Use f-string instead of `format` call 51 51 | '({}={{0!e}})'.format(a) 52 52 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:51:1: UP032 [*] Use f-string instead of `format` call | 49 | "{}".format(a) @@ -495,7 +541,7 @@ UP032_0.py:51:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 48 48 | 49 49 | "{}".format(a) 50 50 | @@ -505,6 +551,8 @@ UP032_0.py:51:1: UP032 [*] Use f-string instead of `format` call 53 53 | "{[b]}".format(a) 54 54 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:53:1: UP032 [*] Use f-string instead of `format` call | 51 | '({}={{0!e}})'.format(a) @@ -516,7 +564,7 @@ UP032_0.py:53:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 50 50 | 51 51 | '({}={{0!e}})'.format(a) 52 52 | @@ -526,6 +574,8 @@ UP032_0.py:53:1: UP032 [*] Use f-string instead of `format` call 55 55 | '{[b]}'.format(a) 56 56 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:55:1: UP032 [*] Use f-string instead of `format` call | 53 | "{[b]}".format(a) @@ -537,7 +587,7 @@ UP032_0.py:55:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 52 52 | 53 53 | "{[b]}".format(a) 54 54 | @@ -547,6 +597,8 @@ UP032_0.py:55:1: UP032 [*] Use f-string instead of `format` call 57 57 | """{[b]}""".format(a) 58 58 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:57:1: UP032 [*] Use f-string instead of `format` call | 55 | '{[b]}'.format(a) @@ -558,7 +610,7 @@ UP032_0.py:57:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 54 54 | 55 55 | '{[b]}'.format(a) 56 56 | @@ -568,6 +620,8 @@ UP032_0.py:57:1: UP032 [*] Use f-string instead of `format` call 59 59 | '''{[b]}'''.format(a) 60 60 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:59:1: UP032 [*] Use f-string instead of `format` call | 57 | """{[b]}""".format(a) @@ -579,7 +633,7 @@ UP032_0.py:59:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 56 56 | 57 57 | """{[b]}""".format(a) 58 58 | @@ -589,6 +643,8 @@ UP032_0.py:59:1: UP032 [*] Use f-string instead of `format` call 61 61 | "{}".format( 62 62 | 1 + Run `ruff check --fix` to apply this fix. + UP032_0.py:61:1: UP032 [*] Use f-string instead of `format` call | 59 | '''{[b]}'''.format(a) @@ -602,7 +658,7 @@ UP032_0.py:61:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 58 58 | 59 59 | '''{[b]}'''.format(a) 60 60 | @@ -614,6 +670,8 @@ UP032_0.py:61:1: UP032 [*] Use f-string instead of `format` call 65 63 | "123456789 {}".format( 66 64 | 1111111111111111111111111111111111111111111111111111111111111111111111111, + Run `ruff check --fix` to apply this fix. + UP032_0.py:65:1: UP032 [*] Use f-string instead of `format` call | 63 | ) @@ -627,7 +685,7 @@ UP032_0.py:65:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 62 62 | 1 63 63 | ) 64 64 | @@ -639,6 +697,8 @@ UP032_0.py:65:1: UP032 [*] Use f-string instead of `format` call 69 67 | """ 70 68 | {} + Run `ruff check --fix` to apply this fix. + UP032_0.py:69:1: UP032 [*] Use f-string instead of `format` call | 67 | ) @@ -652,7 +712,7 @@ UP032_0.py:69:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 66 66 | 1111111111111111111111111111111111111111111111111111111111111111111111111, 67 67 | ) 68 68 | @@ -665,6 +725,8 @@ UP032_0.py:69:1: UP032 [*] Use f-string instead of `format` call 73 73 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = """ 74 74 | {} + Run `ruff check --fix` to apply this fix. + UP032_0.py:73:85: UP032 [*] Use f-string instead of `format` call | 71 | """.format(1) @@ -681,7 +743,7 @@ UP032_0.py:73:85: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 70 70 | {} 71 71 | """.format(1) 72 72 | @@ -697,6 +759,8 @@ UP032_0.py:73:85: UP032 [*] Use f-string instead of `format` call 79 77 | "{a}" "{b}".format(a=1, b=1) 80 78 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:79:1: UP032 [*] Use f-string instead of `format` call | 77 | ) @@ -708,7 +772,7 @@ UP032_0.py:79:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 76 76 | 111111 77 77 | ) 78 78 | @@ -718,6 +782,8 @@ UP032_0.py:79:1: UP032 [*] Use f-string instead of `format` call 81 81 | ( 82 82 | "{a}" + Run `ruff check --fix` to apply this fix. + UP032_0.py:81:1: UP032 [*] Use f-string instead of `format` call | 79 | "{a}" "{b}".format(a=1, b=1) @@ -732,7 +798,7 @@ UP032_0.py:81:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 79 79 | "{a}" "{b}".format(a=1, b=1) 80 80 | 81 81 | ( @@ -746,6 +812,8 @@ UP032_0.py:81:1: UP032 [*] Use f-string instead of `format` call 86 86 | ( 87 87 | "{a}" + Run `ruff check --fix` to apply this fix. + UP032_0.py:86:1: UP032 [*] Use f-string instead of `format` call | 84 | ).format(a=1, b=1) @@ -762,7 +830,7 @@ UP032_0.py:86:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 84 84 | ).format(a=1, b=1) 85 85 | 86 86 | ( @@ -778,6 +846,8 @@ UP032_0.py:86:1: UP032 [*] Use f-string instead of `format` call 93 91 | ( 94 92 | ( + Run `ruff check --fix` to apply this fix. + UP032_0.py:94:5: UP032 [*] Use f-string instead of `format` call | 93 | ( @@ -795,7 +865,7 @@ UP032_0.py:94:5: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 93 93 | ( 94 94 | ( 95 95 | # comment @@ -812,6 +882,8 @@ UP032_0.py:94:5: UP032 [*] Use f-string instead of `format` call 103 103 | 104 104 | ( + Run `ruff check --fix` to apply this fix. + UP032_0.py:104:1: UP032 [*] Use f-string instead of `format` call | 102 | ) @@ -824,7 +896,7 @@ UP032_0.py:104:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 102 102 | ) 103 103 | 104 104 | ( @@ -837,6 +909,8 @@ UP032_0.py:104:1: UP032 [*] Use f-string instead of `format` call 109 109 | 110 110 | def d(osname, version, release): + Run `ruff check --fix` to apply this fix. + UP032_0.py:111:11: UP032 [*] Use f-string instead of `format` call | 110 | def d(osname, version, release): @@ -845,7 +919,7 @@ UP032_0.py:111:11: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 108 108 | 109 109 | 110 110 | def d(osname, version, release): @@ -855,6 +929,8 @@ UP032_0.py:111:11: UP032 [*] Use f-string instead of `format` call 113 113 | 114 114 | def e(): + Run `ruff check --fix` to apply this fix. + UP032_0.py:115:10: UP032 [*] Use f-string instead of `format` call | 114 | def e(): @@ -863,7 +939,7 @@ UP032_0.py:115:10: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 112 112 | 113 113 | 114 114 | def e(): @@ -873,6 +949,8 @@ UP032_0.py:115:10: UP032 [*] Use f-string instead of `format` call 117 117 | 118 118 | assert"{}".format(1) + Run `ruff check --fix` to apply this fix. + UP032_0.py:118:7: UP032 [*] Use f-string instead of `format` call | 118 | assert"{}".format(1) @@ -880,7 +958,7 @@ UP032_0.py:118:7: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 115 115 | yield"{}".format(1) 116 116 | 117 117 | @@ -890,6 +968,8 @@ UP032_0.py:118:7: UP032 [*] Use f-string instead of `format` call 120 120 | 121 121 | async def c(): + Run `ruff check --fix` to apply this fix. + UP032_0.py:122:12: UP032 [*] Use f-string instead of `format` call | 121 | async def c(): @@ -898,7 +978,7 @@ UP032_0.py:122:12: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 119 119 | 120 120 | 121 121 | async def c(): @@ -908,6 +988,8 @@ UP032_0.py:122:12: UP032 [*] Use f-string instead of `format` call 124 124 | 125 125 | async def c(): + Run `ruff check --fix` to apply this fix. + UP032_0.py:126:12: UP032 [*] Use f-string instead of `format` call | 125 | async def c(): @@ -916,7 +998,7 @@ UP032_0.py:126:12: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 123 123 | 124 124 | 125 125 | async def c(): @@ -926,6 +1008,8 @@ UP032_0.py:126:12: UP032 [*] Use f-string instead of `format` call 128 128 | 129 129 | "{}".format(1 * 2) + Run `ruff check --fix` to apply this fix. + UP032_0.py:129:1: UP032 [*] Use f-string instead of `format` call | 129 | "{}".format(1 * 2) @@ -935,7 +1019,7 @@ UP032_0.py:129:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 126 126 | return "{}".format(1 + await 3) 127 127 | 128 128 | @@ -945,6 +1029,8 @@ UP032_0.py:129:1: UP032 [*] Use f-string instead of `format` call 131 131 | ### 132 132 | # Non-errors + Run `ruff check --fix` to apply this fix. + UP032_0.py:160:1: UP032 [*] Use f-string instead of `format` call | 158 | r'"\N{snowman} {}".format(a)' @@ -958,7 +1044,7 @@ UP032_0.py:160:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 157 157 | 158 158 | r'"\N{snowman} {}".format(a)' 159 159 | @@ -970,6 +1056,8 @@ UP032_0.py:160:1: UP032 [*] Use f-string instead of `format` call 164 162 | """ 165 163 | {} + Run `ruff check --fix` to apply this fix. + UP032_0.py:164:1: UP032 [*] Use f-string instead of `format` call | 162 | ) @@ -989,7 +1077,7 @@ UP032_0.py:164:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 161 161 | 11111111111111111111111111111111111111111111111111111111111111111111111111, 162 162 | ) 163 163 | @@ -1010,6 +1098,8 @@ UP032_0.py:164:1: UP032 [*] Use f-string instead of `format` call 174 170 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = """{} 175 171 | """.format( + Run `ruff check --fix` to apply this fix. + UP032_0.py:174:84: UP032 [*] Use f-string instead of `format` call | 172 | ) @@ -1025,7 +1115,7 @@ UP032_0.py:174:84: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 171 171 | 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111, 172 172 | ) 173 173 | @@ -1039,6 +1129,8 @@ UP032_0.py:174:84: UP032 [*] Use f-string instead of `format` call 179 177 | "{}".format( 180 178 | [ + Run `ruff check --fix` to apply this fix. + UP032_0.py:202:1: UP032 Use f-string instead of `format` call | 200 | "{}".format(**c) @@ -1061,7 +1153,7 @@ UP032_0.py:209:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 206 206 | 207 207 | # The fixed string will exceed the line length, but it's still smaller than the 208 208 | # existing line length, so it's fine. @@ -1071,6 +1163,8 @@ UP032_0.py:209:1: UP032 [*] Use f-string instead of `format` call 211 211 | # When fixing, trim the trailing empty string. 212 212 | raise ValueError("Conflicting configuration dicts: {!r} {!r}" + Run `ruff check --fix` to apply this fix. + UP032_0.py:212:18: UP032 [*] Use f-string instead of `format` call | 211 | # When fixing, trim the trailing empty string. @@ -1083,7 +1177,7 @@ UP032_0.py:212:18: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 209 209 | "".format(self.internal_ids, self.external_ids, self.properties, self.tags, self.others) 210 210 | 211 211 | # When fixing, trim the trailing empty string. @@ -1094,6 +1188,8 @@ UP032_0.py:212:18: UP032 [*] Use f-string instead of `format` call 215 214 | # When fixing, trim the trailing empty string. 216 215 | raise ValueError("Conflicting configuration dicts: {!r} {!r}" + Run `ruff check --fix` to apply this fix. + UP032_0.py:216:18: UP032 [*] Use f-string instead of `format` call | 215 | # When fixing, trim the trailing empty string. @@ -1106,7 +1202,7 @@ UP032_0.py:216:18: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 213 213 | "".format(new_dict, d)) 214 214 | 215 215 | # When fixing, trim the trailing empty string. @@ -1118,6 +1214,8 @@ UP032_0.py:216:18: UP032 [*] Use f-string instead of `format` call 219 219 | raise ValueError( 220 220 | "Conflicting configuration dicts: {!r} {!r}" + Run `ruff check --fix` to apply this fix. + UP032_0.py:220:5: UP032 [*] Use f-string instead of `format` call | 219 | raise ValueError( @@ -1129,7 +1227,7 @@ UP032_0.py:220:5: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 217 217 | .format(new_dict, d)) 218 218 | 219 219 | raise ValueError( @@ -1140,6 +1238,8 @@ UP032_0.py:220:5: UP032 [*] Use f-string instead of `format` call 223 222 | 224 223 | raise ValueError( + Run `ruff check --fix` to apply this fix. + UP032_0.py:225:5: UP032 [*] Use f-string instead of `format` call | 224 | raise ValueError( @@ -1152,7 +1252,7 @@ UP032_0.py:225:5: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 222 222 | ) 223 223 | 224 224 | raise ValueError( @@ -1163,6 +1263,8 @@ UP032_0.py:225:5: UP032 [*] Use f-string instead of `format` call 228 227 | ) 229 228 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:231:1: UP032 [*] Use f-string instead of `format` call | 230 | # The first string will be converted to an f-string and the curly braces in the second should be converted to be unescaped @@ -1176,7 +1278,7 @@ UP032_0.py:231:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 229 229 | 230 230 | # The first string will be converted to an f-string and the curly braces in the second should be converted to be unescaped 231 231 | ( @@ -1189,6 +1291,8 @@ UP032_0.py:231:1: UP032 [*] Use f-string instead of `format` call 236 236 | ("{}" "{{}}").format(a) 237 237 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:236:1: UP032 [*] Use f-string instead of `format` call | 234 | ).format(a) @@ -1198,7 +1302,7 @@ UP032_0.py:236:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 233 233 | "{{}}" 234 234 | ).format(a) 235 235 | @@ -1208,6 +1312,8 @@ UP032_0.py:236:1: UP032 [*] Use f-string instead of `format` call 238 238 | 239 239 | # Both strings will be converted to an f-string and the curly braces in the second should left escaped + Run `ruff check --fix` to apply this fix. + UP032_0.py:240:1: UP032 [*] Use f-string instead of `format` call | 239 | # Both strings will be converted to an f-string and the curly braces in the second should left escaped @@ -1221,7 +1327,7 @@ UP032_0.py:240:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 238 238 | 239 239 | # Both strings will be converted to an f-string and the curly braces in the second should left escaped 240 240 | ( @@ -1235,6 +1341,8 @@ UP032_0.py:240:1: UP032 [*] Use f-string instead of `format` call 245 245 | ("{}" "{{{}}}").format(a, b) 246 246 | + Run `ruff check --fix` to apply this fix. + UP032_0.py:245:1: UP032 [*] Use f-string instead of `format` call | 243 | ).format(a, b) @@ -1246,7 +1354,7 @@ UP032_0.py:245:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 242 242 | "{{{}}}" 243 243 | ).format(a, b) 244 244 | @@ -1256,6 +1364,8 @@ UP032_0.py:245:1: UP032 [*] Use f-string instead of `format` call 247 247 | # The dictionary should be parenthesized. 248 248 | "{}".format({0: 1}[0]) + Run `ruff check --fix` to apply this fix. + UP032_0.py:248:1: UP032 [*] Use f-string instead of `format` call | 247 | # The dictionary should be parenthesized. @@ -1266,7 +1376,7 @@ UP032_0.py:248:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 245 245 | ("{}" "{{{}}}").format(a, b) 246 246 | 247 247 | # The dictionary should be parenthesized. @@ -1276,6 +1386,8 @@ UP032_0.py:248:1: UP032 [*] Use f-string instead of `format` call 250 250 | # The dictionary should be parenthesized. 251 251 | "{}".format({0: 1}.bar) + Run `ruff check --fix` to apply this fix. + UP032_0.py:251:1: UP032 [*] Use f-string instead of `format` call | 250 | # The dictionary should be parenthesized. @@ -1286,7 +1398,7 @@ UP032_0.py:251:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 248 248 | "{}".format({0: 1}[0]) 249 249 | 250 250 | # The dictionary should be parenthesized. @@ -1296,6 +1408,8 @@ UP032_0.py:251:1: UP032 [*] Use f-string instead of `format` call 253 253 | # The dictionary should be parenthesized. 254 254 | "{}".format({0: 1}()) + Run `ruff check --fix` to apply this fix. + UP032_0.py:254:1: UP032 [*] Use f-string instead of `format` call | 253 | # The dictionary should be parenthesized. @@ -1306,7 +1420,7 @@ UP032_0.py:254:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 251 251 | "{}".format({0: 1}.bar) 252 252 | 253 253 | # The dictionary should be parenthesized. @@ -1316,6 +1430,8 @@ UP032_0.py:254:1: UP032 [*] Use f-string instead of `format` call 256 256 | # The string shouldn't be converted, since it would require repeating the function call. 257 257 | "{x} {x}".format(x=foo()) + Run `ruff check --fix` to apply this fix. + UP032_0.py:261:1: UP032 [*] Use f-string instead of `format` call | 260 | # The string _should_ be converted, since the function call is repeated in the arguments. @@ -1326,7 +1442,7 @@ UP032_0.py:261:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 258 258 | "{0} {0}".format(foo()) 259 259 | 260 260 | # The string _should_ be converted, since the function call is repeated in the arguments. @@ -1336,6 +1452,8 @@ UP032_0.py:261:1: UP032 [*] Use f-string instead of `format` call 263 263 | # The call should be removed, but the string itself should remain. 264 264 | ''.format(self.project) + Run `ruff check --fix` to apply this fix. + UP032_0.py:264:1: UP032 [*] Use f-string instead of `format` call | 263 | # The call should be removed, but the string itself should remain. @@ -1346,7 +1464,7 @@ UP032_0.py:264:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 261 261 | "{0} {1}".format(foo(), foo()) 262 262 | 263 263 | # The call should be removed, but the string itself should remain. @@ -1356,6 +1474,8 @@ UP032_0.py:264:1: UP032 [*] Use f-string instead of `format` call 266 266 | # The call should be removed, but the string itself should remain. 267 267 | "".format(self.project) + Run `ruff check --fix` to apply this fix. + UP032_0.py:267:1: UP032 [*] Use f-string instead of `format` call | 266 | # The call should be removed, but the string itself should remain. @@ -1366,7 +1486,7 @@ UP032_0.py:267:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 264 264 | ''.format(self.project) 265 265 | 266 266 | # The call should be removed, but the string itself should remain. @@ -1376,6 +1496,8 @@ UP032_0.py:267:1: UP032 [*] Use f-string instead of `format` call 269 269 | # Not a valid type annotation but this test shouldn't result in a panic. 270 270 | # Refer: https://github.com/astral-sh/ruff/issues/11736 + Run `ruff check --fix` to apply this fix. + UP032_0.py:271:5: UP032 [*] Use f-string instead of `format` call | 269 | # Not a valid type annotation but this test shouldn't result in a panic. @@ -1385,9 +1507,11 @@ UP032_0.py:271:5: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 268 268 | 269 269 | # Not a valid type annotation but this test shouldn't result in a panic. 270 270 | # Refer: https://github.com/astral-sh/ruff/issues/11736 271 |-x: "'{} + {}'.format(x, y)" 271 |+x: "f'{x} + {y}'" + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap index 221526314e6fb..e33290ea4624b 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap @@ -8,6 +8,8 @@ UP032_1.py:1:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 1 |-"{} {}".format(a, b) # Intentionally at start-of-file, to ensure graceful handling. 1 |+f"{a} {b}" # Intentionally at start-of-file, to ensure graceful handling. + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap index 7ad4096da6182..73b978b1c9a15 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap @@ -11,7 +11,7 @@ UP032_2.py:2:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 1 1 | # Errors 2 |-"{.real}".format(1) 2 |+f"{(1).real}" @@ -19,6 +19,8 @@ UP032_2.py:2:1: UP032 [*] Use f-string instead of `format` call 4 4 | "{a.real}".format(a=1) 5 5 | + Run `ruff check --fix` to apply this fix. + UP032_2.py:3:1: UP032 [*] Use f-string instead of `format` call | 1 | # Errors @@ -29,7 +31,7 @@ UP032_2.py:3:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 1 1 | # Errors 2 2 | "{.real}".format(1) 3 |-"{0.real}".format(1) @@ -38,6 +40,8 @@ UP032_2.py:3:1: UP032 [*] Use f-string instead of `format` call 5 5 | 6 6 | "{.real}".format(1.0) + Run `ruff check --fix` to apply this fix. + UP032_2.py:4:1: UP032 [*] Use f-string instead of `format` call | 2 | "{.real}".format(1) @@ -49,7 +53,7 @@ UP032_2.py:4:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 1 1 | # Errors 2 2 | "{.real}".format(1) 3 3 | "{0.real}".format(1) @@ -59,6 +63,8 @@ UP032_2.py:4:1: UP032 [*] Use f-string instead of `format` call 6 6 | "{.real}".format(1.0) 7 7 | "{0.real}".format(1.0) + Run `ruff check --fix` to apply this fix. + UP032_2.py:6:1: UP032 [*] Use f-string instead of `format` call | 4 | "{a.real}".format(a=1) @@ -70,7 +76,7 @@ UP032_2.py:6:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 3 3 | "{0.real}".format(1) 4 4 | "{a.real}".format(a=1) 5 5 | @@ -80,6 +86,8 @@ UP032_2.py:6:1: UP032 [*] Use f-string instead of `format` call 8 8 | "{a.real}".format(a=1.0) 9 9 | + Run `ruff check --fix` to apply this fix. + UP032_2.py:7:1: UP032 [*] Use f-string instead of `format` call | 6 | "{.real}".format(1.0) @@ -89,7 +97,7 @@ UP032_2.py:7:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 4 4 | "{a.real}".format(a=1) 5 5 | 6 6 | "{.real}".format(1.0) @@ -99,6 +107,8 @@ UP032_2.py:7:1: UP032 [*] Use f-string instead of `format` call 9 9 | 10 10 | "{.real}".format(1j) + Run `ruff check --fix` to apply this fix. + UP032_2.py:8:1: UP032 [*] Use f-string instead of `format` call | 6 | "{.real}".format(1.0) @@ -110,7 +120,7 @@ UP032_2.py:8:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | "{.real}".format(1.0) 7 7 | "{0.real}".format(1.0) @@ -120,6 +130,8 @@ UP032_2.py:8:1: UP032 [*] Use f-string instead of `format` call 10 10 | "{.real}".format(1j) 11 11 | "{0.real}".format(1j) + Run `ruff check --fix` to apply this fix. + UP032_2.py:10:1: UP032 [*] Use f-string instead of `format` call | 8 | "{a.real}".format(a=1.0) @@ -131,7 +143,7 @@ UP032_2.py:10:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 7 7 | "{0.real}".format(1.0) 8 8 | "{a.real}".format(a=1.0) 9 9 | @@ -141,6 +153,8 @@ UP032_2.py:10:1: UP032 [*] Use f-string instead of `format` call 12 12 | "{a.real}".format(a=1j) 13 13 | + Run `ruff check --fix` to apply this fix. + UP032_2.py:11:1: UP032 [*] Use f-string instead of `format` call | 10 | "{.real}".format(1j) @@ -150,7 +164,7 @@ UP032_2.py:11:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 8 8 | "{a.real}".format(a=1.0) 9 9 | 10 10 | "{.real}".format(1j) @@ -160,6 +174,8 @@ UP032_2.py:11:1: UP032 [*] Use f-string instead of `format` call 13 13 | 14 14 | "{.real}".format(0b01) + Run `ruff check --fix` to apply this fix. + UP032_2.py:12:1: UP032 [*] Use f-string instead of `format` call | 10 | "{.real}".format(1j) @@ -171,7 +187,7 @@ UP032_2.py:12:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 9 9 | 10 10 | "{.real}".format(1j) 11 11 | "{0.real}".format(1j) @@ -181,6 +197,8 @@ UP032_2.py:12:1: UP032 [*] Use f-string instead of `format` call 14 14 | "{.real}".format(0b01) 15 15 | "{0.real}".format(0b01) + Run `ruff check --fix` to apply this fix. + UP032_2.py:14:1: UP032 [*] Use f-string instead of `format` call | 12 | "{a.real}".format(a=1j) @@ -192,7 +210,7 @@ UP032_2.py:14:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 11 11 | "{0.real}".format(1j) 12 12 | "{a.real}".format(a=1j) 13 13 | @@ -202,6 +220,8 @@ UP032_2.py:14:1: UP032 [*] Use f-string instead of `format` call 16 16 | "{a.real}".format(a=0b01) 17 17 | + Run `ruff check --fix` to apply this fix. + UP032_2.py:15:1: UP032 [*] Use f-string instead of `format` call | 14 | "{.real}".format(0b01) @@ -211,7 +231,7 @@ UP032_2.py:15:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 12 12 | "{a.real}".format(a=1j) 13 13 | 14 14 | "{.real}".format(0b01) @@ -221,6 +241,8 @@ UP032_2.py:15:1: UP032 [*] Use f-string instead of `format` call 17 17 | 18 18 | "{}".format(1 + 2) + Run `ruff check --fix` to apply this fix. + UP032_2.py:16:1: UP032 [*] Use f-string instead of `format` call | 14 | "{.real}".format(0b01) @@ -232,7 +254,7 @@ UP032_2.py:16:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 13 13 | 14 14 | "{.real}".format(0b01) 15 15 | "{0.real}".format(0b01) @@ -242,6 +264,8 @@ UP032_2.py:16:1: UP032 [*] Use f-string instead of `format` call 18 18 | "{}".format(1 + 2) 19 19 | "{}".format([1, 2]) + Run `ruff check --fix` to apply this fix. + UP032_2.py:18:1: UP032 [*] Use f-string instead of `format` call | 16 | "{a.real}".format(a=0b01) @@ -253,7 +277,7 @@ UP032_2.py:18:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 15 15 | "{0.real}".format(0b01) 16 16 | "{a.real}".format(a=0b01) 17 17 | @@ -263,6 +287,8 @@ UP032_2.py:18:1: UP032 [*] Use f-string instead of `format` call 20 20 | "{}".format({1, 2}) 21 21 | "{}".format({1: 2, 3: 4}) + Run `ruff check --fix` to apply this fix. + UP032_2.py:19:1: UP032 [*] Use f-string instead of `format` call | 18 | "{}".format(1 + 2) @@ -273,7 +299,7 @@ UP032_2.py:19:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 16 16 | "{a.real}".format(a=0b01) 17 17 | 18 18 | "{}".format(1 + 2) @@ -283,6 +309,8 @@ UP032_2.py:19:1: UP032 [*] Use f-string instead of `format` call 21 21 | "{}".format({1: 2, 3: 4}) 22 22 | "{}".format((i for i in range(2))) + Run `ruff check --fix` to apply this fix. + UP032_2.py:20:1: UP032 [*] Use f-string instead of `format` call | 18 | "{}".format(1 + 2) @@ -294,7 +322,7 @@ UP032_2.py:20:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 17 17 | 18 18 | "{}".format(1 + 2) 19 19 | "{}".format([1, 2]) @@ -304,6 +332,8 @@ UP032_2.py:20:1: UP032 [*] Use f-string instead of `format` call 22 22 | "{}".format((i for i in range(2))) 23 23 | + Run `ruff check --fix` to apply this fix. + UP032_2.py:21:1: UP032 [*] Use f-string instead of `format` call | 19 | "{}".format([1, 2]) @@ -314,7 +344,7 @@ UP032_2.py:21:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 18 18 | "{}".format(1 + 2) 19 19 | "{}".format([1, 2]) 20 20 | "{}".format({1, 2}) @@ -324,6 +354,8 @@ UP032_2.py:21:1: UP032 [*] Use f-string instead of `format` call 23 23 | 24 24 | "{.real}".format(1 + 2) + Run `ruff check --fix` to apply this fix. + UP032_2.py:22:1: UP032 [*] Use f-string instead of `format` call | 20 | "{}".format({1, 2}) @@ -335,7 +367,7 @@ UP032_2.py:22:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 19 19 | "{}".format([1, 2]) 20 20 | "{}".format({1, 2}) 21 21 | "{}".format({1: 2, 3: 4}) @@ -345,6 +377,8 @@ UP032_2.py:22:1: UP032 [*] Use f-string instead of `format` call 24 24 | "{.real}".format(1 + 2) 25 25 | "{.real}".format([1, 2]) + Run `ruff check --fix` to apply this fix. + UP032_2.py:24:1: UP032 [*] Use f-string instead of `format` call | 22 | "{}".format((i for i in range(2))) @@ -356,7 +390,7 @@ UP032_2.py:24:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 21 21 | "{}".format({1: 2, 3: 4}) 22 22 | "{}".format((i for i in range(2))) 23 23 | @@ -366,6 +400,8 @@ UP032_2.py:24:1: UP032 [*] Use f-string instead of `format` call 26 26 | "{.real}".format({1, 2}) 27 27 | "{.real}".format({1: 2, 3: 4}) + Run `ruff check --fix` to apply this fix. + UP032_2.py:25:1: UP032 [*] Use f-string instead of `format` call | 24 | "{.real}".format(1 + 2) @@ -376,7 +412,7 @@ UP032_2.py:25:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 22 22 | "{}".format((i for i in range(2))) 23 23 | 24 24 | "{.real}".format(1 + 2) @@ -386,6 +422,8 @@ UP032_2.py:25:1: UP032 [*] Use f-string instead of `format` call 27 27 | "{.real}".format({1: 2, 3: 4}) 28 28 | "{}".format((i for i in range(2))) + Run `ruff check --fix` to apply this fix. + UP032_2.py:26:1: UP032 [*] Use f-string instead of `format` call | 24 | "{.real}".format(1 + 2) @@ -397,7 +435,7 @@ UP032_2.py:26:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 23 23 | 24 24 | "{.real}".format(1 + 2) 25 25 | "{.real}".format([1, 2]) @@ -406,6 +444,8 @@ UP032_2.py:26:1: UP032 [*] Use f-string instead of `format` call 27 27 | "{.real}".format({1: 2, 3: 4}) 28 28 | "{}".format((i for i in range(2))) + Run `ruff check --fix` to apply this fix. + UP032_2.py:27:1: UP032 [*] Use f-string instead of `format` call | 25 | "{.real}".format([1, 2]) @@ -416,7 +456,7 @@ UP032_2.py:27:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 24 24 | "{.real}".format(1 + 2) 25 25 | "{.real}".format([1, 2]) 26 26 | "{.real}".format({1, 2}) @@ -424,6 +464,8 @@ UP032_2.py:27:1: UP032 [*] Use f-string instead of `format` call 27 |+f"{({1: 2, 3: 4}).real}" 28 28 | "{}".format((i for i in range(2))) + Run `ruff check --fix` to apply this fix. + UP032_2.py:28:1: UP032 [*] Use f-string instead of `format` call | 26 | "{.real}".format({1, 2}) @@ -433,9 +475,11 @@ UP032_2.py:28:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Safe fix +Suggested fix: 25 25 | "{.real}".format([1, 2]) 26 26 | "{.real}".format({1, 2}) 27 27 | "{.real}".format({1: 2, 3: 4}) 28 |-"{}".format((i for i in range(2))) 28 |+f"{(i for i in range(2))}" + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_0.py.snap index 8d6d1475d226c..ec806a3dd0dab 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_0.py.snap @@ -10,7 +10,7 @@ UP033_0.py:4:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_cac | = help: Rewrite with `@functools.cache -ℹ Safe fix +Suggested fix: 1 1 | import functools 2 2 | 3 3 | @@ -20,6 +20,8 @@ UP033_0.py:4:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_cac 6 6 | pass 7 7 | + Run `ruff check --fix` to apply this fix. + UP033_0.py:10:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` | 9 | @other_decorator @@ -30,7 +32,7 @@ UP033_0.py:10:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca | = help: Rewrite with `@functools.cache -ℹ Safe fix +Suggested fix: 7 7 | 8 8 | 9 9 | @other_decorator @@ -40,6 +42,8 @@ UP033_0.py:10:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca 12 12 | pass 13 13 | + Run `ruff check --fix` to apply this fix. + UP033_0.py:15:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` | 15 | @functools.lru_cache(maxsize=None) @@ -49,7 +53,7 @@ UP033_0.py:15:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca | = help: Rewrite with `@functools.cache -ℹ Safe fix +Suggested fix: 12 12 | pass 13 13 | 14 14 | @@ -59,4 +63,4 @@ UP033_0.py:15:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca 17 17 | def fixme(): 18 18 | pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_1.py.snap index 5b106d25411d2..6a9471ce4c467 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_1.py.snap @@ -10,7 +10,7 @@ UP033_1.py:4:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_cac | = help: Rewrite with `@functools.cache -ℹ Safe fix +Suggested fix: 1 |-from functools import lru_cache 1 |+from functools import lru_cache, cache 2 2 | @@ -21,6 +21,8 @@ UP033_1.py:4:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_cac 6 6 | pass 7 7 | + Run `ruff check --fix` to apply this fix. + UP033_1.py:10:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` | 9 | @other_decorator @@ -31,7 +33,7 @@ UP033_1.py:10:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca | = help: Rewrite with `@functools.cache -ℹ Safe fix +Suggested fix: 1 |-from functools import lru_cache 1 |+from functools import lru_cache, cache 2 2 | @@ -47,6 +49,8 @@ UP033_1.py:10:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca 12 12 | pass 13 13 | + Run `ruff check --fix` to apply this fix. + UP033_1.py:15:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` | 15 | @lru_cache(maxsize=None) @@ -56,7 +60,7 @@ UP033_1.py:15:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca | = help: Rewrite with `@functools.cache -ℹ Safe fix +Suggested fix: 1 |-from functools import lru_cache 1 |+from functools import lru_cache, cache 2 2 | @@ -72,4 +76,4 @@ UP033_1.py:15:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca 17 17 | def fixme(): 18 18 | pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP034.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP034.py.snap index 52e90884c17da..4ee8189e4954c 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP034.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP034.py.snap @@ -11,7 +11,7 @@ UP034.py:2:7: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Safe fix +Suggested fix: 1 1 | # UP034 2 |-print(("foo")) 2 |+print("foo") @@ -19,6 +19,8 @@ UP034.py:2:7: UP034 [*] Avoid extraneous parentheses 4 4 | # UP034 5 5 | print(("hell((goodybe))o")) + Run `ruff check --fix` to apply this fix. + UP034.py:5:7: UP034 [*] Avoid extraneous parentheses | 4 | # UP034 @@ -29,7 +31,7 @@ UP034.py:5:7: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Safe fix +Suggested fix: 2 2 | print(("foo")) 3 3 | 4 4 | # UP034 @@ -39,6 +41,8 @@ UP034.py:5:7: UP034 [*] Avoid extraneous parentheses 7 7 | # UP034 8 8 | print((("foo"))) + Run `ruff check --fix` to apply this fix. + UP034.py:8:7: UP034 [*] Avoid extraneous parentheses | 7 | # UP034 @@ -49,7 +53,7 @@ UP034.py:8:7: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Safe fix +Suggested fix: 5 5 | print(("hell((goodybe))o")) 6 6 | 7 7 | # UP034 @@ -59,6 +63,8 @@ UP034.py:8:7: UP034 [*] Avoid extraneous parentheses 10 10 | # UP034 11 11 | print((((1)))) + Run `ruff check --fix` to apply this fix. + UP034.py:11:7: UP034 [*] Avoid extraneous parentheses | 10 | # UP034 @@ -69,7 +75,7 @@ UP034.py:11:7: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Safe fix +Suggested fix: 8 8 | print((("foo"))) 9 9 | 10 10 | # UP034 @@ -79,6 +85,8 @@ UP034.py:11:7: UP034 [*] Avoid extraneous parentheses 13 13 | # UP034 14 14 | print(("foo{}".format(1))) + Run `ruff check --fix` to apply this fix. + UP034.py:14:7: UP034 [*] Avoid extraneous parentheses | 13 | # UP034 @@ -89,7 +97,7 @@ UP034.py:14:7: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Safe fix +Suggested fix: 11 11 | print((((1)))) 12 12 | 13 13 | # UP034 @@ -99,6 +107,8 @@ UP034.py:14:7: UP034 [*] Avoid extraneous parentheses 16 16 | # UP034 17 17 | print( + Run `ruff check --fix` to apply this fix. + UP034.py:18:5: UP034 [*] Avoid extraneous parentheses | 16 | # UP034 @@ -109,7 +119,7 @@ UP034.py:18:5: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Safe fix +Suggested fix: 15 15 | 16 16 | # UP034 17 17 | print( @@ -119,6 +129,8 @@ UP034.py:18:5: UP034 [*] Avoid extraneous parentheses 20 20 | 21 21 | # UP034 + Run `ruff check --fix` to apply this fix. + UP034.py:23:5: UP034 [*] Avoid extraneous parentheses | 21 | # UP034 @@ -132,7 +144,7 @@ UP034.py:23:5: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Safe fix +Suggested fix: 20 20 | 21 21 | # UP034 22 22 | print( @@ -145,6 +157,8 @@ UP034.py:23:5: UP034 [*] Avoid extraneous parentheses 27 27 | 28 28 | # UP034 + Run `ruff check --fix` to apply this fix. + UP034.py:30:13: UP034 [*] Avoid extraneous parentheses | 28 | # UP034 @@ -156,7 +170,7 @@ UP034.py:30:13: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Safe fix +Suggested fix: 27 27 | 28 28 | # UP034 29 29 | def f(): @@ -166,6 +180,8 @@ UP034.py:30:13: UP034 [*] Avoid extraneous parentheses 32 32 | # UP034 33 33 | if True: + Run `ruff check --fix` to apply this fix. + UP034.py:35:9: UP034 [*] Avoid extraneous parentheses | 33 | if True: @@ -176,7 +192,7 @@ UP034.py:35:9: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Safe fix +Suggested fix: 32 32 | # UP034 33 33 | if True: 34 34 | print( @@ -186,6 +202,8 @@ UP034.py:35:9: UP034 [*] Avoid extraneous parentheses 37 37 | 38 38 | # UP034 + Run `ruff check --fix` to apply this fix. + UP034.py:39:7: UP034 [*] Avoid extraneous parentheses | 38 | # UP034 @@ -196,7 +214,7 @@ UP034.py:39:7: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Safe fix +Suggested fix: 36 36 | ) 37 37 | 38 38 | # UP034 @@ -206,4 +224,4 @@ UP034.py:39:7: UP034 [*] Avoid extraneous parentheses 41 41 | # OK 42 42 | print("foo") - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap index e83b5d88e3ec8..ca712f56496ae 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap @@ -11,7 +11,7 @@ UP035.py:2:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 1 1 | # UP035 2 |-from collections import Mapping 2 |+from collections.abc import Mapping @@ -19,6 +19,8 @@ UP035.py:2:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 4 4 | from collections import Mapping as MAP 5 5 | + Run `ruff check --fix` to apply this fix. + UP035.py:4:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 2 | from collections import Mapping @@ -30,7 +32,7 @@ UP035.py:4:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 1 1 | # UP035 2 2 | from collections import Mapping 3 3 | @@ -40,6 +42,8 @@ UP035.py:4:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 6 6 | from collections import Mapping, Sequence 7 7 | + Run `ruff check --fix` to apply this fix. + UP035.py:6:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequence` | 4 | from collections import Mapping as MAP @@ -51,7 +55,7 @@ UP035.py:6:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Seque | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | from collections import Mapping as MAP 5 5 | @@ -61,6 +65,8 @@ UP035.py:6:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Seque 8 8 | from collections import Counter, Mapping 9 9 | + Run `ruff check --fix` to apply this fix. + UP035.py:8:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 6 | from collections import Mapping, Sequence @@ -72,7 +78,7 @@ UP035.py:8:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | from collections import Mapping, Sequence 7 7 | @@ -83,6 +89,8 @@ UP035.py:8:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 10 11 | from collections import (Counter, Mapping) 11 12 | + Run `ruff check --fix` to apply this fix. + UP035.py:10:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 8 | from collections import Counter, Mapping @@ -94,7 +102,7 @@ UP035.py:10:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 7 7 | 8 8 | from collections import Counter, Mapping 9 9 | @@ -105,6 +113,8 @@ UP035.py:10:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 12 13 | from collections import (Counter, 13 14 | Mapping) + Run `ruff check --fix` to apply this fix. + UP035.py:12:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 10 | from collections import (Counter, Mapping) @@ -117,7 +127,7 @@ UP035.py:12:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 9 9 | 10 10 | from collections import (Counter, Mapping) 11 11 | @@ -129,6 +139,8 @@ UP035.py:12:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 15 15 | from collections import Counter, \ 16 16 | Mapping + Run `ruff check --fix` to apply this fix. + UP035.py:15:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 13 | Mapping) @@ -141,7 +153,7 @@ UP035.py:15:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 12 12 | from collections import (Counter, 13 13 | Mapping) 14 14 | @@ -153,6 +165,8 @@ UP035.py:15:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 18 18 | from collections import Counter, Mapping, Sequence 19 19 | + Run `ruff check --fix` to apply this fix. + UP035.py:18:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequence` | 16 | Mapping @@ -164,7 +178,7 @@ UP035.py:18:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequ | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 15 15 | from collections import Counter, \ 16 16 | Mapping 17 17 | @@ -175,6 +189,8 @@ UP035.py:18:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequ 20 21 | from collections import Mapping as mapping, Counter 21 22 | + Run `ruff check --fix` to apply this fix. + UP035.py:20:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 18 | from collections import Counter, Mapping, Sequence @@ -186,7 +202,7 @@ UP035.py:20:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 17 17 | 18 18 | from collections import Counter, Mapping, Sequence 19 19 | @@ -197,6 +213,8 @@ UP035.py:20:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 22 23 | if True: 23 24 | from collections import Mapping, Counter + Run `ruff check --fix` to apply this fix. + UP035.py:23:5: UP035 [*] Import from `collections.abc` instead: `Mapping` | 22 | if True: @@ -207,7 +225,7 @@ UP035.py:23:5: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 20 20 | from collections import Mapping as mapping, Counter 21 21 | 22 22 | if True: @@ -218,6 +236,8 @@ UP035.py:23:5: UP035 [*] Import from `collections.abc` instead: `Mapping` 25 26 | if True: 26 27 | if True: + Run `ruff check --fix` to apply this fix. + UP035.py:28:5: UP035 [*] Import from `collections.abc` instead: `Mapping` | 26 | if True: @@ -229,7 +249,7 @@ UP035.py:28:5: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 25 25 | if True: 26 26 | if True: 27 27 | pass @@ -240,6 +260,8 @@ UP035.py:28:5: UP035 [*] Import from `collections.abc` instead: `Mapping` 30 31 | if True: from collections import Mapping 31 32 | + Run `ruff check --fix` to apply this fix. + UP035.py:30:10: UP035 [*] Import from `collections.abc` instead: `Mapping` | 28 | from collections import Mapping, Counter @@ -251,7 +273,7 @@ UP035.py:30:10: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 27 27 | pass 28 28 | from collections import Mapping, Counter 29 29 | @@ -261,6 +283,8 @@ UP035.py:30:10: UP035 [*] Import from `collections.abc` instead: `Mapping` 32 32 | import os 33 33 | from collections import Counter, Mapping + Run `ruff check --fix` to apply this fix. + UP035.py:33:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 32 | import os @@ -270,7 +294,7 @@ UP035.py:33:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 30 30 | if True: from collections import Mapping 31 31 | 32 32 | import os @@ -281,6 +305,8 @@ UP035.py:33:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 35 36 | 36 37 | if True: + Run `ruff check --fix` to apply this fix. + UP035.py:37:5: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Callable` | 36 | if True: @@ -297,7 +323,7 @@ UP035.py:37:5: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Call | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 35 35 | 36 36 | if True: 37 37 | from collections import ( @@ -311,6 +337,8 @@ UP035.py:37:5: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Call 44 43 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager 45 44 | + Run `ruff check --fix` to apply this fix. + UP035.py:44:1: UP035 [*] Import from `collections.abc` instead: `Callable` | 42 | ) @@ -322,7 +350,7 @@ UP035.py:44:1: UP035 [*] Import from `collections.abc` instead: `Callable` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 41 41 | Good, 42 42 | ) 43 43 | @@ -333,6 +361,8 @@ UP035.py:44:1: UP035 [*] Import from `collections.abc` instead: `Callable` 46 47 | if True: from collections import ( 47 48 | Mapping, Counter) + Run `ruff check --fix` to apply this fix. + UP035.py:44:1: UP035 [*] Import from `collections` instead: `OrderedDict` | 42 | ) @@ -344,7 +374,7 @@ UP035.py:44:1: UP035 [*] Import from `collections` instead: `OrderedDict` | = help: Import from `collections` -ℹ Safe fix +Suggested fix: 41 41 | Good, 42 42 | ) 43 43 | @@ -355,6 +385,8 @@ UP035.py:44:1: UP035 [*] Import from `collections` instead: `OrderedDict` 46 47 | if True: from collections import ( 47 48 | Mapping, Counter) + Run `ruff check --fix` to apply this fix. + UP035.py:44:1: UP035 [*] Import from `re` instead: `Match`, `Pattern` | 42 | ) @@ -366,7 +398,7 @@ UP035.py:44:1: UP035 [*] Import from `re` instead: `Match`, `Pattern` | = help: Import from `re` -ℹ Safe fix +Suggested fix: 41 41 | Good, 42 42 | ) 43 43 | @@ -377,6 +409,8 @@ UP035.py:44:1: UP035 [*] Import from `re` instead: `Match`, `Pattern` 46 47 | if True: from collections import ( 47 48 | Mapping, Counter) + Run `ruff check --fix` to apply this fix. + UP035.py:44:1: UP035 `typing.List` is deprecated, use `list` instead | 42 | ) @@ -440,7 +474,7 @@ UP035.py:51:1: UP035 [*] Import from `collections` instead: `OrderedDict` | = help: Import from `collections` -ℹ Safe fix +Suggested fix: 48 48 | 49 49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035) 50 50 | from typing import ContextManager @@ -450,6 +484,8 @@ UP035.py:51:1: UP035 [*] Import from `collections` instead: `OrderedDict` 53 53 | from typing import Callable 54 54 | from typing import ByteString + Run `ruff check --fix` to apply this fix. + UP035.py:52:1: UP035 [*] Import from `typing` instead: `OrderedDict` | 50 | from typing import ContextManager @@ -461,7 +497,7 @@ UP035.py:52:1: UP035 [*] Import from `typing` instead: `OrderedDict` | = help: Import from `typing` -ℹ Safe fix +Suggested fix: 49 49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035) 50 50 | from typing import ContextManager 51 51 | from typing import OrderedDict @@ -471,6 +507,8 @@ UP035.py:52:1: UP035 [*] Import from `typing` instead: `OrderedDict` 54 54 | from typing import ByteString 55 55 | from typing import Container + Run `ruff check --fix` to apply this fix. + UP035.py:53:1: UP035 [*] Import from `collections.abc` instead: `Callable` | 51 | from typing import OrderedDict @@ -482,7 +520,7 @@ UP035.py:53:1: UP035 [*] Import from `collections.abc` instead: `Callable` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 50 50 | from typing import ContextManager 51 51 | from typing import OrderedDict 52 52 | from typing_extensions import OrderedDict @@ -492,6 +530,8 @@ UP035.py:53:1: UP035 [*] Import from `collections.abc` instead: `Callable` 55 55 | from typing import Container 56 56 | from typing import Hashable + Run `ruff check --fix` to apply this fix. + UP035.py:54:1: UP035 [*] Import from `collections.abc` instead: `ByteString` | 52 | from typing_extensions import OrderedDict @@ -503,7 +543,7 @@ UP035.py:54:1: UP035 [*] Import from `collections.abc` instead: `ByteString` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 51 51 | from typing import OrderedDict 52 52 | from typing_extensions import OrderedDict 53 53 | from typing import Callable @@ -513,6 +553,8 @@ UP035.py:54:1: UP035 [*] Import from `collections.abc` instead: `ByteString` 56 56 | from typing import Hashable 57 57 | from typing import ItemsView + Run `ruff check --fix` to apply this fix. + UP035.py:55:1: UP035 [*] Import from `collections.abc` instead: `Container` | 53 | from typing import Callable @@ -524,7 +566,7 @@ UP035.py:55:1: UP035 [*] Import from `collections.abc` instead: `Container` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 52 52 | from typing_extensions import OrderedDict 53 53 | from typing import Callable 54 54 | from typing import ByteString @@ -534,6 +576,8 @@ UP035.py:55:1: UP035 [*] Import from `collections.abc` instead: `Container` 57 57 | from typing import ItemsView 58 58 | from typing import Iterable + Run `ruff check --fix` to apply this fix. + UP035.py:56:1: UP035 [*] Import from `collections.abc` instead: `Hashable` | 54 | from typing import ByteString @@ -545,7 +589,7 @@ UP035.py:56:1: UP035 [*] Import from `collections.abc` instead: `Hashable` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 53 53 | from typing import Callable 54 54 | from typing import ByteString 55 55 | from typing import Container @@ -555,6 +599,8 @@ UP035.py:56:1: UP035 [*] Import from `collections.abc` instead: `Hashable` 58 58 | from typing import Iterable 59 59 | from typing import Iterator + Run `ruff check --fix` to apply this fix. + UP035.py:57:1: UP035 [*] Import from `collections.abc` instead: `ItemsView` | 55 | from typing import Container @@ -566,7 +612,7 @@ UP035.py:57:1: UP035 [*] Import from `collections.abc` instead: `ItemsView` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 54 54 | from typing import ByteString 55 55 | from typing import Container 56 56 | from typing import Hashable @@ -576,6 +622,8 @@ UP035.py:57:1: UP035 [*] Import from `collections.abc` instead: `ItemsView` 59 59 | from typing import Iterator 60 60 | from typing import KeysView + Run `ruff check --fix` to apply this fix. + UP035.py:58:1: UP035 [*] Import from `collections.abc` instead: `Iterable` | 56 | from typing import Hashable @@ -587,7 +635,7 @@ UP035.py:58:1: UP035 [*] Import from `collections.abc` instead: `Iterable` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 55 55 | from typing import Container 56 56 | from typing import Hashable 57 57 | from typing import ItemsView @@ -597,6 +645,8 @@ UP035.py:58:1: UP035 [*] Import from `collections.abc` instead: `Iterable` 60 60 | from typing import KeysView 61 61 | from typing import Mapping + Run `ruff check --fix` to apply this fix. + UP035.py:59:1: UP035 [*] Import from `collections.abc` instead: `Iterator` | 57 | from typing import ItemsView @@ -608,7 +658,7 @@ UP035.py:59:1: UP035 [*] Import from `collections.abc` instead: `Iterator` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 56 56 | from typing import Hashable 57 57 | from typing import ItemsView 58 58 | from typing import Iterable @@ -618,6 +668,8 @@ UP035.py:59:1: UP035 [*] Import from `collections.abc` instead: `Iterator` 61 61 | from typing import Mapping 62 62 | from typing import MappingView + Run `ruff check --fix` to apply this fix. + UP035.py:60:1: UP035 [*] Import from `collections.abc` instead: `KeysView` | 58 | from typing import Iterable @@ -629,7 +681,7 @@ UP035.py:60:1: UP035 [*] Import from `collections.abc` instead: `KeysView` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 57 57 | from typing import ItemsView 58 58 | from typing import Iterable 59 59 | from typing import Iterator @@ -639,6 +691,8 @@ UP035.py:60:1: UP035 [*] Import from `collections.abc` instead: `KeysView` 62 62 | from typing import MappingView 63 63 | from typing import MutableMapping + Run `ruff check --fix` to apply this fix. + UP035.py:61:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 59 | from typing import Iterator @@ -650,7 +704,7 @@ UP035.py:61:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 58 58 | from typing import Iterable 59 59 | from typing import Iterator 60 60 | from typing import KeysView @@ -660,6 +714,8 @@ UP035.py:61:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 63 63 | from typing import MutableMapping 64 64 | from typing import MutableSequence + Run `ruff check --fix` to apply this fix. + UP035.py:62:1: UP035 [*] Import from `collections.abc` instead: `MappingView` | 60 | from typing import KeysView @@ -671,7 +727,7 @@ UP035.py:62:1: UP035 [*] Import from `collections.abc` instead: `MappingView` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 59 59 | from typing import Iterator 60 60 | from typing import KeysView 61 61 | from typing import Mapping @@ -681,6 +737,8 @@ UP035.py:62:1: UP035 [*] Import from `collections.abc` instead: `MappingView` 64 64 | from typing import MutableSequence 65 65 | from typing import MutableSet + Run `ruff check --fix` to apply this fix. + UP035.py:63:1: UP035 [*] Import from `collections.abc` instead: `MutableMapping` | 61 | from typing import Mapping @@ -692,7 +750,7 @@ UP035.py:63:1: UP035 [*] Import from `collections.abc` instead: `MutableMapping` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 60 60 | from typing import KeysView 61 61 | from typing import Mapping 62 62 | from typing import MappingView @@ -702,6 +760,8 @@ UP035.py:63:1: UP035 [*] Import from `collections.abc` instead: `MutableMapping` 65 65 | from typing import MutableSet 66 66 | from typing import Sequence + Run `ruff check --fix` to apply this fix. + UP035.py:64:1: UP035 [*] Import from `collections.abc` instead: `MutableSequence` | 62 | from typing import MappingView @@ -713,7 +773,7 @@ UP035.py:64:1: UP035 [*] Import from `collections.abc` instead: `MutableSequence | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 61 61 | from typing import Mapping 62 62 | from typing import MappingView 63 63 | from typing import MutableMapping @@ -723,6 +783,8 @@ UP035.py:64:1: UP035 [*] Import from `collections.abc` instead: `MutableSequence 66 66 | from typing import Sequence 67 67 | from typing import Sized + Run `ruff check --fix` to apply this fix. + UP035.py:65:1: UP035 [*] Import from `collections.abc` instead: `MutableSet` | 63 | from typing import MutableMapping @@ -734,7 +796,7 @@ UP035.py:65:1: UP035 [*] Import from `collections.abc` instead: `MutableSet` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 62 62 | from typing import MappingView 63 63 | from typing import MutableMapping 64 64 | from typing import MutableSequence @@ -744,6 +806,8 @@ UP035.py:65:1: UP035 [*] Import from `collections.abc` instead: `MutableSet` 67 67 | from typing import Sized 68 68 | from typing import ValuesView + Run `ruff check --fix` to apply this fix. + UP035.py:66:1: UP035 [*] Import from `collections.abc` instead: `Sequence` | 64 | from typing import MutableSequence @@ -755,7 +819,7 @@ UP035.py:66:1: UP035 [*] Import from `collections.abc` instead: `Sequence` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 63 63 | from typing import MutableMapping 64 64 | from typing import MutableSequence 65 65 | from typing import MutableSet @@ -765,6 +829,8 @@ UP035.py:66:1: UP035 [*] Import from `collections.abc` instead: `Sequence` 68 68 | from typing import ValuesView 69 69 | from typing import Awaitable + Run `ruff check --fix` to apply this fix. + UP035.py:67:1: UP035 [*] Import from `collections.abc` instead: `Sized` | 65 | from typing import MutableSet @@ -776,7 +842,7 @@ UP035.py:67:1: UP035 [*] Import from `collections.abc` instead: `Sized` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 64 64 | from typing import MutableSequence 65 65 | from typing import MutableSet 66 66 | from typing import Sequence @@ -786,6 +852,8 @@ UP035.py:67:1: UP035 [*] Import from `collections.abc` instead: `Sized` 69 69 | from typing import Awaitable 70 70 | from typing import AsyncIterator + Run `ruff check --fix` to apply this fix. + UP035.py:68:1: UP035 [*] Import from `collections.abc` instead: `ValuesView` | 66 | from typing import Sequence @@ -797,7 +865,7 @@ UP035.py:68:1: UP035 [*] Import from `collections.abc` instead: `ValuesView` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 65 65 | from typing import MutableSet 66 66 | from typing import Sequence 67 67 | from typing import Sized @@ -807,6 +875,8 @@ UP035.py:68:1: UP035 [*] Import from `collections.abc` instead: `ValuesView` 70 70 | from typing import AsyncIterator 71 71 | from typing import AsyncIterable + Run `ruff check --fix` to apply this fix. + UP035.py:69:1: UP035 [*] Import from `collections.abc` instead: `Awaitable` | 67 | from typing import Sized @@ -818,7 +888,7 @@ UP035.py:69:1: UP035 [*] Import from `collections.abc` instead: `Awaitable` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 66 66 | from typing import Sequence 67 67 | from typing import Sized 68 68 | from typing import ValuesView @@ -828,6 +898,8 @@ UP035.py:69:1: UP035 [*] Import from `collections.abc` instead: `Awaitable` 71 71 | from typing import AsyncIterable 72 72 | from typing import Coroutine + Run `ruff check --fix` to apply this fix. + UP035.py:70:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterator` | 68 | from typing import ValuesView @@ -839,7 +911,7 @@ UP035.py:70:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterator` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 67 67 | from typing import Sized 68 68 | from typing import ValuesView 69 69 | from typing import Awaitable @@ -849,6 +921,8 @@ UP035.py:70:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterator` 72 72 | from typing import Coroutine 73 73 | from typing import Collection + Run `ruff check --fix` to apply this fix. + UP035.py:71:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterable` | 69 | from typing import Awaitable @@ -860,7 +934,7 @@ UP035.py:71:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterable` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 68 68 | from typing import ValuesView 69 69 | from typing import Awaitable 70 70 | from typing import AsyncIterator @@ -870,6 +944,8 @@ UP035.py:71:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterable` 73 73 | from typing import Collection 74 74 | from typing import AsyncGenerator + Run `ruff check --fix` to apply this fix. + UP035.py:72:1: UP035 [*] Import from `collections.abc` instead: `Coroutine` | 70 | from typing import AsyncIterator @@ -881,7 +957,7 @@ UP035.py:72:1: UP035 [*] Import from `collections.abc` instead: `Coroutine` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 69 69 | from typing import Awaitable 70 70 | from typing import AsyncIterator 71 71 | from typing import AsyncIterable @@ -891,6 +967,8 @@ UP035.py:72:1: UP035 [*] Import from `collections.abc` instead: `Coroutine` 74 74 | from typing import AsyncGenerator 75 75 | from typing import Reversible + Run `ruff check --fix` to apply this fix. + UP035.py:73:1: UP035 [*] Import from `collections.abc` instead: `Collection` | 71 | from typing import AsyncIterable @@ -902,7 +980,7 @@ UP035.py:73:1: UP035 [*] Import from `collections.abc` instead: `Collection` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 70 70 | from typing import AsyncIterator 71 71 | from typing import AsyncIterable 72 72 | from typing import Coroutine @@ -912,6 +990,8 @@ UP035.py:73:1: UP035 [*] Import from `collections.abc` instead: `Collection` 75 75 | from typing import Reversible 76 76 | from typing import Generator + Run `ruff check --fix` to apply this fix. + UP035.py:74:1: UP035 [*] Import from `collections.abc` instead: `AsyncGenerator` | 72 | from typing import Coroutine @@ -923,7 +1003,7 @@ UP035.py:74:1: UP035 [*] Import from `collections.abc` instead: `AsyncGenerator` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 71 71 | from typing import AsyncIterable 72 72 | from typing import Coroutine 73 73 | from typing import Collection @@ -933,6 +1013,8 @@ UP035.py:74:1: UP035 [*] Import from `collections.abc` instead: `AsyncGenerator` 76 76 | from typing import Generator 77 77 | from typing import Callable + Run `ruff check --fix` to apply this fix. + UP035.py:75:1: UP035 [*] Import from `collections.abc` instead: `Reversible` | 73 | from typing import Collection @@ -944,7 +1026,7 @@ UP035.py:75:1: UP035 [*] Import from `collections.abc` instead: `Reversible` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 72 72 | from typing import Coroutine 73 73 | from typing import Collection 74 74 | from typing import AsyncGenerator @@ -954,6 +1036,8 @@ UP035.py:75:1: UP035 [*] Import from `collections.abc` instead: `Reversible` 77 77 | from typing import Callable 78 78 | from typing import cast + Run `ruff check --fix` to apply this fix. + UP035.py:76:1: UP035 [*] Import from `collections.abc` instead: `Generator` | 74 | from typing import AsyncGenerator @@ -965,7 +1049,7 @@ UP035.py:76:1: UP035 [*] Import from `collections.abc` instead: `Generator` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 73 73 | from typing import Collection 74 74 | from typing import AsyncGenerator 75 75 | from typing import Reversible @@ -975,6 +1059,8 @@ UP035.py:76:1: UP035 [*] Import from `collections.abc` instead: `Generator` 78 78 | from typing import cast 79 79 | + Run `ruff check --fix` to apply this fix. + UP035.py:77:1: UP035 [*] Import from `collections.abc` instead: `Callable` | 75 | from typing import Reversible @@ -985,7 +1071,7 @@ UP035.py:77:1: UP035 [*] Import from `collections.abc` instead: `Callable` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 74 74 | from typing import AsyncGenerator 75 75 | from typing import Reversible 76 76 | from typing import Generator @@ -995,6 +1081,8 @@ UP035.py:77:1: UP035 [*] Import from `collections.abc` instead: `Callable` 79 79 | 80 80 | # OK + Run `ruff check --fix` to apply this fix. + UP035.py:84:1: UP035 [*] Import from `typing` instead: `SupportsIndex` | 83 | # UP035 on py312+ only @@ -1005,7 +1093,7 @@ UP035.py:84:1: UP035 [*] Import from `typing` instead: `SupportsIndex` | = help: Import from `typing` -ℹ Safe fix +Suggested fix: 81 81 | from a import b 82 82 | 83 83 | # UP035 on py312+ only @@ -1015,6 +1103,8 @@ UP035.py:84:1: UP035 [*] Import from `typing` instead: `SupportsIndex` 86 86 | # UP035 on py312+ only 87 87 | from typing_extensions import NamedTuple + Run `ruff check --fix` to apply this fix. + UP035.py:87:1: UP035 [*] Import from `typing` instead: `NamedTuple` | 86 | # UP035 on py312+ only @@ -1025,7 +1115,7 @@ UP035.py:87:1: UP035 [*] Import from `typing` instead: `NamedTuple` | = help: Import from `typing` -ℹ Safe fix +Suggested fix: 84 84 | from typing_extensions import SupportsIndex 85 85 | 86 86 | # UP035 on py312+ only @@ -1035,6 +1125,8 @@ UP035.py:87:1: UP035 [*] Import from `typing` instead: `NamedTuple` 89 89 | # UP035 on py312+ only: `typing_extensions` supports `frozen_default` (backported from 3.12). 90 90 | from typing_extensions import dataclass_transform + Run `ruff check --fix` to apply this fix. + UP035.py:90:1: UP035 [*] Import from `typing` instead: `dataclass_transform` | 89 | # UP035 on py312+ only: `typing_extensions` supports `frozen_default` (backported from 3.12). @@ -1045,7 +1137,7 @@ UP035.py:90:1: UP035 [*] Import from `typing` instead: `dataclass_transform` | = help: Import from `typing` -ℹ Safe fix +Suggested fix: 87 87 | from typing_extensions import NamedTuple 88 88 | 89 89 | # UP035 on py312+ only: `typing_extensions` supports `frozen_default` (backported from 3.12). @@ -1055,6 +1147,8 @@ UP035.py:90:1: UP035 [*] Import from `typing` instead: `dataclass_transform` 92 92 | # UP035 93 93 | from backports.strenum import StrEnum + Run `ruff check --fix` to apply this fix. + UP035.py:93:1: UP035 [*] Import from `enum` instead: `StrEnum` | 92 | # UP035 @@ -1065,7 +1159,7 @@ UP035.py:93:1: UP035 [*] Import from `enum` instead: `StrEnum` | = help: Import from `enum` -ℹ Safe fix +Suggested fix: 90 90 | from typing_extensions import dataclass_transform 91 91 | 92 92 | # UP035 @@ -1075,6 +1169,8 @@ UP035.py:93:1: UP035 [*] Import from `enum` instead: `StrEnum` 95 95 | # UP035 96 96 | from typing_extensions import override + Run `ruff check --fix` to apply this fix. + UP035.py:96:1: UP035 [*] Import from `typing` instead: `override` | 95 | # UP035 @@ -1085,7 +1181,7 @@ UP035.py:96:1: UP035 [*] Import from `typing` instead: `override` | = help: Import from `typing` -ℹ Safe fix +Suggested fix: 93 93 | from backports.strenum import StrEnum 94 94 | 95 95 | # UP035 @@ -1095,6 +1191,8 @@ UP035.py:96:1: UP035 [*] Import from `typing` instead: `override` 98 98 | # UP035 99 99 | from typing_extensions import Buffer + Run `ruff check --fix` to apply this fix. + UP035.py:99:1: UP035 [*] Import from `collections.abc` instead: `Buffer` | 98 | # UP035 @@ -1105,7 +1203,7 @@ UP035.py:99:1: UP035 [*] Import from `collections.abc` instead: `Buffer` | = help: Import from `collections.abc` -ℹ Safe fix +Suggested fix: 96 96 | from typing_extensions import override 97 97 | 98 98 | # UP035 @@ -1115,6 +1213,8 @@ UP035.py:99:1: UP035 [*] Import from `collections.abc` instead: `Buffer` 101 101 | # UP035 102 102 | from typing_extensions import get_original_bases + Run `ruff check --fix` to apply this fix. + UP035.py:102:1: UP035 [*] Import from `types` instead: `get_original_bases` | 101 | # UP035 @@ -1125,7 +1225,7 @@ UP035.py:102:1: UP035 [*] Import from `types` instead: `get_original_bases` | = help: Import from `types` -ℹ Safe fix +Suggested fix: 99 99 | from typing_extensions import Buffer 100 100 | 101 101 | # UP035 @@ -1135,6 +1235,8 @@ UP035.py:102:1: UP035 [*] Import from `types` instead: `get_original_bases` 104 104 | # UP035 on py313+ only 105 105 | from typing_extensions import TypeVar + Run `ruff check --fix` to apply this fix. + UP035.py:105:1: UP035 [*] Import from `typing` instead: `TypeVar` | 104 | # UP035 on py313+ only @@ -1145,7 +1247,7 @@ UP035.py:105:1: UP035 [*] Import from `typing` instead: `TypeVar` | = help: Import from `typing` -ℹ Safe fix +Suggested fix: 102 102 | from typing_extensions import get_original_bases 103 103 | 104 104 | # UP035 on py313+ only @@ -1155,6 +1257,8 @@ UP035.py:105:1: UP035 [*] Import from `typing` instead: `TypeVar` 107 107 | # UP035 on py313+ only 108 108 | from typing_extensions import CapsuleType + Run `ruff check --fix` to apply this fix. + UP035.py:108:1: UP035 [*] Import from `types` instead: `CapsuleType` | 107 | # UP035 on py313+ only @@ -1165,7 +1269,7 @@ UP035.py:108:1: UP035 [*] Import from `types` instead: `CapsuleType` | = help: Import from `types` -ℹ Safe fix +Suggested fix: 105 105 | from typing_extensions import TypeVar 106 106 | 107 107 | # UP035 on py313+ only @@ -1175,6 +1279,8 @@ UP035.py:108:1: UP035 [*] Import from `types` instead: `CapsuleType` 110 110 | # UP035 on py313+ only 111 111 | from typing_extensions import deprecated + Run `ruff check --fix` to apply this fix. + UP035.py:111:1: UP035 [*] Import from `warnings` instead: `deprecated` | 110 | # UP035 on py313+ only @@ -1183,9 +1289,11 @@ UP035.py:111:1: UP035 [*] Import from `warnings` instead: `deprecated` | = help: Import from `warnings` -ℹ Safe fix +Suggested fix: 108 108 | from typing_extensions import CapsuleType 109 109 | 110 110 | # UP035 on py313+ only 111 |-from typing_extensions import deprecated 111 |+from warnings import deprecated + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap index 329642fd56850..d9126999a9025 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap @@ -12,7 +12,7 @@ UP036_0.py:3:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 1 1 | import sys 2 2 | 3 |-if sys.version_info < (3,0): @@ -24,6 +24,8 @@ UP036_0.py:3:4: UP036 [*] Version block is outdated for minimum Python version 8 5 | if sys.version_info < (3,0): 9 6 | if True: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:8:4: UP036 [*] Version block is outdated for minimum Python version | 6 | print("py3") @@ -35,7 +37,7 @@ UP036_0.py:8:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 5 5 | else: 6 6 | print("py3") 7 7 | @@ -51,6 +53,8 @@ UP036_0.py:8:4: UP036 [*] Version block is outdated for minimum Python version 16 10 | if sys.version_info < (3,0): print("PY2!") 17 11 | else: print("PY3!") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:16:4: UP036 [*] Version block is outdated for minimum Python version | 14 | print("py3") @@ -61,7 +65,7 @@ UP036_0.py:16:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 13 13 | else: 14 14 | print("py3") 15 15 | @@ -72,6 +76,8 @@ UP036_0.py:16:4: UP036 [*] Version block is outdated for minimum Python version 19 18 | if True: 20 19 | if sys.version_info < (3,0): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:20:8: UP036 [*] Version block is outdated for minimum Python version | 19 | if True: @@ -82,7 +88,7 @@ UP036_0.py:20:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 17 17 | else: print("PY3!") 18 18 | 19 19 | if True: @@ -95,6 +101,8 @@ UP036_0.py:20:8: UP036 [*] Version block is outdated for minimum Python version 25 22 | if sys.version_info < (3,0): print(1 if True else 3) 26 23 | else: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:25:4: UP036 [*] Version block is outdated for minimum Python version | 23 | print("PY3") @@ -106,7 +114,7 @@ UP036_0.py:25:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 22 22 | else: 23 23 | print("PY3") 24 24 | @@ -118,6 +126,8 @@ UP036_0.py:25:4: UP036 [*] Version block is outdated for minimum Python version 29 27 | if sys.version_info < (3,0): 30 28 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:29:4: UP036 [*] Version block is outdated for minimum Python version | 27 | print("py3") @@ -129,7 +139,7 @@ UP036_0.py:29:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 26 26 | else: 27 27 | print("py3") 28 28 | @@ -147,6 +157,8 @@ UP036_0.py:29:4: UP036 [*] Version block is outdated for minimum Python version 37 33 | if sys.version_info > (3,0): 38 34 | print("py3") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:37:4: UP036 [*] Version block is outdated for minimum Python version | 35 | print("This the next") @@ -158,7 +170,7 @@ UP036_0.py:37:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 34 34 | print("py3") 35 35 | print("This the next") 36 36 | @@ -171,6 +183,8 @@ UP036_0.py:37:4: UP036 [*] Version block is outdated for minimum Python version 42 39 | 43 40 | x = 1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:45:4: UP036 [*] Version block is outdated for minimum Python version | 43 | x = 1 @@ -182,7 +196,7 @@ UP036_0.py:45:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 42 42 | 43 43 | x = 1 44 44 | @@ -195,6 +209,8 @@ UP036_0.py:45:4: UP036 [*] Version block is outdated for minimum Python version 50 47 | 51 48 | x = 1 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:53:4: UP036 [*] Version block is outdated for minimum Python version | 51 | x = 1 @@ -205,7 +221,7 @@ UP036_0.py:53:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 50 50 | 51 51 | x = 1 52 52 | @@ -216,6 +232,8 @@ UP036_0.py:53:4: UP036 [*] Version block is outdated for minimum Python version 56 55 | if sys.version_info > (3,): 57 56 | print("py3") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:56:4: UP036 [*] Version block is outdated for minimum Python version | 54 | else: print("py2") @@ -227,7 +245,7 @@ UP036_0.py:56:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 53 53 | if sys.version_info > (3,0): print("py3") 54 54 | else: print("py2") 55 55 | @@ -240,6 +258,8 @@ UP036_0.py:56:4: UP036 [*] Version block is outdated for minimum Python version 61 58 | if True: 62 59 | if sys.version_info > (3,): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:62:8: UP036 [*] Version block is outdated for minimum Python version | 61 | if True: @@ -250,7 +270,7 @@ UP036_0.py:62:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 59 59 | print("py2") 60 60 | 61 61 | if True: @@ -263,6 +283,8 @@ UP036_0.py:62:8: UP036 [*] Version block is outdated for minimum Python version 67 64 | if sys.version_info < (3,): 68 65 | print("py2") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:67:4: UP036 [*] Version block is outdated for minimum Python version | 65 | print("py2") @@ -274,7 +296,7 @@ UP036_0.py:67:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 64 64 | else: 65 65 | print("py2") 66 66 | @@ -287,6 +309,8 @@ UP036_0.py:67:4: UP036 [*] Version block is outdated for minimum Python version 72 69 | def f(): 73 70 | if sys.version_info < (3,0): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:73:8: UP036 [*] Version block is outdated for minimum Python version | 72 | def f(): @@ -297,7 +321,7 @@ UP036_0.py:73:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 70 70 | print("py3") 71 71 | 72 72 | def f(): @@ -313,6 +337,8 @@ UP036_0.py:73:8: UP036 [*] Version block is outdated for minimum Python version 81 75 | 82 76 | class C: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:86:8: UP036 [*] Version block is outdated for minimum Python version | 84 | pass @@ -324,7 +350,7 @@ UP036_0.py:86:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 83 83 | def g(): 84 84 | pass 85 85 | @@ -340,6 +366,8 @@ UP036_0.py:86:8: UP036 [*] Version block is outdated for minimum Python version 93 89 | def h(): 94 90 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:97:8: UP036 [*] Version block is outdated for minimum Python version | 96 | if True: @@ -350,7 +378,7 @@ UP036_0.py:97:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 94 94 | pass 95 95 | 96 96 | if True: @@ -363,6 +391,8 @@ UP036_0.py:97:8: UP036 [*] Version block is outdated for minimum Python version 102 99 | # comment 103 100 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:104:4: UP036 [*] Version block is outdated for minimum Python version | 102 | # comment @@ -374,7 +404,7 @@ UP036_0.py:104:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 101 101 | 102 102 | # comment 103 103 | @@ -396,6 +426,8 @@ UP036_0.py:104:4: UP036 [*] Version block is outdated for minimum Python version 115 109 | if True: 116 110 | if sys.version_info > (3,): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:116:8: UP036 [*] Version block is outdated for minimum Python version | 115 | if True: @@ -406,7 +438,7 @@ UP036_0.py:116:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 113 113 | print("py3") 114 114 | 115 115 | if True: @@ -417,6 +449,8 @@ UP036_0.py:116:8: UP036 [*] Version block is outdated for minimum Python version 119 118 | print(2+3) 120 119 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:122:8: UP036 [*] Version block is outdated for minimum Python version | 121 | if True: @@ -427,7 +461,7 @@ UP036_0.py:122:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 119 119 | print(2+3) 120 120 | 121 121 | if True: @@ -437,6 +471,8 @@ UP036_0.py:122:8: UP036 [*] Version block is outdated for minimum Python version 124 124 | if True: 125 125 | if sys.version_info > (3,): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:125:8: UP036 [*] Version block is outdated for minimum Python version | 124 | if True: @@ -446,7 +482,7 @@ UP036_0.py:125:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 122 122 | if sys.version_info > (3,): print(3) 123 123 | 124 124 | if True: @@ -457,6 +493,8 @@ UP036_0.py:125:8: UP036 [*] Version block is outdated for minimum Python version 128 127 | 129 128 | if True: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:130:8: UP036 [*] Version block is outdated for minimum Python version | 129 | if True: @@ -467,7 +505,7 @@ UP036_0.py:130:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 127 127 | 128 128 | 129 129 | if True: @@ -485,6 +523,8 @@ UP036_0.py:130:8: UP036 [*] Version block is outdated for minimum Python version 139 136 | 140 137 | if sys.version_info <= (3, 0): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:140:4: UP036 [*] Version block is outdated for minimum Python version | 140 | if sys.version_info <= (3, 0): @@ -494,7 +534,7 @@ UP036_0.py:140:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 137 137 | ] 138 138 | 139 139 | @@ -512,6 +552,8 @@ UP036_0.py:140:4: UP036 [*] Version block is outdated for minimum Python version 149 146 | 150 147 | if sys.version_info > (3,0): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:150:4: UP036 [*] Version block is outdated for minimum Python version | 150 | if sys.version_info > (3,0): @@ -521,7 +563,7 @@ UP036_0.py:150:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 147 147 | ] 148 148 | 149 149 | @@ -546,6 +588,8 @@ UP036_0.py:150:4: UP036 [*] Version block is outdated for minimum Python version 163 162 | if sys.version_info > (3, 0): expected_error = \ 164 163 | [] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:163:4: UP036 [*] Version block is outdated for minimum Python version | 161 | "this for some reason") @@ -556,7 +600,7 @@ UP036_0.py:163:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 160 160 | ("so is" 161 161 | "this for some reason") 162 162 | @@ -566,6 +610,8 @@ UP036_0.py:163:4: UP036 [*] Version block is outdated for minimum Python version 165 165 | 166 166 | if sys.version_info > (3, 0): expected_error = [] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:166:4: UP036 [*] Version block is outdated for minimum Python version | 164 | [] @@ -577,7 +623,7 @@ UP036_0.py:166:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 163 163 | if sys.version_info > (3, 0): expected_error = \ 164 164 | [] 165 165 | @@ -587,6 +633,8 @@ UP036_0.py:166:4: UP036 [*] Version block is outdated for minimum Python version 168 168 | if sys.version_info > (3, 0): \ 169 169 | expected_error = [] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:168:4: UP036 [*] Version block is outdated for minimum Python version | 166 | if sys.version_info > (3, 0): expected_error = [] @@ -597,7 +645,7 @@ UP036_0.py:168:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 165 165 | 166 166 | if sys.version_info > (3, 0): expected_error = [] 167 167 | @@ -608,6 +656,8 @@ UP036_0.py:168:4: UP036 [*] Version block is outdated for minimum Python version 171 170 | if True: 172 171 | if sys.version_info > (3, 0): expected_error = \ + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:172:8: UP036 [*] Version block is outdated for minimum Python version | 171 | if True: @@ -617,7 +667,7 @@ UP036_0.py:172:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 169 169 | expected_error = [] 170 170 | 171 171 | if True: @@ -627,6 +677,8 @@ UP036_0.py:172:8: UP036 [*] Version block is outdated for minimum Python version 174 174 | 175 175 | if True: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:176:8: UP036 [*] Version block is outdated for minimum Python version | 175 | if True: @@ -637,7 +689,7 @@ UP036_0.py:176:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 173 173 | [] 174 174 | 175 175 | if True: @@ -647,6 +699,8 @@ UP036_0.py:176:8: UP036 [*] Version block is outdated for minimum Python version 178 178 | if True: 179 179 | if sys.version_info > (3, 0): \ + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:179:8: UP036 [*] Version block is outdated for minimum Python version | 178 | if True: @@ -656,7 +710,7 @@ UP036_0.py:179:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 176 176 | if sys.version_info > (3, 0): expected_error = [] 177 177 | 178 178 | if True: @@ -665,6 +719,8 @@ UP036_0.py:179:8: UP036 [*] Version block is outdated for minimum Python version 181 180 | 182 181 | if sys.version_info < (3,13): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:182:4: UP036 [*] Version block is outdated for minimum Python version | 180 | expected_error = [] @@ -675,7 +731,7 @@ UP036_0.py:182:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 179 179 | if sys.version_info > (3, 0): \ 180 180 | expected_error = [] 181 181 | @@ -685,6 +741,8 @@ UP036_0.py:182:4: UP036 [*] Version block is outdated for minimum Python version 185 183 | if sys.version_info <= (3,13): 186 184 | print("py3") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:191:24: UP036 Version specifier is invalid | 189 | print("py3") @@ -722,7 +780,7 @@ UP036_0.py:203:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 200 200 | if sys.version_info > (3,13): 201 201 | print("py3") 202 202 | @@ -733,6 +791,8 @@ UP036_0.py:203:4: UP036 [*] Version block is outdated for minimum Python version 206 205 | # Slices on `sys.version_info` should be treated equivalently. 207 206 | if sys.version_info[:2] >= (3,0): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:207:4: UP036 [*] Version block is outdated for minimum Python version | 206 | # Slices on `sys.version_info` should be treated equivalently. @@ -742,7 +802,7 @@ UP036_0.py:207:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 204 204 | print("py3") 205 205 | 206 206 | # Slices on `sys.version_info` should be treated equivalently. @@ -753,6 +813,8 @@ UP036_0.py:207:4: UP036 [*] Version block is outdated for minimum Python version 210 209 | if sys.version_info[:3] >= (3,0): 211 210 | print("py3") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:210:4: UP036 [*] Version block is outdated for minimum Python version | 208 | print("py3") @@ -763,7 +825,7 @@ UP036_0.py:210:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 207 207 | if sys.version_info[:2] >= (3,0): 208 208 | print("py3") 209 209 | @@ -774,6 +836,8 @@ UP036_0.py:210:4: UP036 [*] Version block is outdated for minimum Python version 213 212 | if sys.version_info[:2] > (3,14): 214 213 | print("py3") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_0.py:219:4: UP036 [*] Version block is outdated for minimum Python version | 217 | print("py3") @@ -785,7 +849,7 @@ UP036_0.py:219:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 216 216 | if sys.version_info[:3] > (3,14): 217 217 | print("py3") 218 218 | @@ -801,3 +865,5 @@ UP036_0.py:219:4: UP036 [*] Version block is outdated for minimum Python version 226 |- "this is\ 225 |+"this is\ 227 226 | allowed too" + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap index e89393c5a4a1a..715387e52f222 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap @@ -12,7 +12,7 @@ UP036_1.py:3:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 1 1 | import sys 2 2 | 3 |-if sys.version_info == 2: @@ -24,6 +24,8 @@ UP036_1.py:3:4: UP036 [*] Version block is outdated for minimum Python version 8 5 | if sys.version_info < (3,): 9 6 | 2 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_1.py:8:4: UP036 [*] Version block is outdated for minimum Python version | 6 | 3 @@ -35,7 +37,7 @@ UP036_1.py:8:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 5 5 | else: 6 6 | 3 7 7 | @@ -48,6 +50,8 @@ UP036_1.py:8:4: UP036 [*] Version block is outdated for minimum Python version 13 10 | if sys.version_info < (3,0): 14 11 | 2 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_1.py:13:4: UP036 [*] Version block is outdated for minimum Python version | 11 | 3 @@ -59,7 +63,7 @@ UP036_1.py:13:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 10 10 | else: 11 11 | 3 12 12 | @@ -72,6 +76,8 @@ UP036_1.py:13:4: UP036 [*] Version block is outdated for minimum Python version 18 15 | if sys.version_info == 3: 19 16 | 3 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_1.py:18:4: UP036 [*] Version block is outdated for minimum Python version | 16 | 3 @@ -83,7 +89,7 @@ UP036_1.py:18:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 15 15 | else: 16 16 | 3 17 17 | @@ -96,6 +102,8 @@ UP036_1.py:18:4: UP036 [*] Version block is outdated for minimum Python version 23 20 | if sys.version_info > (3,): 24 21 | 3 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_1.py:23:4: UP036 [*] Version block is outdated for minimum Python version | 21 | 2 @@ -107,7 +115,7 @@ UP036_1.py:23:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 20 20 | else: 21 21 | 2 22 22 | @@ -120,6 +128,8 @@ UP036_1.py:23:4: UP036 [*] Version block is outdated for minimum Python version 28 25 | if sys.version_info >= (3,): 29 26 | 3 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_1.py:28:4: UP036 [*] Version block is outdated for minimum Python version | 26 | 2 @@ -131,7 +141,7 @@ UP036_1.py:28:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 25 25 | else: 26 26 | 2 27 27 | @@ -144,6 +154,8 @@ UP036_1.py:28:4: UP036 [*] Version block is outdated for minimum Python version 33 30 | from sys import version_info 34 31 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_1.py:35:4: UP036 [*] Version block is outdated for minimum Python version | 33 | from sys import version_info @@ -155,7 +167,7 @@ UP036_1.py:35:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 32 32 | 33 33 | from sys import version_info 34 34 | @@ -168,6 +180,8 @@ UP036_1.py:35:4: UP036 [*] Version block is outdated for minimum Python version 40 37 | if True: 41 38 | print(1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_1.py:42:6: UP036 [*] Version block is outdated for minimum Python version | 40 | if True: @@ -179,7 +193,7 @@ UP036_1.py:42:6: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 39 39 | 40 40 | if True: 41 41 | print(1) @@ -189,6 +203,8 @@ UP036_1.py:42:6: UP036 [*] Version block is outdated for minimum Python version 45 43 | print(3) 46 44 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_1.py:49:6: UP036 [*] Version block is outdated for minimum Python version | 47 | if True: @@ -200,7 +216,7 @@ UP036_1.py:49:6: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 46 46 | 47 47 | if True: 48 48 | print(1) @@ -213,6 +229,8 @@ UP036_1.py:49:6: UP036 [*] Version block is outdated for minimum Python version 54 52 | if True: 55 53 | print(1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_1.py:56:6: UP036 [*] Version block is outdated for minimum Python version | 54 | if True: @@ -223,7 +241,7 @@ UP036_1.py:56:6: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 53 53 | 54 54 | if True: 55 55 | print(1) @@ -233,6 +251,8 @@ UP036_1.py:56:6: UP036 [*] Version block is outdated for minimum Python version 58 58 | 59 59 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_1.py:62:10: UP036 [*] Version block is outdated for minimum Python version | 60 | if True: @@ -243,7 +263,7 @@ UP036_1.py:62:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 59 59 | def f(): 60 60 | if True: 61 61 | print(1) @@ -253,6 +273,8 @@ UP036_1.py:62:10: UP036 [*] Version block is outdated for minimum Python version 64 64 | 65 65 | if True: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_1.py:67:6: UP036 [*] Version block is outdated for minimum Python version | 65 | if True: @@ -264,7 +286,7 @@ UP036_1.py:67:6: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 64 64 | 65 65 | if True: 66 66 | print(1) @@ -274,6 +296,8 @@ UP036_1.py:67:6: UP036 [*] Version block is outdated for minimum Python version 70 68 | print(3) 71 69 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_1.py:75:10: UP036 [*] Version block is outdated for minimum Python version | 73 | if True: @@ -284,7 +308,7 @@ UP036_1.py:75:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 72 72 | def f(): 73 73 | if True: 74 74 | print(1) @@ -292,4 +316,4 @@ UP036_1.py:75:10: UP036 [*] Version block is outdated for minimum Python version 75 |+ else: 76 76 | print(3) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap index 0a280dc5054e9..f71484c8ad438 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap @@ -12,7 +12,7 @@ UP036_2.py:4:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 1 1 | import sys 2 2 | from sys import version_info 3 3 | @@ -25,6 +25,8 @@ UP036_2.py:4:4: UP036 [*] Version block is outdated for minimum Python version 9 6 | if version_info > (3, 5): 10 7 | 3+6 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_2.py:9:4: UP036 [*] Version block is outdated for minimum Python version | 7 | 3-5 @@ -36,7 +38,7 @@ UP036_2.py:9:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 6 6 | else: 7 7 | 3-5 8 8 | @@ -49,6 +51,8 @@ UP036_2.py:9:4: UP036 [*] Version block is outdated for minimum Python version 14 11 | if sys.version_info >= (3,6): 15 12 | 3+6 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_2.py:14:4: UP036 [*] Version block is outdated for minimum Python version | 12 | 3-5 @@ -60,7 +64,7 @@ UP036_2.py:14:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 11 11 | else: 12 12 | 3-5 13 13 | @@ -73,6 +77,8 @@ UP036_2.py:14:4: UP036 [*] Version block is outdated for minimum Python version 19 16 | if version_info >= (3,6): 20 17 | 3+6 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_2.py:19:4: UP036 [*] Version block is outdated for minimum Python version | 17 | 3-5 @@ -84,7 +90,7 @@ UP036_2.py:19:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 16 16 | else: 17 17 | 3-5 18 18 | @@ -97,6 +103,8 @@ UP036_2.py:19:4: UP036 [*] Version block is outdated for minimum Python version 24 21 | if sys.version_info < (3,6): 25 22 | 3-5 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_2.py:24:4: UP036 [*] Version block is outdated for minimum Python version | 22 | 3-5 @@ -108,7 +116,7 @@ UP036_2.py:24:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 21 21 | else: 22 22 | 3-5 23 23 | @@ -121,6 +129,8 @@ UP036_2.py:24:4: UP036 [*] Version block is outdated for minimum Python version 29 26 | if sys.version_info <= (3,5): 30 27 | 3-5 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_2.py:29:4: UP036 [*] Version block is outdated for minimum Python version | 27 | 3+6 @@ -132,7 +142,7 @@ UP036_2.py:29:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 26 26 | else: 27 27 | 3+6 28 28 | @@ -145,6 +155,8 @@ UP036_2.py:29:4: UP036 [*] Version block is outdated for minimum Python version 34 31 | if sys.version_info <= (3, 5): 35 32 | 3-5 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_2.py:34:4: UP036 [*] Version block is outdated for minimum Python version | 32 | 3+6 @@ -156,7 +168,7 @@ UP036_2.py:34:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 31 31 | else: 32 32 | 3+6 33 33 | @@ -169,6 +181,8 @@ UP036_2.py:34:4: UP036 [*] Version block is outdated for minimum Python version 39 36 | if sys.version_info >= (3, 5): 40 37 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_2.py:39:4: UP036 [*] Version block is outdated for minimum Python version | 37 | 3+6 @@ -179,7 +193,7 @@ UP036_2.py:39:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 36 36 | else: 37 37 | 3+6 38 38 | @@ -190,6 +204,8 @@ UP036_2.py:39:4: UP036 [*] Version block is outdated for minimum Python version 42 41 | if sys.version_info < (3,0): 43 42 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_2.py:42:4: UP036 [*] Version block is outdated for minimum Python version | 40 | pass @@ -200,7 +216,7 @@ UP036_2.py:42:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 39 39 | if sys.version_info >= (3, 5): 40 40 | pass 41 41 | @@ -210,6 +226,8 @@ UP036_2.py:42:4: UP036 [*] Version block is outdated for minimum Python version 45 43 | if True: 46 44 | if sys.version_info < (3,0): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_2.py:46:8: UP036 [*] Version block is outdated for minimum Python version | 45 | if True: @@ -219,7 +237,7 @@ UP036_2.py:46:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 43 43 | pass 44 44 | 45 45 | if True: @@ -230,6 +248,8 @@ UP036_2.py:46:8: UP036 [*] Version block is outdated for minimum Python version 49 48 | if sys.version_info < (3,0): 50 49 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_2.py:49:4: UP036 [*] Version block is outdated for minimum Python version | 47 | pass @@ -241,7 +261,7 @@ UP036_2.py:49:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 46 46 | if sys.version_info < (3,0): 47 47 | pass 48 48 | @@ -253,6 +273,8 @@ UP036_2.py:49:4: UP036 [*] Version block is outdated for minimum Python version 53 51 | 54 52 | if sys.version_info > (3,): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_2.py:54:4: UP036 [*] Version block is outdated for minimum Python version | 52 | pass @@ -264,7 +286,7 @@ UP036_2.py:54:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 51 51 | elif False: 52 52 | pass 53 53 | @@ -277,4 +299,4 @@ UP036_2.py:54:4: UP036 [*] Version block is outdated for minimum Python version 59 56 | if sys.version_info[0] > "2": 60 57 | 3 - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap index d22d368074431..9318e00d00d0b 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap @@ -12,7 +12,7 @@ UP036_3.py:3:15: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 1 1 | import sys 2 2 | 3 |-if sys.version_info < (3,0): @@ -30,6 +30,8 @@ UP036_3.py:3:15: UP036 [*] Version block is outdated for minimum Python version 12 7 | if False: 13 8 | if sys.version_info < (3,0): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_3.py:13:19: UP036 [*] Version block is outdated for minimum Python version | 12 | if False: @@ -40,7 +42,7 @@ UP036_3.py:13:19: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 10 10 | print(f"PY3-{item}") 11 11 | 12 12 | if False: @@ -59,6 +61,8 @@ UP036_3.py:13:19: UP036 [*] Version block is outdated for minimum Python version 22 17 | 23 18 | if sys.version_info < (3,0): print("PY2!") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_3.py:23:15: UP036 [*] Version block is outdated for minimum Python version | 23 | if sys.version_info < (3,0): print("PY2!") @@ -67,7 +71,7 @@ UP036_3.py:23:15: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 20 20 | print(f"PY3-{item}") 21 21 | 22 22 | @@ -75,4 +79,4 @@ UP036_3.py:23:15: UP036 [*] Version block is outdated for minimum Python version 24 |-else : print("PY3!") 23 |+print("PY3!") - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap index db21eecad496d..9d5db7df5042c 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap @@ -10,7 +10,7 @@ UP036_4.py:4:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 1 1 | import sys 2 2 | 3 3 | if True: @@ -21,6 +21,8 @@ UP036_4.py:4:8: UP036 [*] Version block is outdated for minimum Python version 7 6 | 8 7 | if True: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_4.py:11:10: UP036 [*] Version block is outdated for minimum Python version | 9 | if foo: @@ -31,7 +33,7 @@ UP036_4.py:11:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 8 8 | if True: 9 9 | if foo: 10 10 | print() @@ -42,6 +44,8 @@ UP036_4.py:11:10: UP036 [*] Version block is outdated for minimum Python version 14 13 | if True: 15 14 | if foo: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_4.py:17:10: UP036 [*] Version block is outdated for minimum Python version | 15 | if foo: @@ -53,7 +57,7 @@ UP036_4.py:17:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 14 14 | if True: 15 15 | if foo: 16 16 | print() @@ -63,6 +67,8 @@ UP036_4.py:17:10: UP036 [*] Version block is outdated for minimum Python version 20 18 | cmd = [sys.executable, "-m", "test", "-j0"] 21 19 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_4.py:24:10: UP036 [*] Version block is outdated for minimum Python version | 22 | if foo: @@ -73,7 +79,7 @@ UP036_4.py:24:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 21 21 | 22 22 | if foo: 23 23 | print() @@ -84,6 +90,8 @@ UP036_4.py:24:10: UP036 [*] Version block is outdated for minimum Python version 27 26 | if sys.version_info < (3, 3): 28 27 | cmd = [sys.executable, "-m", "test.regrtest"] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_4.py:27:8: UP036 [*] Version block is outdated for minimum Python version | 25 | cmd = [sys.executable, "-m", "test.regrtest"] @@ -94,7 +102,7 @@ UP036_4.py:27:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 24 24 | elif sys.version_info < (3, 3): 25 25 | cmd = [sys.executable, "-m", "test.regrtest"] 26 26 | @@ -104,6 +112,8 @@ UP036_4.py:27:8: UP036 [*] Version block is outdated for minimum Python version 30 28 | if foo: 31 29 | print() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_4.py:32:10: UP036 [*] Version block is outdated for minimum Python version | 30 | if foo: @@ -115,7 +125,7 @@ UP036_4.py:32:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 29 29 | 30 30 | if foo: 31 31 | print() @@ -125,6 +135,8 @@ UP036_4.py:32:10: UP036 [*] Version block is outdated for minimum Python version 35 33 | cmd = [sys.executable, "-m", "test", "-j0"] 36 34 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_4.py:37:8: UP036 [*] Version block is outdated for minimum Python version | 35 | cmd = [sys.executable, "-m", "test", "-j0"] @@ -136,7 +148,7 @@ UP036_4.py:37:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 34 34 | else: 35 35 | cmd = [sys.executable, "-m", "test", "-j0"] 36 36 | @@ -149,6 +161,8 @@ UP036_4.py:37:8: UP036 [*] Version block is outdated for minimum Python version 42 39 | if sys.version_info < (3, 3): 43 40 | cmd = [sys.executable, "-m", "test.regrtest"] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_4.py:42:8: UP036 [*] Version block is outdated for minimum Python version | 40 | cmd = [sys.executable, "-m", "test", "-j0"] @@ -160,7 +174,7 @@ UP036_4.py:42:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 39 39 | else: 40 40 | cmd = [sys.executable, "-m", "test", "-j0"] 41 41 | @@ -170,4 +184,4 @@ UP036_4.py:42:8: UP036 [*] Version block is outdated for minimum Python version 42 |+ if foo: 45 43 | cmd = [sys.executable, "-m", "test", "-j0"] - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap index 5a121f09e4d72..b7df20b2281a8 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap @@ -12,7 +12,7 @@ UP036_5.py:3:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 1 1 | import sys 2 2 | 3 |-if sys.version_info < (3, 8): @@ -31,6 +31,8 @@ UP036_5.py:3:4: UP036 [*] Version block is outdated for minimum Python version 15 5 | 16 6 | import sys + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP036_5.py:18:4: UP036 [*] Version block is outdated for minimum Python version | 16 | import sys @@ -41,7 +43,7 @@ UP036_5.py:18:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Unsafe fix +Suggested fix: 15 15 | 16 16 | import sys 17 17 | @@ -67,4 +69,4 @@ UP036_5.py:18:4: UP036 [*] Version block is outdated for minimum Python version 24 |+ print(3) 25 |+ return None - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap index 4b4eb9e71624c..ad354310e94c7 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap @@ -9,7 +9,7 @@ UP037_0.py:18:14: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 15 15 | from mypy_extensions import Arg, DefaultArg, DefaultNamedArg, NamedArg, VarArg 16 16 | 17 17 | @@ -19,6 +19,8 @@ UP037_0.py:18:14: UP037 [*] Remove quotes from type annotation 20 20 | 21 21 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:18:28: UP037 [*] Remove quotes from type annotation | 18 | def foo(var: "MyClass") -> "MyClass": @@ -27,7 +29,7 @@ UP037_0.py:18:28: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 15 15 | from mypy_extensions import Arg, DefaultArg, DefaultNamedArg, NamedArg, VarArg 16 16 | 17 17 | @@ -37,6 +39,8 @@ UP037_0.py:18:28: UP037 [*] Remove quotes from type annotation 20 20 | 21 21 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:19:8: UP037 [*] Remove quotes from type annotation | 18 | def foo(var: "MyClass") -> "MyClass": @@ -45,7 +49,7 @@ UP037_0.py:19:8: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 16 16 | 17 17 | 18 18 | def foo(var: "MyClass") -> "MyClass": @@ -55,6 +59,8 @@ UP037_0.py:19:8: UP037 [*] Remove quotes from type annotation 21 21 | 22 22 | def foo(*, inplace: "bool"): + Run `ruff check --fix` to apply this fix. + UP037_0.py:22:21: UP037 [*] Remove quotes from type annotation | 22 | def foo(*, inplace: "bool"): @@ -63,7 +69,7 @@ UP037_0.py:22:21: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 19 19 | x: "MyClass" 20 20 | 21 21 | @@ -73,6 +79,8 @@ UP037_0.py:22:21: UP037 [*] Remove quotes from type annotation 24 24 | 25 25 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:26:16: UP037 [*] Remove quotes from type annotation | 26 | def foo(*args: "str", **kwargs: "int"): @@ -81,7 +89,7 @@ UP037_0.py:26:16: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 23 23 | pass 24 24 | 25 25 | @@ -91,6 +99,8 @@ UP037_0.py:26:16: UP037 [*] Remove quotes from type annotation 28 28 | 29 29 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:26:33: UP037 [*] Remove quotes from type annotation | 26 | def foo(*args: "str", **kwargs: "int"): @@ -99,7 +109,7 @@ UP037_0.py:26:33: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 23 23 | pass 24 24 | 25 25 | @@ -109,6 +119,8 @@ UP037_0.py:26:33: UP037 [*] Remove quotes from type annotation 28 28 | 29 29 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:30:10: UP037 [*] Remove quotes from type annotation | 30 | x: Tuple["MyClass"] @@ -118,7 +130,7 @@ UP037_0.py:30:10: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 27 27 | pass 28 28 | 29 29 | @@ -128,6 +140,8 @@ UP037_0.py:30:10: UP037 [*] Remove quotes from type annotation 32 32 | x: Callable[["MyClass"], None] 33 33 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:32:14: UP037 [*] Remove quotes from type annotation | 30 | x: Tuple["MyClass"] @@ -137,7 +151,7 @@ UP037_0.py:32:14: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 29 29 | 30 30 | x: Tuple["MyClass"] 31 31 | @@ -147,6 +161,8 @@ UP037_0.py:32:14: UP037 [*] Remove quotes from type annotation 34 34 | 35 35 | class Foo(NamedTuple): + Run `ruff check --fix` to apply this fix. + UP037_0.py:36:8: UP037 [*] Remove quotes from type annotation | 35 | class Foo(NamedTuple): @@ -155,7 +171,7 @@ UP037_0.py:36:8: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 33 33 | 34 34 | 35 35 | class Foo(NamedTuple): @@ -165,6 +181,8 @@ UP037_0.py:36:8: UP037 [*] Remove quotes from type annotation 38 38 | 39 39 | class D(TypedDict): + Run `ruff check --fix` to apply this fix. + UP037_0.py:40:27: UP037 [*] Remove quotes from type annotation | 39 | class D(TypedDict): @@ -173,7 +191,7 @@ UP037_0.py:40:27: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 37 37 | 38 38 | 39 39 | class D(TypedDict): @@ -183,6 +201,8 @@ UP037_0.py:40:27: UP037 [*] Remove quotes from type annotation 42 42 | 43 43 | class D(TypedDict): + Run `ruff check --fix` to apply this fix. + UP037_0.py:44:31: UP037 [*] Remove quotes from type annotation | 43 | class D(TypedDict): @@ -191,7 +211,7 @@ UP037_0.py:44:31: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 41 41 | 42 42 | 43 43 | class D(TypedDict): @@ -201,6 +221,8 @@ UP037_0.py:44:31: UP037 [*] Remove quotes from type annotation 46 46 | 47 47 | x: Annotated["str", "metadata"] + Run `ruff check --fix` to apply this fix. + UP037_0.py:47:14: UP037 [*] Remove quotes from type annotation | 47 | x: Annotated["str", "metadata"] @@ -210,7 +232,7 @@ UP037_0.py:47:14: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 44 44 | E: TypedDict("E", {"foo": "int"}) 45 45 | 46 46 | @@ -220,6 +242,8 @@ UP037_0.py:47:14: UP037 [*] Remove quotes from type annotation 49 49 | x: Arg("str", "name") 50 50 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:49:8: UP037 [*] Remove quotes from type annotation | 47 | x: Annotated["str", "metadata"] @@ -231,7 +255,7 @@ UP037_0.py:49:8: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 46 46 | 47 47 | x: Annotated["str", "metadata"] 48 48 | @@ -241,6 +265,8 @@ UP037_0.py:49:8: UP037 [*] Remove quotes from type annotation 51 51 | x: DefaultArg("str", "name") 52 52 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:51:15: UP037 [*] Remove quotes from type annotation | 49 | x: Arg("str", "name") @@ -252,7 +278,7 @@ UP037_0.py:51:15: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 48 48 | 49 49 | x: Arg("str", "name") 50 50 | @@ -262,6 +288,8 @@ UP037_0.py:51:15: UP037 [*] Remove quotes from type annotation 53 53 | x: NamedArg("str", "name") 54 54 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:53:13: UP037 [*] Remove quotes from type annotation | 51 | x: DefaultArg("str", "name") @@ -273,7 +301,7 @@ UP037_0.py:53:13: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 50 50 | 51 51 | x: DefaultArg("str", "name") 52 52 | @@ -283,6 +311,8 @@ UP037_0.py:53:13: UP037 [*] Remove quotes from type annotation 55 55 | x: DefaultNamedArg("str", "name") 56 56 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:55:20: UP037 [*] Remove quotes from type annotation | 53 | x: NamedArg("str", "name") @@ -294,7 +324,7 @@ UP037_0.py:55:20: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 52 52 | 53 53 | x: NamedArg("str", "name") 54 54 | @@ -304,6 +334,8 @@ UP037_0.py:55:20: UP037 [*] Remove quotes from type annotation 57 57 | x: DefaultNamedArg("str", name="name") 58 58 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:57:20: UP037 [*] Remove quotes from type annotation | 55 | x: DefaultNamedArg("str", "name") @@ -315,7 +347,7 @@ UP037_0.py:57:20: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 54 54 | 55 55 | x: DefaultNamedArg("str", "name") 56 56 | @@ -325,6 +357,8 @@ UP037_0.py:57:20: UP037 [*] Remove quotes from type annotation 59 59 | x: VarArg("str") 60 60 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:59:11: UP037 [*] Remove quotes from type annotation | 57 | x: DefaultNamedArg("str", name="name") @@ -336,7 +370,7 @@ UP037_0.py:59:11: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 56 56 | 57 57 | x: DefaultNamedArg("str", name="name") 58 58 | @@ -346,6 +380,8 @@ UP037_0.py:59:11: UP037 [*] Remove quotes from type annotation 61 61 | x: List[List[List["MyClass"]]] 62 62 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:61:19: UP037 [*] Remove quotes from type annotation | 59 | x: VarArg("str") @@ -357,7 +393,7 @@ UP037_0.py:61:19: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 58 58 | 59 59 | x: VarArg("str") 60 60 | @@ -367,6 +403,8 @@ UP037_0.py:61:19: UP037 [*] Remove quotes from type annotation 63 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 64 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:63:29: UP037 [*] Remove quotes from type annotation | 61 | x: List[List[List["MyClass"]]] @@ -378,7 +416,7 @@ UP037_0.py:63:29: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 60 60 | 61 61 | x: List[List[List["MyClass"]]] 62 62 | @@ -388,6 +426,8 @@ UP037_0.py:63:29: UP037 [*] Remove quotes from type annotation 65 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) 66 66 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:63:45: UP037 [*] Remove quotes from type annotation | 61 | x: List[List[List["MyClass"]]] @@ -399,7 +439,7 @@ UP037_0.py:63:45: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 60 60 | 61 61 | x: List[List[List["MyClass"]]] 62 62 | @@ -409,6 +449,8 @@ UP037_0.py:63:45: UP037 [*] Remove quotes from type annotation 65 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) 66 66 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:65:29: UP037 [*] Remove quotes from type annotation | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) @@ -420,7 +462,7 @@ UP037_0.py:65:29: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 62 62 | 63 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 64 | @@ -430,6 +472,8 @@ UP037_0.py:65:29: UP037 [*] Remove quotes from type annotation 67 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) 68 68 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:65:36: UP037 [*] Remove quotes from type annotation | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) @@ -441,7 +485,7 @@ UP037_0.py:65:36: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 62 62 | 63 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 64 | @@ -451,6 +495,8 @@ UP037_0.py:65:36: UP037 [*] Remove quotes from type annotation 67 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) 68 68 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:65:45: UP037 [*] Remove quotes from type annotation | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) @@ -462,7 +508,7 @@ UP037_0.py:65:45: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 62 62 | 63 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 64 | @@ -472,6 +518,8 @@ UP037_0.py:65:45: UP037 [*] Remove quotes from type annotation 67 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) 68 68 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:65:52: UP037 [*] Remove quotes from type annotation | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) @@ -483,7 +531,7 @@ UP037_0.py:65:52: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 62 62 | 63 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 64 | @@ -493,6 +541,8 @@ UP037_0.py:65:52: UP037 [*] Remove quotes from type annotation 67 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) 68 68 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:67:24: UP037 [*] Remove quotes from type annotation | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) @@ -504,7 +554,7 @@ UP037_0.py:67:24: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 64 64 | 65 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) 66 66 | @@ -514,6 +564,8 @@ UP037_0.py:67:24: UP037 [*] Remove quotes from type annotation 69 69 | X: MyCallable("X") 70 70 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:67:38: UP037 [*] Remove quotes from type annotation | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) @@ -525,7 +577,7 @@ UP037_0.py:67:38: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 64 64 | 65 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) 66 66 | @@ -535,6 +587,8 @@ UP037_0.py:67:38: UP037 [*] Remove quotes from type annotation 69 69 | X: MyCallable("X") 70 70 | + Run `ruff check --fix` to apply this fix. + UP037_0.py:67:45: UP037 [*] Remove quotes from type annotation | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) @@ -546,7 +600,7 @@ UP037_0.py:67:45: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 64 64 | 65 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) 66 66 | @@ -554,4 +608,6 @@ UP037_0.py:67:45: UP037 [*] Remove quotes from type annotation 67 |+x: NamedTuple(typename="X", fields=[("foo", int)]) 68 68 | 69 69 | X: MyCallable("X") -70 70 | +70 70 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_1.py.snap index 57379b20edbb2..542652b6211d1 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_1.py.snap @@ -11,7 +11,7 @@ UP037_1.py:9:8: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Safe fix +Suggested fix: 6 6 | 7 7 | def foo(): 8 8 | # UP037 @@ -19,4 +19,6 @@ UP037_1.py:9:8: UP037 [*] Remove quotes from type annotation 9 |+ x: Tuple[int, int] = (0, 0) 10 10 | print(x) 11 11 | -12 12 | +12 12 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap index 7a5117ab07aad..e250d48dace61 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap @@ -9,13 +9,15 @@ UP038.py:1:1: UP038 [*] Use `X | Y` in `isinstance` call instead of `(X, Y)` | = help: Convert to `X | Y` -ℹ Unsafe fix +Suggested fix: 1 |-isinstance(1, (int, float)) # UP038 1 |+isinstance(1, int | float) # UP038 2 2 | issubclass("yes", (int, float, str)) # UP038 3 3 | 4 4 | isinstance(1, int) # OK + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP038.py:2:1: UP038 [*] Use `X | Y` in `issubclass` call instead of `(X, Y)` | 1 | isinstance(1, (int, float)) # UP038 @@ -26,7 +28,7 @@ UP038.py:2:1: UP038 [*] Use `X | Y` in `issubclass` call instead of `(X, Y)` | = help: Convert to `X | Y` -ℹ Unsafe fix +Suggested fix: 1 1 | isinstance(1, (int, float)) # UP038 2 |-issubclass("yes", (int, float, str)) # UP038 2 |+issubclass("yes", int | float | str) # UP038 @@ -34,4 +36,4 @@ UP038.py:2:1: UP038 [*] Use `X | Y` in `issubclass` call instead of `(X, Y)` 4 4 | isinstance(1, int) # OK 5 5 | issubclass("yes", int) # OK - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP039.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP039.py.snap index ff6299b6e9079..06ae6d6f6a979 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP039.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP039.py.snap @@ -10,7 +10,7 @@ UP039.py:2:8: UP039 [*] Unnecessary parentheses after class definition | = help: Remove parentheses -ℹ Safe fix +Suggested fix: 1 1 | # Errors 2 |-class A(): 2 |+class A: @@ -18,6 +18,8 @@ UP039.py:2:8: UP039 [*] Unnecessary parentheses after class definition 4 4 | 5 5 | + Run `ruff check --fix` to apply this fix. + UP039.py:6:8: UP039 [*] Unnecessary parentheses after class definition | 6 | class A() \ @@ -27,7 +29,7 @@ UP039.py:6:8: UP039 [*] Unnecessary parentheses after class definition | = help: Remove parentheses -ℹ Safe fix +Suggested fix: 3 3 | pass 4 4 | 5 5 | @@ -37,6 +39,8 @@ UP039.py:6:8: UP039 [*] Unnecessary parentheses after class definition 8 8 | pass 9 9 | + Run `ruff check --fix` to apply this fix. + UP039.py:12:9: UP039 [*] Unnecessary parentheses after class definition | 11 | class A \ @@ -46,7 +50,7 @@ UP039.py:12:9: UP039 [*] Unnecessary parentheses after class definition | = help: Remove parentheses -ℹ Safe fix +Suggested fix: 9 9 | 10 10 | 11 11 | class A \ @@ -56,6 +60,8 @@ UP039.py:12:9: UP039 [*] Unnecessary parentheses after class definition 14 14 | 15 15 | + Run `ruff check --fix` to apply this fix. + UP039.py:17:8: UP039 [*] Unnecessary parentheses after class definition | 16 | @decorator() @@ -65,7 +71,7 @@ UP039.py:17:8: UP039 [*] Unnecessary parentheses after class definition | = help: Remove parentheses -ℹ Safe fix +Suggested fix: 14 14 | 15 15 | 16 16 | @decorator() @@ -75,6 +81,8 @@ UP039.py:17:8: UP039 [*] Unnecessary parentheses after class definition 19 19 | 20 20 | @decorator + Run `ruff check --fix` to apply this fix. + UP039.py:21:8: UP039 [*] Unnecessary parentheses after class definition | 20 | @decorator @@ -84,7 +92,7 @@ UP039.py:21:8: UP039 [*] Unnecessary parentheses after class definition | = help: Remove parentheses -ℹ Safe fix +Suggested fix: 18 18 | pass 19 19 | 20 20 | @decorator @@ -94,4 +102,4 @@ UP039.py:21:8: UP039 [*] Unnecessary parentheses after class definition 23 23 | 24 24 | # OK - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap index 03c7ea34d3bb6..b7921a02ba7ce 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap @@ -10,7 +10,7 @@ UP040.py:5:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of th | = help: Use the `type` keyword -ℹ Unsafe fix +Suggested fix: 2 2 | from typing import TypeAlias 3 3 | 4 4 | # UP040 @@ -20,6 +20,8 @@ UP040.py:5:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of th 7 7 | 8 8 | # UP040 simple generic + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP040.py:6:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | 4 | # UP040 @@ -31,7 +33,7 @@ UP040.py:6:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of th | = help: Use the `type` keyword -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | # UP040 5 5 | x: typing.TypeAlias = int @@ -41,6 +43,8 @@ UP040.py:6:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of th 8 8 | # UP040 simple generic 9 9 | T = typing.TypeVar["T"] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP040.py:10:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | 8 | # UP040 simple generic @@ -52,7 +56,7 @@ UP040.py:10:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Unsafe fix +Suggested fix: 7 7 | 8 8 | # UP040 simple generic 9 9 | T = typing.TypeVar["T"] @@ -62,6 +66,8 @@ UP040.py:10:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 12 12 | # UP040 call style generic 13 13 | T = typing.TypeVar("T") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP040.py:14:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | 12 | # UP040 call style generic @@ -73,7 +79,7 @@ UP040.py:14:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Unsafe fix +Suggested fix: 11 11 | 12 12 | # UP040 call style generic 13 13 | T = typing.TypeVar("T") @@ -83,6 +89,8 @@ UP040.py:14:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 16 16 | # UP040 bounded generic 17 17 | T = typing.TypeVar("T", bound=int) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP040.py:18:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | 16 | # UP040 bounded generic @@ -94,7 +102,7 @@ UP040.py:18:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Unsafe fix +Suggested fix: 15 15 | 16 16 | # UP040 bounded generic 17 17 | T = typing.TypeVar("T", bound=int) @@ -104,6 +112,8 @@ UP040.py:18:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 20 20 | # UP040 constrained generic 21 21 | T = typing.TypeVar("T", int, str) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP040.py:22:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | 20 | # UP040 constrained generic @@ -115,7 +125,7 @@ UP040.py:22:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Unsafe fix +Suggested fix: 19 19 | 20 20 | # UP040 constrained generic 21 21 | T = typing.TypeVar("T", int, str) @@ -125,6 +135,8 @@ UP040.py:22:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 24 24 | # UP040 contravariant generic 25 25 | T = typing.TypeVar("T", contravariant=True) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP040.py:26:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | 24 | # UP040 contravariant generic @@ -136,7 +148,7 @@ UP040.py:26:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Unsafe fix +Suggested fix: 23 23 | 24 24 | # UP040 contravariant generic 25 25 | T = typing.TypeVar("T", contravariant=True) @@ -146,6 +158,8 @@ UP040.py:26:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 28 28 | # UP040 covariant generic 29 29 | T = typing.TypeVar("T", covariant=True) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP040.py:30:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | 28 | # UP040 covariant generic @@ -157,7 +171,7 @@ UP040.py:30:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Unsafe fix +Suggested fix: 27 27 | 28 28 | # UP040 covariant generic 29 29 | T = typing.TypeVar("T", covariant=True) @@ -167,6 +181,8 @@ UP040.py:30:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 32 32 | # UP040 in class scope 33 33 | T = typing.TypeVar["T"] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP040.py:36:5: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | 34 | class Foo: @@ -178,7 +194,7 @@ UP040.py:36:5: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Unsafe fix +Suggested fix: 33 33 | T = typing.TypeVar["T"] 34 34 | class Foo: 35 35 | # reference to global variable @@ -188,6 +204,8 @@ UP040.py:36:5: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 38 38 | # reference to class variable 39 39 | TCLS = typing.TypeVar["TCLS"] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP040.py:40:5: UP040 [*] Type alias `y` uses `TypeAlias` annotation instead of the `type` keyword | 38 | # reference to class variable @@ -199,7 +217,7 @@ UP040.py:40:5: UP040 [*] Type alias `y` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Unsafe fix +Suggested fix: 37 37 | 38 38 | # reference to class variable 39 39 | TCLS = typing.TypeVar["TCLS"] @@ -209,6 +227,8 @@ UP040.py:40:5: UP040 [*] Type alias `y` uses `TypeAlias` annotation instead of t 42 42 | # UP040 won't add generics in fix 43 43 | T = typing.TypeVar(*args) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP040.py:44:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | 42 | # UP040 won't add generics in fix @@ -220,7 +240,7 @@ UP040.py:44:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Unsafe fix +Suggested fix: 41 41 | 42 42 | # UP040 won't add generics in fix 43 43 | T = typing.TypeVar(*args) @@ -230,6 +250,8 @@ UP040.py:44:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 46 46 | # OK 47 47 | x: TypeAlias + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP040.py:53:1: UP040 [*] Type alias `Decorator` uses `TypeAlias` annotation instead of the `type` keyword | 51 | # type alias. @@ -239,7 +261,7 @@ UP040.py:53:1: UP040 [*] Type alias `Decorator` uses `TypeAlias` annotation inst | = help: Use the `type` keyword -ℹ Unsafe fix +Suggested fix: 50 50 | # Ensure that "T" appears only once in the type parameters for the modernized 51 51 | # type alias. 52 52 | T = typing.TypeVar["T"] @@ -249,6 +271,8 @@ UP040.py:53:1: UP040 [*] Type alias `Decorator` uses `TypeAlias` annotation inst 55 55 | 56 56 | from typing import TypeVar, Annotated, TypeAliasType + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP040.py:63:1: UP040 [*] Type alias `PositiveList` uses `TypeAliasType` assignment instead of the `type` keyword | 61 | # https://github.com/astral-sh/ruff/issues/11422 @@ -262,7 +286,7 @@ UP040.py:63:1: UP040 [*] Type alias `PositiveList` uses `TypeAliasType` assignme | = help: Use the `type` keyword -ℹ Safe fix +Suggested fix: 60 60 | 61 61 | # https://github.com/astral-sh/ruff/issues/11422 62 62 | T = TypeVar("T") @@ -274,6 +298,8 @@ UP040.py:63:1: UP040 [*] Type alias `PositiveList` uses `TypeAliasType` assignme 67 65 | # Bound 68 66 | T = TypeVar("T", bound=SupportGt) + Run `ruff check --fix` to apply this fix. + UP040.py:69:1: UP040 [*] Type alias `PositiveList` uses `TypeAliasType` assignment instead of the `type` keyword | 67 | # Bound @@ -287,7 +313,7 @@ UP040.py:69:1: UP040 [*] Type alias `PositiveList` uses `TypeAliasType` assignme | = help: Use the `type` keyword -ℹ Safe fix +Suggested fix: 66 66 | 67 67 | # Bound 68 68 | T = TypeVar("T", bound=SupportGt) @@ -299,6 +325,8 @@ UP040.py:69:1: UP040 [*] Type alias `PositiveList` uses `TypeAliasType` assignme 73 71 | # Multiple bounds 74 72 | T1 = TypeVar("T1", bound=SupportGt) + Run `ruff check --fix` to apply this fix. + UP040.py:77:1: UP040 [*] Type alias `Tuple3` uses `TypeAliasType` assignment instead of the `type` keyword | 75 | T2 = TypeVar("T2") @@ -310,7 +338,7 @@ UP040.py:77:1: UP040 [*] Type alias `Tuple3` uses `TypeAliasType` assignment ins | = help: Use the `type` keyword -ℹ Safe fix +Suggested fix: 74 74 | T1 = TypeVar("T1", bound=SupportGt) 75 75 | T2 = TypeVar("T2") 76 76 | T3 = TypeVar("T3") @@ -320,6 +348,8 @@ UP040.py:77:1: UP040 [*] Type alias `Tuple3` uses `TypeAliasType` assignment ins 79 79 | # No type_params 80 80 | PositiveInt = TypeAliasType("PositiveInt", Annotated[int, Gt(0)]) + Run `ruff check --fix` to apply this fix. + UP040.py:80:1: UP040 [*] Type alias `PositiveInt` uses `TypeAliasType` assignment instead of the `type` keyword | 79 | # No type_params @@ -329,7 +359,7 @@ UP040.py:80:1: UP040 [*] Type alias `PositiveInt` uses `TypeAliasType` assignmen | = help: Use the `type` keyword -ℹ Safe fix +Suggested fix: 77 77 | Tuple3 = TypeAliasType("Tuple3", tuple[T1, T2, T3], type_params=(T1, T2, T3)) 78 78 | 79 79 | # No type_params @@ -339,6 +369,8 @@ UP040.py:80:1: UP040 [*] Type alias `PositiveInt` uses `TypeAliasType` assignmen 82 82 | 83 83 | # OK: Other name + Run `ruff check --fix` to apply this fix. + UP040.py:81:1: UP040 [*] Type alias `PositiveInt` uses `TypeAliasType` assignment instead of the `type` keyword | 79 | # No type_params @@ -350,7 +382,7 @@ UP040.py:81:1: UP040 [*] Type alias `PositiveInt` uses `TypeAliasType` assignmen | = help: Use the `type` keyword -ℹ Safe fix +Suggested fix: 78 78 | 79 79 | # No type_params 80 80 | PositiveInt = TypeAliasType("PositiveInt", Annotated[int, Gt(0)]) @@ -359,3 +391,5 @@ UP040.py:81:1: UP040 [*] Type alias `PositiveInt` uses `TypeAliasType` assignmen 82 82 | 83 83 | # OK: Other name 84 84 | T = TypeVar("T", bound=SupportGt) + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.pyi.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.pyi.snap index 9615265f86bc3..bef8a31e78ac8 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.pyi.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.pyi.snap @@ -11,7 +11,7 @@ UP040.pyi:6:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | # UP040 5 5 | # Fixes in type stub files should be safe to apply unlike in regular code where runtime behavior could change @@ -19,6 +19,8 @@ UP040.pyi:6:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 6 |+type x = int 7 7 | x: TypeAlias = int + Run `ruff check --fix` to apply this fix. + UP040.pyi:7:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | 5 | # Fixes in type stub files should be safe to apply unlike in regular code where runtime behavior could change @@ -28,11 +30,11 @@ UP040.pyi:7:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Safe fix +Suggested fix: 4 4 | # UP040 5 5 | # Fixes in type stub files should be safe to apply unlike in regular code where runtime behavior could change 6 6 | x: typing.TypeAlias = int 7 |-x: TypeAlias = int 7 |+type x = int - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP041.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP041.py.snap index 68f66dc6de38f..9ff6ab8d55cb7 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP041.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP041.py.snap @@ -11,7 +11,7 @@ UP041.py:5:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace `asyncio.TimeoutError` with builtin `TimeoutError` -ℹ Safe fix +Suggested fix: 2 2 | # These should be fixed 3 3 | try: 4 4 | pass @@ -21,6 +21,8 @@ UP041.py:5:8: UP041 [*] Replace aliased errors with `TimeoutError` 7 7 | 8 8 | try: + Run `ruff check --fix` to apply this fix. + UP041.py:10:8: UP041 [*] Replace aliased errors with `TimeoutError` | 8 | try: @@ -31,7 +33,7 @@ UP041.py:10:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace `socket.timeout` with builtin `TimeoutError` -ℹ Safe fix +Suggested fix: 7 7 | 8 8 | try: 9 9 | pass @@ -41,6 +43,8 @@ UP041.py:10:8: UP041 [*] Replace aliased errors with `TimeoutError` 12 12 | 13 13 | # Should NOT be in parentheses when replaced + Run `ruff check --fix` to apply this fix. + UP041.py:17:8: UP041 [*] Replace aliased errors with `TimeoutError` | 15 | try: @@ -51,7 +55,7 @@ UP041.py:17:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -ℹ Safe fix +Suggested fix: 14 14 | 15 15 | try: 16 16 | pass @@ -61,6 +65,8 @@ UP041.py:17:8: UP041 [*] Replace aliased errors with `TimeoutError` 19 19 | 20 20 | try: + Run `ruff check --fix` to apply this fix. + UP041.py:22:8: UP041 [*] Replace aliased errors with `TimeoutError` | 20 | try: @@ -71,7 +77,7 @@ UP041.py:22:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -ℹ Safe fix +Suggested fix: 19 19 | 20 20 | try: 21 21 | pass @@ -81,6 +87,8 @@ UP041.py:22:8: UP041 [*] Replace aliased errors with `TimeoutError` 24 24 | 25 25 | try: + Run `ruff check --fix` to apply this fix. + UP041.py:27:8: UP041 [*] Replace aliased errors with `TimeoutError` | 25 | try: @@ -91,7 +99,7 @@ UP041.py:27:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -ℹ Safe fix +Suggested fix: 24 24 | 25 25 | try: 26 26 | pass @@ -101,6 +109,8 @@ UP041.py:27:8: UP041 [*] Replace aliased errors with `TimeoutError` 29 29 | 30 30 | # Should be kept in parentheses (because multiple) + Run `ruff check --fix` to apply this fix. + UP041.py:34:8: UP041 [*] Replace aliased errors with `TimeoutError` | 32 | try: @@ -111,7 +121,7 @@ UP041.py:34:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -ℹ Safe fix +Suggested fix: 31 31 | 32 32 | try: 33 33 | pass @@ -121,6 +131,8 @@ UP041.py:34:8: UP041 [*] Replace aliased errors with `TimeoutError` 36 36 | 37 37 | # First should change, second should not + Run `ruff check --fix` to apply this fix. + UP041.py:42:8: UP041 [*] Replace aliased errors with `TimeoutError` | 40 | try: @@ -131,7 +143,7 @@ UP041.py:42:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -ℹ Safe fix +Suggested fix: 39 39 | from .mmap import error 40 40 | try: 41 41 | pass @@ -141,4 +153,4 @@ UP041.py:42:8: UP041 [*] Replace aliased errors with `TimeoutError` 44 44 | 45 45 | # These should not change - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP042.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP042.py.snap index e7bff6e26969f..5ba7565497919 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP042.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP042.py.snap @@ -8,7 +8,7 @@ UP042.py:4:7: UP042 [*] Class A inherits from both `str` and `enum.Enum` | = help: Inherit from `enum.StrEnum` -ℹ Unsafe fix +Suggested fix: 1 |-from enum import Enum 1 |+from enum import Enum, StrEnum 2 2 | @@ -19,6 +19,8 @@ UP042.py:4:7: UP042 [*] Class A inherits from both `str` and `enum.Enum` 6 6 | 7 7 | class B(Enum, str): ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP042.py:7:7: UP042 [*] Class B inherits from both `str` and `enum.Enum` | 7 | class B(Enum, str): ... @@ -26,7 +28,7 @@ UP042.py:7:7: UP042 [*] Class B inherits from both `str` and `enum.Enum` | = help: Inherit from `enum.StrEnum` -ℹ Unsafe fix +Suggested fix: 1 |-from enum import Enum 1 |+from enum import Enum, StrEnum 2 2 | @@ -40,6 +42,8 @@ UP042.py:7:7: UP042 [*] Class B inherits from both `str` and `enum.Enum` 9 9 | 10 10 | class D(int, str, Enum): ... + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP042.py:10:7: UP042 Class D inherits from both `str` and `enum.Enum` | 10 | class D(int, str, Enum): ... diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP043.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP043.py.snap index 4198822ad3363..9c6967056abc1 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP043.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP043.py.snap @@ -9,7 +9,7 @@ UP043.py:4:15: UP043 [*] Unnecessary default type arguments | = help: Remove default type arguments -ℹ Safe fix +Suggested fix: 1 1 | from typing import Generator, AsyncGenerator 2 2 | 3 3 | @@ -19,6 +19,8 @@ UP043.py:4:15: UP043 [*] Unnecessary default type arguments 6 6 | 7 7 | + Run `ruff check --fix` to apply this fix. + UP043.py:8:15: UP043 [*] Unnecessary default type arguments | 8 | def func() -> Generator[int, None]: @@ -27,7 +29,7 @@ UP043.py:8:15: UP043 [*] Unnecessary default type arguments | = help: Remove default type arguments -ℹ Safe fix +Suggested fix: 5 5 | yield 42 6 6 | 7 7 | @@ -37,6 +39,8 @@ UP043.py:8:15: UP043 [*] Unnecessary default type arguments 10 10 | 11 11 | + Run `ruff check --fix` to apply this fix. + UP043.py:21:15: UP043 [*] Unnecessary default type arguments | 21 | def func() -> Generator[int, int, None]: @@ -46,7 +50,7 @@ UP043.py:21:15: UP043 [*] Unnecessary default type arguments | = help: Remove default type arguments -ℹ Safe fix +Suggested fix: 18 18 | return foo 19 19 | 20 20 | @@ -56,6 +60,8 @@ UP043.py:21:15: UP043 [*] Unnecessary default type arguments 23 23 | return None 24 24 | + Run `ruff check --fix` to apply this fix. + UP043.py:31:21: UP043 [*] Unnecessary default type arguments | 31 | async def func() -> AsyncGenerator[int, None]: @@ -64,7 +70,7 @@ UP043.py:31:21: UP043 [*] Unnecessary default type arguments | = help: Remove default type arguments -ℹ Safe fix +Suggested fix: 28 28 | return 42 29 29 | 30 30 | @@ -72,4 +78,6 @@ UP043.py:31:21: UP043 [*] Unnecessary default type arguments 31 |+async def func() -> AsyncGenerator[int]: 32 32 | yield 42 33 33 | -34 34 | +34 34 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__async_timeout_error_alias_not_applied_py310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__async_timeout_error_alias_not_applied_py310.snap index 3197391b53919..5febbd610d58c 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__async_timeout_error_alias_not_applied_py310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__async_timeout_error_alias_not_applied_py310.snap @@ -11,7 +11,7 @@ UP041.py:10:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace `socket.timeout` with builtin `TimeoutError` -ℹ Safe fix +Suggested fix: 7 7 | 8 8 | try: 9 9 | pass @@ -21,6 +21,8 @@ UP041.py:10:8: UP041 [*] Replace aliased errors with `TimeoutError` 12 12 | 13 13 | # Should NOT be in parentheses when replaced + Run `ruff check --fix` to apply this fix. + UP041.py:22:8: UP041 [*] Replace aliased errors with `TimeoutError` | 20 | try: @@ -31,7 +33,7 @@ UP041.py:22:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -ℹ Safe fix +Suggested fix: 19 19 | 20 20 | try: 21 21 | pass @@ -41,6 +43,8 @@ UP041.py:22:8: UP041 [*] Replace aliased errors with `TimeoutError` 24 24 | 25 25 | try: + Run `ruff check --fix` to apply this fix. + UP041.py:27:8: UP041 [*] Replace aliased errors with `TimeoutError` | 25 | try: @@ -51,7 +55,7 @@ UP041.py:27:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -ℹ Safe fix +Suggested fix: 24 24 | 25 25 | try: 26 26 | pass @@ -61,6 +65,8 @@ UP041.py:27:8: UP041 [*] Replace aliased errors with `TimeoutError` 29 29 | 30 30 | # Should be kept in parentheses (because multiple) + Run `ruff check --fix` to apply this fix. + UP041.py:34:8: UP041 [*] Replace aliased errors with `TimeoutError` | 32 | try: @@ -71,7 +77,7 @@ UP041.py:34:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -ℹ Safe fix +Suggested fix: 31 31 | 32 32 | try: 33 33 | pass @@ -81,4 +87,4 @@ UP041.py:34:8: UP041 [*] Replace aliased errors with `TimeoutError` 36 36 | 37 37 | # First should change, second should not - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap index 9cea3d7563066..ef6b3ed4b9ba4 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap @@ -10,7 +10,7 @@ UP017.py:10:11: UP017 [*] Use `datetime.UTC` alias | = help: Convert to `datetime.UTC` alias -ℹ Safe fix +Suggested fix: 1 |+from datetime import UTC 1 2 | def func(): 2 3 | import datetime @@ -25,6 +25,8 @@ UP017.py:10:11: UP017 [*] Use `datetime.UTC` alias 12 13 | 13 14 | def func(): + Run `ruff check --fix` to apply this fix. + UP017.py:16:11: UP017 [*] Use `datetime.UTC` alias | 14 | from datetime import timezone as tz @@ -34,7 +36,7 @@ UP017.py:16:11: UP017 [*] Use `datetime.UTC` alias | = help: Convert to `datetime.UTC` alias -ℹ Safe fix +Suggested fix: 1 |+from datetime import UTC 1 2 | def func(): 2 3 | import datetime @@ -49,6 +51,8 @@ UP017.py:16:11: UP017 [*] Use `datetime.UTC` alias 18 19 | 19 20 | def func(): + Run `ruff check --fix` to apply this fix. + UP017.py:22:11: UP017 [*] Use `datetime.UTC` alias | 20 | import datetime @@ -58,7 +62,7 @@ UP017.py:22:11: UP017 [*] Use `datetime.UTC` alias | = help: Convert to `datetime.UTC` alias -ℹ Safe fix +Suggested fix: 19 19 | def func(): 20 20 | import datetime 21 21 | @@ -68,6 +72,8 @@ UP017.py:22:11: UP017 [*] Use `datetime.UTC` alias 24 24 | 25 25 | def func(): + Run `ruff check --fix` to apply this fix. + UP017.py:28:11: UP017 [*] Use `datetime.UTC` alias | 26 | import datetime as dt @@ -77,9 +83,11 @@ UP017.py:28:11: UP017 [*] Use `datetime.UTC` alias | = help: Convert to `datetime.UTC` alias -ℹ Safe fix +Suggested fix: 25 25 | def func(): 26 26 | import datetime as dt 27 27 | 28 |- print(dt.timezone.utc) 28 |+ print(dt.UTC) + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_keep_runtime_typing_p310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_keep_runtime_typing_p310.snap index dc9d6c6a7f0f3..7c65269010c18 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_keep_runtime_typing_p310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_keep_runtime_typing_p310.snap @@ -10,7 +10,7 @@ future_annotations.py:34:18: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 31 31 | return cls(x=0, y=0) 32 32 | 33 33 | @@ -20,6 +20,8 @@ future_annotations.py:34:18: UP006 [*] Use `list` instead of `List` for type ann 36 36 | y.append(x) 37 37 | return y + Run `ruff check --fix` to apply this fix. + future_annotations.py:35:9: UP006 [*] Use `list` instead of `List` for type annotation | 34 | def f(x: int) -> List[int]: @@ -30,7 +32,7 @@ future_annotations.py:35:9: UP006 [*] Use `list` instead of `List` for type anno | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 32 32 | 33 33 | 34 34 | def f(x: int) -> List[int]: @@ -40,6 +42,8 @@ future_annotations.py:35:9: UP006 [*] Use `list` instead of `List` for type anno 37 37 | return y 38 38 | + Run `ruff check --fix` to apply this fix. + future_annotations.py:42:27: UP006 [*] Use `list` instead of `List` for type annotation | 40 | x: Optional[int] = None @@ -49,13 +53,15 @@ future_annotations.py:42:27: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 39 39 | 40 40 | x: Optional[int] = None 41 41 | 42 |-MyList: TypeAlias = Union[List[int], List[str]] 42 |+MyList: TypeAlias = Union[list[int], List[str]] + Run `ruff check --fix` to apply this fix. + future_annotations.py:42:38: UP006 [*] Use `list` instead of `List` for type annotation | 40 | x: Optional[int] = None @@ -65,11 +71,11 @@ future_annotations.py:42:38: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 39 39 | 40 40 | x: Optional[int] = None 41 41 | 42 |-MyList: TypeAlias = Union[List[int], List[str]] 42 |+MyList: TypeAlias = Union[List[int], list[str]] - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap index 71eba348b3fa9..bc57900284fa7 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap @@ -10,7 +10,7 @@ future_annotations.py:34:18: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -ℹ Unsafe fix +Suggested fix: 31 31 | return cls(x=0, y=0) 32 32 | 33 33 | @@ -20,4 +20,4 @@ future_annotations.py:34:18: UP006 [*] Use `list` instead of `List` for type ann 36 36 | y.append(x) 37 37 | return y - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap index dc9d6c6a7f0f3..7c65269010c18 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap @@ -10,7 +10,7 @@ future_annotations.py:34:18: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 31 31 | return cls(x=0, y=0) 32 32 | 33 33 | @@ -20,6 +20,8 @@ future_annotations.py:34:18: UP006 [*] Use `list` instead of `List` for type ann 36 36 | y.append(x) 37 37 | return y + Run `ruff check --fix` to apply this fix. + future_annotations.py:35:9: UP006 [*] Use `list` instead of `List` for type annotation | 34 | def f(x: int) -> List[int]: @@ -30,7 +32,7 @@ future_annotations.py:35:9: UP006 [*] Use `list` instead of `List` for type anno | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 32 32 | 33 33 | 34 34 | def f(x: int) -> List[int]: @@ -40,6 +42,8 @@ future_annotations.py:35:9: UP006 [*] Use `list` instead of `List` for type anno 37 37 | return y 38 38 | + Run `ruff check --fix` to apply this fix. + future_annotations.py:42:27: UP006 [*] Use `list` instead of `List` for type annotation | 40 | x: Optional[int] = None @@ -49,13 +53,15 @@ future_annotations.py:42:27: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 39 39 | 40 40 | x: Optional[int] = None 41 41 | 42 |-MyList: TypeAlias = Union[List[int], List[str]] 42 |+MyList: TypeAlias = Union[list[int], List[str]] + Run `ruff check --fix` to apply this fix. + future_annotations.py:42:38: UP006 [*] Use `list` instead of `List` for type annotation | 40 | x: Optional[int] = None @@ -65,11 +71,11 @@ future_annotations.py:42:38: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -ℹ Safe fix +Suggested fix: 39 39 | 40 40 | x: Optional[int] = None 41 41 | 42 |-MyList: TypeAlias = Union[List[int], List[str]] 42 |+MyList: TypeAlias = Union[List[int], list[str]] - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap index 442d20f7a5476..32569f886f2f8 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap @@ -10,7 +10,7 @@ future_annotations.py:40:4: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Unsafe fix +Suggested fix: 37 37 | return y 38 38 | 39 39 | @@ -19,4 +19,4 @@ future_annotations.py:40:4: UP007 [*] Use `X | Y` for type annotations 41 41 | 42 42 | MyList: TypeAlias = Union[List[int], List[str]] - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap index 386e009dfa9cb..e4d055dc25a6c 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap @@ -10,7 +10,7 @@ future_annotations.py:40:4: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 37 37 | return y 38 38 | 39 39 | @@ -19,6 +19,8 @@ future_annotations.py:40:4: UP007 [*] Use `X | Y` for type annotations 41 41 | 42 42 | MyList: TypeAlias = Union[List[int], List[str]] + Run `ruff check --fix` to apply this fix. + future_annotations.py:42:21: UP007 [*] Use `X | Y` for type annotations | 40 | x: Optional[int] = None @@ -28,11 +30,11 @@ future_annotations.py:42:21: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Safe fix +Suggested fix: 39 39 | 40 40 | x: Optional[int] = None 41 41 | 42 |-MyList: TypeAlias = Union[List[int], List[str]] 42 |+MyList: TypeAlias = List[int] | List[str] - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap index f37d6398a1119..fee8c927d0bcd 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap @@ -12,7 +12,7 @@ FURB105.py:3:1: FURB105 [*] Unnecessary empty string passed to `print` | = help: Remove empty string -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 2 | 3 |-print("") @@ -21,6 +21,8 @@ FURB105.py:3:1: FURB105 [*] Unnecessary empty string passed to `print` 5 5 | print("", end="bar") 6 6 | print("", sep=",", end="bar") + Run `ruff check --fix` to apply this fix. + FURB105.py:4:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 3 | print("") @@ -31,7 +33,7 @@ FURB105.py:4:1: FURB105 [*] Unnecessary empty string and separator passed to `pr | = help: Remove empty string and separator -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 2 | 3 3 | print("") @@ -41,6 +43,8 @@ FURB105.py:4:1: FURB105 [*] Unnecessary empty string and separator passed to `pr 6 6 | print("", sep=",", end="bar") 7 7 | print(sep="") + Run `ruff check --fix` to apply this fix. + FURB105.py:5:1: FURB105 [*] Unnecessary empty string passed to `print` | 3 | print("") @@ -52,7 +56,7 @@ FURB105.py:5:1: FURB105 [*] Unnecessary empty string passed to `print` | = help: Remove empty string -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | print("") 4 4 | print("", sep=",") @@ -62,6 +66,8 @@ FURB105.py:5:1: FURB105 [*] Unnecessary empty string passed to `print` 7 7 | print(sep="") 8 8 | print("", sep="") + Run `ruff check --fix` to apply this fix. + FURB105.py:6:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 4 | print("", sep=",") @@ -73,7 +79,7 @@ FURB105.py:6:1: FURB105 [*] Unnecessary empty string and separator passed to `pr | = help: Remove empty string and separator -ℹ Safe fix +Suggested fix: 3 3 | print("") 4 4 | print("", sep=",") 5 5 | print("", end="bar") @@ -83,6 +89,8 @@ FURB105.py:6:1: FURB105 [*] Unnecessary empty string and separator passed to `pr 8 8 | print("", sep="") 9 9 | print("", "", sep="") + Run `ruff check --fix` to apply this fix. + FURB105.py:7:1: FURB105 [*] Unnecessary separator passed to `print` | 5 | print("", end="bar") @@ -94,7 +102,7 @@ FURB105.py:7:1: FURB105 [*] Unnecessary separator passed to `print` | = help: Remove separator -ℹ Safe fix +Suggested fix: 4 4 | print("", sep=",") 5 5 | print("", end="bar") 6 6 | print("", sep=",", end="bar") @@ -104,6 +112,8 @@ FURB105.py:7:1: FURB105 [*] Unnecessary separator passed to `print` 9 9 | print("", "", sep="") 10 10 | print("", "", sep="", end="") + Run `ruff check --fix` to apply this fix. + FURB105.py:8:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 6 | print("", sep=",", end="bar") @@ -115,7 +125,7 @@ FURB105.py:8:1: FURB105 [*] Unnecessary empty string and separator passed to `pr | = help: Remove empty string and separator -ℹ Safe fix +Suggested fix: 5 5 | print("", end="bar") 6 6 | print("", sep=",", end="bar") 7 7 | print(sep="") @@ -125,6 +135,8 @@ FURB105.py:8:1: FURB105 [*] Unnecessary empty string and separator passed to `pr 10 10 | print("", "", sep="", end="") 11 11 | print("", "", sep="", end="bar") + Run `ruff check --fix` to apply this fix. + FURB105.py:9:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 7 | print(sep="") @@ -136,7 +148,7 @@ FURB105.py:9:1: FURB105 [*] Unnecessary empty string and separator passed to `pr | = help: Remove empty string and separator -ℹ Safe fix +Suggested fix: 6 6 | print("", sep=",", end="bar") 7 7 | print(sep="") 8 8 | print("", sep="") @@ -146,6 +158,8 @@ FURB105.py:9:1: FURB105 [*] Unnecessary empty string and separator passed to `pr 11 11 | print("", "", sep="", end="bar") 12 12 | print("", sep="", end="bar") + Run `ruff check --fix` to apply this fix. + FURB105.py:10:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 8 | print("", sep="") @@ -157,7 +171,7 @@ FURB105.py:10:1: FURB105 [*] Unnecessary empty string and separator passed to `p | = help: Remove empty string and separator -ℹ Safe fix +Suggested fix: 7 7 | print(sep="") 8 8 | print("", sep="") 9 9 | print("", "", sep="") @@ -167,6 +181,8 @@ FURB105.py:10:1: FURB105 [*] Unnecessary empty string and separator passed to `p 12 12 | print("", sep="", end="bar") 13 13 | print(sep="", end="bar") + Run `ruff check --fix` to apply this fix. + FURB105.py:11:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 9 | print("", "", sep="") @@ -178,7 +194,7 @@ FURB105.py:11:1: FURB105 [*] Unnecessary empty string and separator passed to `p | = help: Remove empty string and separator -ℹ Safe fix +Suggested fix: 8 8 | print("", sep="") 9 9 | print("", "", sep="") 10 10 | print("", "", sep="", end="") @@ -188,6 +204,8 @@ FURB105.py:11:1: FURB105 [*] Unnecessary empty string and separator passed to `p 13 13 | print(sep="", end="bar") 14 14 | print("", "foo", sep="") + Run `ruff check --fix` to apply this fix. + FURB105.py:12:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 10 | print("", "", sep="", end="") @@ -199,7 +217,7 @@ FURB105.py:12:1: FURB105 [*] Unnecessary empty string and separator passed to `p | = help: Remove empty string and separator -ℹ Safe fix +Suggested fix: 9 9 | print("", "", sep="") 10 10 | print("", "", sep="", end="") 11 11 | print("", "", sep="", end="bar") @@ -209,6 +227,8 @@ FURB105.py:12:1: FURB105 [*] Unnecessary empty string and separator passed to `p 14 14 | print("", "foo", sep="") 15 15 | print("foo", "", sep="") + Run `ruff check --fix` to apply this fix. + FURB105.py:13:1: FURB105 [*] Unnecessary separator passed to `print` | 11 | print("", "", sep="", end="bar") @@ -220,7 +240,7 @@ FURB105.py:13:1: FURB105 [*] Unnecessary separator passed to `print` | = help: Remove separator -ℹ Safe fix +Suggested fix: 10 10 | print("", "", sep="", end="") 11 11 | print("", "", sep="", end="bar") 12 12 | print("", sep="", end="bar") @@ -230,6 +250,8 @@ FURB105.py:13:1: FURB105 [*] Unnecessary separator passed to `print` 15 15 | print("foo", "", sep="") 16 16 | print("foo", "", "bar", sep="") + Run `ruff check --fix` to apply this fix. + FURB105.py:14:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 12 | print("", sep="", end="bar") @@ -241,7 +263,7 @@ FURB105.py:14:1: FURB105 [*] Unnecessary empty string and separator passed to `p | = help: Remove empty string and separator -ℹ Safe fix +Suggested fix: 11 11 | print("", "", sep="", end="bar") 12 12 | print("", sep="", end="bar") 13 13 | print(sep="", end="bar") @@ -251,6 +273,8 @@ FURB105.py:14:1: FURB105 [*] Unnecessary empty string and separator passed to `p 16 16 | print("foo", "", "bar", sep="") 17 17 | print("", *args) + Run `ruff check --fix` to apply this fix. + FURB105.py:15:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 13 | print(sep="", end="bar") @@ -262,7 +286,7 @@ FURB105.py:15:1: FURB105 [*] Unnecessary empty string and separator passed to `p | = help: Remove empty string and separator -ℹ Safe fix +Suggested fix: 12 12 | print("", sep="", end="bar") 13 13 | print(sep="", end="bar") 14 14 | print("", "foo", sep="") @@ -272,6 +296,8 @@ FURB105.py:15:1: FURB105 [*] Unnecessary empty string and separator passed to `p 17 17 | print("", *args) 18 18 | print("", *args, sep="") + Run `ruff check --fix` to apply this fix. + FURB105.py:16:1: FURB105 [*] Unnecessary empty string passed to `print` | 14 | print("", "foo", sep="") @@ -283,7 +309,7 @@ FURB105.py:16:1: FURB105 [*] Unnecessary empty string passed to `print` | = help: Remove empty string -ℹ Safe fix +Suggested fix: 13 13 | print(sep="", end="bar") 14 14 | print("", "foo", sep="") 15 15 | print("foo", "", sep="") @@ -293,6 +319,8 @@ FURB105.py:16:1: FURB105 [*] Unnecessary empty string passed to `print` 18 18 | print("", *args, sep="") 19 19 | print("", **kwargs) + Run `ruff check --fix` to apply this fix. + FURB105.py:18:1: FURB105 [*] Unnecessary empty string passed to `print` | 16 | print("foo", "", "bar", sep="") @@ -304,7 +332,7 @@ FURB105.py:18:1: FURB105 [*] Unnecessary empty string passed to `print` | = help: Remove empty string -ℹ Safe fix +Suggested fix: 15 15 | print("foo", "", sep="") 16 16 | print("foo", "", "bar", sep="") 17 17 | print("", *args) @@ -314,6 +342,8 @@ FURB105.py:18:1: FURB105 [*] Unnecessary empty string passed to `print` 20 20 | print(sep="\t") 21 21 | + Run `ruff check --fix` to apply this fix. + FURB105.py:19:1: FURB105 [*] Unnecessary empty string passed to `print` | 17 | print("", *args) @@ -324,7 +354,7 @@ FURB105.py:19:1: FURB105 [*] Unnecessary empty string passed to `print` | = help: Remove empty string -ℹ Safe fix +Suggested fix: 16 16 | print("foo", "", "bar", sep="") 17 17 | print("", *args) 18 18 | print("", *args, sep="") @@ -334,6 +364,8 @@ FURB105.py:19:1: FURB105 [*] Unnecessary empty string passed to `print` 21 21 | 22 22 | # OK. + Run `ruff check --fix` to apply this fix. + FURB105.py:20:1: FURB105 [*] Unnecessary separator passed to `print` | 18 | print("", *args, sep="") @@ -345,7 +377,7 @@ FURB105.py:20:1: FURB105 [*] Unnecessary separator passed to `print` | = help: Remove separator -ℹ Safe fix +Suggested fix: 17 17 | print("", *args) 18 18 | print("", *args, sep="") 19 19 | print("", **kwargs) @@ -355,4 +387,4 @@ FURB105.py:20:1: FURB105 [*] Unnecessary separator passed to `print` 22 22 | # OK. 23 23 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap index 29e977193e329..16aa8419a11ff 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap @@ -10,13 +10,15 @@ FURB110.py:1:5: FURB110 [*] Replace ternary `if` expression with `or` operator | = help: Replace with `or` operator -ℹ Safe fix +Suggested fix: 1 |-z = x if x else y # FURB110 1 |+z = x or y # FURB110 2 2 | 3 3 | z = x \ 4 4 | if x else y # FURB110 + Run `ruff check --fix` to apply this fix. + FURB110.py:3:5: FURB110 [*] Replace ternary `if` expression with `or` operator | 1 | z = x if x else y # FURB110 @@ -30,7 +32,7 @@ FURB110.py:3:5: FURB110 [*] Replace ternary `if` expression with `or` operator | = help: Replace with `or` operator -ℹ Safe fix +Suggested fix: 1 1 | z = x if x else y # FURB110 2 2 | 3 |-z = x \ @@ -40,6 +42,8 @@ FURB110.py:3:5: FURB110 [*] Replace ternary `if` expression with `or` operator 6 5 | z = x if x \ 7 6 | else \ + Run `ruff check --fix` to apply this fix. + FURB110.py:6:5: FURB110 [*] Replace ternary `if` expression with `or` operator | 4 | if x else y # FURB110 @@ -54,7 +58,7 @@ FURB110.py:6:5: FURB110 [*] Replace ternary `if` expression with `or` operator | = help: Replace with `or` operator -ℹ Safe fix +Suggested fix: 3 3 | z = x \ 4 4 | if x else y # FURB110 5 5 | @@ -66,6 +70,8 @@ FURB110.py:6:5: FURB110 [*] Replace ternary `if` expression with `or` operator 10 8 | z = x() if x() else y() # FURB110 11 9 | + Run `ruff check --fix` to apply this fix. + FURB110.py:10:5: FURB110 [*] Replace ternary `if` expression with `or` operator | 8 | y # FURB110 @@ -77,7 +83,7 @@ FURB110.py:10:5: FURB110 [*] Replace ternary `if` expression with `or` operator | = help: Replace with `or` operator -ℹ Unsafe fix +Suggested fix: 7 7 | else \ 8 8 | y # FURB110 9 9 | @@ -87,6 +93,8 @@ FURB110.py:10:5: FURB110 [*] Replace ternary `if` expression with `or` operator 12 12 | # FURB110 13 13 | z = x if ( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB110.py:13:5: FURB110 [*] Replace ternary `if` expression with `or` operator | 12 | # FURB110 @@ -104,7 +112,7 @@ FURB110.py:13:5: FURB110 [*] Replace ternary `if` expression with `or` operator | = help: Replace with `or` operator -ℹ Safe fix +Suggested fix: 10 10 | z = x() if x() else y() # FURB110 11 11 | 12 12 | # FURB110 @@ -118,6 +126,8 @@ FURB110.py:13:5: FURB110 [*] Replace ternary `if` expression with `or` operator 18 18 | y 19 19 | ) + Run `ruff check --fix` to apply this fix. + FURB110.py:23:5: FURB110 [*] Replace ternary `if` expression with `or` operator | 21 | # FURB110 @@ -135,7 +145,7 @@ FURB110.py:23:5: FURB110 [*] Replace ternary `if` expression with `or` operator | = help: Replace with `or` operator -ℹ Safe fix +Suggested fix: 20 20 | 21 21 | # FURB110 22 22 | z = ( @@ -149,6 +159,8 @@ FURB110.py:23:5: FURB110 [*] Replace ternary `if` expression with `or` operator 28 28 | y 29 29 | ) + Run `ruff check --fix` to apply this fix. + FURB110.py:34:5: FURB110 [*] Replace ternary `if` expression with `or` operator | 32 | # FURB110 @@ -165,7 +177,7 @@ FURB110.py:34:5: FURB110 [*] Replace ternary `if` expression with `or` operator | = help: Replace with `or` operator -ℹ Safe fix +Suggested fix: 31 31 | 32 32 | # FURB110 33 33 | z = ( @@ -180,6 +192,8 @@ FURB110.py:34:5: FURB110 [*] Replace ternary `if` expression with `or` operator 41 36 | 42 37 | # FURB110 + Run `ruff check --fix` to apply this fix. + FURB110.py:44:5: FURB110 [*] Replace ternary `if` expression with `or` operator | 42 | # FURB110 @@ -195,7 +209,7 @@ FURB110.py:44:5: FURB110 [*] Replace ternary `if` expression with `or` operator | = help: Replace with `or` operator -ℹ Safe fix +Suggested fix: 41 41 | 42 42 | # FURB110 43 43 | z = ( @@ -207,3 +221,5 @@ FURB110.py:44:5: FURB110 [*] Replace ternary `if` expression with `or` operator 48 |- else None 46 |+ else None) 49 47 | ) + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap index 07e89d33ac934..3daf59f067d1f 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap @@ -11,7 +11,7 @@ FURB113.py:23:1: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal | = help: Replace with `nums.extend((1, 2))` -ℹ Unsafe fix +Suggested fix: 20 20 | 21 21 | 22 22 | # FURB113 @@ -22,6 +22,8 @@ FURB113.py:23:1: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal 26 25 | 27 26 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB113.py:29:1: FURB113 [*] Use `nums3.extend((1, 2))` instead of repeatedly calling `nums3.append()` | 28 | # FURB113 @@ -32,7 +34,7 @@ FURB113.py:29:1: FURB113 [*] Use `nums3.extend((1, 2))` instead of repeatedly ca | = help: Replace with `nums3.extend((1, 2))` -ℹ Unsafe fix +Suggested fix: 26 26 | 27 27 | 28 28 | # FURB113 @@ -43,6 +45,8 @@ FURB113.py:29:1: FURB113 [*] Use `nums3.extend((1, 2))` instead of repeatedly ca 32 31 | 33 32 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB113.py:35:1: FURB113 [*] Use `nums4.extend((1, 2))` instead of repeatedly calling `nums4.append()` | 34 | # FURB113 @@ -53,7 +57,7 @@ FURB113.py:35:1: FURB113 [*] Use `nums4.extend((1, 2))` instead of repeatedly ca | = help: Replace with `nums4.extend((1, 2))` -ℹ Unsafe fix +Suggested fix: 32 32 | 33 33 | 34 34 | # FURB113 @@ -64,6 +68,8 @@ FURB113.py:35:1: FURB113 [*] Use `nums4.extend((1, 2))` instead of repeatedly ca 38 37 | 39 38 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB113.py:41:1: FURB113 Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` | 40 | # FURB113 @@ -118,7 +124,7 @@ FURB113.py:56:1: FURB113 [*] Use `nums4.extend((1, 2))` instead of repeatedly ca | = help: Replace with `nums4.extend((1, 2))` -ℹ Unsafe fix +Suggested fix: 53 53 | nums3.append(1) 54 54 | nums.append(3) 55 55 | # FURB113 @@ -129,6 +135,8 @@ FURB113.py:56:1: FURB113 [*] Use `nums4.extend((1, 2))` instead of repeatedly ca 59 58 | pass 60 59 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB113.py:62:1: FURB113 [*] Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` | 61 | # FURB113 @@ -139,7 +147,7 @@ FURB113.py:62:1: FURB113 [*] Use `nums.extend((1, 2, 3))` instead of repeatedly | = help: Replace with `nums.extend((1, 2, 3))` -ℹ Unsafe fix +Suggested fix: 59 59 | pass 60 60 | 61 61 | # FURB113 @@ -151,6 +159,8 @@ FURB113.py:62:1: FURB113 [*] Use `nums.extend((1, 2, 3))` instead of repeatedly 66 64 | 67 65 | if True: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB113.py:69:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` | 67 | if True: @@ -162,7 +172,7 @@ FURB113.py:69:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal | = help: Replace with `nums.extend((1, 2))` -ℹ Unsafe fix +Suggested fix: 66 66 | 67 67 | if True: 68 68 | # FURB113 @@ -173,6 +183,8 @@ FURB113.py:69:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal 72 71 | 73 72 | if True: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB113.py:75:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` | 73 | if True: @@ -185,7 +197,7 @@ FURB113.py:75:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal | = help: Replace with `nums.extend((1, 2))` -ℹ Unsafe fix +Suggested fix: 72 72 | 73 73 | if True: 74 74 | # FURB113 @@ -196,6 +208,8 @@ FURB113.py:75:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal 78 77 | 79 78 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB113.py:82:5: FURB113 Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` | 80 | if True: @@ -220,7 +234,7 @@ FURB113.py:90:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly callin | = help: Replace with `x.extend((1, 2))` -ℹ Unsafe fix +Suggested fix: 87 87 | 88 88 | def yes_one(x: list[int]): 89 89 | # FURB113 @@ -231,6 +245,8 @@ FURB113.py:90:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly callin 93 92 | 94 93 | def yes_two(x: List[int]): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB113.py:96:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` | 94 | def yes_two(x: List[int]): @@ -242,7 +258,7 @@ FURB113.py:96:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly callin | = help: Replace with `x.extend((1, 2))` -ℹ Unsafe fix +Suggested fix: 93 93 | 94 94 | def yes_two(x: List[int]): 95 95 | # FURB113 @@ -253,6 +269,8 @@ FURB113.py:96:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly callin 99 98 | 100 99 | def yes_three(*, x: list[int]): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB113.py:102:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` | 100 | def yes_three(*, x: list[int]): @@ -264,7 +282,7 @@ FURB113.py:102:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli | = help: Replace with `x.extend((1, 2))` -ℹ Unsafe fix +Suggested fix: 99 99 | 100 100 | def yes_three(*, x: list[int]): 101 101 | # FURB113 @@ -275,6 +293,8 @@ FURB113.py:102:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli 105 104 | 106 105 | def yes_four(x: list[int], /): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB113.py:108:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` | 106 | def yes_four(x: list[int], /): @@ -286,7 +306,7 @@ FURB113.py:108:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli | = help: Replace with `x.extend((1, 2))` -ℹ Unsafe fix +Suggested fix: 105 105 | 106 106 | def yes_four(x: list[int], /): 107 107 | # FURB113 @@ -297,6 +317,8 @@ FURB113.py:108:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli 111 110 | 112 111 | def yes_five(x: list[int], y: list[int]): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB113.py:114:5: FURB113 Use `x.extend((1, 2, 3))` instead of repeatedly calling `x.append()` | 112 | def yes_five(x: list[int], y: list[int]): @@ -321,7 +343,7 @@ FURB113.py:122:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli | = help: Replace with `x.extend((1, 2))` -ℹ Unsafe fix +Suggested fix: 119 119 | 120 120 | def yes_six(x: list): 121 121 | # FURB113 @@ -332,6 +354,8 @@ FURB113.py:122:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli 125 124 | 126 125 | if True: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB113.py:128:5: FURB113 Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` | 126 | if True: @@ -345,5 +369,3 @@ FURB113.py:128:5: FURB113 Use `nums.extend((1, 2, 3))` instead of repeatedly cal | |__________________^ FURB113 | = help: Replace with `nums.extend((1, 2, 3))` - - diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap index 02e102a7ba6fb..7b34765563586 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap @@ -12,7 +12,7 @@ FURB116.py:6:7: FURB116 [*] Replace `oct` call with `f"{num:o}"` | = help: Replace with `f"{num:o}"` -ℹ Safe fix +Suggested fix: 3 3 | def return_num() -> int: 4 4 | return num 5 5 | @@ -22,6 +22,8 @@ FURB116.py:6:7: FURB116 [*] Replace `oct` call with `f"{num:o}"` 8 8 | print(bin(num)[2:]) # FURB116 9 9 | + Run `ruff check --fix` to apply this fix. + FURB116.py:7:7: FURB116 [*] Replace `hex` call with `f"{num:x}"` | 6 | print(oct(num)[2:]) # FURB116 @@ -31,7 +33,7 @@ FURB116.py:7:7: FURB116 [*] Replace `hex` call with `f"{num:x}"` | = help: Replace with `f"{num:x}"` -ℹ Safe fix +Suggested fix: 4 4 | return num 5 5 | 6 6 | print(oct(num)[2:]) # FURB116 @@ -41,6 +43,8 @@ FURB116.py:7:7: FURB116 [*] Replace `hex` call with `f"{num:x}"` 9 9 | 10 10 | print(oct(1337)[2:]) # FURB116 + Run `ruff check --fix` to apply this fix. + FURB116.py:8:7: FURB116 [*] Replace `bin` call with `f"{num:b}"` | 6 | print(oct(num)[2:]) # FURB116 @@ -52,7 +56,7 @@ FURB116.py:8:7: FURB116 [*] Replace `bin` call with `f"{num:b}"` | = help: Replace with `f"{num:b}"` -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | print(oct(num)[2:]) # FURB116 7 7 | print(hex(num)[2:]) # FURB116 @@ -62,6 +66,8 @@ FURB116.py:8:7: FURB116 [*] Replace `bin` call with `f"{num:b}"` 10 10 | print(oct(1337)[2:]) # FURB116 11 11 | print(hex(1337)[2:]) # FURB116 + Run `ruff check --fix` to apply this fix. + FURB116.py:10:7: FURB116 [*] Replace `oct` call with `f"{1337:o}"` | 8 | print(bin(num)[2:]) # FURB116 @@ -73,7 +79,7 @@ FURB116.py:10:7: FURB116 [*] Replace `oct` call with `f"{1337:o}"` | = help: Replace with `f"{1337:o}"` -ℹ Safe fix +Suggested fix: 7 7 | print(hex(num)[2:]) # FURB116 8 8 | print(bin(num)[2:]) # FURB116 9 9 | @@ -83,6 +89,8 @@ FURB116.py:10:7: FURB116 [*] Replace `oct` call with `f"{1337:o}"` 12 12 | print(bin(1337)[2:]) # FURB116 13 13 | + Run `ruff check --fix` to apply this fix. + FURB116.py:11:7: FURB116 [*] Replace `hex` call with `f"{1337:x}"` | 10 | print(oct(1337)[2:]) # FURB116 @@ -92,7 +100,7 @@ FURB116.py:11:7: FURB116 [*] Replace `hex` call with `f"{1337:x}"` | = help: Replace with `f"{1337:x}"` -ℹ Safe fix +Suggested fix: 8 8 | print(bin(num)[2:]) # FURB116 9 9 | 10 10 | print(oct(1337)[2:]) # FURB116 @@ -102,6 +110,8 @@ FURB116.py:11:7: FURB116 [*] Replace `hex` call with `f"{1337:x}"` 13 13 | 14 14 | print(bin(return_num())[2:]) # FURB116 (no autofix) + Run `ruff check --fix` to apply this fix. + FURB116.py:12:7: FURB116 [*] Replace `bin` call with `f"{1337:b}"` | 10 | print(oct(1337)[2:]) # FURB116 @@ -113,7 +123,7 @@ FURB116.py:12:7: FURB116 [*] Replace `bin` call with `f"{1337:b}"` | = help: Replace with `f"{1337:b}"` -ℹ Safe fix +Suggested fix: 9 9 | 10 10 | print(oct(1337)[2:]) # FURB116 11 11 | print(hex(1337)[2:]) # FURB116 @@ -123,6 +133,8 @@ FURB116.py:12:7: FURB116 [*] Replace `bin` call with `f"{1337:b}"` 14 14 | print(bin(return_num())[2:]) # FURB116 (no autofix) 15 15 | print(bin(int(f"{num}"))[2:]) # FURB116 (no autofix) + Run `ruff check --fix` to apply this fix. + FURB116.py:14:7: FURB116 Replace `bin` call with f-string | 12 | print(bin(1337)[2:]) # FURB116 diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap index fdfe0dbfbe818..2461c99aa5a4d 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap @@ -11,7 +11,7 @@ FURB118.py:2:13: FURB118 [*] Use `operator.invert` instead of defining a lambda | = help: Replace with `operator.invert` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |-op_bitnot = lambda x: ~x 2 |+import operator @@ -20,6 +20,8 @@ FURB118.py:2:13: FURB118 [*] Use `operator.invert` instead of defining a lambda 4 5 | op_pos = lambda x: +x 5 6 | op_neg = lambda x: -x + Run `ruff check --fix` to apply this fix. + FURB118.py:3:10: FURB118 [*] Use `operator.not_` instead of defining a lambda | 1 | # Errors. @@ -31,7 +33,7 @@ FURB118.py:3:10: FURB118 [*] Use `operator.not_` instead of defining a lambda | = help: Replace with `operator.not_` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -41,6 +43,8 @@ FURB118.py:3:10: FURB118 [*] Use `operator.not_` instead of defining a lambda 5 6 | op_neg = lambda x: -x 6 7 | + Run `ruff check --fix` to apply this fix. + FURB118.py:4:10: FURB118 [*] Use `operator.pos` instead of defining a lambda | 2 | op_bitnot = lambda x: ~x @@ -51,7 +55,7 @@ FURB118.py:4:10: FURB118 [*] Use `operator.pos` instead of defining a lambda | = help: Replace with `operator.pos` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -62,6 +66,8 @@ FURB118.py:4:10: FURB118 [*] Use `operator.pos` instead of defining a lambda 6 7 | 7 8 | op_add = lambda x, y: x + y + Run `ruff check --fix` to apply this fix. + FURB118.py:5:10: FURB118 [*] Use `operator.neg` instead of defining a lambda | 3 | op_not = lambda x: not x @@ -73,7 +79,7 @@ FURB118.py:5:10: FURB118 [*] Use `operator.neg` instead of defining a lambda | = help: Replace with `operator.neg` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -85,6 +91,8 @@ FURB118.py:5:10: FURB118 [*] Use `operator.neg` instead of defining a lambda 7 8 | op_add = lambda x, y: x + y 8 9 | op_sub = lambda x, y: x - y + Run `ruff check --fix` to apply this fix. + FURB118.py:7:10: FURB118 [*] Use `operator.add` instead of defining a lambda | 5 | op_neg = lambda x: -x @@ -96,7 +104,7 @@ FURB118.py:7:10: FURB118 [*] Use `operator.add` instead of defining a lambda | = help: Replace with `operator.add` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -110,6 +118,8 @@ FURB118.py:7:10: FURB118 [*] Use `operator.add` instead of defining a lambda 9 10 | op_mult = lambda x, y: x * y 10 11 | op_matmutl = lambda x, y: x @ y + Run `ruff check --fix` to apply this fix. + FURB118.py:8:10: FURB118 [*] Use `operator.sub` instead of defining a lambda | 7 | op_add = lambda x, y: x + y @@ -120,7 +130,7 @@ FURB118.py:8:10: FURB118 [*] Use `operator.sub` instead of defining a lambda | = help: Replace with `operator.sub` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -135,6 +145,8 @@ FURB118.py:8:10: FURB118 [*] Use `operator.sub` instead of defining a lambda 10 11 | op_matmutl = lambda x, y: x @ y 11 12 | op_truediv = lambda x, y: x / y + Run `ruff check --fix` to apply this fix. + FURB118.py:9:11: FURB118 [*] Use `operator.mul` instead of defining a lambda | 7 | op_add = lambda x, y: x + y @@ -146,7 +158,7 @@ FURB118.py:9:11: FURB118 [*] Use `operator.mul` instead of defining a lambda | = help: Replace with `operator.mul` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -162,6 +174,8 @@ FURB118.py:9:11: FURB118 [*] Use `operator.mul` instead of defining a lambda 11 12 | op_truediv = lambda x, y: x / y 12 13 | op_mod = lambda x, y: x % y + Run `ruff check --fix` to apply this fix. + FURB118.py:10:14: FURB118 [*] Use `operator.matmul` instead of defining a lambda | 8 | op_sub = lambda x, y: x - y @@ -173,7 +187,7 @@ FURB118.py:10:14: FURB118 [*] Use `operator.matmul` instead of defining a lambda | = help: Replace with `operator.matmul` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -189,6 +203,8 @@ FURB118.py:10:14: FURB118 [*] Use `operator.matmul` instead of defining a lambda 12 13 | op_mod = lambda x, y: x % y 13 14 | op_pow = lambda x, y: x ** y + Run `ruff check --fix` to apply this fix. + FURB118.py:11:14: FURB118 [*] Use `operator.truediv` instead of defining a lambda | 9 | op_mult = lambda x, y: x * y @@ -200,7 +216,7 @@ FURB118.py:11:14: FURB118 [*] Use `operator.truediv` instead of defining a lambd | = help: Replace with `operator.truediv` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -216,6 +232,8 @@ FURB118.py:11:14: FURB118 [*] Use `operator.truediv` instead of defining a lambd 13 14 | op_pow = lambda x, y: x ** y 14 15 | op_lshift = lambda x, y: x << y + Run `ruff check --fix` to apply this fix. + FURB118.py:12:10: FURB118 [*] Use `operator.mod` instead of defining a lambda | 10 | op_matmutl = lambda x, y: x @ y @@ -227,7 +245,7 @@ FURB118.py:12:10: FURB118 [*] Use `operator.mod` instead of defining a lambda | = help: Replace with `operator.mod` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -243,6 +261,8 @@ FURB118.py:12:10: FURB118 [*] Use `operator.mod` instead of defining a lambda 14 15 | op_lshift = lambda x, y: x << y 15 16 | op_rshift = lambda x, y: x >> y + Run `ruff check --fix` to apply this fix. + FURB118.py:13:10: FURB118 [*] Use `operator.pow` instead of defining a lambda | 11 | op_truediv = lambda x, y: x / y @@ -254,7 +274,7 @@ FURB118.py:13:10: FURB118 [*] Use `operator.pow` instead of defining a lambda | = help: Replace with `operator.pow` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -270,6 +290,8 @@ FURB118.py:13:10: FURB118 [*] Use `operator.pow` instead of defining a lambda 15 16 | op_rshift = lambda x, y: x >> y 16 17 | op_bitor = lambda x, y: x | y + Run `ruff check --fix` to apply this fix. + FURB118.py:14:13: FURB118 [*] Use `operator.lshift` instead of defining a lambda | 12 | op_mod = lambda x, y: x % y @@ -281,7 +303,7 @@ FURB118.py:14:13: FURB118 [*] Use `operator.lshift` instead of defining a lambda | = help: Replace with `operator.lshift` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -297,6 +319,8 @@ FURB118.py:14:13: FURB118 [*] Use `operator.lshift` instead of defining a lambda 16 17 | op_bitor = lambda x, y: x | y 17 18 | op_xor = lambda x, y: x ^ y + Run `ruff check --fix` to apply this fix. + FURB118.py:15:13: FURB118 [*] Use `operator.rshift` instead of defining a lambda | 13 | op_pow = lambda x, y: x ** y @@ -308,7 +332,7 @@ FURB118.py:15:13: FURB118 [*] Use `operator.rshift` instead of defining a lambda | = help: Replace with `operator.rshift` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -324,6 +348,8 @@ FURB118.py:15:13: FURB118 [*] Use `operator.rshift` instead of defining a lambda 17 18 | op_xor = lambda x, y: x ^ y 18 19 | op_bitand = lambda x, y: x & y + Run `ruff check --fix` to apply this fix. + FURB118.py:16:12: FURB118 [*] Use `operator.or_` instead of defining a lambda | 14 | op_lshift = lambda x, y: x << y @@ -335,7 +361,7 @@ FURB118.py:16:12: FURB118 [*] Use `operator.or_` instead of defining a lambda | = help: Replace with `operator.or_` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -351,6 +377,8 @@ FURB118.py:16:12: FURB118 [*] Use `operator.or_` instead of defining a lambda 18 19 | op_bitand = lambda x, y: x & y 19 20 | op_floordiv = lambda x, y: x // y + Run `ruff check --fix` to apply this fix. + FURB118.py:17:10: FURB118 [*] Use `operator.xor` instead of defining a lambda | 15 | op_rshift = lambda x, y: x >> y @@ -362,7 +390,7 @@ FURB118.py:17:10: FURB118 [*] Use `operator.xor` instead of defining a lambda | = help: Replace with `operator.xor` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -378,6 +406,8 @@ FURB118.py:17:10: FURB118 [*] Use `operator.xor` instead of defining a lambda 19 20 | op_floordiv = lambda x, y: x // y 20 21 | + Run `ruff check --fix` to apply this fix. + FURB118.py:18:13: FURB118 [*] Use `operator.and_` instead of defining a lambda | 16 | op_bitor = lambda x, y: x | y @@ -388,7 +418,7 @@ FURB118.py:18:13: FURB118 [*] Use `operator.and_` instead of defining a lambda | = help: Replace with `operator.and_` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -404,6 +434,8 @@ FURB118.py:18:13: FURB118 [*] Use `operator.and_` instead of defining a lambda 20 21 | 21 22 | op_eq = lambda x, y: x == y + Run `ruff check --fix` to apply this fix. + FURB118.py:19:15: FURB118 [*] Use `operator.floordiv` instead of defining a lambda | 17 | op_xor = lambda x, y: x ^ y @@ -415,7 +447,7 @@ FURB118.py:19:15: FURB118 [*] Use `operator.floordiv` instead of defining a lamb | = help: Replace with `operator.floordiv` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -431,6 +463,8 @@ FURB118.py:19:15: FURB118 [*] Use `operator.floordiv` instead of defining a lamb 21 22 | op_eq = lambda x, y: x == y 22 23 | op_ne = lambda x, y: x != y + Run `ruff check --fix` to apply this fix. + FURB118.py:21:9: FURB118 [*] Use `operator.eq` instead of defining a lambda | 19 | op_floordiv = lambda x, y: x // y @@ -442,7 +476,7 @@ FURB118.py:21:9: FURB118 [*] Use `operator.eq` instead of defining a lambda | = help: Replace with `operator.eq` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -458,6 +492,8 @@ FURB118.py:21:9: FURB118 [*] Use `operator.eq` instead of defining a lambda 23 24 | op_lt = lambda x, y: x < y 24 25 | op_lte = lambda x, y: x <= y + Run `ruff check --fix` to apply this fix. + FURB118.py:22:9: FURB118 [*] Use `operator.ne` instead of defining a lambda | 21 | op_eq = lambda x, y: x == y @@ -468,7 +504,7 @@ FURB118.py:22:9: FURB118 [*] Use `operator.ne` instead of defining a lambda | = help: Replace with `operator.ne` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -484,6 +520,8 @@ FURB118.py:22:9: FURB118 [*] Use `operator.ne` instead of defining a lambda 24 25 | op_lte = lambda x, y: x <= y 25 26 | op_gt = lambda x, y: x > y + Run `ruff check --fix` to apply this fix. + FURB118.py:23:9: FURB118 [*] Use `operator.lt` instead of defining a lambda | 21 | op_eq = lambda x, y: x == y @@ -495,7 +533,7 @@ FURB118.py:23:9: FURB118 [*] Use `operator.lt` instead of defining a lambda | = help: Replace with `operator.lt` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -511,6 +549,8 @@ FURB118.py:23:9: FURB118 [*] Use `operator.lt` instead of defining a lambda 25 26 | op_gt = lambda x, y: x > y 26 27 | op_gte = lambda x, y: x >= y + Run `ruff check --fix` to apply this fix. + FURB118.py:24:10: FURB118 [*] Use `operator.le` instead of defining a lambda | 22 | op_ne = lambda x, y: x != y @@ -522,7 +562,7 @@ FURB118.py:24:10: FURB118 [*] Use `operator.le` instead of defining a lambda | = help: Replace with `operator.le` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -538,6 +578,8 @@ FURB118.py:24:10: FURB118 [*] Use `operator.le` instead of defining a lambda 26 27 | op_gte = lambda x, y: x >= y 27 28 | op_is = lambda x, y: x is y + Run `ruff check --fix` to apply this fix. + FURB118.py:25:9: FURB118 [*] Use `operator.gt` instead of defining a lambda | 23 | op_lt = lambda x, y: x < y @@ -549,7 +591,7 @@ FURB118.py:25:9: FURB118 [*] Use `operator.gt` instead of defining a lambda | = help: Replace with `operator.gt` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -565,6 +607,8 @@ FURB118.py:25:9: FURB118 [*] Use `operator.gt` instead of defining a lambda 27 28 | op_is = lambda x, y: x is y 28 29 | op_isnot = lambda x, y: x is not y + Run `ruff check --fix` to apply this fix. + FURB118.py:26:10: FURB118 [*] Use `operator.ge` instead of defining a lambda | 24 | op_lte = lambda x, y: x <= y @@ -576,7 +620,7 @@ FURB118.py:26:10: FURB118 [*] Use `operator.ge` instead of defining a lambda | = help: Replace with `operator.ge` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -592,6 +636,8 @@ FURB118.py:26:10: FURB118 [*] Use `operator.ge` instead of defining a lambda 28 29 | op_isnot = lambda x, y: x is not y 29 30 | op_in = lambda x, y: y in x + Run `ruff check --fix` to apply this fix. + FURB118.py:27:9: FURB118 [*] Use `operator.is_` instead of defining a lambda | 25 | op_gt = lambda x, y: x > y @@ -603,7 +649,7 @@ FURB118.py:27:9: FURB118 [*] Use `operator.is_` instead of defining a lambda | = help: Replace with `operator.is_` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -619,6 +665,8 @@ FURB118.py:27:9: FURB118 [*] Use `operator.is_` instead of defining a lambda 29 30 | op_in = lambda x, y: y in x 30 31 | op_itemgetter = lambda x: x[0] + Run `ruff check --fix` to apply this fix. + FURB118.py:28:12: FURB118 [*] Use `operator.is_not` instead of defining a lambda | 26 | op_gte = lambda x, y: x >= y @@ -630,7 +678,7 @@ FURB118.py:28:12: FURB118 [*] Use `operator.is_not` instead of defining a lambda | = help: Replace with `operator.is_not` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -646,6 +694,8 @@ FURB118.py:28:12: FURB118 [*] Use `operator.is_not` instead of defining a lambda 30 31 | op_itemgetter = lambda x: x[0] 31 32 | op_itemgetter = lambda x: (x[0], x[1], x[2]) + Run `ruff check --fix` to apply this fix. + FURB118.py:29:9: FURB118 [*] Use `operator.contains` instead of defining a lambda | 27 | op_is = lambda x, y: x is y @@ -657,7 +707,7 @@ FURB118.py:29:9: FURB118 [*] Use `operator.contains` instead of defining a lambd | = help: Replace with `operator.contains` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -673,6 +723,8 @@ FURB118.py:29:9: FURB118 [*] Use `operator.contains` instead of defining a lambd 31 32 | op_itemgetter = lambda x: (x[0], x[1], x[2]) 32 33 | op_itemgetter = lambda x: (x[1:], x[2]) + Run `ruff check --fix` to apply this fix. + FURB118.py:30:17: FURB118 [*] Use `operator.itemgetter(0)` instead of defining a lambda | 28 | op_isnot = lambda x, y: x is not y @@ -684,7 +736,7 @@ FURB118.py:30:17: FURB118 [*] Use `operator.itemgetter(0)` instead of defining a | = help: Replace with `operator.itemgetter(0)` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -700,6 +752,8 @@ FURB118.py:30:17: FURB118 [*] Use `operator.itemgetter(0)` instead of defining a 32 33 | op_itemgetter = lambda x: (x[1:], x[2]) 33 34 | op_itemgetter = lambda x: x[:] + Run `ruff check --fix` to apply this fix. + FURB118.py:31:17: FURB118 [*] Use `operator.itemgetter(0, 1, 2)` instead of defining a lambda | 29 | op_in = lambda x, y: y in x @@ -711,7 +765,7 @@ FURB118.py:31:17: FURB118 [*] Use `operator.itemgetter(0, 1, 2)` instead of defi | = help: Replace with `operator.itemgetter(0, 1, 2)` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -727,6 +781,8 @@ FURB118.py:31:17: FURB118 [*] Use `operator.itemgetter(0, 1, 2)` instead of defi 33 34 | op_itemgetter = lambda x: x[:] 34 35 | op_itemgetter = lambda x: x[0, 1] + Run `ruff check --fix` to apply this fix. + FURB118.py:32:17: FURB118 [*] Use `operator.itemgetter(slice(1, None), 2)` instead of defining a lambda | 30 | op_itemgetter = lambda x: x[0] @@ -738,7 +794,7 @@ FURB118.py:32:17: FURB118 [*] Use `operator.itemgetter(slice(1, None), 2)` inste | = help: Replace with `operator.itemgetter(slice(1, None), 2)` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -754,6 +810,8 @@ FURB118.py:32:17: FURB118 [*] Use `operator.itemgetter(slice(1, None), 2)` inste 34 35 | op_itemgetter = lambda x: x[0, 1] 35 36 | op_itemgetter = lambda x: x[(0, 1)] + Run `ruff check --fix` to apply this fix. + FURB118.py:33:17: FURB118 [*] Use `operator.itemgetter(slice(None))` instead of defining a lambda | 31 | op_itemgetter = lambda x: (x[0], x[1], x[2]) @@ -765,7 +823,7 @@ FURB118.py:33:17: FURB118 [*] Use `operator.itemgetter(slice(None))` instead of | = help: Replace with `operator.itemgetter(slice(None))` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -781,6 +839,8 @@ FURB118.py:33:17: FURB118 [*] Use `operator.itemgetter(slice(None))` instead of 35 36 | op_itemgetter = lambda x: x[(0, 1)] 36 37 | + Run `ruff check --fix` to apply this fix. + FURB118.py:34:17: FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defining a lambda | 32 | op_itemgetter = lambda x: (x[1:], x[2]) @@ -791,7 +851,7 @@ FURB118.py:34:17: FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defin | = help: Replace with `operator.itemgetter((0, 1))` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -807,6 +867,8 @@ FURB118.py:34:17: FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defin 36 37 | 37 38 | + Run `ruff check --fix` to apply this fix. + FURB118.py:35:17: FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defining a lambda | 33 | op_itemgetter = lambda x: x[:] @@ -816,7 +878,7 @@ FURB118.py:35:17: FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defin | = help: Replace with `operator.itemgetter((0, 1))` -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -832,6 +894,8 @@ FURB118.py:35:17: FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defin 37 38 | 38 39 | def op_not2(x): + Run `ruff check --fix` to apply this fix. + FURB118.py:38:5: FURB118 Use `operator.not_` instead of defining a function | 38 | def op_not2(x): diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap index 655f8d69591d4..ca7eb052a0a45 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap @@ -12,7 +12,7 @@ FURB129.py:7:18: FURB129 [*] Instead of calling `readlines()`, iterate over file | = help: Remove `readlines()` -ℹ Unsafe fix +Suggested fix: 4 4 | 5 5 | # Errors 6 6 | with open("FURB129.py") as f: @@ -22,6 +22,8 @@ FURB129.py:7:18: FURB129 [*] Instead of calling `readlines()`, iterate over file 9 9 | a = [line.lower() for line in f.readlines()] 10 10 | b = {line.upper() for line in f.readlines()} + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB129.py:9:35: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | 7 | for _line in f.readlines(): @@ -33,7 +35,7 @@ FURB129.py:9:35: FURB129 [*] Instead of calling `readlines()`, iterate over file | = help: Remove `readlines()` -ℹ Unsafe fix +Suggested fix: 6 6 | with open("FURB129.py") as f: 7 7 | for _line in f.readlines(): 8 8 | pass @@ -43,6 +45,8 @@ FURB129.py:9:35: FURB129 [*] Instead of calling `readlines()`, iterate over file 11 11 | c = {line.lower(): line.upper() for line in f.readlines()} 12 12 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB129.py:10:35: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | 8 | pass @@ -53,7 +57,7 @@ FURB129.py:10:35: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -ℹ Unsafe fix +Suggested fix: 7 7 | for _line in f.readlines(): 8 8 | pass 9 9 | a = [line.lower() for line in f.readlines()] @@ -63,6 +67,8 @@ FURB129.py:10:35: FURB129 [*] Instead of calling `readlines()`, iterate over fil 12 12 | 13 13 | with Path("FURB129.py").open() as f: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB129.py:11:49: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | 9 | a = [line.lower() for line in f.readlines()] @@ -74,7 +80,7 @@ FURB129.py:11:49: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -ℹ Unsafe fix +Suggested fix: 8 8 | pass 9 9 | a = [line.lower() for line in f.readlines()] 10 10 | b = {line.upper() for line in f.readlines()} @@ -84,6 +90,8 @@ FURB129.py:11:49: FURB129 [*] Instead of calling `readlines()`, iterate over fil 13 13 | with Path("FURB129.py").open() as f: 14 14 | for _line in f.readlines(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB129.py:14:18: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | 13 | with Path("FURB129.py").open() as f: @@ -93,7 +101,7 @@ FURB129.py:14:18: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -ℹ Unsafe fix +Suggested fix: 11 11 | c = {line.lower(): line.upper() for line in f.readlines()} 12 12 | 13 13 | with Path("FURB129.py").open() as f: @@ -103,6 +111,8 @@ FURB129.py:14:18: FURB129 [*] Instead of calling `readlines()`, iterate over fil 16 16 | 17 17 | for _line in open("FURB129.py").readlines(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB129.py:17:14: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | 15 | pass @@ -113,7 +123,7 @@ FURB129.py:17:14: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -ℹ Unsafe fix +Suggested fix: 14 14 | for _line in f.readlines(): 15 15 | pass 16 16 | @@ -123,6 +133,8 @@ FURB129.py:17:14: FURB129 [*] Instead of calling `readlines()`, iterate over fil 19 19 | 20 20 | for _line in Path("FURB129.py").open().readlines(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB129.py:20:14: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | 18 | pass @@ -133,7 +145,7 @@ FURB129.py:20:14: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -ℹ Unsafe fix +Suggested fix: 17 17 | for _line in open("FURB129.py").readlines(): 18 18 | pass 19 19 | @@ -143,6 +155,8 @@ FURB129.py:20:14: FURB129 [*] Instead of calling `readlines()`, iterate over fil 22 22 | 23 23 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB129.py:26:18: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | 24 | def func(): @@ -154,7 +168,7 @@ FURB129.py:26:18: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -ℹ Unsafe fix +Suggested fix: 23 23 | 24 24 | def func(): 25 25 | f = Path("FURB129.py").open() @@ -164,6 +178,8 @@ FURB129.py:26:18: FURB129 [*] Instead of calling `readlines()`, iterate over fil 28 28 | f.close() 29 29 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB129.py:32:18: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | 31 | def func(f: io.BytesIO): @@ -173,7 +189,7 @@ FURB129.py:32:18: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -ℹ Unsafe fix +Suggested fix: 29 29 | 30 30 | 31 31 | def func(f: io.BytesIO): @@ -183,6 +199,8 @@ FURB129.py:32:18: FURB129 [*] Instead of calling `readlines()`, iterate over fil 34 34 | 35 35 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB129.py:38:22: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | 36 | def func(): @@ -194,7 +212,7 @@ FURB129.py:38:22: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -ℹ Unsafe fix +Suggested fix: 35 35 | 36 36 | def func(): 37 37 | with (open("FURB129.py") as f, foo as bar): @@ -204,6 +222,8 @@ FURB129.py:38:22: FURB129 [*] Instead of calling `readlines()`, iterate over fil 40 40 | for _line in bar.readlines(): 41 41 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB129.py:48:17: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | 47 | with builtins.open("FURB129.py") as f: @@ -213,7 +233,7 @@ FURB129.py:48:17: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -ℹ Unsafe fix +Suggested fix: 45 45 | 46 46 | 47 47 | with builtins.open("FURB129.py") as f: @@ -223,6 +243,8 @@ FURB129.py:48:17: FURB129 [*] Instead of calling `readlines()`, iterate over fil 50 50 | 51 51 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB129.py:56:17: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | 55 | with o("FURB129.py") as f: @@ -232,7 +254,7 @@ FURB129.py:56:17: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -ℹ Unsafe fix +Suggested fix: 53 53 | 54 54 | 55 55 | with o("FURB129.py") as f: @@ -240,4 +262,6 @@ FURB129.py:56:17: FURB129 [*] Instead of calling `readlines()`, iterate over fil 56 |+ for line in f: 57 57 | pass 58 58 | -59 59 | +59 59 | + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap index fcd3ecd84eb12..d4e561f000ef1 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap @@ -9,7 +9,7 @@ FURB131.py:11:1: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -ℹ Unsafe fix +Suggested fix: 8 8 | # these should match 9 9 | 10 10 | # FURB131 @@ -19,6 +19,8 @@ FURB131.py:11:1: FURB131 [*] Prefer `clear` over deleting a full slice 13 13 | 14 14 | # FURB131 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB131.py:15:1: FURB131 [*] Prefer `clear` over deleting a full slice | 14 | # FURB131 @@ -27,7 +29,7 @@ FURB131.py:15:1: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -ℹ Unsafe fix +Suggested fix: 12 12 | 13 13 | 14 14 | # FURB131 @@ -37,6 +39,8 @@ FURB131.py:15:1: FURB131 [*] Prefer `clear` over deleting a full slice 17 17 | 18 18 | # FURB131 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB131.py:19:1: FURB131 Prefer `clear` over deleting a full slice | 18 | # FURB131 @@ -62,7 +66,7 @@ FURB131.py:28:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -ℹ Unsafe fix +Suggested fix: 25 25 | 26 26 | def yes_one(x: list[int]): 27 27 | # FURB131 @@ -72,6 +76,8 @@ FURB131.py:28:5: FURB131 [*] Prefer `clear` over deleting a full slice 30 30 | 31 31 | def yes_two(x: dict[int, str]): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB131.py:33:5: FURB131 [*] Prefer `clear` over deleting a full slice | 31 | def yes_two(x: dict[int, str]): @@ -81,7 +87,7 @@ FURB131.py:33:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -ℹ Unsafe fix +Suggested fix: 30 30 | 31 31 | def yes_two(x: dict[int, str]): 32 32 | # FURB131 @@ -91,6 +97,8 @@ FURB131.py:33:5: FURB131 [*] Prefer `clear` over deleting a full slice 35 35 | 36 36 | def yes_three(x: List[int]): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB131.py:38:5: FURB131 [*] Prefer `clear` over deleting a full slice | 36 | def yes_three(x: List[int]): @@ -100,7 +108,7 @@ FURB131.py:38:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -ℹ Unsafe fix +Suggested fix: 35 35 | 36 36 | def yes_three(x: List[int]): 37 37 | # FURB131 @@ -110,6 +118,8 @@ FURB131.py:38:5: FURB131 [*] Prefer `clear` over deleting a full slice 40 40 | 41 41 | def yes_four(x: Dict[int, str]): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB131.py:43:5: FURB131 [*] Prefer `clear` over deleting a full slice | 41 | def yes_four(x: Dict[int, str]): @@ -119,7 +129,7 @@ FURB131.py:43:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -ℹ Unsafe fix +Suggested fix: 40 40 | 41 41 | def yes_four(x: Dict[int, str]): 42 42 | # FURB131 @@ -129,6 +139,8 @@ FURB131.py:43:5: FURB131 [*] Prefer `clear` over deleting a full slice 45 45 | 46 46 | def yes_five(x: Dict[int, str]): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB131.py:48:5: FURB131 [*] Prefer `clear` over deleting a full slice | 46 | def yes_five(x: Dict[int, str]): @@ -140,7 +152,7 @@ FURB131.py:48:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -ℹ Unsafe fix +Suggested fix: 45 45 | 46 46 | def yes_five(x: Dict[int, str]): 47 47 | # FURB131 @@ -150,6 +162,8 @@ FURB131.py:48:5: FURB131 [*] Prefer `clear` over deleting a full slice 50 50 | x = 1 51 51 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB131.py:58:1: FURB131 [*] Prefer `clear` over deleting a full slice | 56 | sneaky = SneakyList() @@ -161,7 +175,7 @@ FURB131.py:58:1: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -ℹ Unsafe fix +Suggested fix: 55 55 | 56 56 | sneaky = SneakyList() 57 57 | # FURB131 @@ -169,4 +183,6 @@ FURB131.py:58:1: FURB131 [*] Prefer `clear` over deleting a full slice 58 |+sneaky.clear() 59 59 | 60 60 | # these should not -61 61 | +61 61 | + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap index ac600b20be6ae..3758da982faed 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap @@ -10,7 +10,7 @@ FURB132.py:12:1: FURB132 [*] Use `s.discard("x")` instead of check and `remove` | = help: Replace with `s.discard("x")` -ℹ Unsafe fix +Suggested fix: 9 9 | # these should match 10 10 | 11 11 | # FURB132 @@ -21,6 +21,8 @@ FURB132.py:12:1: FURB132 [*] Use `s.discard("x")` instead of check and `remove` 15 14 | 16 15 | # FURB132 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB132.py:22:1: FURB132 [*] Use `s3.discard("x")` instead of check and `remove` | 21 | # FURB132 @@ -30,7 +32,7 @@ FURB132.py:22:1: FURB132 [*] Use `s3.discard("x")` instead of check and `remove` | = help: Replace with `s3.discard("x")` -ℹ Unsafe fix +Suggested fix: 19 19 | 20 20 | 21 21 | # FURB132 @@ -41,6 +43,8 @@ FURB132.py:22:1: FURB132 [*] Use `s3.discard("x")` instead of check and `remove` 25 24 | 26 25 | var = "y" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB132.py:28:1: FURB132 [*] Use `s.discard(var)` instead of check and `remove` | 26 | var = "y" @@ -51,7 +55,7 @@ FURB132.py:28:1: FURB132 [*] Use `s.discard(var)` instead of check and `remove` | = help: Replace with `s.discard(var)` -ℹ Unsafe fix +Suggested fix: 25 25 | 26 26 | var = "y" 27 27 | # FURB132 @@ -62,6 +66,8 @@ FURB132.py:28:1: FURB132 [*] Use `s.discard(var)` instead of check and `remove` 31 30 | 32 31 | if f"{var}:{var}" in s: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB132.py:32:1: FURB132 [*] Use `s.discard(f"{var}:{var}")` instead of check and `remove` | 32 | / if f"{var}:{var}" in s: @@ -70,7 +76,7 @@ FURB132.py:32:1: FURB132 [*] Use `s.discard(f"{var}:{var}")` instead of check an | = help: Replace with `s.discard(f"{var}:{var}")` -ℹ Unsafe fix +Suggested fix: 29 29 | s.remove(var) 30 30 | 31 31 | @@ -81,4 +87,4 @@ FURB132.py:32:1: FURB132 [*] Use `s.discard(f"{var}:{var}")` instead of check an 35 34 | 36 35 | def identity(x): - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap index bf698bafbfe3f..36ebf9678738f 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap @@ -12,7 +12,7 @@ FURB136.py:4:1: FURB136 [*] Replace `x if x > y else y` with `max(y, x)` | = help: Replace with `max(y, x)` -ℹ Safe fix +Suggested fix: 1 1 | x = 1 2 2 | y = 2 3 3 | @@ -22,6 +22,8 @@ FURB136.py:4:1: FURB136 [*] Replace `x if x > y else y` with `max(y, x)` 6 6 | x if x >= y else y # FURB136 7 7 | + Run `ruff check --fix` to apply this fix. + FURB136.py:6:1: FURB136 [*] Replace `x if x >= y else y` with `max(x, y)` | 4 | x if x > y else y # FURB136 @@ -33,7 +35,7 @@ FURB136.py:6:1: FURB136 [*] Replace `x if x >= y else y` with `max(x, y)` | = help: Replace with `max(x, y)` -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | x if x > y else y # FURB136 5 5 | @@ -43,6 +45,8 @@ FURB136.py:6:1: FURB136 [*] Replace `x if x >= y else y` with `max(x, y)` 8 8 | x if x < y else y # FURB136 9 9 | + Run `ruff check --fix` to apply this fix. + FURB136.py:8:1: FURB136 [*] Replace `x if x < y else y` with `min(y, x)` | 6 | x if x >= y else y # FURB136 @@ -54,7 +58,7 @@ FURB136.py:8:1: FURB136 [*] Replace `x if x < y else y` with `min(y, x)` | = help: Replace with `min(y, x)` -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | x if x >= y else y # FURB136 7 7 | @@ -64,6 +68,8 @@ FURB136.py:8:1: FURB136 [*] Replace `x if x < y else y` with `min(y, x)` 10 10 | x if x <= y else y # FURB136 11 11 | + Run `ruff check --fix` to apply this fix. + FURB136.py:10:1: FURB136 [*] Replace `x if x <= y else y` with `min(x, y)` | 8 | x if x < y else y # FURB136 @@ -75,7 +81,7 @@ FURB136.py:10:1: FURB136 [*] Replace `x if x <= y else y` with `min(x, y)` | = help: Replace with `min(x, y)` -ℹ Safe fix +Suggested fix: 7 7 | 8 8 | x if x < y else y # FURB136 9 9 | @@ -85,6 +91,8 @@ FURB136.py:10:1: FURB136 [*] Replace `x if x <= y else y` with `min(x, y)` 12 12 | y if x > y else x # FURB136 13 13 | + Run `ruff check --fix` to apply this fix. + FURB136.py:12:1: FURB136 [*] Replace `y if x > y else x` with `min(x, y)` | 10 | x if x <= y else y # FURB136 @@ -96,7 +104,7 @@ FURB136.py:12:1: FURB136 [*] Replace `y if x > y else x` with `min(x, y)` | = help: Replace with `min(x, y)` -ℹ Safe fix +Suggested fix: 9 9 | 10 10 | x if x <= y else y # FURB136 11 11 | @@ -106,6 +114,8 @@ FURB136.py:12:1: FURB136 [*] Replace `y if x > y else x` with `min(x, y)` 14 14 | y if x >= y else x # FURB136 15 15 | + Run `ruff check --fix` to apply this fix. + FURB136.py:14:1: FURB136 [*] Replace `y if x >= y else x` with `min(y, x)` | 12 | y if x > y else x # FURB136 @@ -117,7 +127,7 @@ FURB136.py:14:1: FURB136 [*] Replace `y if x >= y else x` with `min(y, x)` | = help: Replace with `min(y, x)` -ℹ Safe fix +Suggested fix: 11 11 | 12 12 | y if x > y else x # FURB136 13 13 | @@ -127,6 +137,8 @@ FURB136.py:14:1: FURB136 [*] Replace `y if x >= y else x` with `min(y, x)` 16 16 | y if x < y else x # FURB136 17 17 | + Run `ruff check --fix` to apply this fix. + FURB136.py:16:1: FURB136 [*] Replace `y if x < y else x` with `max(x, y)` | 14 | y if x >= y else x # FURB136 @@ -138,7 +150,7 @@ FURB136.py:16:1: FURB136 [*] Replace `y if x < y else x` with `max(x, y)` | = help: Replace with `max(x, y)` -ℹ Safe fix +Suggested fix: 13 13 | 14 14 | y if x >= y else x # FURB136 15 15 | @@ -148,6 +160,8 @@ FURB136.py:16:1: FURB136 [*] Replace `y if x < y else x` with `max(x, y)` 18 18 | y if x <= y else x # FURB136 19 19 | + Run `ruff check --fix` to apply this fix. + FURB136.py:18:1: FURB136 [*] Replace `y if x <= y else x` with `max(y, x)` | 16 | y if x < y else x # FURB136 @@ -159,7 +173,7 @@ FURB136.py:18:1: FURB136 [*] Replace `y if x <= y else x` with `max(y, x)` | = help: Replace with `max(y, x)` -ℹ Safe fix +Suggested fix: 15 15 | 16 16 | y if x < y else x # FURB136 17 17 | @@ -169,6 +183,8 @@ FURB136.py:18:1: FURB136 [*] Replace `y if x <= y else x` with `max(y, x)` 20 20 | x + y if x > y else y # OK 21 21 | + Run `ruff check --fix` to apply this fix. + FURB136.py:22:1: FURB136 [*] Replace `if` expression with `max(y, x)` | 20 | x + y if x > y else y # OK @@ -181,7 +197,7 @@ FURB136.py:22:1: FURB136 [*] Replace `if` expression with `max(y, x)` | = help: Replace with `max(y, x)` -ℹ Safe fix +Suggested fix: 19 19 | 20 20 | x + y if x > y else y # OK 21 21 | @@ -191,4 +207,4 @@ FURB136.py:22:1: FURB136 [*] Replace `if` expression with `max(y, x)` 25 |-) else y # FURB136 22 |+max(y, x) # FURB136 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap index 5fc72a0bc02b2..09446e1bf5368 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap @@ -11,7 +11,7 @@ FURB140.py:7:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -ℹ Safe fix +Suggested fix: 1 |+from itertools import starmap 1 2 | def zipped(): 2 3 | return zip([1, 2, 3], "ABC") @@ -25,6 +25,8 @@ FURB140.py:7:1: FURB140 [*] Use `itertools.starmap` instead of the generator 9 10 | # FURB140 10 11 | (print(x, y) for x, y in zipped()) + Run `ruff check --fix` to apply this fix. + FURB140.py:10:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 9 | # FURB140 @@ -35,7 +37,7 @@ FURB140.py:10:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -ℹ Safe fix +Suggested fix: 1 |+from itertools import starmap 1 2 | def zipped(): 2 3 | return zip([1, 2, 3], "ABC") @@ -50,6 +52,8 @@ FURB140.py:10:1: FURB140 [*] Use `itertools.starmap` instead of the generator 12 13 | # FURB140 13 14 | {print(x, y) for x, y in zipped()} + Run `ruff check --fix` to apply this fix. + FURB140.py:13:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 12 | # FURB140 @@ -58,7 +62,7 @@ FURB140.py:13:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -ℹ Safe fix +Suggested fix: 1 |+from itertools import starmap 1 2 | def zipped(): 2 3 | return zip([1, 2, 3], "ABC") @@ -73,6 +77,8 @@ FURB140.py:13:1: FURB140 [*] Use `itertools.starmap` instead of the generator 15 16 | 16 17 | from itertools import starmap as sm + Run `ruff check --fix` to apply this fix. + FURB140.py:19:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 18 | # FURB140 @@ -83,7 +89,7 @@ FURB140.py:19:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -ℹ Safe fix +Suggested fix: 16 16 | from itertools import starmap as sm 17 17 | 18 18 | # FURB140 @@ -93,6 +99,8 @@ FURB140.py:19:1: FURB140 [*] Use `itertools.starmap` instead of the generator 21 21 | # FURB140 22 22 | (print(x, y) for x, y in zipped()) + Run `ruff check --fix` to apply this fix. + FURB140.py:22:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 21 | # FURB140 @@ -103,7 +111,7 @@ FURB140.py:22:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -ℹ Safe fix +Suggested fix: 19 19 | [print(x, y) for x, y in zipped()] 20 20 | 21 21 | # FURB140 @@ -113,6 +121,8 @@ FURB140.py:22:1: FURB140 [*] Use `itertools.starmap` instead of the generator 24 24 | # FURB140 25 25 | {print(x, y) for x, y in zipped()} + Run `ruff check --fix` to apply this fix. + FURB140.py:25:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 24 | # FURB140 @@ -123,7 +133,7 @@ FURB140.py:25:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -ℹ Safe fix +Suggested fix: 22 22 | (print(x, y) for x, y in zipped()) 23 23 | 24 24 | # FURB140 @@ -133,6 +143,8 @@ FURB140.py:25:1: FURB140 [*] Use `itertools.starmap` instead of the generator 27 27 | # FURB140 (check it still flags starred arguments). 28 28 | # See https://github.com/astral-sh/ruff/issues/7636 + Run `ruff check --fix` to apply this fix. + FURB140.py:29:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 27 | # FURB140 (check it still flags starred arguments). @@ -144,7 +156,7 @@ FURB140.py:29:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -ℹ Safe fix +Suggested fix: 26 26 | 27 27 | # FURB140 (check it still flags starred arguments). 28 28 | # See https://github.com/astral-sh/ruff/issues/7636 @@ -154,6 +166,8 @@ FURB140.py:29:1: FURB140 [*] Use `itertools.starmap` instead of the generator 31 31 | {foo(*t) for t in [(85, 60), (100, 80)]} 32 32 | + Run `ruff check --fix` to apply this fix. + FURB140.py:30:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 28 | # See https://github.com/astral-sh/ruff/issues/7636 @@ -164,7 +178,7 @@ FURB140.py:30:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -ℹ Safe fix +Suggested fix: 27 27 | # FURB140 (check it still flags starred arguments). 28 28 | # See https://github.com/astral-sh/ruff/issues/7636 29 29 | [foo(*t) for t in [(85, 60), (100, 80)]] @@ -174,6 +188,8 @@ FURB140.py:30:1: FURB140 [*] Use `itertools.starmap` instead of the generator 32 32 | 33 33 | # Non-errors. + Run `ruff check --fix` to apply this fix. + FURB140.py:31:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 29 | [foo(*t) for t in [(85, 60), (100, 80)]] @@ -185,7 +201,7 @@ FURB140.py:31:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -ℹ Safe fix +Suggested fix: 28 28 | # See https://github.com/astral-sh/ruff/issues/7636 29 29 | [foo(*t) for t in [(85, 60), (100, 80)]] 30 30 | (foo(*t) for t in [(85, 60), (100, 80)]) @@ -195,4 +211,4 @@ FURB140.py:31:1: FURB140 [*] Use `itertools.starmap` instead of the generator 33 33 | # Non-errors. 34 34 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap index cd781a8bbe030..98f05584c96f8 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap @@ -13,7 +13,7 @@ FURB142.py:5:1: FURB142 [*] Use of `set.add()` in a for loop | = help: Replace with `.update()` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | s = set() 4 4 | @@ -24,6 +24,8 @@ FURB142.py:5:1: FURB142 [*] Use of `set.add()` in a for loop 8 7 | for x in {1, 2, 3}: 9 8 | s.add(x) + Run `ruff check --fix` to apply this fix. + FURB142.py:8:1: FURB142 [*] Use of `set.add()` in a for loop | 6 | s.add(x) @@ -36,7 +38,7 @@ FURB142.py:8:1: FURB142 [*] Use of `set.add()` in a for loop | = help: Replace with `.update()` -ℹ Safe fix +Suggested fix: 5 5 | for x in [1, 2, 3]: 6 6 | s.add(x) 7 7 | @@ -47,6 +49,8 @@ FURB142.py:8:1: FURB142 [*] Use of `set.add()` in a for loop 11 10 | for x in (1, 2, 3): 12 11 | s.add(x) + Run `ruff check --fix` to apply this fix. + FURB142.py:11:1: FURB142 [*] Use of `set.add()` in a for loop | 9 | s.add(x) @@ -59,7 +63,7 @@ FURB142.py:11:1: FURB142 [*] Use of `set.add()` in a for loop | = help: Replace with `.update()` -ℹ Safe fix +Suggested fix: 8 8 | for x in {1, 2, 3}: 9 9 | s.add(x) 10 10 | @@ -70,6 +74,8 @@ FURB142.py:11:1: FURB142 [*] Use of `set.add()` in a for loop 14 13 | for x in (1, 2, 3): 15 14 | s.discard(x) + Run `ruff check --fix` to apply this fix. + FURB142.py:14:1: FURB142 [*] Use of `set.discard()` in a for loop | 12 | s.add(x) @@ -82,7 +88,7 @@ FURB142.py:14:1: FURB142 [*] Use of `set.discard()` in a for loop | = help: Replace with `.difference_update()` -ℹ Safe fix +Suggested fix: 11 11 | for x in (1, 2, 3): 12 12 | s.add(x) 13 13 | @@ -93,6 +99,8 @@ FURB142.py:14:1: FURB142 [*] Use of `set.discard()` in a for loop 17 16 | for x in (1, 2, 3): 18 17 | s.add(x + 1) + Run `ruff check --fix` to apply this fix. + FURB142.py:17:1: FURB142 [*] Use of `set.add()` in a for loop | 15 | s.discard(x) @@ -105,7 +113,7 @@ FURB142.py:17:1: FURB142 [*] Use of `set.add()` in a for loop | = help: Replace with `.update()` -ℹ Safe fix +Suggested fix: 14 14 | for x in (1, 2, 3): 15 15 | s.discard(x) 16 16 | @@ -116,6 +124,8 @@ FURB142.py:17:1: FURB142 [*] Use of `set.add()` in a for loop 20 19 | for x, y in ((1, 2), (3, 4)): 21 20 | s.add((x, y)) + Run `ruff check --fix` to apply this fix. + FURB142.py:20:1: FURB142 [*] Use of `set.add()` in a for loop | 18 | s.add(x + 1) @@ -128,7 +138,7 @@ FURB142.py:20:1: FURB142 [*] Use of `set.add()` in a for loop | = help: Replace with `.update()` -ℹ Safe fix +Suggested fix: 17 17 | for x in (1, 2, 3): 18 18 | s.add(x + 1) 19 19 | @@ -139,6 +149,8 @@ FURB142.py:20:1: FURB142 [*] Use of `set.add()` in a for loop 23 22 | num = 123 24 23 | + Run `ruff check --fix` to apply this fix. + FURB142.py:25:1: FURB142 [*] Use of `set.add()` in a for loop | 23 | num = 123 @@ -151,7 +163,7 @@ FURB142.py:25:1: FURB142 [*] Use of `set.add()` in a for loop | = help: Replace with `.update()` -ℹ Safe fix +Suggested fix: 22 22 | 23 23 | num = 123 24 24 | @@ -162,6 +174,8 @@ FURB142.py:25:1: FURB142 [*] Use of `set.add()` in a for loop 28 27 | for x in (1, 2, 3): 29 28 | s.add((num, x)) + Run `ruff check --fix` to apply this fix. + FURB142.py:28:1: FURB142 [*] Use of `set.add()` in a for loop | 26 | s.add(num) @@ -174,7 +188,7 @@ FURB142.py:28:1: FURB142 [*] Use of `set.add()` in a for loop | = help: Replace with `.update()` -ℹ Safe fix +Suggested fix: 25 25 | for x in (1, 2, 3): 26 26 | s.add(num) 27 27 | @@ -185,6 +199,8 @@ FURB142.py:28:1: FURB142 [*] Use of `set.add()` in a for loop 31 30 | for x in (1, 2, 3): 32 31 | s.add(x + num) + Run `ruff check --fix` to apply this fix. + FURB142.py:31:1: FURB142 [*] Use of `set.add()` in a for loop | 29 | s.add((num, x)) @@ -197,7 +213,7 @@ FURB142.py:31:1: FURB142 [*] Use of `set.add()` in a for loop | = help: Replace with `.update()` -ℹ Safe fix +Suggested fix: 28 28 | for x in (1, 2, 3): 29 29 | s.add((num, x)) 30 30 | @@ -206,4 +222,6 @@ FURB142.py:31:1: FURB142 [*] Use of `set.add()` in a for loop 31 |+s.update(x + num for x in (1, 2, 3)) 33 32 | 34 33 | # False negative -35 34 | +35 34 | + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap index 388dfb2488cc0..afca142e10525 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap @@ -11,7 +11,7 @@ FURB145.py:4:5: FURB145 [*] Prefer `copy` method over slicing | = help: Replace with `copy()` -ℹ Safe fix +Suggested fix: 1 1 | l = [1, 2, 3, 4, 5] 2 2 | 3 3 | # Errors. @@ -21,6 +21,8 @@ FURB145.py:4:5: FURB145 [*] Prefer `copy` method over slicing 6 6 | d, e = l[:], 1 7 7 | m = l[::] + Run `ruff check --fix` to apply this fix. + FURB145.py:5:11: FURB145 [*] Prefer `copy` method over slicing | 3 | # Errors. @@ -32,7 +34,7 @@ FURB145.py:5:11: FURB145 [*] Prefer `copy` method over slicing | = help: Replace with `copy()` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | # Errors. 4 4 | a = l[:] @@ -42,6 +44,8 @@ FURB145.py:5:11: FURB145 [*] Prefer `copy` method over slicing 7 7 | m = l[::] 8 8 | l[:] + Run `ruff check --fix` to apply this fix. + FURB145.py:6:8: FURB145 [*] Prefer `copy` method over slicing | 4 | a = l[:] @@ -53,7 +57,7 @@ FURB145.py:6:8: FURB145 [*] Prefer `copy` method over slicing | = help: Replace with `copy()` -ℹ Safe fix +Suggested fix: 3 3 | # Errors. 4 4 | a = l[:] 5 5 | b, c = 1, l[:] @@ -63,6 +67,8 @@ FURB145.py:6:8: FURB145 [*] Prefer `copy` method over slicing 8 8 | l[:] 9 9 | print(l[:]) + Run `ruff check --fix` to apply this fix. + FURB145.py:7:5: FURB145 [*] Prefer `copy` method over slicing | 5 | b, c = 1, l[:] @@ -74,7 +80,7 @@ FURB145.py:7:5: FURB145 [*] Prefer `copy` method over slicing | = help: Replace with `copy()` -ℹ Safe fix +Suggested fix: 4 4 | a = l[:] 5 5 | b, c = 1, l[:] 6 6 | d, e = l[:], 1 @@ -84,6 +90,8 @@ FURB145.py:7:5: FURB145 [*] Prefer `copy` method over slicing 9 9 | print(l[:]) 10 10 | + Run `ruff check --fix` to apply this fix. + FURB145.py:8:1: FURB145 [*] Prefer `copy` method over slicing | 6 | d, e = l[:], 1 @@ -94,7 +102,7 @@ FURB145.py:8:1: FURB145 [*] Prefer `copy` method over slicing | = help: Replace with `copy()` -ℹ Safe fix +Suggested fix: 5 5 | b, c = 1, l[:] 6 6 | d, e = l[:], 1 7 7 | m = l[::] @@ -104,6 +112,8 @@ FURB145.py:8:1: FURB145 [*] Prefer `copy` method over slicing 10 10 | 11 11 | # False negatives. + Run `ruff check --fix` to apply this fix. + FURB145.py:9:7: FURB145 [*] Prefer `copy` method over slicing | 7 | m = l[::] @@ -115,7 +125,7 @@ FURB145.py:9:7: FURB145 [*] Prefer `copy` method over slicing | = help: Replace with `copy()` -ℹ Safe fix +Suggested fix: 6 6 | d, e = l[:], 1 7 7 | m = l[::] 8 8 | l[:] @@ -125,4 +135,4 @@ FURB145.py:9:7: FURB145 [*] Prefer `copy` method over slicing 11 11 | # False negatives. 12 12 | aa = a[:] # Type inference. - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap index 3cb94bc16bd50..161b689a436ce 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap @@ -10,7 +10,7 @@ FURB148.py:14:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -ℹ Unsafe fix +Suggested fix: 11 11 | books_tuple = ("Dune", "Foundation", "Neuromancer") 12 12 | 13 13 | # Errors @@ -20,6 +20,8 @@ FURB148.py:14:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l 16 16 | 17 17 | for index, _ in enumerate(books, start=0): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:17:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 15 | print(index) @@ -30,7 +32,7 @@ FURB148.py:17:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -ℹ Unsafe fix +Suggested fix: 14 14 | for index, _ in enumerate(books): 15 15 | print(index) 16 16 | @@ -40,6 +42,8 @@ FURB148.py:17:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l 19 19 | 20 20 | for index, _ in enumerate(books, 0): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:20:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 18 | print(index) @@ -50,7 +54,7 @@ FURB148.py:20:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -ℹ Unsafe fix +Suggested fix: 17 17 | for index, _ in enumerate(books, start=0): 18 18 | print(index) 19 19 | @@ -60,6 +64,8 @@ FURB148.py:20:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l 22 22 | 23 23 | for index, _ in enumerate(books, start=1): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:23:17: FURB148 `enumerate` value is unused, use `for x in range(len(y))` instead | 21 | print(index) @@ -110,7 +116,7 @@ FURB148.py:35:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Unsafe fix +Suggested fix: 32 32 | for index, _ in enumerate(books, x): 33 33 | print(book) 34 34 | @@ -120,6 +126,8 @@ FURB148.py:35:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 37 37 | 38 38 | for _, book in enumerate(books, start=0): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:38:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 36 | print(book) @@ -130,7 +138,7 @@ FURB148.py:38:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Unsafe fix +Suggested fix: 35 35 | for _, book in enumerate(books): 36 36 | print(book) 37 37 | @@ -140,6 +148,8 @@ FURB148.py:38:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 40 40 | 41 41 | for _, book in enumerate(books, 0): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:41:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 39 | print(book) @@ -150,7 +160,7 @@ FURB148.py:41:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Unsafe fix +Suggested fix: 38 38 | for _, book in enumerate(books, start=0): 39 39 | print(book) 40 40 | @@ -160,6 +170,8 @@ FURB148.py:41:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 43 43 | 44 44 | for _, book in enumerate(books, start=1): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:44:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 42 | print(book) @@ -170,7 +182,7 @@ FURB148.py:44:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Unsafe fix +Suggested fix: 41 41 | for _, book in enumerate(books, 0): 42 42 | print(book) 43 43 | @@ -180,6 +192,8 @@ FURB148.py:44:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 46 46 | 47 47 | for _, book in enumerate(books, 1): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:47:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 45 | print(book) @@ -190,7 +204,7 @@ FURB148.py:47:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Unsafe fix +Suggested fix: 44 44 | for _, book in enumerate(books, start=1): 45 45 | print(book) 46 46 | @@ -200,6 +214,8 @@ FURB148.py:47:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 49 49 | 50 50 | for _, book in enumerate(books, start=x): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:50:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 48 | print(book) @@ -210,7 +226,7 @@ FURB148.py:50:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Unsafe fix +Suggested fix: 47 47 | for _, book in enumerate(books, 1): 48 48 | print(book) 49 49 | @@ -220,6 +236,8 @@ FURB148.py:50:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 52 52 | 53 53 | for _, book in enumerate(books, x): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:53:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 51 | print(book) @@ -230,7 +248,7 @@ FURB148.py:53:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Unsafe fix +Suggested fix: 50 50 | for _, book in enumerate(books, start=x): 51 51 | print(book) 52 52 | @@ -240,6 +258,8 @@ FURB148.py:53:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 55 55 | 56 56 | for index, (_, _) in enumerate(books): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:56:22: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 54 | print(book) @@ -250,7 +270,7 @@ FURB148.py:56:22: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -ℹ Unsafe fix +Suggested fix: 53 53 | for _, book in enumerate(books, x): 54 54 | print(book) 55 55 | @@ -260,6 +280,8 @@ FURB148.py:56:22: FURB148 [*] `enumerate` value is unused, use `for x in range(l 58 58 | 59 59 | for (_, _), book in enumerate(books): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:59:21: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 57 | print(index) @@ -270,7 +292,7 @@ FURB148.py:59:21: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Unsafe fix +Suggested fix: 56 56 | for index, (_, _) in enumerate(books): 57 57 | print(index) 58 58 | @@ -280,6 +302,8 @@ FURB148.py:59:21: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 61 61 | 62 62 | for(index, _)in enumerate(books): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:62:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 60 | print(book) @@ -290,7 +314,7 @@ FURB148.py:62:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -ℹ Unsafe fix +Suggested fix: 59 59 | for (_, _), book in enumerate(books): 60 60 | print(book) 61 61 | @@ -300,6 +324,8 @@ FURB148.py:62:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l 64 64 | 65 65 | for(index), _ in enumerate(books): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:65:18: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 63 | print(index) @@ -310,7 +336,7 @@ FURB148.py:65:18: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -ℹ Unsafe fix +Suggested fix: 62 62 | for(index, _)in enumerate(books): 63 63 | print(index) 64 64 | @@ -320,6 +346,8 @@ FURB148.py:65:18: FURB148 [*] `enumerate` value is unused, use `for x in range(l 67 67 | 68 68 | for index, _ in enumerate(books_and_authors): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:68:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 66 | print(index) @@ -330,7 +358,7 @@ FURB148.py:68:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -ℹ Unsafe fix +Suggested fix: 65 65 | for(index), _ in enumerate(books): 66 66 | print(index) 67 67 | @@ -340,6 +368,8 @@ FURB148.py:68:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l 70 70 | 71 71 | for _, book in enumerate(books_and_authors): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:71:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 69 | print(index) @@ -350,7 +380,7 @@ FURB148.py:71:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Unsafe fix +Suggested fix: 68 68 | for index, _ in enumerate(books_and_authors): 69 69 | print(index) 70 70 | @@ -360,6 +390,8 @@ FURB148.py:71:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 73 73 | 74 74 | for index, _ in enumerate(books_set): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:74:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 72 | print(book) @@ -370,7 +402,7 @@ FURB148.py:74:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -ℹ Unsafe fix +Suggested fix: 71 71 | for _, book in enumerate(books_and_authors): 72 72 | print(book) 73 73 | @@ -380,6 +412,8 @@ FURB148.py:74:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l 76 76 | 77 77 | for _, book in enumerate(books_set): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:77:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 75 | print(index) @@ -390,7 +424,7 @@ FURB148.py:77:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Unsafe fix +Suggested fix: 74 74 | for index, _ in enumerate(books_set): 75 75 | print(index) 76 76 | @@ -400,6 +434,8 @@ FURB148.py:77:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 79 79 | 80 80 | for index, _ in enumerate(books_tuple): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:80:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 78 | print(book) @@ -410,7 +446,7 @@ FURB148.py:80:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -ℹ Unsafe fix +Suggested fix: 77 77 | for _, book in enumerate(books_set): 78 78 | print(book) 79 79 | @@ -420,6 +456,8 @@ FURB148.py:80:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l 82 82 | 83 83 | for _, book in enumerate(books_tuple): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB148.py:83:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 81 | print(index) @@ -430,7 +468,7 @@ FURB148.py:83:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Unsafe fix +Suggested fix: 80 80 | for index, _ in enumerate(books_tuple): 81 81 | print(index) 82 82 | @@ -440,4 +478,4 @@ FURB148.py:83:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 85 85 | 86 86 | # OK - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap index 9933f51589ab9..e2eb9bd530888 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap @@ -12,7 +12,7 @@ FURB152.py:3:5: FURB152 [*] Replace `3.14` with `math.pi` | = help: Use `math.pi` -ℹ Safe fix +Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -22,6 +22,8 @@ FURB152.py:3:5: FURB152 [*] Replace `3.14` with `math.pi` 5 6 | C = 6.28 * r # FURB152 6 7 | + Run `ruff check --fix` to apply this fix. + FURB152.py:5:5: FURB152 [*] Replace `6.28` with `math.tau` | 3 | A = 3.14 * r ** 2 # FURB152 @@ -33,7 +35,7 @@ FURB152.py:5:5: FURB152 [*] Replace `6.28` with `math.tau` | = help: Use `math.tau` -ℹ Safe fix +Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -45,6 +47,8 @@ FURB152.py:5:5: FURB152 [*] Replace `6.28` with `math.tau` 7 8 | e = 2.71 # FURB152 8 9 | + Run `ruff check --fix` to apply this fix. + FURB152.py:7:5: FURB152 [*] Replace `2.71` with `math.e` | 5 | C = 6.28 * r # FURB152 @@ -56,7 +60,7 @@ FURB152.py:7:5: FURB152 [*] Replace `2.71` with `math.e` | = help: Use `math.e` -ℹ Safe fix +Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -70,6 +74,8 @@ FURB152.py:7:5: FURB152 [*] Replace `2.71` with `math.e` 9 10 | r = 3.15 # OK 10 11 | + Run `ruff check --fix` to apply this fix. + FURB152.py:11:5: FURB152 [*] Replace `3.141` with `math.pi` | 9 | r = 3.15 # OK @@ -81,7 +87,7 @@ FURB152.py:11:5: FURB152 [*] Replace `3.141` with `math.pi` | = help: Use `math.pi` -ℹ Safe fix +Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -96,6 +102,8 @@ FURB152.py:11:5: FURB152 [*] Replace `3.141` with `math.pi` 13 14 | r = 3.142 # FURB152 14 15 | + Run `ruff check --fix` to apply this fix. + FURB152.py:13:5: FURB152 [*] Replace `3.142` with `math.pi` | 11 | r = 3.141 # FURB152 @@ -107,7 +115,7 @@ FURB152.py:13:5: FURB152 [*] Replace `3.142` with `math.pi` | = help: Use `math.pi` -ℹ Safe fix +Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -122,6 +130,8 @@ FURB152.py:13:5: FURB152 [*] Replace `3.142` with `math.pi` 15 16 | r = 3.1415 # FURB152 16 17 | + Run `ruff check --fix` to apply this fix. + FURB152.py:15:5: FURB152 [*] Replace `3.1415` with `math.pi` | 13 | r = 3.142 # FURB152 @@ -133,7 +143,7 @@ FURB152.py:15:5: FURB152 [*] Replace `3.1415` with `math.pi` | = help: Use `math.pi` -ℹ Safe fix +Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -148,6 +158,8 @@ FURB152.py:15:5: FURB152 [*] Replace `3.1415` with `math.pi` 17 18 | r = 3.1416 # FURB152 18 19 | + Run `ruff check --fix` to apply this fix. + FURB152.py:17:5: FURB152 [*] Replace `3.1416` with `math.pi` | 15 | r = 3.1415 # FURB152 @@ -159,7 +171,7 @@ FURB152.py:17:5: FURB152 [*] Replace `3.1416` with `math.pi` | = help: Use `math.pi` -ℹ Safe fix +Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -174,6 +186,8 @@ FURB152.py:17:5: FURB152 [*] Replace `3.1416` with `math.pi` 19 20 | r = 3.141592 # FURB152 20 21 | + Run `ruff check --fix` to apply this fix. + FURB152.py:19:5: FURB152 [*] Replace `3.141592` with `math.pi` | 17 | r = 3.1416 # FURB152 @@ -185,7 +199,7 @@ FURB152.py:19:5: FURB152 [*] Replace `3.141592` with `math.pi` | = help: Use `math.pi` -ℹ Safe fix +Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -200,6 +214,8 @@ FURB152.py:19:5: FURB152 [*] Replace `3.141592` with `math.pi` 21 22 | r = 3.141593 # FURB152 22 23 | + Run `ruff check --fix` to apply this fix. + FURB152.py:21:5: FURB152 [*] Replace `3.141593` with `math.pi` | 19 | r = 3.141592 # FURB152 @@ -211,7 +227,7 @@ FURB152.py:21:5: FURB152 [*] Replace `3.141593` with `math.pi` | = help: Use `math.pi` -ℹ Safe fix +Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -226,6 +242,8 @@ FURB152.py:21:5: FURB152 [*] Replace `3.141593` with `math.pi` 23 24 | r = 3.14159265 # FURB152 24 25 | + Run `ruff check --fix` to apply this fix. + FURB152.py:23:5: FURB152 [*] Replace `3.14159265` with `math.pi` | 21 | r = 3.141593 # FURB152 @@ -237,7 +255,7 @@ FURB152.py:23:5: FURB152 [*] Replace `3.14159265` with `math.pi` | = help: Use `math.pi` -ℹ Safe fix +Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -252,6 +270,8 @@ FURB152.py:23:5: FURB152 [*] Replace `3.14159265` with `math.pi` 25 26 | r = 3.141592653589793238462643383279 # FURB152 26 27 | + Run `ruff check --fix` to apply this fix. + FURB152.py:25:5: FURB152 [*] Replace `3.141592653589793238462643383279` with `math.pi` | 23 | r = 3.14159265 # FURB152 @@ -263,7 +283,7 @@ FURB152.py:25:5: FURB152 [*] Replace `3.141592653589793238462643383279` with `ma | = help: Use `math.pi` -ℹ Safe fix +Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -278,6 +298,8 @@ FURB152.py:25:5: FURB152 [*] Replace `3.141592653589793238462643383279` with `ma 27 28 | r = 3.14159266 # OK 28 29 | + Run `ruff check --fix` to apply this fix. + FURB152.py:31:5: FURB152 [*] Replace `2.718` with `math.e` | 29 | e = 2.7 # OK @@ -289,7 +311,7 @@ FURB152.py:31:5: FURB152 [*] Replace `2.718` with `math.e` | = help: Use `math.e` -ℹ Safe fix +Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -304,6 +326,8 @@ FURB152.py:31:5: FURB152 [*] Replace `2.718` with `math.e` 33 34 | e = 2.7182 # FURB152 34 35 | + Run `ruff check --fix` to apply this fix. + FURB152.py:33:5: FURB152 [*] Replace `2.7182` with `math.e` | 31 | e = 2.718 # FURB152 @@ -315,7 +339,7 @@ FURB152.py:33:5: FURB152 [*] Replace `2.7182` with `math.e` | = help: Use `math.e` -ℹ Safe fix +Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -330,6 +354,8 @@ FURB152.py:33:5: FURB152 [*] Replace `2.7182` with `math.e` 35 36 | e = 2.7183 # FURB152 36 37 | + Run `ruff check --fix` to apply this fix. + FURB152.py:35:5: FURB152 [*] Replace `2.7183` with `math.e` | 33 | e = 2.7182 # FURB152 @@ -341,7 +367,7 @@ FURB152.py:35:5: FURB152 [*] Replace `2.7183` with `math.e` | = help: Use `math.e` -ℹ Safe fix +Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -356,6 +382,8 @@ FURB152.py:35:5: FURB152 [*] Replace `2.7183` with `math.e` 37 38 | e = 2.719 # OK 38 39 | + Run `ruff check --fix` to apply this fix. + FURB152.py:45:5: FURB152 [*] Replace `2.7182000000000001` with `math.e` | 43 | e = 2.718200000000001 # OK @@ -365,7 +393,7 @@ FURB152.py:45:5: FURB152 [*] Replace `2.7182000000000001` with `math.e` | = help: Use `math.e` -ℹ Safe fix +Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -377,4 +405,4 @@ FURB152.py:45:5: FURB152 [*] Replace `2.7182000000000001` with `math.e` 45 |-e = 2.7182000000000001 # FURB152 46 |+e = math.e # FURB152 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB154_FURB154.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB154_FURB154.py.snap index a935e1ae3c4fe..59aaf68c97415 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB154_FURB154.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB154_FURB154.py.snap @@ -11,7 +11,7 @@ FURB154.py:4:5: FURB154 [*] Use of repeated consecutive `global` | = help: Merge `global` statements -ℹ Safe fix +Suggested fix: 1 1 | # Errors 2 2 | 3 3 | def f1(): @@ -22,6 +22,8 @@ FURB154.py:4:5: FURB154 [*] Use of repeated consecutive `global` 7 6 | 8 7 | def f3(): + Run `ruff check --fix` to apply this fix. + FURB154.py:9:5: FURB154 [*] Use of repeated consecutive `global` | 8 | def f3(): @@ -33,7 +35,7 @@ FURB154.py:9:5: FURB154 [*] Use of repeated consecutive `global` | = help: Merge `global` statements -ℹ Safe fix +Suggested fix: 6 6 | 7 7 | 8 8 | def f3(): @@ -45,6 +47,8 @@ FURB154.py:9:5: FURB154 [*] Use of repeated consecutive `global` 13 11 | 14 12 | def f4(): + Run `ruff check --fix` to apply this fix. + FURB154.py:15:5: FURB154 [*] Use of repeated consecutive `global` | 14 | def f4(): @@ -57,7 +61,7 @@ FURB154.py:15:5: FURB154 [*] Use of repeated consecutive `global` | = help: Merge `global` statements -ℹ Safe fix +Suggested fix: 12 12 | 13 13 | 14 14 | def f4(): @@ -68,6 +72,8 @@ FURB154.py:15:5: FURB154 [*] Use of repeated consecutive `global` 18 17 | global x 19 18 | global y + Run `ruff check --fix` to apply this fix. + FURB154.py:18:5: FURB154 [*] Use of repeated consecutive `global` | 16 | global y @@ -79,7 +85,7 @@ FURB154.py:18:5: FURB154 [*] Use of repeated consecutive `global` | = help: Merge `global` statements -ℹ Safe fix +Suggested fix: 15 15 | global x 16 16 | global y 17 17 | pass @@ -90,6 +96,8 @@ FURB154.py:18:5: FURB154 [*] Use of repeated consecutive `global` 21 20 | 22 21 | def f2(): + Run `ruff check --fix` to apply this fix. + FURB154.py:26:9: FURB154 [*] Use of repeated consecutive `nonlocal` | 25 | def inner(): @@ -102,7 +110,7 @@ FURB154.py:26:9: FURB154 [*] Use of repeated consecutive `nonlocal` | = help: Merge `nonlocal` statements -ℹ Safe fix +Suggested fix: 23 23 | x = y = z = 1 24 24 | 25 25 | def inner(): @@ -113,6 +121,8 @@ FURB154.py:26:9: FURB154 [*] Use of repeated consecutive `nonlocal` 29 28 | def inner2(): 30 29 | nonlocal x + Run `ruff check --fix` to apply this fix. + FURB154.py:30:9: FURB154 [*] Use of repeated consecutive `nonlocal` | 29 | def inner2(): @@ -126,7 +136,7 @@ FURB154.py:30:9: FURB154 [*] Use of repeated consecutive `nonlocal` | = help: Merge `nonlocal` statements -ℹ Safe fix +Suggested fix: 27 27 | nonlocal y 28 28 | 29 29 | def inner2(): @@ -138,6 +148,8 @@ FURB154.py:30:9: FURB154 [*] Use of repeated consecutive `nonlocal` 34 32 | def inner3(): 35 33 | nonlocal x + Run `ruff check --fix` to apply this fix. + FURB154.py:35:9: FURB154 [*] Use of repeated consecutive `nonlocal` | 34 | def inner3(): @@ -150,7 +162,7 @@ FURB154.py:35:9: FURB154 [*] Use of repeated consecutive `nonlocal` | = help: Merge `nonlocal` statements -ℹ Safe fix +Suggested fix: 32 32 | nonlocal z 33 33 | 34 34 | def inner3(): @@ -161,6 +173,8 @@ FURB154.py:35:9: FURB154 [*] Use of repeated consecutive `nonlocal` 38 37 | nonlocal x 39 38 | nonlocal y + Run `ruff check --fix` to apply this fix. + FURB154.py:38:9: FURB154 [*] Use of repeated consecutive `nonlocal` | 36 | nonlocal y @@ -172,7 +186,7 @@ FURB154.py:38:9: FURB154 [*] Use of repeated consecutive `nonlocal` | = help: Merge `nonlocal` statements -ℹ Safe fix +Suggested fix: 35 35 | nonlocal x 36 36 | nonlocal y 37 37 | pass @@ -183,6 +197,8 @@ FURB154.py:38:9: FURB154 [*] Use of repeated consecutive `nonlocal` 41 40 | 42 41 | def f5(): + Run `ruff check --fix` to apply this fix. + FURB154.py:46:9: FURB154 [*] Use of repeated consecutive `global` | 45 | def inner(): @@ -195,7 +211,7 @@ FURB154.py:46:9: FURB154 [*] Use of repeated consecutive `global` | = help: Merge `global` statements -ℹ Safe fix +Suggested fix: 43 43 | w = x = y = z = 1 44 44 | 45 45 | def inner(): @@ -206,6 +222,8 @@ FURB154.py:46:9: FURB154 [*] Use of repeated consecutive `global` 49 48 | nonlocal z 50 49 | + Run `ruff check --fix` to apply this fix. + FURB154.py:48:9: FURB154 [*] Use of repeated consecutive `nonlocal` | 46 | global w @@ -219,7 +237,7 @@ FURB154.py:48:9: FURB154 [*] Use of repeated consecutive `nonlocal` | = help: Merge `nonlocal` statements -ℹ Safe fix +Suggested fix: 45 45 | def inner(): 46 46 | global w 47 47 | global x @@ -230,6 +248,8 @@ FURB154.py:48:9: FURB154 [*] Use of repeated consecutive `nonlocal` 51 50 | def inner2(): 52 51 | global x + Run `ruff check --fix` to apply this fix. + FURB154.py:53:9: FURB154 [*] Use of repeated consecutive `nonlocal` | 51 | def inner2(): @@ -241,7 +261,7 @@ FURB154.py:53:9: FURB154 [*] Use of repeated consecutive `nonlocal` | = help: Merge `nonlocal` statements -ℹ Safe fix +Suggested fix: 50 50 | 51 51 | def inner2(): 52 52 | global x @@ -252,6 +272,8 @@ FURB154.py:53:9: FURB154 [*] Use of repeated consecutive `nonlocal` 56 55 | 57 56 | def f6(): + Run `ruff check --fix` to apply this fix. + FURB154.py:58:5: FURB154 [*] Use of repeated consecutive `global` | 57 | def f6(): @@ -263,7 +285,7 @@ FURB154.py:58:5: FURB154 [*] Use of repeated consecutive `global` | = help: Merge `global` statements -ℹ Safe fix +Suggested fix: 55 55 | 56 56 | 57 57 | def f6(): @@ -274,3 +296,5 @@ FURB154.py:58:5: FURB154 [*] Use of repeated consecutive `global` 61 59 | 62 60 | 63 61 | # Ok + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap index ef8680e3666d0..716f1bcccaad6 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap @@ -11,7 +11,7 @@ FURB157.py:5:9: FURB157 [*] Verbose expression in `Decimal` constructor | = help: Replace with `0` -ℹ Safe fix +Suggested fix: 2 2 | from decimal import Decimal 3 3 | 4 4 | # Errors @@ -21,6 +21,8 @@ FURB157.py:5:9: FURB157 [*] Verbose expression in `Decimal` constructor 7 7 | Decimal(float("Infinity")) 8 8 | Decimal(float("-Infinity")) + Run `ruff check --fix` to apply this fix. + FURB157.py:6:9: FURB157 [*] Verbose expression in `Decimal` constructor | 4 | # Errors @@ -32,7 +34,7 @@ FURB157.py:6:9: FURB157 [*] Verbose expression in `Decimal` constructor | = help: Replace with `-42` -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | # Errors 5 5 | Decimal("0") @@ -42,6 +44,8 @@ FURB157.py:6:9: FURB157 [*] Verbose expression in `Decimal` constructor 8 8 | Decimal(float("-Infinity")) 9 9 | Decimal(float("inf")) + Run `ruff check --fix` to apply this fix. + FURB157.py:7:9: FURB157 [*] Verbose expression in `Decimal` constructor | 5 | Decimal("0") @@ -53,7 +57,7 @@ FURB157.py:7:9: FURB157 [*] Verbose expression in `Decimal` constructor | = help: Replace with `"Infinity"` -ℹ Safe fix +Suggested fix: 4 4 | # Errors 5 5 | Decimal("0") 6 6 | Decimal("-42") @@ -63,6 +67,8 @@ FURB157.py:7:9: FURB157 [*] Verbose expression in `Decimal` constructor 9 9 | Decimal(float("inf")) 10 10 | Decimal(float("-inf")) + Run `ruff check --fix` to apply this fix. + FURB157.py:8:9: FURB157 [*] Verbose expression in `Decimal` constructor | 6 | Decimal("-42") @@ -74,7 +80,7 @@ FURB157.py:8:9: FURB157 [*] Verbose expression in `Decimal` constructor | = help: Replace with `"-Infinity"` -ℹ Safe fix +Suggested fix: 5 5 | Decimal("0") 6 6 | Decimal("-42") 7 7 | Decimal(float("Infinity")) @@ -84,6 +90,8 @@ FURB157.py:8:9: FURB157 [*] Verbose expression in `Decimal` constructor 10 10 | Decimal(float("-inf")) 11 11 | Decimal(float("nan")) + Run `ruff check --fix` to apply this fix. + FURB157.py:9:9: FURB157 [*] Verbose expression in `Decimal` constructor | 7 | Decimal(float("Infinity")) @@ -95,7 +103,7 @@ FURB157.py:9:9: FURB157 [*] Verbose expression in `Decimal` constructor | = help: Replace with `"inf"` -ℹ Safe fix +Suggested fix: 6 6 | Decimal("-42") 7 7 | Decimal(float("Infinity")) 8 8 | Decimal(float("-Infinity")) @@ -105,6 +113,8 @@ FURB157.py:9:9: FURB157 [*] Verbose expression in `Decimal` constructor 11 11 | Decimal(float("nan")) 12 12 | decimal.Decimal("0") + Run `ruff check --fix` to apply this fix. + FURB157.py:10:9: FURB157 [*] Verbose expression in `Decimal` constructor | 8 | Decimal(float("-Infinity")) @@ -116,7 +126,7 @@ FURB157.py:10:9: FURB157 [*] Verbose expression in `Decimal` constructor | = help: Replace with `"-inf"` -ℹ Safe fix +Suggested fix: 7 7 | Decimal(float("Infinity")) 8 8 | Decimal(float("-Infinity")) 9 9 | Decimal(float("inf")) @@ -126,6 +136,8 @@ FURB157.py:10:9: FURB157 [*] Verbose expression in `Decimal` constructor 12 12 | decimal.Decimal("0") 13 13 | + Run `ruff check --fix` to apply this fix. + FURB157.py:11:9: FURB157 [*] Verbose expression in `Decimal` constructor | 9 | Decimal(float("inf")) @@ -136,7 +148,7 @@ FURB157.py:11:9: FURB157 [*] Verbose expression in `Decimal` constructor | = help: Replace with `"nan"` -ℹ Safe fix +Suggested fix: 8 8 | Decimal(float("-Infinity")) 9 9 | Decimal(float("inf")) 10 10 | Decimal(float("-inf")) @@ -146,6 +158,8 @@ FURB157.py:11:9: FURB157 [*] Verbose expression in `Decimal` constructor 13 13 | 14 14 | # OK + Run `ruff check --fix` to apply this fix. + FURB157.py:12:17: FURB157 [*] Verbose expression in `Decimal` constructor | 10 | Decimal(float("-inf")) @@ -157,7 +171,7 @@ FURB157.py:12:17: FURB157 [*] Verbose expression in `Decimal` constructor | = help: Replace with `0` -ℹ Safe fix +Suggested fix: 9 9 | Decimal(float("inf")) 10 10 | Decimal(float("-inf")) 11 11 | Decimal(float("nan")) @@ -166,3 +180,5 @@ FURB157.py:12:17: FURB157 [*] Verbose expression in `Decimal` constructor 13 13 | 14 14 | # OK 15 15 | Decimal(0) + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap index 0085558579ae4..13c6897dcba67 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap @@ -12,7 +12,7 @@ FURB161.py:6:9: FURB161 [*] Use of `bin(x).count('1')` | = help: Replace with `(x).bit_count()` -ℹ Safe fix +Suggested fix: 3 3 | def ten() -> int: 4 4 | return 10 5 5 | @@ -22,6 +22,8 @@ FURB161.py:6:9: FURB161 [*] Use of `bin(x).count('1')` 8 8 | count = bin(0b1010).count("1") # FURB161 9 9 | count = bin(0xA).count("1") # FURB161 + Run `ruff check --fix` to apply this fix. + FURB161.py:7:9: FURB161 [*] Use of `bin(10).count('1')` | 6 | count = bin(x).count("1") # FURB161 @@ -32,7 +34,7 @@ FURB161.py:7:9: FURB161 [*] Use of `bin(10).count('1')` | = help: Replace with `(10).bit_count()` -ℹ Safe fix +Suggested fix: 4 4 | return 10 5 5 | 6 6 | count = bin(x).count("1") # FURB161 @@ -42,6 +44,8 @@ FURB161.py:7:9: FURB161 [*] Use of `bin(10).count('1')` 9 9 | count = bin(0xA).count("1") # FURB161 10 10 | count = bin(0o12).count("1") # FURB161 + Run `ruff check --fix` to apply this fix. + FURB161.py:8:9: FURB161 [*] Use of `bin(0b1010).count('1')` | 6 | count = bin(x).count("1") # FURB161 @@ -53,7 +57,7 @@ FURB161.py:8:9: FURB161 [*] Use of `bin(0b1010).count('1')` | = help: Replace with `0b1010.bit_count()` -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | count = bin(x).count("1") # FURB161 7 7 | count = bin(10).count("1") # FURB161 @@ -63,6 +67,8 @@ FURB161.py:8:9: FURB161 [*] Use of `bin(0b1010).count('1')` 10 10 | count = bin(0o12).count("1") # FURB161 11 11 | count = bin(0x10 + 0x1000).count("1") # FURB161 + Run `ruff check --fix` to apply this fix. + FURB161.py:9:9: FURB161 [*] Use of `bin(0xA).count('1')` | 7 | count = bin(10).count("1") # FURB161 @@ -74,7 +80,7 @@ FURB161.py:9:9: FURB161 [*] Use of `bin(0xA).count('1')` | = help: Replace with `0xA.bit_count()` -ℹ Safe fix +Suggested fix: 6 6 | count = bin(x).count("1") # FURB161 7 7 | count = bin(10).count("1") # FURB161 8 8 | count = bin(0b1010).count("1") # FURB161 @@ -84,6 +90,8 @@ FURB161.py:9:9: FURB161 [*] Use of `bin(0xA).count('1')` 11 11 | count = bin(0x10 + 0x1000).count("1") # FURB161 12 12 | count = bin(ten()).count("1") # FURB161 + Run `ruff check --fix` to apply this fix. + FURB161.py:10:9: FURB161 [*] Use of `bin(0o12).count('1')` | 8 | count = bin(0b1010).count("1") # FURB161 @@ -95,7 +103,7 @@ FURB161.py:10:9: FURB161 [*] Use of `bin(0o12).count('1')` | = help: Replace with `0o12.bit_count()` -ℹ Safe fix +Suggested fix: 7 7 | count = bin(10).count("1") # FURB161 8 8 | count = bin(0b1010).count("1") # FURB161 9 9 | count = bin(0xA).count("1") # FURB161 @@ -105,6 +113,8 @@ FURB161.py:10:9: FURB161 [*] Use of `bin(0o12).count('1')` 12 12 | count = bin(ten()).count("1") # FURB161 13 13 | count = bin((10)).count("1") # FURB161 + Run `ruff check --fix` to apply this fix. + FURB161.py:11:9: FURB161 [*] Use of `bin(0x10 + 0x1000).count('1')` | 9 | count = bin(0xA).count("1") # FURB161 @@ -116,7 +126,7 @@ FURB161.py:11:9: FURB161 [*] Use of `bin(0x10 + 0x1000).count('1')` | = help: Replace with `(0x10 + 0x1000).bit_count()` -ℹ Safe fix +Suggested fix: 8 8 | count = bin(0b1010).count("1") # FURB161 9 9 | count = bin(0xA).count("1") # FURB161 10 10 | count = bin(0o12).count("1") # FURB161 @@ -126,6 +136,8 @@ FURB161.py:11:9: FURB161 [*] Use of `bin(0x10 + 0x1000).count('1')` 13 13 | count = bin((10)).count("1") # FURB161 14 14 | count = bin("10" "15").count("1") # FURB161 + Run `ruff check --fix` to apply this fix. + FURB161.py:12:9: FURB161 [*] Use of `bin(ten()).count('1')` | 10 | count = bin(0o12).count("1") # FURB161 @@ -137,7 +149,7 @@ FURB161.py:12:9: FURB161 [*] Use of `bin(ten()).count('1')` | = help: Replace with `ten().bit_count()` -ℹ Safe fix +Suggested fix: 9 9 | count = bin(0xA).count("1") # FURB161 10 10 | count = bin(0o12).count("1") # FURB161 11 11 | count = bin(0x10 + 0x1000).count("1") # FURB161 @@ -147,6 +159,8 @@ FURB161.py:12:9: FURB161 [*] Use of `bin(ten()).count('1')` 14 14 | count = bin("10" "15").count("1") # FURB161 15 15 | + Run `ruff check --fix` to apply this fix. + FURB161.py:13:9: FURB161 [*] Use of `bin(10).count('1')` | 11 | count = bin(0x10 + 0x1000).count("1") # FURB161 @@ -157,7 +171,7 @@ FURB161.py:13:9: FURB161 [*] Use of `bin(10).count('1')` | = help: Replace with `(10).bit_count()` -ℹ Safe fix +Suggested fix: 10 10 | count = bin(0o12).count("1") # FURB161 11 11 | count = bin(0x10 + 0x1000).count("1") # FURB161 12 12 | count = bin(ten()).count("1") # FURB161 @@ -167,6 +181,8 @@ FURB161.py:13:9: FURB161 [*] Use of `bin(10).count('1')` 15 15 | 16 16 | count = x.bit_count() # OK + Run `ruff check --fix` to apply this fix. + FURB161.py:14:9: FURB161 [*] Use of `bin("10" "15").count('1')` | 12 | count = bin(ten()).count("1") # FURB161 @@ -178,7 +194,7 @@ FURB161.py:14:9: FURB161 [*] Use of `bin("10" "15").count('1')` | = help: Replace with `("10" "15").bit_count()` -ℹ Safe fix +Suggested fix: 11 11 | count = bin(0x10 + 0x1000).count("1") # FURB161 12 12 | count = bin(ten()).count("1") # FURB161 13 13 | count = bin((10)).count("1") # FURB161 @@ -188,4 +204,4 @@ FURB161.py:14:9: FURB161 [*] Use of `bin("10" "15").count('1')` 16 16 | count = x.bit_count() # OK 17 17 | count = (10).bit_count() # OK - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap index c305821cc9a85..46b37fe9974c0 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap @@ -11,7 +11,7 @@ FURB163.py:4:1: FURB163 [*] Prefer `math.log2(1)` over `math.log` with a redunda | = help: Replace with `math.log2(1)` -ℹ Safe fix +Suggested fix: 1 1 | import math 2 2 | 3 3 | # Errors @@ -21,6 +21,8 @@ FURB163.py:4:1: FURB163 [*] Prefer `math.log2(1)` over `math.log` with a redunda 6 6 | math.log(1, math.e) 7 7 | foo = ... + Run `ruff check --fix` to apply this fix. + FURB163.py:5:1: FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redundant base | 3 | # Errors @@ -32,7 +34,7 @@ FURB163.py:5:1: FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redund | = help: Replace with `math.log10(1)` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | # Errors 4 4 | math.log(1, 2) @@ -42,6 +44,8 @@ FURB163.py:5:1: FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redund 7 7 | foo = ... 8 8 | math.log(foo, 2) + Run `ruff check --fix` to apply this fix. + FURB163.py:6:1: FURB163 [*] Prefer `math.log(1)` over `math.log` with a redundant base | 4 | math.log(1, 2) @@ -53,7 +57,7 @@ FURB163.py:6:1: FURB163 [*] Prefer `math.log(1)` over `math.log` with a redundan | = help: Replace with `math.log(1)` -ℹ Safe fix +Suggested fix: 3 3 | # Errors 4 4 | math.log(1, 2) 5 5 | math.log(1, 10) @@ -63,6 +67,8 @@ FURB163.py:6:1: FURB163 [*] Prefer `math.log(1)` over `math.log` with a redundan 8 8 | math.log(foo, 2) 9 9 | math.log(foo, 10) + Run `ruff check --fix` to apply this fix. + FURB163.py:8:1: FURB163 [*] Prefer `math.log2(foo)` over `math.log` with a redundant base | 6 | math.log(1, math.e) @@ -74,7 +80,7 @@ FURB163.py:8:1: FURB163 [*] Prefer `math.log2(foo)` over `math.log` with a redun | = help: Replace with `math.log2(foo)` -ℹ Safe fix +Suggested fix: 5 5 | math.log(1, 10) 6 6 | math.log(1, math.e) 7 7 | foo = ... @@ -84,6 +90,8 @@ FURB163.py:8:1: FURB163 [*] Prefer `math.log2(foo)` over `math.log` with a redun 10 10 | math.log(foo, math.e) 11 11 | math.log(1, 2.0) + Run `ruff check --fix` to apply this fix. + FURB163.py:9:1: FURB163 [*] Prefer `math.log10(foo)` over `math.log` with a redundant base | 7 | foo = ... @@ -95,7 +103,7 @@ FURB163.py:9:1: FURB163 [*] Prefer `math.log10(foo)` over `math.log` with a redu | = help: Replace with `math.log10(foo)` -ℹ Safe fix +Suggested fix: 6 6 | math.log(1, math.e) 7 7 | foo = ... 8 8 | math.log(foo, 2) @@ -105,6 +113,8 @@ FURB163.py:9:1: FURB163 [*] Prefer `math.log10(foo)` over `math.log` with a redu 11 11 | math.log(1, 2.0) 12 12 | math.log(1, 10.0) + Run `ruff check --fix` to apply this fix. + FURB163.py:10:1: FURB163 [*] Prefer `math.log(foo)` over `math.log` with a redundant base | 8 | math.log(foo, 2) @@ -116,7 +126,7 @@ FURB163.py:10:1: FURB163 [*] Prefer `math.log(foo)` over `math.log` with a redun | = help: Replace with `math.log(foo)` -ℹ Safe fix +Suggested fix: 7 7 | foo = ... 8 8 | math.log(foo, 2) 9 9 | math.log(foo, 10) @@ -126,6 +136,8 @@ FURB163.py:10:1: FURB163 [*] Prefer `math.log(foo)` over `math.log` with a redun 12 12 | math.log(1, 10.0) 13 13 | + Run `ruff check --fix` to apply this fix. + FURB163.py:11:1: FURB163 [*] Prefer `math.log2(1)` over `math.log` with a redundant base | 9 | math.log(foo, 10) @@ -136,7 +148,7 @@ FURB163.py:11:1: FURB163 [*] Prefer `math.log2(1)` over `math.log` with a redund | = help: Replace with `math.log2(1)` -ℹ Safe fix +Suggested fix: 8 8 | math.log(foo, 2) 9 9 | math.log(foo, 10) 10 10 | math.log(foo, math.e) @@ -146,6 +158,8 @@ FURB163.py:11:1: FURB163 [*] Prefer `math.log2(1)` over `math.log` with a redund 13 13 | 14 14 | # OK + Run `ruff check --fix` to apply this fix. + FURB163.py:12:1: FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redundant base | 10 | math.log(foo, math.e) @@ -157,7 +171,7 @@ FURB163.py:12:1: FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redun | = help: Replace with `math.log10(1)` -ℹ Safe fix +Suggested fix: 9 9 | math.log(foo, 10) 10 10 | math.log(foo, math.e) 11 11 | math.log(1, 2.0) @@ -166,3 +180,5 @@ FURB163.py:12:1: FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redun 13 13 | 14 14 | # OK 15 15 | math.log2(1) + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap index 04340e219c219..d1a56d4eaa748 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap @@ -11,7 +11,7 @@ FURB164.py:7:5: FURB164 [*] Verbose method `from_float` in `Fraction` constructi | = help: Replace with `Fraction` constructor -ℹ Safe fix +Suggested fix: 4 4 | import fractions 5 5 | 6 6 | # Errors @@ -21,6 +21,8 @@ FURB164.py:7:5: FURB164 [*] Verbose method `from_float` in `Fraction` constructi 9 9 | _ = Fraction.from_float(5.0) 10 10 | _ = fractions.Fraction.from_float(4.2) + Run `ruff check --fix` to apply this fix. + FURB164.py:8:5: FURB164 [*] Verbose method `from_float` in `Fraction` construction | 6 | # Errors @@ -32,7 +34,7 @@ FURB164.py:8:5: FURB164 [*] Verbose method `from_float` in `Fraction` constructi | = help: Replace with `Fraction` constructor -ℹ Safe fix +Suggested fix: 5 5 | 6 6 | # Errors 7 7 | _ = Fraction.from_float(0.1) @@ -42,6 +44,8 @@ FURB164.py:8:5: FURB164 [*] Verbose method `from_float` in `Fraction` constructi 10 10 | _ = fractions.Fraction.from_float(4.2) 11 11 | _ = Fraction.from_decimal(Decimal("4.2")) + Run `ruff check --fix` to apply this fix. + FURB164.py:9:5: FURB164 [*] Verbose method `from_float` in `Fraction` construction | 7 | _ = Fraction.from_float(0.1) @@ -53,7 +57,7 @@ FURB164.py:9:5: FURB164 [*] Verbose method `from_float` in `Fraction` constructi | = help: Replace with `Fraction` constructor -ℹ Safe fix +Suggested fix: 6 6 | # Errors 7 7 | _ = Fraction.from_float(0.1) 8 8 | _ = Fraction.from_float(-0.5) @@ -63,6 +67,8 @@ FURB164.py:9:5: FURB164 [*] Verbose method `from_float` in `Fraction` constructi 11 11 | _ = Fraction.from_decimal(Decimal("4.2")) 12 12 | _ = Fraction.from_decimal(Decimal("-4.2")) + Run `ruff check --fix` to apply this fix. + FURB164.py:10:5: FURB164 [*] Verbose method `from_float` in `Fraction` construction | 8 | _ = Fraction.from_float(-0.5) @@ -74,7 +80,7 @@ FURB164.py:10:5: FURB164 [*] Verbose method `from_float` in `Fraction` construct | = help: Replace with `Fraction` constructor -ℹ Safe fix +Suggested fix: 7 7 | _ = Fraction.from_float(0.1) 8 8 | _ = Fraction.from_float(-0.5) 9 9 | _ = Fraction.from_float(5.0) @@ -84,6 +90,8 @@ FURB164.py:10:5: FURB164 [*] Verbose method `from_float` in `Fraction` construct 12 12 | _ = Fraction.from_decimal(Decimal("-4.2")) 13 13 | _ = Fraction.from_decimal(Decimal.from_float(4.2)) + Run `ruff check --fix` to apply this fix. + FURB164.py:11:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` construction | 9 | _ = Fraction.from_float(5.0) @@ -95,7 +103,7 @@ FURB164.py:11:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` constru | = help: Replace with `Fraction` constructor -ℹ Safe fix +Suggested fix: 8 8 | _ = Fraction.from_float(-0.5) 9 9 | _ = Fraction.from_float(5.0) 10 10 | _ = fractions.Fraction.from_float(4.2) @@ -105,6 +113,8 @@ FURB164.py:11:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` constru 13 13 | _ = Fraction.from_decimal(Decimal.from_float(4.2)) 14 14 | _ = Decimal.from_float(0.1) + Run `ruff check --fix` to apply this fix. + FURB164.py:12:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` construction | 10 | _ = fractions.Fraction.from_float(4.2) @@ -116,7 +126,7 @@ FURB164.py:12:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` constru | = help: Replace with `Fraction` constructor -ℹ Safe fix +Suggested fix: 9 9 | _ = Fraction.from_float(5.0) 10 10 | _ = fractions.Fraction.from_float(4.2) 11 11 | _ = Fraction.from_decimal(Decimal("4.2")) @@ -126,6 +136,8 @@ FURB164.py:12:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` constru 14 14 | _ = Decimal.from_float(0.1) 15 15 | _ = Decimal.from_float(-0.5) + Run `ruff check --fix` to apply this fix. + FURB164.py:13:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` construction | 11 | _ = Fraction.from_decimal(Decimal("4.2")) @@ -137,7 +149,7 @@ FURB164.py:13:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` constru | = help: Replace with `Fraction` constructor -ℹ Safe fix +Suggested fix: 10 10 | _ = fractions.Fraction.from_float(4.2) 11 11 | _ = Fraction.from_decimal(Decimal("4.2")) 12 12 | _ = Fraction.from_decimal(Decimal("-4.2")) @@ -147,6 +159,8 @@ FURB164.py:13:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` constru 15 15 | _ = Decimal.from_float(-0.5) 16 16 | _ = Decimal.from_float(5.0) + Run `ruff check --fix` to apply this fix. + FURB164.py:13:27: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 11 | _ = Fraction.from_decimal(Decimal("4.2")) @@ -158,7 +172,7 @@ FURB164.py:13:27: FURB164 [*] Verbose method `from_float` in `Decimal` construct | = help: Replace with `Decimal` constructor -ℹ Safe fix +Suggested fix: 10 10 | _ = fractions.Fraction.from_float(4.2) 11 11 | _ = Fraction.from_decimal(Decimal("4.2")) 12 12 | _ = Fraction.from_decimal(Decimal("-4.2")) @@ -168,6 +182,8 @@ FURB164.py:13:27: FURB164 [*] Verbose method `from_float` in `Decimal` construct 15 15 | _ = Decimal.from_float(-0.5) 16 16 | _ = Decimal.from_float(5.0) + Run `ruff check --fix` to apply this fix. + FURB164.py:14:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 12 | _ = Fraction.from_decimal(Decimal("-4.2")) @@ -179,7 +195,7 @@ FURB164.py:14:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -ℹ Safe fix +Suggested fix: 11 11 | _ = Fraction.from_decimal(Decimal("4.2")) 12 12 | _ = Fraction.from_decimal(Decimal("-4.2")) 13 13 | _ = Fraction.from_decimal(Decimal.from_float(4.2)) @@ -189,6 +205,8 @@ FURB164.py:14:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 16 16 | _ = Decimal.from_float(5.0) 17 17 | _ = decimal.Decimal.from_float(4.2) + Run `ruff check --fix` to apply this fix. + FURB164.py:15:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 13 | _ = Fraction.from_decimal(Decimal.from_float(4.2)) @@ -200,7 +218,7 @@ FURB164.py:15:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -ℹ Safe fix +Suggested fix: 12 12 | _ = Fraction.from_decimal(Decimal("-4.2")) 13 13 | _ = Fraction.from_decimal(Decimal.from_float(4.2)) 14 14 | _ = Decimal.from_float(0.1) @@ -210,6 +228,8 @@ FURB164.py:15:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 17 17 | _ = decimal.Decimal.from_float(4.2) 18 18 | _ = Decimal.from_float(float("inf")) + Run `ruff check --fix` to apply this fix. + FURB164.py:16:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 14 | _ = Decimal.from_float(0.1) @@ -221,7 +241,7 @@ FURB164.py:16:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -ℹ Safe fix +Suggested fix: 13 13 | _ = Fraction.from_decimal(Decimal.from_float(4.2)) 14 14 | _ = Decimal.from_float(0.1) 15 15 | _ = Decimal.from_float(-0.5) @@ -231,6 +251,8 @@ FURB164.py:16:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 18 18 | _ = Decimal.from_float(float("inf")) 19 19 | _ = Decimal.from_float(float("-inf")) + Run `ruff check --fix` to apply this fix. + FURB164.py:17:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 15 | _ = Decimal.from_float(-0.5) @@ -242,7 +264,7 @@ FURB164.py:17:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -ℹ Safe fix +Suggested fix: 14 14 | _ = Decimal.from_float(0.1) 15 15 | _ = Decimal.from_float(-0.5) 16 16 | _ = Decimal.from_float(5.0) @@ -252,6 +274,8 @@ FURB164.py:17:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 19 19 | _ = Decimal.from_float(float("-inf")) 20 20 | _ = Decimal.from_float(float("Infinity")) + Run `ruff check --fix` to apply this fix. + FURB164.py:18:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 16 | _ = Decimal.from_float(5.0) @@ -263,7 +287,7 @@ FURB164.py:18:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -ℹ Safe fix +Suggested fix: 15 15 | _ = Decimal.from_float(-0.5) 16 16 | _ = Decimal.from_float(5.0) 17 17 | _ = decimal.Decimal.from_float(4.2) @@ -273,6 +297,8 @@ FURB164.py:18:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 20 20 | _ = Decimal.from_float(float("Infinity")) 21 21 | _ = Decimal.from_float(float("-Infinity")) + Run `ruff check --fix` to apply this fix. + FURB164.py:19:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 17 | _ = decimal.Decimal.from_float(4.2) @@ -284,7 +310,7 @@ FURB164.py:19:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -ℹ Safe fix +Suggested fix: 16 16 | _ = Decimal.from_float(5.0) 17 17 | _ = decimal.Decimal.from_float(4.2) 18 18 | _ = Decimal.from_float(float("inf")) @@ -294,6 +320,8 @@ FURB164.py:19:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 21 21 | _ = Decimal.from_float(float("-Infinity")) 22 22 | _ = Decimal.from_float(float("nan")) + Run `ruff check --fix` to apply this fix. + FURB164.py:20:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 18 | _ = Decimal.from_float(float("inf")) @@ -305,7 +333,7 @@ FURB164.py:20:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -ℹ Safe fix +Suggested fix: 17 17 | _ = decimal.Decimal.from_float(4.2) 18 18 | _ = Decimal.from_float(float("inf")) 19 19 | _ = Decimal.from_float(float("-inf")) @@ -315,6 +343,8 @@ FURB164.py:20:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 22 22 | _ = Decimal.from_float(float("nan")) 23 23 | + Run `ruff check --fix` to apply this fix. + FURB164.py:21:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 19 | _ = Decimal.from_float(float("-inf")) @@ -325,7 +355,7 @@ FURB164.py:21:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -ℹ Safe fix +Suggested fix: 18 18 | _ = Decimal.from_float(float("inf")) 19 19 | _ = Decimal.from_float(float("-inf")) 20 20 | _ = Decimal.from_float(float("Infinity")) @@ -335,6 +365,8 @@ FURB164.py:21:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 23 23 | 24 24 | # OK + Run `ruff check --fix` to apply this fix. + FURB164.py:22:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 20 | _ = Decimal.from_float(float("Infinity")) @@ -346,7 +378,7 @@ FURB164.py:22:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -ℹ Safe fix +Suggested fix: 19 19 | _ = Decimal.from_float(float("-inf")) 20 20 | _ = Decimal.from_float(float("Infinity")) 21 21 | _ = Decimal.from_float(float("-Infinity")) @@ -355,3 +387,5 @@ FURB164.py:22:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 23 23 | 24 24 | # OK 25 25 | _ = Fraction(0.1) + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap index c78dbdb22cad2..bca5c61a6090e 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap @@ -12,7 +12,7 @@ FURB166.py:3:5: FURB166 [*] Use of `int` with explicit `base=2` after removing p | = help: Replace with `base=0` -ℹ Unsafe fix +Suggested fix: 1 1 | # Errors 2 2 | 3 |-_ = int("0b1010"[2:], 2) @@ -21,6 +21,8 @@ FURB166.py:3:5: FURB166 [*] Use of `int` with explicit `base=2` after removing p 5 5 | _ = int("0xFFFF"[2:], 16) 6 6 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB166.py:4:5: FURB166 [*] Use of `int` with explicit `base=8` after removing prefix | 3 | _ = int("0b1010"[2:], 2) @@ -30,7 +32,7 @@ FURB166.py:4:5: FURB166 [*] Use of `int` with explicit `base=8` after removing p | = help: Replace with `base=0` -ℹ Unsafe fix +Suggested fix: 1 1 | # Errors 2 2 | 3 3 | _ = int("0b1010"[2:], 2) @@ -40,6 +42,8 @@ FURB166.py:4:5: FURB166 [*] Use of `int` with explicit `base=8` after removing p 6 6 | 7 7 | b = "0b11" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB166.py:5:5: FURB166 [*] Use of `int` with explicit `base=16` after removing prefix | 3 | _ = int("0b1010"[2:], 2) @@ -51,7 +55,7 @@ FURB166.py:5:5: FURB166 [*] Use of `int` with explicit `base=16` after removing | = help: Replace with `base=0` -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | _ = int("0b1010"[2:], 2) 4 4 | _ = int("0o777"[2:], 8) @@ -61,6 +65,8 @@ FURB166.py:5:5: FURB166 [*] Use of `int` with explicit `base=16` after removing 7 7 | b = "0b11" 8 8 | _ = int(b[2:], 2) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB166.py:8:5: FURB166 [*] Use of `int` with explicit `base=2` after removing prefix | 7 | b = "0b11" @@ -71,7 +77,7 @@ FURB166.py:8:5: FURB166 [*] Use of `int` with explicit `base=2` after removing p | = help: Replace with `base=0` -ℹ Unsafe fix +Suggested fix: 5 5 | _ = int("0xFFFF"[2:], 16) 6 6 | 7 7 | b = "0b11" @@ -81,6 +87,8 @@ FURB166.py:8:5: FURB166 [*] Use of `int` with explicit `base=2` after removing p 10 10 | _ = int("0xFFFF"[2:], base=16) 11 11 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB166.py:10:5: FURB166 [*] Use of `int` with explicit `base=16` after removing prefix | 8 | _ = int(b[2:], 2) @@ -92,7 +100,7 @@ FURB166.py:10:5: FURB166 [*] Use of `int` with explicit `base=16` after removing | = help: Replace with `base=0` -ℹ Unsafe fix +Suggested fix: 7 7 | b = "0b11" 8 8 | _ = int(b[2:], 2) 9 9 | @@ -102,6 +110,8 @@ FURB166.py:10:5: FURB166 [*] Use of `int` with explicit `base=16` after removing 12 12 | _ = int(b"0xFFFF"[2:], 16) 13 13 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB166.py:12:5: FURB166 [*] Use of `int` with explicit `base=16` after removing prefix | 10 | _ = int("0xFFFF"[2:], base=16) @@ -111,7 +121,7 @@ FURB166.py:12:5: FURB166 [*] Use of `int` with explicit `base=16` after removing | = help: Replace with `base=0` -ℹ Unsafe fix +Suggested fix: 9 9 | 10 10 | _ = int("0xFFFF"[2:], base=16) 11 11 | @@ -121,6 +131,8 @@ FURB166.py:12:5: FURB166 [*] Use of `int` with explicit `base=16` after removing 14 14 | 15 15 | def get_str(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB166.py:19:5: FURB166 [*] Use of `int` with explicit `base=16` after removing prefix | 19 | _ = int(get_str()[2:], 16) @@ -130,7 +142,7 @@ FURB166.py:19:5: FURB166 [*] Use of `int` with explicit `base=16` after removing | = help: Replace with `base=0` -ℹ Unsafe fix +Suggested fix: 16 16 | return "0xFFF" 17 17 | 18 18 | @@ -138,4 +150,6 @@ FURB166.py:19:5: FURB166 [*] Use of `int` with explicit `base=16` after removing 19 |+_ = int(get_str(), 0) 20 20 | 21 21 | # OK -22 22 | +22 22 | + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB167_FURB167.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB167_FURB167.py.snap index a95fff1e098b8..8c3071c521b21 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB167_FURB167.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB167_FURB167.py.snap @@ -10,7 +10,7 @@ FURB167.py:13:42: FURB167 [*] Use of regular expression alias `re.I` | = help: Replace with `re.IGNORECASE` -ℹ Safe fix +Suggested fix: 10 10 | import re 11 11 | 12 12 | # FURB167 @@ -20,6 +20,8 @@ FURB167.py:13:42: FURB167 [*] Use of regular expression alias `re.I` 15 15 | 16 16 | + Run `ruff check --fix` to apply this fix. + FURB167.py:21:39: FURB167 [*] Use of regular expression alias `re.I` | 20 | # FURB167 @@ -29,7 +31,7 @@ FURB167.py:21:39: FURB167 [*] Use of regular expression alias `re.I` | = help: Replace with `re.IGNORECASE` -ℹ Safe fix +Suggested fix: 1 |+import re 1 2 | def func(): 2 3 | import re @@ -42,4 +44,4 @@ FURB167.py:21:39: FURB167 [*] Use of regular expression alias `re.I` 22 |+ if match("^hello", "hello world", re.IGNORECASE): 22 23 | pass - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB168_FURB168.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB168_FURB168.py.snap index 88aa3efb4ea4a..61e03e1a64da6 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB168_FURB168.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB168_FURB168.py.snap @@ -11,7 +11,7 @@ FURB168.py:5:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if a | = help: Replace with `is` operator -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | # Errors. 4 4 | @@ -21,6 +21,8 @@ FURB168.py:5:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if a 7 7 | 8 8 | if isinstance(foo, (type(None))): + Run `ruff check --fix` to apply this fix. + FURB168.py:8:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 6 | pass @@ -31,7 +33,7 @@ FURB168.py:8:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if a | = help: Replace with `is` operator -ℹ Safe fix +Suggested fix: 5 5 | if isinstance(foo, type(None)): 6 6 | pass 7 7 | @@ -41,6 +43,8 @@ FURB168.py:8:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if a 10 10 | 11 11 | if isinstance(foo, (type(None), type(None), type(None))): + Run `ruff check --fix` to apply this fix. + FURB168.py:11:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 9 | pass @@ -51,7 +55,7 @@ FURB168.py:11:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -ℹ Safe fix +Suggested fix: 8 8 | if isinstance(foo, (type(None))): 9 9 | pass 10 10 | @@ -61,6 +65,8 @@ FURB168.py:11:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if 13 13 | 14 14 | if isinstance(foo, None | None): + Run `ruff check --fix` to apply this fix. + FURB168.py:14:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 12 | pass @@ -71,7 +77,7 @@ FURB168.py:14:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -ℹ Safe fix +Suggested fix: 11 11 | if isinstance(foo, (type(None), type(None), type(None))): 12 12 | pass 13 13 | @@ -81,6 +87,8 @@ FURB168.py:14:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if 16 16 | 17 17 | if isinstance(foo, (None | None)): + Run `ruff check --fix` to apply this fix. + FURB168.py:17:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 15 | pass @@ -91,7 +99,7 @@ FURB168.py:17:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -ℹ Safe fix +Suggested fix: 14 14 | if isinstance(foo, None | None): 15 15 | pass 16 16 | @@ -101,6 +109,8 @@ FURB168.py:17:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if 19 19 | 20 20 | if isinstance(foo, None | type(None)): + Run `ruff check --fix` to apply this fix. + FURB168.py:20:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 18 | pass @@ -111,7 +121,7 @@ FURB168.py:20:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -ℹ Safe fix +Suggested fix: 17 17 | if isinstance(foo, (None | None)): 18 18 | pass 19 19 | @@ -121,6 +131,8 @@ FURB168.py:20:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if 22 22 | 23 23 | if isinstance(foo, (None | type(None))): + Run `ruff check --fix` to apply this fix. + FURB168.py:23:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 21 | pass @@ -131,7 +143,7 @@ FURB168.py:23:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -ℹ Safe fix +Suggested fix: 20 20 | if isinstance(foo, None | type(None)): 21 21 | pass 22 22 | @@ -141,6 +153,8 @@ FURB168.py:23:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if 25 25 | 26 26 | # A bit contrived, but is both technically valid and equivalent to the above. + Run `ruff check --fix` to apply this fix. + FURB168.py:27:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 26 | # A bit contrived, but is both technically valid and equivalent to the above. @@ -150,7 +164,7 @@ FURB168.py:27:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -ℹ Safe fix +Suggested fix: 24 24 | pass 25 25 | 26 26 | # A bit contrived, but is both technically valid and equivalent to the above. @@ -160,4 +174,4 @@ FURB168.py:27:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if 29 29 | 30 30 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB169_FURB169.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB169_FURB169.py.snap index ee9ee14f36ef1..959ba376477c2 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB169_FURB169.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB169_FURB169.py.snap @@ -12,7 +12,7 @@ FURB169.py:5:1: FURB169 [*] Compare the identities of `foo` and `None` instead o | = help: Replace with `foo is None` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | # Error. 4 4 | @@ -22,6 +22,8 @@ FURB169.py:5:1: FURB169 [*] Compare the identities of `foo` and `None` instead o 7 7 | type(None) is type(foo) 8 8 | + Run `ruff check --fix` to apply this fix. + FURB169.py:7:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 5 | type(foo) is type(None) @@ -33,7 +35,7 @@ FURB169.py:7:1: FURB169 [*] Compare the identities of `foo` and `None` instead o | = help: Replace with `foo is None` -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | type(foo) is type(None) 6 6 | @@ -43,6 +45,8 @@ FURB169.py:7:1: FURB169 [*] Compare the identities of `foo` and `None` instead o 9 9 | type(None) is type(None) 10 10 | + Run `ruff check --fix` to apply this fix. + FURB169.py:9:1: FURB169 [*] Compare the identities of `None` and `None` instead of their respective types | 7 | type(None) is type(foo) @@ -54,7 +58,7 @@ FURB169.py:9:1: FURB169 [*] Compare the identities of `None` and `None` instead | = help: Replace with `None is None` -ℹ Safe fix +Suggested fix: 6 6 | 7 7 | type(None) is type(foo) 8 8 | @@ -64,6 +68,8 @@ FURB169.py:9:1: FURB169 [*] Compare the identities of `None` and `None` instead 11 11 | type(foo) is not type(None) 12 12 | + Run `ruff check --fix` to apply this fix. + FURB169.py:11:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 9 | type(None) is type(None) @@ -75,7 +81,7 @@ FURB169.py:11:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is not None` -ℹ Safe fix +Suggested fix: 8 8 | 9 9 | type(None) is type(None) 10 10 | @@ -85,6 +91,8 @@ FURB169.py:11:1: FURB169 [*] Compare the identities of `foo` and `None` instead 13 13 | type(None) is not type(foo) 14 14 | + Run `ruff check --fix` to apply this fix. + FURB169.py:13:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 11 | type(foo) is not type(None) @@ -96,7 +104,7 @@ FURB169.py:13:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is not None` -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | type(foo) is not type(None) 12 12 | @@ -106,6 +114,8 @@ FURB169.py:13:1: FURB169 [*] Compare the identities of `foo` and `None` instead 15 15 | type(None) is not type(None) 16 16 | + Run `ruff check --fix` to apply this fix. + FURB169.py:15:1: FURB169 [*] Compare the identities of `None` and `None` instead of their respective types | 13 | type(None) is not type(foo) @@ -117,7 +127,7 @@ FURB169.py:15:1: FURB169 [*] Compare the identities of `None` and `None` instead | = help: Replace with `None is not None` -ℹ Safe fix +Suggested fix: 12 12 | 13 13 | type(None) is not type(foo) 14 14 | @@ -127,6 +137,8 @@ FURB169.py:15:1: FURB169 [*] Compare the identities of `None` and `None` instead 17 17 | type(foo) == type(None) 18 18 | + Run `ruff check --fix` to apply this fix. + FURB169.py:17:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 15 | type(None) is not type(None) @@ -138,7 +150,7 @@ FURB169.py:17:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is None` -ℹ Safe fix +Suggested fix: 14 14 | 15 15 | type(None) is not type(None) 16 16 | @@ -148,6 +160,8 @@ FURB169.py:17:1: FURB169 [*] Compare the identities of `foo` and `None` instead 19 19 | type(None) == type(foo) 20 20 | + Run `ruff check --fix` to apply this fix. + FURB169.py:19:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 17 | type(foo) == type(None) @@ -159,7 +173,7 @@ FURB169.py:19:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is None` -ℹ Safe fix +Suggested fix: 16 16 | 17 17 | type(foo) == type(None) 18 18 | @@ -169,6 +183,8 @@ FURB169.py:19:1: FURB169 [*] Compare the identities of `foo` and `None` instead 21 21 | type(None) == type(None) 22 22 | + Run `ruff check --fix` to apply this fix. + FURB169.py:21:1: FURB169 [*] Compare the identities of `None` and `None` instead of their respective types | 19 | type(None) == type(foo) @@ -180,7 +196,7 @@ FURB169.py:21:1: FURB169 [*] Compare the identities of `None` and `None` instead | = help: Replace with `None is None` -ℹ Safe fix +Suggested fix: 18 18 | 19 19 | type(None) == type(foo) 20 20 | @@ -190,6 +206,8 @@ FURB169.py:21:1: FURB169 [*] Compare the identities of `None` and `None` instead 23 23 | type(foo) != type(None) 24 24 | + Run `ruff check --fix` to apply this fix. + FURB169.py:23:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 21 | type(None) == type(None) @@ -201,7 +219,7 @@ FURB169.py:23:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is not None` -ℹ Safe fix +Suggested fix: 20 20 | 21 21 | type(None) == type(None) 22 22 | @@ -211,6 +229,8 @@ FURB169.py:23:1: FURB169 [*] Compare the identities of `foo` and `None` instead 25 25 | type(None) != type(foo) 26 26 | + Run `ruff check --fix` to apply this fix. + FURB169.py:25:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 23 | type(foo) != type(None) @@ -222,7 +242,7 @@ FURB169.py:25:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is not None` -ℹ Safe fix +Suggested fix: 22 22 | 23 23 | type(foo) != type(None) 24 24 | @@ -232,6 +252,8 @@ FURB169.py:25:1: FURB169 [*] Compare the identities of `foo` and `None` instead 27 27 | type(None) != type(None) 28 28 | + Run `ruff check --fix` to apply this fix. + FURB169.py:27:1: FURB169 [*] Compare the identities of `None` and `None` instead of their respective types | 25 | type(None) != type(foo) @@ -243,7 +265,7 @@ FURB169.py:27:1: FURB169 [*] Compare the identities of `None` and `None` instead | = help: Replace with `None is not None` -ℹ Safe fix +Suggested fix: 24 24 | 25 25 | type(None) != type(foo) 26 26 | @@ -253,4 +275,4 @@ FURB169.py:27:1: FURB169 [*] Compare the identities of `None` and `None` instead 29 29 | # Ok. 30 30 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB171_FURB171.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB171_FURB171.py.snap index 2b29e1e40aa51..fdfd927f4b492 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB171_FURB171.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB171_FURB171.py.snap @@ -11,7 +11,7 @@ FURB171.py:3:4: FURB171 [*] Membership test against single-item container | = help: Convert to equality test -ℹ Safe fix +Suggested fix: 1 1 | # Errors. 2 2 | 3 |-if 1 in (1,): @@ -20,6 +20,8 @@ FURB171.py:3:4: FURB171 [*] Membership test against single-item container 5 5 | 6 6 | if 1 in [1]: + Run `ruff check --fix` to apply this fix. + FURB171.py:6:4: FURB171 [*] Membership test against single-item container | 4 | print("Single-element tuple") @@ -30,7 +32,7 @@ FURB171.py:6:4: FURB171 [*] Membership test against single-item container | = help: Convert to equality test -ℹ Safe fix +Suggested fix: 3 3 | if 1 in (1,): 4 4 | print("Single-element tuple") 5 5 | @@ -40,6 +42,8 @@ FURB171.py:6:4: FURB171 [*] Membership test against single-item container 8 8 | 9 9 | if 1 in {1}: + Run `ruff check --fix` to apply this fix. + FURB171.py:9:4: FURB171 [*] Membership test against single-item container | 7 | print("Single-element list") @@ -50,7 +54,7 @@ FURB171.py:9:4: FURB171 [*] Membership test against single-item container | = help: Convert to equality test -ℹ Safe fix +Suggested fix: 6 6 | if 1 in [1]: 7 7 | print("Single-element list") 8 8 | @@ -60,6 +64,8 @@ FURB171.py:9:4: FURB171 [*] Membership test against single-item container 11 11 | 12 12 | if "a" in "a": + Run `ruff check --fix` to apply this fix. + FURB171.py:12:4: FURB171 [*] Membership test against single-item container | 10 | print("Single-element set") @@ -70,7 +76,7 @@ FURB171.py:12:4: FURB171 [*] Membership test against single-item container | = help: Convert to equality test -ℹ Safe fix +Suggested fix: 9 9 | if 1 in {1}: 10 10 | print("Single-element set") 11 11 | @@ -80,6 +86,8 @@ FURB171.py:12:4: FURB171 [*] Membership test against single-item container 14 14 | 15 15 | if 1 not in (1,): + Run `ruff check --fix` to apply this fix. + FURB171.py:15:4: FURB171 [*] Membership test against single-item container | 13 | print("Single-element string") @@ -90,7 +98,7 @@ FURB171.py:15:4: FURB171 [*] Membership test against single-item container | = help: Convert to inequality test -ℹ Safe fix +Suggested fix: 12 12 | if "a" in "a": 13 13 | print("Single-element string") 14 14 | @@ -100,6 +108,8 @@ FURB171.py:15:4: FURB171 [*] Membership test against single-item container 17 17 | 18 18 | if not 1 in (1,): + Run `ruff check --fix` to apply this fix. + FURB171.py:18:8: FURB171 [*] Membership test against single-item container | 16 | print("Check `not in` membership test") @@ -110,7 +120,7 @@ FURB171.py:18:8: FURB171 [*] Membership test against single-item container | = help: Convert to equality test -ℹ Safe fix +Suggested fix: 15 15 | if 1 not in (1,): 16 16 | print("Check `not in` membership test") 17 17 | @@ -120,4 +130,4 @@ FURB171.py:18:8: FURB171 [*] Membership test against single-item container 20 20 | 21 21 | # Non-errors. - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap index 0d683880efd9d..7d731ac2b2b7d 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap @@ -12,7 +12,7 @@ FURB180.py:7:10: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract b | = help: Replace with `abc.ABC` -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | # Errors 6 6 | @@ -22,6 +22,8 @@ FURB180.py:7:10: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract b 9 9 | def foo(self): pass 10 10 | + Run `ruff check --fix` to apply this fix. + FURB180.py:12:10: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract base class | 12 | class A1(metaclass=ABCMeta): @@ -31,7 +33,7 @@ FURB180.py:12:10: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract | = help: Replace with `abc.ABC` -ℹ Safe fix +Suggested fix: 9 9 | def foo(self): pass 10 10 | 11 11 | @@ -41,6 +43,8 @@ FURB180.py:12:10: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract 14 14 | def foo(self): pass 15 15 | + Run `ruff check --fix` to apply this fix. + FURB180.py:26:18: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract base class | 26 | class A2(B0, B1, metaclass=ABCMeta): @@ -50,7 +54,7 @@ FURB180.py:26:18: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract | = help: Replace with `abc.ABC` -ℹ Safe fix +Suggested fix: 23 23 | pass 24 24 | 25 25 | @@ -60,6 +64,8 @@ FURB180.py:26:18: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract 28 28 | def foo(self): pass 29 29 | + Run `ruff check --fix` to apply this fix. + FURB180.py:31:34: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract base class | 31 | class A3(B0, before_metaclass=1, metaclass=abc.ABCMeta): @@ -68,7 +74,7 @@ FURB180.py:31:34: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract | = help: Replace with `abc.ABC` -ℹ Safe fix +Suggested fix: 28 28 | def foo(self): pass 29 29 | 30 30 | @@ -78,4 +84,4 @@ FURB180.py:31:34: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract 33 33 | 34 34 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap index cca7645c90adf..3bc4220379407 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap @@ -12,7 +12,7 @@ FURB181.py:19:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -ℹ Unsafe fix +Suggested fix: 16 16 | 17 17 | # these will match 18 18 | @@ -22,6 +22,8 @@ FURB181.py:19:1: FURB181 [*] Use of hashlib's `.digest().hex()` 21 21 | md5().digest().hex() 22 22 | sha1().digest().hex() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB181.py:20:1: FURB181 [*] Use of hashlib's `.digest().hex()` | 19 | blake2b().digest().hex() @@ -32,7 +34,7 @@ FURB181.py:20:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -ℹ Unsafe fix +Suggested fix: 17 17 | # these will match 18 18 | 19 19 | blake2b().digest().hex() @@ -42,6 +44,8 @@ FURB181.py:20:1: FURB181 [*] Use of hashlib's `.digest().hex()` 22 22 | sha1().digest().hex() 23 23 | sha224().digest().hex() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB181.py:21:1: FURB181 [*] Use of hashlib's `.digest().hex()` | 19 | blake2b().digest().hex() @@ -53,7 +57,7 @@ FURB181.py:21:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -ℹ Unsafe fix +Suggested fix: 18 18 | 19 19 | blake2b().digest().hex() 20 20 | blake2s().digest().hex() @@ -63,6 +67,8 @@ FURB181.py:21:1: FURB181 [*] Use of hashlib's `.digest().hex()` 23 23 | sha224().digest().hex() 24 24 | sha256().digest().hex() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB181.py:22:1: FURB181 [*] Use of hashlib's `.digest().hex()` | 20 | blake2s().digest().hex() @@ -74,7 +80,7 @@ FURB181.py:22:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -ℹ Unsafe fix +Suggested fix: 19 19 | blake2b().digest().hex() 20 20 | blake2s().digest().hex() 21 21 | md5().digest().hex() @@ -84,6 +90,8 @@ FURB181.py:22:1: FURB181 [*] Use of hashlib's `.digest().hex()` 24 24 | sha256().digest().hex() 25 25 | sha384().digest().hex() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB181.py:23:1: FURB181 [*] Use of hashlib's `.digest().hex()` | 21 | md5().digest().hex() @@ -95,7 +103,7 @@ FURB181.py:23:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -ℹ Unsafe fix +Suggested fix: 20 20 | blake2s().digest().hex() 21 21 | md5().digest().hex() 22 22 | sha1().digest().hex() @@ -105,6 +113,8 @@ FURB181.py:23:1: FURB181 [*] Use of hashlib's `.digest().hex()` 25 25 | sha384().digest().hex() 26 26 | sha3_224().digest().hex() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB181.py:24:1: FURB181 [*] Use of hashlib's `.digest().hex()` | 22 | sha1().digest().hex() @@ -116,7 +126,7 @@ FURB181.py:24:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -ℹ Unsafe fix +Suggested fix: 21 21 | md5().digest().hex() 22 22 | sha1().digest().hex() 23 23 | sha224().digest().hex() @@ -126,6 +136,8 @@ FURB181.py:24:1: FURB181 [*] Use of hashlib's `.digest().hex()` 26 26 | sha3_224().digest().hex() 27 27 | sha3_256().digest().hex() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB181.py:25:1: FURB181 [*] Use of hashlib's `.digest().hex()` | 23 | sha224().digest().hex() @@ -137,7 +149,7 @@ FURB181.py:25:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -ℹ Unsafe fix +Suggested fix: 22 22 | sha1().digest().hex() 23 23 | sha224().digest().hex() 24 24 | sha256().digest().hex() @@ -147,6 +159,8 @@ FURB181.py:25:1: FURB181 [*] Use of hashlib's `.digest().hex()` 27 27 | sha3_256().digest().hex() 28 28 | sha3_384().digest().hex() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB181.py:26:1: FURB181 [*] Use of hashlib's `.digest().hex()` | 24 | sha256().digest().hex() @@ -158,7 +172,7 @@ FURB181.py:26:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -ℹ Unsafe fix +Suggested fix: 23 23 | sha224().digest().hex() 24 24 | sha256().digest().hex() 25 25 | sha384().digest().hex() @@ -168,6 +182,8 @@ FURB181.py:26:1: FURB181 [*] Use of hashlib's `.digest().hex()` 28 28 | sha3_384().digest().hex() 29 29 | sha3_512().digest().hex() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB181.py:27:1: FURB181 [*] Use of hashlib's `.digest().hex()` | 25 | sha384().digest().hex() @@ -179,7 +195,7 @@ FURB181.py:27:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -ℹ Unsafe fix +Suggested fix: 24 24 | sha256().digest().hex() 25 25 | sha384().digest().hex() 26 26 | sha3_224().digest().hex() @@ -189,6 +205,8 @@ FURB181.py:27:1: FURB181 [*] Use of hashlib's `.digest().hex()` 29 29 | sha3_512().digest().hex() 30 30 | sha512().digest().hex() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB181.py:28:1: FURB181 [*] Use of hashlib's `.digest().hex()` | 26 | sha3_224().digest().hex() @@ -200,7 +218,7 @@ FURB181.py:28:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -ℹ Unsafe fix +Suggested fix: 25 25 | sha384().digest().hex() 26 26 | sha3_224().digest().hex() 27 27 | sha3_256().digest().hex() @@ -210,6 +228,8 @@ FURB181.py:28:1: FURB181 [*] Use of hashlib's `.digest().hex()` 30 30 | sha512().digest().hex() 31 31 | shake_128().digest(10).hex() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB181.py:29:1: FURB181 [*] Use of hashlib's `.digest().hex()` | 27 | sha3_256().digest().hex() @@ -221,7 +241,7 @@ FURB181.py:29:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -ℹ Unsafe fix +Suggested fix: 26 26 | sha3_224().digest().hex() 27 27 | sha3_256().digest().hex() 28 28 | sha3_384().digest().hex() @@ -231,6 +251,8 @@ FURB181.py:29:1: FURB181 [*] Use of hashlib's `.digest().hex()` 31 31 | shake_128().digest(10).hex() 32 32 | shake_256().digest(10).hex() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB181.py:30:1: FURB181 [*] Use of hashlib's `.digest().hex()` | 28 | sha3_384().digest().hex() @@ -242,7 +264,7 @@ FURB181.py:30:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -ℹ Unsafe fix +Suggested fix: 27 27 | sha3_256().digest().hex() 28 28 | sha3_384().digest().hex() 29 29 | sha3_512().digest().hex() @@ -252,6 +274,8 @@ FURB181.py:30:1: FURB181 [*] Use of hashlib's `.digest().hex()` 32 32 | shake_256().digest(10).hex() 33 33 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB181.py:31:1: FURB181 Use of hashlib's `.digest().hex()` | 29 | sha3_512().digest().hex() @@ -284,7 +308,7 @@ FURB181.py:34:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -ℹ Unsafe fix +Suggested fix: 31 31 | shake_128().digest(10).hex() 32 32 | shake_256().digest(10).hex() 33 33 | @@ -294,6 +318,8 @@ FURB181.py:34:1: FURB181 [*] Use of hashlib's `.digest().hex()` 36 36 | sha256(b"text").digest().hex() 37 37 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB181.py:36:1: FURB181 [*] Use of hashlib's `.digest().hex()` | 34 | hashlib.sha256().digest().hex() @@ -305,7 +331,7 @@ FURB181.py:36:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -ℹ Unsafe fix +Suggested fix: 33 33 | 34 34 | hashlib.sha256().digest().hex() 35 35 | @@ -315,6 +341,8 @@ FURB181.py:36:1: FURB181 [*] Use of hashlib's `.digest().hex()` 38 38 | hash_algo().digest().hex() 39 39 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB181.py:38:1: FURB181 [*] Use of hashlib's `.digest().hex()` | 36 | sha256(b"text").digest().hex() @@ -326,7 +354,7 @@ FURB181.py:38:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -ℹ Unsafe fix +Suggested fix: 35 35 | 36 36 | sha256(b"text").digest().hex() 37 37 | @@ -336,4 +364,4 @@ FURB181.py:38:1: FURB181 [*] Use of hashlib's `.digest().hex()` 40 40 | # not yet supported 41 41 | h = sha256() - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB187_FURB187.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB187_FURB187.py.snap index e4d08fd9eefbc..987cf596758d3 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB187_FURB187.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB187_FURB187.py.snap @@ -10,7 +10,7 @@ FURB187.py:6:5: FURB187 [*] Use of assignment of `reversed` on list `l` | = help: Replace with `l.reverse()` -ℹ Unsafe fix +Suggested fix: 3 3 | 4 4 | def a(): 5 5 | l = [] @@ -20,6 +20,8 @@ FURB187.py:6:5: FURB187 [*] Use of assignment of `reversed` on list `l` 8 8 | 9 9 | def b(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB187.py:11:5: FURB187 [*] Use of assignment of `reversed` on list `l` | 9 | def b(): @@ -29,7 +31,7 @@ FURB187.py:11:5: FURB187 [*] Use of assignment of `reversed` on list `l` | = help: Replace with `l.reverse()` -ℹ Unsafe fix +Suggested fix: 8 8 | 9 9 | def b(): 10 10 | l = [] @@ -39,6 +41,8 @@ FURB187.py:11:5: FURB187 [*] Use of assignment of `reversed` on list `l` 13 13 | 14 14 | def c(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB187.py:16:5: FURB187 [*] Use of assignment of `reversed` on list `l` | 14 | def c(): @@ -48,7 +52,7 @@ FURB187.py:16:5: FURB187 [*] Use of assignment of `reversed` on list `l` | = help: Replace with `l.reverse()` -ℹ Unsafe fix +Suggested fix: 13 13 | 14 14 | def c(): 15 15 | l = [] @@ -57,3 +61,5 @@ FURB187.py:16:5: FURB187 [*] Use of assignment of `reversed` on list `l` 17 17 | 18 18 | 19 19 | # False negative + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap index 2d962a82b9581..272a47b1f110e 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap @@ -12,7 +12,7 @@ FURB192.py:3:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum | = help: Replace with `min` -ℹ Safe fix +Suggested fix: 1 1 | # Errors 2 2 | 3 |-sorted(l)[0] @@ -21,6 +21,8 @@ FURB192.py:3:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum 5 5 | sorted(l)[-1] 6 6 | + Run `ruff check --fix` to apply this fix. + FURB192.py:5:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum value in a sequence | 3 | sorted(l)[0] @@ -32,7 +34,7 @@ FURB192.py:5:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum | = help: Replace with `max` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | sorted(l)[0] 4 4 | @@ -42,6 +44,8 @@ FURB192.py:5:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum 7 7 | sorted(l, reverse=False)[-1] 8 8 | + Run `ruff check --fix` to apply this fix. + FURB192.py:7:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum value in a sequence | 5 | sorted(l)[-1] @@ -53,7 +57,7 @@ FURB192.py:7:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum | = help: Replace with `max` -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | sorted(l)[-1] 6 6 | @@ -63,6 +67,8 @@ FURB192.py:7:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum 9 9 | sorted(l, key=lambda x: x)[0] 10 10 | + Run `ruff check --fix` to apply this fix. + FURB192.py:9:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence | 7 | sorted(l, reverse=False)[-1] @@ -74,7 +80,7 @@ FURB192.py:9:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum | = help: Replace with `min` -ℹ Safe fix +Suggested fix: 6 6 | 7 7 | sorted(l, reverse=False)[-1] 8 8 | @@ -84,6 +90,8 @@ FURB192.py:9:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum 11 11 | sorted(l, key=key_fn)[0] 12 12 | + Run `ruff check --fix` to apply this fix. + FURB192.py:11:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence | 9 | sorted(l, key=lambda x: x)[0] @@ -95,7 +103,7 @@ FURB192.py:11:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum | = help: Replace with `min` -ℹ Safe fix +Suggested fix: 8 8 | 9 9 | sorted(l, key=lambda x: x)[0] 10 10 | @@ -105,6 +113,8 @@ FURB192.py:11:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum 13 13 | sorted([1, 2, 3])[0] 14 14 | + Run `ruff check --fix` to apply this fix. + FURB192.py:13:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence | 11 | sorted(l, key=key_fn)[0] @@ -116,7 +126,7 @@ FURB192.py:13:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum | = help: Replace with `min` -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | sorted(l, key=key_fn)[0] 12 12 | @@ -126,6 +136,8 @@ FURB192.py:13:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum 15 15 | # Unsafe 16 16 | + Run `ruff check --fix` to apply this fix. + FURB192.py:17:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence | 15 | # Unsafe @@ -137,7 +149,7 @@ FURB192.py:17:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum | = help: Replace with `min` -ℹ Unsafe fix +Suggested fix: 14 14 | 15 15 | # Unsafe 16 16 | @@ -147,6 +159,8 @@ FURB192.py:17:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum 19 19 | sorted(l, reverse=True)[0] 20 20 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB192.py:19:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum value in a sequence | 17 | sorted(l, key=key_fn, reverse=True)[-1] @@ -158,7 +172,7 @@ FURB192.py:19:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum | = help: Replace with `max` -ℹ Unsafe fix +Suggested fix: 16 16 | 17 17 | sorted(l, key=key_fn, reverse=True)[-1] 18 18 | @@ -168,6 +182,8 @@ FURB192.py:19:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum 21 21 | sorted(l, reverse=True)[-1] 22 22 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + FURB192.py:21:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence | 19 | sorted(l, reverse=True)[0] @@ -179,7 +195,7 @@ FURB192.py:21:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum | = help: Replace with `min` -ℹ Unsafe fix +Suggested fix: 18 18 | 19 19 | sorted(l, reverse=True)[0] 20 20 | @@ -187,4 +203,6 @@ FURB192.py:21:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum 21 |+min(l) 22 22 | 23 23 | # Non-errors -24 24 | +24 24 | + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap index 096eceb46b23a..42b3fa75e849f 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap @@ -9,7 +9,7 @@ RUF013_0.py:20:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 17 17 | pass 18 18 | 19 19 | @@ -19,6 +19,8 @@ RUF013_0.py:20:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 22 22 | 23 23 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:24:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 24 | def f(arg: str = None): # RUF013 @@ -27,7 +29,7 @@ RUF013_0.py:24:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 21 21 | pass 22 22 | 23 23 | @@ -37,6 +39,8 @@ RUF013_0.py:24:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 26 26 | 27 27 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:28:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 28 | def f(arg: Tuple[str] = None): # RUF013 @@ -45,7 +49,7 @@ RUF013_0.py:28:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 25 25 | pass 26 26 | 27 27 | @@ -55,6 +59,8 @@ RUF013_0.py:28:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 30 30 | 31 31 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:58:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 58 | def f(arg: Union = None): # RUF013 @@ -63,7 +69,7 @@ RUF013_0.py:58:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 55 55 | pass 56 56 | 57 57 | @@ -73,6 +79,8 @@ RUF013_0.py:58:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 60 60 | 61 61 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:62:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 62 | def f(arg: Union[int] = None): # RUF013 @@ -81,7 +89,7 @@ RUF013_0.py:62:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 59 59 | pass 60 60 | 61 61 | @@ -91,6 +99,8 @@ RUF013_0.py:62:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 64 64 | 65 65 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:66:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 66 | def f(arg: Union[int, str] = None): # RUF013 @@ -99,7 +109,7 @@ RUF013_0.py:66:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 63 63 | pass 64 64 | 65 65 | @@ -109,6 +119,8 @@ RUF013_0.py:66:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 68 68 | 69 69 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:85:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 85 | def f(arg: int | float = None): # RUF013 @@ -117,7 +129,7 @@ RUF013_0.py:85:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 82 82 | pass 83 83 | 84 84 | @@ -127,6 +139,8 @@ RUF013_0.py:85:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 87 87 | 88 88 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:89:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 89 | def f(arg: int | float | str | bytes = None): # RUF013 @@ -135,7 +149,7 @@ RUF013_0.py:89:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 86 86 | pass 87 87 | 88 88 | @@ -145,6 +159,8 @@ RUF013_0.py:89:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 91 91 | 92 92 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:108:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 108 | def f(arg: Literal[1] = None): # RUF013 @@ -153,7 +169,7 @@ RUF013_0.py:108:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 105 105 | pass 106 106 | 107 107 | @@ -163,6 +179,8 @@ RUF013_0.py:108:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 110 110 | 111 111 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:112:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 112 | def f(arg: Literal[1, "foo"] = None): # RUF013 @@ -171,7 +189,7 @@ RUF013_0.py:112:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 109 109 | pass 110 110 | 111 111 | @@ -181,6 +199,8 @@ RUF013_0.py:112:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 114 114 | 115 115 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:131:22: RUF013 [*] PEP 484 prohibits implicit `Optional` | 131 | def f(arg: Annotated[int, ...] = None): # RUF013 @@ -189,7 +209,7 @@ RUF013_0.py:131:22: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 128 128 | pass 129 129 | 130 130 | @@ -199,6 +219,8 @@ RUF013_0.py:131:22: RUF013 [*] PEP 484 prohibits implicit `Optional` 133 133 | 134 134 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:135:32: RUF013 [*] PEP 484 prohibits implicit `Optional` | 135 | def f(arg: Annotated[Annotated[int | str, ...], ...] = None): # RUF013 @@ -207,7 +229,7 @@ RUF013_0.py:135:32: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 132 132 | pass 133 133 | 134 134 | @@ -217,6 +239,8 @@ RUF013_0.py:135:32: RUF013 [*] PEP 484 prohibits implicit `Optional` 137 137 | 138 138 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:151:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | 150 | def f( @@ -227,7 +251,7 @@ RUF013_0.py:151:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 148 148 | 149 149 | 150 150 | def f( @@ -237,6 +261,8 @@ RUF013_0.py:151:11: RUF013 [*] PEP 484 prohibits implicit `Optional` 153 153 | arg3: Literal[1, 2, 3] = None, # RUF013 154 154 | ): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:152:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | 150 | def f( @@ -248,7 +274,7 @@ RUF013_0.py:152:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 149 149 | 150 150 | def f( 151 151 | arg1: int = None, # RUF013 @@ -258,6 +284,8 @@ RUF013_0.py:152:11: RUF013 [*] PEP 484 prohibits implicit `Optional` 154 154 | ): 155 155 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:153:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | 151 | arg1: int = None, # RUF013 @@ -269,7 +297,7 @@ RUF013_0.py:153:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 150 150 | def f( 151 151 | arg1: int = None, # RUF013 152 152 | arg2: Union[int, float] = None, # RUF013 @@ -279,6 +307,8 @@ RUF013_0.py:153:11: RUF013 [*] PEP 484 prohibits implicit `Optional` 155 155 | pass 156 156 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:181:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 181 | def f(arg: Union[Annotated[int, ...], Union[str, bytes]] = None): # RUF013 @@ -287,7 +317,7 @@ RUF013_0.py:181:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 178 178 | pass 179 179 | 180 180 | @@ -297,6 +327,8 @@ RUF013_0.py:181:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 183 183 | 184 184 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:188:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | 188 | def f(arg: "int" = None): # RUF013 @@ -305,7 +337,7 @@ RUF013_0.py:188:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 185 185 | # Quoted 186 186 | 187 187 | @@ -315,6 +347,8 @@ RUF013_0.py:188:13: RUF013 [*] PEP 484 prohibits implicit `Optional` 190 190 | 191 191 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:192:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | 192 | def f(arg: "str" = None): # RUF013 @@ -323,7 +357,7 @@ RUF013_0.py:192:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 189 189 | pass 190 190 | 191 191 | @@ -333,6 +367,8 @@ RUF013_0.py:192:13: RUF013 [*] PEP 484 prohibits implicit `Optional` 194 194 | 195 195 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:196:12: RUF013 PEP 484 prohibits implicit `Optional` | 196 | def f(arg: "st" "r" = None): # RUF013 @@ -349,7 +385,7 @@ RUF013_0.py:204:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 201 201 | pass 202 202 | 203 203 | @@ -357,4 +393,6 @@ RUF013_0.py:204:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 204 |+def f(arg: Optional[Union["int", "str"]] = None): # RUF013 205 205 | pass 206 206 | -207 207 | +207 207 | + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap index b15b7e14094f6..6fd4ad0123f33 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap @@ -9,7 +9,7 @@ RUF013_1.py:4:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Unsafe fix +Suggested fix: 1 1 | # No `typing.Optional` import 2 |+from typing import Optional 2 3 | @@ -17,3 +17,5 @@ RUF013_1.py:4:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 4 |-def f(arg: int = None): # RUF013 5 |+def f(arg: Optional[int] = None): # RUF013 5 6 | pass + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap index 8e9c466eb6f66..6771c68b23d17 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap @@ -52,7 +52,7 @@ RUF005.py:39:7: RUF005 [*] Consider `[1, 2, 3, *foo]` instead of concatenation | = help: Replace with `[1, 2, 3, *foo]` -ℹ Unsafe fix +Suggested fix: 36 36 | yay = Fun().yay 37 37 | 38 38 | foo = [4, 5, 6] @@ -62,6 +62,8 @@ RUF005.py:39:7: RUF005 [*] Consider `[1, 2, 3, *foo]` instead of concatenation 41 41 | quux = (7, 8, 9) + zoob 42 42 | spam = quux + (10, 11, 12) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF005.py:41:8: RUF005 [*] Consider `(7, 8, 9, *zoob)` instead of concatenation | 39 | bar = [1, 2, 3] + foo @@ -73,7 +75,7 @@ RUF005.py:41:8: RUF005 [*] Consider `(7, 8, 9, *zoob)` instead of concatenation | = help: Replace with `(7, 8, 9, *zoob)` -ℹ Unsafe fix +Suggested fix: 38 38 | foo = [4, 5, 6] 39 39 | bar = [1, 2, 3] + foo 40 40 | zoob = tuple(bar) @@ -83,6 +85,8 @@ RUF005.py:41:8: RUF005 [*] Consider `(7, 8, 9, *zoob)` instead of concatenation 43 43 | spom = list(spam) 44 44 | eggs = spom + [13, 14, 15] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF005.py:42:8: RUF005 [*] Consider `(*quux, 10, 11, 12)` instead of concatenation | 40 | zoob = tuple(bar) @@ -94,7 +98,7 @@ RUF005.py:42:8: RUF005 [*] Consider `(*quux, 10, 11, 12)` instead of concatenati | = help: Replace with `(*quux, 10, 11, 12)` -ℹ Unsafe fix +Suggested fix: 39 39 | bar = [1, 2, 3] + foo 40 40 | zoob = tuple(bar) 41 41 | quux = (7, 8, 9) + zoob @@ -104,6 +108,8 @@ RUF005.py:42:8: RUF005 [*] Consider `(*quux, 10, 11, 12)` instead of concatenati 44 44 | eggs = spom + [13, 14, 15] 45 45 | elatement = ("we all say",) + yay() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF005.py:44:8: RUF005 [*] Consider `[*spom, 13, 14, 15]` instead of concatenation | 42 | spam = quux + (10, 11, 12) @@ -115,7 +121,7 @@ RUF005.py:44:8: RUF005 [*] Consider `[*spom, 13, 14, 15]` instead of concatenati | = help: Replace with `[*spom, 13, 14, 15]` -ℹ Unsafe fix +Suggested fix: 41 41 | quux = (7, 8, 9) + zoob 42 42 | spam = quux + (10, 11, 12) 43 43 | spom = list(spam) @@ -125,6 +131,8 @@ RUF005.py:44:8: RUF005 [*] Consider `[*spom, 13, 14, 15]` instead of concatenati 46 46 | excitement = ("we all think",) + Fun().yay() 47 47 | astonishment = ("we all feel",) + Fun.words + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF005.py:45:13: RUF005 [*] Consider `("we all say", *yay())` instead of concatenation | 43 | spom = list(spam) @@ -136,7 +144,7 @@ RUF005.py:45:13: RUF005 [*] Consider `("we all say", *yay())` instead of concate | = help: Replace with `("we all say", *yay())` -ℹ Unsafe fix +Suggested fix: 42 42 | spam = quux + (10, 11, 12) 43 43 | spom = list(spam) 44 44 | eggs = spom + [13, 14, 15] @@ -146,6 +154,8 @@ RUF005.py:45:13: RUF005 [*] Consider `("we all say", *yay())` instead of concate 47 47 | astonishment = ("we all feel",) + Fun.words 48 48 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF005.py:46:14: RUF005 [*] Consider `("we all think", *Fun().yay())` instead of concatenation | 44 | eggs = spom + [13, 14, 15] @@ -156,7 +166,7 @@ RUF005.py:46:14: RUF005 [*] Consider `("we all think", *Fun().yay())` instead of | = help: Replace with `("we all think", *Fun().yay())` -ℹ Unsafe fix +Suggested fix: 43 43 | spom = list(spam) 44 44 | eggs = spom + [13, 14, 15] 45 45 | elatement = ("we all say",) + yay() @@ -166,6 +176,8 @@ RUF005.py:46:14: RUF005 [*] Consider `("we all think", *Fun().yay())` instead of 48 48 | 49 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF005.py:47:16: RUF005 [*] Consider `("we all feel", *Fun.words)` instead of concatenation | 45 | elatement = ("we all say",) + yay() @@ -177,7 +189,7 @@ RUF005.py:47:16: RUF005 [*] Consider `("we all feel", *Fun.words)` instead of co | = help: Replace with `("we all feel", *Fun.words)` -ℹ Unsafe fix +Suggested fix: 44 44 | eggs = spom + [13, 14, 15] 45 45 | elatement = ("we all say",) + yay() 46 46 | excitement = ("we all think",) + Fun().yay() @@ -187,6 +199,8 @@ RUF005.py:47:16: RUF005 [*] Consider `("we all feel", *Fun.words)` instead of co 49 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) 50 50 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF005.py:49:9: RUF005 [*] Consider iterable unpacking instead of concatenation | 47 | astonishment = ("we all feel",) + Fun.words @@ -198,7 +212,7 @@ RUF005.py:49:9: RUF005 [*] Consider iterable unpacking instead of concatenation | = help: Replace with iterable unpacking -ℹ Unsafe fix +Suggested fix: 46 46 | excitement = ("we all think",) + Fun().yay() 47 47 | astonishment = ("we all feel",) + Fun.words 48 48 | @@ -208,6 +222,8 @@ RUF005.py:49:9: RUF005 [*] Consider iterable unpacking instead of concatenation 51 51 | baz = () + zoob 52 52 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF005.py:49:39: RUF005 [*] Consider `("yes", "no", "pants", *zoob)` instead of concatenation | 47 | astonishment = ("we all feel",) + Fun.words @@ -219,7 +235,7 @@ RUF005.py:49:39: RUF005 [*] Consider `("yes", "no", "pants", *zoob)` instead of | = help: Replace with `("yes", "no", "pants", *zoob)` -ℹ Unsafe fix +Suggested fix: 46 46 | excitement = ("we all think",) + Fun().yay() 47 47 | astonishment = ("we all feel",) + Fun.words 48 48 | @@ -229,6 +245,8 @@ RUF005.py:49:39: RUF005 [*] Consider `("yes", "no", "pants", *zoob)` instead of 51 51 | baz = () + zoob 52 52 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF005.py:51:7: RUF005 [*] Consider `(*zoob,)` instead of concatenation | 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) @@ -240,7 +258,7 @@ RUF005.py:51:7: RUF005 [*] Consider `(*zoob,)` instead of concatenation | = help: Replace with `(*zoob,)` -ℹ Unsafe fix +Suggested fix: 48 48 | 49 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) 50 50 | @@ -250,6 +268,8 @@ RUF005.py:51:7: RUF005 [*] Consider `(*zoob,)` instead of concatenation 53 53 | [] + foo + [ 54 54 | ] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF005.py:53:1: RUF005 [*] Consider `[*foo]` instead of concatenation | 51 | baz = () + zoob @@ -262,7 +282,7 @@ RUF005.py:53:1: RUF005 [*] Consider `[*foo]` instead of concatenation | = help: Replace with `[*foo]` -ℹ Unsafe fix +Suggested fix: 50 50 | 51 51 | baz = () + zoob 52 52 | @@ -273,6 +293,8 @@ RUF005.py:53:1: RUF005 [*] Consider `[*foo]` instead of concatenation 56 55 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] 57 56 | pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF005.py:56:15: RUF005 [*] Consider `[sys.executable, "-m", "pylint", *args, path]` instead of concatenation | 54 | ] @@ -284,7 +306,7 @@ RUF005.py:56:15: RUF005 [*] Consider `[sys.executable, "-m", "pylint", *args, pa | = help: Replace with `[sys.executable, "-m", "pylint", *args, path]` -ℹ Unsafe fix +Suggested fix: 53 53 | [] + foo + [ 54 54 | ] 55 55 | @@ -294,6 +316,8 @@ RUF005.py:56:15: RUF005 [*] Consider `[sys.executable, "-m", "pylint", *args, pa 58 58 | b = a + [2, 3] + [4] 59 59 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF005.py:57:21: RUF005 [*] Consider iterable unpacking instead of concatenation | 56 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] @@ -303,7 +327,7 @@ RUF005.py:57:21: RUF005 [*] Consider iterable unpacking instead of concatenation | = help: Replace with iterable unpacking -ℹ Unsafe fix +Suggested fix: 54 54 | ] 55 55 | 56 56 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] @@ -313,6 +337,8 @@ RUF005.py:57:21: RUF005 [*] Consider iterable unpacking instead of concatenation 59 59 | 60 60 | # Uses the non-preferred quote style, which should be retained. + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF005.py:58:5: RUF005 [*] Consider `[*a, 2, 3, 4]` instead of concatenation | 56 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] @@ -324,7 +350,7 @@ RUF005.py:58:5: RUF005 [*] Consider `[*a, 2, 3, 4]` instead of concatenation | = help: Replace with `[*a, 2, 3, 4]` -ℹ Unsafe fix +Suggested fix: 55 55 | 56 56 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] 57 57 | pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) @@ -334,6 +360,8 @@ RUF005.py:58:5: RUF005 [*] Consider `[*a, 2, 3, 4]` instead of concatenation 60 60 | # Uses the non-preferred quote style, which should be retained. 61 61 | f"{a() + ['b']}" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF005.py:61:4: RUF005 [*] Consider `[*a(), 'b']` instead of concatenation | 60 | # Uses the non-preferred quote style, which should be retained. @@ -344,7 +372,7 @@ RUF005.py:61:4: RUF005 [*] Consider `[*a(), 'b']` instead of concatenation | = help: Replace with `[*a(), 'b']` -ℹ Unsafe fix +Suggested fix: 58 58 | b = a + [2, 3] + [4] 59 59 | 60 60 | # Uses the non-preferred quote style, which should be retained. @@ -354,4 +382,4 @@ RUF005.py:61:4: RUF005 [*] Consider `[*a(), 'b']` instead of concatenation 63 63 | ### 64 64 | # Non-errors. - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF010_RUF010.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF010_RUF010.py.snap index fe2e4e3c743be..520eb35b1dcf2 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF010_RUF010.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF010_RUF010.py.snap @@ -10,7 +10,7 @@ RUF010.py:9:4: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Safe fix +Suggested fix: 6 6 | pass 7 7 | 8 8 | @@ -20,6 +20,8 @@ RUF010.py:9:4: RUF010 [*] Use explicit conversion flag 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | + Run `ruff check --fix` to apply this fix. + RUF010.py:9:16: RUF010 [*] Use explicit conversion flag | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 @@ -29,7 +31,7 @@ RUF010.py:9:16: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Safe fix +Suggested fix: 6 6 | pass 7 7 | 8 8 | @@ -39,6 +41,8 @@ RUF010.py:9:16: RUF010 [*] Use explicit conversion flag 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | + Run `ruff check --fix` to apply this fix. + RUF010.py:9:29: RUF010 [*] Use explicit conversion flag | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 @@ -48,7 +52,7 @@ RUF010.py:9:29: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Safe fix +Suggested fix: 6 6 | pass 7 7 | 8 8 | @@ -58,6 +62,8 @@ RUF010.py:9:29: RUF010 [*] Use explicit conversion flag 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | + Run `ruff check --fix` to apply this fix. + RUF010.py:11:4: RUF010 [*] Use explicit conversion flag | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 @@ -69,7 +75,7 @@ RUF010.py:11:4: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Safe fix +Suggested fix: 8 8 | 9 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 10 10 | @@ -79,6 +85,8 @@ RUF010.py:11:4: RUF010 [*] Use explicit conversion flag 13 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 14 14 | + Run `ruff check --fix` to apply this fix. + RUF010.py:11:19: RUF010 [*] Use explicit conversion flag | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 @@ -90,7 +98,7 @@ RUF010.py:11:19: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Safe fix +Suggested fix: 8 8 | 9 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 10 10 | @@ -100,6 +108,8 @@ RUF010.py:11:19: RUF010 [*] Use explicit conversion flag 13 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 14 14 | + Run `ruff check --fix` to apply this fix. + RUF010.py:11:35: RUF010 [*] Use explicit conversion flag | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 @@ -111,7 +121,7 @@ RUF010.py:11:35: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Safe fix +Suggested fix: 8 8 | 9 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 10 10 | @@ -121,6 +131,8 @@ RUF010.py:11:35: RUF010 [*] Use explicit conversion flag 13 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 14 14 | + Run `ruff check --fix` to apply this fix. + RUF010.py:13:5: RUF010 [*] Use explicit conversion flag | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 @@ -132,7 +144,7 @@ RUF010.py:13:5: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | @@ -142,6 +154,8 @@ RUF010.py:13:5: RUF010 [*] Use explicit conversion flag 15 15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}" # RUF010 16 16 | + Run `ruff check --fix` to apply this fix. + RUF010.py:13:19: RUF010 [*] Use explicit conversion flag | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 @@ -153,7 +167,7 @@ RUF010.py:13:19: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | @@ -163,6 +177,8 @@ RUF010.py:13:19: RUF010 [*] Use explicit conversion flag 15 15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}" # RUF010 16 16 | + Run `ruff check --fix` to apply this fix. + RUF010.py:13:34: RUF010 [*] Use explicit conversion flag | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 @@ -174,7 +190,7 @@ RUF010.py:13:34: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | @@ -184,6 +200,8 @@ RUF010.py:13:34: RUF010 [*] Use explicit conversion flag 15 15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}" # RUF010 16 16 | + Run `ruff check --fix` to apply this fix. + RUF010.py:15:14: RUF010 [*] Use explicit conversion flag | 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 @@ -195,7 +213,7 @@ RUF010.py:15:14: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Safe fix +Suggested fix: 12 12 | 13 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 14 14 | @@ -205,6 +223,8 @@ RUF010.py:15:14: RUF010 [*] Use explicit conversion flag 17 17 | f"{foo(bla)}" # OK 18 18 | + Run `ruff check --fix` to apply this fix. + RUF010.py:15:29: RUF010 [*] Use explicit conversion flag | 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 @@ -216,7 +236,7 @@ RUF010.py:15:29: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Safe fix +Suggested fix: 12 12 | 13 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 14 14 | @@ -226,6 +246,8 @@ RUF010.py:15:29: RUF010 [*] Use explicit conversion flag 17 17 | f"{foo(bla)}" # OK 18 18 | + Run `ruff check --fix` to apply this fix. + RUF010.py:35:20: RUF010 [*] Use explicit conversion flag | 33 | f"Member of tuple mismatches type at index {i}. Expected {of_shape_i}. Got " @@ -236,7 +258,7 @@ RUF010.py:35:20: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Safe fix +Suggested fix: 32 32 | ( 33 33 | f"Member of tuple mismatches type at index {i}. Expected {of_shape_i}. Got " 34 34 | " intermediary content " @@ -246,4 +268,4 @@ RUF010.py:35:20: RUF010 [*] Use explicit conversion flag 37 37 | 38 38 | - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap index 50bcc3df25e9f..50c10703aa812 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap @@ -9,7 +9,7 @@ RUF013_0.py:20:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 17 17 | pass 18 18 | 19 19 | @@ -19,6 +19,8 @@ RUF013_0.py:20:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 22 22 | 23 23 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:24:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 24 | def f(arg: str = None): # RUF013 @@ -27,7 +29,7 @@ RUF013_0.py:24:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 21 21 | pass 22 22 | 23 23 | @@ -37,6 +39,8 @@ RUF013_0.py:24:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 26 26 | 27 27 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:28:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 28 | def f(arg: Tuple[str] = None): # RUF013 @@ -45,7 +49,7 @@ RUF013_0.py:28:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 25 25 | pass 26 26 | 27 27 | @@ -55,6 +59,8 @@ RUF013_0.py:28:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 30 30 | 31 31 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:58:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 58 | def f(arg: Union = None): # RUF013 @@ -63,7 +69,7 @@ RUF013_0.py:58:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 55 55 | pass 56 56 | 57 57 | @@ -73,6 +79,8 @@ RUF013_0.py:58:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 60 60 | 61 61 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:62:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 62 | def f(arg: Union[int] = None): # RUF013 @@ -81,7 +89,7 @@ RUF013_0.py:62:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 59 59 | pass 60 60 | 61 61 | @@ -91,6 +99,8 @@ RUF013_0.py:62:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 64 64 | 65 65 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:66:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 66 | def f(arg: Union[int, str] = None): # RUF013 @@ -99,7 +109,7 @@ RUF013_0.py:66:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 63 63 | pass 64 64 | 65 65 | @@ -109,6 +119,8 @@ RUF013_0.py:66:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 68 68 | 69 69 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:85:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 85 | def f(arg: int | float = None): # RUF013 @@ -117,7 +129,7 @@ RUF013_0.py:85:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 82 82 | pass 83 83 | 84 84 | @@ -127,6 +139,8 @@ RUF013_0.py:85:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 87 87 | 88 88 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:89:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 89 | def f(arg: int | float | str | bytes = None): # RUF013 @@ -135,7 +149,7 @@ RUF013_0.py:89:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 86 86 | pass 87 87 | 88 88 | @@ -145,6 +159,8 @@ RUF013_0.py:89:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 91 91 | 92 92 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:108:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 108 | def f(arg: Literal[1] = None): # RUF013 @@ -153,7 +169,7 @@ RUF013_0.py:108:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 105 105 | pass 106 106 | 107 107 | @@ -163,6 +179,8 @@ RUF013_0.py:108:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 110 110 | 111 111 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:112:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 112 | def f(arg: Literal[1, "foo"] = None): # RUF013 @@ -171,7 +189,7 @@ RUF013_0.py:112:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 109 109 | pass 110 110 | 111 111 | @@ -181,6 +199,8 @@ RUF013_0.py:112:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 114 114 | 115 115 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:131:22: RUF013 [*] PEP 484 prohibits implicit `Optional` | 131 | def f(arg: Annotated[int, ...] = None): # RUF013 @@ -189,7 +209,7 @@ RUF013_0.py:131:22: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 128 128 | pass 129 129 | 130 130 | @@ -199,6 +219,8 @@ RUF013_0.py:131:22: RUF013 [*] PEP 484 prohibits implicit `Optional` 133 133 | 134 134 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:135:32: RUF013 [*] PEP 484 prohibits implicit `Optional` | 135 | def f(arg: Annotated[Annotated[int | str, ...], ...] = None): # RUF013 @@ -207,7 +229,7 @@ RUF013_0.py:135:32: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 132 132 | pass 133 133 | 134 134 | @@ -217,6 +239,8 @@ RUF013_0.py:135:32: RUF013 [*] PEP 484 prohibits implicit `Optional` 137 137 | 138 138 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:151:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | 150 | def f( @@ -227,7 +251,7 @@ RUF013_0.py:151:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 148 148 | 149 149 | 150 150 | def f( @@ -237,6 +261,8 @@ RUF013_0.py:151:11: RUF013 [*] PEP 484 prohibits implicit `Optional` 153 153 | arg3: Literal[1, 2, 3] = None, # RUF013 154 154 | ): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:152:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | 150 | def f( @@ -248,7 +274,7 @@ RUF013_0.py:152:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 149 149 | 150 150 | def f( 151 151 | arg1: int = None, # RUF013 @@ -258,6 +284,8 @@ RUF013_0.py:152:11: RUF013 [*] PEP 484 prohibits implicit `Optional` 154 154 | ): 155 155 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:153:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | 151 | arg1: int = None, # RUF013 @@ -269,7 +297,7 @@ RUF013_0.py:153:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 150 150 | def f( 151 151 | arg1: int = None, # RUF013 152 152 | arg2: Union[int, float] = None, # RUF013 @@ -279,6 +307,8 @@ RUF013_0.py:153:11: RUF013 [*] PEP 484 prohibits implicit `Optional` 155 155 | pass 156 156 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:181:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 181 | def f(arg: Union[Annotated[int, ...], Union[str, bytes]] = None): # RUF013 @@ -287,7 +317,7 @@ RUF013_0.py:181:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 178 178 | pass 179 179 | 180 180 | @@ -297,6 +327,8 @@ RUF013_0.py:181:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 183 183 | 184 184 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:188:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | 188 | def f(arg: "int" = None): # RUF013 @@ -305,7 +337,7 @@ RUF013_0.py:188:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 185 185 | # Quoted 186 186 | 187 187 | @@ -315,6 +347,8 @@ RUF013_0.py:188:13: RUF013 [*] PEP 484 prohibits implicit `Optional` 190 190 | 191 191 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:192:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | 192 | def f(arg: "str" = None): # RUF013 @@ -323,7 +357,7 @@ RUF013_0.py:192:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 189 189 | pass 190 190 | 191 191 | @@ -333,6 +367,8 @@ RUF013_0.py:192:13: RUF013 [*] PEP 484 prohibits implicit `Optional` 194 194 | 195 195 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_0.py:196:12: RUF013 PEP 484 prohibits implicit `Optional` | 196 | def f(arg: "st" "r" = None): # RUF013 @@ -349,7 +385,7 @@ RUF013_0.py:204:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 201 201 | pass 202 202 | 203 203 | @@ -357,4 +393,6 @@ RUF013_0.py:204:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 204 |+def f(arg: Union["int", "str"] | None = None): # RUF013 205 205 | pass 206 206 | -207 207 | +207 207 | + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap index f2bf264ff57d4..dcd89b6fc6832 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap @@ -9,10 +9,12 @@ RUF013_1.py:4:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 1 1 | # No `typing.Optional` import 2 2 | 3 3 | 4 |-def f(arg: int = None): # RUF013 4 |+def f(arg: int | None = None): # RUF013 5 5 | pass + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_3.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_3.py.snap index f8172df9aafe2..b4b3c5924a2a3 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_3.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_3.py.snap @@ -9,7 +9,7 @@ RUF013_3.py:4:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 1 1 | import typing 2 2 | 3 3 | @@ -19,6 +19,8 @@ RUF013_3.py:4:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 6 6 | 7 7 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_3.py:22:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 22 | def f(arg: typing.Union[int, str] = None): # RUF013 @@ -27,7 +29,7 @@ RUF013_3.py:22:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 19 19 | pass 20 20 | 21 21 | @@ -37,6 +39,8 @@ RUF013_3.py:22:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 24 24 | 25 25 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF013_3.py:29:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 29 | def f(arg: typing.Literal[1, "foo", True] = None): # RUF013 @@ -45,10 +49,12 @@ RUF013_3.py:29:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Unsafe fix +Suggested fix: 26 26 | # Literal 27 27 | 28 28 | 29 |-def f(arg: typing.Literal[1, "foo", True] = None): # RUF013 29 |+def f(arg: typing.Literal[1, "foo", True] | None = None): # RUF013 30 30 | pass + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap index 7500f39c81f82..47070a7319fae 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap @@ -11,7 +11,7 @@ RUF015.py:4:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -ℹ Unsafe fix +Suggested fix: 1 1 | x = range(10) 2 2 | 3 3 | # RUF015 @@ -21,6 +21,8 @@ RUF015.py:4:1: RUF015 [*] Prefer `next(iter(x))` over single element slice 6 6 | list(i for i in x)[0] 7 7 | [i for i in x][0] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:5:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | 3 | # RUF015 @@ -32,7 +34,7 @@ RUF015.py:5:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | # RUF015 4 4 | list(x)[0] @@ -42,6 +44,8 @@ RUF015.py:5:1: RUF015 [*] Prefer `next(iter(x))` over single element slice 7 7 | [i for i in x][0] 8 8 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:6:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | 4 | list(x)[0] @@ -52,7 +56,7 @@ RUF015.py:6:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -ℹ Unsafe fix +Suggested fix: 3 3 | # RUF015 4 4 | list(x)[0] 5 5 | tuple(x)[0] @@ -62,6 +66,8 @@ RUF015.py:6:1: RUF015 [*] Prefer `next(iter(x))` over single element slice 8 8 | 9 9 | # OK (not indexing (solely) the first element) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:7:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | 5 | tuple(x)[0] @@ -73,7 +79,7 @@ RUF015.py:7:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -ℹ Unsafe fix +Suggested fix: 4 4 | list(x)[0] 5 5 | tuple(x)[0] 6 6 | list(i for i in x)[0] @@ -83,6 +89,8 @@ RUF015.py:7:1: RUF015 [*] Prefer `next(iter(x))` over single element slice 9 9 | # OK (not indexing (solely) the first element) 10 10 | list(x) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:29:1: RUF015 [*] Prefer `next(i + 1 for i in x)` over single element slice | 28 | # RUF015 (doesn't mirror the underlying list) @@ -93,7 +101,7 @@ RUF015.py:29:1: RUF015 [*] Prefer `next(i + 1 for i in x)` over single element s | = help: Replace with `next(i + 1 for i in x)` -ℹ Unsafe fix +Suggested fix: 26 26 | [i for i in x][::] 27 27 | 28 28 | # RUF015 (doesn't mirror the underlying list) @@ -103,6 +111,8 @@ RUF015.py:29:1: RUF015 [*] Prefer `next(i + 1 for i in x)` over single element s 31 31 | [(i, i + 1) for i in x][0] 32 32 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:30:1: RUF015 [*] Prefer `next(i for i in x if i > 5)` over single element slice | 28 | # RUF015 (doesn't mirror the underlying list) @@ -113,7 +123,7 @@ RUF015.py:30:1: RUF015 [*] Prefer `next(i for i in x if i > 5)` over single elem | = help: Replace with `next(i for i in x if i > 5)` -ℹ Unsafe fix +Suggested fix: 27 27 | 28 28 | # RUF015 (doesn't mirror the underlying list) 29 29 | [i + 1 for i in x][0] @@ -123,6 +133,8 @@ RUF015.py:30:1: RUF015 [*] Prefer `next(i for i in x if i > 5)` over single elem 32 32 | 33 33 | # RUF015 (multiple generators) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:31:1: RUF015 [*] Prefer `next((i, i + 1) for i in x)` over single element slice | 29 | [i + 1 for i in x][0] @@ -134,7 +146,7 @@ RUF015.py:31:1: RUF015 [*] Prefer `next((i, i + 1) for i in x)` over single elem | = help: Replace with `next((i, i + 1) for i in x)` -ℹ Unsafe fix +Suggested fix: 28 28 | # RUF015 (doesn't mirror the underlying list) 29 29 | [i + 1 for i in x][0] 30 30 | [i for i in x if i > 5][0] @@ -144,6 +156,8 @@ RUF015.py:31:1: RUF015 [*] Prefer `next((i, i + 1) for i in x)` over single elem 33 33 | # RUF015 (multiple generators) 34 34 | y = range(10) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:35:1: RUF015 [*] Prefer `next(i + j for i in x for j in y)` over single element slice | 33 | # RUF015 (multiple generators) @@ -155,7 +169,7 @@ RUF015.py:35:1: RUF015 [*] Prefer `next(i + j for i in x for j in y)` over singl | = help: Replace with `next(i + j for i in x for j in y)` -ℹ Unsafe fix +Suggested fix: 32 32 | 33 33 | # RUF015 (multiple generators) 34 34 | y = range(10) @@ -165,6 +179,8 @@ RUF015.py:35:1: RUF015 [*] Prefer `next(i + j for i in x for j in y)` over singl 37 37 | # RUF015 38 38 | list(range(10))[0] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:38:1: RUF015 [*] Prefer `next(iter(range(10)))` over single element slice | 37 | # RUF015 @@ -175,7 +191,7 @@ RUF015.py:38:1: RUF015 [*] Prefer `next(iter(range(10)))` over single element sl | = help: Replace with `next(iter(range(10)))` -ℹ Unsafe fix +Suggested fix: 35 35 | [i + j for i in x for j in y][0] 36 36 | 37 37 | # RUF015 @@ -185,6 +201,8 @@ RUF015.py:38:1: RUF015 [*] Prefer `next(iter(range(10)))` over single element sl 40 40 | list(x["y"])[0] 41 41 | [*range(10)][0] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:39:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | 37 | # RUF015 @@ -196,7 +214,7 @@ RUF015.py:39:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | = help: Replace with `next(iter(x.y))` -ℹ Unsafe fix +Suggested fix: 36 36 | 37 37 | # RUF015 38 38 | list(range(10))[0] @@ -206,6 +224,8 @@ RUF015.py:39:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice 41 41 | [*range(10)][0] 42 42 | [*x["y"]][0] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:40:1: RUF015 [*] Prefer `next(iter(x["y"]))` over single element slice | 38 | list(range(10))[0] @@ -217,7 +237,7 @@ RUF015.py:40:1: RUF015 [*] Prefer `next(iter(x["y"]))` over single element slice | = help: Replace with `next(iter(x["y"]))` -ℹ Unsafe fix +Suggested fix: 37 37 | # RUF015 38 38 | list(range(10))[0] 39 39 | list(x.y)[0] @@ -227,6 +247,8 @@ RUF015.py:40:1: RUF015 [*] Prefer `next(iter(x["y"]))` over single element slice 42 42 | [*x["y"]][0] 43 43 | [*x.y][0] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:41:1: RUF015 [*] Prefer `next(iter(range(10)))` over single element slice | 39 | list(x.y)[0] @@ -238,7 +260,7 @@ RUF015.py:41:1: RUF015 [*] Prefer `next(iter(range(10)))` over single element sl | = help: Replace with `next(iter(range(10)))` -ℹ Unsafe fix +Suggested fix: 38 38 | list(range(10))[0] 39 39 | list(x.y)[0] 40 40 | list(x["y"])[0] @@ -248,6 +270,8 @@ RUF015.py:41:1: RUF015 [*] Prefer `next(iter(range(10)))` over single element sl 43 43 | [*x.y][0] 44 44 | [* x.y][0] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:42:1: RUF015 [*] Prefer `next(iter(x["y"]))` over single element slice | 40 | list(x["y"])[0] @@ -259,7 +283,7 @@ RUF015.py:42:1: RUF015 [*] Prefer `next(iter(x["y"]))` over single element slice | = help: Replace with `next(iter(x["y"]))` -ℹ Unsafe fix +Suggested fix: 39 39 | list(x.y)[0] 40 40 | list(x["y"])[0] 41 41 | [*range(10)][0] @@ -269,6 +293,8 @@ RUF015.py:42:1: RUF015 [*] Prefer `next(iter(x["y"]))` over single element slice 44 44 | [* x.y][0] 45 45 | [ + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:43:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | 41 | [*range(10)][0] @@ -280,7 +306,7 @@ RUF015.py:43:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | = help: Replace with `next(iter(x.y))` -ℹ Unsafe fix +Suggested fix: 40 40 | list(x["y"])[0] 41 41 | [*range(10)][0] 42 42 | [*x["y"]][0] @@ -290,6 +316,8 @@ RUF015.py:43:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice 45 45 | [ 46 46 | *x.y + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:44:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | 42 | [*x["y"]][0] @@ -301,7 +329,7 @@ RUF015.py:44:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | = help: Replace with `next(iter(x.y))` -ℹ Unsafe fix +Suggested fix: 41 41 | [*range(10)][0] 42 42 | [*x["y"]][0] 43 43 | [*x.y][0] @@ -311,6 +339,8 @@ RUF015.py:44:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice 46 46 | *x.y 47 47 | ][0] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:45:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | 43 | [*x.y][0] @@ -324,7 +354,7 @@ RUF015.py:45:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | = help: Replace with `next(iter(x.y))` -ℹ Unsafe fix +Suggested fix: 42 42 | [*x["y"]][0] 43 43 | [*x.y][0] 44 44 | [* x.y][0] @@ -336,6 +366,8 @@ RUF015.py:45:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice 49 47 | # RUF015 (multi-line) 50 48 | revision_heads_map_ast = [ + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:50:26: RUF015 [*] Prefer `next(...)` over single element slice | 49 | # RUF015 (multi-line) @@ -351,7 +383,7 @@ RUF015.py:50:26: RUF015 [*] Prefer `next(...)` over single element slice | = help: Replace with `next(...)` -ℹ Unsafe fix +Suggested fix: 47 47 | ][0] 48 48 | 49 49 | # RUF015 (multi-line) @@ -366,6 +398,8 @@ RUF015.py:50:26: RUF015 [*] Prefer `next(...)` over single element slice 56 56 | # RUF015 (zip) 57 57 | list(zip(x, y))[0] + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:57:1: RUF015 [*] Prefer `next(zip(x, y))` over single element slice | 56 | # RUF015 (zip) @@ -375,7 +409,7 @@ RUF015.py:57:1: RUF015 [*] Prefer `next(zip(x, y))` over single element slice | = help: Replace with `next(zip(x, y))` -ℹ Unsafe fix +Suggested fix: 54 54 | ][0] 55 55 | 56 56 | # RUF015 (zip) @@ -385,6 +419,8 @@ RUF015.py:57:1: RUF015 [*] Prefer `next(zip(x, y))` over single element slice 59 59 | 60 60 | # RUF015 (pop) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:58:1: RUF015 [*] Prefer `next(zip(x, y))` over single element slice | 56 | # RUF015 (zip) @@ -396,7 +432,7 @@ RUF015.py:58:1: RUF015 [*] Prefer `next(zip(x, y))` over single element slice | = help: Replace with `next(zip(x, y))` -ℹ Unsafe fix +Suggested fix: 55 55 | 56 56 | # RUF015 (zip) 57 57 | list(zip(x, y))[0] @@ -406,6 +442,8 @@ RUF015.py:58:1: RUF015 [*] Prefer `next(zip(x, y))` over single element slice 60 60 | # RUF015 (pop) 61 61 | list(x).pop(0) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:61:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | 60 | # RUF015 (pop) @@ -416,7 +454,7 @@ RUF015.py:61:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -ℹ Unsafe fix +Suggested fix: 58 58 | [*zip(x, y)][0] 59 59 | 60 60 | # RUF015 (pop) @@ -426,6 +464,8 @@ RUF015.py:61:1: RUF015 [*] Prefer `next(iter(x))` over single element slice 63 63 | list(i for i in x).pop(0) 64 64 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:62:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | 60 | # RUF015 (pop) @@ -436,7 +476,7 @@ RUF015.py:62:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -ℹ Unsafe fix +Suggested fix: 59 59 | 60 60 | # RUF015 (pop) 61 61 | list(x).pop(0) @@ -446,6 +486,8 @@ RUF015.py:62:1: RUF015 [*] Prefer `next(iter(x))` over single element slice 64 64 | 65 65 | # OK + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:63:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | 61 | list(x).pop(0) @@ -457,7 +499,7 @@ RUF015.py:63:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -ℹ Unsafe fix +Suggested fix: 60 60 | # RUF015 (pop) 61 61 | list(x).pop(0) 62 62 | [i for i in x].pop(0) @@ -467,6 +509,8 @@ RUF015.py:63:1: RUF015 [*] Prefer `next(iter(x))` over single element slice 65 65 | # OK 66 66 | list(x).pop(1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF015.py:73:5: RUF015 [*] Prefer `next(iter(zip(x, y)))` over single element slice | 71 | def test(): @@ -476,9 +520,11 @@ RUF015.py:73:5: RUF015 [*] Prefer `next(iter(zip(x, y)))` over single element sl | = help: Replace with `next(iter(zip(x, y)))` -ℹ Unsafe fix +Suggested fix: 70 70 | 71 71 | def test(): 72 72 | zip = list # Overwrite the builtin zip 73 |- list(zip(x, y))[0] 73 |+ next(iter(zip(x, y))) + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap index aad3c2fed9103..7617a5cfe2f93 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap @@ -11,7 +11,7 @@ RUF017_0.py:5:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -ℹ Unsafe fix +Suggested fix: 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] @@ -24,6 +24,8 @@ RUF017_0.py:5:1: RUF017 [*] Avoid quadratic list summation 7 9 | sum([[1, 2, 3], [4, 5, 6]], start=[]) 8 10 | sum([[1, 2, 3], [4, 5, 6]], []) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF017_0.py:6:1: RUF017 [*] Avoid quadratic list summation | 4 | # RUF017 @@ -35,7 +37,7 @@ RUF017_0.py:6:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -ℹ Unsafe fix +Suggested fix: 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] @@ -49,6 +51,8 @@ RUF017_0.py:6:1: RUF017 [*] Avoid quadratic list summation 8 10 | sum([[1, 2, 3], [4, 5, 6]], []) 9 11 | sum([[1, 2, 3], [4, 5, 6]], + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF017_0.py:7:1: RUF017 [*] Avoid quadratic list summation | 5 | sum([x, y], start=[]) @@ -60,7 +64,7 @@ RUF017_0.py:7:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -ℹ Unsafe fix +Suggested fix: 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] @@ -75,6 +79,8 @@ RUF017_0.py:7:1: RUF017 [*] Avoid quadratic list summation 9 11 | sum([[1, 2, 3], [4, 5, 6]], 10 12 | []) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF017_0.py:8:1: RUF017 [*] Avoid quadratic list summation | 6 | sum([x, y], []) @@ -86,7 +92,7 @@ RUF017_0.py:8:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -ℹ Unsafe fix +Suggested fix: 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] @@ -102,6 +108,8 @@ RUF017_0.py:8:1: RUF017 [*] Avoid quadratic list summation 10 12 | []) 11 13 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF017_0.py:9:1: RUF017 [*] Avoid quadratic list summation | 7 | sum([[1, 2, 3], [4, 5, 6]], start=[]) @@ -114,7 +122,7 @@ RUF017_0.py:9:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -ℹ Unsafe fix +Suggested fix: 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] @@ -131,6 +139,8 @@ RUF017_0.py:9:1: RUF017 [*] Avoid quadratic list summation 12 13 | # OK 13 14 | sum([x, y]) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF017_0.py:21:5: RUF017 [*] Avoid quadratic list summation | 19 | import functools, operator @@ -140,7 +150,7 @@ RUF017_0.py:21:5: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -ℹ Unsafe fix +Suggested fix: 18 18 | def func(): 19 19 | import functools, operator 20 20 | @@ -150,6 +160,8 @@ RUF017_0.py:21:5: RUF017 [*] Avoid quadratic list summation 23 23 | 24 24 | # Regression test for: https://github.com/astral-sh/ruff/issues/7718 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF017_0.py:26:5: RUF017 [*] Avoid quadratic list summation | 24 | # Regression test for: https://github.com/astral-sh/ruff/issues/7718 @@ -159,7 +171,7 @@ RUF017_0.py:26:5: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -ℹ Unsafe fix +Suggested fix: 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] @@ -172,4 +184,4 @@ RUF017_0.py:26:5: RUF017 [*] Avoid quadratic list summation 26 |- sum((factor.dims for factor in bases), []) 28 |+ functools.reduce(operator.iadd, (factor.dims for factor in bases), []) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap index ff3b145e56799..5ad2325da20ba 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap @@ -8,10 +8,10 @@ RUF017_1.py:1:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -ℹ Unsafe fix +Suggested fix: 1 |-sum((factor.dims for factor in bases), []) 1 |+import functools 2 |+import operator 3 |+functools.reduce(operator.iadd, (factor.dims for factor in bases), []) - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF019_RUF019.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF019_RUF019.py.snap index f536eb250ac13..51fb832c1d9e5 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF019_RUF019.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF019_RUF019.py.snap @@ -11,7 +11,7 @@ RUF019.py:3:4: RUF019 [*] Unnecessary key check before dictionary access | = help: Replace with `dict.get` -ℹ Safe fix +Suggested fix: 1 1 | d = {} 2 2 | # RUF019 3 |-if "k" in d and d["k"]: @@ -20,6 +20,8 @@ RUF019.py:3:4: RUF019 [*] Unnecessary key check before dictionary access 5 5 | 6 6 | k = "k" + Run `ruff check --fix` to apply this fix. + RUF019.py:7:4: RUF019 [*] Unnecessary key check before dictionary access | 6 | k = "k" @@ -29,7 +31,7 @@ RUF019.py:7:4: RUF019 [*] Unnecessary key check before dictionary access | = help: Replace with `dict.get` -ℹ Safe fix +Suggested fix: 4 4 | pass 5 5 | 6 6 | k = "k" @@ -39,6 +41,8 @@ RUF019.py:7:4: RUF019 [*] Unnecessary key check before dictionary access 9 9 | 10 10 | if (k) in d and d[k]: + Run `ruff check --fix` to apply this fix. + RUF019.py:10:4: RUF019 [*] Unnecessary key check before dictionary access | 8 | pass @@ -49,7 +53,7 @@ RUF019.py:10:4: RUF019 [*] Unnecessary key check before dictionary access | = help: Replace with `dict.get` -ℹ Safe fix +Suggested fix: 7 7 | if k in d and d[k]: 8 8 | pass 9 9 | @@ -59,6 +63,8 @@ RUF019.py:10:4: RUF019 [*] Unnecessary key check before dictionary access 12 12 | 13 13 | if k in d and d[(k)]: + Run `ruff check --fix` to apply this fix. + RUF019.py:13:4: RUF019 [*] Unnecessary key check before dictionary access | 11 | pass @@ -69,7 +75,7 @@ RUF019.py:13:4: RUF019 [*] Unnecessary key check before dictionary access | = help: Replace with `dict.get` -ℹ Safe fix +Suggested fix: 10 10 | if (k) in d and d[k]: 11 11 | pass 12 12 | @@ -79,6 +85,8 @@ RUF019.py:13:4: RUF019 [*] Unnecessary key check before dictionary access 15 15 | 16 16 | not ("key" in dct and dct["key"]) + Run `ruff check --fix` to apply this fix. + RUF019.py:16:6: RUF019 [*] Unnecessary key check before dictionary access | 14 | pass @@ -90,7 +98,7 @@ RUF019.py:16:6: RUF019 [*] Unnecessary key check before dictionary access | = help: Replace with `dict.get` -ℹ Safe fix +Suggested fix: 13 13 | if k in d and d[(k)]: 14 14 | pass 15 15 | @@ -100,6 +108,8 @@ RUF019.py:16:6: RUF019 [*] Unnecessary key check before dictionary access 18 18 | bool("key" in dct and dct["key"]) 19 19 | + Run `ruff check --fix` to apply this fix. + RUF019.py:18:6: RUF019 [*] Unnecessary key check before dictionary access | 16 | not ("key" in dct and dct["key"]) @@ -111,7 +121,7 @@ RUF019.py:18:6: RUF019 [*] Unnecessary key check before dictionary access | = help: Replace with `dict.get` -ℹ Safe fix +Suggested fix: 15 15 | 16 16 | not ("key" in dct and dct["key"]) 17 17 | @@ -120,3 +130,5 @@ RUF019.py:18:6: RUF019 [*] Unnecessary key check before dictionary access 19 19 | 20 20 | # OK 21 21 | v = "k" in d and d["k"] + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap index 64fd30b4ed4d2..5aea0c2cfa954 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap @@ -12,7 +12,7 @@ RUF020.py:3:7: RUF020 [*] `Union[Never, T]` is equivalent to `T` | = help: Remove `Never` -ℹ Safe fix +Suggested fix: 1 1 | from typing import Never, NoReturn, Union 2 2 | 3 |-Union[Never, int] @@ -21,6 +21,8 @@ RUF020.py:3:7: RUF020 [*] `Union[Never, T]` is equivalent to `T` 5 5 | Never | int 6 6 | NoReturn | int + Run `ruff check --fix` to apply this fix. + RUF020.py:4:7: RUF020 [*] `Union[NoReturn, T]` is equivalent to `T` | 3 | Union[Never, int] @@ -31,7 +33,7 @@ RUF020.py:4:7: RUF020 [*] `Union[NoReturn, T]` is equivalent to `T` | = help: Remove `NoReturn` -ℹ Safe fix +Suggested fix: 1 1 | from typing import Never, NoReturn, Union 2 2 | 3 3 | Union[Never, int] @@ -41,6 +43,8 @@ RUF020.py:4:7: RUF020 [*] `Union[NoReturn, T]` is equivalent to `T` 6 6 | NoReturn | int 7 7 | Union[Union[Never, int], Union[NoReturn, int]] + Run `ruff check --fix` to apply this fix. + RUF020.py:5:1: RUF020 [*] `Never | T` is equivalent to `T` | 3 | Union[Never, int] @@ -52,7 +56,7 @@ RUF020.py:5:1: RUF020 [*] `Never | T` is equivalent to `T` | = help: Remove `Never` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | Union[Never, int] 4 4 | Union[NoReturn, int] @@ -62,6 +66,8 @@ RUF020.py:5:1: RUF020 [*] `Never | T` is equivalent to `T` 7 7 | Union[Union[Never, int], Union[NoReturn, int]] 8 8 | Union[NoReturn, int, float] + Run `ruff check --fix` to apply this fix. + RUF020.py:6:1: RUF020 [*] `NoReturn | T` is equivalent to `T` | 4 | Union[NoReturn, int] @@ -73,7 +79,7 @@ RUF020.py:6:1: RUF020 [*] `NoReturn | T` is equivalent to `T` | = help: Remove `NoReturn` -ℹ Safe fix +Suggested fix: 3 3 | Union[Never, int] 4 4 | Union[NoReturn, int] 5 5 | Never | int @@ -82,6 +88,8 @@ RUF020.py:6:1: RUF020 [*] `NoReturn | T` is equivalent to `T` 7 7 | Union[Union[Never, int], Union[NoReturn, int]] 8 8 | Union[NoReturn, int, float] + Run `ruff check --fix` to apply this fix. + RUF020.py:7:13: RUF020 [*] `Union[Never, T]` is equivalent to `T` | 5 | Never | int @@ -92,7 +100,7 @@ RUF020.py:7:13: RUF020 [*] `Union[Never, T]` is equivalent to `T` | = help: Remove `Never` -ℹ Safe fix +Suggested fix: 4 4 | Union[NoReturn, int] 5 5 | Never | int 6 6 | NoReturn | int @@ -100,6 +108,8 @@ RUF020.py:7:13: RUF020 [*] `Union[Never, T]` is equivalent to `T` 7 |+Union[int, Union[NoReturn, int]] 8 8 | Union[NoReturn, int, float] + Run `ruff check --fix` to apply this fix. + RUF020.py:7:32: RUF020 [*] `Union[NoReturn, T]` is equivalent to `T` | 5 | Never | int @@ -110,7 +120,7 @@ RUF020.py:7:32: RUF020 [*] `Union[NoReturn, T]` is equivalent to `T` | = help: Remove `NoReturn` -ℹ Safe fix +Suggested fix: 4 4 | Union[NoReturn, int] 5 5 | Never | int 6 6 | NoReturn | int @@ -118,6 +128,8 @@ RUF020.py:7:32: RUF020 [*] `Union[NoReturn, T]` is equivalent to `T` 7 |+Union[Union[Never, int], int] 8 8 | Union[NoReturn, int, float] + Run `ruff check --fix` to apply this fix. + RUF020.py:8:7: RUF020 [*] `Union[NoReturn, T]` is equivalent to `T` | 6 | NoReturn | int @@ -127,11 +139,11 @@ RUF020.py:8:7: RUF020 [*] `Union[NoReturn, T]` is equivalent to `T` | = help: Remove `NoReturn` -ℹ Safe fix +Suggested fix: 5 5 | Never | int 6 6 | NoReturn | int 7 7 | Union[Union[Never, int], Union[NoReturn, int]] 8 |-Union[NoReturn, int, float] 8 |+Union[int, float] - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap index 0660b0b97f85a..33c15cb916a0b 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap @@ -10,7 +10,7 @@ RUF021.py:12:10: RUF021 [*] Parenthesize `a and b` expressions when chaining `an | = help: Parenthesize the `and` subexpression -ℹ Safe fix +Suggested fix: 9 9 | # as part of a chain. 10 10 | 11 11 | a, b, c = 1, 0, 2 @@ -20,6 +20,8 @@ RUF021.py:12:10: RUF021 [*] Parenthesize `a and b` expressions when chaining `an 14 14 | 15 15 | a, b, c = 0, 1, 2 + Run `ruff check --fix` to apply this fix. + RUF021.py:13:10: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 11 | a, b, c = 1, 0, 2 @@ -31,7 +33,7 @@ RUF021.py:13:10: RUF021 [*] Parenthesize `a and b` expressions when chaining `an | = help: Parenthesize the `and` subexpression -ℹ Safe fix +Suggested fix: 10 10 | 11 11 | a, b, c = 1, 0, 2 12 12 | x = a or b and c # RUF021: => `a or (b and c)` @@ -41,6 +43,8 @@ RUF021.py:13:10: RUF021 [*] Parenthesize `a and b` expressions when chaining `an 15 15 | a, b, c = 0, 1, 2 16 16 | y = a and b or c # RUF021: => `(a and b) or c` + Run `ruff check --fix` to apply this fix. + RUF021.py:16:5: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 15 | a, b, c = 0, 1, 2 @@ -51,7 +55,7 @@ RUF021.py:16:5: RUF021 [*] Parenthesize `a and b` expressions when chaining `and | = help: Parenthesize the `and` subexpression -ℹ Safe fix +Suggested fix: 13 13 | x = a or b and c # looooooooooooooooooooooooooooooong comment but it won't prevent an autofix 14 14 | 15 15 | a, b, c = 0, 1, 2 @@ -61,6 +65,8 @@ RUF021.py:16:5: RUF021 [*] Parenthesize `a and b` expressions when chaining `and 18 18 | a, b, c, d = 1, 2, 0, 3 19 19 | if a or b or c and d: # RUF021: => `a or b or (c and d)` + Run `ruff check --fix` to apply this fix. + RUF021.py:19:14: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 18 | a, b, c, d = 1, 2, 0, 3 @@ -70,7 +76,7 @@ RUF021.py:19:14: RUF021 [*] Parenthesize `a and b` expressions when chaining `an | = help: Parenthesize the `and` subexpression -ℹ Safe fix +Suggested fix: 16 16 | y = a and b or c # RUF021: => `(a and b) or c` 17 17 | 18 18 | a, b, c, d = 1, 2, 0, 3 @@ -80,6 +86,8 @@ RUF021.py:19:14: RUF021 [*] Parenthesize `a and b` expressions when chaining `an 21 21 | 22 22 | a, b, c, d = 0, 0, 2, 3 + Run `ruff check --fix` to apply this fix. + RUF021.py:26:11: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 24 | if bool(): @@ -90,7 +98,7 @@ RUF021.py:26:11: RUF021 [*] Parenthesize `a and b` expressions when chaining `an | = help: Parenthesize the `and` subexpression -ℹ Safe fix +Suggested fix: 23 23 | 24 24 | if bool(): 25 25 | pass @@ -100,6 +108,8 @@ RUF021.py:26:11: RUF021 [*] Parenthesize `a and b` expressions when chaining `an 28 28 | 29 29 | a, b, c, d = 0, 1, 0, 2 + Run `ruff check --fix` to apply this fix. + RUF021.py:30:7: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 29 | a, b, c, d = 0, 1, 0, 2 @@ -109,7 +119,7 @@ RUF021.py:30:7: RUF021 [*] Parenthesize `a and b` expressions when chaining `and | = help: Parenthesize the `and` subexpression -ℹ Safe fix +Suggested fix: 27 27 | pass 28 28 | 29 29 | a, b, c, d = 0, 1, 0, 2 @@ -119,6 +129,8 @@ RUF021.py:30:7: RUF021 [*] Parenthesize `a and b` expressions when chaining `and 32 32 | 33 33 | b, c, d, e = 2, 3, 0, 4 + Run `ruff check --fix` to apply this fix. + RUF021.py:30:18: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 29 | a, b, c, d = 0, 1, 0, 2 @@ -128,7 +140,7 @@ RUF021.py:30:18: RUF021 [*] Parenthesize `a and b` expressions when chaining `an | = help: Parenthesize the `and` subexpression -ℹ Safe fix +Suggested fix: 27 27 | pass 28 28 | 29 29 | a, b, c, d = 0, 1, 0, 2 @@ -138,6 +150,8 @@ RUF021.py:30:18: RUF021 [*] Parenthesize `a and b` expressions when chaining `an 32 32 | 33 33 | b, c, d, e = 2, 3, 0, 4 + Run `ruff check --fix` to apply this fix. + RUF021.py:35:44: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 33 | b, c, d, e = 2, 3, 0, 4 @@ -149,7 +163,7 @@ RUF021.py:35:44: RUF021 [*] Parenthesize `a and b` expressions when chaining `an | = help: Parenthesize the `and` subexpression -ℹ Safe fix +Suggested fix: 32 32 | 33 33 | b, c, d, e = 2, 3, 0, 4 34 34 | # RUF021: => `a or b or c or (d and e)`: @@ -159,6 +173,8 @@ RUF021.py:35:44: RUF021 [*] Parenthesize `a and b` expressions when chaining `an 37 37 | a, b, c, d = 0, 1, 3, 0 38 38 | assert not a and b or c or d # RUF021: => `(not a and b) or c or d` + Run `ruff check --fix` to apply this fix. + RUF021.py:38:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 37 | a, b, c, d = 0, 1, 3, 0 @@ -169,7 +185,7 @@ RUF021.py:38:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and | = help: Parenthesize the `and` subexpression -ℹ Safe fix +Suggested fix: 35 35 | z = [a for a in range(5) if a or b or c or d and e] 36 36 | 37 37 | a, b, c, d = 0, 1, 3, 0 @@ -179,6 +195,8 @@ RUF021.py:38:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and 40 40 | if (not a) and b or c or d: # RUF021: => `((not a) and b) or c or d` 41 41 | if (not a and b) or c or d: # OK + Run `ruff check --fix` to apply this fix. + RUF021.py:40:4: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 38 | assert not a and b or c or d # RUF021: => `(not a and b) or c or d` @@ -190,7 +208,7 @@ RUF021.py:40:4: RUF021 [*] Parenthesize `a and b` expressions when chaining `and | = help: Parenthesize the `and` subexpression -ℹ Safe fix +Suggested fix: 37 37 | a, b, c, d = 0, 1, 3, 0 38 38 | assert not a and b or c or d # RUF021: => `(not a and b) or c or d` 39 39 | @@ -200,6 +218,8 @@ RUF021.py:40:4: RUF021 [*] Parenthesize `a and b` expressions when chaining `and 42 42 | pass 43 43 | + Run `ruff check --fix` to apply this fix. + RUF021.py:46:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 44 | if ( @@ -213,7 +233,7 @@ RUF021.py:46:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and | = help: Parenthesize the `and` subexpression -ℹ Safe fix +Suggested fix: 43 43 | 44 44 | if ( 45 45 | some_reasonably_long_condition @@ -225,6 +245,8 @@ RUF021.py:46:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and 49 49 | and some_fifth_reasonably_long_condition 50 50 | # a comment + Run `ruff check --fix` to apply this fix. + RUF021.py:48:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 46 | or some_other_reasonably_long_condition @@ -241,7 +263,7 @@ RUF021.py:48:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and | = help: Parenthesize the `and` subexpression -ℹ Safe fix +Suggested fix: 45 45 | some_reasonably_long_condition 46 46 | or some_other_reasonably_long_condition 47 47 | and some_third_reasonably_long_condition @@ -255,3 +277,5 @@ RUF021.py:48:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and 53 53 | # another comment 54 54 | or some_eighth_reasonably_long_condition 55 55 | ): + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF022_RUF022.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF022_RUF022.py.snap index c886b91ccf04d..8ce0ffb25acd3 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF022_RUF022.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF022_RUF022.py.snap @@ -12,7 +12,7 @@ RUF022.py:5:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 2 2 | # Single-line __all__ definitions (nice 'n' easy!) 3 3 | ################################################## 4 4 | @@ -22,6 +22,8 @@ RUF022.py:5:11: RUF022 [*] `__all__` is not sorted 7 7 | __all__ = ("d", "c", "b", "a") 8 8 | + Run `ruff check --fix` to apply this fix. + RUF022.py:6:12: RUF022 [*] `__all__` is not sorted | 5 | __all__ = ["d", "c", "b", "a"] # a comment that is untouched @@ -31,7 +33,7 @@ RUF022.py:6:12: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 3 3 | ################################################## 4 4 | 5 5 | __all__ = ["d", "c", "b", "a"] # a comment that is untouched @@ -41,6 +43,8 @@ RUF022.py:6:12: RUF022 [*] `__all__` is not sorted 8 8 | 9 9 | # Quoting style is retained, + Run `ruff check --fix` to apply this fix. + RUF022.py:7:11: RUF022 [*] `__all__` is not sorted | 5 | __all__ = ["d", "c", "b", "a"] # a comment that is untouched @@ -52,7 +56,7 @@ RUF022.py:7:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | __all__ = ["d", "c", "b", "a"] # a comment that is untouched 6 6 | __all__ += ["foo", "bar", "antipasti"] @@ -62,6 +66,8 @@ RUF022.py:7:11: RUF022 [*] `__all__` is not sorted 9 9 | # Quoting style is retained, 10 10 | # but unnecessary parens are not + Run `ruff check --fix` to apply this fix. + RUF022.py:11:17: RUF022 [*] `__all__` is not sorted | 9 | # Quoting style is retained, @@ -73,7 +79,7 @@ RUF022.py:11:17: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 8 8 | 9 9 | # Quoting style is retained, 10 10 | # but unnecessary parens are not @@ -83,6 +89,8 @@ RUF022.py:11:17: RUF022 [*] `__all__` is not sorted 13 13 | # (but they are in multiline `__all__` definitions) 14 14 | __all__: tuple = ("b", "c", "a",) + Run `ruff check --fix` to apply this fix. + RUF022.py:14:18: RUF022 [*] `__all__` is not sorted | 12 | # Trailing commas are also not retained in single-line `__all__` definitions @@ -94,7 +102,7 @@ RUF022.py:14:18: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 11 11 | __all__: list = ['b', "c", ((('a')))] 12 12 | # Trailing commas are also not retained in single-line `__all__` definitions 13 13 | # (but they are in multiline `__all__` definitions) @@ -104,6 +112,8 @@ RUF022.py:14:18: RUF022 [*] `__all__` is not sorted 16 16 | if bool(): 17 17 | __all__ += ("x", "m", "a", "s") + Run `ruff check --fix` to apply this fix. + RUF022.py:17:16: RUF022 [*] `__all__` is not sorted | 16 | if bool(): @@ -114,7 +124,7 @@ RUF022.py:17:16: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 14 14 | __all__: tuple = ("b", "c", "a",) 15 15 | 16 16 | if bool(): @@ -124,6 +134,8 @@ RUF022.py:17:16: RUF022 [*] `__all__` is not sorted 19 19 | __all__ += "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) 20 20 | + Run `ruff check --fix` to apply this fix. + RUF022.py:19:16: RUF022 [*] `__all__` is not sorted | 17 | __all__ += ("x", "m", "a", "s") @@ -135,7 +147,7 @@ RUF022.py:19:16: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 16 16 | if bool(): 17 17 | __all__ += ("x", "m", "a", "s") 18 18 | else: @@ -145,6 +157,8 @@ RUF022.py:19:16: RUF022 [*] `__all__` is not sorted 21 21 | __all__: list[str] = ["the", "three", "little", "pigs"] 22 22 | + Run `ruff check --fix` to apply this fix. + RUF022.py:21:22: RUF022 [*] `__all__` is not sorted | 19 | __all__ += "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) @@ -156,7 +170,7 @@ RUF022.py:21:22: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 18 18 | else: 19 19 | __all__ += "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) 20 20 | @@ -166,6 +180,8 @@ RUF022.py:21:22: RUF022 [*] `__all__` is not sorted 23 23 | __all__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") 24 24 | __all__.extend(["foo", "bar"]) + Run `ruff check --fix` to apply this fix. + RUF022.py:23:11: RUF022 [*] `__all__` is not sorted | 21 | __all__: list[str] = ["the", "three", "little", "pigs"] @@ -177,7 +193,7 @@ RUF022.py:23:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 20 20 | 21 21 | __all__: list[str] = ["the", "three", "little", "pigs"] 22 22 | @@ -187,6 +203,8 @@ RUF022.py:23:11: RUF022 [*] `__all__` is not sorted 25 25 | __all__.extend(("foo", "bar")) 26 26 | __all__.extend((((["foo", "bar"])))) + Run `ruff check --fix` to apply this fix. + RUF022.py:24:16: RUF022 [*] `__all__` is not sorted | 23 | __all__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") @@ -197,7 +215,7 @@ RUF022.py:24:16: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 21 21 | __all__: list[str] = ["the", "three", "little", "pigs"] 22 22 | 23 23 | __all__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") @@ -207,6 +225,8 @@ RUF022.py:24:16: RUF022 [*] `__all__` is not sorted 26 26 | __all__.extend((((["foo", "bar"])))) 27 27 | + Run `ruff check --fix` to apply this fix. + RUF022.py:25:16: RUF022 [*] `__all__` is not sorted | 23 | __all__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") @@ -217,7 +237,7 @@ RUF022.py:25:16: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 22 22 | 23 23 | __all__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") 24 24 | __all__.extend(["foo", "bar"]) @@ -227,6 +247,8 @@ RUF022.py:25:16: RUF022 [*] `__all__` is not sorted 27 27 | 28 28 | #################################### + Run `ruff check --fix` to apply this fix. + RUF022.py:26:19: RUF022 [*] `__all__` is not sorted | 24 | __all__.extend(["foo", "bar"]) @@ -238,7 +260,7 @@ RUF022.py:26:19: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 23 23 | __all__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") 24 24 | __all__.extend(["foo", "bar"]) 25 25 | __all__.extend(("foo", "bar")) @@ -248,6 +270,8 @@ RUF022.py:26:19: RUF022 [*] `__all__` is not sorted 28 28 | #################################### 29 29 | # Neat multiline __all__ definitions + Run `ruff check --fix` to apply this fix. + RUF022.py:32:11: RUF022 [*] `__all__` is not sorted | 30 | #################################### @@ -266,7 +290,7 @@ RUF022.py:32:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 30 30 | #################################### 31 31 | 32 32 | __all__ = ( @@ -283,6 +307,8 @@ RUF022.py:32:11: RUF022 [*] `__all__` is not sorted 39 39 | 40 40 | __all__ = [ + Run `ruff check --fix` to apply this fix. + RUF022.py:40:11: RUF022 [*] `__all__` is not sorted | 38 | ) @@ -301,7 +327,7 @@ RUF022.py:40:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 38 38 | ) 39 39 | 40 40 | __all__ = [ @@ -318,6 +344,8 @@ RUF022.py:40:11: RUF022 [*] `__all__` is not sorted 47 47 | 48 48 | # we implement an "isort-style sort": + Run `ruff check --fix` to apply this fix. + RUF022.py:54:11: RUF022 [*] `__all__` is not sorted | 52 | # This (which is currently alphabetically sorted) @@ -360,7 +388,7 @@ RUF022.py:54:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 54 54 | __all__ = [ 55 55 | "APRIL", 56 56 | "AUGUST", @@ -405,6 +433,8 @@ RUF022.py:54:11: RUF022 [*] `__all__` is not sorted 86 87 | ########################################## 87 88 | # Messier multiline __all__ definitions... + Run `ruff check --fix` to apply this fix. + RUF022.py:91:11: RUF022 [*] `__all__` is not sorted | 90 | # comment0 @@ -422,7 +452,7 @@ RUF022.py:91:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 88 88 | ########################################## 89 89 | 90 90 | # comment0 @@ -444,6 +474,8 @@ RUF022.py:91:11: RUF022 [*] `__all__` is not sorted 98 101 | ) # comment6 99 102 | # comment7 + Run `ruff check --fix` to apply this fix. + RUF022.py:101:11: RUF022 [*] `__all__` is not sorted | 99 | # comment7 @@ -463,7 +495,7 @@ RUF022.py:101:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 99 99 | # comment7 100 100 | 101 101 | __all__ = [ # comment0 @@ -478,6 +510,8 @@ RUF022.py:101:11: RUF022 [*] `__all__` is not sorted 106 109 | # comment5 107 110 | # comment6 + Run `ruff check --fix` to apply this fix. + RUF022.py:110:11: RUF022 [*] `__all__` is not sorted | 108 | ] # comment7 @@ -503,7 +537,7 @@ RUF022.py:110:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 107 107 | # comment6 108 108 | ] # comment7 109 109 | @@ -571,6 +605,8 @@ RUF022.py:110:11: RUF022 [*] `__all__` is not sorted 125 157 | __all__: tuple[str, ...] = ( # a comment about the opening paren 126 158 | # multiline comment about "bbb" part 1 + Run `ruff check --fix` to apply this fix. + RUF022.py:125:28: RUF022 [*] `__all__` is not sorted | 123 | "register_error", "lookup_error"] @@ -590,7 +626,7 @@ RUF022.py:125:28: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 123 123 | "register_error", "lookup_error"] 124 124 | 125 125 | __all__: tuple[str, ...] = ( # a comment about the opening paren @@ -607,6 +643,8 @@ RUF022.py:125:28: RUF022 [*] `__all__` is not sorted 133 133 | 134 134 | # we use natural sort for `__all__`, + Run `ruff check --fix` to apply this fix. + RUF022.py:138:11: RUF022 [*] `__all__` is not sorted | 136 | # Also, this doesn't end with a trailing comma, @@ -624,7 +662,7 @@ RUF022.py:138:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 136 136 | # Also, this doesn't end with a trailing comma, 137 137 | # so the autofix shouldn't introduce one: 138 138 | __all__ = ( @@ -639,6 +677,8 @@ RUF022.py:138:11: RUF022 [*] `__all__` is not sorted 144 144 | 145 145 | __all__.extend(( # comment0 + Run `ruff check --fix` to apply this fix. + RUF022.py:145:16: RUF022 [*] `__all__` is not sorted | 143 | ) @@ -657,7 +697,7 @@ RUF022.py:145:16: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 143 143 | ) 144 144 | 145 145 | __all__.extend(( # comment0 @@ -672,6 +712,8 @@ RUF022.py:145:16: RUF022 [*] `__all__` is not sorted 151 151 | )) # comment2 152 152 | + Run `ruff check --fix` to apply this fix. + RUF022.py:155:5: RUF022 [*] `__all__` is not sorted | 153 | __all__.extend( # comment0 @@ -689,7 +731,7 @@ RUF022.py:155:5: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 153 153 | __all__.extend( # comment0 154 154 | # comment1 155 155 | ( # comment2 @@ -704,6 +746,8 @@ RUF022.py:155:5: RUF022 [*] `__all__` is not sorted 161 161 | ) # comment4 162 162 | ) # comment2 + Run `ruff check --fix` to apply this fix. + RUF022.py:164:16: RUF022 [*] `__all__` is not sorted | 162 | ) # comment2 @@ -722,7 +766,7 @@ RUF022.py:164:16: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 162 162 | ) # comment2 163 163 | 164 164 | __all__.extend([ # comment0 @@ -737,6 +781,8 @@ RUF022.py:164:16: RUF022 [*] `__all__` is not sorted 170 170 | ]) # comment2 171 171 | + Run `ruff check --fix` to apply this fix. + RUF022.py:174:5: RUF022 [*] `__all__` is not sorted | 172 | __all__.extend( # comment0 @@ -754,7 +800,7 @@ RUF022.py:174:5: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 172 172 | __all__.extend( # comment0 173 173 | # comment1 174 174 | [ # comment2 @@ -769,6 +815,8 @@ RUF022.py:174:5: RUF022 [*] `__all__` is not sorted 180 180 | ] # comment4 181 181 | ) # comment2 + Run `ruff check --fix` to apply this fix. + RUF022.py:183:11: RUF022 [*] `__all__` is not sorted | 181 | ) # comment2 @@ -784,7 +832,7 @@ RUF022.py:183:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 180 180 | ] # comment4 181 181 | ) # comment2 182 182 | @@ -801,6 +849,8 @@ RUF022.py:183:11: RUF022 [*] `__all__` is not sorted 187 190 | 188 191 | __all__ = ["Awaitable", "Coroutine", + Run `ruff check --fix` to apply this fix. + RUF022.py:188:11: RUF022 [*] `__all__` is not sorted | 186 | ] @@ -815,7 +865,7 @@ RUF022.py:188:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 185 185 | "LabeledScale", "OptionMenu", 186 186 | ] 187 187 | @@ -833,6 +883,8 @@ RUF022.py:188:11: RUF022 [*] `__all__` is not sorted 192 196 | __all__ = [ 193 197 | "foo", + Run `ruff check --fix` to apply this fix. + RUF022.py:192:11: RUF022 [*] `__all__` is not sorted | 190 | ] @@ -849,7 +901,7 @@ RUF022.py:192:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 190 190 | ] 191 191 | 192 192 | __all__ = [ @@ -861,6 +913,8 @@ RUF022.py:192:11: RUF022 [*] `__all__` is not sorted 197 197 | 198 198 | ######################################################################### + Run `ruff check --fix` to apply this fix. + RUF022.py:204:11: RUF022 `__all__` is not sorted | 202 | ######################################################################### @@ -921,7 +975,7 @@ RUF022.py:225:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 223 223 | ############################################################ 224 224 | 225 225 | __all__ = ( @@ -933,6 +987,8 @@ RUF022.py:225:11: RUF022 [*] `__all__` is not sorted 229 230 | __all__ = [ 230 231 | "loads", + Run `ruff check --fix` to apply this fix. + RUF022.py:229:11: RUF022 [*] `__all__` is not sorted | 227 | "dumps",) @@ -947,7 +1003,7 @@ RUF022.py:229:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 227 227 | "dumps",) 228 228 | 229 229 | __all__ = [ @@ -959,6 +1015,8 @@ RUF022.py:229:11: RUF022 [*] `__all__` is not sorted 233 233 | __all__ = ['xp', 'yp', 234 234 | 'canvas' + Run `ruff check --fix` to apply this fix. + RUF022.py:233:11: RUF022 [*] `__all__` is not sorted | 231 | "dumps" , ] @@ -979,7 +1037,7 @@ RUF022.py:233:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 230 230 | "loads", 231 231 | "dumps" , ] 232 232 | @@ -993,6 +1051,8 @@ RUF022.py:233:11: RUF022 [*] `__all__` is not sorted 236 238 | # very strangely placed comment 237 239 | + Run `ruff check --fix` to apply this fix. + RUF022.py:243:11: RUF022 [*] `__all__` is not sorted | 241 | ] @@ -1013,7 +1073,7 @@ RUF022.py:243:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 241 241 | ] 242 242 | 243 243 | __all__ = ( @@ -1028,6 +1088,8 @@ RUF022.py:243:11: RUF022 [*] `__all__` is not sorted 250 249 | , 251 250 | ) + Run `ruff check --fix` to apply this fix. + RUF022.py:253:11: RUF022 [*] `__all__` is not sorted | 251 | ) @@ -1055,7 +1117,7 @@ RUF022.py:253:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -ℹ Safe fix +Suggested fix: 251 251 | ) 252 252 | 253 253 | __all__ = ( # comment about the opening paren @@ -1077,4 +1139,4 @@ RUF022.py:253:11: RUF022 [*] `__all__` is not sorted 264 264 | # strange multiline comment 2b 265 265 | , - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap index 2ec896e3081c3..417dc896b6173 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap @@ -10,7 +10,7 @@ RUF023.py:6:17: RUF023 [*] `Klass.__slots__` is not sorted | = help: Apply a natural sort to `Klass.__slots__` -ℹ Safe fix +Suggested fix: 3 3 | ######################### 4 4 | 5 5 | class Klass: @@ -20,6 +20,8 @@ RUF023.py:6:17: RUF023 [*] `Klass.__slots__` is not sorted 8 8 | 9 9 | # Quoting style is retained, + Run `ruff check --fix` to apply this fix. + RUF023.py:7:17: RUF023 [*] `Klass.__slots__` is not sorted | 5 | class Klass: @@ -31,7 +33,7 @@ RUF023.py:7:17: RUF023 [*] `Klass.__slots__` is not sorted | = help: Apply a natural sort to `Klass.__slots__` -ℹ Safe fix +Suggested fix: 4 4 | 5 5 | class Klass: 6 6 | __slots__ = ["d", "c", "b", "a"] # a comment that is untouched @@ -41,6 +43,8 @@ RUF023.py:7:17: RUF023 [*] `Klass.__slots__` is not sorted 9 9 | # Quoting style is retained, 10 10 | # but unnecessary parens are not + Run `ruff check --fix` to apply this fix. + RUF023.py:11:22: RUF023 [*] `Klass.__slots__` is not sorted | 9 | # Quoting style is retained, @@ -52,7 +56,7 @@ RUF023.py:11:22: RUF023 [*] `Klass.__slots__` is not sorted | = help: Apply a natural sort to `Klass.__slots__` -ℹ Safe fix +Suggested fix: 8 8 | 9 9 | # Quoting style is retained, 10 10 | # but unnecessary parens are not @@ -62,6 +66,8 @@ RUF023.py:11:22: RUF023 [*] `Klass.__slots__` is not sorted 13 13 | # (but they are in multiline definitions) 14 14 | __slots__: tuple = ("b", "c", "a",) + Run `ruff check --fix` to apply this fix. + RUF023.py:14:24: RUF023 [*] `Klass.__slots__` is not sorted | 12 | # Trailing commas are also not retained for single-line definitions @@ -73,7 +79,7 @@ RUF023.py:14:24: RUF023 [*] `Klass.__slots__` is not sorted | = help: Apply a natural sort to `Klass.__slots__` -ℹ Safe fix +Suggested fix: 11 11 | __slots__: set = {'b', "c", ((('a')))} 12 12 | # Trailing commas are also not retained for single-line definitions 13 13 | # (but they are in multiline definitions) @@ -83,6 +89,8 @@ RUF023.py:14:24: RUF023 [*] `Klass.__slots__` is not sorted 16 16 | class Klass2: 17 17 | if bool(): + Run `ruff check --fix` to apply this fix. + RUF023.py:18:21: RUF023 [*] `Klass2.__slots__` is not sorted | 16 | class Klass2: @@ -94,7 +102,7 @@ RUF023.py:18:21: RUF023 [*] `Klass2.__slots__` is not sorted | = help: Apply a natural sort to `Klass2.__slots__` -ℹ Safe fix +Suggested fix: 15 15 | 16 16 | class Klass2: 17 17 | if bool(): @@ -104,6 +112,8 @@ RUF023.py:18:21: RUF023 [*] `Klass2.__slots__` is not sorted 20 20 | __slots__ = "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) 21 21 | + Run `ruff check --fix` to apply this fix. + RUF023.py:20:21: RUF023 [*] `Klass2.__slots__` is not sorted | 18 | __slots__ = {"x": "docs for x", "m": "docs for m", "a": "docs for a"} @@ -115,7 +125,7 @@ RUF023.py:20:21: RUF023 [*] `Klass2.__slots__` is not sorted | = help: Apply a natural sort to `Klass2.__slots__` -ℹ Safe fix +Suggested fix: 17 17 | if bool(): 18 18 | __slots__ = {"x": "docs for x", "m": "docs for m", "a": "docs for a"} 19 19 | else: @@ -125,6 +135,8 @@ RUF023.py:20:21: RUF023 [*] `Klass2.__slots__` is not sorted 22 22 | __slots__: list[str] = ["the", "three", "little", "pigs"] 23 23 | __slots__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") + Run `ruff check --fix` to apply this fix. + RUF023.py:22:28: RUF023 [*] `Klass2.__slots__` is not sorted | 20 | __slots__ = "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) @@ -136,7 +148,7 @@ RUF023.py:22:28: RUF023 [*] `Klass2.__slots__` is not sorted | = help: Apply a natural sort to `Klass2.__slots__` -ℹ Safe fix +Suggested fix: 19 19 | else: 20 20 | __slots__ = "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) 21 21 | @@ -146,6 +158,8 @@ RUF023.py:22:28: RUF023 [*] `Klass2.__slots__` is not sorted 24 24 | # we use natural sort, 25 25 | # not alphabetical sort or "isort-style" sort + Run `ruff check --fix` to apply this fix. + RUF023.py:23:17: RUF023 [*] `Klass2.__slots__` is not sorted | 22 | __slots__: list[str] = ["the", "three", "little", "pigs"] @@ -156,7 +170,7 @@ RUF023.py:23:17: RUF023 [*] `Klass2.__slots__` is not sorted | = help: Apply a natural sort to `Klass2.__slots__` -ℹ Safe fix +Suggested fix: 20 20 | __slots__ = "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) 21 21 | 22 22 | __slots__: list[str] = ["the", "three", "little", "pigs"] @@ -166,6 +180,8 @@ RUF023.py:23:17: RUF023 [*] `Klass2.__slots__` is not sorted 25 25 | # not alphabetical sort or "isort-style" sort 26 26 | __slots__ = {"aadvark237", "aadvark10092", "aadvark174", "aadvark532"} + Run `ruff check --fix` to apply this fix. + RUF023.py:26:17: RUF023 [*] `Klass2.__slots__` is not sorted | 24 | # we use natural sort, @@ -177,7 +193,7 @@ RUF023.py:26:17: RUF023 [*] `Klass2.__slots__` is not sorted | = help: Apply a natural sort to `Klass2.__slots__` -ℹ Safe fix +Suggested fix: 23 23 | __slots__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") 24 24 | # we use natural sort, 25 25 | # not alphabetical sort or "isort-style" sort @@ -187,6 +203,8 @@ RUF023.py:26:17: RUF023 [*] `Klass2.__slots__` is not sorted 28 28 | ############################ 29 29 | # Neat multiline definitions + Run `ruff check --fix` to apply this fix. + RUF023.py:33:17: RUF023 [*] `Klass3.__slots__` is not sorted | 32 | class Klass3: @@ -204,7 +222,7 @@ RUF023.py:33:17: RUF023 [*] `Klass3.__slots__` is not sorted | = help: Apply a natural sort to `Klass3.__slots__` -ℹ Safe fix +Suggested fix: 31 31 | 32 32 | class Klass3: 33 33 | __slots__ = ( @@ -221,6 +239,8 @@ RUF023.py:33:17: RUF023 [*] `Klass3.__slots__` is not sorted 40 40 | __slots__ = [ 41 41 | "d", + Run `ruff check --fix` to apply this fix. + RUF023.py:40:17: RUF023 [*] `Klass3.__slots__` is not sorted | 38 | "a0" @@ -239,7 +259,7 @@ RUF023.py:40:17: RUF023 [*] `Klass3.__slots__` is not sorted | = help: Apply a natural sort to `Klass3.__slots__` -ℹ Safe fix +Suggested fix: 38 38 | "a0" 39 39 | ) 40 40 | __slots__ = [ @@ -256,6 +276,8 @@ RUF023.py:40:17: RUF023 [*] `Klass3.__slots__` is not sorted 47 47 | 48 48 | ################################## + Run `ruff check --fix` to apply this fix. + RUF023.py:54:17: RUF023 [*] `Klass4.__slots__` is not sorted | 52 | class Klass4: @@ -274,7 +296,7 @@ RUF023.py:54:17: RUF023 [*] `Klass4.__slots__` is not sorted | = help: Apply a natural sort to `Klass4.__slots__` -ℹ Safe fix +Suggested fix: 51 51 | 52 52 | class Klass4: 53 53 | # comment0 @@ -296,6 +318,8 @@ RUF023.py:54:17: RUF023 [*] `Klass4.__slots__` is not sorted 61 64 | ) # comment6 62 65 | # comment7 + Run `ruff check --fix` to apply this fix. + RUF023.py:64:17: RUF023 [*] `Klass4.__slots__` is not sorted | 62 | # comment7 @@ -315,7 +339,7 @@ RUF023.py:64:17: RUF023 [*] `Klass4.__slots__` is not sorted | = help: Apply a natural sort to `Klass4.__slots__` -ℹ Safe fix +Suggested fix: 62 62 | # comment7 63 63 | 64 64 | __slots__ = [ # comment0 @@ -330,6 +354,8 @@ RUF023.py:64:17: RUF023 [*] `Klass4.__slots__` is not sorted 69 72 | # comment5 70 73 | # comment6 + Run `ruff check --fix` to apply this fix. + RUF023.py:75:17: RUF023 [*] `PurePath.__slots__` is not sorted | 73 | # from cpython/Lib/pathlib/__init__.py @@ -376,7 +402,7 @@ RUF023.py:75:17: RUF023 [*] `PurePath.__slots__` is not sorted | = help: Apply a natural sort to `PurePath.__slots__` -ℹ Safe fix +Suggested fix: 73 73 | # from cpython/Lib/pathlib/__init__.py 74 74 | class PurePath: 75 75 | __slots__ = ( @@ -431,6 +457,8 @@ RUF023.py:75:17: RUF023 [*] `PurePath.__slots__` is not sorted 110 107 | 111 108 | # From cpython/Lib/pickletools.py + Run `ruff check --fix` to apply this fix. + RUF023.py:113:17: RUF023 [*] `ArgumentDescriptor.__slots__` is not sorted | 111 | # From cpython/Lib/pickletools.py @@ -459,7 +487,7 @@ RUF023.py:113:17: RUF023 [*] `ArgumentDescriptor.__slots__` is not sorted | = help: Apply a natural sort to `ArgumentDescriptor.__slots__` -ℹ Safe fix +Suggested fix: 111 111 | # From cpython/Lib/pickletools.py 112 112 | class ArgumentDescriptor(object): 113 113 | __slots__ = ( @@ -486,6 +514,8 @@ RUF023.py:113:17: RUF023 [*] `ArgumentDescriptor.__slots__` is not sorted 130 127 | 131 128 | #################################### + Run `ruff check --fix` to apply this fix. + RUF023.py:138:17: RUF023 `SlotUser.__slots__` is not sorted | 136 | # Multiline dicts are out of scope. @@ -555,7 +585,7 @@ RUF023.py:162:17: RUF023 [*] `BezierBuilder.__slots__` is not sorted | = help: Apply a natural sort to `BezierBuilder.__slots__` -ℹ Safe fix +Suggested fix: 159 159 | ############################################################ 160 160 | 161 161 | class BezierBuilder: @@ -570,6 +600,8 @@ RUF023.py:162:17: RUF023 [*] `BezierBuilder.__slots__` is not sorted 165 168 | class BezierBuilder2: 166 169 | __slots__ = {'xp', 'yp', + Run `ruff check --fix` to apply this fix. + RUF023.py:166:17: RUF023 [*] `BezierBuilder2.__slots__` is not sorted | 165 | class BezierBuilder2: @@ -582,7 +614,7 @@ RUF023.py:166:17: RUF023 [*] `BezierBuilder2.__slots__` is not sorted | = help: Apply a natural sort to `BezierBuilder2.__slots__` -ℹ Safe fix +Suggested fix: 163 163 | 'canvas',) 164 164 | 165 165 | class BezierBuilder2: @@ -596,6 +628,8 @@ RUF023.py:166:17: RUF023 [*] `BezierBuilder2.__slots__` is not sorted 169 171 | class BezierBuilder3: 170 172 | __slots__ = ['xp', 'yp', + Run `ruff check --fix` to apply this fix. + RUF023.py:170:17: RUF023 [*] `BezierBuilder3.__slots__` is not sorted | 169 | class BezierBuilder3: @@ -615,7 +649,7 @@ RUF023.py:170:17: RUF023 [*] `BezierBuilder3.__slots__` is not sorted | = help: Apply a natural sort to `BezierBuilder3.__slots__` -ℹ Safe fix +Suggested fix: 167 167 | 'canvas' , } 168 168 | 169 169 | class BezierBuilder3: @@ -629,6 +663,8 @@ RUF023.py:170:17: RUF023 [*] `BezierBuilder3.__slots__` is not sorted 173 175 | # very strangely placed comment 174 176 | + Run `ruff check --fix` to apply this fix. + RUF023.py:181:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted | 180 | class BezierBuilder4: @@ -648,7 +684,7 @@ RUF023.py:181:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted | = help: Apply a natural sort to `BezierBuilder4.__slots__` -ℹ Safe fix +Suggested fix: 179 179 | 180 180 | class BezierBuilder4: 181 181 | __slots__ = ( @@ -663,6 +699,8 @@ RUF023.py:181:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted 188 187 | , 189 188 | ) + Run `ruff check --fix` to apply this fix. + RUF023.py:191:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted | 189 | ) @@ -677,7 +715,7 @@ RUF023.py:191:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted | = help: Apply a natural sort to `BezierBuilder4.__slots__` -ℹ Safe fix +Suggested fix: 188 188 | , 189 189 | ) 190 190 | @@ -694,4 +732,4 @@ RUF023.py:191:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted 195 198 | ################################### 196 199 | # These should all not get flagged: - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap index f083f1920fa04..48a6e045973a6 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap @@ -11,7 +11,7 @@ RUF024.py:9:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkey | = help: Replace with comprehension -ℹ Unsafe fix +Suggested fix: 6 6 | ] 7 7 | 8 8 | # Errors. @@ -21,6 +21,8 @@ RUF024.py:9:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkey 11 11 | dict.fromkeys(pierogi_fillings, {}) 12 12 | dict.fromkeys(pierogi_fillings, set()) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF024.py:10:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys` | 8 | # Errors. @@ -32,7 +34,7 @@ RUF024.py:10:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke | = help: Replace with comprehension -ℹ Unsafe fix +Suggested fix: 7 7 | 8 8 | # Errors. 9 9 | dict.fromkeys(pierogi_fillings, []) @@ -42,6 +44,8 @@ RUF024.py:10:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke 12 12 | dict.fromkeys(pierogi_fillings, set()) 13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"}) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF024.py:11:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys` | 9 | dict.fromkeys(pierogi_fillings, []) @@ -53,7 +57,7 @@ RUF024.py:11:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke | = help: Replace with comprehension -ℹ Unsafe fix +Suggested fix: 8 8 | # Errors. 9 9 | dict.fromkeys(pierogi_fillings, []) 10 10 | dict.fromkeys(pierogi_fillings, list()) @@ -63,6 +67,8 @@ RUF024.py:11:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke 13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"}) 14 14 | dict.fromkeys(pierogi_fillings, dict()) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF024.py:12:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys` | 10 | dict.fromkeys(pierogi_fillings, list()) @@ -74,7 +80,7 @@ RUF024.py:12:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke | = help: Replace with comprehension -ℹ Unsafe fix +Suggested fix: 9 9 | dict.fromkeys(pierogi_fillings, []) 10 10 | dict.fromkeys(pierogi_fillings, list()) 11 11 | dict.fromkeys(pierogi_fillings, {}) @@ -84,6 +90,8 @@ RUF024.py:12:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke 14 14 | dict.fromkeys(pierogi_fillings, dict()) 15 15 | import builtins + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF024.py:13:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys` | 11 | dict.fromkeys(pierogi_fillings, {}) @@ -95,7 +103,7 @@ RUF024.py:13:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke | = help: Replace with comprehension -ℹ Unsafe fix +Suggested fix: 10 10 | dict.fromkeys(pierogi_fillings, list()) 11 11 | dict.fromkeys(pierogi_fillings, {}) 12 12 | dict.fromkeys(pierogi_fillings, set()) @@ -105,6 +113,8 @@ RUF024.py:13:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke 15 15 | import builtins 16 16 | builtins.dict.fromkeys(pierogi_fillings, dict()) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF024.py:14:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys` | 12 | dict.fromkeys(pierogi_fillings, set()) @@ -116,7 +126,7 @@ RUF024.py:14:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke | = help: Replace with comprehension -ℹ Unsafe fix +Suggested fix: 11 11 | dict.fromkeys(pierogi_fillings, {}) 12 12 | dict.fromkeys(pierogi_fillings, set()) 13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"}) @@ -126,6 +136,8 @@ RUF024.py:14:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke 16 16 | builtins.dict.fromkeys(pierogi_fillings, dict()) 17 17 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF024.py:16:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys` | 14 | dict.fromkeys(pierogi_fillings, dict()) @@ -137,7 +149,7 @@ RUF024.py:16:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke | = help: Replace with comprehension -ℹ Unsafe fix +Suggested fix: 13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"}) 14 14 | dict.fromkeys(pierogi_fillings, dict()) 15 15 | import builtins @@ -146,3 +158,5 @@ RUF024.py:16:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke 17 17 | 18 18 | # Okay. 19 19 | dict.fromkeys(pierogi_fillings) + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF025_RUF025.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF025_RUF025.py.snap index 519fb1b801390..7798bf19cac9f 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF025_RUF025.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF025_RUF025.py.snap @@ -10,7 +10,7 @@ RUF025.py:6:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict | = help: Replace with `dict.fromkeys(iterable, value)`) -ℹ Safe fix +Suggested fix: 3 3 | 4 4 | def func(): 5 5 | numbers = [1, 2, 3] @@ -20,6 +20,8 @@ RUF025.py:6:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict 8 8 | 9 9 | def func(): + Run `ruff check --fix` to apply this fix. + RUF025.py:10:23: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 9 | def func(): @@ -29,7 +31,7 @@ RUF025.py:10:23: RUF025 [*] Unnecessary dict comprehension for iterable; use `di | = help: Replace with `dict.fromkeys(iterable)`) -ℹ Safe fix +Suggested fix: 7 7 | 8 8 | 9 9 | def func(): @@ -39,6 +41,8 @@ RUF025.py:10:23: RUF025 [*] Unnecessary dict comprehension for iterable; use `di 12 12 | 13 13 | + Run `ruff check --fix` to apply this fix. + RUF025.py:15:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 14 | def func(): @@ -47,7 +51,7 @@ RUF025.py:15:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -ℹ Safe fix +Suggested fix: 12 12 | 13 13 | 14 14 | def func(): @@ -57,6 +61,8 @@ RUF025.py:15:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 17 17 | 18 18 | def func(): + Run `ruff check --fix` to apply this fix. + RUF025.py:26:7: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 24 | return data @@ -66,7 +72,7 @@ RUF025.py:26:7: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -ℹ Safe fix +Suggested fix: 23 23 | def f(data): 24 24 | return data 25 25 | @@ -76,6 +82,8 @@ RUF025.py:26:7: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 28 28 | 29 29 | def func(): + Run `ruff check --fix` to apply this fix. + RUF025.py:30:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 29 | def func(): @@ -84,7 +92,7 @@ RUF025.py:30:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -ℹ Safe fix +Suggested fix: 27 27 | 28 28 | 29 29 | def func(): @@ -94,6 +102,8 @@ RUF025.py:30:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 32 32 | 33 33 | def func(): + Run `ruff check --fix` to apply this fix. + RUF025.py:34:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 33 | def func(): @@ -102,7 +112,7 @@ RUF025.py:34:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -ℹ Safe fix +Suggested fix: 31 31 | 32 32 | 33 33 | def func(): @@ -112,6 +122,8 @@ RUF025.py:34:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 36 36 | 37 37 | def func(): + Run `ruff check --fix` to apply this fix. + RUF025.py:38:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 37 | def func(): @@ -120,7 +132,7 @@ RUF025.py:38:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -ℹ Safe fix +Suggested fix: 35 35 | 36 36 | 37 37 | def func(): @@ -130,6 +142,8 @@ RUF025.py:38:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 40 40 | 41 41 | def func(): + Run `ruff check --fix` to apply this fix. + RUF025.py:42:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 41 | def func(): @@ -138,7 +152,7 @@ RUF025.py:42:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -ℹ Safe fix +Suggested fix: 39 39 | 40 40 | 41 41 | def func(): @@ -148,6 +162,8 @@ RUF025.py:42:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 44 44 | 45 45 | def func(): + Run `ruff check --fix` to apply this fix. + RUF025.py:46:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 45 | def func(): @@ -156,7 +172,7 @@ RUF025.py:46:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -ℹ Safe fix +Suggested fix: 43 43 | 44 44 | 45 45 | def func(): @@ -166,6 +182,8 @@ RUF025.py:46:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 48 48 | 49 49 | def func(): + Run `ruff check --fix` to apply this fix. + RUF025.py:54:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 53 | a = f() @@ -174,7 +192,7 @@ RUF025.py:54:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -ℹ Safe fix +Suggested fix: 51 51 | return 1 52 52 | 53 53 | a = f() @@ -184,6 +202,8 @@ RUF025.py:54:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 56 56 | 57 57 | def func(): + Run `ruff check --fix` to apply this fix. + RUF025.py:59:6: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 57 | def func(): @@ -193,7 +213,7 @@ RUF025.py:59:6: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -ℹ Safe fix +Suggested fix: 56 56 | 57 57 | def func(): 58 58 | values = ["a", "b", "c"] @@ -203,4 +223,4 @@ RUF025.py:59:6: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 61 61 | 62 62 | # Non-violation cases: RUF025 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF026_RUF026.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF026_RUF026.py.snap index 100ff9db321ba..f5e6f5656fc5e 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF026_RUF026.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF026_RUF026.py.snap @@ -9,7 +9,7 @@ RUF026.py:11:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=int)` -ℹ Unsafe fix +Suggested fix: 8 8 | 9 9 | 10 10 | def func(): @@ -19,6 +19,8 @@ RUF026.py:11:5: RUF026 [*] `default_factory` is a positional-only argument to `d 13 13 | 14 14 | def func(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF026.py:15:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | 14 | def func(): @@ -27,7 +29,7 @@ RUF026.py:15:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=float)` -ℹ Unsafe fix +Suggested fix: 12 12 | 13 13 | 14 14 | def func(): @@ -37,6 +39,8 @@ RUF026.py:15:5: RUF026 [*] `default_factory` is a positional-only argument to `d 17 17 | 18 18 | def func(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF026.py:19:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | 18 | def func(): @@ -45,7 +49,7 @@ RUF026.py:19:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=dict)` -ℹ Unsafe fix +Suggested fix: 16 16 | 17 17 | 18 18 | def func(): @@ -55,6 +59,8 @@ RUF026.py:19:5: RUF026 [*] `default_factory` is a positional-only argument to `d 21 21 | 22 22 | def func(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF026.py:23:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | 22 | def func(): @@ -63,7 +69,7 @@ RUF026.py:23:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=list)` -ℹ Unsafe fix +Suggested fix: 20 20 | 21 21 | 22 22 | def func(): @@ -73,6 +79,8 @@ RUF026.py:23:5: RUF026 [*] `default_factory` is a positional-only argument to `d 25 25 | 26 26 | def func(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF026.py:27:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | 26 | def func(): @@ -81,7 +89,7 @@ RUF026.py:27:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=tuple)` -ℹ Unsafe fix +Suggested fix: 24 24 | 25 25 | 26 26 | def func(): @@ -91,6 +99,8 @@ RUF026.py:27:5: RUF026 [*] `default_factory` is a positional-only argument to `d 29 29 | 30 30 | def func(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF026.py:34:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | 32 | pass @@ -100,7 +110,7 @@ RUF026.py:34:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=foo)` -ℹ Unsafe fix +Suggested fix: 31 31 | def foo(): 32 32 | pass 33 33 | @@ -110,6 +120,8 @@ RUF026.py:34:5: RUF026 [*] `default_factory` is a positional-only argument to `d 36 36 | 37 37 | def func(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF026.py:38:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | 37 | def func(): @@ -118,7 +130,7 @@ RUF026.py:38:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=lambda: 1)` -ℹ Unsafe fix +Suggested fix: 35 35 | 36 36 | 37 37 | def func(): @@ -128,6 +140,8 @@ RUF026.py:38:5: RUF026 [*] `default_factory` is a positional-only argument to `d 40 40 | 41 41 | def func(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF026.py:44:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | 42 | from collections import deque @@ -137,7 +151,7 @@ RUF026.py:44:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=deque)` -ℹ Unsafe fix +Suggested fix: 41 41 | def func(): 42 42 | from collections import deque 43 43 | @@ -147,6 +161,8 @@ RUF026.py:44:5: RUF026 [*] `default_factory` is a positional-only argument to `d 46 46 | 47 47 | def func(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF026.py:52:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | 50 | pass @@ -156,7 +172,7 @@ RUF026.py:52:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=MyCallable())` -ℹ Unsafe fix +Suggested fix: 49 49 | def __call__(self): 50 50 | pass 51 51 | @@ -166,6 +182,8 @@ RUF026.py:52:5: RUF026 [*] `default_factory` is a positional-only argument to `d 54 54 | 55 55 | def func(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF026.py:56:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | 55 | def func(): @@ -174,7 +192,7 @@ RUF026.py:56:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=tuple)` -ℹ Unsafe fix +Suggested fix: 53 53 | 54 54 | 55 55 | def func(): @@ -184,6 +202,8 @@ RUF026.py:56:5: RUF026 [*] `default_factory` is a positional-only argument to `d 58 58 | 59 59 | def func(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF026.py:60:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | 59 | def func(): @@ -192,7 +212,7 @@ RUF026.py:60:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=tuple)` -ℹ Unsafe fix +Suggested fix: 57 57 | 58 58 | 59 59 | def func(): @@ -202,6 +222,8 @@ RUF026.py:60:5: RUF026 [*] `default_factory` is a positional-only argument to `d 62 62 | 63 63 | def func(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF026.py:64:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | 63 | def func(): @@ -210,7 +232,7 @@ RUF026.py:64:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=tuple)` -ℹ Unsafe fix +Suggested fix: 61 61 | 62 62 | 63 63 | def func(): @@ -220,6 +242,8 @@ RUF026.py:64:5: RUF026 [*] `default_factory` is a positional-only argument to `d 66 66 | 67 67 | def func(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF026.py:68:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | 67 | def func(): @@ -232,7 +256,7 @@ RUF026.py:68:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=tuple)` -ℹ Unsafe fix +Suggested fix: 66 66 | 67 67 | def func(): 68 68 | defaultdict( @@ -243,6 +267,8 @@ RUF026.py:68:5: RUF026 [*] `default_factory` is a positional-only argument to `d 72 71 | 73 72 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF026.py:75:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | 74 | def func(): @@ -255,7 +281,7 @@ RUF026.py:75:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=tuple)` -ℹ Unsafe fix +Suggested fix: 73 73 | 74 74 | def func(): 75 75 | defaultdict( @@ -266,4 +292,4 @@ RUF026.py:75:5: RUF026 [*] `default_factory` is a positional-only argument to `d 79 78 | 80 79 | - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap index ca858cdcda640..68f26876380ef 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap @@ -10,7 +10,7 @@ RUF027_0.py:5:7: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | "always ignore this: {val}" 4 4 | @@ -20,6 +20,8 @@ RUF027_0.py:5:7: RUF027 [*] Possible f-string without an `f` prefix 7 7 | 8 8 | def simple_cases(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF027_0.py:10:9: RUF027 [*] Possible f-string without an `f` prefix | 8 | def simple_cases(): @@ -30,7 +32,7 @@ RUF027_0.py:10:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -ℹ Unsafe fix +Suggested fix: 7 7 | 8 8 | def simple_cases(): 9 9 | a = 4 @@ -40,6 +42,8 @@ RUF027_0.py:10:9: RUF027 [*] Possible f-string without an `f` prefix 12 12 | 13 13 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF027_0.py:11:9: RUF027 [*] Possible f-string without an `f` prefix | 9 | a = 4 @@ -49,7 +53,7 @@ RUF027_0.py:11:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -ℹ Unsafe fix +Suggested fix: 8 8 | def simple_cases(): 9 9 | a = 4 10 10 | b = "{a}" # RUF027 @@ -59,6 +63,8 @@ RUF027_0.py:11:9: RUF027 [*] Possible f-string without an `f` prefix 13 13 | 14 14 | def escaped_string(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF027_0.py:21:9: RUF027 [*] Possible f-string without an `f` prefix | 19 | def raw_string(): @@ -69,7 +75,7 @@ RUF027_0.py:21:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -ℹ Unsafe fix +Suggested fix: 18 18 | 19 19 | def raw_string(): 20 20 | a = 4 @@ -79,6 +85,8 @@ RUF027_0.py:21:9: RUF027 [*] Possible f-string without an `f` prefix 23 23 | 24 24 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF027_0.py:22:9: RUF027 [*] Possible f-string without an `f` prefix | 20 | a = 4 @@ -88,7 +96,7 @@ RUF027_0.py:22:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -ℹ Unsafe fix +Suggested fix: 19 19 | def raw_string(): 20 20 | a = 4 21 21 | b = r"raw string with formatting: {a}" # RUF027 @@ -98,6 +106,8 @@ RUF027_0.py:22:9: RUF027 [*] Possible f-string without an `f` prefix 24 24 | 25 25 | def print_name(name: str): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF027_0.py:27:11: RUF027 [*] Possible f-string without an `f` prefix | 25 | def print_name(name: str): @@ -108,7 +118,7 @@ RUF027_0.py:27:11: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -ℹ Unsafe fix +Suggested fix: 24 24 | 25 25 | def print_name(name: str): 26 26 | a = 4 @@ -118,6 +128,8 @@ RUF027_0.py:27:11: RUF027 [*] Possible f-string without an `f` prefix 29 29 | 30 30 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF027_0.py:28:11: RUF027 [*] Possible f-string without an `f` prefix | 26 | a = 4 @@ -127,7 +139,7 @@ RUF027_0.py:28:11: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -ℹ Unsafe fix +Suggested fix: 25 25 | def print_name(name: str): 26 26 | a = 4 27 27 | print("Hello, {name}!") # RUF027 @@ -137,6 +149,8 @@ RUF027_0.py:28:11: RUF027 [*] Possible f-string without an `f` prefix 30 30 | 31 31 | def nested_funcs(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF027_0.py:33:33: RUF027 [*] Possible f-string without an `f` prefix | 31 | def nested_funcs(): @@ -146,7 +160,7 @@ RUF027_0.py:33:33: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -ℹ Unsafe fix +Suggested fix: 30 30 | 31 31 | def nested_funcs(): 32 32 | a = 4 @@ -156,6 +170,8 @@ RUF027_0.py:33:33: RUF027 [*] Possible f-string without an `f` prefix 35 35 | 36 36 | def tripled_quoted(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF027_0.py:39:19: RUF027 [*] Possible f-string without an `f` prefix | 37 | a = 4 @@ -167,7 +183,7 @@ RUF027_0.py:39:19: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -ℹ Unsafe fix +Suggested fix: 36 36 | def tripled_quoted(): 37 37 | a = 4 38 38 | c = a @@ -177,6 +193,8 @@ RUF027_0.py:39:19: RUF027 [*] Possible f-string without an `f` prefix 41 41 | multi_line = a = """b { # comment 42 42 | c} d + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF027_0.py:41:22: RUF027 [*] Possible f-string without an `f` prefix | 39 | single_line = """ {a} """ # RUF027 @@ -189,7 +207,7 @@ RUF027_0.py:41:22: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -ℹ Unsafe fix +Suggested fix: 38 38 | c = a 39 39 | single_line = """ {a} """ # RUF027 40 40 | # RUF027 @@ -199,6 +217,8 @@ RUF027_0.py:41:22: RUF027 [*] Possible f-string without an `f` prefix 43 43 | """ 44 44 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF027_0.py:49:9: RUF027 [*] Possible f-string without an `f` prefix | 47 | a = 4 @@ -211,7 +231,7 @@ RUF027_0.py:49:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -ℹ Unsafe fix +Suggested fix: 46 46 | def single_quoted_multi_line(): 47 47 | a = 4 48 48 | # RUF027 @@ -221,6 +241,8 @@ RUF027_0.py:49:9: RUF027 [*] Possible f-string without an `f` prefix 51 51 | " 52 52 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF027_0.py:56:9: RUF027 [*] Possible f-string without an `f` prefix | 54 | def implicit_concat(): @@ -231,7 +253,7 @@ RUF027_0.py:56:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -ℹ Unsafe fix +Suggested fix: 53 53 | 54 54 | def implicit_concat(): 55 55 | a = 4 @@ -241,6 +263,8 @@ RUF027_0.py:56:9: RUF027 [*] Possible f-string without an `f` prefix 58 58 | 59 59 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF027_0.py:57:18: RUF027 [*] Possible f-string without an `f` prefix | 55 | a = 4 @@ -250,7 +274,7 @@ RUF027_0.py:57:18: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -ℹ Unsafe fix +Suggested fix: 54 54 | def implicit_concat(): 55 55 | a = 4 56 56 | b = "{a}" "+" "{b}" r" \\ " # RUF027 for the first part only @@ -260,6 +284,8 @@ RUF027_0.py:57:18: RUF027 [*] Possible f-string without an `f` prefix 59 59 | 60 60 | def escaped_chars(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF027_0.py:62:9: RUF027 [*] Possible f-string without an `f` prefix | 60 | def escaped_chars(): @@ -269,7 +295,7 @@ RUF027_0.py:62:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -ℹ Unsafe fix +Suggested fix: 59 59 | 60 60 | def escaped_chars(): 61 61 | a = 4 @@ -279,6 +305,8 @@ RUF027_0.py:62:9: RUF027 [*] Possible f-string without an `f` prefix 64 64 | 65 65 | def method_calls(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF027_0.py:70:18: RUF027 [*] Possible f-string without an `f` prefix | 68 | first = "Wendy" @@ -290,7 +318,7 @@ RUF027_0.py:70:18: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -ℹ Unsafe fix +Suggested fix: 67 67 | value.method = print_name 68 68 | first = "Wendy" 69 69 | last = "Appleseed" @@ -300,6 +328,8 @@ RUF027_0.py:70:18: RUF027 [*] Possible f-string without an `f` prefix 72 72 | def format_specifiers(): 73 73 | a = 4 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF027_0.py:74:9: RUF027 [*] Possible f-string without an `f` prefix | 72 | def format_specifiers(): @@ -309,11 +339,11 @@ RUF027_0.py:74:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -ℹ Unsafe fix +Suggested fix: 71 71 | 72 72 | def format_specifiers(): 73 73 | a = 4 74 |- b = "{a:b} {a:^5}" 74 |+ b = f"{a:b} {a:^5}" - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF028_RUF028.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF028_RUF028.py.snap index a2846ab41fa89..d6609aafbdb62 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF028_RUF028.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF028_RUF028.py.snap @@ -12,7 +12,7 @@ RUF028.py:3:9: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -ℹ Unsafe fix +Suggested fix: 1 1 | def fmt_off_between_lists(): 2 2 | test_list = [ 3 |- # fmt: off @@ -20,6 +20,8 @@ RUF028.py:3:9: RUF028 [*] This suppression comment is invalid because it cannot 5 4 | 2, 6 5 | 3, + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF028.py:12:5: RUF028 [*] This suppression comment is invalid because it cannot be on its own line | 10 | # note: the second `fmt: skip`` should be OK @@ -30,7 +32,7 @@ RUF028.py:12:5: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -ℹ Unsafe fix +Suggested fix: 9 9 | 10 10 | # note: the second `fmt: skip`` should be OK 11 11 | def fmt_skip_on_own_line(): @@ -39,6 +41,8 @@ RUF028.py:12:5: RUF028 [*] This suppression comment is invalid because it cannot 14 13 | 15 14 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF028.py:17:1: RUF028 [*] This suppression comment is invalid because it cannot be after a decorator | 16 | @fmt_skip_on_own_line @@ -49,7 +53,7 @@ RUF028.py:17:1: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -ℹ Unsafe fix +Suggested fix: 14 14 | 15 15 | 16 16 | @fmt_skip_on_own_line @@ -58,6 +62,8 @@ RUF028.py:17:1: RUF028 [*] This suppression comment is invalid because it cannot 19 18 | def fmt_off_between_decorators(): 20 19 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF028.py:24:1: RUF028 [*] This suppression comment is invalid because it cannot be after a decorator | 23 | @fmt_off_between_decorators @@ -68,7 +74,7 @@ RUF028.py:24:1: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -ℹ Unsafe fix +Suggested fix: 21 21 | 22 22 | 23 23 | @fmt_off_between_decorators @@ -77,6 +83,8 @@ RUF028.py:24:1: RUF028 [*] This suppression comment is invalid because it cannot 26 25 | ... 27 26 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF028.py:33:5: RUF028 [*] This suppression comment is invalid because it cannot be directly above an alternate body | 31 | for val in x: @@ -88,7 +96,7 @@ RUF028.py:33:5: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -ℹ Unsafe fix +Suggested fix: 30 30 | x = [1, 2, 3] 31 31 | for val in x: 32 32 | print(x) @@ -97,6 +105,8 @@ RUF028.py:33:5: RUF028 [*] This suppression comment is invalid because it cannot 35 34 | print("done") 36 35 | while False: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF028.py:39:5: RUF028 [*] This suppression comment is invalid because it cannot be directly above an alternate body | 37 | print("while") @@ -108,7 +118,7 @@ RUF028.py:39:5: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -ℹ Unsafe fix +Suggested fix: 36 36 | while False: 37 37 | print("while") 38 38 | # fmt: off @@ -117,6 +127,8 @@ RUF028.py:39:5: RUF028 [*] This suppression comment is invalid because it cannot 41 40 | print("done") 42 41 | if len(x) > 3: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF028.py:45:5: RUF028 [*] This suppression comment is invalid because it cannot be directly above an alternate body | 43 | print("huh?") @@ -128,7 +140,7 @@ RUF028.py:45:5: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -ℹ Unsafe fix +Suggested fix: 42 42 | if len(x) > 3: 43 43 | print("huh?") 44 44 | # fmt: on @@ -137,6 +149,8 @@ RUF028.py:45:5: RUF028 [*] This suppression comment is invalid because it cannot 47 46 | print("expected") 48 47 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF028.py:52:5: RUF028 [*] This suppression comment is invalid because it cannot be after a decorator | 50 | class Test: @@ -148,7 +162,7 @@ RUF028.py:52:5: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -ℹ Unsafe fix +Suggested fix: 49 49 | 50 50 | class Test: 51 51 | @classmethod @@ -157,6 +171,8 @@ RUF028.py:52:5: RUF028 [*] This suppression comment is invalid because it cannot 54 53 | # fmt: off 55 54 | cls, + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF028.py:54:9: RUF028 [*] This suppression comment is invalid because it cannot be in an expression, pattern, argument list, or other non-statement | 52 | # fmt: off @@ -168,7 +184,7 @@ RUF028.py:54:9: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -ℹ Unsafe fix +Suggested fix: 51 51 | @classmethod 52 52 | # fmt: off 53 53 | def cls_method_a( @@ -177,6 +193,8 @@ RUF028.py:54:9: RUF028 [*] This suppression comment is invalid because it cannot 56 55 | ) -> None: # noqa: test # fmt: skip 57 56 | pass + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF028.py:62:13: RUF028 [*] This suppression comment is invalid because it cannot be at the end of a line | 60 | def fmt_on_trailing(): @@ -187,7 +205,7 @@ RUF028.py:62:13: RUF028 [*] This suppression comment is invalid because it canno | = help: Remove this comment -ℹ Unsafe fix +Suggested fix: 59 59 | 60 60 | def fmt_on_trailing(): 61 61 | # fmt: off @@ -197,6 +215,8 @@ RUF028.py:62:13: RUF028 [*] This suppression comment is invalid because it canno 64 64 | 65 65 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF028.py:63:10: RUF028 [*] This suppression comment is invalid because it cannot be at the end of a line | 61 | # fmt: off @@ -206,7 +226,7 @@ RUF028.py:63:10: RUF028 [*] This suppression comment is invalid because it canno | = help: Remove this comment -ℹ Unsafe fix +Suggested fix: 60 60 | def fmt_on_trailing(): 61 61 | # fmt: off 62 62 | val = 5 # fmt: on @@ -215,3 +235,5 @@ RUF028.py:63:10: RUF028 [*] This suppression comment is invalid because it canno 64 64 | 65 65 | 66 66 | # all of these should be fine + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap index aeea27858e988..007bd033089d3 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap @@ -12,7 +12,7 @@ RUF030.py:6:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 3 3 | # Standard Case 4 4 | # Expects: 5 5 | # - single StringLiteral @@ -22,6 +22,8 @@ RUF030.py:6:14: RUF030 [*] `print()` expression in `assert` statement is likely 8 8 | # Concatenated string literals 9 9 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:11:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 9 | # Expects: @@ -33,7 +35,7 @@ RUF030.py:11:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 8 8 | # Concatenated string literals 9 9 | # Expects: 10 10 | # - single StringLiteral @@ -43,6 +45,8 @@ RUF030.py:11:14: RUF030 [*] `print()` expression in `assert` statement is likely 13 13 | # Positional arguments, string literals 14 14 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:16:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 14 | # Expects: @@ -54,7 +58,7 @@ RUF030.py:16:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 13 13 | # Positional arguments, string literals 14 14 | # Expects: 15 15 | # - single StringLiteral concatenated with " " @@ -64,6 +68,8 @@ RUF030.py:16:14: RUF030 [*] `print()` expression in `assert` statement is likely 18 18 | # Concatenated string literals combined with Positional arguments 19 19 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:21:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 19 | # Expects: @@ -75,7 +81,7 @@ RUF030.py:21:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 18 18 | # Concatenated string literals combined with Positional arguments 19 19 | # Expects: 20 20 | # - single stringliteral concatenated with " " only between `print` and `is` @@ -85,6 +91,8 @@ RUF030.py:21:14: RUF030 [*] `print()` expression in `assert` statement is likely 23 23 | # Positional arguments, string literals with a variable 24 24 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:26:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 24 | # Expects: @@ -96,7 +104,7 @@ RUF030.py:26:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 23 23 | # Positional arguments, string literals with a variable 24 24 | # Expects: 25 25 | # - single FString concatenated with " " @@ -106,6 +114,8 @@ RUF030.py:26:14: RUF030 [*] `print()` expression in `assert` statement is likely 28 28 | # Mixed brackets string literals 29 29 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:31:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 29 | # Expects: @@ -117,7 +127,7 @@ RUF030.py:31:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 28 28 | # Mixed brackets string literals 29 29 | # Expects: 30 30 | # - single StringLiteral concatenated with " " @@ -127,6 +137,8 @@ RUF030.py:31:14: RUF030 [*] `print()` expression in `assert` statement is likely 33 33 | # Mixed brackets with other brackets inside 34 34 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:36:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 34 | # Expects: @@ -138,7 +150,7 @@ RUF030.py:36:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 33 33 | # Mixed brackets with other brackets inside 34 34 | # Expects: 35 35 | # - single StringLiteral concatenated with " " and escaped brackets @@ -148,6 +160,8 @@ RUF030.py:36:14: RUF030 [*] `print()` expression in `assert` statement is likely 38 38 | # Positional arguments, string literals with a separator 39 39 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:41:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 39 | # Expects: @@ -159,7 +173,7 @@ RUF030.py:41:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 38 38 | # Positional arguments, string literals with a separator 39 39 | # Expects: 40 40 | # - single StringLiteral concatenated with "|" @@ -169,6 +183,8 @@ RUF030.py:41:14: RUF030 [*] `print()` expression in `assert` statement is likely 43 43 | # Positional arguments, string literals with None as separator 44 44 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:46:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 44 | # Expects: @@ -180,7 +196,7 @@ RUF030.py:46:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 43 43 | # Positional arguments, string literals with None as separator 44 44 | # Expects: 45 45 | # - single StringLiteral concatenated with " " @@ -190,6 +206,8 @@ RUF030.py:46:14: RUF030 [*] `print()` expression in `assert` statement is likely 48 48 | # Positional arguments, string literals with variable as separator, needs f-string 49 49 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:51:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 49 | # Expects: @@ -201,7 +219,7 @@ RUF030.py:51:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 48 48 | # Positional arguments, string literals with variable as separator, needs f-string 49 49 | # Expects: 50 50 | # - single FString concatenated with "{U00A0}" @@ -211,6 +229,8 @@ RUF030.py:51:14: RUF030 [*] `print()` expression in `assert` statement is likely 53 53 | # Unnecessary f-string 54 54 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:56:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 54 | # Expects: @@ -222,7 +242,7 @@ RUF030.py:56:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 53 53 | # Unnecessary f-string 54 54 | # Expects: 55 55 | # - single StringLiteral @@ -232,6 +252,8 @@ RUF030.py:56:14: RUF030 [*] `print()` expression in `assert` statement is likely 58 58 | # Positional arguments, string literals and f-strings 59 59 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:61:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 59 | # Expects: @@ -243,7 +265,7 @@ RUF030.py:61:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 58 58 | # Positional arguments, string literals and f-strings 59 59 | # Expects: 60 60 | # - single FString concatenated with " " @@ -253,6 +275,8 @@ RUF030.py:61:14: RUF030 [*] `print()` expression in `assert` statement is likely 63 63 | # Positional arguments, string literals and f-strings with a separator 64 64 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:66:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 64 | # Expects: @@ -264,7 +288,7 @@ RUF030.py:66:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 63 63 | # Positional arguments, string literals and f-strings with a separator 64 64 | # Expects: 65 65 | # - single FString concatenated with "|" @@ -274,6 +298,8 @@ RUF030.py:66:14: RUF030 [*] `print()` expression in `assert` statement is likely 68 68 | # A single f-string 69 69 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:71:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 69 | # Expects: @@ -285,7 +311,7 @@ RUF030.py:71:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 68 68 | # A single f-string 69 69 | # Expects: 70 70 | # - single FString @@ -295,6 +321,8 @@ RUF030.py:71:14: RUF030 [*] `print()` expression in `assert` statement is likely 73 73 | # A single f-string with a redundant separator 74 74 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:76:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 74 | # Expects: @@ -306,7 +334,7 @@ RUF030.py:76:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 73 73 | # A single f-string with a redundant separator 74 74 | # Expects: 75 75 | # - single FString @@ -316,6 +344,8 @@ RUF030.py:76:14: RUF030 [*] `print()` expression in `assert` statement is likely 78 78 | # Complex f-string with variable as separator 79 79 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:83:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 81 | condition = "True is True" @@ -327,7 +357,7 @@ RUF030.py:83:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 80 80 | # - single FString concatenated with "{U00A0}", all placeholders preserved 81 81 | condition = "True is True" 82 82 | maintainer = "John Doe" @@ -337,6 +367,8 @@ RUF030.py:83:14: RUF030 [*] `print()` expression in `assert` statement is likely 85 85 | # Empty print 86 86 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:88:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 86 | # Expects: @@ -348,7 +380,7 @@ RUF030.py:88:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 85 85 | # Empty print 86 86 | # Expects: 87 87 | # - `msg` entirely removed from assertion @@ -358,6 +390,8 @@ RUF030.py:88:14: RUF030 [*] `print()` expression in `assert` statement is likely 90 90 | # Empty print with separator 91 91 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:93:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 91 | # Expects: @@ -369,7 +403,7 @@ RUF030.py:93:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 90 90 | # Empty print with separator 91 91 | # Expects: 92 92 | # - `msg` entirely removed from assertion @@ -379,6 +413,8 @@ RUF030.py:93:14: RUF030 [*] `print()` expression in `assert` statement is likely 95 95 | # Custom print function that actually returns a string 96 96 | # Expects: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF030.py:108:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | 106 | # Expects: @@ -388,9 +424,11 @@ RUF030.py:108:14: RUF030 [*] `print()` expression in `assert` statement is likel | = help: Remove `print` -ℹ Unsafe fix +Suggested fix: 105 105 | # Use of `builtins.print` 106 106 | # Expects: 107 107 | # - single StringLiteral 108 |-assert True, builtins.print("This print should be removed.") 108 |+assert True, "This print should be removed." + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101.py.snap index c7a92cb49eff8..2c2c63c03178a 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101.py.snap @@ -10,7 +10,7 @@ RUF101.py:1:15: RUF101 [*] `RUF940` is a redirect to `RUF950` | = help: Replace with `RUF950` -ℹ Safe fix +Suggested fix: 1 |-x = 2 # noqa: RUF940 2 1 | x = 2 # noqa: RUF950 2 |+x = 2 # noqa: RUF950 @@ -18,6 +18,8 @@ RUF101.py:1:15: RUF101 [*] `RUF940` is a redirect to `RUF950` 4 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 5 5 | x = 2 # noqa: RUF940, RUF950, RUF940 + Run `ruff check --fix` to apply this fix. + RUF101.py:3:15: RUF101 [*] `RUF940` is a redirect to `RUF950` | 1 | x = 2 # noqa: RUF940 @@ -29,7 +31,7 @@ RUF101.py:3:15: RUF101 [*] `RUF940` is a redirect to `RUF950` | = help: Replace with `RUF950` -ℹ Safe fix +Suggested fix: 1 1 | x = 2 # noqa: RUF940 2 2 | x = 2 # noqa: RUF950 3 |-x = 2 # noqa: RUF940, RUF950 @@ -38,6 +40,8 @@ RUF101.py:3:15: RUF101 [*] `RUF940` is a redirect to `RUF950` 5 5 | x = 2 # noqa: RUF940, RUF950, RUF940 6 6 | x = 2 # noqa: RUF940, RUF950, RUF940, RUF950 + Run `ruff check --fix` to apply this fix. + RUF101.py:4:23: RUF101 [*] `RUF940` is a redirect to `RUF950` | 2 | x = 2 # noqa: RUF950 @@ -49,7 +53,7 @@ RUF101.py:4:23: RUF101 [*] `RUF940` is a redirect to `RUF950` | = help: Replace with `RUF950` -ℹ Safe fix +Suggested fix: 1 1 | x = 2 # noqa: RUF940 2 2 | x = 2 # noqa: RUF950 3 3 | x = 2 # noqa: RUF940, RUF950 @@ -58,6 +62,8 @@ RUF101.py:4:23: RUF101 [*] `RUF940` is a redirect to `RUF950` 5 5 | x = 2 # noqa: RUF940, RUF950, RUF940 6 6 | x = 2 # noqa: RUF940, RUF950, RUF940, RUF950 + Run `ruff check --fix` to apply this fix. + RUF101.py:5:15: RUF101 [*] `RUF940` is a redirect to `RUF950` | 3 | x = 2 # noqa: RUF940, RUF950 @@ -68,7 +74,7 @@ RUF101.py:5:15: RUF101 [*] `RUF940` is a redirect to `RUF950` | = help: Replace with `RUF950` -ℹ Safe fix +Suggested fix: 2 2 | x = 2 # noqa: RUF950 3 3 | x = 2 # noqa: RUF940, RUF950 4 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 @@ -76,6 +82,8 @@ RUF101.py:5:15: RUF101 [*] `RUF940` is a redirect to `RUF950` 5 |+x = 2 # noqa: RUF950, RUF950, RUF940 6 6 | x = 2 # noqa: RUF940, RUF950, RUF940, RUF950 + Run `ruff check --fix` to apply this fix. + RUF101.py:5:31: RUF101 [*] `RUF940` is a redirect to `RUF950` | 3 | x = 2 # noqa: RUF940, RUF950 @@ -86,7 +94,7 @@ RUF101.py:5:31: RUF101 [*] `RUF940` is a redirect to `RUF950` | = help: Replace with `RUF950` -ℹ Safe fix +Suggested fix: 2 2 | x = 2 # noqa: RUF950 3 3 | x = 2 # noqa: RUF940, RUF950 4 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 @@ -94,6 +102,8 @@ RUF101.py:5:31: RUF101 [*] `RUF940` is a redirect to `RUF950` 5 |+x = 2 # noqa: RUF940, RUF950, RUF950 6 6 | x = 2 # noqa: RUF940, RUF950, RUF940, RUF950 + Run `ruff check --fix` to apply this fix. + RUF101.py:6:15: RUF101 [*] `RUF940` is a redirect to `RUF950` | 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 @@ -103,13 +113,15 @@ RUF101.py:6:15: RUF101 [*] `RUF940` is a redirect to `RUF950` | = help: Replace with `RUF950` -ℹ Safe fix +Suggested fix: 3 3 | x = 2 # noqa: RUF940, RUF950 4 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 5 5 | x = 2 # noqa: RUF940, RUF950, RUF940 6 |-x = 2 # noqa: RUF940, RUF950, RUF940, RUF950 6 |+x = 2 # noqa: RUF950, RUF950, RUF940, RUF950 + Run `ruff check --fix` to apply this fix. + RUF101.py:6:31: RUF101 [*] `RUF940` is a redirect to `RUF950` | 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 @@ -119,9 +131,11 @@ RUF101.py:6:31: RUF101 [*] `RUF940` is a redirect to `RUF950` | = help: Replace with `RUF950` -ℹ Safe fix +Suggested fix: 3 3 | x = 2 # noqa: RUF940, RUF950 4 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 5 5 | x = 2 # noqa: RUF940, RUF950, RUF940 6 |-x = 2 # noqa: RUF940, RUF950, RUF940, RUF950 6 |+x = 2 # noqa: RUF940, RUF950, RUF950, RUF950 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap index 6736a8f1c5020..1f5858da03de2 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap @@ -10,11 +10,11 @@ noqa.py:23:5: F841 [*] Local variable `I` is assigned to but never used | = help: Remove assignment to unused variable `I` -ℹ Unsafe fix +Suggested fix: 20 20 | 21 21 | def f(): 22 22 | # Only `E741` should be ignored by the `noqa`. 23 |- I = 1 # noqa: E741.F841 23 |+ pass # noqa: E741.F841 - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap index 4832895a7074b..1b3d50d0b3ca1 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap @@ -10,7 +10,7 @@ RUF100_0.py:9:12: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 6 6 | b = 2 # noqa: F841 7 7 | 8 8 | # Invalid @@ -20,6 +20,8 @@ RUF100_0.py:9:12: RUF100 [*] Unused blanket `noqa` directive 11 11 | 12 12 | # Invalid + Run `ruff check --fix` to apply this fix. + RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 12 | # Invalid @@ -30,7 +32,7 @@ RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 10 10 | print(c) 11 11 | 12 12 | # Invalid @@ -40,6 +42,8 @@ RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) 15 15 | # Invalid 16 16 | d = 1 # noqa: F841, E501 + Run `ruff check --fix` to apply this fix. + RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) | 15 | # Invalid @@ -50,7 +54,7 @@ RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 13 13 | d = 1 # noqa: E501 14 14 | 15 15 | # Invalid @@ -60,6 +64,8 @@ RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) 18 18 | # Invalid (and unimplemented or not enabled) 19 19 | d = 1 # noqa: F841, W191, F821 + Run `ruff check --fix` to apply this fix. + RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; non-enabled: `F821`) | 18 | # Invalid (and unimplemented or not enabled) @@ -70,7 +76,7 @@ RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; n | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 16 16 | d = 1 # noqa: F841, E501 17 17 | 18 18 | # Invalid (and unimplemented or not enabled) @@ -80,6 +86,8 @@ RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; n 21 21 | # Invalid (but external) 22 22 | d = 1 # noqa: F841, V101 + Run `ruff check --fix` to apply this fix. + RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) | 21 | # Invalid (but external) @@ -90,7 +98,7 @@ RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 19 19 | d = 1 # noqa: F841, W191, F821 20 20 | 21 21 | # Invalid (but external) @@ -100,6 +108,8 @@ RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) 24 24 | # Invalid (but external) 25 25 | d = 1 # noqa: V500 + Run `ruff check --fix` to apply this fix. + RUF100_0.py:25:12: RUF100 [*] Unused `noqa` directive (unknown: `V500`) | 24 | # Invalid (but external) @@ -110,7 +120,7 @@ RUF100_0.py:25:12: RUF100 [*] Unused `noqa` directive (unknown: `V500`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 22 22 | d = 1 # noqa: F841, V101 23 23 | 24 24 | # Invalid (but external) @@ -120,6 +130,8 @@ RUF100_0.py:25:12: RUF100 [*] Unused `noqa` directive (unknown: `V500`) 27 27 | # fmt: off 28 28 | # Invalid - no space before # + Run `ruff check --fix` to apply this fix. + RUF100_0.py:29:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 27 | # fmt: off @@ -131,7 +143,7 @@ RUF100_0.py:29:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 26 26 | 27 27 | # fmt: off 28 28 | # Invalid - no space before # @@ -141,6 +153,8 @@ RUF100_0.py:29:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) 31 31 | # Invalid - many spaces before # 32 32 | d = 1 # noqa: E501 + Run `ruff check --fix` to apply this fix. + RUF100_0.py:32:5: F841 [*] Local variable `d` is assigned to but never used | 31 | # Invalid - many spaces before # @@ -150,7 +164,7 @@ RUF100_0.py:32:5: F841 [*] Local variable `d` is assigned to but never used | = help: Remove assignment to unused variable `d` -ℹ Unsafe fix +Suggested fix: 29 29 | d = 1 # noqa: E501 30 30 | 31 31 | # Invalid - many spaces before # @@ -159,6 +173,8 @@ RUF100_0.py:32:5: F841 [*] Local variable `d` is assigned to but never used 34 33 | 35 34 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF100_0.py:32:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 31 | # Invalid - many spaces before # @@ -168,7 +184,7 @@ RUF100_0.py:32:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 29 29 | d = 1 # noqa: E501 30 30 | 31 31 | # Invalid - many spaces before # @@ -178,6 +194,8 @@ RUF100_0.py:32:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) 34 34 | 35 35 | + Run `ruff check --fix` to apply this fix. + RUF100_0.py:58:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) | 57 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. @@ -188,7 +206,7 @@ RUF100_0.py:58:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 55 55 | https://github.com/PyCQA/pycodestyle/pull/258/files#diff-841c622497a8033d10152bfdfb15b20b92437ecdea21a260944ea86b77b51533 56 56 | 57 57 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. @@ -198,6 +216,8 @@ RUF100_0.py:58:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) 60 60 | # Invalid 61 61 | _ = """Lorem ipsum dolor sit amet. + Run `ruff check --fix` to apply this fix. + RUF100_0.py:66:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 65 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. @@ -208,7 +228,7 @@ RUF100_0.py:66:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 63 63 | https://github.com/PyCQA/pycodestyle/pull/258/files#diff-841c622497a8033d10152bfdfb15b20b92437ecdea21a260944ea86b77b51533 64 64 | 65 65 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. @@ -218,6 +238,8 @@ RUF100_0.py:66:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) 68 68 | # Invalid 69 69 | _ = """Lorem ipsum dolor sit amet. + Run `ruff check --fix` to apply this fix. + RUF100_0.py:74:6: RUF100 [*] Unused blanket `noqa` directive | 73 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. @@ -228,7 +250,7 @@ RUF100_0.py:74:6: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 71 71 | https://github.com/PyCQA/pycodestyle/pull/258/files#diff-841c622497a8033d10152bfdfb15b20b92437ecdea21a260944ea86b77b51533 72 72 | 73 73 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. @@ -238,6 +260,8 @@ RUF100_0.py:74:6: RUF100 [*] Unused blanket `noqa` directive 76 76 | # Valid 77 77 | # this is a veryyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy long comment # noqa: E501 + Run `ruff check --fix` to apply this fix. + RUF100_0.py:88:8: F401 [*] `shelve` imported but unused | 86 | import collections # noqa @@ -248,7 +272,7 @@ RUF100_0.py:88:8: F401 [*] `shelve` imported but unused | = help: Remove unused import: `shelve` -ℹ Safe fix +Suggested fix: 85 85 | 86 86 | import collections # noqa 87 87 | import os # noqa: F401, RUF100 @@ -257,6 +281,8 @@ RUF100_0.py:88:8: F401 [*] `shelve` imported but unused 90 89 | 91 90 | print(sys.path) + Run `ruff check --fix` to apply this fix. + RUF100_0.py:93:89: E501 Line too long (89 > 88) | 91 | print(sys.path) @@ -274,7 +300,7 @@ RUF100_0.py:93:92: RUF100 [*] Unused `noqa` directive (unused: `F401`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 90 90 | 91 91 | print(sys.path) 92 92 | @@ -284,6 +310,8 @@ RUF100_0.py:93:92: RUF100 [*] Unused `noqa` directive (unused: `F401`) 95 95 | 96 96 | def f(): + Run `ruff check --fix` to apply this fix. + RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | 105 | def f(): @@ -294,7 +322,7 @@ RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 104 104 | 105 105 | def f(): 106 106 | # Invalid - nonexistent error code with multibyte character @@ -304,6 +332,8 @@ RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) 109 109 | 110 110 | + Run `ruff check --fix` to apply this fix. + RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used | 106 | # Invalid - nonexistent error code with multibyte character @@ -313,7 +343,7 @@ RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used | = help: Remove assignment to unused variable `e` -ℹ Unsafe fix +Suggested fix: 105 105 | def f(): 106 106 | # Invalid - nonexistent error code with multibyte character 107 107 | d = 1 # …noqa: F841, E50 @@ -322,6 +352,8 @@ RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used 110 109 | 111 110 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF100_0.py:108:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | 106 | # Invalid - nonexistent error code with multibyte character @@ -331,7 +363,7 @@ RUF100_0.py:108:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 105 105 | def f(): 106 106 | # Invalid - nonexistent error code with multibyte character 107 107 | d = 1 # …noqa: F841, E50 @@ -341,6 +373,8 @@ RUF100_0.py:108:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) 110 110 | 111 111 | def f(): + Run `ruff check --fix` to apply this fix. + RUF100_0.py:118:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`; unknown: `X200`) | 116 | # Check duplicate code detection @@ -352,7 +386,7 @@ RUF100_0.py:118:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`; unkn | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 115 115 | 116 116 | # Check duplicate code detection 117 117 | def f(): @@ -362,6 +396,8 @@ RUF100_0.py:118:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`; unkn 120 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 121 121 | + Run `ruff check --fix` to apply this fix. + RUF100_0.py:120:19: RUF100 [*] Unused `noqa` directive (duplicated: `SIM300`, `SIM300`) | 118 | x = 2 # noqa: F841, F841, X200 @@ -373,7 +409,7 @@ RUF100_0.py:120:19: RUF100 [*] Unused `noqa` directive (duplicated: `SIM300`, `S | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 117 117 | def f(): 118 118 | x = 2 # noqa: F841, F841, X200 119 119 | @@ -383,6 +419,8 @@ RUF100_0.py:120:19: RUF100 [*] Unused `noqa` directive (duplicated: `SIM300`, `S 122 122 | z = 2 # noqa: F841 F841 F841, F841, F841 123 123 | + Run `ruff check --fix` to apply this fix. + RUF100_0.py:122:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`, `F841`, `F841`, `F841`) | 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 @@ -394,7 +432,7 @@ RUF100_0.py:122:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`, `F84 | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 119 119 | 120 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 121 121 | @@ -404,6 +442,8 @@ RUF100_0.py:122:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`, `F84 124 124 | return 125 125 | + Run `ruff check --fix` to apply this fix. + RUF100_0.py:129:20: RUF100 [*] Unused `noqa` directive (duplicated: `S307`, `S307`, `S307`) | 127 | # Allow code redirects @@ -415,7 +455,7 @@ RUF100_0.py:129:20: RUF100 [*] Unused `noqa` directive (duplicated: `S307`, `S30 | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 126 126 | 127 127 | # Allow code redirects 128 128 | x = eval(command) # noqa: PGH001, S307 @@ -424,6 +464,8 @@ RUF100_0.py:129:20: RUF100 [*] Unused `noqa` directive (duplicated: `S307`, `S30 130 130 | x = eval(command) # noqa: PGH001, S307, PGH001 131 131 | x = eval(command) # noqa: PGH001, S307, PGH001, S307 + Run `ruff check --fix` to apply this fix. + RUF100_0.py:130:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`) | 128 | x = eval(command) # noqa: PGH001, S307 @@ -434,7 +476,7 @@ RUF100_0.py:130:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 127 127 | # Allow code redirects 128 128 | x = eval(command) # noqa: PGH001, S307 129 129 | x = eval(command) # noqa: S307, PGH001, S307, S307, S307 @@ -442,6 +484,8 @@ RUF100_0.py:130:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`) 130 |+x = eval(command) # noqa: PGH001, S307 131 131 | x = eval(command) # noqa: PGH001, S307, PGH001, S307 + Run `ruff check --fix` to apply this fix. + RUF100_0.py:131:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`, `S307`) | 129 | x = eval(command) # noqa: S307, PGH001, S307, S307, S307 @@ -451,9 +495,11 @@ RUF100_0.py:131:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`, `S | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 128 128 | x = eval(command) # noqa: PGH001, S307 129 129 | x = eval(command) # noqa: S307, PGH001, S307, S307, S307 130 130 | x = eval(command) # noqa: PGH001, S307, PGH001 131 |-x = eval(command) # noqa: PGH001, S307, PGH001, S307 131 |+x = eval(command) # noqa: PGH001, S307 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap index 10d49089c3dc9..002149c06d1ff 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap @@ -10,7 +10,7 @@ RUF100_0.py:9:12: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 6 6 | b = 2 # noqa: F841 7 7 | 8 8 | # Invalid @@ -20,6 +20,8 @@ RUF100_0.py:9:12: RUF100 [*] Unused blanket `noqa` directive 11 11 | 12 12 | # Invalid + Run `ruff check --fix` to apply this fix. + RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 12 | # Invalid @@ -30,7 +32,7 @@ RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 10 10 | print(c) 11 11 | 12 12 | # Invalid @@ -40,6 +42,8 @@ RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) 15 15 | # Invalid 16 16 | d = 1 # noqa: F841, E501 + Run `ruff check --fix` to apply this fix. + RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) | 15 | # Invalid @@ -50,7 +54,7 @@ RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 13 13 | d = 1 # noqa: E501 14 14 | 15 15 | # Invalid @@ -60,6 +64,8 @@ RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) 18 18 | # Invalid (and unimplemented or not enabled) 19 19 | d = 1 # noqa: F841, W191, F821 + Run `ruff check --fix` to apply this fix. + RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; non-enabled: `F821`) | 18 | # Invalid (and unimplemented or not enabled) @@ -70,7 +76,7 @@ RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; n | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 16 16 | d = 1 # noqa: F841, E501 17 17 | 18 18 | # Invalid (and unimplemented or not enabled) @@ -80,6 +86,8 @@ RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; n 21 21 | # Invalid (but external) 22 22 | d = 1 # noqa: F841, V101 + Run `ruff check --fix` to apply this fix. + RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) | 21 | # Invalid (but external) @@ -90,7 +98,7 @@ RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 19 19 | d = 1 # noqa: F841, W191, F821 20 20 | 21 21 | # Invalid (but external) @@ -100,6 +108,8 @@ RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) 24 24 | # Invalid (but external) 25 25 | d = 1 # noqa: V500 + Run `ruff check --fix` to apply this fix. + RUF100_0.py:29:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 27 | # fmt: off @@ -111,7 +121,7 @@ RUF100_0.py:29:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 26 26 | 27 27 | # fmt: off 28 28 | # Invalid - no space before # @@ -121,6 +131,8 @@ RUF100_0.py:29:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) 31 31 | # Invalid - many spaces before # 32 32 | d = 1 # noqa: E501 + Run `ruff check --fix` to apply this fix. + RUF100_0.py:32:5: F841 [*] Local variable `d` is assigned to but never used | 31 | # Invalid - many spaces before # @@ -130,7 +142,7 @@ RUF100_0.py:32:5: F841 [*] Local variable `d` is assigned to but never used | = help: Remove assignment to unused variable `d` -ℹ Unsafe fix +Suggested fix: 29 29 | d = 1 # noqa: E501 30 30 | 31 31 | # Invalid - many spaces before # @@ -139,6 +151,8 @@ RUF100_0.py:32:5: F841 [*] Local variable `d` is assigned to but never used 34 33 | 35 34 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF100_0.py:32:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 31 | # Invalid - many spaces before # @@ -148,7 +162,7 @@ RUF100_0.py:32:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 29 29 | d = 1 # noqa: E501 30 30 | 31 31 | # Invalid - many spaces before # @@ -158,6 +172,8 @@ RUF100_0.py:32:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) 34 34 | 35 35 | + Run `ruff check --fix` to apply this fix. + RUF100_0.py:58:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) | 57 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. @@ -168,7 +184,7 @@ RUF100_0.py:58:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 55 55 | https://github.com/PyCQA/pycodestyle/pull/258/files#diff-841c622497a8033d10152bfdfb15b20b92437ecdea21a260944ea86b77b51533 56 56 | 57 57 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. @@ -178,6 +194,8 @@ RUF100_0.py:58:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) 60 60 | # Invalid 61 61 | _ = """Lorem ipsum dolor sit amet. + Run `ruff check --fix` to apply this fix. + RUF100_0.py:66:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 65 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. @@ -188,7 +206,7 @@ RUF100_0.py:66:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 63 63 | https://github.com/PyCQA/pycodestyle/pull/258/files#diff-841c622497a8033d10152bfdfb15b20b92437ecdea21a260944ea86b77b51533 64 64 | 65 65 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. @@ -198,6 +216,8 @@ RUF100_0.py:66:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) 68 68 | # Invalid 69 69 | _ = """Lorem ipsum dolor sit amet. + Run `ruff check --fix` to apply this fix. + RUF100_0.py:74:6: RUF100 [*] Unused blanket `noqa` directive | 73 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. @@ -208,7 +228,7 @@ RUF100_0.py:74:6: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 71 71 | https://github.com/PyCQA/pycodestyle/pull/258/files#diff-841c622497a8033d10152bfdfb15b20b92437ecdea21a260944ea86b77b51533 72 72 | 73 73 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. @@ -218,6 +238,8 @@ RUF100_0.py:74:6: RUF100 [*] Unused blanket `noqa` directive 76 76 | # Valid 77 77 | # this is a veryyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy long comment # noqa: E501 + Run `ruff check --fix` to apply this fix. + RUF100_0.py:88:8: F401 [*] `shelve` imported but unused | 86 | import collections # noqa @@ -228,7 +250,7 @@ RUF100_0.py:88:8: F401 [*] `shelve` imported but unused | = help: Remove unused import: `shelve` -ℹ Safe fix +Suggested fix: 85 85 | 86 86 | import collections # noqa 87 87 | import os # noqa: F401, RUF100 @@ -237,6 +259,8 @@ RUF100_0.py:88:8: F401 [*] `shelve` imported but unused 90 89 | 91 90 | print(sys.path) + Run `ruff check --fix` to apply this fix. + RUF100_0.py:93:89: E501 Line too long (89 > 88) | 91 | print(sys.path) @@ -254,7 +278,7 @@ RUF100_0.py:93:92: RUF100 [*] Unused `noqa` directive (unused: `F401`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 90 90 | 91 91 | print(sys.path) 92 92 | @@ -264,6 +288,8 @@ RUF100_0.py:93:92: RUF100 [*] Unused `noqa` directive (unused: `F401`) 95 95 | 96 96 | def f(): + Run `ruff check --fix` to apply this fix. + RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | 105 | def f(): @@ -274,7 +300,7 @@ RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 104 104 | 105 105 | def f(): 106 106 | # Invalid - nonexistent error code with multibyte character @@ -284,6 +310,8 @@ RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) 109 109 | 110 110 | + Run `ruff check --fix` to apply this fix. + RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used | 106 | # Invalid - nonexistent error code with multibyte character @@ -293,7 +321,7 @@ RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used | = help: Remove assignment to unused variable `e` -ℹ Unsafe fix +Suggested fix: 105 105 | def f(): 106 106 | # Invalid - nonexistent error code with multibyte character 107 107 | d = 1 # …noqa: F841, E50 @@ -302,6 +330,8 @@ RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used 110 109 | 111 110 | def f(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + RUF100_0.py:108:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | 106 | # Invalid - nonexistent error code with multibyte character @@ -311,7 +341,7 @@ RUF100_0.py:108:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 105 105 | def f(): 106 106 | # Invalid - nonexistent error code with multibyte character 107 107 | d = 1 # …noqa: F841, E50 @@ -321,6 +351,8 @@ RUF100_0.py:108:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) 110 110 | 111 111 | def f(): + Run `ruff check --fix` to apply this fix. + RUF100_0.py:118:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`; unknown: `X200`) | 116 | # Check duplicate code detection @@ -332,7 +364,7 @@ RUF100_0.py:118:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`; unkn | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 115 115 | 116 116 | # Check duplicate code detection 117 117 | def f(): @@ -342,6 +374,8 @@ RUF100_0.py:118:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`; unkn 120 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 121 121 | + Run `ruff check --fix` to apply this fix. + RUF100_0.py:120:19: RUF100 [*] Unused `noqa` directive (duplicated: `SIM300`, `SIM300`) | 118 | x = 2 # noqa: F841, F841, X200 @@ -353,7 +387,7 @@ RUF100_0.py:120:19: RUF100 [*] Unused `noqa` directive (duplicated: `SIM300`, `S | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 117 117 | def f(): 118 118 | x = 2 # noqa: F841, F841, X200 119 119 | @@ -363,6 +397,8 @@ RUF100_0.py:120:19: RUF100 [*] Unused `noqa` directive (duplicated: `SIM300`, `S 122 122 | z = 2 # noqa: F841 F841 F841, F841, F841 123 123 | + Run `ruff check --fix` to apply this fix. + RUF100_0.py:122:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`, `F841`, `F841`, `F841`) | 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 @@ -374,7 +410,7 @@ RUF100_0.py:122:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`, `F84 | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 119 119 | 120 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 121 121 | @@ -384,6 +420,8 @@ RUF100_0.py:122:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`, `F84 124 124 | return 125 125 | + Run `ruff check --fix` to apply this fix. + RUF100_0.py:129:20: RUF100 [*] Unused `noqa` directive (duplicated: `S307`, `S307`, `S307`) | 127 | # Allow code redirects @@ -395,7 +433,7 @@ RUF100_0.py:129:20: RUF100 [*] Unused `noqa` directive (duplicated: `S307`, `S30 | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 126 126 | 127 127 | # Allow code redirects 128 128 | x = eval(command) # noqa: PGH001, S307 @@ -404,6 +442,8 @@ RUF100_0.py:129:20: RUF100 [*] Unused `noqa` directive (duplicated: `S307`, `S30 130 130 | x = eval(command) # noqa: PGH001, S307, PGH001 131 131 | x = eval(command) # noqa: PGH001, S307, PGH001, S307 + Run `ruff check --fix` to apply this fix. + RUF100_0.py:130:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`) | 128 | x = eval(command) # noqa: PGH001, S307 @@ -414,7 +454,7 @@ RUF100_0.py:130:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 127 127 | # Allow code redirects 128 128 | x = eval(command) # noqa: PGH001, S307 129 129 | x = eval(command) # noqa: S307, PGH001, S307, S307, S307 @@ -422,6 +462,8 @@ RUF100_0.py:130:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`) 130 |+x = eval(command) # noqa: PGH001, S307 131 131 | x = eval(command) # noqa: PGH001, S307, PGH001, S307 + Run `ruff check --fix` to apply this fix. + RUF100_0.py:131:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`, `S307`) | 129 | x = eval(command) # noqa: S307, PGH001, S307, S307, S307 @@ -431,9 +473,11 @@ RUF100_0.py:131:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`, `S | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 128 128 | x = eval(command) # noqa: PGH001, S307 129 129 | x = eval(command) # noqa: S307, PGH001, S307, S307, S307 130 130 | x = eval(command) # noqa: PGH001, S307, PGH001 131 |-x = eval(command) # noqa: PGH001, S307, PGH001, S307 131 |+x = eval(command) # noqa: PGH001, S307 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap index bd0aaf365a2cf..f46717e1ee4b0 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap @@ -11,7 +11,7 @@ RUF100_1.py:37:9: F401 [*] `typing.Union` imported but unused | = help: Remove unused import: `typing.Union` -ℹ Safe fix +Suggested fix: 34 34 | # This should ignore the first error. 35 35 | from typing import ( 36 36 | Mapping, # noqa: F401 @@ -22,6 +22,8 @@ RUF100_1.py:37:9: F401 [*] `typing.Union` imported but unused 40 39 | 41 40 | def f(): + Run `ruff check --fix` to apply this fix. + RUF100_1.py:52:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) | 50 | # This should ignore the error, but the inner noqa should be marked as unused. @@ -32,7 +34,7 @@ RUF100_1.py:52:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 49 49 | def f(): 50 50 | # This should ignore the error, but the inner noqa should be marked as unused. 51 51 | from typing import ( # noqa: F401 @@ -42,6 +44,8 @@ RUF100_1.py:52:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) 54 54 | 55 55 | + Run `ruff check --fix` to apply this fix. + RUF100_1.py:59:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) | 57 | # This should ignore the error, but the inner noqa should be marked as unused. @@ -52,7 +56,7 @@ RUF100_1.py:59:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 56 56 | def f(): 57 57 | # This should ignore the error, but the inner noqa should be marked as unused. 58 58 | from typing import ( # noqa @@ -62,6 +66,8 @@ RUF100_1.py:59:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) 61 61 | 62 62 | + Run `ruff check --fix` to apply this fix. + RUF100_1.py:66:16: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | 64 | # This should ignore the error, but mark F501 as unused. @@ -72,7 +78,7 @@ RUF100_1.py:66:16: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 63 63 | def f(): 64 64 | # This should ignore the error, but mark F501 as unused. 65 65 | from typing import ( # noqa: F401 @@ -82,6 +88,8 @@ RUF100_1.py:66:16: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) 68 68 | 69 69 | + Run `ruff check --fix` to apply this fix. + RUF100_1.py:72:27: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | 70 | def f(): @@ -93,7 +101,7 @@ RUF100_1.py:72:27: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 69 69 | 70 70 | def f(): 71 71 | # This should ignore the error, but mark F501 as unused. @@ -103,6 +111,8 @@ RUF100_1.py:72:27: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) 74 74 | ) 75 75 | + Run `ruff check --fix` to apply this fix. + RUF100_1.py:89:24: F401 [*] `typing.Awaitable` imported but unused | 87 | def f(): @@ -112,13 +122,15 @@ RUF100_1.py:89:24: F401 [*] `typing.Awaitable` imported but unused | = help: Remove unused import -ℹ Safe fix +Suggested fix: 86 86 | 87 87 | def f(): 88 88 | # This should mark F501 as unused. 89 |- from typing import Awaitable, AwaitableGenerator # noqa: F501 89 |+ pass # noqa: F501 + Run `ruff check --fix` to apply this fix. + RUF100_1.py:89:35: F401 [*] `typing.AwaitableGenerator` imported but unused | 87 | def f(): @@ -128,13 +140,15 @@ RUF100_1.py:89:35: F401 [*] `typing.AwaitableGenerator` imported but unused | = help: Remove unused import -ℹ Safe fix +Suggested fix: 86 86 | 87 87 | def f(): 88 88 | # This should mark F501 as unused. 89 |- from typing import Awaitable, AwaitableGenerator # noqa: F501 89 |+ pass # noqa: F501 + Run `ruff check --fix` to apply this fix. + RUF100_1.py:89:55: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | 87 | def f(): @@ -144,11 +158,11 @@ RUF100_1.py:89:55: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 86 86 | 87 87 | def f(): 88 88 | # This should mark F501 as unused. 89 |- from typing import Awaitable, AwaitableGenerator # noqa: F501 89 |+ from typing import Awaitable, AwaitableGenerator - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap index 4eef8cdef37e6..f827e039dd0d2 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap @@ -8,8 +8,8 @@ RUF100_2.py:1:19: RUF100 [*] Unused `noqa` directive (unused: `F401`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 1 |-import itertools # noqa: F401 1 |+import itertools - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap index 5f38b489e2ab9..4b51342c5d6ec 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap @@ -10,12 +10,14 @@ RUF100_3.py:1:1: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 1 |-# noqa 2 1 | # noqa # comment 3 2 | print() # noqa 4 3 | print() # noqa # comment + Run `ruff check --fix` to apply this fix. + RUF100_3.py:2:1: RUF100 [*] Unused blanket `noqa` directive | 1 | # noqa @@ -26,7 +28,7 @@ RUF100_3.py:2:1: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 1 1 | # noqa 2 |-# noqa # comment 2 |+# comment @@ -34,6 +36,8 @@ RUF100_3.py:2:1: RUF100 [*] Unused blanket `noqa` directive 4 4 | print() # noqa # comment 5 5 | print() # noqa # comment + Run `ruff check --fix` to apply this fix. + RUF100_3.py:3:10: RUF100 [*] Unused blanket `noqa` directive | 1 | # noqa @@ -45,7 +49,7 @@ RUF100_3.py:3:10: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 1 1 | # noqa 2 2 | # noqa # comment 3 |-print() # noqa @@ -54,6 +58,8 @@ RUF100_3.py:3:10: RUF100 [*] Unused blanket `noqa` directive 5 5 | print() # noqa # comment 6 6 | print() # noqa comment + Run `ruff check --fix` to apply this fix. + RUF100_3.py:4:10: RUF100 [*] Unused blanket `noqa` directive | 2 | # noqa # comment @@ -65,7 +71,7 @@ RUF100_3.py:4:10: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 1 1 | # noqa 2 2 | # noqa # comment 3 3 | print() # noqa @@ -75,6 +81,8 @@ RUF100_3.py:4:10: RUF100 [*] Unused blanket `noqa` directive 6 6 | print() # noqa comment 7 7 | print() # noqa comment + Run `ruff check --fix` to apply this fix. + RUF100_3.py:5:10: RUF100 [*] Unused blanket `noqa` directive | 3 | print() # noqa @@ -86,7 +94,7 @@ RUF100_3.py:5:10: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 2 2 | # noqa # comment 3 3 | print() # noqa 4 4 | print() # noqa # comment @@ -96,6 +104,8 @@ RUF100_3.py:5:10: RUF100 [*] Unused blanket `noqa` directive 7 7 | print() # noqa comment 8 8 | print(a) # noqa + Run `ruff check --fix` to apply this fix. + RUF100_3.py:6:10: RUF100 [*] Unused blanket `noqa` directive | 4 | print() # noqa # comment @@ -107,7 +117,7 @@ RUF100_3.py:6:10: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 3 3 | print() # noqa 4 4 | print() # noqa # comment 5 5 | print() # noqa # comment @@ -117,6 +127,8 @@ RUF100_3.py:6:10: RUF100 [*] Unused blanket `noqa` directive 8 8 | print(a) # noqa 9 9 | print(a) # noqa # comment + Run `ruff check --fix` to apply this fix. + RUF100_3.py:7:10: RUF100 [*] Unused blanket `noqa` directive | 5 | print() # noqa # comment @@ -128,7 +140,7 @@ RUF100_3.py:7:10: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 4 4 | print() # noqa # comment 5 5 | print() # noqa # comment 6 6 | print() # noqa comment @@ -138,6 +150,8 @@ RUF100_3.py:7:10: RUF100 [*] Unused blanket `noqa` directive 9 9 | print(a) # noqa # comment 10 10 | print(a) # noqa # comment + Run `ruff check --fix` to apply this fix. + RUF100_3.py:14:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 12 | print(a) # noqa comment @@ -149,7 +163,7 @@ RUF100_3.py:14:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 11 11 | print(a) # noqa comment 12 12 | print(a) # noqa comment 13 13 | @@ -158,6 +172,8 @@ RUF100_3.py:14:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 16 15 | print() # noqa: E501, F821 17 16 | print() # noqa: E501, F821 # comment + Run `ruff check --fix` to apply this fix. + RUF100_3.py:15:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 14 | # noqa: E501, F821 @@ -168,7 +184,7 @@ RUF100_3.py:15:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 12 12 | print(a) # noqa comment 13 13 | 14 14 | # noqa: E501, F821 @@ -178,6 +194,8 @@ RUF100_3.py:15:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 17 17 | print() # noqa: E501, F821 # comment 18 18 | print() # noqa: E501, F821 # comment + Run `ruff check --fix` to apply this fix. + RUF100_3.py:16:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 14 | # noqa: E501, F821 @@ -189,7 +207,7 @@ RUF100_3.py:16:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 13 13 | 14 14 | # noqa: E501, F821 15 15 | # noqa: E501, F821 # comment @@ -199,6 +217,8 @@ RUF100_3.py:16:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 18 18 | print() # noqa: E501, F821 # comment 19 19 | print() # noqa: E501, F821 comment + Run `ruff check --fix` to apply this fix. + RUF100_3.py:17:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 15 | # noqa: E501, F821 # comment @@ -210,7 +230,7 @@ RUF100_3.py:17:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 14 14 | # noqa: E501, F821 15 15 | # noqa: E501, F821 # comment 16 16 | print() # noqa: E501, F821 @@ -220,6 +240,8 @@ RUF100_3.py:17:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 19 19 | print() # noqa: E501, F821 comment 20 20 | print() # noqa: E501, F821 comment + Run `ruff check --fix` to apply this fix. + RUF100_3.py:18:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 16 | print() # noqa: E501, F821 @@ -231,7 +253,7 @@ RUF100_3.py:18:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 15 15 | # noqa: E501, F821 # comment 16 16 | print() # noqa: E501, F821 17 17 | print() # noqa: E501, F821 # comment @@ -241,6 +263,8 @@ RUF100_3.py:18:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 20 20 | print() # noqa: E501, F821 comment 21 21 | print(a) # noqa: E501, F821 + Run `ruff check --fix` to apply this fix. + RUF100_3.py:19:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 17 | print() # noqa: E501, F821 # comment @@ -252,7 +276,7 @@ RUF100_3.py:19:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 16 16 | print() # noqa: E501, F821 17 17 | print() # noqa: E501, F821 # comment 18 18 | print() # noqa: E501, F821 # comment @@ -262,6 +286,8 @@ RUF100_3.py:19:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 21 21 | print(a) # noqa: E501, F821 22 22 | print(a) # noqa: E501, F821 # comment + Run `ruff check --fix` to apply this fix. + RUF100_3.py:20:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 18 | print() # noqa: E501, F821 # comment @@ -273,7 +299,7 @@ RUF100_3.py:20:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 17 17 | print() # noqa: E501, F821 # comment 18 18 | print() # noqa: E501, F821 # comment 19 19 | print() # noqa: E501, F821 comment @@ -283,6 +309,8 @@ RUF100_3.py:20:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 22 22 | print(a) # noqa: E501, F821 # comment 23 23 | print(a) # noqa: E501, F821 # comment + Run `ruff check --fix` to apply this fix. + RUF100_3.py:21:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 19 | print() # noqa: E501, F821 comment @@ -294,7 +322,7 @@ RUF100_3.py:21:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 18 18 | print() # noqa: E501, F821 # comment 19 19 | print() # noqa: E501, F821 comment 20 20 | print() # noqa: E501, F821 comment @@ -304,6 +332,8 @@ RUF100_3.py:21:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) 23 23 | print(a) # noqa: E501, F821 # comment 24 24 | print(a) # noqa: E501, F821 comment + Run `ruff check --fix` to apply this fix. + RUF100_3.py:22:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 20 | print() # noqa: E501, F821 comment @@ -315,7 +345,7 @@ RUF100_3.py:22:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 19 19 | print() # noqa: E501, F821 comment 20 20 | print() # noqa: E501, F821 comment 21 21 | print(a) # noqa: E501, F821 @@ -325,6 +355,8 @@ RUF100_3.py:22:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) 24 24 | print(a) # noqa: E501, F821 comment 25 25 | print(a) # noqa: E501, F821 comment + Run `ruff check --fix` to apply this fix. + RUF100_3.py:23:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 21 | print(a) # noqa: E501, F821 @@ -336,7 +368,7 @@ RUF100_3.py:23:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 20 20 | print() # noqa: E501, F821 comment 21 21 | print(a) # noqa: E501, F821 22 22 | print(a) # noqa: E501, F821 # comment @@ -346,6 +378,8 @@ RUF100_3.py:23:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) 25 25 | print(a) # noqa: E501, F821 comment 26 26 | + Run `ruff check --fix` to apply this fix. + RUF100_3.py:24:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 22 | print(a) # noqa: E501, F821 # comment @@ -356,7 +390,7 @@ RUF100_3.py:24:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 21 21 | print(a) # noqa: E501, F821 22 22 | print(a) # noqa: E501, F821 # comment 23 23 | print(a) # noqa: E501, F821 # comment @@ -366,6 +400,8 @@ RUF100_3.py:24:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) 26 26 | 27 27 | print(a) # comment with unicode µ # noqa: E501 + Run `ruff check --fix` to apply this fix. + RUF100_3.py:25:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 23 | print(a) # noqa: E501, F821 # comment @@ -377,7 +413,7 @@ RUF100_3.py:25:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 22 22 | print(a) # noqa: E501, F821 # comment 23 23 | print(a) # noqa: E501, F821 # comment 24 24 | print(a) # noqa: E501, F821 comment @@ -387,6 +423,8 @@ RUF100_3.py:25:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) 27 27 | print(a) # comment with unicode µ # noqa: E501 28 28 | print(a) # comment with unicode µ # noqa: E501, F821 + Run `ruff check --fix` to apply this fix. + RUF100_3.py:27:7: F821 Undefined name `a` | 25 | print(a) # noqa: E501, F821 comment @@ -406,7 +444,7 @@ RUF100_3.py:27:39: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 24 24 | print(a) # noqa: E501, F821 comment 25 25 | print(a) # noqa: E501, F821 comment 26 26 | @@ -414,6 +452,8 @@ RUF100_3.py:27:39: RUF100 [*] Unused `noqa` directive (unused: `E501`) 27 |+print(a) # comment with unicode µ 28 28 | print(a) # comment with unicode µ # noqa: E501, F821 + Run `ruff check --fix` to apply this fix. + RUF100_3.py:28:39: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 27 | print(a) # comment with unicode µ # noqa: E501 @@ -422,11 +462,11 @@ RUF100_3.py:28:39: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 25 25 | print(a) # noqa: E501, F821 comment 26 26 | 27 27 | print(a) # comment with unicode µ # noqa: E501 28 |-print(a) # comment with unicode µ # noqa: E501, F821 28 |+print(a) # comment with unicode µ # noqa: F821 - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap index a58ef10cb160d..d5ece5dc4f83c 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap @@ -11,7 +11,7 @@ RUF100_5.py:7:5: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 4 4 | dictionary = { 5 5 | # "key1": 123, # noqa: ERA001 6 6 | # "key2": 456, # noqa @@ -20,6 +20,8 @@ RUF100_5.py:7:5: ERA001 Found commented-out code 9 8 | 10 9 | + Ruff cannot safely apply this fix. + RUF100_5.py:11:1: ERA001 Found commented-out code | 11 | #import os # noqa: E501 @@ -27,12 +29,14 @@ RUF100_5.py:11:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Display-only fix +Suggested fix: 8 8 | } 9 9 | 10 10 | 11 |-#import os # noqa: E501 + Ruff cannot safely apply this fix. + RUF100_5.py:11:13: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 11 | #import os # noqa: E501 @@ -40,11 +44,11 @@ RUF100_5.py:11:13: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Safe fix +Suggested fix: 8 8 | } 9 9 | 10 10 | 11 |-#import os # noqa: E501 11 |+#import os - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap index 32744177506e0..2ee91ff9eb2b9 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap @@ -9,11 +9,11 @@ ruff_noqa_codes.py:8:5: F841 [*] Local variable `x` is assigned to but never use | = help: Remove assignment to unused variable `x` -ℹ Unsafe fix +Suggested fix: 5 5 | 6 6 | 7 7 | def f(): 8 |- x = 1 8 |+ pass - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap index 7161b11be3c2b..bff7955eac273 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap @@ -8,12 +8,14 @@ ruff_noqa_invalid.py:1:8: F401 [*] `os` imported but unused | = help: Remove unused import: `os` -ℹ Safe fix +Suggested fix: 1 |-import os # ruff: noqa: F401 2 1 | 3 2 | 4 3 | def f(): + Run `ruff check --fix` to apply this fix. + ruff_noqa_invalid.py:5:5: F841 [*] Local variable `x` is assigned to but never used | 4 | def f(): @@ -22,11 +24,11 @@ ruff_noqa_invalid.py:5:5: F841 [*] Local variable `x` is assigned to but never u | = help: Remove assignment to unused variable `x` -ℹ Unsafe fix +Suggested fix: 2 2 | 3 3 | 4 4 | def f(): 5 |- x = 1 5 |+ pass - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap index 1cc91d6730fee..941b0fc6e2179 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap @@ -12,7 +12,7 @@ TRY400.py:13:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -ℹ Safe fix +Suggested fix: 10 10 | try: 11 11 | a = 1 12 12 | except Exception: @@ -22,6 +22,8 @@ TRY400.py:13:9: TRY400 [*] Use `logging.exception` instead of `logging.error` 15 15 | if True: 16 16 | logging.error("Context message here") + Run `ruff check --fix` to apply this fix. + TRY400.py:16:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | 15 | if True: @@ -30,7 +32,7 @@ TRY400.py:16:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -ℹ Safe fix +Suggested fix: 13 13 | logging.error("Context message here") 14 14 | 15 15 | if True: @@ -40,6 +42,8 @@ TRY400.py:16:13: TRY400 [*] Use `logging.exception` instead of `logging.error` 18 18 | 19 19 | def bad(): + Run `ruff check --fix` to apply this fix. + TRY400.py:27:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | 25 | a = 1 @@ -51,7 +55,7 @@ TRY400.py:27:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -ℹ Unsafe fix +Suggested fix: 24 24 | try: 25 25 | a = 1 26 26 | except Exception: @@ -61,6 +65,8 @@ TRY400.py:27:9: TRY400 [*] Use `logging.exception` instead of `logging.error` 29 29 | if True: 30 30 | logger.error("Context message here") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TRY400.py:30:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | 29 | if True: @@ -69,7 +75,7 @@ TRY400.py:30:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -ℹ Unsafe fix +Suggested fix: 27 27 | logger.error("Context message here") 28 28 | 29 29 | if True: @@ -79,6 +85,8 @@ TRY400.py:30:13: TRY400 [*] Use `logging.exception` instead of `logging.error` 32 32 | 33 33 | def bad(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TRY400.py:37:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | 35 | a = 1 @@ -90,7 +98,7 @@ TRY400.py:37:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -ℹ Unsafe fix +Suggested fix: 34 34 | try: 35 35 | a = 1 36 36 | except Exception: @@ -100,6 +108,8 @@ TRY400.py:37:9: TRY400 [*] Use `logging.exception` instead of `logging.error` 39 39 | if True: 40 40 | log.error("Context message here") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TRY400.py:40:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | 39 | if True: @@ -108,7 +118,7 @@ TRY400.py:40:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -ℹ Unsafe fix +Suggested fix: 37 37 | log.error("Context message here") 38 38 | 39 39 | if True: @@ -118,6 +128,8 @@ TRY400.py:40:13: TRY400 [*] Use `logging.exception` instead of `logging.error` 42 42 | 43 43 | def bad(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TRY400.py:47:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | 45 | a = 1 @@ -129,7 +141,7 @@ TRY400.py:47:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -ℹ Unsafe fix +Suggested fix: 44 44 | try: 45 45 | a = 1 46 46 | except Exception: @@ -139,6 +151,8 @@ TRY400.py:47:9: TRY400 [*] Use `logging.exception` instead of `logging.error` 49 49 | if True: 50 50 | self.logger.error("Context message here") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TRY400.py:50:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | 49 | if True: @@ -147,7 +161,7 @@ TRY400.py:50:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -ℹ Unsafe fix +Suggested fix: 47 47 | self.logger.error("Context message here") 48 48 | 49 49 | if True: @@ -157,6 +171,8 @@ TRY400.py:50:13: TRY400 [*] Use `logging.exception` instead of `logging.error` 52 52 | 53 53 | def good(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TRY400.py:100:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | 98 | a = 1 @@ -168,7 +184,7 @@ TRY400.py:100:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -ℹ Safe fix +Suggested fix: 97 97 | try: 98 98 | a = 1 99 99 | except Exception: @@ -178,6 +194,8 @@ TRY400.py:100:9: TRY400 [*] Use `logging.exception` instead of `logging.error` 102 102 | if True: 103 103 | error("Context message here") + Run `ruff check --fix` to apply this fix. + TRY400.py:103:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | 102 | if True: @@ -186,7 +204,7 @@ TRY400.py:103:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -ℹ Safe fix +Suggested fix: 100 100 | error("Context message here") 101 101 | 102 102 | if True: @@ -196,6 +214,8 @@ TRY400.py:103:13: TRY400 [*] Use `logging.exception` instead of `logging.error` 105 105 | 106 106 | def good(): + Run `ruff check --fix` to apply this fix. + TRY400.py:143:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | 141 | b = 2 @@ -205,9 +225,11 @@ TRY400.py:143:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -ℹ Safe fix +Suggested fix: 140 140 | try: 141 141 | b = 2 142 142 | except Exception: 143 |- error("Context message here") 143 |+ exception("Context message here") + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap index 558c2c91ac299..b6c5d6c61ec12 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap @@ -10,7 +10,7 @@ TRY201.py:20:15: TRY201 [*] Use `raise` without specifying exception name | = help: Remove exception name -ℹ Unsafe fix +Suggested fix: 17 17 | process() 18 18 | except MyException as e: 19 19 | logger.exception("process failed") @@ -20,6 +20,8 @@ TRY201.py:20:15: TRY201 [*] Use `raise` without specifying exception name 22 22 | 23 23 | def good(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TRY201.py:63:19: TRY201 [*] Use `raise` without specifying exception name | 61 | logger.exception("process failed") @@ -29,7 +31,7 @@ TRY201.py:63:19: TRY201 [*] Use `raise` without specifying exception name | = help: Remove exception name -ℹ Unsafe fix +Suggested fix: 60 60 | except MyException as e: 61 61 | logger.exception("process failed") 62 62 | if True: @@ -39,6 +41,8 @@ TRY201.py:63:19: TRY201 [*] Use `raise` without specifying exception name 65 65 | 66 66 | def bad_that_needs_recursion_2(): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + TRY201.py:74:23: TRY201 [*] Use `raise` without specifying exception name | 73 | def foo(): @@ -47,11 +51,11 @@ TRY201.py:74:23: TRY201 [*] Use `raise` without specifying exception name | = help: Remove exception name -ℹ Unsafe fix +Suggested fix: 71 71 | if True: 72 72 | 73 73 | def foo(): 74 |- raise e 74 |+ raise - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__import_sorting.snap b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__import_sorting.snap index b0cc03fe750e1..462cafcdf91a8 100644 --- a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__import_sorting.snap +++ b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__import_sorting.snap @@ -13,7 +13,7 @@ isort.ipynb:cell 1:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 |+import math 2 |+import random 1 3 | from pathlib import Path @@ -23,6 +23,8 @@ isort.ipynb:cell 1:1:1: I001 [*] Import block is un-sorted or un-formatted 5 5 | import collections 6 6 | # Newline should be added here + Run `ruff check --fix` to apply this fix. + isort.ipynb:cell 2:1:1: I001 [*] Import block is un-sorted or un-formatted | 1 | / from typing import Any @@ -34,7 +36,7 @@ isort.ipynb:cell 2:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 1 1 | from pathlib import Path 2 2 | import random 3 3 | import math @@ -47,6 +49,8 @@ isort.ipynb:cell 2:1:1: I001 [*] Import block is un-sorted or un-formatted 7 9 | def foo(): 8 10 | pass + Run `ruff check --fix` to apply this fix. + isort.ipynb:cell 3:1:1: I001 [*] Import block is un-sorted or un-formatted | 1 | / from pathlib import Path @@ -58,7 +62,7 @@ isort.ipynb:cell 3:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 6 6 | # Newline should be added here 7 7 | def foo(): 8 8 | pass @@ -69,6 +73,8 @@ isort.ipynb:cell 3:1:1: I001 [*] Import block is un-sorted or un-formatted 12 12 | %matplotlib \ 13 13 | --inline + Run `ruff check --fix` to apply this fix. + isort.ipynb:cell 3:7:1: I001 [*] Import block is un-sorted or un-formatted | 5 | --inline @@ -78,7 +84,7 @@ isort.ipynb:cell 3:7:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Safe fix +Suggested fix: 12 12 | %matplotlib \ 13 13 | --inline 14 14 | @@ -86,4 +92,4 @@ isort.ipynb:cell 3:7:1: I001 [*] Import block is un-sorted or un-formatted 15 16 | import math 16 |-import abc - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__ipy_escape_command.snap b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__ipy_escape_command.snap index 8c1a547e85966..ff9e2c4e0ca68 100644 --- a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__ipy_escape_command.snap +++ b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__ipy_escape_command.snap @@ -12,7 +12,7 @@ ipy_escape_command.ipynb:cell 1:5:8: F401 [*] `os` imported but unused | = help: Remove unused import: `os` -ℹ Safe fix +Suggested fix: 2 2 | 3 3 | %matplotlib inline 4 4 | @@ -21,6 +21,8 @@ ipy_escape_command.ipynb:cell 1:5:8: F401 [*] `os` imported but unused 7 6 | _ = math.pi 8 7 | %%timeit + Run `ruff check --fix` to apply this fix. + ipy_escape_command.ipynb:cell 2:2:8: F401 [*] `sys` imported but unused | 1 | %%timeit @@ -29,10 +31,10 @@ ipy_escape_command.ipynb:cell 2:2:8: F401 [*] `sys` imported but unused | = help: Remove unused import: `sys` -ℹ Safe fix +Suggested fix: 6 6 | 7 7 | _ = math.pi 8 8 | %%timeit 9 |-import sys - + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap index a610a9bb123c2..67b10b332ecef 100644 --- a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap +++ b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap @@ -10,7 +10,7 @@ unused_variable.ipynb:cell 1:2:5: F841 [*] Local variable `foo1` is assigned to | = help: Remove assignment to unused variable `foo1` -ℹ Unsafe fix +Suggested fix: 1 1 | def f(): 2 |- foo1 = %matplotlib --list 2 |+ %matplotlib --list @@ -18,6 +18,8 @@ unused_variable.ipynb:cell 1:2:5: F841 [*] Local variable `foo1` is assigned to 4 4 | def f(): 5 5 | bar1 = !pwd + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unused_variable.ipynb:cell 1:3:5: F841 [*] Local variable `foo2` is assigned to but never used | 1 | def f(): @@ -27,7 +29,7 @@ unused_variable.ipynb:cell 1:3:5: F841 [*] Local variable `foo2` is assigned to | = help: Remove assignment to unused variable `foo2` -ℹ Unsafe fix +Suggested fix: 1 1 | def f(): 2 2 | foo1 = %matplotlib --list 3 |- foo2: list[str] = %matplotlib --list @@ -36,6 +38,8 @@ unused_variable.ipynb:cell 1:3:5: F841 [*] Local variable `foo2` is assigned to 5 5 | bar1 = !pwd 6 6 | bar2: str = !pwd + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unused_variable.ipynb:cell 2:2:5: F841 [*] Local variable `bar1` is assigned to but never used | 1 | def f(): @@ -45,7 +49,7 @@ unused_variable.ipynb:cell 2:2:5: F841 [*] Local variable `bar1` is assigned to | = help: Remove assignment to unused variable `bar1` -ℹ Unsafe fix +Suggested fix: 2 2 | foo1 = %matplotlib --list 3 3 | foo2: list[str] = %matplotlib --list 4 4 | def f(): @@ -53,6 +57,8 @@ unused_variable.ipynb:cell 2:2:5: F841 [*] Local variable `bar1` is assigned to 5 |+ !pwd 6 6 | bar2: str = !pwd + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + unused_variable.ipynb:cell 2:3:5: F841 [*] Local variable `bar2` is assigned to but never used | 1 | def f(): @@ -62,11 +68,11 @@ unused_variable.ipynb:cell 2:3:5: F841 [*] Local variable `bar2` is assigned to | = help: Remove assignment to unused variable `bar2` -ℹ Unsafe fix +Suggested fix: 3 3 | foo2: list[str] = %matplotlib --list 4 4 | def f(): 5 5 | bar1 = !pwd 6 |- bar2: str = !pwd 6 |+ !pwd - + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. From 1f07f5f539f3fcfc1f380218f56dd3144a970c15 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Wed, 31 Jul 2024 11:19:49 -0600 Subject: [PATCH 2/4] Remove 'Suggested fix:' header from `check` diff output --- crates/ruff/tests/integration_test.rs | 32 ---- crates/ruff_linter/src/message/diff.rs | 2 - ...s__eradicate__tests__ERA001_ERA001.py.snap | 17 -- ...i-non-annotated-dependency_FAST002.py.snap | 9 - ...i-redundant-response-model_FAST001.py.snap | 9 - ..._annotations__tests__auto_return_type.snap | 37 ---- ...tations__tests__auto_return_type_py38.snap | 37 ---- ...__flake8_annotations__tests__defaults.snap | 6 - ...otations__tests__ignore_fully_untyped.snap | 3 - ..._annotations__tests__mypy_init_return.snap | 4 - ...otations__tests__simple_magic_methods.snap | 14 -- ...tions__tests__suppress_none_returning.snap | 2 - ...e8_async__tests__ASYNC105_ASYNC105.py.snap | 24 --- ...e8_async__tests__ASYNC115_ASYNC115.py.snap | 6 - ...e8_async__tests__ASYNC116_ASYNC116.py.snap | 7 - ..._tests__preview__ASYNC115_ASYNC115.py.snap | 10 -- ..._tests__preview__ASYNC116_ASYNC116.py.snap | 14 -- ...__flake8_bugbear__tests__B004_B004.py.snap | 3 - ...flake8_bugbear__tests__B006_B006_1.py.snap | 1 - ...flake8_bugbear__tests__B006_B006_2.py.snap | 1 - ...flake8_bugbear__tests__B006_B006_3.py.snap | 1 - ...flake8_bugbear__tests__B006_B006_4.py.snap | 1 - ...flake8_bugbear__tests__B006_B006_5.py.snap | 13 -- ...flake8_bugbear__tests__B006_B006_6.py.snap | 1 - ...flake8_bugbear__tests__B006_B006_7.py.snap | 1 - ...flake8_bugbear__tests__B006_B006_8.py.snap | 5 - ...ke8_bugbear__tests__B006_B006_B008.py.snap | 23 --- ...__flake8_bugbear__tests__B007_B007.py.snap | 4 - ...ke8_bugbear__tests__B009_B009_B010.py.snap | 18 -- ...ke8_bugbear__tests__B010_B009_B010.py.snap | 6 - ...__flake8_bugbear__tests__B011_B011.py.snap | 2 - ...__flake8_bugbear__tests__B013_B013.py.snap | 2 - ...__flake8_bugbear__tests__B014_B014.py.snap | 5 - ...__flake8_bugbear__tests__B033_B033.py.snap | 8 - ...rules__flake8_bugbear__tests__B905.py.snap | 10 -- ...extend_immutable_calls_arg_annotation.snap | 1 - ...rules__flake8_commas__tests__COM81.py.snap | 45 ----- ...8_comprehensions__tests__C400_C400.py.snap | 7 - ...8_comprehensions__tests__C401_C401.py.snap | 12 -- ...8_comprehensions__tests__C402_C402.py.snap | 13 -- ...8_comprehensions__tests__C403_C403.py.snap | 11 -- ...8_comprehensions__tests__C404_C404.py.snap | 10 -- ...8_comprehensions__tests__C405_C405.py.snap | 20 --- ...8_comprehensions__tests__C406_C406.py.snap | 4 - ...8_comprehensions__tests__C408_C408.py.snap | 18 -- ...low_dict_calls_with_keyword_arguments.snap | 7 - ...8_comprehensions__tests__C409_C409.py.snap | 11 -- ...8_comprehensions__tests__C410_C410.py.snap | 6 - ...8_comprehensions__tests__C411_C411.py.snap | 1 - ...8_comprehensions__tests__C413_C413.py.snap | 13 -- ...8_comprehensions__tests__C414_C414.py.snap | 24 --- ...8_comprehensions__tests__C416_C416.py.snap | 7 - ...8_comprehensions__tests__C417_C417.py.snap | 18 -- ...8_comprehensions__tests__C418_C418.py.snap | 4 - ...8_comprehensions__tests__C419_C419.py.snap | 7 - ...sions__tests__preview__C419_C419_1.py.snap | 5 - ...__rules__flake8_errmsg__tests__custom.snap | 12 -- ...rules__flake8_errmsg__tests__defaults.snap | 15 -- ...flake8_executable__tests__EXE004_1.py.snap | 1 - ...flake8_executable__tests__EXE004_4.py.snap | 1 - ...02_no_future_import_uses_lowercase.py.snap | 1 - ..._fa102_no_future_import_uses_union.py.snap | 2 - ..._no_future_import_uses_union_inner.py.snap | 2 - ...icit_str_concat__tests__ISC001_ISC.py.snap | 12 -- ...oncat__tests__multiline_ISC001_ISC.py.snap | 12 -- ...8_import_conventions__tests__defaults.snap | 13 -- ..._import_conventions__tests__same_name.snap | 1 - ...ke8_import_conventions__tests__tricky.snap | 1 - ...ake8_logging__tests__LOG001_LOG001.py.snap | 2 - ...ake8_logging__tests__LOG002_LOG002.py.snap | 4 - ...ake8_logging__tests__LOG009_LOG009.py.snap | 2 - ...flake8_logging_format__tests__G010.py.snap | 4 - ...__flake8_pie__tests__PIE790_PIE790.py.snap | 36 ---- ...__flake8_pie__tests__PIE794_PIE794.py.snap | 6 - ...__flake8_pie__tests__PIE800_PIE800.py.snap | 6 - ...__flake8_pie__tests__PIE804_PIE804.py.snap | 10 -- ...__flake8_pie__tests__PIE807_PIE807.py.snap | 6 - ...__flake8_pie__tests__PIE808_PIE808.py.snap | 2 - ...__flake8_pie__tests__PIE810_PIE810.py.snap | 7 - ...es__flake8_print__tests__T201_T201.py.snap | 4 - ...es__flake8_print__tests__T203_T203.py.snap | 2 - ..._flake8_pyi__tests__PYI009_PYI009.pyi.snap | 2 - ..._flake8_pyi__tests__PYI010_PYI010.pyi.snap | 3 - ..._flake8_pyi__tests__PYI011_PYI011.pyi.snap | 18 -- ..._flake8_pyi__tests__PYI012_PYI012.pyi.snap | 6 - ...__flake8_pyi__tests__PYI013_PYI013.py.snap | 8 - ..._flake8_pyi__tests__PYI013_PYI013.pyi.snap | 9 - ..._flake8_pyi__tests__PYI014_PYI014.pyi.snap | 13 -- ..._flake8_pyi__tests__PYI015_PYI015.pyi.snap | 11 -- ...__flake8_pyi__tests__PYI016_PYI016.py.snap | 23 --- ..._flake8_pyi__tests__PYI016_PYI016.pyi.snap | 23 --- ..._flake8_pyi__tests__PYI020_PYI020.pyi.snap | 9 - ...flake8_pyi__tests__PYI025_PYI025_1.py.snap | 2 - ...lake8_pyi__tests__PYI025_PYI025_1.pyi.snap | 5 - ...flake8_pyi__tests__PYI025_PYI025_2.py.snap | 1 - ...lake8_pyi__tests__PYI025_PYI025_2.pyi.snap | 1 - ...flake8_pyi__tests__PYI025_PYI025_3.py.snap | 1 - ...lake8_pyi__tests__PYI025_PYI025_3.pyi.snap | 1 - ..._flake8_pyi__tests__PYI026_PYI026.pyi.snap | 6 - ..._flake8_pyi__tests__PYI029_PYI029.pyi.snap | 3 - ...__flake8_pyi__tests__PYI030_PYI030.py.snap | 26 --- ..._flake8_pyi__tests__PYI030_PYI030.pyi.snap | 26 --- ...__flake8_pyi__tests__PYI032_PYI032.py.snap | 2 - ..._flake8_pyi__tests__PYI032_PYI032.pyi.snap | 2 - ...__flake8_pyi__tests__PYI036_PYI036.py.snap | 3 - ..._flake8_pyi__tests__PYI036_PYI036.pyi.snap | 3 - ..._flake8_pyi__tests__PYI053_PYI053.pyi.snap | 8 - ..._flake8_pyi__tests__PYI054_PYI054.pyi.snap | 8 - ...__flake8_pyi__tests__PYI055_PYI055.py.snap | 7 - ..._flake8_pyi__tests__PYI055_PYI055.pyi.snap | 9 - ...__flake8_pyi__tests__PYI058_PYI058.py.snap | 8 - ..._flake8_pyi__tests__PYI058_PYI058.pyi.snap | 9 - ...__flake8_pyi__tests__PYI059_PYI059.py.snap | 4 - ..._flake8_pyi__tests__PYI059_PYI059.pyi.snap | 4 - ...__flake8_pyi__tests__PYI064_PYI064.py.snap | 4 - ..._flake8_pyi__tests__PYI064_PYI064.pyi.snap | 4 - ...e8_pyi__tests__py38_PYI026_PYI026.pyi.snap | 6 - ...e8_pytest_style__tests__PT001_default.snap | 3 - ...st_style__tests__PT001_no_parentheses.snap | 6 - ...es__flake8_pytest_style__tests__PT003.snap | 8 - ...flake8_pytest_style__tests__PT006_csv.snap | 4 - ...e8_pytest_style__tests__PT006_default.snap | 12 -- ...lake8_pytest_style__tests__PT006_list.snap | 10 -- ...est_style__tests__PT007_list_of_lists.snap | 10 -- ...st_style__tests__PT007_list_of_tuples.snap | 10 -- ...st_style__tests__PT007_tuple_of_lists.snap | 15 -- ...t_style__tests__PT007_tuple_of_tuples.snap | 15 -- ...es__flake8_pytest_style__tests__PT009.snap | 29 ---- ...es__flake8_pytest_style__tests__PT014.snap | 9 - ...es__flake8_pytest_style__tests__PT018.snap | 15 -- ...es__flake8_pytest_style__tests__PT022.snap | 3 - ...e8_pytest_style__tests__PT023_default.snap | 5 - ...st_style__tests__PT023_no_parentheses.snap | 5 - ...es__flake8_pytest_style__tests__PT024.snap | 4 - ...es__flake8_pytest_style__tests__PT025.snap | 2 - ...es__flake8_pytest_style__tests__PT026.snap | 2 - ...__flake8_pytest_style__tests__PT027_0.snap | 8 - ...__flake8_pytest_style__tests__PT027_1.snap | 1 - ..._tests__only_docstring_doubles_all.py.snap | 1 - ...es__tests__only_inline_doubles_all.py.snap | 1 - ..._tests__only_multiline_doubles_all.py.snap | 1 - ...ing_doubles_over_docstring_doubles.py.snap | 5 - ...ubles_over_docstring_doubles_class.py.snap | 2 - ...es_over_docstring_doubles_function.py.snap | 5 - ...docstring_doubles_module_multiline.py.snap | 2 - ...ocstring_doubles_module_singleline.py.snap | 2 - ...ing_doubles_over_docstring_singles.py.snap | 3 - ...ubles_over_docstring_singles_class.py.snap | 3 - ...es_over_docstring_singles_function.py.snap | 3 - ...g_singles_mixed_quotes_class_var_1.py.snap | 3 - ...g_singles_mixed_quotes_class_var_2.py.snap | 6 - ...xed_quotes_module_singleline_var_1.py.snap | 2 - ...xed_quotes_module_singleline_var_2.py.snap | 3 - ...docstring_singles_module_multiline.py.snap | 1 - ...ocstring_singles_module_singleline.py.snap | 1 - ...ing_singles_over_docstring_doubles.py.snap | 3 - ...ngles_over_docstring_doubles_class.py.snap | 3 - ...es_over_docstring_doubles_function.py.snap | 3 - ...g_doubles_mixed_quotes_class_var_2.py.snap | 3 - ...xed_quotes_module_singleline_var_2.py.snap | 1 - ...docstring_doubles_module_multiline.py.snap | 1 - ...ocstring_doubles_module_singleline.py.snap | 1 - ...ing_singles_over_docstring_singles.py.snap | 6 - ...ngles_over_docstring_singles_class.py.snap | 2 - ...es_over_docstring_singles_function.py.snap | 5 - ...docstring_singles_module_multiline.py.snap | 2 - ...ocstring_singles_module_singleline.py.snap | 2 - ...ests__require_doubles_over_singles.py.snap | 3 - ...quire_doubles_over_singles_escaped.py.snap | 11 -- ...re_doubles_over_singles_escaped_py311.snap | 4 - ...s_over_singles_escaped_unnecessary.py.snap | 18 -- ...uire_doubles_over_singles_implicit.py.snap | 7 - ...bles_over_singles_multiline_string.py.snap | 1 - ...ver_singles_would_be_triple_quotes.py.snap | 3 - ...ests__require_singles_over_doubles.py.snap | 3 - ...quire_singles_over_doubles_escaped.py.snap | 13 -- ...re_singles_over_doubles_escaped_py311.snap | 6 - ...s_over_doubles_escaped_unnecessary.py.snap | 19 -- ...uire_singles_over_doubles_implicit.py.snap | 7 - ...gles_over_doubles_multiline_string.py.snap | 1 - ...ver_doubles_would_be_triple_quotes.py.snap | 1 - ...ry-paren-on-raise-exception_RSE102.py.snap | 14 -- ...lake8_return__tests__RET501_RET501.py.snap | 2 - ...lake8_return__tests__RET502_RET502.py.snap | 1 - ...lake8_return__tests__RET503_RET503.py.snap | 23 --- ...lake8_return__tests__RET504_RET504.py.snap | 13 -- ...urn__tests__preview__RET505_RET505.py.snap | 20 --- ...urn__tests__preview__RET506_RET506.py.snap | 7 - ...urn__tests__preview__RET507_RET507.py.snap | 7 - ...urn__tests__preview__RET508_RET508.py.snap | 8 - ...ke8_simplify__tests__SIM101_SIM101.py.snap | 9 - ...ke8_simplify__tests__SIM102_SIM102.py.snap | 12 -- ...ke8_simplify__tests__SIM103_SIM103.py.snap | 10 -- ...8_simplify__tests__SIM105_SIM105_0.py.snap | 9 - ...8_simplify__tests__SIM105_SIM105_1.py.snap | 1 - ...8_simplify__tests__SIM105_SIM105_2.py.snap | 1 - ...8_simplify__tests__SIM105_SIM105_4.py.snap | 1 - ...ke8_simplify__tests__SIM108_SIM108.py.snap | 3 - ...ke8_simplify__tests__SIM109_SIM109.py.snap | 4 - ...ke8_simplify__tests__SIM110_SIM110.py.snap | 12 -- ...ke8_simplify__tests__SIM110_SIM111.py.snap | 12 -- ...ke8_simplify__tests__SIM112_SIM112.py.snap | 3 - ...ke8_simplify__tests__SIM114_SIM114.py.snap | 17 -- ...ke8_simplify__tests__SIM117_SIM117.py.snap | 11 -- ...ke8_simplify__tests__SIM118_SIM118.py.snap | 20 --- ...ke8_simplify__tests__SIM201_SIM201.py.snap | 3 - ...ke8_simplify__tests__SIM202_SIM202.py.snap | 3 - ...ke8_simplify__tests__SIM208_SIM208.py.snap | 5 - ...ke8_simplify__tests__SIM210_SIM210.py.snap | 4 - ...ke8_simplify__tests__SIM211_SIM211.py.snap | 3 - ...ke8_simplify__tests__SIM212_SIM212.py.snap | 2 - ...ke8_simplify__tests__SIM220_SIM220.py.snap | 3 - ...ke8_simplify__tests__SIM221_SIM221.py.snap | 3 - ...ke8_simplify__tests__SIM222_SIM222.py.snap | 52 ------ ...ke8_simplify__tests__SIM223_SIM223.py.snap | 50 ------ ...ke8_simplify__tests__SIM300_SIM300.py.snap | 17 -- ...ke8_simplify__tests__SIM401_SIM401.py.snap | 8 - ...ke8_simplify__tests__SIM910_SIM910.py.snap | 6 - ...ts__tests__ban_parent_imports_package.snap | 6 - ..._invalid-todo-capitalization_TD006.py.snap | 3 - ...__empty-type-checking-block_TCH005.py.snap | 6 - ..._type_checking__tests__exempt_modules.snap | 1 - ...ke8_type_checking__tests__import_from.snap | 1 - ...ests__import_from_type_checking_block.snap | 1 - ...ype_checking__tests__multiple_members.snap | 2 - ...sts__multiple_modules_different_types.snap | 2 - ...ng__tests__multiple_modules_same_type.snap | 2 - ...ype_checking__tests__no_typing_import.snap | 1 - ...mport-in-type-checking-block_quote.py.snap | 1 - ...ping-only-third-party-import_quote.py.snap | 12 -- ...rt-in-type-checking-block_TCH004_1.py.snap | 1 - ...t-in-type-checking-block_TCH004_11.py.snap | 1 - ...t-in-type-checking-block_TCH004_12.py.snap | 1 - ...t-in-type-checking-block_TCH004_17.py.snap | 1 - ...rt-in-type-checking-block_TCH004_2.py.snap | 1 - ...rt-in-type-checking-block_TCH004_4.py.snap | 1 - ...rt-in-type-checking-block_TCH004_5.py.snap | 3 - ...rt-in-type-checking-block_TCH004_9.py.snap | 2 - ...mport-in-type-checking-block_quote.py.snap | 1 - ...k_runtime_evaluated_base_classes_1.py.snap | 3 - ...ock_runtime_evaluated_decorators_1.py.snap | 3 - ...y-standard-library-import_init_var.py.snap | 2 - ...ing-only-third-party-import_strict.py.snap | 8 - ...ests__type_checking_block_after_usage.snap | 1 - ...g__tests__type_checking_block_comment.snap | 1 - ...ng__tests__type_checking_block_inline.snap | 1 - ...__tests__type_checking_block_own_line.snap | 1 - ...ing-only-first-party-import_TCH001.py.snap | 1 - ...nly-standard-library-import_TCH003.py.snap | 1 - ...rary-import_exempt_type_checking_1.py.snap | 1 - ...rary-import_exempt_type_checking_2.py.snap | 1 - ...rary-import_exempt_type_checking_3.py.snap | 1 - ...y-standard-library-import_init_var.py.snap | 1 - ...d-library-import_module__undefined.py.snap | 1 - ...t_runtime_evaluated_base_classes_3.py.snap | 1 - ...ort_runtime_evaluated_decorators_3.py.snap | 1 - ...ing-only-third-party-import_TCH002.py.snap | 9 - ...t_runtime_evaluated_base_classes_2.py.snap | 2 - ...ort_runtime_evaluated_decorators_2.py.snap | 1 - ...-third-party-import_singledispatch.py.snap | 1 - ...ing-only-third-party-import_strict.py.snap | 2 - ...hird-party-import_typing_modules_1.py.snap | 1 - ...hird-party-import_typing_modules_2.py.snap | 1 - ...s__typing_import_after_package_import.snap | 1 - ...__typing_import_before_package_import.snap | 1 - ..._use_pathlib__tests__PTH201_PTH201.py.snap | 4 - ...rules__flynt__tests__FLY002_FLY002.py.snap | 7 - ...kage_first_and_third_party_imports.py.snap | 1 - ...kage_first_and_third_party_imports.py.snap | 1 - ...tests__add_newline_before_comments.py.snap | 1 - ..._isort__tests__as_imports_comments.py.snap | 1 - ..._rules__isort__tests__bom_unsorted.py.snap | 1 - ...sts__case_sensitive_case_sensitive.py.snap | 1 - ...to_furthest_relative_imports_order.py.snap | 1 - ...__isort__tests__combine_as_imports.py.snap | 1 - ...bine_as_imports_combine_as_imports.py.snap | 1 - ..._isort__tests__combine_import_from.py.snap | 1 - ...ter__rules__isort__tests__comments.py.snap | 1 - ..._isort__tests__deduplicate_imports.py.snap | 1 - ...es__isort__tests__detect_same_package.snap | 1 - ...les__isort__tests__fit_line_length.py.snap | 1 - ...rt__tests__fit_line_length_comment.py.snap | 1 - ...orce_single_line_force_single_line.py.snap | 1 - ..._tests__force_sort_within_sections.py.snap | 1 - ...ections_force_sort_within_sections.py.snap | 1 - ..._force_sort_within_sections_future.py.snap | 1 - ...sort_within_sections_with_as_names.py.snap | 1 - ..._rules__isort__tests__force_to_top.py.snap | 1 - ...__tests__force_to_top_force_to_top.py.snap | 1 - ...__isort__tests__force_wrap_aliases.py.snap | 1 - ...ce_wrap_aliases_force_wrap_aliases.py.snap | 1 - ...les__isort__tests__forced_separate.py.snap | 1 - ...__rules__isort__tests__future_from.py.snap | 1 - ...kage_first_and_third_party_imports.py.snap | 1 - ..._rules__isort__tests__if_elif_else.py.snap | 1 - ...t__tests__import_from_after_import.py.snap | 1 - ...les__isort__tests__inline_comments.py.snap | 1 - ...__isort__tests__insert_empty_lines.py.snap | 4 - ..._isort__tests__insert_empty_lines.pyi.snap | 3 - ...sest_separate_local_folder_imports.py.snap | 1 - ...lder_separate_local_folder_imports.py.snap | 1 - ...gth_sort__length_sort_from_imports.py.snap | 1 - ...ort__length_sort_non_ascii_members.py.snap | 1 - ...ort__length_sort_non_ascii_modules.py.snap | 1 - ...gth_sort_straight_and_from_imports.py.snap | 1 - ...sort__length_sort_straight_imports.py.snap | 1 - ..._length_sort_with_relative_imports.py.snap | 1 - ...straight__length_sort_from_imports.py.snap | 1 - ...gth_sort_straight_and_from_imports.py.snap | 1 - ...ight__length_sort_straight_imports.py.snap | 1 - ...es__isort__tests__line_ending_crlf.py.snap | 1 - ...ules__isort__tests__line_ending_lf.py.snap | 1 - ...isort__tests__lines_after_imports.pyi.snap | 1 - ...s__lines_after_imports_class_after.py.snap | 1 - ...ts__lines_after_imports_func_after.py.snap | 1 - ...after_imports_lines_after_imports.pyi.snap | 1 - ...ts_lines_after_imports_class_after.py.snap | 1 - ...rts_lines_after_imports_func_after.py.snap | 1 - ..._lines_after_imports_nothing_after.py.snap | 1 - ...s_between_typeslines_between_types.py.snap | 1 - ...isort__tests__magic_trailing_comma.py.snap | 1 - ...r__rules__isort__tests__match_case.py.snap | 2 - ...rules__isort__tests__natural_order.py.snap | 1 - ..._isort__tests__no_detect_same_package.snap | 1 - ...les__isort__tests__no_lines_before.py.snap | 1 - ...no_lines_before.py_no_lines_before.py.snap | 1 - ...o_lines_before_with_empty_sections.py.snap | 1 - ...andard_library_no_standard_library.py.snap | 1 - ..._rules__isort__tests__no_wrap_star.py.snap | 1 - ...rules__isort__tests__order_by_type.py.snap | 1 - ..._order_by_type_false_order_by_type.py.snap | 1 - ..._order_by_type_with_custom_classes.py.snap | 1 - ..._order_by_type_with_custom_classes.py.snap | 1 - ...rder_by_type_with_custom_constants.py.snap | 1 - ...rder_by_type_with_custom_constants.py.snap | 1 - ...rder_by_type_with_custom_variables.py.snap | 1 - ...rder_by_type_with_custom_variables.py.snap | 1 - ...s__order_relative_imports_by_level.py.snap | 1 - ...ort__tests__preserve_comment_order.py.snap | 1 - ...isort__tests__preserve_import_star.py.snap | 1 - ...isort__tests__preserve_indentation.py.snap | 2 - ...comments_propagate_inline_comments.py.snap | 1 - ...ort__tests__reorder_within_section.py.snap | 1 - ...rt__tests__required_import_comment.py.snap | 1 - ...uired_import_comments_and_newlines.py.snap | 1 - ...__tests__required_import_docstring.py.snap | 1 - ...import_docstring_with_continuation.py.snap | 1 - ...ed_import_docstring_with_semicolon.py.snap | 1 - ...s__required_import_existing_import.py.snap | 1 - ...equired_import_multiline_docstring.py.snap | 1 - ..._isort__tests__required_import_off.py.snap | 1 - ...ort__tests__required_import_unused.py.snap | 6 +- ...required_import_with_alias_comment.py.snap | 1 - ...t_with_alias_comments_and_newlines.py.snap | 1 - ...quired_import_with_alias_docstring.py.snap | 1 - ..._alias_docstring_with_continuation.py.snap | 1 - ...ith_alias_docstring_with_semicolon.py.snap | 1 - ..._import_with_alias_existing_import.py.snap | 1 - ...ort_with_alias_multiline_docstring.py.snap | 1 - ...ts__required_import_with_alias_off.py.snap | 1 - ..._tests__required_imports_docstring.py.snap | 2 - ...ort__tests__section_order_sections.py.snap | 1 - ...__tests__sections_main_first_party.py.snap | 1 - ...s__isort__tests__sections_sections.py.snap | 1 - ...ests__separate_first_party_imports.py.snap | 1 - ...rt__tests__separate_future_imports.py.snap | 1 - ...sts__separate_local_folder_imports.py.snap | 1 - ...ests__separate_third_party_imports.py.snap | 1 - ..._linter__rules__isort__tests__skip.py.snap | 3 - ...isort__tests__sort_similar_imports.py.snap | 1 - ...linter__rules__isort__tests__split.py.snap | 3 - ...railing_comma_magic_trailing_comma.py.snap | 1 - ...__isort__tests__star_before_others.py.snap | 1 - ...straight_required_import_docstring.py.snap | 1 - ...traight_required_import_docstring.pyi.snap | 1 - ...es__isort__tests__trailing_comment.py.snap | 5 - ...er__rules__isort__tests__two_space.py.snap | 1 - ...nter__rules__isort__tests__unicode.py.snap | 1 - ...__numpy-deprecated-function_NPY003.py.snap | 10 -- ...numpy-deprecated-type-alias_NPY001.py.snap | 8 - ...__tests__numpy2-deprecation_NPY201.py.snap | 20 --- ...tests__numpy2-deprecation_NPY201_2.py.snap | 21 --- ...tests__numpy2-deprecation_NPY201_3.py.snap | 7 - ...es__pandas_vet__tests__PD002_PD002.py.snap | 7 - ..._rules__pandas_vet__tests__PD002_fail.snap | 1 - ...les__pep8_naming__tests__N804_N804.py.snap | 5 - ...les__pep8_naming__tests__N805_N805.py.snap | 12 -- ...naming__tests__classmethod_decorators.snap | 9 - ...ing__tests__ignore_names_N804_N804.py.snap | 5 - ...ing__tests__ignore_names_N805_N805.py.snap | 8 - ...aming__tests__staticmethod_decorators.snap | 11 -- ...__perflint__tests__PERF101_PERF101.py.snap | 11 -- ...__perflint__tests__PERF102_PERF102.py.snap | 12 -- ...ules__pycodestyle__tests__E201_E20.py.snap | 9 - ...ules__pycodestyle__tests__E202_E20.py.snap | 8 - ...ules__pycodestyle__tests__E203_E20.py.snap | 17 -- ...les__pycodestyle__tests__E204_E204.py.snap | 3 - ...ules__pycodestyle__tests__E211_E21.py.snap | 7 - ...ules__pycodestyle__tests__E221_E22.py.snap | 8 - ...ules__pycodestyle__tests__E222_E22.py.snap | 5 - ...ules__pycodestyle__tests__E223_E22.py.snap | 1 - ...ules__pycodestyle__tests__E224_E22.py.snap | 1 - ...ules__pycodestyle__tests__E225_E22.py.snap | 12 -- ...ules__pycodestyle__tests__E226_E22.py.snap | 26 --- ...ules__pycodestyle__tests__E227_E22.py.snap | 8 - ...ules__pycodestyle__tests__E228_E22.py.snap | 3 - ...ules__pycodestyle__tests__E231_E23.py.snap | 23 --- ...ules__pycodestyle__tests__E241_E24.py.snap | 4 - ...ules__pycodestyle__tests__E242_E24.py.snap | 1 - ...ules__pycodestyle__tests__E251_E25.py.snap | 11 -- ...ules__pycodestyle__tests__E252_E25.py.snap | 4 - ...ules__pycodestyle__tests__E261_E26.py.snap | 1 - ...ules__pycodestyle__tests__E262_E26.py.snap | 7 - ...ules__pycodestyle__tests__E265_E26.py.snap | 6 - ...ules__pycodestyle__tests__E266_E26.py.snap | 5 - ...ules__pycodestyle__tests__E271_E27.py.snap | 10 -- ...ules__pycodestyle__tests__E272_E27.py.snap | 3 - ...ules__pycodestyle__tests__E273_E27.py.snap | 6 - ...ules__pycodestyle__tests__E274_E27.py.snap | 2 - ...ules__pycodestyle__tests__E275_E27.py.snap | 7 - ...ules__pycodestyle__tests__E301_E30.py.snap | 5 - ...ules__pycodestyle__tests__E302_E30.py.snap | 11 -- ...ts__E302_E302_first_line_docstring.py.snap | 1 - ...s__E302_E302_first_line_expression.py.snap | 1 - ...sts__E302_E302_first_line_function.py.snap | 1 - ...ts__E302_E302_first_line_statement.py.snap | 1 - ...ules__pycodestyle__tests__E303_E30.py.snap | 14 -- ...ests__E303_E303_first_line_comment.py.snap | 1 - ...ts__E303_E303_first_line_docstring.py.snap | 1 - ...s__E303_E303_first_line_expression.py.snap | 1 - ...ts__E303_E303_first_line_statement.py.snap | 1 - ...ules__pycodestyle__tests__E304_E30.py.snap | 3 - ...ules__pycodestyle__tests__E305_E30.py.snap | 5 - ...ules__pycodestyle__tests__E306_E30.py.snap | 11 -- ...ules__pycodestyle__tests__E401_E40.py.snap | 9 - ...ules__pycodestyle__tests__E703_E70.py.snap | 5 - ...__pycodestyle__tests__E703_E703.ipynb.snap | 2 - ...les__pycodestyle__tests__E711_E711.py.snap | 10 -- ...les__pycodestyle__tests__E712_E712.py.snap | 13 -- ...les__pycodestyle__tests__E713_E713.py.snap | 6 - ...les__pycodestyle__tests__E714_E714.py.snap | 3 - ...les__pycodestyle__tests__E731_E731.py.snap | 18 -- ...ules__pycodestyle__tests__W291_W29.py.snap | 3 - ...les__pycodestyle__tests__W291_W291.py.snap | 4 - ...s__pycodestyle__tests__W292_W292_0.py.snap | 1 - ...ules__pycodestyle__tests__W293_W29.py.snap | 1 - ...les__pycodestyle__tests__W293_W293.py.snap | 4 - ...s__pycodestyle__tests__W605_W605_0.py.snap | 11 -- ...s__pycodestyle__tests__W605_W605_1.py.snap | 14 -- ...yle__tests__blank_lines_E301_notebook.snap | 1 - ...yle__tests__blank_lines_E302_notebook.snap | 1 - ...yle__tests__blank_lines_E303_notebook.snap | 2 - ...__tests__blank_lines_E303_typing_stub.snap | 4 - ...yle__tests__blank_lines_E304_notebook.snap | 1 - ...__tests__blank_lines_E304_typing_stub.snap | 1 - ...yle__tests__blank_lines_E305_notebook.snap | 1 - ...yle__tests__blank_lines_E306_notebook.snap | 1 - ...patibility-lines-after(-1)-between(0).snap | 7 - ...mpatibility-lines-after(0)-between(0).snap | 6 - ...mpatibility-lines-after(1)-between(1).snap | 5 - ...mpatibility-lines-after(4)-between(4).snap | 8 - ..._tests__blank_lines_typing_stub_isort.snap | 15 -- ...pycodestyle__tests__constant_literals.snap | 27 --- ...destyle__tests__preview__E502_E502.py.snap | 14 -- ...style__tests__preview__W391_W391_0.py.snap | 1 - ...style__tests__preview__W391_W391_2.py.snap | 1 - ...r__rules__pycodestyle__tests__shebang.snap | 1 - ...patibility-lines-after(-1)-between(0).snap | 7 - ...mpatibility-lines-after(0)-between(0).snap | 9 - ...mpatibility-lines-after(1)-between(1).snap | 7 - ...mpatibility-lines-after(4)-between(4).snap | 5 - ...er__rules__pycodestyle__tests__w292_4.snap | 1 - ...__rules__pydocstyle__tests__D200_D.py.snap | 3 - ...ules__pydocstyle__tests__D200_D200.py.snap | 1 - ...__rules__pydocstyle__tests__D201_D.py.snap | 4 - ...__rules__pydocstyle__tests__D202_D.py.snap | 4 - ...ules__pydocstyle__tests__D202_D202.py.snap | 3 - ...__rules__pydocstyle__tests__D203_D.py.snap | 6 - ...__rules__pydocstyle__tests__D204_D.py.snap | 5 - ...__rules__pydocstyle__tests__D205_D.py.snap | 1 - ...__rules__pydocstyle__tests__D207_D.py.snap | 4 - ...__rules__pydocstyle__tests__D208_D.py.snap | 21 --- ...ules__pydocstyle__tests__D208_D208.py.snap | 4 - ...__rules__pydocstyle__tests__D209_D.py.snap | 2 - ...__rules__pydocstyle__tests__D210_D.py.snap | 3 - ...__rules__pydocstyle__tests__D211_D.py.snap | 2 - ...__rules__pydocstyle__tests__D212_D.py.snap | 3 - ...__rules__pydocstyle__tests__D213_D.py.snap | 28 --- ...ydocstyle__tests__D214_D214_module.py.snap | 2 - ...__pydocstyle__tests__D214_sections.py.snap | 2 - ...ules__pydocstyle__tests__D215_D215.py.snap | 1 - ...__pydocstyle__tests__D215_sections.py.snap | 2 - ...__rules__pydocstyle__tests__D300_D.py.snap | 10 -- ...ules__pydocstyle__tests__D300_D300.py.snap | 1 - ...__rules__pydocstyle__tests__D301_D.py.snap | 1 - ...ules__pydocstyle__tests__D301_D301.py.snap | 3 - ...__rules__pydocstyle__tests__D400_D.py.snap | 17 -- ...ules__pydocstyle__tests__D400_D400.py.snap | 13 -- ...ules__pydocstyle__tests__D403_D403.py.snap | 3 - ...__pydocstyle__tests__D405_sections.py.snap | 2 - ...__pydocstyle__tests__D406_sections.py.snap | 3 - ...__pydocstyle__tests__D407_sections.py.snap | 23 --- ...__pydocstyle__tests__D408_sections.py.snap | 1 - ...__pydocstyle__tests__D409_sections.py.snap | 3 - ...ules__pydocstyle__tests__D410_D410.py.snap | 2 - ...__pydocstyle__tests__D410_sections.py.snap | 2 - ...__pydocstyle__tests__D411_sections.py.snap | 3 - ...__pydocstyle__tests__D412_sections.py.snap | 1 - ...es__pydocstyle__tests__D412_sphinx.py.snap | 4 - ...ules__pydocstyle__tests__D413_D413.py.snap | 4 - ...__pydocstyle__tests__D413_sections.py.snap | 8 - ...__rules__pydocstyle__tests__D415_D.py.snap | 16 -- ...linter__rules__pydocstyle__tests__bom.snap | 1 - ...__rules__pydocstyle__tests__d209_d400.snap | 2 - ...ules__pyflakes__tests__F401_F401_0.py.snap | 15 -- ...les__pyflakes__tests__F401_F401_11.py.snap | 1 - ...les__pyflakes__tests__F401_F401_15.py.snap | 1 - ...les__pyflakes__tests__F401_F401_17.py.snap | 2 - ...les__pyflakes__tests__F401_F401_18.py.snap | 1 - ...les__pyflakes__tests__F401_F401_23.py.snap | 1 - ...ules__pyflakes__tests__F401_F401_5.py.snap | 4 - ...ules__pyflakes__tests__F401_F401_6.py.snap | 4 - ...ules__pyflakes__tests__F401_F401_7.py.snap | 3 - ...ules__pyflakes__tests__F401_F401_9.py.snap | 1 - ...eprecated_option_F401_24____init__.py.snap | 3 - ...on_F401_25__all_nonempty____init__.py.snap | 3 - ...ption_F401_26__all_empty____init__.py.snap | 2 - ...on_F401_27__all_mistyped____init__.py.snap | 2 - ...on_F401_28__all_multiple____init__.py.snap | 2 - ...F401_29__all_conditional____init__.py.snap | 2 - ...ts__F401_deprecated_option_F401_30.py.snap | 3 +- ..._rules__pyflakes__tests__F504_F504.py.snap | 5 - ..._rules__pyflakes__tests__F504_F50x.py.snap | 1 - ..._rules__pyflakes__tests__F522_F522.py.snap | 4 - ..._rules__pyflakes__tests__F523_F523.py.snap | 10 -- ..._rules__pyflakes__tests__F541_F541.py.snap | 20 --- ..._rules__pyflakes__tests__F601_F601.py.snap | 8 - ..._rules__pyflakes__tests__F602_F602.py.snap | 6 - ..._rules__pyflakes__tests__F632_F632.py.snap | 12 -- ...les__pyflakes__tests__F811_F811_17.py.snap | 1 - ...les__pyflakes__tests__F811_F811_21.py.snap | 1 - ...ules__pyflakes__tests__F811_F811_6.py.snap | 1 - ...ules__pyflakes__tests__F811_F811_8.py.snap | 1 - ...ules__pyflakes__tests__F841_F841_0.py.snap | 11 -- ...ules__pyflakes__tests__F841_F841_1.py.snap | 8 - ...ules__pyflakes__tests__F841_F841_3.py.snap | 34 ---- ...ules__pyflakes__tests__F841_F841_4.py.snap | 1 - ..._rules__pyflakes__tests__F901_F901.py.snap | 3 - ...hadowed_global_import_in_global_scope.snap | 1 - ...shadowed_global_import_in_local_scope.snap | 2 - ...shadowed_import_shadow_in_local_scope.snap | 1 - ..._shadowed_local_import_in_local_scope.snap | 1 - ...view_first_party_submodule_dunder_all.snap | 3 +- ...lakes__tests__f841_dummy_variable_rgx.snap | 12 -- ...__pyflakes__tests__future_annotations.snap | 1 - ...er_multiple_unbinds_from_module_scope.snap | 2 - ...s__load_after_unbind_from_class_scope.snap | 1 - ...__load_after_unbind_from_module_scope.snap | 1 - ...after_unbind_from_nested_module_scope.snap | 2 - ...yflakes__tests__multi_statement_lines.snap | 16 -- ...s__preview__F401_F401_24____init__.py.snap | 2 - ...01_F401_25__all_nonempty____init__.py.snap | 3 - ..._F401_F401_26__all_empty____init__.py.snap | 2 - ...01_F401_28__all_multiple____init__.py.snap | 2 - ...kes__tests__preview__F401___init__.py.snap | 1 - ...lakes__tests__preview__F841_F841_4.py.snap | 3 - ...in_body_after_double_shadowing_except.snap | 2 - ..._print_in_body_after_shadowing_except.snap | 1 - ...grep_hooks__tests__PGH004_PGH004_0.py.snap | 5 - ..._tests__PLC0208_iteration_over_set.py.snap | 8 - ...nt__tests__PLC0414_import_aliasing.py.snap | 8 - ...s__PLC2801_unnecessary_dunder_call.py.snap | 50 ------ ...nt__tests__PLE0241_duplicate_bases.py.snap | 8 - ...s__PLE1141_dict_iter_missing_items.py.snap | 2 - ...sts__PLE1519_singledispatch_method.py.snap | 3 - ...1520_singledispatchmethod_function.py.snap | 1 - ..._tests__PLE2510_invalid_characters.py.snap | 3 - ..._tests__PLE2512_invalid_characters.py.snap | 4 - ..._tests__PLE2513_invalid_characters.py.snap | 4 - ..._tests__PLE2514_invalid_characters.py.snap | Bin 905 -> 875 bytes ..._tests__PLE2515_invalid_characters.py.snap | 8 - ...ts__PLE4703_modified_iterating_set.py.snap | 6 - ...tests__PLR0202_no_method_decorator.py.snap | 2 - ...tests__PLR0203_no_method_decorator.py.snap | 2 - ...nt__tests__PLR0402_import_aliasing.py.snap | 2 - ...int__tests__PLR1711_useless_return.py.snap | 6 - ...R1714_repeated_equality_comparison.py.snap | 18 -- ...t__tests__PLR1722_sys_exit_alias_0.py.snap | 4 - ...t__tests__PLR1722_sys_exit_alias_1.py.snap | 4 - ...__tests__PLR1722_sys_exit_alias_11.py.snap | 1 - ...__tests__PLR1722_sys_exit_alias_12.py.snap | 1 - ...t__tests__PLR1722_sys_exit_alias_2.py.snap | 4 - ...t__tests__PLR1722_sys_exit_alias_3.py.snap | 2 - ...t__tests__PLR1722_sys_exit_alias_4.py.snap | 4 - ...t__tests__PLR1722_sys_exit_alias_5.py.snap | 4 - ...t__tests__PLR1722_sys_exit_alias_6.py.snap | 2 - ...t__tests__PLR1722_sys_exit_alias_7.py.snap | 1 - ...t__tests__PLR1722_sys_exit_alias_8.py.snap | 1 - ...t__tests__PLR1722_sys_exit_alias_9.py.snap | 1 - ...nt__tests__PLR1730_if_stmt_min_max.py.snap | 21 --- ...1733_unnecessary_dict_index_lookup.py.snap | 6 - ...1736_unnecessary_list_index_lookup.py.snap | 9 - ...lint__tests__PLR2044_empty_comment.py.snap | 7 - ...tests__PLR5501_collapsible_else_if.py.snap | 7 - ...__PLR6104_non_augmented_assignment.py.snap | 26 --- ..._tests__PLR6201_literal_membership.py.snap | 4 - ..._tests__PLW0108_unnecessary_lambda.py.snap | 8 - ...ests__PLW0120_useless_else_on_loop.py.snap | 8 - ...LW0133_useless_exception_statement.py.snap | 11 -- ...ts__PLW0245_super_without_brackets.py.snap | 1 - ...W1510_subprocess_run_without_check.py.snap | 4 - ...ests__PLW1514_unspecified_encoding.py.snap | 21 --- ...int__tests__PLW3301_nested_min_max.py.snap | 15 -- ...er__rules__pyupgrade__tests__UP001.py.snap | 2 - ...er__rules__pyupgrade__tests__UP003.py.snap | 6 - ...er__rules__pyupgrade__tests__UP004.py.snap | 24 --- ...er__rules__pyupgrade__tests__UP005.py.snap | 4 - ...__rules__pyupgrade__tests__UP006_0.py.snap | 13 -- ...__rules__pyupgrade__tests__UP006_1.py.snap | 1 - ...__rules__pyupgrade__tests__UP006_3.py.snap | 1 - ...er__rules__pyupgrade__tests__UP007.py.snap | 18 -- ...er__rules__pyupgrade__tests__UP008.py.snap | 20 ++- ...__rules__pyupgrade__tests__UP009_0.py.snap | 1 - ...__rules__pyupgrade__tests__UP009_1.py.snap | 1 - ...__rules__pyupgrade__tests__UP009_6.py.snap | 1 - ...__rules__pyupgrade__tests__UP009_7.py.snap | 1 - ...er__rules__pyupgrade__tests__UP010.py.snap | 10 -- ...er__rules__pyupgrade__tests__UP011.py.snap | 4 - ...er__rules__pyupgrade__tests__UP012.py.snap | 27 --- ...er__rules__pyupgrade__tests__UP013.py.snap | 12 -- ...er__rules__pyupgrade__tests__UP014.py.snap | 5 - ...er__rules__pyupgrade__tests__UP015.py.snap | 44 ----- ...__rules__pyupgrade__tests__UP015_1.py.snap | 1 - ...er__rules__pyupgrade__tests__UP018.py.snap | 19 -- ...er__rules__pyupgrade__tests__UP019.py.snap | 4 - ...er__rules__pyupgrade__tests__UP020.py.snap | 2 - ...er__rules__pyupgrade__tests__UP021.py.snap | 3 - ...er__rules__pyupgrade__tests__UP022.py.snap | 7 - ...er__rules__pyupgrade__tests__UP023.py.snap | 10 -- ...__rules__pyupgrade__tests__UP024_0.py.snap | 15 -- ...__rules__pyupgrade__tests__UP024_1.py.snap | 3 - ...__rules__pyupgrade__tests__UP024_2.py.snap | 20 --- ...__rules__pyupgrade__tests__UP024_4.py.snap | 1 - ...er__rules__pyupgrade__tests__UP025.py.snap | 15 -- ...er__rules__pyupgrade__tests__UP026.py.snap | 26 --- ...er__rules__pyupgrade__tests__UP027.py.snap | 5 - ...__rules__pyupgrade__tests__UP028_0.py.snap | 13 -- ...er__rules__pyupgrade__tests__UP029.py.snap | 4 - ...__rules__pyupgrade__tests__UP030_0.py.snap | 23 --- ...__rules__pyupgrade__tests__UP031_0.py.snap | 162 ++++++++++++------ ...__rules__pyupgrade__tests__UP032_0.py.snap | 62 ------- ...__rules__pyupgrade__tests__UP032_1.py.snap | 1 - ...__rules__pyupgrade__tests__UP032_2.py.snap | 22 --- ...__rules__pyupgrade__tests__UP033_0.py.snap | 3 - ...__rules__pyupgrade__tests__UP033_1.py.snap | 3 - ...er__rules__pyupgrade__tests__UP034.py.snap | 10 -- ...er__rules__pyupgrade__tests__UP035.py.snap | 54 ------ ...__rules__pyupgrade__tests__UP036_0.py.snap | 33 ---- ...__rules__pyupgrade__tests__UP036_1.py.snap | 13 -- ...__rules__pyupgrade__tests__UP036_2.py.snap | 12 -- ...__rules__pyupgrade__tests__UP036_3.py.snap | 3 - ...__rules__pyupgrade__tests__UP036_4.py.snap | 8 - ...__rules__pyupgrade__tests__UP036_5.py.snap | 2 - ...__rules__pyupgrade__tests__UP037_0.py.snap | 28 --- ...__rules__pyupgrade__tests__UP037_1.py.snap | 1 - ...er__rules__pyupgrade__tests__UP038.py.snap | 2 - ...er__rules__pyupgrade__tests__UP039.py.snap | 5 - ...er__rules__pyupgrade__tests__UP040.py.snap | 17 -- ...r__rules__pyupgrade__tests__UP040.pyi.snap | 2 - ...er__rules__pyupgrade__tests__UP041.py.snap | 7 - ...er__rules__pyupgrade__tests__UP042.py.snap | 2 - ...er__rules__pyupgrade__tests__UP043.py.snap | 4 - ...timeout_error_alias_not_applied_py310.snap | 4 - ...rade__tests__datetime_utc_alias_py311.snap | 4 - ..._annotations_keep_runtime_typing_p310.snap | 4 - ...tests__future_annotations_pep_585_p37.snap | 1 - ...sts__future_annotations_pep_585_py310.snap | 4 - ...tests__future_annotations_pep_604_p37.snap | 1 - ...sts__future_annotations_pep_604_py310.snap | 2 - ...es__refurb__tests__FURB105_FURB105.py.snap | 17 -- ...es__refurb__tests__FURB110_FURB110.py.snap | 8 - ...es__refurb__tests__FURB113_FURB113.py.snap | 12 -- ...es__refurb__tests__FURB116_FURB116.py.snap | 6 - ...es__refurb__tests__FURB118_FURB118.py.snap | 32 ---- ...es__refurb__tests__FURB129_FURB129.py.snap | 12 -- ...es__refurb__tests__FURB131_FURB131.py.snap | 8 - ...es__refurb__tests__FURB132_FURB132.py.snap | 4 - ...es__refurb__tests__FURB136_FURB136.py.snap | 9 - ...es__refurb__tests__FURB140_FURB140.py.snap | 9 - ...es__refurb__tests__FURB142_FURB142.py.snap | 9 - ...es__refurb__tests__FURB145_FURB145.py.snap | 6 - ...es__refurb__tests__FURB148_FURB148.py.snap | 20 --- ...es__refurb__tests__FURB152_FURB152.py.snap | 15 -- ...es__refurb__tests__FURB154_FURB154.py.snap | 12 -- ...es__refurb__tests__FURB157_FURB157.py.snap | 8 - ...es__refurb__tests__FURB161_FURB161.py.snap | 9 - ...es__refurb__tests__FURB163_FURB163.py.snap | 8 - ...es__refurb__tests__FURB164_FURB164.py.snap | 17 -- ...es__refurb__tests__FURB166_FURB166.py.snap | 7 - ...es__refurb__tests__FURB167_FURB167.py.snap | 2 - ...es__refurb__tests__FURB168_FURB168.py.snap | 8 - ...es__refurb__tests__FURB169_FURB169.py.snap | 12 -- ...es__refurb__tests__FURB171_FURB171.py.snap | 6 - ...es__refurb__tests__FURB180_FURB180.py.snap | 4 - ...es__refurb__tests__FURB181_FURB181.py.snap | 15 -- ...es__refurb__tests__FURB187_FURB187.py.snap | 3 - ...es__refurb__tests__FURB192_FURB192.py.snap | 9 - ..._ruff__tests__PY39_RUF013_RUF013_0.py.snap | 19 -- ..._ruff__tests__PY39_RUF013_RUF013_1.py.snap | 1 - ..._rules__ruff__tests__RUF005_RUF005.py.snap | 15 -- ..._rules__ruff__tests__RUF010_RUF010.py.snap | 12 -- ...ules__ruff__tests__RUF013_RUF013_0.py.snap | 19 -- ...ules__ruff__tests__RUF013_RUF013_1.py.snap | 1 - ...ules__ruff__tests__RUF013_RUF013_3.py.snap | 3 - ..._rules__ruff__tests__RUF015_RUF015.py.snap | 23 --- ...ules__ruff__tests__RUF017_RUF017_0.py.snap | 7 - ...ules__ruff__tests__RUF017_RUF017_1.py.snap | 1 - ..._rules__ruff__tests__RUF019_RUF019.py.snap | 6 - ..._rules__ruff__tests__RUF020_RUF020.py.snap | 7 - ..._rules__ruff__tests__RUF021_RUF021.py.snap | 12 -- ..._rules__ruff__tests__RUF022_RUF022.py.snap | 32 ---- ..._rules__ruff__tests__RUF023_RUF023.py.snap | 20 --- ..._rules__ruff__tests__RUF024_RUF024.py.snap | 7 - ..._rules__ruff__tests__RUF025_RUF025.py.snap | 11 -- ..._rules__ruff__tests__RUF026_RUF026.py.snap | 14 -- ...ules__ruff__tests__RUF027_RUF027_0.py.snap | 16 -- ..._rules__ruff__tests__RUF028_RUF028.py.snap | 11 -- ..._rules__ruff__tests__RUF030_RUF030.py.snap | 19 -- ..._rules__ruff__tests__RUF101_RUF101.py.snap | 7 - ...ruff_linter__rules__ruff__tests__noqa.snap | 1 - ..._linter__rules__ruff__tests__ruf100_0.snap | 23 --- ...__rules__ruff__tests__ruf100_0_prefix.snap | 22 --- ..._linter__rules__ruff__tests__ruf100_1.snap | 8 - ..._linter__rules__ruff__tests__ruf100_2.snap | 1 - ..._linter__rules__ruff__tests__ruf100_3.snap | 21 --- ..._linter__rules__ruff__tests__ruf100_5.snap | 3 - ...__rules__ruff__tests__ruff_noqa_codes.snap | 1 - ...rules__ruff__tests__ruff_noqa_invalid.snap | 2 - ..._error-instead-of-exception_TRY400.py.snap | 11 -- ...atops__tests__verbose-raise_TRY201.py.snap | 3 - ...linter__linter__tests__import_sorting.snap | 4 - ...er__linter__tests__ipy_escape_command.snap | 2 - ...inter__linter__tests__unused_variable.snap | 4 - 743 files changed, 129 insertions(+), 4771 deletions(-) diff --git a/crates/ruff/tests/integration_test.rs b/crates/ruff/tests/integration_test.rs index 03f6c81af5894..4e090b880ab67 100644 --- a/crates/ruff/tests/integration_test.rs +++ b/crates/ruff/tests/integration_test.rs @@ -122,7 +122,6 @@ fn stdin_error() { | = help: Remove unused import: `os` - Suggested fix: 1 |-import os Run `ruff check --fix` to apply this fix. @@ -151,7 +150,6 @@ fn stdin_filename() { | = help: Remove unused import: `os` - Suggested fix: 1 |-import os Run `ruff check --fix` to apply this fix. @@ -191,7 +189,6 @@ import bar # unused import | = help: Remove unused import: `bar` - Suggested fix: 1 1 | 2 |-import bar # unused import @@ -204,7 +201,6 @@ import bar # unused import | = help: Remove unused import: `foo` - Suggested fix: 1 1 | 2 |-import foo # unused import @@ -237,7 +233,6 @@ fn check_warn_stdin_filename_with_files() { | = help: Remove unused import: `os` - Suggested fix: 1 |-import os Run `ruff check --fix` to apply this fix. @@ -268,7 +263,6 @@ fn stdin_source_type_py() { | = help: Remove unused import: `os` - Suggested fix: 1 |-import os Run `ruff check --fix` to apply this fix. @@ -608,7 +602,6 @@ fn stdin_override_parser_ipynb() { | = help: Remove unused import: `os` - Suggested fix: 1 |-import os 2 1 | import sys 3 2 | print(1) @@ -623,7 +616,6 @@ fn stdin_override_parser_ipynb() { | = help: Remove unused import: `sys` - Suggested fix: 1 1 | import os 2 |-import sys 3 2 | print(1) @@ -660,7 +652,6 @@ fn stdin_override_parser_py() { | = help: Remove unused import: `os` - Suggested fix: 1 |-import os Run `ruff check --fix` to apply this fix. @@ -1555,7 +1546,6 @@ fn check_input_from_argfile() -> Result<()> { | = help: Remove unused import: `os` - Suggested fix: 1 |-import os Run `ruff check --fix` to apply this fix. @@ -1581,13 +1571,11 @@ fn check_hints_hidden_unsafe_fixes() { exit_code: 1 ----- stdout ----- -:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix. - Suggested fix: 1 |+# fix from stable-test-rule-safe-fix Run `ruff check --fix` to apply this fix. -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. - Suggested fix: 1 |+# fix from stable-test-rule-unsafe-fix Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. @@ -1609,7 +1597,6 @@ fn check_hints_hidden_unsafe_fixes_with_no_safe_fixes() { exit_code: 1 ----- stdout ----- -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. - Suggested fix: 1 |+# fix from stable-test-rule-unsafe-fix 1 2 | x = {'a': 1, 'a': 1} @@ -1633,13 +1620,11 @@ fn check_no_hint_for_hidden_unsafe_fixes_when_disabled() { exit_code: 1 ----- stdout ----- -:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix. - Suggested fix: 1 |+# fix from stable-test-rule-safe-fix Run `ruff check --fix` to apply this fix. -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. - Suggested fix: 1 |+# fix from stable-test-rule-unsafe-fix Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. @@ -1663,7 +1648,6 @@ fn check_no_hint_for_hidden_unsafe_fixes_with_no_safe_fixes_when_disabled() { exit_code: 1 ----- stdout ----- -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. - Suggested fix: 1 |+# fix from stable-test-rule-unsafe-fix 1 2 | x = {'a': 1, 'a': 1} @@ -1686,13 +1670,11 @@ fn check_shows_unsafe_fixes_with_opt_in() { exit_code: 1 ----- stdout ----- -:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix. - Suggested fix: 1 |+# fix from stable-test-rule-safe-fix Run `ruff check --fix` to apply this fix. -:1:1: RUF902 [*] Hey this is a stable test rule with an unsafe fix. - Suggested fix: 1 |+# fix from stable-test-rule-unsafe-fix Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. @@ -1718,7 +1700,6 @@ fn fix_applies_safe_fixes_by_default() { ----- stderr ----- -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. - Suggested fix: 1 |+# fix from stable-test-rule-unsafe-fix 1 2 | # fix from stable-test-rule-safe-fix @@ -1761,7 +1742,6 @@ fn fix_does_not_apply_display_only_fixes() { def add_to_list(item, some_list=[]): ... ----- stderr ----- -:1:1: RUF903 Hey this is a stable test rule with a display only fix. - Suggested fix: 1 |+# fix from stable-test-rule-display-only-fix 1 2 | def add_to_list(item, some_list=[]): ... @@ -1785,7 +1765,6 @@ fn fix_does_not_apply_display_only_fixes_with_unsafe_fixes_enabled() { def add_to_list(item, some_list=[]): ... ----- stderr ----- -:1:1: RUF903 Hey this is a stable test rule with a display only fix. - Suggested fix: 1 |+# fix from stable-test-rule-display-only-fix 1 2 | def add_to_list(item, some_list=[]): ... @@ -1808,7 +1787,6 @@ fn fix_only_unsafe_fixes_available() { ----- stderr ----- -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. - Suggested fix: 1 |+# fix from stable-test-rule-unsafe-fix Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. @@ -1949,13 +1927,11 @@ extend-unsafe-fixes = ["RUF901"] exit_code: 1 ----- stdout ----- -:1:1: RUF901 Hey this is a stable test rule with a safe fix. - Suggested fix: 1 |+# fix from stable-test-rule-safe-fix Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. - Suggested fix: 1 |+# fix from stable-test-rule-unsafe-fix Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. @@ -1991,13 +1967,11 @@ extend-safe-fixes = ["RUF902"] exit_code: 1 ----- stdout ----- -:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix. - Suggested fix: 1 |+# fix from stable-test-rule-safe-fix Run `ruff check --fix` to apply this fix. -:1:1: RUF902 [*] Hey this is a stable test rule with an unsafe fix. - Suggested fix: 1 |+# fix from stable-test-rule-unsafe-fix Run `ruff check --fix` to apply this fix. @@ -2035,13 +2009,11 @@ extend-safe-fixes = ["RUF902"] exit_code: 1 ----- stdout ----- -:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix. - Suggested fix: 1 |+# fix from stable-test-rule-safe-fix Run `ruff check --fix` to apply this fix. -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. - Suggested fix: 1 |+# fix from stable-test-rule-unsafe-fix Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. @@ -2082,7 +2054,6 @@ extend-safe-fixes = ["RUF9"] ----- stdout ----- -:1:1: RUF900 Hey this is a stable test rule. -:1:1: RUF901 Hey this is a stable test rule with a safe fix. - Suggested fix: 1 |+# fix from stable-test-rule-safe-fix 1 2 | x = {'a': 1, 'a': 1} 2 3 | print(('foo')) @@ -2091,7 +2062,6 @@ extend-safe-fixes = ["RUF9"] Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. -:1:1: RUF902 [*] Hey this is a stable test rule with an unsafe fix. - Suggested fix: 1 |+# fix from stable-test-rule-unsafe-fix 1 2 | x = {'a': 1, 'a': 1} 2 3 | print(('foo')) @@ -2100,7 +2070,6 @@ extend-safe-fixes = ["RUF9"] Run `ruff check --fix` to apply this fix. -:1:1: RUF903 Hey this is a stable test rule with a display only fix. - Suggested fix: 1 |+# fix from stable-test-rule-display-only-fix 1 2 | x = {'a': 1, 'a': 1} 2 3 | print(('foo')) @@ -2216,7 +2185,6 @@ select = ["RUF017"] | = help: Replace with `functools.reduce` - Suggested fix: 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] diff --git a/crates/ruff_linter/src/message/diff.rs b/crates/ruff_linter/src/message/diff.rs index 3f3e58aa76b1f..468ddf72d1aad 100644 --- a/crates/ruff_linter/src/message/diff.rs +++ b/crates/ruff_linter/src/message/diff.rs @@ -62,8 +62,6 @@ impl Display for Diff<'_> { let digit_with = calculate_print_width(OneIndexed::from_zero_indexed(largest_new.max(largest_old))); - writeln!(f, "{}", "Suggested fix:".blue())?; - for (idx, group) in diff.grouped_ops(3).iter().enumerate() { if idx > 0 { writeln!(f, "{:-^1$}", "-", 80)?; diff --git a/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap b/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap index fb4de78455d6b..72a77e4727d46 100644 --- a/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap +++ b/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap @@ -10,7 +10,6 @@ ERA001.py:1:1: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 1 |-#import os 2 1 | # from foo import junk 3 2 | #a = 3 @@ -28,7 +27,6 @@ ERA001.py:2:1: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 1 1 | #import os 2 |-# from foo import junk 3 2 | #a = 3 @@ -48,7 +46,6 @@ ERA001.py:3:1: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 1 1 | #import os 2 2 | # from foo import junk 3 |-#a = 3 @@ -69,7 +66,6 @@ ERA001.py:5:1: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 2 2 | # from foo import junk 3 3 | #a = 3 4 4 | a = 4 @@ -90,7 +86,6 @@ ERA001.py:13:5: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 10 10 | 11 11 | # This is a real comment. 12 12 | # # This is a (nested) comment. @@ -110,7 +105,6 @@ ERA001.py:21:5: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 18 18 | 19 19 | class A(): 20 20 | pass @@ -132,7 +126,6 @@ ERA001.py:26:5: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 23 23 | 24 24 | dictionary = { 25 25 | # "key1": 123, # noqa: ERA001 @@ -153,7 +146,6 @@ ERA001.py:27:5: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 24 24 | dictionary = { 25 25 | # "key1": 123, # noqa: ERA001 26 26 | # "key2": 456, @@ -175,7 +167,6 @@ ERA001.py:32:1: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 29 29 | 30 30 | #import os # noqa 31 31 | @@ -196,7 +187,6 @@ ERA001.py:33:1: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 30 30 | #import os # noqa 31 31 | 32 32 | # case 1: @@ -218,7 +208,6 @@ ERA001.py:34:1: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 31 31 | 32 32 | # case 1: 33 33 | # try: @@ -240,7 +229,6 @@ ERA001.py:35:1: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 32 32 | # case 1: 33 33 | # try: 34 34 | # try: # with comment @@ -262,7 +250,6 @@ ERA001.py:36:1: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 33 33 | # try: 34 34 | # try: # with comment 35 35 | # try: print() @@ -283,7 +270,6 @@ ERA001.py:37:1: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 34 34 | # try: # with comment 35 35 | # try: print() 36 36 | # except: @@ -303,7 +289,6 @@ ERA001.py:38:1: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 35 35 | # try: print() 36 36 | # except: 37 37 | # except Foo: @@ -324,7 +309,6 @@ ERA001.py:44:1: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 41 41 | # Script tag without an opening tag (Error) 42 42 | 43 43 | # requires-python = ">=3.11" @@ -345,7 +329,6 @@ ERA001.py:47:1: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 44 44 | # dependencies = [ 45 45 | # "requests<3", 46 46 | # "rich", diff --git a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-non-annotated-dependency_FAST002.py.snap b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-non-annotated-dependency_FAST002.py.snap index fb1bbd4eae746..48096f737d59a 100644 --- a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-non-annotated-dependency_FAST002.py.snap +++ b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-non-annotated-dependency_FAST002.py.snap @@ -12,7 +12,6 @@ FAST002.py:24:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel @@ -43,7 +42,6 @@ FAST002.py:25:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel @@ -74,7 +72,6 @@ FAST002.py:32:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel @@ -105,7 +102,6 @@ FAST002.py:33:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel @@ -136,7 +132,6 @@ FAST002.py:34:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel @@ -167,7 +162,6 @@ FAST002.py:35:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel @@ -198,7 +192,6 @@ FAST002.py:36:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel @@ -229,7 +222,6 @@ FAST002.py:37:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel @@ -260,7 +252,6 @@ FAST002.py:38:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -Suggested fix: 12 12 | Security, 13 13 | ) 14 14 | from pydantic import BaseModel diff --git a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-redundant-response-model_FAST001.py.snap b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-redundant-response-model_FAST001.py.snap index 143163f8228fc..e56838203de37 100644 --- a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-redundant-response-model_FAST001.py.snap +++ b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-redundant-response-model_FAST001.py.snap @@ -10,7 +10,6 @@ FAST001.py:17:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -Suggested fix: 14 14 | # Errors 15 15 | 16 16 | @@ -31,7 +30,6 @@ FAST001.py:22:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -Suggested fix: 19 19 | return item 20 20 | 21 21 | @@ -52,7 +50,6 @@ FAST001.py:27:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -Suggested fix: 24 24 | return item 25 25 | 26 26 | @@ -73,7 +70,6 @@ FAST001.py:32:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -Suggested fix: 29 29 | return item 30 30 | 31 31 | @@ -94,7 +90,6 @@ FAST001.py:37:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -Suggested fix: 34 34 | return item 35 35 | 36 36 | @@ -115,7 +110,6 @@ FAST001.py:42:21: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -Suggested fix: 39 39 | return item 40 40 | 41 41 | @@ -136,7 +130,6 @@ FAST001.py:47:21: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -Suggested fix: 44 44 | return item 45 45 | 46 46 | @@ -158,7 +151,6 @@ FAST001.py:48:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -Suggested fix: 45 45 | 46 46 | 47 47 | @app.get("/items/", response_model=Item) @@ -179,7 +171,6 @@ FAST001.py:53:24: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -Suggested fix: 50 50 | return item 51 51 | 52 52 | diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type.snap index 10e83b3d158f4..f3aec4ea80cba 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type.snap @@ -9,7 +9,6 @@ auto_return_type.py:1:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `int` -Suggested fix: 1 |-def func(): 1 |+def func() -> int: 2 2 | return 1 @@ -26,7 +25,6 @@ auto_return_type.py:5:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `float` -Suggested fix: 2 2 | return 1 3 3 | 4 4 | @@ -47,7 +45,6 @@ auto_return_type.py:9:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `float` -Suggested fix: 6 6 | return 1.5 7 7 | 8 8 | @@ -67,7 +64,6 @@ auto_return_type.py:16:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `bool` -Suggested fix: 13 13 | return 1.5 14 14 | 15 15 | @@ -88,7 +84,6 @@ auto_return_type.py:20:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `None` -Suggested fix: 17 17 | return True 18 18 | 19 19 | @@ -108,7 +103,6 @@ auto_return_type.py:27:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `str | float` -Suggested fix: 24 24 | return 25 25 | 26 26 | @@ -128,7 +122,6 @@ auto_return_type.py:31:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `str | float` -Suggested fix: 28 28 | return 1 or 2.5 if x > 0 else 1.5 or "str" 29 29 | 30 30 | @@ -166,7 +159,6 @@ auto_return_type.py:45:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int` -Suggested fix: 42 42 | return {"foo": 1} 43 43 | 44 44 | @@ -187,7 +179,6 @@ auto_return_type.py:52:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int | None` -Suggested fix: 49 49 | return True 50 50 | 51 51 | @@ -208,7 +199,6 @@ auto_return_type.py:59:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `str | int | None` -Suggested fix: 56 56 | return None 57 57 | 58 58 | @@ -229,7 +219,6 @@ auto_return_type.py:68:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int | None` -Suggested fix: 65 65 | return None 66 66 | 67 67 | @@ -249,7 +238,6 @@ auto_return_type.py:73:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `None` -Suggested fix: 70 70 | return 1 71 71 | 72 72 | @@ -270,7 +258,6 @@ auto_return_type.py:77:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int | None` -Suggested fix: 74 74 | x = 1 75 75 | 76 76 | @@ -291,7 +278,6 @@ auto_return_type.py:82:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `str | int | None` -Suggested fix: 79 79 | return 1 80 80 | 81 81 | @@ -312,7 +298,6 @@ auto_return_type.py:90:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int | None` -Suggested fix: 87 87 | return "foo" 88 88 | 89 89 | @@ -333,7 +318,6 @@ auto_return_type.py:96:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int` -Suggested fix: 93 93 | return 1 94 94 | 95 95 | @@ -354,7 +338,6 @@ auto_return_type.py:104:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -Suggested fix: 101 101 | return 4 102 102 | 103 103 | @@ -375,7 +358,6 @@ auto_return_type.py:112:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -Suggested fix: 109 109 | return 4 110 110 | 111 111 | @@ -396,7 +378,6 @@ auto_return_type.py:119:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -Suggested fix: 116 116 | return 1 117 117 | 118 118 | @@ -417,7 +398,6 @@ auto_return_type.py:128:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -Suggested fix: 125 125 | return 2 126 126 | 127 127 | @@ -438,7 +418,6 @@ auto_return_type.py:137:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -Suggested fix: 134 134 | return 2 135 135 | 136 136 | @@ -459,7 +438,6 @@ auto_return_type.py:146:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -Suggested fix: 143 143 | pass 144 144 | 145 145 | @@ -529,7 +507,6 @@ auto_return_type.py:180:9: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `float` -Suggested fix: 177 177 | pass 178 178 | 179 179 | @abstractmethod @@ -550,7 +527,6 @@ auto_return_type.py:187:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -Suggested fix: 184 184 | return 1.5 185 185 | 186 186 | @@ -571,7 +547,6 @@ auto_return_type.py:194:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -Suggested fix: 191 191 | return 2 192 192 | 193 193 | @@ -592,7 +567,6 @@ auto_return_type.py:203:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Never` -Suggested fix: 151 151 | 152 152 | import abc 153 153 | from abc import abstractmethod @@ -621,7 +595,6 @@ auto_return_type.py:210:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -Suggested fix: 207 207 | raise TypeError 208 208 | 209 209 | @@ -642,7 +615,6 @@ auto_return_type.py:234:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -Suggested fix: 231 231 | return i 232 232 | 233 233 | @@ -663,7 +635,6 @@ auto_return_type.py:240:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -Suggested fix: 237 237 | raise ValueError 238 238 | 239 239 | @@ -684,7 +655,6 @@ auto_return_type.py:248:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -Suggested fix: 245 245 | raise ValueError 246 246 | 247 247 | @@ -705,7 +675,6 @@ auto_return_type.py:255:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -Suggested fix: 252 252 | return 2 253 253 | 254 254 | @@ -726,7 +695,6 @@ auto_return_type.py:262:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -Suggested fix: 259 259 | pass 260 260 | 261 261 | @@ -747,7 +715,6 @@ auto_return_type.py:269:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `None` -Suggested fix: 266 266 | raise ValueError 267 267 | 268 268 | @@ -768,7 +735,6 @@ auto_return_type.py:276:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `None` -Suggested fix: 273 273 | pass 274 274 | 275 275 | @@ -789,7 +755,6 @@ auto_return_type.py:283:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -Suggested fix: 280 280 | pass 281 281 | 282 282 | @@ -810,7 +775,6 @@ auto_return_type.py:290:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -Suggested fix: 287 287 | return 5 288 288 | 289 289 | @@ -831,7 +795,6 @@ auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `str | int` -Suggested fix: 296 296 | raise ValueError 297 297 | 298 298 | diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type_py38.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type_py38.snap index 0f7ad20532ec3..e615e2c3a3998 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type_py38.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type_py38.snap @@ -9,7 +9,6 @@ auto_return_type.py:1:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `int` -Suggested fix: 1 |-def func(): 1 |+def func() -> int: 2 2 | return 1 @@ -26,7 +25,6 @@ auto_return_type.py:5:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `float` -Suggested fix: 2 2 | return 1 3 3 | 4 4 | @@ -47,7 +45,6 @@ auto_return_type.py:9:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `float` -Suggested fix: 6 6 | return 1.5 7 7 | 8 8 | @@ -67,7 +64,6 @@ auto_return_type.py:16:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `bool` -Suggested fix: 13 13 | return 1.5 14 14 | 15 15 | @@ -88,7 +84,6 @@ auto_return_type.py:20:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `None` -Suggested fix: 17 17 | return True 18 18 | 19 19 | @@ -108,7 +103,6 @@ auto_return_type.py:27:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Union[str | float]` -Suggested fix: 1 |+from typing import Union 1 2 | def func(): 2 3 | return 1 @@ -133,7 +127,6 @@ auto_return_type.py:31:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Union[str | float]` -Suggested fix: 1 |+from typing import Union 1 2 | def func(): 2 3 | return 1 @@ -176,7 +169,6 @@ auto_return_type.py:45:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int` -Suggested fix: 42 42 | return {"foo": 1} 43 43 | 44 44 | @@ -197,7 +189,6 @@ auto_return_type.py:52:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Optional[int]` -Suggested fix: 1 |+from typing import Optional 1 2 | def func(): 2 3 | return 1 @@ -223,7 +214,6 @@ auto_return_type.py:59:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Union[str | int | None]` -Suggested fix: 1 |+from typing import Union 1 2 | def func(): 2 3 | return 1 @@ -249,7 +239,6 @@ auto_return_type.py:68:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Optional[int]` -Suggested fix: 1 |+from typing import Optional 1 2 | def func(): 2 3 | return 1 @@ -274,7 +263,6 @@ auto_return_type.py:73:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `None` -Suggested fix: 70 70 | return 1 71 71 | 72 72 | @@ -295,7 +283,6 @@ auto_return_type.py:77:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Optional[int]` -Suggested fix: 1 |+from typing import Optional 1 2 | def func(): 2 3 | return 1 @@ -321,7 +308,6 @@ auto_return_type.py:82:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Union[str | int | None]` -Suggested fix: 1 |+from typing import Union 1 2 | def func(): 2 3 | return 1 @@ -347,7 +333,6 @@ auto_return_type.py:90:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Optional[int]` -Suggested fix: 1 |+from typing import Optional 1 2 | def func(): 2 3 | return 1 @@ -373,7 +358,6 @@ auto_return_type.py:96:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int` -Suggested fix: 93 93 | return 1 94 94 | 95 95 | @@ -394,7 +378,6 @@ auto_return_type.py:104:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -Suggested fix: 1 |+from typing import Optional 1 2 | def func(): 2 3 | return 1 @@ -420,7 +403,6 @@ auto_return_type.py:112:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -Suggested fix: 1 |+from typing import Optional 1 2 | def func(): 2 3 | return 1 @@ -446,7 +428,6 @@ auto_return_type.py:119:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -Suggested fix: 116 116 | return 1 117 117 | 118 118 | @@ -467,7 +448,6 @@ auto_return_type.py:128:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -Suggested fix: 125 125 | return 2 126 126 | 127 127 | @@ -488,7 +468,6 @@ auto_return_type.py:137:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -Suggested fix: 1 |+from typing import Optional 1 2 | def func(): 2 3 | return 1 @@ -514,7 +493,6 @@ auto_return_type.py:146:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -Suggested fix: 1 |+from typing import Optional 1 2 | def func(): 2 3 | return 1 @@ -589,7 +567,6 @@ auto_return_type.py:180:9: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `float` -Suggested fix: 177 177 | pass 178 178 | 179 179 | @abstractmethod @@ -610,7 +587,6 @@ auto_return_type.py:187:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -Suggested fix: 151 151 | 152 152 | import abc 153 153 | from abc import abstractmethod @@ -639,7 +615,6 @@ auto_return_type.py:194:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -Suggested fix: 191 191 | return 2 192 192 | 193 193 | @@ -660,7 +635,6 @@ auto_return_type.py:203:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `NoReturn` -Suggested fix: 151 151 | 152 152 | import abc 153 153 | from abc import abstractmethod @@ -689,7 +663,6 @@ auto_return_type.py:210:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -Suggested fix: 207 207 | raise TypeError 208 208 | 209 209 | @@ -710,7 +683,6 @@ auto_return_type.py:234:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -Suggested fix: 231 231 | return i 232 232 | 233 233 | @@ -731,7 +703,6 @@ auto_return_type.py:240:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -Suggested fix: 237 237 | raise ValueError 238 238 | 239 239 | @@ -752,7 +723,6 @@ auto_return_type.py:248:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -Suggested fix: 214 214 | return 1 215 215 | 216 216 | @@ -782,7 +752,6 @@ auto_return_type.py:255:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -Suggested fix: 214 214 | return 1 215 215 | 216 216 | @@ -812,7 +781,6 @@ auto_return_type.py:262:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -Suggested fix: 259 259 | pass 260 260 | 261 261 | @@ -833,7 +801,6 @@ auto_return_type.py:269:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `None` -Suggested fix: 266 266 | raise ValueError 267 267 | 268 268 | @@ -854,7 +821,6 @@ auto_return_type.py:276:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `None` -Suggested fix: 273 273 | pass 274 274 | 275 275 | @@ -875,7 +841,6 @@ auto_return_type.py:283:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -Suggested fix: 214 214 | return 1 215 215 | 216 216 | @@ -905,7 +870,6 @@ auto_return_type.py:290:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -Suggested fix: 287 287 | return 5 288 288 | 289 289 | @@ -926,7 +890,6 @@ auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Union[str | int]` -Suggested fix: 214 214 | return 1 215 215 | 216 216 | diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap index af2ffa3cb365c..40b828000acaa 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap @@ -10,7 +10,6 @@ annotation_presence.py:5:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `None` -Suggested fix: 2 2 | from typing_extensions import override 3 3 | 4 4 | # Error @@ -47,7 +46,6 @@ annotation_presence.py:10:5: ANN201 [*] Missing return type annotation for publi | = help: Add return type annotation: `None` -Suggested fix: 7 7 | 8 8 | 9 9 | # Error @@ -84,7 +82,6 @@ annotation_presence.py:20:5: ANN201 [*] Missing return type annotation for publi | = help: Add return type annotation: `None` -Suggested fix: 17 17 | 18 18 | 19 19 | # Error @@ -105,7 +102,6 @@ annotation_presence.py:25:5: ANN201 [*] Missing return type annotation for publi | = help: Add return type annotation: `None` -Suggested fix: 22 22 | 23 23 | 24 24 | # Error @@ -304,7 +300,6 @@ annotation_presence.py:159:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `None` -Suggested fix: 156 156 | 157 157 | class Foo: 158 158 | @decorator() @@ -326,7 +321,6 @@ annotation_presence.py:165:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `None` -Suggested fix: 162 162 | 163 163 | # Regression test for: https://github.com/astral-sh/ruff/issues/7711 164 164 | class Class: diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap index a12d3149045d2..7a4116381f2fc 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap @@ -9,7 +9,6 @@ ignore_fully_untyped.py:24:5: ANN201 [*] Missing return type annotation for publ | = help: Add return type annotation: `None` -Suggested fix: 21 21 | pass 22 22 | 23 23 | @@ -43,7 +42,6 @@ ignore_fully_untyped.py:32:5: ANN201 [*] Missing return type annotation for publ | = help: Add return type annotation: `None` -Suggested fix: 29 29 | pass 30 30 | 31 31 | @@ -65,7 +63,6 @@ ignore_fully_untyped.py:43:9: ANN201 [*] Missing return type annotation for publ | = help: Add return type annotation: `None` -Suggested fix: 40 40 | def ok_untyped_method(self): 41 41 | pass 42 42 | diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap index bcf11f8ea5c36..bdd4c0957c4a9 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap @@ -11,7 +11,6 @@ mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special m | = help: Add return type annotation: `None` -Suggested fix: 2 2 | 3 3 | # Error 4 4 | class Foo: @@ -33,7 +32,6 @@ mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special | = help: Add return type annotation: `None` -Suggested fix: 8 8 | 9 9 | # Error 10 10 | class Foo: @@ -54,7 +52,6 @@ mypy_init_return.py:40:5: ANN202 [*] Missing return type annotation for private | = help: Add return type annotation: `None` -Suggested fix: 37 37 | 38 38 | 39 39 | # Error @@ -76,7 +73,6 @@ mypy_init_return.py:47:9: ANN204 [*] Missing return type annotation for special | = help: Add return type annotation: `None` -Suggested fix: 44 44 | # Error – used to be ok for a moment since the mere presence 45 45 | # of a vararg falsely indicated that the function has a typed argument. 46 46 | class Foo: diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap index 5c0f2defaf783..94d20c6f2e1f8 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap @@ -10,7 +10,6 @@ simple_magic_methods.py:2:9: ANN204 [*] Missing return type annotation for speci | = help: Add return type annotation: `str` -Suggested fix: 1 1 | class Foo: 2 |- def __str__(self): 2 |+ def __str__(self) -> str: @@ -30,7 +29,6 @@ simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for speci | = help: Add return type annotation: `str` -Suggested fix: 2 2 | def __str__(self): 3 3 | ... 4 4 | @@ -52,7 +50,6 @@ simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for speci | = help: Add return type annotation: `int` -Suggested fix: 5 5 | def __repr__(self): 6 6 | ... 7 7 | @@ -74,7 +71,6 @@ simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `int` -Suggested fix: 8 8 | def __len__(self): 9 9 | ... 10 10 | @@ -96,7 +92,6 @@ simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `None` -Suggested fix: 11 11 | def __length_hint__(self): 12 12 | ... 13 13 | @@ -118,7 +113,6 @@ simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `None` -Suggested fix: 14 14 | def __init__(self): 15 15 | ... 16 16 | @@ -140,7 +134,6 @@ simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `bool` -Suggested fix: 17 17 | def __del__(self): 18 18 | ... 19 19 | @@ -162,7 +155,6 @@ simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `bytes` -Suggested fix: 20 20 | def __bool__(self): 21 21 | ... 22 22 | @@ -184,7 +176,6 @@ simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `str` -Suggested fix: 23 23 | def __bytes__(self): 24 24 | ... 25 25 | @@ -206,7 +197,6 @@ simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `bool` -Suggested fix: 26 26 | def __format__(self, format_spec): 27 27 | ... 28 28 | @@ -228,7 +218,6 @@ simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `complex` -Suggested fix: 29 29 | def __contains__(self, item): 30 30 | ... 31 31 | @@ -250,7 +239,6 @@ simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `int` -Suggested fix: 32 32 | def __complex__(self): 33 33 | ... 34 34 | @@ -272,7 +260,6 @@ simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `float` -Suggested fix: 35 35 | def __int__(self): 36 36 | ... 37 37 | @@ -294,7 +281,6 @@ simple_magic_methods.py:41:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `int` -Suggested fix: 38 38 | def __float__(self): 39 39 | ... 40 40 | diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__suppress_none_returning.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__suppress_none_returning.snap index a2643c13073ad..3a924a9e40bbf 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__suppress_none_returning.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__suppress_none_returning.snap @@ -10,7 +10,6 @@ suppress_none_returning.py:45:5: ANN201 [*] Missing return type annotation for p | = help: Add return type annotation: `bool` -Suggested fix: 42 42 | 43 43 | 44 44 | # Error @@ -32,7 +31,6 @@ suppress_none_returning.py:50:5: ANN201 [*] Missing return type annotation for p | = help: Add return type annotation: `bool | None` -Suggested fix: 47 47 | 48 48 | 49 49 | # Error diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap index c9f4d3f93d3f8..0664555b1f633 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap @@ -11,7 +11,6 @@ ASYNC105.py:30:5: ASYNC105 [*] Call to `trio.aclose_forcefully` is not immediate | = help: Add `await` -Suggested fix: 27 27 | await trio.lowlevel.wait_writable(foo) 28 28 | 29 29 | # ASYNC105 @@ -34,7 +33,6 @@ ASYNC105.py:31:5: ASYNC105 [*] Call to `trio.open_file` is not immediately await | = help: Add `await` -Suggested fix: 28 28 | 29 29 | # ASYNC105 30 30 | trio.aclose_forcefully(foo) @@ -57,7 +55,6 @@ ASYNC105.py:32:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_listeners` is not | = help: Add `await` -Suggested fix: 29 29 | # ASYNC105 30 30 | trio.aclose_forcefully(foo) 31 31 | trio.open_file(foo) @@ -80,7 +77,6 @@ ASYNC105.py:33:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_stream` is not im | = help: Add `await` -Suggested fix: 30 30 | trio.aclose_forcefully(foo) 31 31 | trio.open_file(foo) 32 32 | trio.open_ssl_over_tcp_listeners(foo, foo) @@ -103,7 +99,6 @@ ASYNC105.py:34:5: ASYNC105 [*] Call to `trio.open_tcp_listeners` is not immediat | = help: Add `await` -Suggested fix: 31 31 | trio.open_file(foo) 32 32 | trio.open_ssl_over_tcp_listeners(foo, foo) 33 33 | trio.open_ssl_over_tcp_stream(foo, foo) @@ -126,7 +121,6 @@ ASYNC105.py:35:5: ASYNC105 [*] Call to `trio.open_tcp_stream` is not immediately | = help: Add `await` -Suggested fix: 32 32 | trio.open_ssl_over_tcp_listeners(foo, foo) 33 33 | trio.open_ssl_over_tcp_stream(foo, foo) 34 34 | trio.open_tcp_listeners(foo) @@ -149,7 +143,6 @@ ASYNC105.py:36:5: ASYNC105 [*] Call to `trio.open_unix_socket` is not immediatel | = help: Add `await` -Suggested fix: 33 33 | trio.open_ssl_over_tcp_stream(foo, foo) 34 34 | trio.open_tcp_listeners(foo) 35 35 | trio.open_tcp_stream(foo, foo) @@ -172,7 +165,6 @@ ASYNC105.py:37:5: ASYNC105 [*] Call to `trio.run_process` is not immediately awa | = help: Add `await` -Suggested fix: 34 34 | trio.open_tcp_listeners(foo) 35 35 | trio.open_tcp_stream(foo, foo) 36 36 | trio.open_unix_socket(foo) @@ -195,7 +187,6 @@ ASYNC105.py:38:5: ASYNC105 [*] Call to `trio.serve_listeners` is not immediately | = help: Add `await` -Suggested fix: 35 35 | trio.open_tcp_stream(foo, foo) 36 36 | trio.open_unix_socket(foo) 37 37 | trio.run_process(foo) @@ -218,7 +209,6 @@ ASYNC105.py:39:5: ASYNC105 [*] Call to `trio.serve_ssl_over_tcp` is not immediat | = help: Add `await` -Suggested fix: 36 36 | trio.open_unix_socket(foo) 37 37 | trio.run_process(foo) 38 38 | trio.serve_listeners(foo, foo) @@ -241,7 +231,6 @@ ASYNC105.py:40:5: ASYNC105 [*] Call to `trio.serve_tcp` is not immediately await | = help: Add `await` -Suggested fix: 37 37 | trio.run_process(foo) 38 38 | trio.serve_listeners(foo, foo) 39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) @@ -264,7 +253,6 @@ ASYNC105.py:41:5: ASYNC105 [*] Call to `trio.sleep` is not immediately awaited | = help: Add `await` -Suggested fix: 38 38 | trio.serve_listeners(foo, foo) 39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) 40 40 | trio.serve_tcp(foo, foo) @@ -287,7 +275,6 @@ ASYNC105.py:42:5: ASYNC105 [*] Call to `trio.sleep_forever` is not immediately a | = help: Add `await` -Suggested fix: 39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) 40 40 | trio.serve_tcp(foo, foo) 41 41 | trio.sleep(foo) @@ -310,7 +297,6 @@ ASYNC105.py:44:5: ASYNC105 [*] Call to `trio.lowlevel.cancel_shielded_checkpoint | = help: Add `await` -Suggested fix: 41 41 | trio.sleep(foo) 42 42 | trio.sleep_forever() 43 43 | trio.sleep_until(foo) @@ -333,7 +319,6 @@ ASYNC105.py:45:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint` is not immedia | = help: Add `await` -Suggested fix: 42 42 | trio.sleep_forever() 43 43 | trio.sleep_until(foo) 44 44 | trio.lowlevel.cancel_shielded_checkpoint() @@ -356,7 +341,6 @@ ASYNC105.py:46:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint_if_cancelled` i | = help: Add `await` -Suggested fix: 43 43 | trio.sleep_until(foo) 44 44 | trio.lowlevel.cancel_shielded_checkpoint() 45 45 | trio.lowlevel.checkpoint() @@ -379,7 +363,6 @@ ASYNC105.py:47:5: ASYNC105 [*] Call to `trio.lowlevel.open_process` is not immed | = help: Add `await` -Suggested fix: 44 44 | trio.lowlevel.cancel_shielded_checkpoint() 45 45 | trio.lowlevel.checkpoint() 46 46 | trio.lowlevel.checkpoint_if_cancelled() @@ -402,7 +385,6 @@ ASYNC105.py:48:5: ASYNC105 [*] Call to `trio.lowlevel.permanently_detach_corouti | = help: Add `await` -Suggested fix: 45 45 | trio.lowlevel.checkpoint() 46 46 | trio.lowlevel.checkpoint_if_cancelled() 47 47 | trio.lowlevel.open_process() @@ -425,7 +407,6 @@ ASYNC105.py:49:5: ASYNC105 [*] Call to `trio.lowlevel.reattach_detached_coroutin | = help: Add `await` -Suggested fix: 46 46 | trio.lowlevel.checkpoint_if_cancelled() 47 47 | trio.lowlevel.open_process() 48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) @@ -448,7 +429,6 @@ ASYNC105.py:50:5: ASYNC105 [*] Call to `trio.lowlevel.temporarily_detach_corouti | = help: Add `await` -Suggested fix: 47 47 | trio.lowlevel.open_process() 48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) 49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) @@ -471,7 +451,6 @@ ASYNC105.py:51:5: ASYNC105 [*] Call to `trio.lowlevel.wait_readable` is not imme | = help: Add `await` -Suggested fix: 48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) 49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) 50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) @@ -493,7 +472,6 @@ ASYNC105.py:52:5: ASYNC105 [*] Call to `trio.lowlevel.wait_task_rescheduled` is | = help: Add `await` -Suggested fix: 49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) 50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) 51 51 | trio.lowlevel.wait_readable(foo) @@ -516,7 +494,6 @@ ASYNC105.py:53:5: ASYNC105 [*] Call to `trio.lowlevel.wait_writable` is not imme | = help: Add `await` -Suggested fix: 50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) 51 51 | trio.lowlevel.wait_readable(foo) 52 52 | trio.lowlevel.wait_task_rescheduled(foo) @@ -538,7 +515,6 @@ ASYNC105.py:58:16: ASYNC105 [*] Call to `trio.open_file` is not immediately awai | = help: Add `await` -Suggested fix: 55 55 | async with await trio.open_file(foo): # Ok 56 56 | pass 57 57 | diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap index 4061b60b4e001..72caee9131652 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap @@ -12,7 +12,6 @@ ASYNC115.py:5:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio | = help: Replace with `trio.lowlevel.checkpoint()` -Suggested fix: 2 2 | import trio 3 3 | from trio import sleep 4 4 | @@ -35,7 +34,6 @@ ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio | = help: Replace with `trio.lowlevel.checkpoint()` -Suggested fix: 8 8 | await trio.sleep(...) # OK 9 9 | await trio.sleep() # OK 10 10 | @@ -58,7 +56,6 @@ ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio | = help: Replace with `trio.lowlevel.checkpoint()` -Suggested fix: 14 14 | trio.sleep(1) # OK 15 15 | time.sleep(0) # OK 16 16 | @@ -79,7 +76,6 @@ ASYNC115.py:48:14: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri | = help: Replace with `trio.lowlevel.checkpoint()` -Suggested fix: 45 45 | def func(): 46 46 | import trio 47 47 | @@ -99,7 +95,6 @@ ASYNC115.py:55:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio | = help: Replace with `trio.lowlevel.checkpoint()` -Suggested fix: 48 48 | trio.run(trio.sleep(0)) # ASYNC115 49 49 | 50 50 | @@ -124,7 +119,6 @@ ASYNC115.py:59:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri | = help: Replace with `trio.lowlevel.checkpoint()` -Suggested fix: 48 48 | trio.run(trio.sleep(0)) # ASYNC115 49 49 | 50 50 | diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap index 69b286e59012a..00b514b6e3b90 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap @@ -11,7 +11,6 @@ ASYNC116.py:11:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -Suggested fix: 8 8 | import trio 9 9 | 10 10 | # These examples are probably not meant to ever wake up: @@ -33,7 +32,6 @@ ASYNC116.py:14:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -Suggested fix: 11 11 | await trio.sleep(100000) # error: 116, "async" 12 12 | 13 13 | # 'inf literal' overflow trick @@ -55,7 +53,6 @@ ASYNC116.py:18:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -Suggested fix: 15 15 | 16 16 | await trio.sleep(86399) 17 17 | await trio.sleep(86400) @@ -78,7 +75,6 @@ ASYNC116.py:19:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -Suggested fix: 16 16 | await trio.sleep(86399) 17 17 | await trio.sleep(86400) 18 18 | await trio.sleep(86400.01) # error: 116, "async" @@ -100,7 +96,6 @@ ASYNC116.py:48:5: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usua | = help: Replace with `trio.sleep_forever()` -Suggested fix: 45 45 | import trio 46 46 | 47 47 | # does not require the call to be awaited, nor in an async fun @@ -121,7 +116,6 @@ ASYNC116.py:50:14: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -Suggested fix: 47 47 | # does not require the call to be awaited, nor in an async fun 48 48 | trio.sleep(86401) # error: 116, "async" 49 49 | # also checks that we don't break visit_Call @@ -141,7 +135,6 @@ ASYNC116.py:57:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC115_ASYNC115.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC115_ASYNC115.py.snap index 2322ee4508926..669e6ec5247ab 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC115_ASYNC115.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC115_ASYNC115.py.snap @@ -12,7 +12,6 @@ ASYNC115.py:5:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio | = help: Replace with `trio.lowlevel.checkpoint()` -Suggested fix: 2 2 | import trio 3 3 | from trio import sleep 4 4 | @@ -35,7 +34,6 @@ ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio | = help: Replace with `trio.lowlevel.checkpoint()` -Suggested fix: 8 8 | await trio.sleep(...) # OK 9 9 | await trio.sleep() # OK 10 10 | @@ -58,7 +56,6 @@ ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio | = help: Replace with `trio.lowlevel.checkpoint()` -Suggested fix: 14 14 | trio.sleep(1) # OK 15 15 | time.sleep(0) # OK 16 16 | @@ -79,7 +76,6 @@ ASYNC115.py:48:14: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri | = help: Replace with `trio.lowlevel.checkpoint()` -Suggested fix: 45 45 | def func(): 46 46 | import trio 47 47 | @@ -99,7 +95,6 @@ ASYNC115.py:55:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio | = help: Replace with `trio.lowlevel.checkpoint()` -Suggested fix: 48 48 | trio.run(trio.sleep(0)) # ASYNC115 49 49 | 50 50 | @@ -124,7 +119,6 @@ ASYNC115.py:59:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri | = help: Replace with `trio.lowlevel.checkpoint()` -Suggested fix: 48 48 | trio.run(trio.sleep(0)) # ASYNC115 49 49 | 50 50 | @@ -156,7 +150,6 @@ ASYNC115.py:85:11: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of ` | = help: Replace with `asyncio.lowlevel.checkpoint()` -Suggested fix: 49 49 | 50 50 | 51 51 | from trio import Event, sleep @@ -187,7 +180,6 @@ ASYNC115.py:91:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `a | = help: Replace with `asyncio.lowlevel.checkpoint()` -Suggested fix: 49 49 | 50 50 | 51 51 | from trio import Event, sleep @@ -218,7 +210,6 @@ ASYNC115.py:97:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `a | = help: Replace with `asyncio.lowlevel.checkpoint()` -Suggested fix: 49 49 | 50 50 | 51 51 | from trio import Event, sleep @@ -247,7 +238,6 @@ ASYNC115.py:128:15: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of | = help: Replace with `asyncio.lowlevel.checkpoint()` -Suggested fix: 49 49 | 50 50 | 51 51 | from trio import Event, sleep diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC116_ASYNC116.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC116_ASYNC116.py.snap index 052673fcb2fd4..d6fade4d8a9a7 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC116_ASYNC116.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC116_ASYNC116.py.snap @@ -11,7 +11,6 @@ ASYNC116.py:11:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -Suggested fix: 8 8 | import trio 9 9 | 10 10 | # These examples are probably not meant to ever wake up: @@ -33,7 +32,6 @@ ASYNC116.py:14:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -Suggested fix: 11 11 | await trio.sleep(100000) # error: 116, "async" 12 12 | 13 13 | # 'inf literal' overflow trick @@ -55,7 +53,6 @@ ASYNC116.py:18:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -Suggested fix: 15 15 | 16 16 | await trio.sleep(86399) 17 17 | await trio.sleep(86400) @@ -78,7 +75,6 @@ ASYNC116.py:19:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -Suggested fix: 16 16 | await trio.sleep(86399) 17 17 | await trio.sleep(86400) 18 18 | await trio.sleep(86400.01) # error: 116, "async" @@ -100,7 +96,6 @@ ASYNC116.py:48:5: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usua | = help: Replace with `trio.sleep_forever()` -Suggested fix: 45 45 | import trio 46 46 | 47 47 | # does not require the call to be awaited, nor in an async fun @@ -121,7 +116,6 @@ ASYNC116.py:50:14: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -Suggested fix: 47 47 | # does not require the call to be awaited, nor in an async fun 48 48 | trio.sleep(86401) # error: 116, "async" 49 49 | # also checks that we don't break visit_Call @@ -141,7 +135,6 @@ ASYNC116.py:57:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf @@ -171,7 +164,6 @@ ASYNC116.py:64:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf @@ -201,7 +193,6 @@ ASYNC116.py:67:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf @@ -231,7 +222,6 @@ ASYNC116.py:71:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf @@ -262,7 +252,6 @@ ASYNC116.py:72:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf @@ -292,7 +281,6 @@ ASYNC116.py:101:5: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf @@ -321,7 +309,6 @@ ASYNC116.py:103:15: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf @@ -349,7 +336,6 @@ ASYNC116.py:110:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -Suggested fix: 2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. 3 3 | import math 4 4 | from math import inf diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B004_B004.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B004_B004.py.snap index 4aa58646ed94e..6e9c5a5686eb6 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B004_B004.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B004_B004.py.snap @@ -12,7 +12,6 @@ B004.py:3:8: B004 [*] Using `hasattr(x, "__call__")` to test if x is callable is | = help: Replace with `callable()` -Suggested fix: 1 1 | def this_is_a_bug(): 2 2 | o = object() 3 |- if hasattr(o, "__call__"): @@ -44,7 +43,6 @@ B004.py:12:8: B004 [*] Using `hasattr(x, "__call__")` to test if x is callable i | = help: Replace with `callable()` -Suggested fix: 9 9 | def still_a_bug(): 10 10 | import builtins 11 11 | o = object() @@ -76,7 +74,6 @@ B004.py:24:8: B004 [*] Using `hasattr(x, "__call__")` to test if x is callable i | = help: Replace with `callable()` -Suggested fix: 1 |+import builtins 1 2 | def this_is_a_bug(): 2 3 | o = object() diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap index 6407011a0e16d..bddc5b5759874 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap @@ -12,7 +12,6 @@ B006_1.py:3:22: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -Suggested fix: 1 1 | # Docstring followed by a newline 2 2 | 3 |-def foobar(foor, bar={}): diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap index 453ae719c0b6e..dca16c244a89b 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap @@ -12,7 +12,6 @@ B006_2.py:4:22: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -Suggested fix: 1 1 | # Docstring followed by whitespace with no newline 2 2 | # Regression test for https://github.com/astral-sh/ruff/issues/7155 3 3 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap index c6f48a23e6432..cca2c9b7a3870 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap @@ -10,7 +10,6 @@ B006_3.py:4:22: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -Suggested fix: 1 1 | # Docstring with no newline 2 2 | 3 3 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap index e8dc1edc4c304..869f866f1e8c9 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap @@ -10,7 +10,6 @@ B006_4.py:7:26: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -Suggested fix: 4 4 | 5 5 | 6 6 | class FormFeedIndent: diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap index e2522cae40874..95c59c1f81442 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap @@ -9,7 +9,6 @@ B006_5.py:5:49: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -Suggested fix: 2 2 | # https://github.com/astral-sh/ruff/issues/7616 3 3 | 4 4 | @@ -32,7 +31,6 @@ B006_5.py:9:61: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -Suggested fix: 6 6 | import os 7 7 | 8 8 | @@ -57,7 +55,6 @@ B006_5.py:15:50: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -Suggested fix: 12 12 | return 2 13 13 | 14 14 | @@ -82,7 +79,6 @@ B006_5.py:21:54: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -Suggested fix: 18 18 | import itertools 19 19 | 20 20 | @@ -106,7 +102,6 @@ B006_5.py:25:55: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -Suggested fix: 22 22 | from os import path 23 23 | 24 24 | @@ -131,7 +126,6 @@ B006_5.py:30:66: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -Suggested fix: 27 27 | from sys import version_info 28 28 | 29 29 | @@ -156,7 +150,6 @@ B006_5.py:35:59: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -Suggested fix: 32 32 | from sys import version_info 33 33 | 34 34 | @@ -181,7 +174,6 @@ B006_5.py:40:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -Suggested fix: 37 37 | import os 38 38 | 39 39 | @@ -206,7 +198,6 @@ B006_5.py:45:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -Suggested fix: 42 42 | import os; import sys 43 43 | 44 44 | @@ -230,7 +221,6 @@ B006_5.py:50:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -Suggested fix: 47 47 | import os; import sys; x = 1 48 48 | 49 49 | @@ -254,7 +244,6 @@ B006_5.py:55:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -Suggested fix: 52 52 | import os; import sys 53 53 | 54 54 | @@ -277,7 +266,6 @@ B006_5.py:59:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -Suggested fix: 56 56 | import os; import sys 57 57 | 58 58 | @@ -299,7 +287,6 @@ B006_5.py:63:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -Suggested fix: 60 60 | import os; import sys; x = 1 61 61 | 62 62 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap index 551e22d66699d..6470227784340 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap @@ -11,7 +11,6 @@ B006_6.py:4:22: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -Suggested fix: 1 1 | # Import followed by whitespace with no newline 2 2 | # Same as B006_2.py, but import instead of docstring 3 3 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap index e763933a54f9a..0e62a1580c5e6 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap @@ -11,7 +11,6 @@ B006_7.py:4:22: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -Suggested fix: 1 1 | # Import with no newline 2 2 | # Same as B006_3.py, but import instead of docstring 3 3 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_8.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_8.py.snap index 8a8f30fc6ebd1..3392fd3140832 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_8.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_8.py.snap @@ -9,7 +9,6 @@ B006_8.py:1:19: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -Suggested fix: 1 |-def foo(a: list = []): 1 |+def foo(a: list = None): 2 2 | raise NotImplementedError("") @@ -27,7 +26,6 @@ B006_8.py:5:19: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -Suggested fix: 2 2 | raise NotImplementedError("") 3 3 | 4 4 | @@ -48,7 +46,6 @@ B006_8.py:10:19: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -Suggested fix: 7 7 | raise NotImplementedError("and has some text in here") 8 8 | 9 9 | @@ -71,7 +68,6 @@ B006_8.py:15:19: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -Suggested fix: 12 12 | raise IndexError() 13 13 | 14 14 | @@ -91,7 +87,6 @@ B006_8.py:19:20: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -Suggested fix: 16 16 | raise NotImplementedError 17 17 | 18 18 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap index 06982176f119b..fa1122a1d6258 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap @@ -9,7 +9,6 @@ B006_B008.py:63:25: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -Suggested fix: 60 60 | # Flag mutable literals/comprehensions 61 61 | 62 62 | @@ -29,7 +28,6 @@ B006_B008.py:67:30: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -Suggested fix: 64 64 | ... 65 65 | 66 66 | @@ -51,7 +49,6 @@ B006_B008.py:73:52: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -Suggested fix: 70 70 | 71 71 | class Foo: 72 72 | @staticmethod @@ -74,7 +71,6 @@ B006_B008.py:77:31: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -Suggested fix: 74 74 | pass 75 75 | 76 76 | @@ -105,7 +101,6 @@ B006_B008.py:85:20: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -Suggested fix: 82 82 | def single_line_func_wrong(value = {}): ... 83 83 | 84 84 | @@ -125,7 +120,6 @@ B006_B008.py:89:20: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -Suggested fix: 86 86 | ... 87 87 | 88 88 | @@ -145,7 +139,6 @@ B006_B008.py:93:32: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -Suggested fix: 90 90 | ... 91 91 | 92 92 | @@ -165,7 +158,6 @@ B006_B008.py:97:26: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -Suggested fix: 94 94 | ... 95 95 | 96 96 | @@ -186,7 +178,6 @@ B006_B008.py:102:46: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -Suggested fix: 99 99 | 100 100 | 101 101 | # N.B. we're also flagging the function call in the comprehension @@ -206,7 +197,6 @@ B006_B008.py:106:46: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -Suggested fix: 103 103 | pass 104 104 | 105 105 | @@ -226,7 +216,6 @@ B006_B008.py:110:45: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -Suggested fix: 107 107 | pass 108 108 | 109 109 | @@ -246,7 +235,6 @@ B006_B008.py:114:33: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -Suggested fix: 111 111 | pass 112 112 | 113 113 | @@ -268,7 +256,6 @@ B006_B008.py:239:20: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -Suggested fix: 236 236 | 237 237 | # B006 and B008 238 238 | # We should handle arbitrary nesting of these B008. @@ -290,7 +277,6 @@ B006_B008.py:276:27: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -Suggested fix: 273 273 | 274 274 | 275 275 | def mutable_annotations( @@ -313,7 +299,6 @@ B006_B008.py:277:35: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -Suggested fix: 274 274 | 275 275 | def mutable_annotations( 276 276 | a: list[int] | None = [], @@ -336,7 +321,6 @@ B006_B008.py:278:62: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -Suggested fix: 275 275 | def mutable_annotations( 276 276 | a: list[int] | None = [], 277 277 | b: Optional[Dict[int, int]] = {}, @@ -359,7 +343,6 @@ B006_B008.py:279:80: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -Suggested fix: 276 276 | a: list[int] | None = [], 277 277 | b: Optional[Dict[int, int]] = {}, 278 278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), @@ -379,7 +362,6 @@ B006_B008.py:284:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -Suggested fix: 281 281 | pass 282 282 | 283 283 | @@ -400,7 +382,6 @@ B006_B008.py:288:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -Suggested fix: 285 285 | """Docstring""" 286 286 | 287 287 | @@ -420,7 +401,6 @@ B006_B008.py:293:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -Suggested fix: 290 290 | ... 291 291 | 292 292 | @@ -441,7 +421,6 @@ B006_B008.py:297:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -Suggested fix: 294 294 | """Docstring"""; ... 295 295 | 296 296 | @@ -464,7 +443,6 @@ B006_B008.py:302:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -Suggested fix: 299 299 | ... 300 300 | 301 301 | @@ -495,7 +473,6 @@ B006_B008.py:313:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -Suggested fix: 310 310 | """Docstring""" 311 311 | 312 312 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap index ee2aa19375899..042e32ef61f85 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap @@ -21,7 +21,6 @@ B007.py:18:13: B007 [*] Loop control variable `k` not used within loop body | = help: Rename unused `k` to `_k` -Suggested fix: 15 15 | 16 16 | for i in range(10): 17 17 | for j in range(10): @@ -49,7 +48,6 @@ B007.py:30:13: B007 [*] Loop control variable `k` not used within loop body | = help: Rename unused `k` to `_k` -Suggested fix: 27 27 | yield i, (j, (k, l)) 28 28 | 29 29 | @@ -114,7 +112,6 @@ B007.py:52:14: B007 [*] Loop control variable `bar` not used within loop body | = help: Rename unused `bar` to `_bar` -Suggested fix: 49 49 | 50 50 | def f(): 51 51 | # Fixable. @@ -148,7 +145,6 @@ B007.py:68:14: B007 [*] Loop control variable `bar` not used within loop body | = help: Rename unused `bar` to `_bar` -Suggested fix: 65 65 | 66 66 | def f(): 67 67 | # Fixable. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap index a5b8a9a1b9c19..a262f6884ae3b 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap @@ -11,7 +11,6 @@ B009_B010.py:19:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -Suggested fix: 16 16 | getattr(foo, "__123abc") 17 17 | 18 18 | # Invalid usage @@ -34,7 +33,6 @@ B009_B010.py:20:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -Suggested fix: 17 17 | 18 18 | # Invalid usage 19 19 | getattr(foo, "bar") @@ -57,7 +55,6 @@ B009_B010.py:21:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -Suggested fix: 18 18 | # Invalid usage 19 19 | getattr(foo, "bar") 20 20 | getattr(foo, "_123abc") @@ -80,7 +77,6 @@ B009_B010.py:22:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -Suggested fix: 19 19 | getattr(foo, "bar") 20 20 | getattr(foo, "_123abc") 21 21 | getattr(foo, "__123abc__") @@ -103,7 +99,6 @@ B009_B010.py:23:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -Suggested fix: 20 20 | getattr(foo, "_123abc") 21 21 | getattr(foo, "__123abc__") 22 22 | getattr(foo, "abc123") @@ -126,7 +121,6 @@ B009_B010.py:24:15: B009 [*] Do not call `getattr` with a constant attribute val | = help: Replace `getattr` with attribute access -Suggested fix: 21 21 | getattr(foo, "__123abc__") 22 22 | getattr(foo, "abc123") 23 23 | getattr(foo, r"abc123") @@ -149,7 +143,6 @@ B009_B010.py:25:4: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -Suggested fix: 22 22 | getattr(foo, "abc123") 23 23 | getattr(foo, r"abc123") 24 24 | _ = lambda x: getattr(x, "bar") @@ -172,7 +165,6 @@ B009_B010.py:27:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -Suggested fix: 24 24 | _ = lambda x: getattr(x, "bar") 25 25 | if getattr(x, "bar"): 26 26 | pass @@ -195,7 +187,6 @@ B009_B010.py:28:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -Suggested fix: 25 25 | if getattr(x, "bar"): 26 26 | pass 27 27 | getattr(1, "real") @@ -218,7 +209,6 @@ B009_B010.py:29:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -Suggested fix: 26 26 | pass 27 27 | getattr(1, "real") 28 28 | getattr(1., "real") @@ -241,7 +231,6 @@ B009_B010.py:30:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -Suggested fix: 27 27 | getattr(1, "real") 28 28 | getattr(1., "real") 29 29 | getattr(1.0, "real") @@ -264,7 +253,6 @@ B009_B010.py:31:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -Suggested fix: 28 28 | getattr(1., "real") 29 29 | getattr(1.0, "real") 30 30 | getattr(1j, "real") @@ -287,7 +275,6 @@ B009_B010.py:32:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -Suggested fix: 29 29 | getattr(1.0, "real") 30 30 | getattr(1j, "real") 31 31 | getattr(True, "real") @@ -310,7 +297,6 @@ B009_B010.py:33:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -Suggested fix: 30 30 | getattr(1j, "real") 31 31 | getattr(True, "real") 32 32 | getattr(x := 1, "real") @@ -332,7 +318,6 @@ B009_B010.py:34:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -Suggested fix: 31 31 | getattr(True, "real") 32 32 | getattr(x := 1, "real") 33 33 | getattr(x + y, "real") @@ -356,7 +341,6 @@ B009_B010.py:58:8: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -Suggested fix: 55 55 | setattr(foo.bar, r"baz", None) 56 56 | 57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885 @@ -379,7 +363,6 @@ B009_B010.py:65:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -Suggested fix: 62 62 | setattr(*foo, "bar", None) 63 63 | 64 64 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1739800901 @@ -401,7 +384,6 @@ B009_B010.py:69:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -Suggested fix: 66 66 | registration.registry, '__name__') 67 67 | 68 68 | import builtins diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap index a80515fb62407..5b71cec7aabb2 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap @@ -11,7 +11,6 @@ B009_B010.py:50:1: B010 [*] Do not call `setattr` with a constant attribute valu | = help: Replace `setattr` with assignment -Suggested fix: 47 47 | pass 48 48 | 49 49 | # Invalid usage @@ -34,7 +33,6 @@ B009_B010.py:51:1: B010 [*] Do not call `setattr` with a constant attribute valu | = help: Replace `setattr` with assignment -Suggested fix: 48 48 | 49 49 | # Invalid usage 50 50 | setattr(foo, "bar", None) @@ -57,7 +55,6 @@ B009_B010.py:52:1: B010 [*] Do not call `setattr` with a constant attribute valu | = help: Replace `setattr` with assignment -Suggested fix: 49 49 | # Invalid usage 50 50 | setattr(foo, "bar", None) 51 51 | setattr(foo, "_123abc", None) @@ -80,7 +77,6 @@ B009_B010.py:53:1: B010 [*] Do not call `setattr` with a constant attribute valu | = help: Replace `setattr` with assignment -Suggested fix: 50 50 | setattr(foo, "bar", None) 51 51 | setattr(foo, "_123abc", None) 52 52 | setattr(foo, "__123abc__", None) @@ -102,7 +98,6 @@ B009_B010.py:54:1: B010 [*] Do not call `setattr` with a constant attribute valu | = help: Replace `setattr` with assignment -Suggested fix: 51 51 | setattr(foo, "_123abc", None) 52 52 | setattr(foo, "__123abc__", None) 53 53 | setattr(foo, "abc123", None) @@ -125,7 +120,6 @@ B009_B010.py:55:1: B010 [*] Do not call `setattr` with a constant attribute valu | = help: Replace `setattr` with assignment -Suggested fix: 52 52 | setattr(foo, "__123abc__", None) 53 53 | setattr(foo, "abc123", None) 54 54 | setattr(foo, r"abc123", None) diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap index 26279768e9cfc..1b5bd4e01c1c0 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap @@ -11,7 +11,6 @@ B011.py:8:8: B011 [*] Do not `assert False` (`python -O` removes these calls), r | = help: Replace `assert False` -Suggested fix: 5 5 | """ 6 6 | 7 7 | assert 1 != 2 @@ -31,7 +30,6 @@ B011.py:10:8: B011 [*] Do not `assert False` (`python -O` removes these calls), | = help: Replace `assert False` -Suggested fix: 7 7 | assert 1 != 2 8 8 | assert False 9 9 | assert 1 != 2, "message" diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B013_B013.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B013_B013.py.snap index 1ccff0f08bdea..1bea9537622ea 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B013_B013.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B013_B013.py.snap @@ -12,7 +12,6 @@ B013.py:5:8: B013 [*] A length-one tuple literal is redundant in exception handl | = help: Replace with `except ValueError` -Suggested fix: 2 2 | 3 3 | try: 4 4 | pass @@ -34,7 +33,6 @@ B013.py:13:7: B013 [*] A length-one tuple literal is redundant in exception hand | = help: Replace with `except ValueError` -Suggested fix: 10 10 | pass 11 11 | except (*retriable_exceptions,): 12 12 | pass diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B014_B014.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B014_B014.py.snap index 4825feb582fb2..5e2b1af527249 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B014_B014.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B014_B014.py.snap @@ -12,7 +12,6 @@ B014.py:17:8: B014 [*] Exception handler with duplicate exception: `OSError` | = help: De-duplicate exceptions -Suggested fix: 14 14 | 15 15 | try: 16 16 | pass @@ -35,7 +34,6 @@ B014.py:28:8: B014 [*] Exception handler with duplicate exception: `MyError` | = help: De-duplicate exceptions -Suggested fix: 25 25 | 26 26 | try: 27 27 | pass @@ -58,7 +56,6 @@ B014.py:49:8: B014 [*] Exception handler with duplicate exception: `re.error` | = help: De-duplicate exceptions -Suggested fix: 46 46 | 47 47 | try: 48 48 | pass @@ -80,7 +77,6 @@ B014.py:82:8: B014 [*] Exception handler with duplicate exception: `ValueError` | = help: De-duplicate exceptions -Suggested fix: 79 79 | # Regression test for: https://github.com/astral-sh/ruff/issues/6412 80 80 | try: 81 81 | pass @@ -102,7 +98,6 @@ B014.py:89:7: B014 [*] Exception handler with duplicate exception: `re.error` | = help: De-duplicate exceptions -Suggested fix: 86 86 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1739801758 87 87 | try: 88 88 | pas diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap index 122c7fadc4f1e..4cf1feae43625 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap @@ -12,7 +12,6 @@ B033.py:4:35: B033 [*] Sets should not contain duplicate item `"value1"` | = help: Remove duplicate item -Suggested fix: 1 1 | ### 2 2 | # Errors. 3 3 | ### @@ -35,7 +34,6 @@ B033.py:5:21: B033 [*] Sets should not contain duplicate item `1` | = help: Remove duplicate item -Suggested fix: 2 2 | # Errors. 3 3 | ### 4 4 | incorrect_set = {"value1", 23, 5, "value1"} @@ -58,7 +56,6 @@ B033.py:10:5: B033 [*] Sets should not contain duplicate item `"value1"` | = help: Remove duplicate item -Suggested fix: 7 7 | "value1", 8 8 | 23, 9 9 | 5, @@ -80,7 +77,6 @@ B033.py:13:21: B033 [*] Sets should not contain duplicate item `1` | = help: Remove duplicate item -Suggested fix: 10 10 | "value1", 11 11 | # B033 12 12 | } @@ -103,7 +99,6 @@ B033.py:14:21: B033 [*] Sets should not contain duplicate item `1` | = help: Remove duplicate item -Suggested fix: 11 11 | # B033 12 12 | } 13 13 | incorrect_set = {1, 1} @@ -126,7 +121,6 @@ B033.py:15:24: B033 [*] Sets should not contain duplicate item `1` | = help: Remove duplicate item -Suggested fix: 12 12 | } 13 13 | incorrect_set = {1, 1} 14 14 | incorrect_set = {1, 1,} @@ -149,7 +143,6 @@ B033.py:16:24: B033 [*] Sets should not contain duplicate item `1` | = help: Remove duplicate item -Suggested fix: 13 13 | incorrect_set = {1, 1} 14 14 | incorrect_set = {1, 1,} 15 15 | incorrect_set = {0, 1, 1,} @@ -171,7 +164,6 @@ B033.py:20:5: B033 [*] Sets should not contain duplicate item `1` | = help: Remove duplicate item -Suggested fix: 17 17 | incorrect_set = { 18 18 | 0, 19 19 | 1, diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap index 30df1b919fdcc..b266544baeb3e 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap @@ -11,7 +11,6 @@ B905.py:4:1: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -Suggested fix: 1 1 | from itertools import count, cycle, repeat 2 2 | 3 3 | # Errors @@ -34,7 +33,6 @@ B905.py:5:1: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -Suggested fix: 2 2 | 3 3 | # Errors 4 4 | zip() @@ -57,7 +55,6 @@ B905.py:6:1: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -Suggested fix: 3 3 | # Errors 4 4 | zip() 5 5 | zip(range(3)) @@ -80,7 +77,6 @@ B905.py:7:1: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -Suggested fix: 4 4 | zip() 5 5 | zip(range(3)) 6 6 | zip("a", "b") @@ -103,7 +99,6 @@ B905.py:7:16: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -Suggested fix: 4 4 | zip() 5 5 | zip(range(3)) 6 6 | zip("a", "b") @@ -125,7 +120,6 @@ B905.py:8:5: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -Suggested fix: 5 5 | zip(range(3)) 6 6 | zip("a", "b") 7 7 | zip("a", "b", *zip("c")) @@ -148,7 +142,6 @@ B905.py:9:1: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -Suggested fix: 6 6 | zip("a", "b") 7 7 | zip("a", "b", *zip("c")) 8 8 | zip(zip("a"), strict=False) @@ -169,7 +162,6 @@ B905.py:24:1: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -Suggested fix: 21 21 | zip([1, 2, 3], repeat(1, times=None)) 22 22 | 23 23 | # Errors (limited iterators). @@ -192,7 +184,6 @@ B905.py:25:1: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -Suggested fix: 22 22 | 23 23 | # Errors (limited iterators). 24 24 | zip([1, 2, 3], repeat(1, 1)) @@ -213,7 +204,6 @@ B905.py:29:1: B905 [*] `zip()` without an explicit `strict=` parameter | = help: Add explicit `strict=False` -Suggested fix: 26 26 | 27 27 | import builtins 28 28 | # Still an error even though it uses the qualified name diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap index 147f66027f2dc..64bfc95352a57 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap @@ -9,7 +9,6 @@ B006_extended.py:17:55: B006 [*] Do not use mutable data structures for argument | = help: Replace with `None`; initialize within function -Suggested fix: 14 14 | ... 15 15 | 16 16 | diff --git a/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81.py.snap b/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81.py.snap index 3a3b1563ed631..c459f8a52772b 100644 --- a/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81.py.snap +++ b/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81.py.snap @@ -12,7 +12,6 @@ COM81.py:4:18: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 1 1 | # ==> bad_function_call.py <== 2 2 | bad_function_call( 3 3 | param1='test', @@ -34,7 +33,6 @@ COM81.py:10:6: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 7 7 | bad_list = [ 8 8 | 1, 9 9 | 2, @@ -57,7 +55,6 @@ COM81.py:16:6: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 13 13 | bad_list_with_comment = [ 14 14 | 1, 15 15 | 2, @@ -78,7 +75,6 @@ COM81.py:23:6: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 20 20 | bad_list_with_extra_empty = [ 21 21 | 1, 22 22 | 2, @@ -167,7 +163,6 @@ COM81.py:70:8: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 67 67 | pass 68 68 | 69 69 | {'foo': foo}['foo']( @@ -188,7 +183,6 @@ COM81.py:78:8: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 75 75 | ) 76 76 | 77 77 | (foo)( @@ -209,7 +203,6 @@ COM81.py:86:8: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 83 83 | ) 84 84 | 85 85 | [foo][0]( @@ -231,7 +224,6 @@ COM81.py:152:6: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 149 149 | 150 150 | # ==> keyword_before_parenth_form/base_bad.py <== 151 151 | from x import ( @@ -253,7 +245,6 @@ COM81.py:158:11: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 155 155 | assert( 156 156 | SyntaxWarning, 157 157 | ThrownHere, @@ -276,7 +267,6 @@ COM81.py:293:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 290 290 | 291 291 | # ==> multiline_bad_dict.py <== 292 292 | multiline_bad_dict = { @@ -299,7 +289,6 @@ COM81.py:304:14: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 301 301 | 302 302 | def func_bad( 303 303 | a = 3, @@ -322,7 +311,6 @@ COM81.py:310:14: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 307 307 | 308 308 | # ==> multiline_bad_function_one_param.py <== 309 309 | def func( @@ -343,7 +331,6 @@ COM81.py:316:10: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 313 313 | 314 314 | 315 315 | func( @@ -365,7 +352,6 @@ COM81.py:322:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 319 319 | # ==> multiline_bad_or_dict.py <== 320 320 | multiline_bad_or_dict = { 321 321 | "good": True or False, @@ -387,7 +373,6 @@ COM81.py:368:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 365 365 | 366 366 | multiline_index_access[ 367 367 | "probably fine", @@ -409,7 +394,6 @@ COM81.py:375:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 372 372 | "fine", 373 373 | "fine", 374 374 | : @@ -431,7 +415,6 @@ COM81.py:404:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 401 401 | "fine", 402 402 | "fine" 403 403 | : @@ -453,7 +436,6 @@ COM81.py:432:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 429 429 | "fine" 430 430 | : 431 431 | "fine", @@ -475,7 +457,6 @@ COM81.py:485:21: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -Suggested fix: 482 482 | ) 483 483 | 484 484 | # ==> prohibited.py <== @@ -498,7 +479,6 @@ COM81.py:487:13: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -Suggested fix: 484 484 | # ==> prohibited.py <== 485 485 | foo = ['a', 'b', 'c',] 486 486 | @@ -520,7 +500,6 @@ COM81.py:489:18: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -Suggested fix: 486 486 | 487 487 | bar = { a: b,} 488 488 | @@ -543,7 +522,6 @@ COM81.py:494:6: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -Suggested fix: 491 491 | 492 492 | (0,) 493 493 | @@ -566,7 +544,6 @@ COM81.py:496:21: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -Suggested fix: 493 493 | 494 494 | (0, 1,) 495 495 | @@ -589,7 +566,6 @@ COM81.py:498:13: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -Suggested fix: 495 495 | 496 496 | foo = ['a', 'b', 'c', ] 497 497 | @@ -611,7 +587,6 @@ COM81.py:500:18: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -Suggested fix: 497 497 | 498 498 | bar = { a: b, } 499 499 | @@ -634,7 +609,6 @@ COM81.py:505:6: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -Suggested fix: 502 502 | 503 503 | (0, ) 504 504 | @@ -657,7 +631,6 @@ COM81.py:511:10: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -Suggested fix: 508 508 | 509 509 | image[:,] 510 510 | @@ -680,7 +653,6 @@ COM81.py:513:9: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -Suggested fix: 510 510 | 511 511 | image[:,:,] 512 512 | @@ -703,7 +675,6 @@ COM81.py:519:13: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 516 516 | def function( 517 517 | foo, 518 518 | bar, @@ -726,7 +697,6 @@ COM81.py:526:10: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 523 523 | def function( 524 524 | foo, 525 525 | bar, @@ -749,7 +719,6 @@ COM81.py:534:16: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 531 531 | foo, 532 532 | bar, 533 533 | *args, @@ -771,7 +740,6 @@ COM81.py:541:13: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 538 538 | result = function( 539 539 | foo, 540 540 | bar, @@ -793,7 +761,6 @@ COM81.py:547:24: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 544 544 | result = function( 545 545 | foo, 546 546 | bar, @@ -816,7 +783,6 @@ COM81.py:554:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 551 551 | ham, 552 552 | spam, 553 553 | *args, @@ -837,7 +803,6 @@ COM81.py:561:13: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 558 558 | # In python 3.5 if it's not a function def, commas are mandatory. 559 559 | 560 560 | foo( @@ -858,7 +823,6 @@ COM81.py:565:13: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 562 562 | ) 563 563 | 564 564 | { @@ -879,7 +843,6 @@ COM81.py:569:10: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 566 566 | } 567 567 | 568 568 | { @@ -900,7 +863,6 @@ COM81.py:573:10: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 570 570 | } 571 571 | 572 572 | [ @@ -923,7 +885,6 @@ COM81.py:579:10: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 576 576 | def foo( 577 577 | ham, 578 578 | spam, @@ -946,7 +907,6 @@ COM81.py:586:13: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 583 583 | def foo( 584 584 | ham, 585 585 | spam, @@ -969,7 +929,6 @@ COM81.py:594:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 591 591 | ham, 592 592 | spam, 593 593 | *args, @@ -991,7 +950,6 @@ COM81.py:623:20: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 620 620 | result = function( 621 621 | foo, 622 622 | bar, @@ -1013,7 +971,6 @@ COM81.py:628:42: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 625 625 | 626 626 | # Make sure the COM812 and UP034 rules don't fix simultaneously and cause a syntax error. 627 627 | the_first_one = next( @@ -1035,7 +992,6 @@ COM81.py:640:46: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -Suggested fix: 637 637 | ) 638 638 | 639 639 | # F-strings @@ -1056,7 +1012,6 @@ COM81.py:643:49: COM812 [*] Trailing comma missing | = help: Add trailing comma -Suggested fix: 640 640 | kwargs.pop("remove", f"this {trailing_comma}",) 641 641 | 642 642 | raise Exception( diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap index e72c94e4be5bd..e4f87ae1f34c1 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap @@ -11,7 +11,6 @@ C400.py:2:13: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | = help: Rewrite as a `list` comprehension -Suggested fix: 1 1 | # Cannot combine with C416. Should use list comprehension here. 2 |-even_nums = list(2 * x for x in range(3)) 2 |+even_nums = [2 * x for x in range(3)] @@ -33,7 +32,6 @@ C400.py:3:12: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | = help: Rewrite as a `list` comprehension -Suggested fix: 1 1 | # Cannot combine with C416. Should use list comprehension here. 2 2 | even_nums = list(2 * x for x in range(3)) 3 |-odd_nums = list( @@ -57,7 +55,6 @@ C400.py:9:5: C400 [*] Unnecessary generator (rewrite using `list()`) | = help: Rewrite using `list()` -Suggested fix: 6 6 | 7 7 | 8 8 | # Short-circuit case, combine with C416 and should produce x = list(range(3)) @@ -83,7 +80,6 @@ C400.py:10:5: C400 [*] Unnecessary generator (rewrite using `list()`) | = help: Rewrite using `list()` -Suggested fix: 7 7 | 8 8 | # Short-circuit case, combine with C416 and should produce x = list(range(3)) 9 9 | x = list(x for x in range(3)) @@ -107,7 +103,6 @@ C400.py:15:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | = help: Rewrite as a `list` comprehension -Suggested fix: 12 12 | ) 13 13 | 14 14 | # Strip parentheses from inner generators. @@ -129,7 +124,6 @@ C400.py:16:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | = help: Rewrite as a `list` comprehension -Suggested fix: 13 13 | 14 14 | # Strip parentheses from inner generators. 15 15 | list((2 * x for x in range(3))) @@ -152,7 +146,6 @@ C400.py:17:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | = help: Rewrite as a `list` comprehension -Suggested fix: 14 14 | # Strip parentheses from inner generators. 15 15 | list((2 * x for x in range(3))) 16 16 | list(((2 * x for x in range(3)))) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap index 0ac41a3167dc4..9cd8caeb0168c 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap @@ -11,7 +11,6 @@ C401.py:2:13: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -Suggested fix: 1 1 | # Cannot conbime with C416. Should use set comprehension here. 2 |-even_nums = set(2 * x for x in range(3)) 2 |+even_nums = {2 * x for x in range(3)} @@ -34,7 +33,6 @@ C401.py:3:12: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -Suggested fix: 1 1 | # Cannot conbime with C416. Should use set comprehension here. 2 2 | even_nums = set(2 * x for x in range(3)) 3 |-odd_nums = set( @@ -59,7 +57,6 @@ C401.py:6:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -Suggested fix: 3 3 | odd_nums = set( 4 4 | 2 * x + 1 for x in range(3) 5 5 | ) @@ -81,7 +78,6 @@ C401.py:11:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -Suggested fix: 8 8 | def f(x): 9 9 | return x 10 10 | @@ -101,7 +97,6 @@ C401.py:12:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -Suggested fix: 9 9 | return x 10 10 | 11 11 | print(f"Hello {set(f(a) for a in 'abc')} World") @@ -123,7 +118,6 @@ C401.py:16:5: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -Suggested fix: 13 13 | 14 14 | 15 15 | # Short-circuit case, combine with C416 and should produce x = set(range(3)) @@ -149,7 +143,6 @@ C401.py:17:5: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -Suggested fix: 14 14 | 15 15 | # Short-circuit case, combine with C416 and should produce x = set(range(3)) 16 16 | x = set(x for x in range(3)) @@ -174,7 +167,6 @@ C401.py:20:16: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -Suggested fix: 17 17 | x = set( 18 18 | x for x in range(3) 19 19 | ) @@ -196,7 +188,6 @@ C401.py:21:10: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -Suggested fix: 18 18 | x for x in range(3) 19 19 | ) 20 20 | print(f"Hello {set(a for a in range(3))} World") @@ -218,7 +209,6 @@ C401.py:21:34: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -Suggested fix: 18 18 | x for x in range(3) 19 19 | ) 20 20 | print(f"Hello {set(a for a in range(3))} World") @@ -239,7 +229,6 @@ C401.py:22:11: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -Suggested fix: 19 19 | ) 20 20 | print(f"Hello {set(a for a in range(3))} World") 21 21 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") @@ -260,7 +249,6 @@ C401.py:22:35: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -Suggested fix: 19 19 | ) 20 20 | print(f"Hello {set(a for a in range(3))} World") 21 21 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap index 14236e2a69ab2..2ccb48841de2b 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap @@ -10,7 +10,6 @@ C402.py:1:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -Suggested fix: 1 |-dict((x, x) for x in range(3)) 1 |+{x: x for x in range(3)} 2 2 | dict( @@ -31,7 +30,6 @@ C402.py:2:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -Suggested fix: 1 1 | dict((x, x) for x in range(3)) 2 |-dict( 3 |- (x, x) for x in range(3) @@ -56,7 +54,6 @@ C402.py:6:8: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -Suggested fix: 3 3 | (x, x) for x in range(3) 4 4 | ) 5 5 | dict(((x, x) for x in range(3)), z=3) @@ -79,7 +76,6 @@ C402.py:7:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -Suggested fix: 4 4 | ) 5 5 | dict(((x, x) for x in range(3)), z=3) 6 6 | y = f'{dict((x, x) for x in range(3))}' @@ -102,7 +98,6 @@ C402.py:8:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -Suggested fix: 5 5 | dict(((x, x) for x in range(3)), z=3) 6 6 | y = f'{dict((x, x) for x in range(3))}' 7 7 | print(f'Hello {dict((x, x) for x in range(3))} World') @@ -124,7 +119,6 @@ C402.py:9:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -Suggested fix: 6 6 | y = f'{dict((x, x) for x in range(3))}' 7 7 | print(f'Hello {dict((x, x) for x in range(3))} World') 8 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") @@ -147,7 +141,6 @@ C402.py:10:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension | = help: Rewrite as a `dict` comprehension -Suggested fix: 7 7 | print(f'Hello {dict((x, x) for x in range(3))} World') 8 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") 9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') @@ -169,7 +162,6 @@ C402.py:12:4: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -Suggested fix: 9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') 10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 11 | @@ -191,7 +183,6 @@ C402.py:12:37: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension | = help: Rewrite as a `dict` comprehension -Suggested fix: 9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') 10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 11 | @@ -213,7 +204,6 @@ C402.py:13:5: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -Suggested fix: 10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 11 | 12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' @@ -235,7 +225,6 @@ C402.py:13:38: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension | = help: Rewrite as a `dict` comprehension -Suggested fix: 10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 11 | 12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' @@ -258,7 +247,6 @@ C402.py:18:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension | = help: Rewrite as a `dict` comprehension -Suggested fix: 15 15 | def f(x): 16 16 | return x 17 17 | @@ -280,7 +268,6 @@ C402.py:21:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -Suggested fix: 18 18 | print(f'Hello {dict((x,f(x)) for x in "abc")} World') 19 19 | 20 20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086 diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap index d16e1dfd1daa4..278ca19df7ffe 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap @@ -10,7 +10,6 @@ C403.py:1:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr | = help: Rewrite as a `set` comprehension -Suggested fix: 1 |-s = set([x for x in range(3)]) 1 |+s = {x for x in range(3)} 2 2 | s = set( @@ -32,7 +31,6 @@ C403.py:2:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr | = help: Rewrite as a `set` comprehension -Suggested fix: 1 1 | s = set([x for x in range(3)]) 2 |-s = set( 3 |- [x for x in range(3)] @@ -56,7 +54,6 @@ C403.py:6:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr | = help: Rewrite as a `set` comprehension -Suggested fix: 3 3 | [x for x in range(3)] 4 4 | ) 5 5 | @@ -78,7 +75,6 @@ C403.py:7:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr | = help: Rewrite as a `set` comprehension -Suggested fix: 4 4 | ) 5 5 | 6 6 | s = f"{set([x for x in 'ab'])}" @@ -101,7 +97,6 @@ C403.py:12:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | = help: Rewrite as a `set` comprehension -Suggested fix: 9 9 | def f(x): 10 10 | return x 11 11 | @@ -123,7 +118,6 @@ C403.py:14:9: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | = help: Rewrite as a `set` comprehension -Suggested fix: 11 11 | 12 12 | s = f"{set([f(x) for x in 'ab'])}" 13 13 | @@ -145,7 +139,6 @@ C403.py:14:34: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` com | = help: Rewrite as a `set` comprehension -Suggested fix: 11 11 | 12 12 | s = f"{set([f(x) for x in 'ab'])}" 13 13 | @@ -167,7 +160,6 @@ C403.py:15:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | = help: Rewrite as a `set` comprehension -Suggested fix: 12 12 | s = f"{set([f(x) for x in 'ab'])}" 13 13 | 14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" @@ -189,7 +181,6 @@ C403.py:15:33: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` com | = help: Rewrite as a `set` comprehension -Suggested fix: 12 12 | s = f"{set([f(x) for x in 'ab'])}" 13 13 | 14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" @@ -215,7 +206,6 @@ C403.py:17:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | = help: Rewrite as a `set` comprehension -Suggested fix: 14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" 15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" 16 16 | @@ -243,7 +233,6 @@ C403.py:21:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | = help: Rewrite as a `set` comprehension -Suggested fix: 18 18 | [x for x in range(3)] 19 19 | ) 20 20 | diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap index cffe8558e7eac..a724d69479164 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap @@ -9,7 +9,6 @@ C404.py:1:1: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp | = help: Rewrite as a `dict` comprehension -Suggested fix: 1 |-dict([(i, i) for i in range(3)]) 1 |+{i: i for i in range(3)} 2 2 | dict([(i, i) for i in range(3)], z=4) @@ -29,7 +28,6 @@ C404.py:7:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp | = help: Rewrite as a `dict` comprehension -Suggested fix: 4 4 | def f(x): 5 5 | return x 6 6 | @@ -51,7 +49,6 @@ C404.py:8:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp | = help: Rewrite as a `dict` comprehension -Suggested fix: 5 5 | return x 6 6 | 7 7 | f'{dict([(s,s) for s in "ab"])}' @@ -73,7 +70,6 @@ C404.py:9:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp | = help: Rewrite as a `dict` comprehension -Suggested fix: 6 6 | 7 7 | f'{dict([(s,s) for s in "ab"])}' 8 8 | f"{dict([(s,s) for s in 'ab'])}" @@ -96,7 +92,6 @@ C404.py:10:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com | = help: Rewrite as a `dict` comprehension -Suggested fix: 7 7 | f'{dict([(s,s) for s in "ab"])}' 8 8 | f"{dict([(s,s) for s in 'ab'])}" 9 9 | f"{dict([(s, s) for s in 'ab'])}" @@ -118,7 +113,6 @@ C404.py:12:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com | = help: Rewrite as a `dict` comprehension -Suggested fix: 9 9 | f"{dict([(s, s) for s in 'ab'])}" 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 11 | @@ -140,7 +134,6 @@ C404.py:12:34: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co | = help: Rewrite as a `dict` comprehension -Suggested fix: 9 9 | f"{dict([(s, s) for s in 'ab'])}" 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 11 | @@ -162,7 +155,6 @@ C404.py:13:5: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com | = help: Rewrite as a `dict` comprehension -Suggested fix: 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 11 | 12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' @@ -184,7 +176,6 @@ C404.py:13:35: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co | = help: Rewrite as a `dict` comprehension -Suggested fix: 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 11 | 12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' @@ -204,7 +195,6 @@ C404.py:16:14: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co | = help: Rewrite as a `dict` comprehension -Suggested fix: 13 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' 14 14 | 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap index cd99e16e1a412..2d04098d2bccd 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap @@ -10,7 +10,6 @@ C405.py:1:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 1 |-set([1, 2]) 1 |+{1, 2} 2 2 | set((1, 2)) @@ -29,7 +28,6 @@ C405.py:2:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 1 1 | set([1, 2]) 2 |-set((1, 2)) 2 |+{1, 2} @@ -50,7 +48,6 @@ C405.py:3:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 1 1 | set([1, 2]) 2 2 | set((1, 2)) 3 |-set([]) @@ -72,7 +69,6 @@ C405.py:4:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 1 1 | set([1, 2]) 2 2 | set((1, 2)) 3 3 | set([]) @@ -96,7 +92,6 @@ C405.py:6:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 3 3 | set([]) 4 4 | set(()) 5 5 | set() @@ -121,7 +116,6 @@ C405.py:7:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 4 4 | set(()) 5 5 | set() 6 6 | set((1,)) @@ -149,7 +143,6 @@ C405.py:10:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 7 7 | set(( 8 8 | 1, 9 9 | )) @@ -177,7 +170,6 @@ C405.py:13:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 10 10 | set([ 11 11 | 1, 12 12 | ]) @@ -204,7 +196,6 @@ C405.py:16:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 13 13 | set( 14 14 | (1,) 15 15 | ) @@ -229,7 +220,6 @@ C405.py:19:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 16 16 | set( 17 17 | [1,] 18 18 | ) @@ -251,7 +241,6 @@ C405.py:20:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 17 17 | [1,] 18 18 | ) 19 19 | f"{set([1,2,3])}" @@ -274,7 +263,6 @@ C405.py:21:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 18 18 | ) 19 19 | f"{set([1,2,3])}" 20 20 | f"{set(['a', 'b'])}" @@ -297,7 +285,6 @@ C405.py:23:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 20 20 | f"{set(['a', 'b'])}" 21 21 | f'{set(["a", "b"])}' 22 22 | @@ -320,7 +307,6 @@ C405.py:23:22: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 20 20 | f"{set(['a', 'b'])}" 21 21 | f'{set(["a", "b"])}' 22 22 | @@ -342,7 +328,6 @@ C405.py:24:5: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 21 21 | f'{set(["a", "b"])}' 22 22 | 23 23 | f"{set(['a', 'b']) - set(['a'])}" @@ -363,7 +348,6 @@ C405.py:24:23: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 21 21 | f'{set(["a", "b"])}' 22 22 | 23 23 | f"{set(['a', 'b']) - set(['a'])}" @@ -384,7 +368,6 @@ C405.py:25:6: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 22 22 | 23 23 | f"{set(['a', 'b']) - set(['a'])}" 24 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -404,7 +387,6 @@ C405.py:25:24: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 22 22 | 23 23 | f"{set(['a', 'b']) - set(['a'])}" 24 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -423,7 +405,6 @@ C405.py:26:7: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 23 23 | f"{set(['a', 'b']) - set(['a'])}" 24 24 | f"{ set(['a', 'b']) - set(['a']) }" 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" @@ -441,7 +422,6 @@ C405.py:26:25: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -Suggested fix: 23 23 | f"{set(['a', 'b']) - set(['a'])}" 24 24 | f"{ set(['a', 'b']) - set(['a']) }" 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap index d2a8de7a4a578..de5a2c649d433 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap @@ -10,7 +10,6 @@ C406.py:1:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal) | = help: Rewrite as a `dict` literal -Suggested fix: 1 |-d1 = dict([(1, 2)]) 1 |+d1 = {1: 2} 2 2 | d2 = dict(((1, 2),)) @@ -29,7 +28,6 @@ C406.py:2:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) | = help: Rewrite as a `dict` literal -Suggested fix: 1 1 | d1 = dict([(1, 2)]) 2 |-d2 = dict(((1, 2),)) 2 |+d2 = {1: 2,} @@ -50,7 +48,6 @@ C406.py:3:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal) | = help: Rewrite as a `dict` literal -Suggested fix: 1 1 | d1 = dict([(1, 2)]) 2 2 | d2 = dict(((1, 2),)) 3 |-d3 = dict([]) @@ -70,7 +67,6 @@ C406.py:4:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) | = help: Rewrite as a `dict` literal -Suggested fix: 1 1 | d1 = dict([(1, 2)]) 2 2 | d2 = dict(((1, 2),)) 3 3 | d3 = dict([]) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap index c035876cc2687..5cbb164a89a0e 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap @@ -10,7 +10,6 @@ C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 1 |-t = tuple() 1 |+t = () 2 2 | l = list() @@ -29,7 +28,6 @@ C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 1 1 | t = tuple() 2 |-l = list() 2 |+l = [] @@ -50,7 +48,6 @@ C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 1 1 | t = tuple() 2 2 | l = list() 3 |-d1 = dict() @@ -71,7 +68,6 @@ C408.py:4:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 1 1 | t = tuple() 2 2 | l = list() 3 3 | d1 = dict() @@ -94,7 +90,6 @@ C408.py:14:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 11 11 | 12 12 | a = list() 13 13 | @@ -116,7 +111,6 @@ C408.py:15:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 12 12 | a = list() 13 13 | 14 14 | f"{dict(x='y')}" @@ -138,7 +132,6 @@ C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 13 13 | 14 14 | f"{dict(x='y')}" 15 15 | f'{dict(x="y")}' @@ -161,7 +154,6 @@ C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 14 14 | f"{dict(x='y')}" 15 15 | f'{dict(x="y")}' 16 16 | f"{dict()}" @@ -184,7 +176,6 @@ C408.py:19:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 16 16 | f"{dict()}" 17 17 | f"a {dict()} b" 18 18 | @@ -207,7 +198,6 @@ C408.py:19:18: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 16 16 | f"{dict()}" 17 17 | f"a {dict()} b" 18 18 | @@ -229,7 +219,6 @@ C408.py:20:5: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 17 17 | f"a {dict()} b" 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" @@ -251,7 +240,6 @@ C408.py:20:19: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 17 17 | f"a {dict()} b" 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" @@ -273,7 +261,6 @@ C408.py:21:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" 20 20 | f"{ dict(x='y') | dict(y='z') }" @@ -295,7 +282,6 @@ C408.py:21:20: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" 20 20 | f"{ dict(x='y') | dict(y='z') }" @@ -318,7 +304,6 @@ C408.py:22:7: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 19 19 | f"{dict(x='y') | dict(y='z')}" 20 20 | f"{ dict(x='y') | dict(y='z') }" 21 21 | f"a {dict(x='y') | dict(y='z')} b" @@ -341,7 +326,6 @@ C408.py:22:21: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 19 19 | f"{dict(x='y') | dict(y='z')}" 20 20 | f"{ dict(x='y') | dict(y='z') }" 21 21 | f"a {dict(x='y') | dict(y='z')} b" @@ -366,7 +350,6 @@ C408.py:24:1: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 21 21 | f"a {dict(x='y') | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" 23 23 | @@ -391,7 +374,6 @@ C408.py:28:1: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 25 25 | # comment 26 26 | ) 27 27 | diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap index 5fa0a099b439c..2e1cf30d4ecdd 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap @@ -10,7 +10,6 @@ C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 1 |-t = tuple() 1 |+t = () 2 2 | l = list() @@ -29,7 +28,6 @@ C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 1 1 | t = tuple() 2 |-l = list() 2 |+l = [] @@ -50,7 +48,6 @@ C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 1 1 | t = tuple() 2 2 | l = list() 3 |-d1 = dict() @@ -71,7 +68,6 @@ C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 13 13 | 14 14 | f"{dict(x='y')}" 15 15 | f'{dict(x="y")}' @@ -94,7 +90,6 @@ C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 14 14 | f"{dict(x='y')}" 15 15 | f'{dict(x="y")}' 16 16 | f"{dict()}" @@ -119,7 +114,6 @@ C408.py:24:1: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 21 21 | f"a {dict(x='y') | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" 23 23 | @@ -144,7 +138,6 @@ C408.py:28:1: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | = help: Rewrite as a literal -Suggested fix: 25 25 | # comment 26 26 | ) 27 27 | diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap index 8483a397be61e..f27d960576ad6 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap @@ -10,7 +10,6 @@ C409.py:1:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as | = help: Rewrite as a `tuple` literal -Suggested fix: 1 |-t1 = tuple([]) 1 |+t1 = () 2 2 | t2 = tuple([1, 2]) @@ -29,7 +28,6 @@ C409.py:2:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as | = help: Rewrite as a `tuple` literal -Suggested fix: 1 1 | t1 = tuple([]) 2 |-t2 = tuple([1, 2]) 2 |+t2 = (1, 2) @@ -50,7 +48,6 @@ C409.py:3:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th | = help: Remove outer `tuple` call -Suggested fix: 1 1 | t1 = tuple([]) 2 2 | t2 = tuple([1, 2]) 3 |-t3 = tuple((1, 2)) @@ -76,7 +73,6 @@ C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as | = help: Rewrite as a `tuple` literal -Suggested fix: 1 1 | t1 = tuple([]) 2 2 | t2 = tuple([1, 2]) 3 3 | t3 = tuple((1, 2)) @@ -106,7 +102,6 @@ C409.py:8:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th | = help: Remove outer `tuple` call -Suggested fix: 5 5 | 1, 6 6 | 2 7 7 | ]) @@ -133,7 +128,6 @@ C409.py:12:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a | = help: Rewrite as a `tuple` literal -Suggested fix: 9 9 | (1, 2) 10 10 | ) 11 11 | @@ -160,7 +154,6 @@ C409.py:16:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a | = help: Rewrite as a `tuple` literal -Suggested fix: 13 13 | [1, 2] 14 14 | ) 15 15 | @@ -188,7 +181,6 @@ C409.py:20:1: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove t | = help: Remove outer `tuple` call -Suggested fix: 17 17 | 1, 2 18 18 | ]) 19 19 | @@ -214,7 +206,6 @@ C409.py:24:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a | = help: Rewrite as a `tuple` literal -Suggested fix: 21 21 | 1, 22 22 | )) 23 23 | @@ -234,7 +225,6 @@ C409.py:25:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove t | = help: Remove outer `tuple` call -Suggested fix: 22 22 | )) 23 23 | 24 24 | t6 = tuple([1]) @@ -253,7 +243,6 @@ C409.py:26:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a | = help: Rewrite as a `tuple` literal -Suggested fix: 23 23 | 24 24 | t6 = tuple([1]) 25 25 | t7 = tuple((1,)) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap index 0405f732193c6..b8c7486b1f590 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap @@ -10,7 +10,6 @@ C410.py:1:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the | = help: Remove outer `list` call -Suggested fix: 1 |-l1 = list([1, 2]) 1 |+l1 = [1, 2] 2 2 | l2 = list((1, 2)) @@ -29,7 +28,6 @@ C410.py:2:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as | = help: Rewrite as a `list` literal -Suggested fix: 1 1 | l1 = list([1, 2]) 2 |-l2 = list((1, 2)) 2 |+l2 = [1, 2] @@ -49,7 +47,6 @@ C410.py:3:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the | = help: Remove outer `list` call -Suggested fix: 1 1 | l1 = list([1, 2]) 2 2 | l2 = list((1, 2)) 3 |-l3 = list([]) @@ -69,7 +66,6 @@ C410.py:4:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as | = help: Rewrite as a `list` literal -Suggested fix: 1 1 | l1 = list([1, 2]) 2 2 | l2 = list((1, 2)) 3 3 | l3 = list([]) @@ -92,7 +88,6 @@ C410.py:7:1: C410 [*] Unnecessary `list` literal passed to `list()` (remove the | = help: Remove outer `list` call -Suggested fix: 4 4 | l4 = list(()) 5 5 | 6 6 | @@ -117,7 +112,6 @@ C410.py:11:1: C410 [*] Unnecessary `list` literal passed to `list()` (remove the | = help: Remove outer `list` call -Suggested fix: 8 8 | [1, 2] 9 9 | ) 10 10 | diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap index ce35b4c9f08ac..741ac73479fa4 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap @@ -9,7 +9,6 @@ C411.py:2:1: C411 [*] Unnecessary `list` call (remove the outer call to `list()` | = help: Remove outer `list` call -Suggested fix: 1 1 | x = [1, 2, 3] 2 |-list([i for i in x]) 2 |+[i for i in x] diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap index cd47b5229e10e..461fc8a7d7f6d 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap @@ -12,7 +12,6 @@ C413.py:3:1: C413 [*] Unnecessary `list` call around `sorted()` | = help: Remove unnecessary `list` call -Suggested fix: 1 1 | x = [2, 3, 1] 2 2 | list(x) 3 |-list(sorted(x)) @@ -34,7 +33,6 @@ C413.py:4:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -Suggested fix: 1 1 | x = [2, 3, 1] 2 2 | list(x) 3 3 | list(sorted(x)) @@ -57,7 +55,6 @@ C413.py:5:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -Suggested fix: 2 2 | list(x) 3 3 | list(sorted(x)) 4 4 | reversed(sorted(x)) @@ -80,7 +77,6 @@ C413.py:6:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -Suggested fix: 3 3 | list(sorted(x)) 4 4 | reversed(sorted(x)) 5 5 | reversed(sorted(x, key=lambda e: e)) @@ -103,7 +99,6 @@ C413.py:7:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -Suggested fix: 4 4 | reversed(sorted(x)) 5 5 | reversed(sorted(x, key=lambda e: e)) 6 6 | reversed(sorted(x, reverse=True)) @@ -126,7 +121,6 @@ C413.py:8:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -Suggested fix: 5 5 | reversed(sorted(x, key=lambda e: e)) 6 6 | reversed(sorted(x, reverse=True)) 7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) @@ -149,7 +143,6 @@ C413.py:9:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -Suggested fix: 6 6 | reversed(sorted(x, reverse=True)) 7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) 8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) @@ -171,7 +164,6 @@ C413.py:10:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -Suggested fix: 7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) 8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) 9 9 | reversed(sorted(x, reverse=False)) @@ -194,7 +186,6 @@ C413.py:11:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -Suggested fix: 8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) 9 9 | reversed(sorted(x, reverse=False)) 10 10 | reversed(sorted(x, reverse=x)) @@ -215,7 +206,6 @@ C413.py:14:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -Suggested fix: 11 11 | reversed(sorted(x, reverse=not x)) 12 12 | 13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 @@ -238,7 +228,6 @@ C413.py:15:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -Suggested fix: 12 12 | 13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 14 14 | reversed(sorted(i for i in range(42))) @@ -259,7 +248,6 @@ C413.py:18:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -Suggested fix: 15 15 | reversed(sorted((i for i in range(42)), reverse=True)) 16 16 | 17 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335 @@ -278,7 +266,6 @@ C413.py:19:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -Suggested fix: 16 16 | 17 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335 18 18 | reversed(sorted([1, 2, 3], reverse=False or True)) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap index db3d510c9b599..173e79eaafa3a 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap @@ -11,7 +11,6 @@ C414.py:2:1: C414 [*] Unnecessary `list` call within `list()` | = help: Remove the inner `list` call -Suggested fix: 1 1 | x = [1, 2, 3] 2 |-list(list(x)) 2 |+list(x) @@ -32,7 +31,6 @@ C414.py:3:1: C414 [*] Unnecessary `tuple` call within `list()` | = help: Remove the inner `tuple` call -Suggested fix: 1 1 | x = [1, 2, 3] 2 2 | list(list(x)) 3 |-list(tuple(x)) @@ -54,7 +52,6 @@ C414.py:4:1: C414 [*] Unnecessary `list` call within `tuple()` | = help: Remove the inner `list` call -Suggested fix: 1 1 | x = [1, 2, 3] 2 2 | list(list(x)) 3 3 | list(tuple(x)) @@ -77,7 +74,6 @@ C414.py:5:1: C414 [*] Unnecessary `tuple` call within `tuple()` | = help: Remove the inner `tuple` call -Suggested fix: 2 2 | list(list(x)) 3 3 | list(tuple(x)) 4 4 | tuple(list(x)) @@ -100,7 +96,6 @@ C414.py:6:1: C414 [*] Unnecessary `set` call within `set()` | = help: Remove the inner `set` call -Suggested fix: 3 3 | list(tuple(x)) 4 4 | tuple(list(x)) 5 5 | tuple(tuple(x)) @@ -123,7 +118,6 @@ C414.py:7:1: C414 [*] Unnecessary `list` call within `set()` | = help: Remove the inner `list` call -Suggested fix: 4 4 | tuple(list(x)) 5 5 | tuple(tuple(x)) 6 6 | set(set(x)) @@ -146,7 +140,6 @@ C414.py:8:1: C414 [*] Unnecessary `tuple` call within `set()` | = help: Remove the inner `tuple` call -Suggested fix: 5 5 | tuple(tuple(x)) 6 6 | set(set(x)) 7 7 | set(list(x)) @@ -169,7 +162,6 @@ C414.py:9:1: C414 [*] Unnecessary `sorted` call within `set()` | = help: Remove the inner `sorted` call -Suggested fix: 6 6 | set(set(x)) 7 7 | set(list(x)) 8 8 | set(tuple(x)) @@ -192,7 +184,6 @@ C414.py:10:1: C414 [*] Unnecessary `sorted` call within `set()` | = help: Remove the inner `sorted` call -Suggested fix: 7 7 | set(list(x)) 8 8 | set(tuple(x)) 9 9 | set(sorted(x)) @@ -215,7 +206,6 @@ C414.py:11:1: C414 [*] Unnecessary `reversed` call within `set()` | = help: Remove the inner `reversed` call -Suggested fix: 8 8 | set(tuple(x)) 9 9 | set(sorted(x)) 10 10 | set(sorted(x, key=lambda y: y)) @@ -238,7 +228,6 @@ C414.py:12:1: C414 [*] Unnecessary `list` call within `sorted()` | = help: Remove the inner `list` call -Suggested fix: 9 9 | set(sorted(x)) 10 10 | set(sorted(x, key=lambda y: y)) 11 11 | set(reversed(x)) @@ -261,7 +250,6 @@ C414.py:13:1: C414 [*] Unnecessary `tuple` call within `sorted()` | = help: Remove the inner `tuple` call -Suggested fix: 10 10 | set(sorted(x, key=lambda y: y)) 11 11 | set(reversed(x)) 12 12 | sorted(list(x)) @@ -284,7 +272,6 @@ C414.py:14:1: C414 [*] Unnecessary `sorted` call within `sorted()` | = help: Remove the inner `sorted` call -Suggested fix: 11 11 | set(reversed(x)) 12 12 | sorted(list(x)) 13 13 | sorted(tuple(x)) @@ -307,7 +294,6 @@ C414.py:15:1: C414 [*] Unnecessary `sorted` call within `sorted()` | = help: Remove the inner `sorted` call -Suggested fix: 12 12 | sorted(list(x)) 13 13 | sorted(tuple(x)) 14 14 | sorted(sorted(x)) @@ -330,7 +316,6 @@ C414.py:16:1: C414 [*] Unnecessary `sorted` call within `sorted()` | = help: Remove the inner `sorted` call -Suggested fix: 13 13 | sorted(tuple(x)) 14 14 | sorted(sorted(x)) 15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) @@ -353,7 +338,6 @@ C414.py:17:1: C414 [*] Unnecessary `reversed` call within `sorted()` | = help: Remove the inner `reversed` call -Suggested fix: 14 14 | sorted(sorted(x)) 15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) 16 16 | sorted(sorted(x, reverse=True), reverse=True) @@ -376,7 +360,6 @@ C414.py:18:1: C414 [*] Unnecessary `list` call within `sorted()` | = help: Remove the inner `list` call -Suggested fix: 15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) 16 16 | sorted(sorted(x, reverse=True), reverse=True) 17 17 | sorted(reversed(x)) @@ -404,7 +387,6 @@ C414.py:19:1: C414 [*] Unnecessary `list` call within `tuple()` | = help: Remove the inner `list` call -Suggested fix: 17 17 | sorted(reversed(x)) 18 18 | sorted(list(x), key=lambda y: y) 19 19 | tuple( @@ -430,7 +412,6 @@ C414.py:25:1: C414 [*] Unnecessary `set` call within `set()` | = help: Remove the inner `set` call -Suggested fix: 22 22 | "o"] 23 23 | ) 24 24 | ) @@ -453,7 +434,6 @@ C414.py:26:1: C414 [*] Unnecessary `list` call within `set()` | = help: Remove the inner `list` call -Suggested fix: 23 23 | ) 24 24 | ) 25 25 | set(set()) @@ -475,7 +455,6 @@ C414.py:27:1: C414 [*] Unnecessary `tuple` call within `set()` | = help: Remove the inner `tuple` call -Suggested fix: 24 24 | ) 25 25 | set(set()) 26 26 | set(list()) @@ -498,7 +477,6 @@ C414.py:28:1: C414 [*] Unnecessary `reversed` call within `sorted()` | = help: Remove the inner `reversed` call -Suggested fix: 25 25 | set(set()) 26 26 | set(list()) 27 27 | set(tuple()) @@ -526,7 +504,6 @@ C414.py:37:27: C414 [*] Unnecessary `list` call within `sorted()` | = help: Remove the inner `list` call -Suggested fix: 35 35 | 36 36 | # Preserve trailing comments. 37 37 | xxxxxxxxxxx_xxxxx_xxxxx = sorted( @@ -551,7 +528,6 @@ C414.py:44:27: C414 [*] Unnecessary `list` call within `sorted()` | = help: Remove the inner `list` call -Suggested fix: 42 42 | ) 43 43 | 44 44 | xxxxxxxxxxx_xxxxx_xxxxx = sorted( diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap index b0dda28d134f4..bc4dc070e8258 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap @@ -12,7 +12,6 @@ C416.py:6:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) | = help: Rewrite using `list()` -Suggested fix: 3 3 | z = [(1,), (2,), (3,)] 4 4 | d = {"a": 1, "b": 2, "c": 3} 5 5 | @@ -34,7 +33,6 @@ C416.py:7:1: C416 [*] Unnecessary `set` comprehension (rewrite using `set()`) | = help: Rewrite using `set()` -Suggested fix: 4 4 | d = {"a": 1, "b": 2, "c": 3} 5 5 | 6 6 | [i for i in x] @@ -57,7 +55,6 @@ C416.py:8:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | = help: Rewrite using `dict()` -Suggested fix: 5 5 | 6 6 | [i for i in x] 7 7 | {i for i in x} @@ -80,7 +77,6 @@ C416.py:9:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | = help: Rewrite using `dict()` -Suggested fix: 6 6 | [i for i in x] 7 7 | {i for i in x} 8 8 | {k: v for k, v in y} @@ -102,7 +98,6 @@ C416.py:10:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) | = help: Rewrite using `list()` -Suggested fix: 7 7 | {i for i in x} 8 8 | {k: v for k, v in y} 9 9 | {k: v for k, v in d.items()} @@ -125,7 +120,6 @@ C416.py:11:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | = help: Rewrite using `dict()` -Suggested fix: 8 8 | {k: v for k, v in y} 9 9 | {k: v for k, v in d.items()} 10 10 | [(k, v) for k, v in d.items()] @@ -145,7 +139,6 @@ C416.py:24:70: C416 [*] Unnecessary `list` comprehension (rewrite using `list()` | = help: Rewrite using `list()` -Suggested fix: 21 21 | {k: v if v else None for k, v in y} 22 22 | 23 23 | # Regression test for: https://github.com/astral-sh/ruff/issues/7196 diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap index be27f679990fc..33c7badf00fff 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap @@ -12,7 +12,6 @@ C417.py:3:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express | = help: Replace `map` with a generator expression -Suggested fix: 1 1 | # Errors. 2 2 | nums = [1, 2, 3] 3 |-map(lambda x: x + 1, nums) @@ -34,7 +33,6 @@ C417.py:4:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express | = help: Replace `map` with a generator expression -Suggested fix: 1 1 | # Errors. 2 2 | nums = [1, 2, 3] 3 3 | map(lambda x: x + 1, nums) @@ -57,7 +55,6 @@ C417.py:5:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehens | = help: Replace `map` with a `list` comprehension -Suggested fix: 2 2 | nums = [1, 2, 3] 3 3 | map(lambda x: x + 1, nums) 4 4 | map(lambda x: str(x), nums) @@ -80,7 +77,6 @@ C417.py:6:1: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehensi | = help: Replace `map` with a `set` comprehension -Suggested fix: 3 3 | map(lambda x: x + 1, nums) 4 4 | map(lambda x: str(x), nums) 5 5 | list(map(lambda x: x * 2, nums)) @@ -103,7 +99,6 @@ C417.py:7:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehens | = help: Replace `map` with a `dict` comprehension -Suggested fix: 4 4 | map(lambda x: str(x), nums) 5 5 | list(map(lambda x: x * 2, nums)) 6 6 | set(map(lambda x: x % 2 == 0, nums)) @@ -126,7 +121,6 @@ C417.py:8:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehens | = help: Replace `map` with a `dict` comprehension -Suggested fix: 5 5 | list(map(lambda x: x * 2, nums)) 6 6 | set(map(lambda x: x % 2 == 0, nums)) 7 7 | dict(map(lambda v: (v, v**2), nums)) @@ -149,7 +143,6 @@ C417.py:9:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express | = help: Replace `map` with a generator expression -Suggested fix: 6 6 | set(map(lambda x: x % 2 == 0, nums)) 7 7 | dict(map(lambda v: (v, v**2), nums)) 8 8 | dict(map(lambda v: [v, v**2], nums)) @@ -172,7 +165,6 @@ C417.py:10:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -Suggested fix: 7 7 | dict(map(lambda v: (v, v**2), nums)) 8 8 | dict(map(lambda v: [v, v**2], nums)) 9 9 | map(lambda: "const", nums) @@ -195,7 +187,6 @@ C417.py:11:13: C417 [*] Unnecessary `map` usage (rewrite using a generator expre | = help: Replace `map` with a generator expression -Suggested fix: 8 8 | dict(map(lambda v: [v, v**2], nums)) 9 9 | map(lambda: "const", nums) 10 10 | map(lambda _: 3.0, nums) @@ -218,7 +209,6 @@ C417.py:12:5: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -Suggested fix: 9 9 | map(lambda: "const", nums) 10 10 | map(lambda _: 3.0, nums) 11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) @@ -240,7 +230,6 @@ C417.py:13:14: C417 [*] Unnecessary `map` usage (rewrite using a generator expre | = help: Replace `map` with a generator expression -Suggested fix: 10 10 | map(lambda _: 3.0, nums) 11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) 12 12 | all(map(lambda v: isinstance(v, dict), nums)) @@ -263,7 +252,6 @@ C417.py:14:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehen | = help: Replace `map` with a `list` comprehension -Suggested fix: 11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) 12 12 | all(map(lambda v: isinstance(v, dict), nums)) 13 13 | filter(func, map(lambda v: v, nums)) @@ -284,7 +272,6 @@ C417.py:17:8: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehens | = help: Replace `map` with a `set` comprehension -Suggested fix: 14 14 | list(map(lambda x, y: x * y, nums)) 15 15 | 16 16 | # When inside f-string, then the fix should be surrounded by whitespace @@ -307,7 +294,6 @@ C417.py:18:8: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehen | = help: Replace `map` with a `dict` comprehension -Suggested fix: 15 15 | 16 16 | # When inside f-string, then the fix should be surrounded by whitespace 17 17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}" @@ -329,7 +315,6 @@ C417.py:36:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -Suggested fix: 33 33 | map(lambda x: lambda: x, range(4)) 34 34 | 35 35 | # Error: the `x` is overridden by the inner lambda. @@ -351,7 +336,6 @@ C417.py:47:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -Suggested fix: 44 44 | dict(map(lambda k, v: (k, v), keys, values)) 45 45 | 46 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121 @@ -372,7 +356,6 @@ C417.py:48:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -Suggested fix: 45 45 | 46 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121 47 47 | map(lambda x: x, y if y else z) @@ -391,7 +374,6 @@ C417.py:49:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -Suggested fix: 46 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121 47 47 | map(lambda x: x, y if y else z) 48 48 | map(lambda x: x, (y if y else z)) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap index 9a3e817984085..e45cbc3bb2816 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap @@ -10,7 +10,6 @@ C418.py:1:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the | = help: Remove outer `dict` call -Suggested fix: 1 |-dict({}) 1 |+{} 2 2 | dict({'a': 1}) @@ -29,7 +28,6 @@ C418.py:2:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the | = help: Remove outer `dict` call -Suggested fix: 1 1 | dict({}) 2 |-dict({'a': 1}) 2 |+{'a': 1} @@ -50,7 +48,6 @@ C418.py:3:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remov | = help: Remove outer `dict` call -Suggested fix: 1 1 | dict({}) 2 2 | dict({'a': 1}) 3 |-dict({'x': 1 for x in range(10)}) @@ -74,7 +71,6 @@ C418.py:4:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remov | = help: Remove outer `dict` call -Suggested fix: 1 1 | dict({}) 2 2 | dict({'a': 1}) 3 3 | dict({'x': 1 for x in range(10)}) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap index d9bdf19552c82..e20981cbd6c4b 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap @@ -10,7 +10,6 @@ C419.py:1:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -Suggested fix: 1 |-any([x.id for x in bar]) 1 |+any(x.id for x in bar) 2 2 | all([x.id for x in bar]) @@ -29,7 +28,6 @@ C419.py:2:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -Suggested fix: 1 1 | any([x.id for x in bar]) 2 |-all([x.id for x in bar]) 2 |+all(x.id for x in bar) @@ -50,7 +48,6 @@ C419.py:4:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -Suggested fix: 1 1 | any([x.id for x in bar]) 2 2 | all([x.id for x in bar]) 3 3 | any( # first comment @@ -73,7 +70,6 @@ C419.py:7:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -Suggested fix: 4 4 | [x.id for x in bar], # second comment 5 5 | ) # third comment 6 6 | all( # first comment @@ -96,7 +92,6 @@ C419.py:9:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -Suggested fix: 6 6 | all( # first comment 7 7 | [x.id for x in bar], # second comment 8 8 | ) # third comment @@ -125,7 +120,6 @@ C419.py:28:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -Suggested fix: 25 25 | 26 26 | # Special comment handling 27 27 | any( @@ -159,7 +153,6 @@ C419.py:39:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -Suggested fix: 36 36 | 37 37 | # Weird case where the function call, opening bracket, and comment are all 38 38 | # on the same line. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C419_C419_1.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C419_C419_1.py.snap index 9ac29a51032ae..b8111ca753f49 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C419_C419_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C419_C419_1.py.snap @@ -10,7 +10,6 @@ C419_1.py:1:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -Suggested fix: 1 |-sum([x.val for x in bar]) 1 |+sum(x.val for x in bar) 2 2 | min([x.val for x in bar]) @@ -29,7 +28,6 @@ C419_1.py:2:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -Suggested fix: 1 1 | sum([x.val for x in bar]) 2 |-min([x.val for x in bar]) 2 |+min(x.val for x in bar) @@ -49,7 +47,6 @@ C419_1.py:3:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -Suggested fix: 1 1 | sum([x.val for x in bar]) 2 2 | min([x.val for x in bar]) 3 |-max([x.val for x in bar]) @@ -71,7 +68,6 @@ C419_1.py:4:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -Suggested fix: 1 1 | sum([x.val for x in bar]) 2 2 | min([x.val for x in bar]) 3 3 | max([x.val for x in bar]) @@ -99,7 +95,6 @@ C419_1.py:14:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -Suggested fix: 11 11 | 12 12 | # Multi-line 13 13 | sum( diff --git a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap index 67b6b635aa9d8..e3c3e6464bfe0 100644 --- a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap +++ b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap @@ -9,7 +9,6 @@ EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variabl | = help: Assign to variable; remove string literal -Suggested fix: 2 2 | 3 3 | 4 4 | def f_a(): @@ -31,7 +30,6 @@ EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -Suggested fix: 15 15 | 16 16 | def f_b(): 17 17 | example = "example" @@ -52,7 +50,6 @@ EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, ass | = help: Assign to variable; remove `.format()` string -Suggested fix: 19 19 | 20 20 | 21 21 | def f_c(): @@ -74,7 +71,6 @@ EM.py:32:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -Suggested fix: 29 29 | 30 30 | def f_msg_defined(): 31 31 | msg = "hello" @@ -96,7 +92,6 @@ EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -Suggested fix: 36 36 | def nested(): 37 37 | msg = "hello" 38 38 | @@ -117,7 +112,6 @@ EM.py:46:28: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -Suggested fix: 43 43 | msg = "hello" 44 44 | 45 45 | def nested(): @@ -141,7 +135,6 @@ EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -Suggested fix: 48 48 | 49 49 | def f_fix_indentation_check(foo): 50 50 | if foo: @@ -164,7 +157,6 @@ EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -Suggested fix: 51 51 | raise RuntimeError("This is an example exception") 52 52 | else: 53 53 | if foo == "foo": @@ -186,7 +178,6 @@ EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, ass | = help: Assign to variable; remove `.format()` string -Suggested fix: 52 52 | else: 53 53 | if foo == "foo": 54 54 | raise RuntimeError(f"This is an exception: {foo}") @@ -225,7 +216,6 @@ EM.py:64:24: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -Suggested fix: 61 61 | 62 62 | 63 63 | def f_triple_quoted_string(): @@ -251,7 +241,6 @@ EM.py:76:9: EM103 [*] Exception must not use a `.format()` string directly, assi | = help: Assign to variable; remove `.format()` string -Suggested fix: 72 72 | 73 73 | 74 74 | def f_multi_line_string2(): @@ -286,7 +275,6 @@ EM.py:84:9: EM103 [*] Exception must not use a `.format()` string directly, assi | = help: Assign to variable; remove `.format()` string -Suggested fix: 80 80 | 81 81 | 82 82 | def f_multi_line_string2(): diff --git a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap index f9c5c703c97f7..1fc7454608f27 100644 --- a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap @@ -9,7 +9,6 @@ EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variabl | = help: Assign to variable; remove string literal -Suggested fix: 2 2 | 3 3 | 4 4 | def f_a(): @@ -30,7 +29,6 @@ EM.py:9:24: EM101 [*] Exception must not use a string literal, assign to variabl | = help: Assign to variable; remove string literal -Suggested fix: 6 6 | 7 7 | 8 8 | def f_a_short(): @@ -51,7 +49,6 @@ EM.py:13:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -Suggested fix: 10 10 | 11 11 | 12 12 | def f_a_empty(): @@ -73,7 +70,6 @@ EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -Suggested fix: 15 15 | 16 16 | def f_b(): 17 17 | example = "example" @@ -94,7 +90,6 @@ EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, ass | = help: Assign to variable; remove `.format()` string -Suggested fix: 19 19 | 20 20 | 21 21 | def f_c(): @@ -116,7 +111,6 @@ EM.py:32:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -Suggested fix: 29 29 | 30 30 | def f_msg_defined(): 31 31 | msg = "hello" @@ -138,7 +132,6 @@ EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -Suggested fix: 36 36 | def nested(): 37 37 | msg = "hello" 38 38 | @@ -159,7 +152,6 @@ EM.py:46:28: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -Suggested fix: 43 43 | msg = "hello" 44 44 | 45 45 | def nested(): @@ -183,7 +175,6 @@ EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -Suggested fix: 48 48 | 49 49 | def f_fix_indentation_check(foo): 50 50 | if foo: @@ -206,7 +197,6 @@ EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -Suggested fix: 51 51 | raise RuntimeError("This is an example exception") 52 52 | else: 53 53 | if foo == "foo": @@ -228,7 +218,6 @@ EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, ass | = help: Assign to variable; remove `.format()` string -Suggested fix: 52 52 | else: 53 53 | if foo == "foo": 54 54 | raise RuntimeError(f"This is an exception: {foo}") @@ -267,7 +256,6 @@ EM.py:64:24: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -Suggested fix: 61 61 | 62 62 | 63 63 | def f_triple_quoted_string(): @@ -292,7 +280,6 @@ EM.py:69:9: EM101 [*] Exception must not use a string literal, assign to variabl | = help: Assign to variable; remove string literal -Suggested fix: 65 65 | 66 66 | 67 67 | def f_multi_line_string(): @@ -323,7 +310,6 @@ EM.py:76:9: EM103 [*] Exception must not use a `.format()` string directly, assi | = help: Assign to variable; remove `.format()` string -Suggested fix: 72 72 | 73 73 | 74 74 | def f_multi_line_string2(): @@ -358,7 +344,6 @@ EM.py:84:9: EM103 [*] Exception must not use a `.format()` string directly, assi | = help: Assign to variable; remove `.format()` string -Suggested fix: 80 80 | 81 81 | 82 82 | def f_multi_line_string2(): diff --git a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_1.py.snap b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_1.py.snap index c85bb80baa1ce..29974dee8432a 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_1.py.snap @@ -8,7 +8,6 @@ EXE004_1.py:1:1: EXE004 [*] Avoid whitespace before shebang | = help: Remove whitespace before shebang -Suggested fix: 1 |- #!/usr/bin/python 1 |+#!/usr/bin/python diff --git a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_4.py.snap b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_4.py.snap index b0423301ed57b..54bdb691235c6 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_4.py.snap @@ -9,7 +9,6 @@ EXE004_4.py:1:1: EXE004 [*] Avoid whitespace before shebang | = help: Remove whitespace before shebang -Suggested fix: 1 |- 2 |- #!/usr/bin/env python 1 |+#!/usr/bin/env python diff --git a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_lowercase.py.snap b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_lowercase.py.snap index 82466963c9d6e..59f2b0613afde 100644 --- a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_lowercase.py.snap +++ b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_lowercase.py.snap @@ -9,7 +9,6 @@ no_future_import_uses_lowercase.py:6:14: FA102 [*] Missing `from __future__ impo | = help: Add `from __future__ import annotations` -Suggested fix: 1 |+from __future__ import annotations 1 2 | def main() -> None: 2 3 | a_list: list[str] = [] diff --git a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union.py.snap b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union.py.snap index f6de122621d20..f400b10c0e7e7 100644 --- a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union.py.snap +++ b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union.py.snap @@ -9,7 +9,6 @@ no_future_import_uses_union.py:6:14: FA102 [*] Missing `from __future__ import a | = help: Add `from __future__ import annotations` -Suggested fix: 1 |+from __future__ import annotations 1 2 | def main() -> None: 2 3 | a_list: list[str] | None = [] @@ -25,7 +24,6 @@ no_future_import_uses_union.py:6:14: FA102 [*] Missing `from __future__ import a | = help: Add `from __future__ import annotations` -Suggested fix: 1 |+from __future__ import annotations 1 2 | def main() -> None: 2 3 | a_list: list[str] | None = [] diff --git a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union_inner.py.snap b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union_inner.py.snap index f4f104377a2b3..cc897dc713682 100644 --- a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union_inner.py.snap +++ b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union_inner.py.snap @@ -10,7 +10,6 @@ no_future_import_uses_union_inner.py:6:14: FA102 [*] Missing `from __future__ im | = help: Add `from __future__ import annotations` -Suggested fix: 1 |+from __future__ import annotations 1 2 | def main() -> None: 2 3 | a_list: list[str | None] = [] @@ -27,7 +26,6 @@ no_future_import_uses_union_inner.py:6:19: FA102 [*] Missing `from __future__ im | = help: Add `from __future__ import annotations` -Suggested fix: 1 |+from __future__ import annotations 1 2 | def main() -> None: 2 3 | a_list: list[str | None] = [] diff --git a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC.py.snap b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC.py.snap index eab6235d09de6..2542e832c2733 100644 --- a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC.py.snap +++ b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC.py.snap @@ -10,7 +10,6 @@ ISC.py:1:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 1 |-_ = "a" "b" "c" 1 |+_ = "ab" "c" 2 2 | @@ -28,7 +27,6 @@ ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 1 |-_ = "a" "b" "c" 1 |+_ = "a" "bc" 2 2 | @@ -48,7 +46,6 @@ ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 35 35 | b"def" 36 36 | ) 37 37 | @@ -74,7 +71,6 @@ ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 38 38 | _ = """a""" """b""" 39 39 | 40 40 | _ = """a @@ -97,7 +93,6 @@ ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 41 41 | b""" """c 42 42 | d""" 43 43 | @@ -153,7 +148,6 @@ ISC.py:52:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 49 49 | 50 50 | _ = 'a' "b" 51 51 | @@ -175,7 +169,6 @@ ISC.py:64:10: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 61 61 | _ = foo + "abc" + bar 62 62 | 63 63 | # Multiple strings nested inside a f-string @@ -197,7 +190,6 @@ ISC.py:64:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 61 61 | _ = foo + "abc" + bar 62 62 | 63 63 | # Multiple strings nested inside a f-string @@ -220,7 +212,6 @@ ISC.py:65:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 62 62 | 63 63 | # Multiple strings nested inside a f-string 64 64 | _ = f"a {'b' 'c' 'd'} e" @@ -262,7 +253,6 @@ ISC.py:72:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 69 69 | } jkl""" 70 70 | 71 71 | # Nested f-strings @@ -285,7 +275,6 @@ ISC.py:73:10: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 70 70 | 71 71 | # Nested f-strings 72 72 | _ = "a" f"b {f"c" f"d"} e" "f" @@ -308,7 +297,6 @@ ISC.py:73:20: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 70 70 | 71 71 | # Nested f-strings 72 72 | _ = "a" f"b {f"c" f"d"} e" "f" diff --git a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC001_ISC.py.snap b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC001_ISC.py.snap index eab6235d09de6..2542e832c2733 100644 --- a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC001_ISC.py.snap +++ b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC001_ISC.py.snap @@ -10,7 +10,6 @@ ISC.py:1:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 1 |-_ = "a" "b" "c" 1 |+_ = "ab" "c" 2 2 | @@ -28,7 +27,6 @@ ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 1 |-_ = "a" "b" "c" 1 |+_ = "a" "bc" 2 2 | @@ -48,7 +46,6 @@ ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 35 35 | b"def" 36 36 | ) 37 37 | @@ -74,7 +71,6 @@ ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 38 38 | _ = """a""" """b""" 39 39 | 40 40 | _ = """a @@ -97,7 +93,6 @@ ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 41 41 | b""" """c 42 42 | d""" 43 43 | @@ -153,7 +148,6 @@ ISC.py:52:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 49 49 | 50 50 | _ = 'a' "b" 51 51 | @@ -175,7 +169,6 @@ ISC.py:64:10: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 61 61 | _ = foo + "abc" + bar 62 62 | 63 63 | # Multiple strings nested inside a f-string @@ -197,7 +190,6 @@ ISC.py:64:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 61 61 | _ = foo + "abc" + bar 62 62 | 63 63 | # Multiple strings nested inside a f-string @@ -220,7 +212,6 @@ ISC.py:65:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 62 62 | 63 63 | # Multiple strings nested inside a f-string 64 64 | _ = f"a {'b' 'c' 'd'} e" @@ -262,7 +253,6 @@ ISC.py:72:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 69 69 | } jkl""" 70 70 | 71 71 | # Nested f-strings @@ -285,7 +275,6 @@ ISC.py:73:10: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 70 70 | 71 71 | # Nested f-strings 72 72 | _ = "a" f"b {f"c" f"d"} e" "f" @@ -308,7 +297,6 @@ ISC.py:73:20: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -Suggested fix: 70 70 | 71 71 | # Nested f-strings 72 72 | _ = "a" f"b {f"c" f"d"} e" "f" diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap index be3f69a68ad6a..705cd72db9435 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap @@ -11,7 +11,6 @@ defaults.py:6:12: ICN001 [*] `altair` should be imported as `alt` | = help: Alias `altair` to `alt` -Suggested fix: 3 3 | 4 4 | 5 5 | def unconventional(): @@ -45,7 +44,6 @@ defaults.py:8:12: ICN001 [*] `numpy` should be imported as `np` | = help: Alias `numpy` to `np` -Suggested fix: 5 5 | def unconventional(): 6 6 | import altair 7 7 | import matplotlib.pyplot @@ -68,7 +66,6 @@ defaults.py:9:12: ICN001 [*] `pandas` should be imported as `pd` | = help: Alias `pandas` to `pd` -Suggested fix: 6 6 | import altair 7 7 | import matplotlib.pyplot 8 8 | import numpy @@ -91,7 +88,6 @@ defaults.py:10:12: ICN001 [*] `seaborn` should be imported as `sns` | = help: Alias `seaborn` to `sns` -Suggested fix: 7 7 | import matplotlib.pyplot 8 8 | import numpy 9 9 | import pandas @@ -113,7 +109,6 @@ defaults.py:11:12: ICN001 [*] `tkinter` should be imported as `tk` | = help: Alias `tkinter` to `tk` -Suggested fix: 8 8 | import numpy 9 9 | import pandas 10 10 | import seaborn @@ -134,7 +129,6 @@ defaults.py:12:12: ICN001 [*] `networkx` should be imported as `nx` | = help: Alias `networkx` to `nx` -Suggested fix: 9 9 | import pandas 10 10 | import seaborn 11 11 | import tkinter @@ -156,7 +150,6 @@ defaults.py:16:22: ICN001 [*] `altair` should be imported as `alt` | = help: Alias `altair` to `alt` -Suggested fix: 13 13 | 14 14 | 15 15 | def unconventional_aliases(): @@ -179,7 +172,6 @@ defaults.py:17:33: ICN001 [*] `matplotlib.pyplot` should be imported as `plt` | = help: Alias `matplotlib.pyplot` to `plt` -Suggested fix: 14 14 | 15 15 | def unconventional_aliases(): 16 16 | import altair as altr @@ -202,7 +194,6 @@ defaults.py:18:21: ICN001 [*] `numpy` should be imported as `np` | = help: Alias `numpy` to `np` -Suggested fix: 15 15 | def unconventional_aliases(): 16 16 | import altair as altr 17 17 | import matplotlib.pyplot as plot @@ -225,7 +216,6 @@ defaults.py:19:22: ICN001 [*] `pandas` should be imported as `pd` | = help: Alias `pandas` to `pd` -Suggested fix: 16 16 | import altair as altr 17 17 | import matplotlib.pyplot as plot 18 18 | import numpy as nmp @@ -248,7 +238,6 @@ defaults.py:20:23: ICN001 [*] `seaborn` should be imported as `sns` | = help: Alias `seaborn` to `sns` -Suggested fix: 17 17 | import matplotlib.pyplot as plot 18 18 | import numpy as nmp 19 19 | import pandas as pdas @@ -270,7 +259,6 @@ defaults.py:21:23: ICN001 [*] `tkinter` should be imported as `tk` | = help: Alias `tkinter` to `tk` -Suggested fix: 18 18 | import numpy as nmp 19 19 | import pandas as pdas 20 20 | import seaborn as sbrn @@ -291,7 +279,6 @@ defaults.py:22:24: ICN001 [*] `networkx` should be imported as `nx` | = help: Alias `networkx` to `nx` -Suggested fix: 19 19 | import pandas as pdas 20 20 | import seaborn as sbrn 21 21 | import tkinter as tkr diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__same_name.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__same_name.snap index af721e0853b44..ebed3f82b501c 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__same_name.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__same_name.snap @@ -9,7 +9,6 @@ same_name.py:10:41: ICN001 [*] `django.conf.settings` should be imported as `set | = help: Alias `django.conf.settings` to `settings` -Suggested fix: 7 7 | 8 8 | 9 9 | def unconventional_alias(): diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap index a76a30a39829d..14c2fdd0d4292 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap @@ -12,7 +12,6 @@ tricky.py:7:16: ICN001 [*] `pandas` should be imported as `pd` | = help: Alias `pandas` to `pd` -Suggested fix: 3 3 | 4 4 | def rename_global(): 5 5 | try: diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap index 0c9f7d6a57afb..e89fe2d4d4232 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap @@ -12,7 +12,6 @@ LOG001.py:3:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers | = help: Replace with `logging.getLogger()` -Suggested fix: 1 1 | import logging 2 2 | 3 |-logging.Logger(__name__) @@ -31,7 +30,6 @@ LOG001.py:4:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers | = help: Replace with `logging.getLogger()` -Suggested fix: 1 1 | import logging 2 2 | 3 3 | logging.Logger(__name__) diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap index af57337424506..e6b44674522f0 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap @@ -10,7 +10,6 @@ LOG002.py:11:11: LOG002 [*] Use `__name__` with `logging.getLogger()` | = help: Replace with `__name__` -Suggested fix: 8 8 | logging.getLogger(name="custom") 9 9 | 10 10 | # LOG002 @@ -33,7 +32,6 @@ LOG002.py:12:24: LOG002 [*] Use `__name__` with `logging.getLogger()` | = help: Replace with `__name__` -Suggested fix: 9 9 | 10 10 | # LOG002 11 11 | getLogger(__file__) @@ -55,7 +53,6 @@ LOG002.py:14:19: LOG002 [*] Use `__name__` with `logging.getLogger()` | = help: Replace with `__name__` -Suggested fix: 11 11 | getLogger(__file__) 12 12 | logging.getLogger(name=__file__) 13 13 | @@ -75,7 +72,6 @@ LOG002.py:15:16: LOG002 [*] Use `__name__` with `logging.getLogger()` | = help: Replace with `__name__` -Suggested fix: 12 12 | logging.getLogger(name=__file__) 13 13 | 14 14 | logging.getLogger(__cached__) diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap index 086fedde0858f..8b2e653b497a0 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap @@ -11,7 +11,6 @@ LOG009.py:4:5: LOG009 [*] Use of undocumented `logging.WARN` constant | = help: Replace `logging.WARN` with `logging.WARNING` -Suggested fix: 1 1 | def func(): 2 2 | import logging 3 3 | @@ -33,7 +32,6 @@ LOG009.py:11:5: LOG009 [*] Use of undocumented `logging.WARN` constant | = help: Replace `logging.WARN` with `logging.WARNING` -Suggested fix: 8 8 | def func(): 9 9 | from logging import WARN, WARNING 10 10 | diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G010.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G010.py.snap index 63cab07c20c25..7346affeab0d2 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G010.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G010.py.snap @@ -12,7 +12,6 @@ G010.py:6:9: G010 [*] Logging statement uses `warn` instead of `warning` | = help: Convert to `warning` -Suggested fix: 3 3 | 4 4 | from logging_setup import logger 5 5 | @@ -35,7 +34,6 @@ G010.py:8:8: G010 [*] Logging statement uses `warn` instead of `warning` | = help: Convert to `warning` -Suggested fix: 5 5 | 6 6 | logging.warn("Hello World!") 7 7 | log.warn("Hello world!") # This shouldn't be considered as a logger candidate @@ -58,7 +56,6 @@ G010.py:10:11: G010 [*] Logging statement uses `warn` instead of `warning` | = help: Convert to `warning` -Suggested fix: 7 7 | log.warn("Hello world!") # This shouldn't be considered as a logger candidate 8 8 | logger.warn("Hello world!") 9 9 | @@ -80,7 +77,6 @@ G010.py:13:1: G010 [*] Logging statement uses `warn` instead of `warning` | = help: Convert to `warning` -Suggested fix: 10 10 | logging . warn("Hello World!") 11 11 | 12 12 | from logging import warn, warning, exception diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE790_PIE790.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE790_PIE790.py.snap index b0ba0d4867e24..0a8fa25cc1cbd 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE790_PIE790.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE790_PIE790.py.snap @@ -10,7 +10,6 @@ PIE790.py:4:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 1 1 | class Foo: 2 2 | """buzz""" 3 3 | @@ -30,7 +29,6 @@ PIE790.py:9:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 6 6 | 7 7 | if foo: 8 8 | """foo""" @@ -50,7 +48,6 @@ PIE790.py:14:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 11 11 | 12 12 | def multi_statement() -> None: 13 13 | """This is a function.""" @@ -71,7 +68,6 @@ PIE790.py:21:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 18 18 | pass 19 19 | else: 20 20 | """bar""" @@ -91,7 +87,6 @@ PIE790.py:28:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 25 25 | pass 26 26 | else: 27 27 | """bar""" @@ -111,7 +106,6 @@ PIE790.py:35:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 32 32 | pass 33 33 | else: 34 34 | """bar""" @@ -131,7 +125,6 @@ PIE790.py:42:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 39 39 | pass 40 40 | else: 41 41 | """bar""" @@ -151,7 +144,6 @@ PIE790.py:50:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 47 47 | buzz 48 48 | """ 49 49 | @@ -171,7 +163,6 @@ PIE790.py:58:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 55 55 | buzz 56 56 | """ 57 57 | @@ -193,7 +184,6 @@ PIE790.py:65:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 62 62 | """ 63 63 | buzz 64 64 | """ @@ -213,7 +203,6 @@ PIE790.py:74:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 71 71 | bar() 72 72 | except ValueError: 73 73 | """bar""" @@ -235,7 +224,6 @@ PIE790.py:79:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 76 76 | 77 77 | for _ in range(10): 78 78 | """buzz""" @@ -257,7 +245,6 @@ PIE790.py:83:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 80 80 | 81 81 | async for _ in range(10): 82 82 | """buzz""" @@ -277,7 +264,6 @@ PIE790.py:87:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 84 84 | 85 85 | while cond: 86 86 | """buzz""" @@ -299,7 +285,6 @@ PIE790.py:92:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 89 89 | 90 90 | with bar: 91 91 | """buzz""" @@ -319,7 +304,6 @@ PIE790.py:96:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 93 93 | 94 94 | async with bar: 95 95 | """buzz""" @@ -339,7 +323,6 @@ PIE790.py:101:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 98 98 | 99 99 | def foo() -> None: 100 100 | """buzz""" @@ -360,7 +343,6 @@ PIE790.py:130:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 127 127 | 128 128 | def foo(): 129 129 | print("foo") @@ -380,7 +362,6 @@ PIE790.py:136:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 133 133 | def foo(): 134 134 | """A docstring.""" 135 135 | print("foo") @@ -400,7 +381,6 @@ PIE790.py:140:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 138 138 | 139 139 | for i in range(10): 140 140 | pass @@ -422,7 +402,6 @@ PIE790.py:141:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 138 138 | 139 139 | for i in range(10): 140 140 | pass @@ -443,7 +422,6 @@ PIE790.py:144:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 141 141 | pass 142 142 | 143 143 | for i in range(10): @@ -465,7 +443,6 @@ PIE790.py:146:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 143 143 | for i in range(10): 144 144 | pass 145 145 | @@ -485,7 +462,6 @@ PIE790.py:149:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 146 146 | pass 147 147 | 148 148 | for i in range(10): @@ -506,7 +482,6 @@ PIE790.py:150:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 147 147 | 148 148 | for i in range(10): 149 149 | pass # comment @@ -526,7 +501,6 @@ PIE790.py:155:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -Suggested fix: 152 152 | 153 153 | def foo(): 154 154 | print("foo") @@ -546,7 +520,6 @@ PIE790.py:161:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -Suggested fix: 158 158 | def foo(): 159 159 | """A docstring.""" 160 160 | print("foo") @@ -566,7 +539,6 @@ PIE790.py:165:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -Suggested fix: 163 163 | 164 164 | for i in range(10): 165 165 | ... @@ -588,7 +560,6 @@ PIE790.py:166:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -Suggested fix: 163 163 | 164 164 | for i in range(10): 165 165 | ... @@ -609,7 +580,6 @@ PIE790.py:169:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -Suggested fix: 166 166 | ... 167 167 | 168 168 | for i in range(10): @@ -631,7 +601,6 @@ PIE790.py:171:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -Suggested fix: 168 168 | for i in range(10): 169 169 | ... 170 170 | @@ -651,7 +620,6 @@ PIE790.py:174:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -Suggested fix: 171 171 | ... 172 172 | 173 173 | for i in range(10): @@ -674,7 +642,6 @@ PIE790.py:175:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -Suggested fix: 172 172 | 173 173 | for i in range(10): 174 174 | ... # comment @@ -694,7 +661,6 @@ PIE790.py:178:5: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -Suggested fix: 175 175 | ... 176 176 | 177 177 | for i in range(10): @@ -716,7 +682,6 @@ PIE790.py:179:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -Suggested fix: 176 176 | 177 177 | for i in range(10): 178 178 | ... @@ -736,7 +701,6 @@ PIE790.py:209:9: PIE790 [*] Unnecessary `...` literal | = help: Remove unnecessary `...` -Suggested fix: 206 206 | 207 207 | def stub(self) -> str: 208 208 | """Docstring""" diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap index e123bd2ac6426..2bb2f76079eb9 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap @@ -12,7 +12,6 @@ PIE794.py:4:5: PIE794 [*] Class field `name` is defined multiple times | = help: Remove duplicate field definition for `name` -Suggested fix: 1 1 | class Foo(BaseModel): 2 2 | name = StringField() 3 3 | # .... @@ -34,7 +33,6 @@ PIE794.py:13:5: PIE794 [*] Class field `name` is defined multiple times | = help: Remove duplicate field definition for `name` -Suggested fix: 10 10 | class Foo(BaseModel): 11 11 | name: str = StringField() 12 12 | # .... @@ -54,7 +52,6 @@ PIE794.py:23:5: PIE794 [*] Class field `bar` is defined multiple times | = help: Remove duplicate field definition for `bar` -Suggested fix: 20 20 | bar: str = StringField() 21 21 | foo: bool = BooleanField() 22 22 | # ... @@ -74,7 +71,6 @@ PIE794.py:40:5: PIE794 [*] Class field `bar` is defined multiple times | = help: Remove duplicate field definition for `bar` -Suggested fix: 37 37 | bar: str = StringField() 38 38 | foo: bool = BooleanField() 39 39 | # ... @@ -94,7 +90,6 @@ PIE794.py:46:5: PIE794 [*] Class field `name` is defined multiple times | = help: Remove duplicate field definition for `name` -Suggested fix: 43 43 | class Person: 44 44 | name = "Foo" 45 45 | name = name + " Bar" @@ -114,7 +109,6 @@ PIE794.py:52:5: PIE794 [*] Class field `name` is defined multiple times | = help: Remove duplicate field definition for `name` -Suggested fix: 49 49 | class Person: 50 50 | name: str = "Foo" 51 51 | name: str = name + " Bar" diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap index 7a1b88457d50a..2a8365037de89 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap @@ -10,7 +10,6 @@ PIE800.py:1:14: PIE800 [*] Unnecessary spread `**` | = help: Remove unnecessary dict -Suggested fix: 1 |-{"foo": 1, **{"bar": 1}} # PIE800 1 |+{"foo": 1, "bar": 1} # PIE800 2 2 | @@ -30,7 +29,6 @@ PIE800.py:3:4: PIE800 [*] Unnecessary spread `**` | = help: Remove unnecessary dict -Suggested fix: 1 1 | {"foo": 1, **{"bar": 1}} # PIE800 2 2 | 3 |-{**{"bar": 10}, "a": "b"} # PIE800 @@ -52,7 +50,6 @@ PIE800.py:5:15: PIE800 [*] Unnecessary spread `**` | = help: Remove unnecessary dict -Suggested fix: 2 2 | 3 3 | {**{"bar": 10}, "a": "b"} # PIE800 4 4 | @@ -75,7 +72,6 @@ PIE800.py:7:11: PIE800 [*] Unnecessary spread `**` | = help: Remove unnecessary dict -Suggested fix: 4 4 | 5 5 | foo({**foo, **{"bar": True}}) # PIE800 6 6 | @@ -102,7 +98,6 @@ PIE800.py:12:7: PIE800 [*] Unnecessary spread `**` | = help: Remove unnecessary dict -Suggested fix: 9 9 | { # PIE800 10 10 | "a": "b", 11 11 | # Preserve @@ -131,7 +126,6 @@ PIE800.py:19:19: PIE800 [*] Unnecessary spread `**` | = help: Remove unnecessary dict -Suggested fix: 16 16 | }, 17 17 | } 18 18 | diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE804_PIE804.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE804_PIE804.py.snap index 29b871cbb8033..af5e70204584a 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE804_PIE804.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE804_PIE804.py.snap @@ -10,7 +10,6 @@ PIE804.py:1:5: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -Suggested fix: 1 |-foo(**{"bar": True}) # PIE804 1 |+foo(bar=True) # PIE804 2 2 | @@ -30,7 +29,6 @@ PIE804.py:3:5: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -Suggested fix: 1 1 | foo(**{"bar": True}) # PIE804 2 2 | 3 |-foo(**{"r2d2": True}) # PIE804 @@ -52,7 +50,6 @@ PIE804.py:5:20: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -Suggested fix: 2 2 | 3 3 | foo(**{"r2d2": True}) # PIE804 4 4 | @@ -75,7 +72,6 @@ PIE804.py:7:20: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -Suggested fix: 4 4 | 5 5 | Foo.objects.create(**{"bar": True}) # PIE804 6 6 | @@ -98,7 +94,6 @@ PIE804.py:9:20: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -Suggested fix: 6 6 | 7 7 | Foo.objects.create(**{"_id": some_id}) # PIE804 8 8 | @@ -121,7 +116,6 @@ PIE804.py:11:5: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -Suggested fix: 8 8 | 9 9 | Foo.objects.create(**{**bar}) # PIE804 10 10 | @@ -144,7 +138,6 @@ PIE804.py:22:5: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -Suggested fix: 19 19 | foo(**{"": True}) 20 20 | foo(**{f"buzz__{bar}": True}) 21 21 | abc(**{"for": 3}) @@ -196,7 +189,6 @@ PIE804.py:26:22: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -Suggested fix: 23 23 | 24 24 | # Duplicated key names won't be fixed, to avoid syntax errors. 25 25 | abc(**{'a': b}, **{'a': c}) # PIE804 @@ -217,7 +209,6 @@ PIE804.py:29:12: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -Suggested fix: 26 26 | abc(a=1, **{'a': c}, **{'b': c}) # PIE804 27 27 | 28 28 | # Some values need to be parenthesized. @@ -236,7 +227,6 @@ PIE804.py:30:12: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -Suggested fix: 27 27 | 28 28 | # Some values need to be parenthesized. 29 29 | abc(foo=1, **{'bar': (bar := 1)}) # PIE804 diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE807_PIE807.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE807_PIE807.py.snap index 0b48ea9a8e8f1..ab4880a625d6a 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE807_PIE807.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE807_PIE807.py.snap @@ -11,7 +11,6 @@ PIE807.py:3:44: PIE807 [*] Prefer `list` over useless lambda | = help: Replace with `lambda` with `list` -Suggested fix: 1 1 | @dataclass 2 2 | class Foo: 3 |- foo: List[str] = field(default_factory=lambda: []) # PIE807 @@ -31,7 +30,6 @@ PIE807.py:4:49: PIE807 [*] Prefer `dict` over useless lambda | = help: Replace with `lambda` with `dict` -Suggested fix: 1 1 | @dataclass 2 2 | class Foo: 3 3 | foo: List[str] = field(default_factory=lambda: []) # PIE807 @@ -52,7 +50,6 @@ PIE807.py:8:36: PIE807 [*] Prefer `list` over useless lambda | = help: Replace with `lambda` with `list` -Suggested fix: 5 5 | 6 6 | 7 7 | class FooTable(BaseTable): @@ -73,7 +70,6 @@ PIE807.py:9:36: PIE807 [*] Prefer `dict` over useless lambda | = help: Replace with `lambda` with `dict` -Suggested fix: 6 6 | 7 7 | class FooTable(BaseTable): 8 8 | foo = fields.ListField(default=lambda: []) # PIE807 @@ -94,7 +90,6 @@ PIE807.py:13:28: PIE807 [*] Prefer `list` over useless lambda | = help: Replace with `lambda` with `list` -Suggested fix: 10 10 | 11 11 | 12 12 | class FooTable(BaseTable): @@ -115,7 +110,6 @@ PIE807.py:14:36: PIE807 [*] Prefer `dict` over useless lambda | = help: Replace with `lambda` with `dict` -Suggested fix: 11 11 | 12 12 | class FooTable(BaseTable): 13 13 | foo = fields.ListField(lambda: []) # PIE807 diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE808_PIE808.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE808_PIE808.py.snap index 73c6defbebd56..efdc6cfafa5ea 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE808_PIE808.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE808_PIE808.py.snap @@ -11,7 +11,6 @@ PIE808.py:2:7: PIE808 [*] Unnecessary `start` argument in `range` | = help: Remove `start` argument -Suggested fix: 1 1 | # PIE808 2 |-range(0, 10) 2 |+range(10) @@ -31,7 +30,6 @@ PIE808.py:5:16: PIE808 [*] Unnecessary `start` argument in `range` | = help: Remove `start` argument -Suggested fix: 2 2 | range(0, 10) 3 3 | 4 4 | import builtins diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap index ccb047259e15d..9103ab91fdbe1 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap @@ -11,7 +11,6 @@ PIE810.py:2:1: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -Suggested fix: 1 1 | # error 2 |-obj.startswith("foo") or obj.startswith("bar") 2 |+obj.startswith(("foo", "bar")) @@ -32,7 +31,6 @@ PIE810.py:4:1: PIE810 [*] Call `endswith` once with a `tuple` | = help: Merge into a single `endswith` call -Suggested fix: 1 1 | # error 2 2 | obj.startswith("foo") or obj.startswith("bar") 3 3 | # error @@ -55,7 +53,6 @@ PIE810.py:6:1: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -Suggested fix: 3 3 | # error 4 4 | obj.endswith("foo") or obj.endswith("bar") 5 5 | # error @@ -78,7 +75,6 @@ PIE810.py:8:1: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -Suggested fix: 5 5 | # error 6 6 | obj.startswith(foo) or obj.startswith(bar) 7 7 | # error @@ -101,7 +97,6 @@ PIE810.py:10:1: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -Suggested fix: 7 7 | # error 8 8 | obj.startswith(foo) or obj.startswith("foo") 9 9 | # error @@ -123,7 +118,6 @@ PIE810.py:19:8: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -Suggested fix: 16 16 | y = ("h", "e", "l", "l", "o") 17 17 | z = "w" 18 18 | @@ -145,7 +139,6 @@ PIE810.py:25:8: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -Suggested fix: 22 22 | def func(): 23 23 | msg = "hello world" 24 24 | diff --git a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap index ef41f25d577ff..3c5c228a36f63 100644 --- a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap +++ b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap @@ -12,7 +12,6 @@ T201.py:4:1: T201 [*] `print` found | = help: Remove `print` -Suggested fix: 1 1 | import sys 2 2 | import tempfile 3 3 | @@ -33,7 +32,6 @@ T201.py:5:1: T201 [*] `print` found | = help: Remove `print` -Suggested fix: 2 2 | import tempfile 3 3 | 4 4 | print("Hello, world!") # T201 @@ -54,7 +52,6 @@ T201.py:6:1: T201 [*] `print` found | = help: Remove `print` -Suggested fix: 3 3 | 4 4 | print("Hello, world!") # T201 5 5 | print("Hello, world!", file=None) # T201 @@ -76,7 +73,6 @@ T201.py:7:1: T201 [*] `print` found | = help: Remove `print` -Suggested fix: 4 4 | print("Hello, world!") # T201 5 5 | print("Hello, world!", file=None) # T201 6 6 | print("Hello, world!", file=sys.stdout) # T201 diff --git a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap index d365c438eccfe..1a67512ddedb5 100644 --- a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap +++ b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap @@ -12,7 +12,6 @@ T203.py:3:1: T203 [*] `pprint` found | = help: Remove `pprint` -Suggested fix: 1 1 | from pprint import pprint 2 2 | 3 |-pprint("Hello, world!") # T203 @@ -33,7 +32,6 @@ T203.py:7:1: T203 [*] `pprint` found | = help: Remove `pprint` -Suggested fix: 4 4 | 5 5 | import pprint 6 6 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI009_PYI009.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI009_PYI009.pyi.snap index 05072ab2d3d70..c10f70efeae25 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI009_PYI009.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI009_PYI009.pyi.snap @@ -12,7 +12,6 @@ PYI009.pyi:3:5: PYI009 [*] Empty body should contain `...`, not `pass` | = help: Replace `pass` with `...` -Suggested fix: 1 1 | def bar(): ... # OK 2 2 | def foo(): 3 |- pass # ERROR PYI009, since we're in a stub file @@ -31,7 +30,6 @@ PYI009.pyi:8:5: PYI009 [*] Empty body should contain `...`, not `pass` | = help: Replace `pass` with `...` -Suggested fix: 5 5 | class Bar: ... # OK 6 6 | 7 7 | class Foo: diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap index 4f27777cd4829..30ad8c8834bef 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap @@ -11,7 +11,6 @@ PYI010.pyi:6:5: PYI010 [*] Function body must contain only `...` | = help: Replace function body with `...` -Suggested fix: 3 3 | """foo""" # OK, docstrings are handled by another rule 4 4 | 5 5 | def buzz(): @@ -33,7 +32,6 @@ PYI010.pyi:9:5: PYI010 [*] Function body must contain only `...` | = help: Replace function body with `...` -Suggested fix: 6 6 | print("buzz") # ERROR PYI010 7 7 | 8 8 | def foo2(): @@ -55,7 +53,6 @@ PYI010.pyi:12:5: PYI010 [*] Function body must contain only `...` | = help: Replace function body with `...` -Suggested fix: 9 9 | 123 # ERROR PYI010 10 10 | 11 11 | def bizz(): diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap index 5dc5af9468d89..d29d421cbd2de 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap @@ -12,7 +12,6 @@ PYI011.pyi:10:14: PYI011 [*] Only simple default values allowed for typed argume | = help: Replace default value with `...` -Suggested fix: 7 7 | 8 8 | def f12( 9 9 | x, @@ -39,7 +38,6 @@ PYI011.pyi:38:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -Suggested fix: 35 35 | def f152( 36 36 | x: dict[ 37 37 | int, int @@ -78,7 +76,6 @@ PYI011.pyi:46:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -Suggested fix: 43 43 | def f153( 44 44 | x: list[ 45 45 | int @@ -117,7 +114,6 @@ PYI011.pyi:63:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -Suggested fix: 60 60 | def f154( 61 61 | x: tuple[ 62 62 | str, tuple[str, ...] @@ -146,7 +142,6 @@ PYI011.pyi:71:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -Suggested fix: 68 68 | def f141( 69 69 | x: list[ 70 70 | int @@ -174,7 +169,6 @@ PYI011.pyi:78:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -Suggested fix: 75 75 | def f142( 76 76 | x: list[ 77 77 | int @@ -202,7 +196,6 @@ PYI011.pyi:85:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -Suggested fix: 82 82 | def f16( 83 83 | x: frozenset[ 84 84 | bytes @@ -229,7 +222,6 @@ PYI011.pyi:90:14: PYI011 [*] Only simple default values allowed for typed argume | = help: Replace default value with `...` -Suggested fix: 87 87 | ) 88 88 | ) -> None: ... 89 89 | def f17( @@ -255,7 +247,6 @@ PYI011.pyi:94:14: PYI011 [*] Only simple default values allowed for typed argume | = help: Replace default value with `...` -Suggested fix: 91 91 | + "bar", 92 92 | ) -> None: ... 93 93 | def f18( @@ -281,7 +272,6 @@ PYI011.pyi:98:17: PYI011 [*] Only simple default values allowed for typed argume | = help: Replace default value with `...` -Suggested fix: 95 95 | + b"bar", 96 96 | ) -> None: ... 97 97 | def f19( @@ -307,7 +297,6 @@ PYI011.pyi:102:14: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -Suggested fix: 99 99 | + 4, 100 100 | ) -> None: ... 101 101 | def f20( @@ -333,7 +322,6 @@ PYI011.pyi:106:18: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -Suggested fix: 103 103 | + 5, # Error PYI011 Only simple default values allowed for typed arguments 104 104 | ) -> None: ... 105 105 | def f21( @@ -359,7 +347,6 @@ PYI011.pyi:110:18: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -Suggested fix: 107 107 | - 3j, # Error PYI011 Only simple default values allowed for typed arguments 108 108 | ) -> None: ... 109 109 | def f22( @@ -383,7 +370,6 @@ PYI011.pyi:138:16: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -Suggested fix: 135 135 | x: float = -math.inf, # OK 136 136 | ) -> None: ... 137 137 | def f31( @@ -406,7 +392,6 @@ PYI011.pyi:141:16: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -Suggested fix: 138 138 | x: float = inf, # Error PYI011 Only simple default values allowed for typed arguments 139 139 | ) -> None: ... 140 140 | def f32( @@ -429,7 +414,6 @@ PYI011.pyi:147:16: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -Suggested fix: 144 144 | x: float = math.nan, # OK 145 145 | ) -> None: ... 146 146 | def f34( @@ -454,7 +438,6 @@ PYI011.pyi:150:18: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -Suggested fix: 147 147 | x: float = -math.nan, # Error PYI011 Only simple default values allowed for typed arguments 148 148 | ) -> None: ... 149 149 | def f35( @@ -479,7 +462,6 @@ PYI011.pyi:159:14: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -Suggested fix: 156 156 | ) -> None: ... 157 157 | def f37( 158 158 | *, diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI012_PYI012.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI012_PYI012.pyi.snap index 80a224c5d2bb2..e4323e3350593 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI012_PYI012.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI012_PYI012.pyi.snap @@ -12,7 +12,6 @@ PYI012.pyi:5:5: PYI012 [*] Class body must not contain `pass` | = help: Remove unnecessary `pass` -Suggested fix: 2 2 | 3 3 | class OneAttributeClass: 4 4 | value: int @@ -32,7 +31,6 @@ PYI012.pyi:8:5: PYI012 [*] Class body must not contain `pass` | = help: Remove unnecessary `pass` -Suggested fix: 5 5 | pass # PYI012 Class body must not contain `pass` 6 6 | 7 7 | class OneAttributeClassRev: @@ -54,7 +52,6 @@ PYI012.pyi:16:5: PYI012 [*] Class body must not contain `pass` | = help: Remove unnecessary `pass` -Suggested fix: 13 13 | My body only contains pass. 14 14 | """ 15 15 | @@ -76,7 +73,6 @@ PYI012.pyi:20:5: PYI012 [*] Class body must not contain `pass` | = help: Remove unnecessary `pass` -Suggested fix: 17 17 | 18 18 | class NonEmptyChild(Exception): 19 19 | value: int @@ -96,7 +92,6 @@ PYI012.pyi:23:5: PYI012 [*] Class body must not contain `pass` | = help: Remove unnecessary `pass` -Suggested fix: 20 20 | pass # PYI012 Class body must not contain `pass` 21 21 | 22 22 | class NonEmptyChild2(Exception): @@ -118,7 +113,6 @@ PYI012.pyi:28:5: PYI012 [*] Class body must not contain `pass` | = help: Remove unnecessary `pass` -Suggested fix: 25 25 | 26 26 | class NonEmptyWithInit: 27 27 | value: int diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.py.snap index ecc76d9323ab9..f65a46a52e89d 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.py.snap @@ -10,7 +10,6 @@ PYI013.py:3:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -Suggested fix: 1 1 | class OneAttributeClass: 2 2 | value: int 3 |- ... @@ -29,7 +28,6 @@ PYI013.py:7:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -Suggested fix: 4 4 | 5 5 | 6 6 | class OneAttributeClass2: @@ -49,7 +47,6 @@ PYI013.py:12:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -Suggested fix: 10 10 | 11 11 | class TwoEllipsesClass: 12 12 | ... @@ -69,7 +66,6 @@ PYI013.py:13:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -Suggested fix: 10 10 | 11 11 | class TwoEllipsesClass: 12 12 | ... @@ -89,7 +85,6 @@ PYI013.py:21:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -Suggested fix: 18 18 | My body only contains an ellipsis. 19 19 | """ 20 20 | @@ -109,7 +104,6 @@ PYI013.py:26:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -Suggested fix: 23 23 | 24 24 | class NonEmptyChild(Exception): 25 25 | value: int @@ -129,7 +123,6 @@ PYI013.py:30:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -Suggested fix: 27 27 | 28 28 | 29 29 | class NonEmptyChild2(Exception): @@ -151,7 +144,6 @@ PYI013.py:36:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -Suggested fix: 33 33 | 34 34 | class NonEmptyWithInit: 35 35 | value: int diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.pyi.snap index 3095b78fa8247..726f31a836c8f 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.pyi.snap @@ -12,7 +12,6 @@ PYI013.pyi:5:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -Suggested fix: 2 2 | 3 3 | class OneAttributeClass: 4 4 | value: int @@ -32,7 +31,6 @@ PYI013.pyi:8:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -Suggested fix: 5 5 | ... # Error 6 6 | 7 7 | class OneAttributeClass2: @@ -52,7 +50,6 @@ PYI013.pyi:12:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -Suggested fix: 9 9 | value: int 10 10 | 11 11 | class MyClass: @@ -72,7 +69,6 @@ PYI013.pyi:16:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -Suggested fix: 13 13 | value: int 14 14 | 15 15 | class TwoEllipsesClass: @@ -94,7 +90,6 @@ PYI013.pyi:17:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -Suggested fix: 14 14 | 15 15 | class TwoEllipsesClass: 16 16 | ... @@ -116,7 +111,6 @@ PYI013.pyi:24:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -Suggested fix: 21 21 | My body only contains an ellipsis. 22 22 | """ 23 23 | @@ -138,7 +132,6 @@ PYI013.pyi:28:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -Suggested fix: 25 25 | 26 26 | class NonEmptyChild(Exception): 27 27 | value: int @@ -158,7 +151,6 @@ PYI013.pyi:31:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -Suggested fix: 28 28 | ... # Error 29 29 | 30 30 | class NonEmptyChild2(Exception): @@ -180,7 +172,6 @@ PYI013.pyi:36:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -Suggested fix: 33 33 | 34 34 | class NonEmptyWithInit: 35 35 | value: int diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap index 92e435e87f488..5ac36a26aae43 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap @@ -12,7 +12,6 @@ PYI014.pyi:3:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -Suggested fix: 1 1 | def f12( 2 2 | x, 3 |- y=os.pathsep, # Error PYI014 @@ -38,7 +37,6 @@ PYI014.pyi:29:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -Suggested fix: 26 26 | ) -> None: ... 27 27 | def f151(x={1: 2}) -> None: ... 28 28 | def f152( @@ -77,7 +75,6 @@ PYI014.pyi:35:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -Suggested fix: 32 32 | } 33 33 | ) -> None: ... 34 34 | def f153( @@ -116,7 +113,6 @@ PYI014.pyi:50:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -Suggested fix: 47 47 | ] 48 48 | ) -> None: ... 49 49 | def f154( @@ -142,7 +138,6 @@ PYI014.pyi:56:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -Suggested fix: 53 53 | ) 54 54 | ) -> None: ... 55 55 | def f141( @@ -165,7 +160,6 @@ PYI014.pyi:59:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -Suggested fix: 56 56 | x=[*range(10)], # Error PYI014 57 57 | ) -> None: ... 58 58 | def f142( @@ -188,7 +182,6 @@ PYI014.pyi:61:11: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -Suggested fix: 58 58 | def f142( 59 59 | x=list(range(10)), # Error PYI014 60 60 | ) -> None: ... @@ -211,7 +204,6 @@ PYI014.pyi:63:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -Suggested fix: 60 60 | ) -> None: ... 61 61 | def f16(x=frozenset({b"foo", b"bar", b"baz"})) -> None: ... # Error PYI014 62 62 | def f17( @@ -234,7 +226,6 @@ PYI014.pyi:66:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -Suggested fix: 63 63 | x="foo" + "bar", # Error PYI014 64 64 | ) -> None: ... 65 65 | def f18( @@ -257,7 +248,6 @@ PYI014.pyi:69:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -Suggested fix: 66 66 | x=b"foo" + b"bar", # Error PYI014 67 67 | ) -> None: ... 68 68 | def f19( @@ -280,7 +270,6 @@ PYI014.pyi:72:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -Suggested fix: 69 69 | x="foo" + 4, # Error PYI014 70 70 | ) -> None: ... 71 71 | def f20( @@ -303,7 +292,6 @@ PYI014.pyi:75:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -Suggested fix: 72 72 | x=5 + 5, # Error PYI014 73 73 | ) -> None: ... 74 74 | def f21( @@ -326,7 +314,6 @@ PYI014.pyi:78:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -Suggested fix: 75 75 | x=3j - 3j, # Error PYI014 76 76 | ) -> None: ... 77 77 | def f22( diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap index 17264559e85c6..89f9fa94f6ac6 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap @@ -11,7 +11,6 @@ PYI015.pyi:44:23: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -Suggested fix: 41 41 | field22: Final = {"foo": 5} 42 42 | 43 43 | # We *should* emit Y015 for more complex default values @@ -34,7 +33,6 @@ PYI015.pyi:45:23: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -Suggested fix: 42 42 | 43 43 | # We *should* emit Y015 for more complex default values 44 44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments @@ -57,7 +55,6 @@ PYI015.pyi:46:23: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -Suggested fix: 43 43 | # We *should* emit Y015 for more complex default values 44 44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments 45 45 | field223: list[int] = [*range(10)] # Y015 Only simple default values are allowed for assignments @@ -80,7 +77,6 @@ PYI015.pyi:47:26: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -Suggested fix: 44 44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments 45 45 | field223: list[int] = [*range(10)] # Y015 Only simple default values are allowed for assignments 46 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments @@ -103,7 +99,6 @@ PYI015.pyi:48:47: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -Suggested fix: 45 45 | field223: list[int] = [*range(10)] # Y015 Only simple default values are allowed for assignments 46 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments 47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments @@ -126,7 +121,6 @@ PYI015.pyi:49:31: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -Suggested fix: 46 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments 47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments 48 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments @@ -149,7 +143,6 @@ PYI015.pyi:50:37: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -Suggested fix: 47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments 48 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments 49 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments @@ -172,7 +165,6 @@ PYI015.pyi:52:28: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -Suggested fix: 49 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments 50 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments 51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node @@ -195,7 +187,6 @@ PYI015.pyi:53:11: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -Suggested fix: 50 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments 51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node 52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments @@ -217,7 +208,6 @@ PYI015.pyi:54:11: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -Suggested fix: 51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node 52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments 53 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments @@ -240,7 +230,6 @@ PYI015.pyi:55:11: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -Suggested fix: 52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments 53 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments 54 54 | field24 = b"foo" + b"bar" # Y015 Only simple default values are allowed for assignments diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.py.snap index a89481febbf09..b684710deae73 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.py.snap @@ -11,7 +11,6 @@ PYI016.py:7:15: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -Suggested fix: 4 4 | field1: str 5 5 | 6 6 | # Should emit for duplicate field types. @@ -32,7 +31,6 @@ PYI016.py:10:23: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 7 7 | field2: str | str # PYI016: Duplicate union member `str` 8 8 | 9 9 | # Should emit for union types in arguments. @@ -53,7 +51,6 @@ PYI016.py:14:22: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -Suggested fix: 11 11 | print(arg1) 12 12 | 13 13 | # Should emit for unions in return types. @@ -75,7 +72,6 @@ PYI016.py:18:15: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -Suggested fix: 15 15 | return "my string" 16 16 | 17 17 | # Should emit in longer unions, even if not directly adjacent. @@ -98,7 +94,6 @@ PYI016.py:19:15: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 16 16 | 17 17 | # Should emit in longer unions, even if not directly adjacent. 18 18 | field3: str | str | int # PYI016: Duplicate union member `str` @@ -120,7 +115,6 @@ PYI016.py:20:21: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -Suggested fix: 17 17 | # Should emit in longer unions, even if not directly adjacent. 18 18 | field3: str | str | int # PYI016: Duplicate union member `str` 19 19 | field4: int | int | str # PYI016: Duplicate union member `int` @@ -143,7 +137,6 @@ PYI016.py:21:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 18 18 | field3: str | str | int # PYI016: Duplicate union member `str` 19 19 | field4: int | int | str # PYI016: Duplicate union member `int` 20 20 | field5: str | int | str # PYI016: Duplicate union member `str` @@ -165,7 +158,6 @@ PYI016.py:27:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 24 24 | field7 = str | str 25 25 | 26 26 | # Should emit for strangely-bracketed unions. @@ -186,7 +178,6 @@ PYI016.py:30:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 27 27 | field8: int | (str | int) # PYI016: Duplicate union member `int` 28 28 | 29 29 | # Should handle user brackets when fixing. @@ -209,7 +200,6 @@ PYI016.py:31:24: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -Suggested fix: 28 28 | 29 29 | # Should handle user brackets when fixing. 30 30 | field9: int | (int | str) # PYI016: Duplicate union member `int` @@ -231,7 +221,6 @@ PYI016.py:34:21: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 31 31 | field10: (str | int) | str # PYI016: Duplicate union member `str` 32 32 | 33 33 | # Should emit for nested unions. @@ -252,7 +241,6 @@ PYI016.py:37:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 34 34 | field11: dict[int | int, str] 35 35 | 36 36 | # Should emit for unions with more than two cases @@ -273,7 +261,6 @@ PYI016.py:37:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 34 34 | field11: dict[int | int, str] 35 35 | 36 36 | # Should emit for unions with more than two cases @@ -296,7 +283,6 @@ PYI016.py:38:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -319,7 +305,6 @@ PYI016.py:38:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -342,7 +327,6 @@ PYI016.py:38:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -364,7 +348,6 @@ PYI016.py:41:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 38 38 | field13: int | int | int | int # Error 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -386,7 +369,6 @@ PYI016.py:41:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 38 38 | field13: int | int | int | int # Error 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -408,7 +390,6 @@ PYI016.py:44:30: PYI016 [*] Duplicate union member `typing.Literal[1]` | = help: Remove duplicate union member `typing.Literal[1]` -Suggested fix: 41 41 | field14: int | int | str | int # Error 42 42 | 43 43 | # Should emit for duplicate literal types; also covered by PYI030 @@ -463,7 +444,6 @@ PYI016.py:69:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 66 66 | field20: typing.Union[int, typing.Union[int, str]] # Error 67 67 | 68 68 | # Should emit in cases with mixed `typing.Union` and `|` @@ -516,7 +496,6 @@ PYI016.py:76:12: PYI016 [*] Duplicate union member `set[int]` | = help: Remove duplicate union member `set[int]` -Suggested fix: 73 73 | 74 74 | # Should emit in cases with newlines 75 75 | field23: set[ # foo @@ -559,7 +538,6 @@ PYI016.py:86:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 83 83 | # Should emit twice (once for each `int` in the nested union, both of which are 84 84 | # duplicates of the outer `int`), but not three times (which would indicate that 85 85 | # we incorrectly re-checked the nested union). @@ -577,7 +555,6 @@ PYI016.py:86:34: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 83 83 | # Should emit twice (once for each `int` in the nested union, both of which are 84 84 | # duplicates of the outer `int`), but not three times (which would indicate that 85 85 | # we incorrectly re-checked the nested union). diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.pyi.snap index 09593badd6d66..63d067329b00d 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.pyi.snap @@ -11,7 +11,6 @@ PYI016.pyi:7:15: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -Suggested fix: 4 4 | field1: str 5 5 | 6 6 | # Should emit for duplicate field types. @@ -32,7 +31,6 @@ PYI016.pyi:10:23: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 7 7 | field2: str | str # PYI016: Duplicate union member `str` 8 8 | 9 9 | # Should emit for union types in arguments. @@ -53,7 +51,6 @@ PYI016.pyi:14:22: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -Suggested fix: 11 11 | print(arg1) 12 12 | 13 13 | # Should emit for unions in return types. @@ -75,7 +72,6 @@ PYI016.pyi:18:15: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -Suggested fix: 15 15 | return "my string" 16 16 | 17 17 | # Should emit in longer unions, even if not directly adjacent. @@ -98,7 +94,6 @@ PYI016.pyi:19:15: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 16 16 | 17 17 | # Should emit in longer unions, even if not directly adjacent. 18 18 | field3: str | str | int # PYI016: Duplicate union member `str` @@ -120,7 +115,6 @@ PYI016.pyi:20:21: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -Suggested fix: 17 17 | # Should emit in longer unions, even if not directly adjacent. 18 18 | field3: str | str | int # PYI016: Duplicate union member `str` 19 19 | field4: int | int | str # PYI016: Duplicate union member `int` @@ -143,7 +137,6 @@ PYI016.pyi:21:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 18 18 | field3: str | str | int # PYI016: Duplicate union member `str` 19 19 | field4: int | int | str # PYI016: Duplicate union member `int` 20 20 | field5: str | int | str # PYI016: Duplicate union member `str` @@ -165,7 +158,6 @@ PYI016.pyi:27:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 24 24 | field7 = str | str 25 25 | 26 26 | # Should emit for strangely-bracketed unions. @@ -186,7 +178,6 @@ PYI016.pyi:30:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 27 27 | field8: int | (str | int) # PYI016: Duplicate union member `int` 28 28 | 29 29 | # Should handle user brackets when fixing. @@ -209,7 +200,6 @@ PYI016.pyi:31:24: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -Suggested fix: 28 28 | 29 29 | # Should handle user brackets when fixing. 30 30 | field9: int | (int | str) # PYI016: Duplicate union member `int` @@ -231,7 +221,6 @@ PYI016.pyi:34:21: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 31 31 | field10: (str | int) | str # PYI016: Duplicate union member `str` 32 32 | 33 33 | # Should emit for nested unions. @@ -252,7 +241,6 @@ PYI016.pyi:37:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 34 34 | field11: dict[int | int, str] 35 35 | 36 36 | # Should emit for unions with more than two cases @@ -273,7 +261,6 @@ PYI016.pyi:37:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 34 34 | field11: dict[int | int, str] 35 35 | 36 36 | # Should emit for unions with more than two cases @@ -296,7 +283,6 @@ PYI016.pyi:38:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -319,7 +305,6 @@ PYI016.pyi:38:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -342,7 +327,6 @@ PYI016.pyi:38:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -364,7 +348,6 @@ PYI016.pyi:41:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 38 38 | field13: int | int | int | int # Error 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -386,7 +369,6 @@ PYI016.pyi:41:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 38 38 | field13: int | int | int | int # Error 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -408,7 +390,6 @@ PYI016.pyi:44:30: PYI016 [*] Duplicate union member `typing.Literal[1]` | = help: Remove duplicate union member `typing.Literal[1]` -Suggested fix: 41 41 | field14: int | int | str | int # Error 42 42 | 43 43 | # Should emit for duplicate literal types; also covered by PYI030 @@ -463,7 +444,6 @@ PYI016.pyi:69:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 66 66 | field20: typing.Union[int, typing.Union[int, str]] # Error 67 67 | 68 68 | # Should emit in cases with mixed `typing.Union` and `|` @@ -516,7 +496,6 @@ PYI016.pyi:76:12: PYI016 [*] Duplicate union member `set[int]` | = help: Remove duplicate union member `set[int]` -Suggested fix: 73 73 | 74 74 | # Should emit in cases with newlines 75 75 | field23: set[ # foo @@ -559,7 +538,6 @@ PYI016.pyi:86:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 83 83 | # Should emit twice (once for each `int` in the nested union, both of which are 84 84 | # duplicates of the outer `int`), but not three times (which would indicate that 85 85 | # we incorrectly re-checked the nested union). @@ -577,7 +555,6 @@ PYI016.pyi:86:34: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -Suggested fix: 83 83 | # Should emit twice (once for each `int` in the nested union, both of which are 84 84 | # duplicates of the outer `int`), but not three times (which would indicate that 85 85 | # we incorrectly re-checked the nested union). diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI020_PYI020.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI020_PYI020.pyi.snap index 974c368b75b61..0ed861b7bbe21 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI020_PYI020.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI020_PYI020.pyi.snap @@ -12,7 +12,6 @@ PYI020.pyi:7:10: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -Suggested fix: 4 4 | 5 5 | import typing_extensions 6 6 | @@ -33,7 +32,6 @@ PYI020.pyi:8:15: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -Suggested fix: 5 5 | import typing_extensions 6 6 | 7 7 | def f(x: "int"): ... # Y020 Quoted annotations should never be used in stubs @@ -56,7 +54,6 @@ PYI020.pyi:9:26: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -Suggested fix: 6 6 | 7 7 | def f(x: "int"): ... # Y020 Quoted annotations should never be used in stubs 8 8 | def g(x: list["int"]): ... # Y020 Quoted annotations should never be used in stubs @@ -78,7 +75,6 @@ PYI020.pyi:13:12: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -Suggested fix: 10 10 | 11 11 | def h(w: Literal["a", "b"], x: typing.Literal["c"], y: typing_extensions.Literal["d"], z: _T) -> _T: ... 12 12 | @@ -100,7 +96,6 @@ PYI020.pyi:14:25: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -Suggested fix: 11 11 | def h(w: Literal["a", "b"], x: typing.Literal["c"], y: typing_extensions.Literal["d"], z: _T) -> _T: ... 12 12 | 13 13 | def j() -> "int": ... # Y020 Quoted annotations should never be used in stubs @@ -122,7 +117,6 @@ PYI020.pyi:16:18: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -Suggested fix: 13 13 | def j() -> "int": ... # Y020 Quoted annotations should never be used in stubs 14 14 | Alias: TypeAlias = list["int"] # Y020 Quoted annotations should never be used in stubs 15 15 | @@ -144,7 +138,6 @@ PYI020.pyi:20:8: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -Suggested fix: 17 17 | """Documented and guaranteed useful.""" # Y021 Docstrings should not be included in stubs 18 18 | 19 19 | if sys.platform == "linux": @@ -167,7 +160,6 @@ PYI020.pyi:22:8: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -Suggested fix: 19 19 | if sys.platform == "linux": 20 20 | f: "int" # Y020 Quoted annotations should never be used in stubs 21 21 | elif sys.platform == "win32": @@ -190,7 +182,6 @@ PYI020.pyi:24:8: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -Suggested fix: 21 21 | elif sys.platform == "win32": 22 22 | f: "str" # Y020 Quoted annotations should never be used in stubs 23 23 | else: diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap index 931dbde8b028a..4531d8d65ca1c 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap @@ -9,7 +9,6 @@ PYI025_1.py:10:33: PYI025 [*] Use `from collections.abc import Set as AbstractSe | = help: Alias `Set` to `AbstractSet` -Suggested fix: 7 7 | 8 8 | 9 9 | def f(): @@ -31,7 +30,6 @@ PYI025_1.py:14:51: PYI025 [*] Use `from collections.abc import Set as AbstractSe | = help: Alias `Set` to `AbstractSet` -Suggested fix: 11 11 | 12 12 | 13 13 | def f(): diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap index 715cfa96b9e29..5d6686f8baddf 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap @@ -11,7 +11,6 @@ PYI025_1.pyi:8:33: PYI025 [*] Use `from collections.abc import Set as AbstractSe | = help: Alias `Set` to `AbstractSet` -Suggested fix: 5 5 | from collections.abc import Container, Sized, Set as AbstractSet, ValuesView # Ok 6 6 | 7 7 | def f(): @@ -33,7 +32,6 @@ PYI025_1.pyi:11:51: PYI025 [*] Use `from collections.abc import Set as AbstractS | = help: Alias `Set` to `AbstractSet` -Suggested fix: 8 8 | from collections.abc import Set # PYI025 9 9 | 10 10 | def f(): @@ -56,7 +54,6 @@ PYI025_1.pyi:16:37: PYI025 [*] Use `from collections.abc import Set as AbstractS | = help: Alias `Set` to `AbstractSet` -Suggested fix: 13 13 | def f(): 14 14 | """Test: local symbol renaming.""" 15 15 | if True: @@ -93,7 +90,6 @@ PYI025_1.pyi:33:29: PYI025 [*] Use `from collections.abc import Set as AbstractS | = help: Alias `Set` to `AbstractSet` -Suggested fix: 17 17 | else: 18 18 | Set = 1 19 19 | @@ -138,7 +134,6 @@ PYI025_1.pyi:44:33: PYI025 [*] Use `from collections.abc import Set as AbstractS | = help: Alias `Set` to `AbstractSet` -Suggested fix: 41 41 | 42 42 | def f(): 43 43 | """Test: nonlocal symbol renaming.""" diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap index 20653dbbfc398..4fc9b8b3ac89c 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap @@ -12,7 +12,6 @@ PYI025_2.py:3:29: PYI025 [*] Use `from collections.abc import Set as AbstractSet | = help: Alias `Set` to `AbstractSet` -Suggested fix: 1 1 | """Tests to ensure we correctly rename references inside `__all__`""" 2 2 | 3 |-from collections.abc import Set diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap index 1c6cc732fd9ab..651209aacb975 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap @@ -12,7 +12,6 @@ PYI025_2.pyi:3:29: PYI025 [*] Use `from collections.abc import Set as AbstractSe | = help: Alias `Set` to `AbstractSet` -Suggested fix: 1 1 | """Tests to ensure we correctly rename references inside `__all__`""" 2 2 | 3 |-from collections.abc import Set diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap index 61a3621f1a2dc..9171845dee44b 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap @@ -10,7 +10,6 @@ PYI025_3.py:6:36: PYI025 [*] Use `from collections.abc import Set as AbstractSet | = help: Alias `Set` to `AbstractSet` -Suggested fix: 3 3 | through usage of a "redundant" `import Set as Set` alias 4 4 | """ 5 5 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap index 357f383a48ee1..7e0cd0c7f6b8f 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap @@ -10,7 +10,6 @@ PYI025_3.pyi:6:36: PYI025 [*] Use `from collections.abc import Set as AbstractSe | = help: Alias `Set` to `AbstractSet` -Suggested fix: 3 3 | through usage of a "redundant" `import Set as Set` alias 4 4 | """ 5 5 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap index 3e10eba02a36a..30af752506f63 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap @@ -12,7 +12,6 @@ PYI026.pyi:3:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `NewAny: | = help: Add `TypeAlias` annotation -Suggested fix: 1 |-from typing import Literal, Any 1 |+from typing import Literal, Any, TypeAlias 2 2 | @@ -34,7 +33,6 @@ PYI026.pyi:4:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Optiona | = help: Add `TypeAlias` annotation -Suggested fix: 1 |-from typing import Literal, Any 1 |+from typing import Literal, Any, TypeAlias 2 2 | @@ -58,7 +56,6 @@ PYI026.pyi:5:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Foo: Ty | = help: Add `TypeAlias` annotation -Suggested fix: 1 |-from typing import Literal, Any 1 |+from typing import Literal, Any, TypeAlias 2 2 | @@ -82,7 +79,6 @@ PYI026.pyi:6:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `IntOrSt | = help: Add `TypeAlias` annotation -Suggested fix: 1 |-from typing import Literal, Any 1 |+from typing import Literal, Any, TypeAlias 2 2 | @@ -108,7 +104,6 @@ PYI026.pyi:7:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `AliasNo | = help: Add `TypeAlias` annotation -Suggested fix: 1 |-from typing import Literal, Any 1 |+from typing import Literal, Any, TypeAlias 2 2 | @@ -134,7 +129,6 @@ PYI026.pyi:17:5: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `FLAG_T | = help: Add `TypeAlias` annotation -Suggested fix: 1 |-from typing import Literal, Any 1 |+from typing import Literal, Any, TypeAlias 2 2 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI029_PYI029.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI029_PYI029.pyi.snap index 501226e552f07..11acaee7a8684 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI029_PYI029.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI029_PYI029.pyi.snap @@ -11,7 +11,6 @@ PYI029.pyi:10:9: PYI029 [*] Defining `__str__` in a stub is almost always redund | = help: Remove definition of `__str__` -Suggested fix: 7 7 | def __repr__(self, *, foo) -> str: ... 8 8 | 9 9 | class ShouldRemoveSingle: @@ -32,7 +31,6 @@ PYI029.pyi:13:9: PYI029 [*] Defining `__repr__` in a stub is almost always redun | = help: Remove definition of `__repr__` -Suggested fix: 10 10 | def __str__(self) -> builtins.str: ... # Error: PYI029 11 11 | 12 12 | class ShouldRemove: @@ -54,7 +52,6 @@ PYI029.pyi:14:9: PYI029 [*] Defining `__str__` in a stub is almost always redund | = help: Remove definition of `__str__` -Suggested fix: 11 11 | 12 12 | class ShouldRemove: 13 13 | def __repr__(self) -> str: ... # Error: PYI029 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap index e380847ee2364..67765151089b0 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap @@ -11,7 +11,6 @@ PYI030.py:9:9: PYI030 [*] Multiple literal members in a union. Use a single lite | = help: Replace with a single `Literal` -Suggested fix: 6 6 | field1: Literal[1] # OK 7 7 | 8 8 | # Should emit for duplicate field types. @@ -32,7 +31,6 @@ PYI030.py:12:17: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 9 9 | field2: Literal[1] | Literal[2] # Error 10 10 | 11 11 | # Should emit for union types in arguments. @@ -53,7 +51,6 @@ PYI030.py:17:16: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 14 14 | 15 15 | 16 16 | # Should emit for unions in return types. @@ -75,7 +72,6 @@ PYI030.py:22:9: PYI030 [*] Multiple literal members in a union. Use a single lit | = help: Replace with a single `Literal` -Suggested fix: 19 19 | 20 20 | 21 21 | # Should emit in longer unions, even if not directly adjacent. @@ -98,7 +94,6 @@ PYI030.py:23:9: PYI030 [*] Multiple literal members in a union. Use a single lit | = help: Replace with a single `Literal` -Suggested fix: 20 20 | 21 21 | # Should emit in longer unions, even if not directly adjacent. 22 22 | field3: Literal[1] | Literal[2] | str # Error @@ -120,7 +115,6 @@ PYI030.py:24:9: PYI030 [*] Multiple literal members in a union. Use a single lit | = help: Replace with a single `Literal` -Suggested fix: 21 21 | # Should emit in longer unions, even if not directly adjacent. 22 22 | field3: Literal[1] | Literal[2] | str # Error 23 23 | field4: str | Literal[1] | Literal[2] # Error @@ -143,7 +137,6 @@ PYI030.py:25:9: PYI030 [*] Multiple literal members in a union. Use a single lit | = help: Replace with a single `Literal` -Suggested fix: 22 22 | field3: Literal[1] | Literal[2] | str # Error 23 23 | field4: str | Literal[1] | Literal[2] # Error 24 24 | field5: Literal[1] | str | Literal[2] # Error @@ -165,7 +158,6 @@ PYI030.py:28:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 25 25 | field6: Literal[1] | bool | Literal[2] | str # Error 26 26 | 27 27 | # Should emit for non-type unions. @@ -187,7 +179,6 @@ PYI030.py:31:9: PYI030 [*] Multiple literal members in a union. Use a single lit | = help: Replace with a single `Literal` -Suggested fix: 28 28 | field7 = Literal[1] | Literal[2] # Error 29 29 | 30 30 | # Should emit for parenthesized unions. @@ -208,7 +199,6 @@ PYI030.py:34:9: PYI030 [*] Multiple literal members in a union. Use a single lit | = help: Replace with a single `Literal` -Suggested fix: 31 31 | field8: Literal[1] | (Literal[2] | str) # Error 32 32 | 33 33 | # Should handle user parentheses when fixing. @@ -231,7 +221,6 @@ PYI030.py:35:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 32 32 | 33 33 | # Should handle user parentheses when fixing. 34 34 | field9: Literal[1] | (Literal[2] | str) # Error @@ -253,7 +242,6 @@ PYI030.py:38:15: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 35 35 | field10: (Literal[1] | str) | Literal[2] # Error 36 36 | 37 37 | # Should emit for union in generic parent type. @@ -274,7 +262,6 @@ PYI030.py:41:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 38 38 | field11: dict[Literal[1] | Literal[2], str] # Error 39 39 | 40 40 | # Should emit for unions with more than two cases @@ -297,7 +284,6 @@ PYI030.py:42:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 39 39 | 40 40 | # Should emit for unions with more than two cases 41 41 | field12: Literal[1] | Literal[2] | Literal[3] # Error @@ -319,7 +305,6 @@ PYI030.py:45:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 42 42 | field13: Literal[1] | Literal[2] | Literal[3] | Literal[4] # Error 43 43 | 44 44 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -341,7 +326,6 @@ PYI030.py:48:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 45 45 | field14: Literal[1] | Literal[2] | str | Literal[3] # Error 46 46 | 47 47 | # Should emit for unions with mixed literal internal types @@ -363,7 +347,6 @@ PYI030.py:51:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 48 48 | field15: Literal[1] | Literal["foo"] | Literal[True] # Error 49 49 | 50 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 @@ -385,7 +368,6 @@ PYI030.py:60:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 57 57 | field18: dict[Literal[1], Literal[2]] # OK 58 58 | 59 59 | # Should respect name of literal type used @@ -413,7 +395,6 @@ PYI030.py:63:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 60 60 | field19: typing.Literal[1] | typing.Literal[2] # Error 61 61 | 62 62 | # Should emit in cases with newlines @@ -440,7 +421,6 @@ PYI030.py:71:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 68 68 | ] # Error, newline and comment will not be emitted in message 69 69 | 70 70 | # Should handle multiple unions with multiple members @@ -462,7 +442,6 @@ PYI030.py:74:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 71 71 | field21: Literal[1, 2] | Literal[3, 4] # Error 72 72 | 73 73 | # Should emit in cases with `typing.Union` instead of `|` @@ -484,7 +463,6 @@ PYI030.py:77:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 74 74 | field22: typing.Union[Literal[1], Literal[2]] # Error 75 75 | 76 76 | # Should emit in cases with `typing_extensions.Literal` @@ -506,7 +484,6 @@ PYI030.py:80:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 77 77 | field23: typing_extensions.Literal[1] | typing_extensions.Literal[2] # Error 78 78 | 79 79 | # Should emit in cases with nested `typing.Union` @@ -528,7 +505,6 @@ PYI030.py:83:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 80 80 | field24: typing.Union[Literal[1], typing.Union[Literal[2], str]] # Error 81 81 | 82 82 | # Should emit in cases with mixed `typing.Union` and `|` @@ -550,7 +526,6 @@ PYI030.py:86:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 83 83 | field25: typing.Union[Literal[1], Literal[2] | str] # Error 84 84 | 85 85 | # Should emit only once in cases with multiple nested `typing.Union` @@ -570,7 +545,6 @@ PYI030.py:89:10: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 86 86 | field24: typing.Union[Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]]] # Error 87 87 | 88 88 | # Should use the first literal subscript attribute when fixing diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap index 613db88ee15e3..316a9f1f8f183 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap @@ -11,7 +11,6 @@ PYI030.pyi:9:9: PYI030 [*] Multiple literal members in a union. Use a single lit | = help: Replace with a single `Literal` -Suggested fix: 6 6 | field1: Literal[1] # OK 7 7 | 8 8 | # Should emit for duplicate field types. @@ -32,7 +31,6 @@ PYI030.pyi:12:17: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 9 9 | field2: Literal[1] | Literal[2] # Error 10 10 | 11 11 | # Should emit for union types in arguments. @@ -53,7 +51,6 @@ PYI030.pyi:17:16: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 14 14 | 15 15 | 16 16 | # Should emit for unions in return types. @@ -75,7 +72,6 @@ PYI030.pyi:22:9: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 19 19 | 20 20 | 21 21 | # Should emit in longer unions, even if not directly adjacent. @@ -98,7 +94,6 @@ PYI030.pyi:23:9: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 20 20 | 21 21 | # Should emit in longer unions, even if not directly adjacent. 22 22 | field3: Literal[1] | Literal[2] | str # Error @@ -120,7 +115,6 @@ PYI030.pyi:24:9: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 21 21 | # Should emit in longer unions, even if not directly adjacent. 22 22 | field3: Literal[1] | Literal[2] | str # Error 23 23 | field4: str | Literal[1] | Literal[2] # Error @@ -143,7 +137,6 @@ PYI030.pyi:25:9: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 22 22 | field3: Literal[1] | Literal[2] | str # Error 23 23 | field4: str | Literal[1] | Literal[2] # Error 24 24 | field5: Literal[1] | str | Literal[2] # Error @@ -165,7 +158,6 @@ PYI030.pyi:28:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 25 25 | field6: Literal[1] | bool | Literal[2] | str # Error 26 26 | 27 27 | # Should emit for non-type unions. @@ -187,7 +179,6 @@ PYI030.pyi:31:9: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 28 28 | field7 = Literal[1] | Literal[2] # Error 29 29 | 30 30 | # Should emit for parenthesized unions. @@ -208,7 +199,6 @@ PYI030.pyi:34:9: PYI030 [*] Multiple literal members in a union. Use a single li | = help: Replace with a single `Literal` -Suggested fix: 31 31 | field8: Literal[1] | (Literal[2] | str) # Error 32 32 | 33 33 | # Should handle user parentheses when fixing. @@ -231,7 +221,6 @@ PYI030.pyi:35:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 32 32 | 33 33 | # Should handle user parentheses when fixing. 34 34 | field9: Literal[1] | (Literal[2] | str) # Error @@ -253,7 +242,6 @@ PYI030.pyi:38:15: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 35 35 | field10: (Literal[1] | str) | Literal[2] # Error 36 36 | 37 37 | # Should emit for union in generic parent type. @@ -274,7 +262,6 @@ PYI030.pyi:41:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 38 38 | field11: dict[Literal[1] | Literal[2], str] # Error 39 39 | 40 40 | # Should emit for unions with more than two cases @@ -297,7 +284,6 @@ PYI030.pyi:42:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 39 39 | 40 40 | # Should emit for unions with more than two cases 41 41 | field12: Literal[1] | Literal[2] | Literal[3] # Error @@ -319,7 +305,6 @@ PYI030.pyi:45:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 42 42 | field13: Literal[1] | Literal[2] | Literal[3] | Literal[4] # Error 43 43 | 44 44 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -341,7 +326,6 @@ PYI030.pyi:48:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 45 45 | field14: Literal[1] | Literal[2] | str | Literal[3] # Error 46 46 | 47 47 | # Should emit for unions with mixed literal internal types @@ -363,7 +347,6 @@ PYI030.pyi:51:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 48 48 | field15: Literal[1] | Literal["foo"] | Literal[True] # Error 49 49 | 50 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 @@ -385,7 +368,6 @@ PYI030.pyi:60:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 57 57 | field18: dict[Literal[1], Literal[2]] # OK 58 58 | 59 59 | # Should respect name of literal type used @@ -413,7 +395,6 @@ PYI030.pyi:63:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 60 60 | field19: typing.Literal[1] | typing.Literal[2] # Error 61 61 | 62 62 | # Should emit in cases with newlines @@ -440,7 +421,6 @@ PYI030.pyi:71:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 68 68 | ] # Error, newline and comment will not be emitted in message 69 69 | 70 70 | # Should handle multiple unions with multiple members @@ -462,7 +442,6 @@ PYI030.pyi:74:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 71 71 | field21: Literal[1, 2] | Literal[3, 4] # Error 72 72 | 73 73 | # Should emit in cases with `typing.Union` instead of `|` @@ -484,7 +463,6 @@ PYI030.pyi:77:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 74 74 | field22: typing.Union[Literal[1], Literal[2]] # Error 75 75 | 76 76 | # Should emit in cases with `typing_extensions.Literal` @@ -506,7 +484,6 @@ PYI030.pyi:80:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 77 77 | field23: typing_extensions.Literal[1] | typing_extensions.Literal[2] # Error 78 78 | 79 79 | # Should emit in cases with nested `typing.Union` @@ -528,7 +505,6 @@ PYI030.pyi:83:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 80 80 | field24: typing.Union[Literal[1], typing.Union[Literal[2], str]] # Error 81 81 | 82 82 | # Should emit in cases with mixed `typing.Union` and `|` @@ -550,7 +526,6 @@ PYI030.pyi:86:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 83 83 | field25: typing.Union[Literal[1], Literal[2] | str] # Error 84 84 | 85 85 | # Should emit only once in cases with multiple nested `typing.Union` @@ -570,7 +545,6 @@ PYI030.pyi:89:10: PYI030 [*] Multiple literal members in a union. Use a single l | = help: Replace with a single `Literal` -Suggested fix: 86 86 | field24: typing.Union[Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]]] # Error 87 87 | 88 88 | # Should use the first literal subscript attribute when fixing diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.py.snap index 0d1b7588df80e..2812736eb793c 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.py.snap @@ -10,7 +10,6 @@ PYI032.py:6:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to | = help: Replace with `object` -Suggested fix: 3 3 | 4 4 | 5 5 | class Bad: @@ -31,7 +30,6 @@ PYI032.py:7:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to | = help: Replace with `object` -Suggested fix: 4 4 | 5 5 | class Bad: 6 6 | def __eq__(self, other: Any) -> bool: ... # Y032 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.pyi.snap index 174c4b0be2fab..41fcde5b465cf 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.pyi.snap @@ -10,7 +10,6 @@ PYI032.pyi:6:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to | = help: Replace with `object` -Suggested fix: 3 3 | 4 4 | 5 5 | class Bad: @@ -31,7 +30,6 @@ PYI032.pyi:7:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to | = help: Replace with `object` -Suggested fix: 4 4 | 5 5 | class Bad: 6 6 | def __eq__(self, other: Any) -> bool: ... # Y032 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.py.snap index bcb4028d87577..6bf34fe6f9cbe 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.py.snap @@ -10,7 +10,6 @@ PYI036.py:54:31: PYI036 [*] Star-args in `__exit__` should be annotated with `ob | = help: Annotate star-args with `object` -Suggested fix: 51 51 | 52 52 | 53 53 | class BadOne: @@ -113,7 +112,6 @@ PYI036.py:70:58: PYI036 [*] Star-args in `__exit__` should be annotated with `ob | = help: Annotate star-args with `object` -Suggested fix: 67 67 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException | None, __tb: typing.Union[TracebackType, None, int]) -> bool | None: ... # PYI036: Third arg has bad annotation 68 68 | 69 69 | class BadFive: @@ -136,7 +134,6 @@ PYI036.py:71:74: PYI036 [*] Star-args in `__aexit__` should be annotated with `o | = help: Annotate star-args with `object` -Suggested fix: 68 68 | 69 69 | class BadFive: 70 70 | def __exit__(self, typ: BaseException | None, *args: list[str]) -> bool: ... # PYI036: Bad star-args annotation diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.pyi.snap index 998d3828c709b..2225b779921ce 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.pyi.snap @@ -10,7 +10,6 @@ PYI036.pyi:54:31: PYI036 [*] Star-args in `__exit__` should be annotated with `o | = help: Annotate star-args with `object` -Suggested fix: 51 51 | 52 52 | 53 53 | class BadOne: @@ -123,7 +122,6 @@ PYI036.pyi:70:58: PYI036 [*] Star-args in `__exit__` should be annotated with `o | = help: Annotate star-args with `object` -Suggested fix: 67 67 | async def __aexit__(self, __typ: type[BaseException] | None, __exc: BaseException | None, __tb: typing.Union[TracebackType, None, int]) -> bool | None: ... # PYI036: Third arg has bad annotation 68 68 | 69 69 | class BadFive: @@ -146,7 +144,6 @@ PYI036.pyi:71:74: PYI036 [*] Star-args in `__aexit__` should be annotated with ` | = help: Annotate star-args with `object` -Suggested fix: 68 68 | 69 69 | class BadFive: 70 70 | def __exit__(self, typ: BaseException | None, *args: list[str]) -> bool: ... # PYI036: Bad star-args annotation diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap index bf5d379cc6283..74f9cff63db1a 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap @@ -12,7 +12,6 @@ PYI053.pyi:7:14: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -Suggested fix: 4 4 | 5 5 | def f1(x: str = "50 character stringggggggggggggggggggggggggggggggg") -> None: ... # OK 6 6 | def f2( @@ -35,7 +34,6 @@ PYI053.pyi:13:14: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -Suggested fix: 10 10 | x: str = "50 character stringgggggggggggggggggggggggggggggg\U0001f600", # OK 11 11 | ) -> None: ... 12 12 | def f4( @@ -57,7 +55,6 @@ PYI053.pyi:25:16: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -Suggested fix: 22 22 | x: bytes = b"50 character byte stringggggggggggggggggggggggggg\xff", # OK 23 23 | ) -> None: ... 24 24 | def f8( @@ -80,7 +77,6 @@ PYI053.pyi:30:12: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -Suggested fix: 27 27 | 28 28 | foo: str = "50 character stringggggggggggggggggggggggggggggggg" # OK 29 29 | @@ -103,7 +99,6 @@ PYI053.pyi:34:14: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -Suggested fix: 31 31 | 32 32 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK 33 33 | @@ -126,7 +121,6 @@ PYI053.pyi:38:13: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -Suggested fix: 35 35 | 36 36 | ffoo: str = f"50 character stringggggggggggggggggggggggggggggggg" # OK 37 37 | @@ -148,7 +142,6 @@ PYI053.pyi:64:5: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -Suggested fix: 61 61 | ) -> Callable[[Callable[[], None]], Callable[[], None]]: ... 62 62 | 63 63 | @not_warnings_dot_deprecated( @@ -169,7 +162,6 @@ PYI053.pyi:68:13: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -Suggested fix: 65 65 | ) 66 66 | def not_a_deprecated_function() -> None: ... 67 67 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap index 5d58e19257d1e..0fc04f8615f87 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap @@ -11,7 +11,6 @@ PYI054.pyi:2:16: PYI054 [*] Numeric literals with a string representation longer | = help: Replace with `...` -Suggested fix: 1 1 | field01: int = 0xFFFFFFFF 2 |-field02: int = 0xFFFFFFFFF # Error: PYI054 2 |+field02: int = ... # Error: PYI054 @@ -32,7 +31,6 @@ PYI054.pyi:4:17: PYI054 [*] Numeric literals with a string representation longer | = help: Replace with `...` -Suggested fix: 1 1 | field01: int = 0xFFFFFFFF 2 2 | field02: int = 0xFFFFFFFFF # Error: PYI054 3 3 | field03: int = -0xFFFFFFFF @@ -55,7 +53,6 @@ PYI054.pyi:8:16: PYI054 [*] Numeric literals with a string representation longer | = help: Replace with `...` -Suggested fix: 5 5 | 6 6 | field05: int = 1234567890 7 7 | field06: int = 12_456_890 @@ -78,7 +75,6 @@ PYI054.pyi:10:17: PYI054 [*] Numeric literals with a string representation longe | = help: Replace with `...` -Suggested fix: 7 7 | field06: int = 12_456_890 8 8 | field07: int = 12345678901 # Error: PYI054 9 9 | field08: int = -1234567801 @@ -100,7 +96,6 @@ PYI054.pyi:13:18: PYI054 [*] Numeric literals with a string representation longe | = help: Replace with `...` -Suggested fix: 10 10 | field09: int = -234_567_890 # Error: PYI054 11 11 | 12 12 | field10: float = 123.456789 @@ -123,7 +118,6 @@ PYI054.pyi:15:19: PYI054 [*] Numeric literals with a string representation longe | = help: Replace with `...` -Suggested fix: 12 12 | field10: float = 123.456789 13 13 | field11: float = 123.4567890 # Error: PYI054 14 14 | field12: float = -123.456789 @@ -145,7 +139,6 @@ PYI054.pyi:18:20: PYI054 [*] Numeric literals with a string representation longe | = help: Replace with `...` -Suggested fix: 15 15 | field13: float = -123.567_890 # Error: PYI054 16 16 | 17 17 | field14: complex = 1e1234567j @@ -165,7 +158,6 @@ PYI054.pyi:20:20: PYI054 [*] Numeric literals with a string representation longe | = help: Replace with `...` -Suggested fix: 17 17 | field14: complex = 1e1234567j 18 18 | field15: complex = 1e12345678j # Error: PYI054 19 19 | field16: complex = -1e1234567j diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.py.snap index 1d4b1ff4d033d..cca2aafb26b59 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.py.snap @@ -11,7 +11,6 @@ PYI055.py:31:8: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -Suggested fix: 28 28 | 29 29 | def func(): 30 30 | # PYI055 @@ -32,7 +31,6 @@ PYI055.py:32:8: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -Suggested fix: 29 29 | def func(): 30 30 | # PYI055 31 31 | x: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker @@ -52,7 +50,6 @@ PYI055.py:39:8: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -Suggested fix: 36 36 | from typing import Union as U 37 37 | 38 38 | # PYI055 @@ -75,7 +72,6 @@ PYI055.py:44:9: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -Suggested fix: 41 41 | 42 42 | def convert_union(union: UnionType) -> _T | None: 43 43 | converters: tuple[ @@ -98,7 +94,6 @@ PYI055.py:50:15: PYI055 [*] Multiple `type` members in a union. Combine them int | = help: Combine multiple `type` members -Suggested fix: 47 47 | 48 48 | def convert_union(union: UnionType) -> _T | None: 49 49 | converters: tuple[ @@ -121,7 +116,6 @@ PYI055.py:56:15: PYI055 [*] Multiple `type` members in a union. Combine them int | = help: Combine multiple `type` members -Suggested fix: 53 53 | 54 54 | def convert_union(union: UnionType) -> _T | None: 55 55 | converters: tuple[ @@ -144,7 +138,6 @@ PYI055.py:62:15: PYI055 [*] Multiple `type` members in a union. Combine them int | = help: Combine multiple `type` members -Suggested fix: 59 59 | 60 60 | def convert_union(union: UnionType) -> _T | None: 61 61 | converters: tuple[ diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.pyi.snap index b2d27a7a7f091..2887197d4322f 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.pyi.snap @@ -12,7 +12,6 @@ PYI055.pyi:4:4: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -Suggested fix: 1 1 | import builtins 2 2 | from typing import Union 3 3 | @@ -34,7 +33,6 @@ PYI055.pyi:5:4: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -Suggested fix: 2 2 | from typing import Union 3 3 | 4 4 | w: builtins.type[int] | builtins.type[str] | builtins.type[complex] @@ -57,7 +55,6 @@ PYI055.pyi:6:4: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -Suggested fix: 3 3 | 4 4 | w: builtins.type[int] | builtins.type[str] | builtins.type[complex] 5 5 | x: type[int] | type[str] | type[float] @@ -79,7 +76,6 @@ PYI055.pyi:7:4: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -Suggested fix: 4 4 | w: builtins.type[int] | builtins.type[str] | builtins.type[complex] 5 5 | x: type[int] | type[str] | type[float] 6 6 | y: builtins.type[int] | type[str] | builtins.type[complex] @@ -102,7 +98,6 @@ PYI055.pyi:8:4: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -Suggested fix: 5 5 | x: type[int] | type[str] | type[float] 6 6 | y: builtins.type[int] | type[str] | builtins.type[complex] 7 7 | z: Union[type[float], type[complex]] @@ -125,7 +120,6 @@ PYI055.pyi:10:15: PYI055 [*] Multiple `type` members in a union. Combine them in | = help: Combine multiple `type` members -Suggested fix: 7 7 | z: Union[type[float], type[complex]] 8 8 | z: Union[type[float, int], type[complex]] 9 9 | @@ -147,7 +141,6 @@ PYI055.pyi:20:7: PYI055 [*] Multiple `type` members in a union. Combine them int | = help: Combine multiple `type` members -Suggested fix: 17 17 | def func(arg: type[int, float] | str) -> None: ... 18 18 | 19 19 | # OK @@ -169,7 +162,6 @@ PYI055.pyi:24:11: PYI055 [*] Multiple `type` members in a union. Combine them in | = help: Combine multiple `type` members -Suggested fix: 21 21 | 22 22 | def func(): 23 23 | # PYI055 @@ -188,7 +180,6 @@ PYI055.pyi:25:12: PYI055 [*] Multiple `type` members in a union. Combine them in | = help: Combine multiple `type` members -Suggested fix: 22 22 | def func(): 23 23 | # PYI055 24 24 | item: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.py.snap index 5b43a330597bc..611ba91607b1c 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.py.snap @@ -10,7 +10,6 @@ PYI058.py:5:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter | = help: Convert the return annotation of your `__iter__` method to `Iterator` -Suggested fix: 1 |+from collections.abc import Iterator 1 2 | def scope(): 2 3 | from collections.abc import Generator @@ -33,7 +32,6 @@ PYI058.py:13:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite | = help: Convert the return annotation of your `__iter__` method to `Iterator` -Suggested fix: 10 10 | import typing 11 11 | 12 12 | class IteratorReturningSimpleGenerator2: @@ -54,7 +52,6 @@ PYI058.py:21:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite | = help: Convert the return annotation of your `__iter__` method to `Iterator` -Suggested fix: 18 18 | import collections.abc 19 19 | 20 20 | class IteratorReturningSimpleGenerator3: @@ -75,7 +72,6 @@ PYI058.py:30:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite | = help: Convert the return annotation of your `__iter__` method to `Iterator` -Suggested fix: 27 27 | from typing import Any 28 28 | 29 29 | class IteratorReturningSimpleGenerator4: @@ -96,7 +92,6 @@ PYI058.py:39:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite | = help: Convert the return annotation of your `__iter__` method to `Iterator` -Suggested fix: 36 36 | import typing 37 37 | 38 38 | class IteratorReturningSimpleGenerator5: @@ -117,7 +112,6 @@ PYI058.py:47:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite | = help: Convert the return annotation of your `__iter__` method to `Iterator` -Suggested fix: 1 |+from collections.abc import Iterator 1 2 | def scope(): 2 3 | from collections.abc import Generator @@ -144,7 +138,6 @@ PYI058.py:55:13: PYI058 [*] Use `AsyncIterator` as the return value for simple ` | = help: Convert the return annotation of your `__aiter__` method to `AsyncIterator` -Suggested fix: 54 54 | class AsyncIteratorReturningSimpleAsyncGenerator1: 55 55 | def __aiter__( 56 56 | self, @@ -165,7 +158,6 @@ PYI058.py:73:13: PYI058 [*] Use `AsyncIterator` as the return value for simple ` | = help: Convert the return annotation of your `__aiter__` method to `AsyncIterator` -Suggested fix: 70 70 | import collections.abc 71 71 | 72 72 | class AsyncIteratorReturningSimpleAsyncGenerator3: diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap index f25449e417c05..d6aa24e2b32b1 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap @@ -11,7 +11,6 @@ PYI058.pyi:5:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite | = help: Convert the return annotation of your `__iter__` method to `Iterator` -Suggested fix: 1 |+from collections.abc import Iterator 1 2 | def scope(): 2 3 | from collections.abc import Generator @@ -35,7 +34,6 @@ PYI058.pyi:11:13: PYI058 [*] Use `Iterator` as the return value for simple `__it | = help: Convert the return annotation of your `__iter__` method to `Iterator` -Suggested fix: 8 8 | import typing 9 9 | 10 10 | class IteratorReturningSimpleGenerator2: @@ -57,7 +55,6 @@ PYI058.pyi:17:13: PYI058 [*] Use `Iterator` as the return value for simple `__it | = help: Convert the return annotation of your `__iter__` method to `Iterator` -Suggested fix: 14 14 | import collections.abc 15 15 | 16 16 | class IteratorReturningSimpleGenerator3: @@ -79,7 +76,6 @@ PYI058.pyi:24:13: PYI058 [*] Use `Iterator` as the return value for simple `__it | = help: Convert the return annotation of your `__iter__` method to `Iterator` -Suggested fix: 21 21 | from typing import Any 22 22 | 23 23 | class IteratorReturningSimpleGenerator4: @@ -101,7 +97,6 @@ PYI058.pyi:31:13: PYI058 [*] Use `Iterator` as the return value for simple `__it | = help: Convert the return annotation of your `__iter__` method to `Iterator` -Suggested fix: 28 28 | import typing 29 29 | 30 30 | class IteratorReturningSimpleGenerator5: @@ -123,7 +118,6 @@ PYI058.pyi:37:13: PYI058 [*] Use `Iterator` as the return value for simple `__it | = help: Convert the return annotation of your `__iter__` method to `Iterator` -Suggested fix: 1 |+from collections.abc import Iterator 1 2 | def scope(): 2 3 | from collections.abc import Generator @@ -150,7 +144,6 @@ PYI058.pyi:43:13: PYI058 [*] Use `AsyncIterator` as the return value for simple | = help: Convert the return annotation of your `__aiter__` method to `AsyncIterator` -Suggested fix: 40 40 | import typing_extensions 41 41 | 42 42 | class AsyncIteratorReturningSimpleAsyncGenerator1: @@ -171,7 +164,6 @@ PYI058.pyi:49:13: PYI058 [*] Use `AsyncIterator` as the return value for simple | = help: Convert the return annotation of your `__aiter__` method to `AsyncIterator` -Suggested fix: 46 46 | import collections.abc 47 47 | 48 48 | class AsyncIteratorReturningSimpleAsyncGenerator3: @@ -193,7 +185,6 @@ PYI058.pyi:56:13: PYI058 [*] Use `AsyncIterator` as the return value for simple | = help: Convert the return annotation of your `__aiter__` method to `AsyncIterator` -Suggested fix: 53 53 | import collections.abc 54 54 | 55 55 | class AsyncIteratorReturningSimpleAsyncGenerator3: diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap index 0d996b58020cb..ad31c6f238068 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap @@ -12,7 +12,6 @@ PYI059.py:8:17: PYI059 [*] `Generic[]` should always be the last base class | = help: Move `Generic[]` to the end -Suggested fix: 5 5 | K = TypeVar('K') 6 6 | V = TypeVar('V') 7 7 | @@ -39,7 +38,6 @@ PYI059.py:15:16: PYI059 [*] `Generic[]` should always be the last base class | = help: Move `Generic[]` to the end -Suggested fix: 13 13 | self._items.append(item) 14 14 | 15 15 | class MyMapping( # PYI059 @@ -63,7 +61,6 @@ PYI059.py:26:10: PYI059 [*] `Generic[]` should always be the last base class | = help: Move `Generic[]` to the end -Suggested fix: 23 23 | # Inheriting from just `Generic` is a TypeError, but it's probably fine 24 24 | # to flag this issue in this case as well, since after fixing the error 25 25 | # the Generic's position issue persists. @@ -94,7 +91,6 @@ PYI059.py:30:10: PYI059 [*] `Generic[]` should always be the last base class | = help: Move `Generic[]` to the end -Suggested fix: 30 30 | class Foo( # comment about the bracket 31 31 | # Part 1 of multiline comment 1 32 32 | # Part 2 of multiline comment 1 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap index 8faa775a90c76..a69905cfc2825 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap @@ -12,7 +12,6 @@ PYI059.pyi:8:17: PYI059 [*] `Generic[]` should always be the last base class | = help: Move `Generic[]` to the end -Suggested fix: 5 5 | K = TypeVar('K') 6 6 | V = TypeVar('V') 7 7 | @@ -39,7 +38,6 @@ PYI059.pyi:12:16: PYI059 [*] `Generic[]` should always be the last base class | = help: Move `Generic[]` to the end -Suggested fix: 10 10 | def push(self, item: T) -> None: ... 11 11 | 12 12 | class MyMapping( # PYI059 @@ -62,7 +60,6 @@ PYI059.pyi:22:10: PYI059 [*] `Generic[]` should always be the last base class | = help: Move `Generic[]` to the end -Suggested fix: 19 19 | # Inheriting from just `Generic` is a TypeError, but it's probably fine 20 20 | # to flag this issue in this case as well, since after fixing the error 21 21 | # the Generic's position issue persists. @@ -93,7 +90,6 @@ PYI059.pyi:25:10: PYI059 [*] `Generic[]` should always be the last base class | = help: Move `Generic[]` to the end -Suggested fix: 25 25 | class Foo( # comment about the bracket 26 26 | # Part 1 of multiline comment 1 27 27 | # Part 2 of multiline comment 1 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap index 29434230bf97a..a64b9538e9b9d 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap @@ -12,7 +12,6 @@ PYI064.py:3:1: PYI064 [*] `Final[Literal[True]]` can be replaced with a bare `Fi | = help: Replace with `Final` -Suggested fix: 1 1 | from typing import Final, Literal 2 2 | 3 |-x: Final[Literal[True]] = True # PYI064 @@ -33,7 +32,6 @@ PYI064.py:4:1: PYI064 [*] `Final[Literal[None]]` can be replaced with a bare `Fi | = help: Replace with `Final` -Suggested fix: 1 1 | from typing import Final, Literal 2 2 | 3 3 | x: Final[Literal[True]] = True # PYI064 @@ -58,7 +56,6 @@ PYI064.py:5:1: PYI064 [*] `Final[Literal[...]]` can be replaced with a bare `Fin | = help: Replace with `Final` -Suggested fix: 2 2 | 3 3 | x: Final[Literal[True]] = True # PYI064 4 4 | y: Final[Literal[None]] = None # PYI064 @@ -82,7 +79,6 @@ PYI064.py:10:1: PYI064 [*] `Final[Literal[123]]` can be replaced with a bare `Fi | = help: Replace with `Final` -Suggested fix: 7 7 | ]] = "this is a really long literal, that won't be rendered in the issue text" 8 8 | 9 9 | # This should be fixable, and marked as safe diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap index 54fd185434f61..523e35383243c 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap @@ -12,7 +12,6 @@ PYI064.pyi:3:1: PYI064 [*] `Final[Literal[True]]` can be replaced with a bare `F | = help: Replace with `Final` -Suggested fix: 1 1 | from typing import Final, Literal 2 2 | 3 |-x: Final[Literal[True]] # PYI064 @@ -32,7 +31,6 @@ PYI064.pyi:4:1: PYI064 [*] `Final[Literal[None]]` can be replaced with a bare `F | = help: Replace with `Final` -Suggested fix: 1 1 | from typing import Final, Literal 2 2 | 3 3 | x: Final[Literal[True]] # PYI064 @@ -55,7 +53,6 @@ PYI064.pyi:5:1: PYI064 [*] `Final[Literal[...]]` can be replaced with a bare `Fi | = help: Replace with `Final` -Suggested fix: 2 2 | 3 3 | x: Final[Literal[True]] # PYI064 4 4 | y: Final[Literal[None]] = None # PYI064 @@ -77,7 +74,6 @@ PYI064.pyi:8:1: PYI064 [*] `Final[Literal[123]]` can be replaced with a bare `Fi | = help: Replace with `Final` -Suggested fix: 5 5 | z: Final[Literal["this is a really long literal, that won't be rendered in the issue text"]] # PYI064 6 6 | 7 7 | # This should be fixable, and marked as safe diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap index ec8fe0f81320d..10316a0690774 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap @@ -12,7 +12,6 @@ PYI026.pyi:3:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g | = help: Add `TypeAlias` annotation -Suggested fix: 1 1 | from typing import Literal, Any 2 |+import typing_extensions 2 3 | @@ -34,7 +33,6 @@ PYI026.pyi:4:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g | = help: Add `TypeAlias` annotation -Suggested fix: 1 1 | from typing import Literal, Any 2 |+import typing_extensions 2 3 | @@ -58,7 +56,6 @@ PYI026.pyi:5:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g | = help: Add `TypeAlias` annotation -Suggested fix: 1 1 | from typing import Literal, Any 2 |+import typing_extensions 2 3 | @@ -82,7 +79,6 @@ PYI026.pyi:6:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g | = help: Add `TypeAlias` annotation -Suggested fix: 1 1 | from typing import Literal, Any 2 |+import typing_extensions 2 3 | @@ -108,7 +104,6 @@ PYI026.pyi:7:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g | = help: Add `TypeAlias` annotation -Suggested fix: 1 1 | from typing import Literal, Any 2 |+import typing_extensions 2 3 | @@ -134,7 +129,6 @@ PYI026.pyi:17:5: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e. | = help: Add `TypeAlias` annotation -Suggested fix: 1 1 | from typing import Literal, Any 2 |+import typing_extensions 2 3 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_default.snap index ddc5c50905aac..3bfb5d5d918ce 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_default.snap @@ -10,7 +10,6 @@ PT001.py:9:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` | = help: Add parentheses -Suggested fix: 6 6 | # `import pytest` 7 7 | 8 8 | @@ -31,7 +30,6 @@ PT001.py:34:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` | = help: Add parentheses -Suggested fix: 31 31 | # `from pytest import fixture` 32 32 | 33 33 | @@ -52,7 +50,6 @@ PT001.py:59:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` | = help: Add parentheses -Suggested fix: 56 56 | # `from pytest import fixture as aliased` 57 57 | 58 58 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_no_parentheses.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_no_parentheses.snap index f0a1b418433a9..c52c1c2f6d9bc 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_no_parentheses.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_no_parentheses.snap @@ -10,7 +10,6 @@ PT001.py:14:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | = help: Remove parentheses -Suggested fix: 11 11 | return 42 12 12 | 13 13 | @@ -33,7 +32,6 @@ PT001.py:24:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | = help: Remove parentheses -Suggested fix: 21 21 | return 42 22 22 | 23 23 | @@ -56,7 +54,6 @@ PT001.py:39:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | = help: Remove parentheses -Suggested fix: 36 36 | return 42 37 37 | 38 38 | @@ -79,7 +76,6 @@ PT001.py:49:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | = help: Remove parentheses -Suggested fix: 46 46 | return 42 47 47 | 48 48 | @@ -102,7 +98,6 @@ PT001.py:64:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | = help: Remove parentheses -Suggested fix: 61 61 | return 42 62 62 | 63 63 | @@ -125,7 +120,6 @@ PT001.py:74:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | = help: Remove parentheses -Suggested fix: 71 71 | return 42 72 72 | 73 73 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap index 0f8d2b2a3c4ee..b27f08d42c354 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap @@ -10,7 +10,6 @@ PT003.py:14:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -Suggested fix: 11 11 | ... 12 12 | 13 13 | @@ -31,7 +30,6 @@ PT003.py:19:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -Suggested fix: 16 16 | ... 17 17 | 18 18 | @@ -52,7 +50,6 @@ PT003.py:24:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -Suggested fix: 21 21 | ... 22 22 | 23 23 | @@ -73,7 +70,6 @@ PT003.py:29:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -Suggested fix: 26 26 | ... 27 27 | 28 28 | @@ -96,7 +92,6 @@ PT003.py:37:31: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -Suggested fix: 34 34 | # pytest.fixture does not take positional arguments, however this 35 35 | # tests the general case as we use a helper function that should 36 36 | # work for all cases. @@ -118,7 +113,6 @@ PT003.py:43:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -Suggested fix: 40 40 | 41 41 | 42 42 | @pytest.fixture( @@ -140,7 +134,6 @@ PT003.py:52:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -Suggested fix: 49 49 | 50 50 | @pytest.fixture( 51 51 | name="my_fixture", @@ -163,7 +156,6 @@ PT003.py:66:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -Suggested fix: 63 63 | 64 64 | # another comment ,) 65 65 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap index 8985498320d84..1df658037c41a 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap @@ -10,7 +10,6 @@ PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string of comma-separated values for the first argument -Suggested fix: 21 21 | ... 22 22 | 23 23 | @@ -31,7 +30,6 @@ PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string for the first argument -Suggested fix: 26 26 | ... 27 27 | 28 28 | @@ -52,7 +50,6 @@ PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string of comma-separated values for the first argument -Suggested fix: 31 31 | ... 32 32 | 33 33 | @@ -73,7 +70,6 @@ PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string for the first argument -Suggested fix: 36 36 | ... 37 37 | 38 38 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap index dba252fbb5030..220f99de16140 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap @@ -10,7 +10,6 @@ PT006.py:9:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.pa | = help: Use a `tuple` for the first argument -Suggested fix: 6 6 | ... 7 7 | 8 8 | @@ -31,7 +30,6 @@ PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -Suggested fix: 11 11 | ... 12 12 | 13 13 | @@ -52,7 +50,6 @@ PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -Suggested fix: 16 16 | ... 17 17 | 18 18 | @@ -73,7 +70,6 @@ PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string for the first argument -Suggested fix: 26 26 | ... 27 27 | 28 28 | @@ -94,7 +90,6 @@ PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -Suggested fix: 31 31 | ... 32 32 | 33 33 | @@ -115,7 +110,6 @@ PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string for the first argument -Suggested fix: 36 36 | ... 37 37 | 38 38 | @@ -136,7 +130,6 @@ PT006.py:44:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -Suggested fix: 41 41 | ... 42 42 | 43 43 | @@ -157,7 +150,6 @@ PT006.py:49:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -Suggested fix: 46 46 | ... 47 47 | 48 48 | @@ -178,7 +170,6 @@ PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -Suggested fix: 51 51 | ... 52 52 | 53 53 | @@ -199,7 +190,6 @@ PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -Suggested fix: 56 56 | ... 57 57 | 58 58 | @@ -220,7 +210,6 @@ PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -Suggested fix: 61 61 | ... 62 62 | 63 63 | @@ -241,7 +230,6 @@ PT006.py:69:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -Suggested fix: 66 66 | ... 67 67 | 68 68 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap index 163c9da9d2d7d..9ce223af2cc01 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap @@ -10,7 +10,6 @@ PT006.py:9:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.pa | = help: Use a `list` for the first argument -Suggested fix: 6 6 | ... 7 7 | 8 8 | @@ -31,7 +30,6 @@ PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -Suggested fix: 11 11 | ... 12 12 | 13 13 | @@ -52,7 +50,6 @@ PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -Suggested fix: 16 16 | ... 17 17 | 18 18 | @@ -73,7 +70,6 @@ PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -Suggested fix: 21 21 | ... 22 22 | 23 23 | @@ -94,7 +90,6 @@ PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string for the first argument -Suggested fix: 26 26 | ... 27 27 | 28 28 | @@ -115,7 +110,6 @@ PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string for the first argument -Suggested fix: 36 36 | ... 37 37 | 38 38 | @@ -136,7 +130,6 @@ PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -Suggested fix: 51 51 | ... 52 52 | 53 53 | @@ -157,7 +150,6 @@ PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -Suggested fix: 56 56 | ... 57 57 | 58 58 | @@ -178,7 +170,6 @@ PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -Suggested fix: 61 61 | ... 62 62 | 63 63 | @@ -199,7 +190,6 @@ PT006.py:69:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -Suggested fix: 66 66 | ... 67 67 | 68 68 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_lists.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_lists.snap index eba5d9a4e8614..b9369c1101875 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_lists.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_lists.snap @@ -10,7 +10,6 @@ PT007.py:4:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -Suggested fix: 1 1 | import pytest 2 2 | 3 3 | @@ -37,7 +36,6 @@ PT007.py:11:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -Suggested fix: 8 8 | 9 9 | @pytest.mark.parametrize( 10 10 | ("param1", "param2"), @@ -64,7 +62,6 @@ PT007.py:12:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -Suggested fix: 9 9 | @pytest.mark.parametrize( 10 10 | ("param1", "param2"), 11 11 | ( @@ -87,7 +84,6 @@ PT007.py:13:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -Suggested fix: 10 10 | ("param1", "param2"), 11 11 | ( 12 12 | (1, 2), @@ -114,7 +110,6 @@ PT007.py:22:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -Suggested fix: 19 19 | 20 20 | @pytest.mark.parametrize( 21 21 | ("param1", "param2"), @@ -141,7 +136,6 @@ PT007.py:39:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -Suggested fix: 36 36 | @pytest.mark.parametrize( 37 37 | ("param1", "param2"), 38 38 | [ @@ -164,7 +158,6 @@ PT007.py:40:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -Suggested fix: 37 37 | ("param1", "param2"), 38 38 | [ 39 39 | (1, 2), @@ -186,7 +179,6 @@ PT007.py:81:38: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `list` of `list` for parameter values -Suggested fix: 78 78 | 79 79 | 80 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -208,7 +200,6 @@ PT007.py:81:39: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `list` of `list` for parameter values -Suggested fix: 78 78 | 79 79 | 80 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -230,7 +221,6 @@ PT007.py:81:47: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `list` of `list` for parameter values -Suggested fix: 78 78 | 79 79 | 80 80 | @pytest.mark.parametrize("a", [1, 2]) diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_tuples.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_tuples.snap index fa6d007fdb810..21214fd3d0606 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_tuples.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_tuples.snap @@ -10,7 +10,6 @@ PT007.py:4:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -Suggested fix: 1 1 | import pytest 2 2 | 3 3 | @@ -37,7 +36,6 @@ PT007.py:11:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -Suggested fix: 8 8 | 9 9 | @pytest.mark.parametrize( 10 10 | ("param1", "param2"), @@ -68,7 +66,6 @@ PT007.py:22:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -Suggested fix: 19 19 | 20 20 | @pytest.mark.parametrize( 21 21 | ("param1", "param2"), @@ -95,7 +92,6 @@ PT007.py:23:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -Suggested fix: 20 20 | @pytest.mark.parametrize( 21 21 | ("param1", "param2"), 22 22 | ( @@ -118,7 +114,6 @@ PT007.py:24:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -Suggested fix: 21 21 | ("param1", "param2"), 22 22 | ( 23 23 | [1, 2], @@ -141,7 +136,6 @@ PT007.py:50:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -Suggested fix: 47 47 | @pytest.mark.parametrize( 48 48 | ("param1", "param2"), 49 49 | [ @@ -164,7 +158,6 @@ PT007.py:51:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -Suggested fix: 48 48 | ("param1", "param2"), 49 49 | [ 50 50 | [1, 2], @@ -187,7 +180,6 @@ PT007.py:61:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -Suggested fix: 58 58 | @pytest.mark.parametrize( 59 59 | "param1,param2", 60 60 | [ @@ -210,7 +202,6 @@ PT007.py:62:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -Suggested fix: 59 59 | "param1,param2", 60 60 | [ 61 61 | [1, 2], @@ -232,7 +223,6 @@ PT007.py:81:38: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `list` of `tuple` for parameter values -Suggested fix: 78 78 | 79 79 | 80 80 | @pytest.mark.parametrize("a", [1, 2]) diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_lists.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_lists.snap index fcdfd455f6726..73e8a15ccdeb2 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_lists.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_lists.snap @@ -12,7 +12,6 @@ PT007.py:12:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -Suggested fix: 9 9 | @pytest.mark.parametrize( 10 10 | ("param1", "param2"), 11 11 | ( @@ -35,7 +34,6 @@ PT007.py:13:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -Suggested fix: 10 10 | ("param1", "param2"), 11 11 | ( 12 12 | (1, 2), @@ -56,7 +54,6 @@ PT007.py:31:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `list` for parameter values -Suggested fix: 28 28 | ... 29 29 | 30 30 | @@ -83,7 +80,6 @@ PT007.py:38:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -Suggested fix: 35 35 | 36 36 | @pytest.mark.parametrize( 37 37 | ("param1", "param2"), @@ -110,7 +106,6 @@ PT007.py:39:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -Suggested fix: 36 36 | @pytest.mark.parametrize( 37 37 | ("param1", "param2"), 38 38 | [ @@ -133,7 +128,6 @@ PT007.py:40:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -Suggested fix: 37 37 | ("param1", "param2"), 38 38 | [ 39 39 | (1, 2), @@ -160,7 +154,6 @@ PT007.py:49:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -Suggested fix: 46 46 | 47 47 | @pytest.mark.parametrize( 48 48 | ("param1", "param2"), @@ -191,7 +184,6 @@ PT007.py:60:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -Suggested fix: 57 57 | 58 58 | @pytest.mark.parametrize( 59 59 | "param1,param2", @@ -222,7 +214,6 @@ PT007.py:71:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -Suggested fix: 68 68 | 69 69 | @pytest.mark.parametrize( 70 70 | "param", @@ -247,7 +238,6 @@ PT007.py:80:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `list` for parameter values -Suggested fix: 77 77 | ... 78 78 | 79 79 | @@ -269,7 +259,6 @@ PT007.py:81:39: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `list` for parameter values -Suggested fix: 78 78 | 79 79 | 80 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -291,7 +280,6 @@ PT007.py:81:47: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `list` for parameter values -Suggested fix: 78 78 | 79 79 | 80 80 | @pytest.mark.parametrize("a", [1, 2]) @@ -314,7 +302,6 @@ PT007.py:82:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `list` for parameter values -Suggested fix: 79 79 | 80 80 | @pytest.mark.parametrize("a", [1, 2]) 81 81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) @@ -337,7 +324,6 @@ PT007.py:85:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -Suggested fix: 82 82 | @pytest.mark.parametrize("d", [3,]) 83 83 | @pytest.mark.parametrize( 84 84 | "d", @@ -360,7 +346,6 @@ PT007.py:89:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -Suggested fix: 86 86 | ) 87 87 | @pytest.mark.parametrize( 88 88 | "e", diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_tuples.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_tuples.snap index 7e1accd1e441d..35d3b4433e444 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_tuples.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_tuples.snap @@ -12,7 +12,6 @@ PT007.py:23:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -Suggested fix: 20 20 | @pytest.mark.parametrize( 21 21 | ("param1", "param2"), 22 22 | ( @@ -35,7 +34,6 @@ PT007.py:24:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -Suggested fix: 21 21 | ("param1", "param2"), 22 22 | ( 23 23 | [1, 2], @@ -56,7 +54,6 @@ PT007.py:31:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `tuple` for parameter values -Suggested fix: 28 28 | ... 29 29 | 30 30 | @@ -83,7 +80,6 @@ PT007.py:38:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -Suggested fix: 35 35 | 36 36 | @pytest.mark.parametrize( 37 37 | ("param1", "param2"), @@ -114,7 +110,6 @@ PT007.py:49:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -Suggested fix: 46 46 | 47 47 | @pytest.mark.parametrize( 48 48 | ("param1", "param2"), @@ -141,7 +136,6 @@ PT007.py:50:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -Suggested fix: 47 47 | @pytest.mark.parametrize( 48 48 | ("param1", "param2"), 49 49 | [ @@ -164,7 +158,6 @@ PT007.py:51:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -Suggested fix: 48 48 | ("param1", "param2"), 49 49 | [ 50 50 | [1, 2], @@ -191,7 +184,6 @@ PT007.py:60:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -Suggested fix: 57 57 | 58 58 | @pytest.mark.parametrize( 59 59 | "param1,param2", @@ -218,7 +210,6 @@ PT007.py:61:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -Suggested fix: 58 58 | @pytest.mark.parametrize( 59 59 | "param1,param2", 60 60 | [ @@ -241,7 +232,6 @@ PT007.py:62:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -Suggested fix: 59 59 | "param1,param2", 60 60 | [ 61 61 | [1, 2], @@ -268,7 +258,6 @@ PT007.py:71:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -Suggested fix: 68 68 | 69 69 | @pytest.mark.parametrize( 70 70 | "param", @@ -293,7 +282,6 @@ PT007.py:80:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `tuple` for parameter values -Suggested fix: 77 77 | ... 78 78 | 79 79 | @@ -316,7 +304,6 @@ PT007.py:82:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `tuple` for parameter values -Suggested fix: 79 79 | 80 80 | @pytest.mark.parametrize("a", [1, 2]) 81 81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) @@ -339,7 +326,6 @@ PT007.py:85:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -Suggested fix: 82 82 | @pytest.mark.parametrize("d", [3,]) 83 83 | @pytest.mark.parametrize( 84 84 | "d", @@ -362,7 +348,6 @@ PT007.py:89:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -Suggested fix: 86 86 | ) 87 87 | @pytest.mark.parametrize( 88 88 | "e", diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap index 1a605854fea86..199a00dbf775b 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap @@ -12,7 +12,6 @@ PT009.py:11:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -Suggested fix: 8 8 | def test_assert_true(self): 9 9 | expr = 1 10 10 | msg = "Must be True" @@ -35,7 +34,6 @@ PT009.py:12:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -Suggested fix: 9 9 | expr = 1 10 10 | msg = "Must be True" 11 11 | self.assertTrue(expr) # Error @@ -58,7 +56,6 @@ PT009.py:13:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -Suggested fix: 10 10 | msg = "Must be True" 11 11 | self.assertTrue(expr) # Error 12 12 | self.assertTrue(expr=expr) # Error @@ -81,7 +78,6 @@ PT009.py:14:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -Suggested fix: 11 11 | self.assertTrue(expr) # Error 12 12 | self.assertTrue(expr=expr) # Error 13 13 | self.assertTrue(expr, msg) # Error @@ -104,7 +100,6 @@ PT009.py:15:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -Suggested fix: 12 12 | self.assertTrue(expr=expr) # Error 13 13 | self.assertTrue(expr, msg) # Error 14 14 | self.assertTrue(expr=expr, msg=msg) # Error @@ -203,7 +198,6 @@ PT009.py:28:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertFalse(...)` with `assert ...` -Suggested fix: 25 25 | return self.assertEqual(True, False) # Error, unfixable 26 26 | 27 27 | def test_assert_false(self): @@ -225,7 +219,6 @@ PT009.py:31:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertEqual(...)` with `assert ...` -Suggested fix: 28 28 | self.assertFalse(True) # Error 29 29 | 30 30 | def test_assert_equal(self): @@ -247,7 +240,6 @@ PT009.py:34:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotEqual(...)` with `assert ...` -Suggested fix: 31 31 | self.assertEqual(1, 2) # Error 32 32 | 33 33 | def test_assert_not_equal(self): @@ -269,7 +261,6 @@ PT009.py:37:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertGreater(...)` with `assert ...` -Suggested fix: 34 34 | self.assertNotEqual(1, 1) # Error 35 35 | 36 36 | def test_assert_greater(self): @@ -291,7 +282,6 @@ PT009.py:40:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertGreaterEqual(...)` with `assert ...` -Suggested fix: 37 37 | self.assertGreater(1, 2) # Error 38 38 | 39 39 | def test_assert_greater_equal(self): @@ -313,7 +303,6 @@ PT009.py:43:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertLess(...)` with `assert ...` -Suggested fix: 40 40 | self.assertGreaterEqual(1, 2) # Error 41 41 | 42 42 | def test_assert_less(self): @@ -335,7 +324,6 @@ PT009.py:46:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertLessEqual(...)` with `assert ...` -Suggested fix: 43 43 | self.assertLess(2, 1) # Error 44 44 | 45 45 | def test_assert_less_equal(self): @@ -357,7 +345,6 @@ PT009.py:49:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIn(...)` with `assert ...` -Suggested fix: 46 46 | self.assertLessEqual(1, 2) # Error 47 47 | 48 48 | def test_assert_in(self): @@ -379,7 +366,6 @@ PT009.py:52:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotIn(...)` with `assert ...` -Suggested fix: 49 49 | self.assertIn(1, [2, 3]) # Error 50 50 | 51 51 | def test_assert_not_in(self): @@ -401,7 +387,6 @@ PT009.py:55:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIsNone(...)` with `assert ...` -Suggested fix: 52 52 | self.assertNotIn(2, [2, 3]) # Error 53 53 | 54 54 | def test_assert_is_none(self): @@ -423,7 +408,6 @@ PT009.py:58:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIsNotNone(...)` with `assert ...` -Suggested fix: 55 55 | self.assertIsNone(0) # Error 56 56 | 57 57 | def test_assert_is_not_none(self): @@ -445,7 +429,6 @@ PT009.py:61:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIs(...)` with `assert ...` -Suggested fix: 58 58 | self.assertIsNotNone(0) # Error 59 59 | 60 60 | def test_assert_is(self): @@ -467,7 +450,6 @@ PT009.py:64:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIsNot(...)` with `assert ...` -Suggested fix: 61 61 | self.assertIs([], []) # Error 62 62 | 63 63 | def test_assert_is_not(self): @@ -489,7 +471,6 @@ PT009.py:67:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIsInstance(...)` with `assert ...` -Suggested fix: 64 64 | self.assertIsNot(1, 1) # Error 65 65 | 66 66 | def test_assert_is_instance(self): @@ -511,7 +492,6 @@ PT009.py:70:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotIsInstance(...)` with `assert ...` -Suggested fix: 67 67 | self.assertIsInstance(1, str) # Error 68 68 | 69 69 | def test_assert_is_not_instance(self): @@ -533,7 +513,6 @@ PT009.py:73:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertRegex(...)` with `assert ...` -Suggested fix: 70 70 | self.assertNotIsInstance(1, int) # Error 71 71 | 72 72 | def test_assert_regex(self): @@ -555,7 +534,6 @@ PT009.py:76:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotRegex(...)` with `assert ...` -Suggested fix: 73 73 | self.assertRegex("abc", r"def") # Error 74 74 | 75 75 | def test_assert_not_regex(self): @@ -577,7 +555,6 @@ PT009.py:79:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertRegexpMatches(...)` with `assert ...` -Suggested fix: 76 76 | self.assertNotRegex("abc", r"abc") # Error 77 77 | 78 78 | def test_assert_regexp_matches(self): @@ -599,7 +576,6 @@ PT009.py:82:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotRegex(...)` with `assert ...` -Suggested fix: 79 79 | self.assertRegexpMatches("abc", r"def") # Error 80 80 | 81 81 | def test_assert_not_regexp_matches(self): @@ -621,7 +597,6 @@ PT009.py:85:9: PT009 [*] Use a regular `assert` instead of unittest-style `failI | = help: Replace `failIf(...)` with `assert ...` -Suggested fix: 82 82 | self.assertNotRegex("abc", r"abc") # Error 83 83 | 84 84 | def test_fail_if(self): @@ -643,7 +618,6 @@ PT009.py:88:9: PT009 [*] Use a regular `assert` instead of unittest-style `failU | = help: Replace `failUnless(...)` with `assert ...` -Suggested fix: 85 85 | self.failIf("abc") # Error 86 86 | 87 87 | def test_fail_unless(self): @@ -665,7 +639,6 @@ PT009.py:91:9: PT009 [*] Use a regular `assert` instead of unittest-style `failU | = help: Replace `failUnlessEqual(...)` with `assert ...` -Suggested fix: 88 88 | self.failUnless("abc") # Error 89 89 | 90 90 | def test_fail_unless_equal(self): @@ -685,7 +658,6 @@ PT009.py:94:9: PT009 [*] Use a regular `assert` instead of unittest-style `failI | = help: Replace `failIfEqual(...)` with `assert ...` -Suggested fix: 91 91 | self.failUnlessEqual(1, 2) # Error 92 92 | 93 93 | def test_fail_if_equal(self): @@ -707,7 +679,6 @@ PT009.py:98:2: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -Suggested fix: 95 95 | 96 96 | 97 97 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459517 diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap index 3ff6603735af2..8e45b6b9772a6 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap @@ -10,7 +10,6 @@ PT014.py:4:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.para | = help: Remove duplicate test case -Suggested fix: 1 1 | import pytest 2 2 | 3 3 | @@ -31,7 +30,6 @@ PT014.py:14:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -Suggested fix: 11 11 | c = 3 12 12 | 13 13 | @@ -52,7 +50,6 @@ PT014.py:14:41: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.par | = help: Remove duplicate test case -Suggested fix: 11 11 | c = 3 12 12 | 13 13 | @@ -73,7 +70,6 @@ PT014.py:14:44: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.par | = help: Remove duplicate test case -Suggested fix: 11 11 | c = 3 12 12 | 13 13 | @@ -105,7 +101,6 @@ PT014.py:32:39: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -Suggested fix: 29 29 | ... 30 30 | 31 31 | @@ -126,7 +121,6 @@ PT014.py:32:48: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -Suggested fix: 29 29 | ... 30 30 | 31 31 | @@ -149,7 +143,6 @@ PT014.py:42:10: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -Suggested fix: 39 39 | [ 40 40 | a, 41 41 | b, @@ -171,7 +164,6 @@ PT014.py:44:11: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -Suggested fix: 41 41 | b, 42 42 | (a), 43 43 | c, @@ -191,7 +183,6 @@ PT014.py:56:53: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -Suggested fix: 53 53 | ... 54 54 | 55 55 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap index 19d99a1ccb71e..fe5e1519bb038 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap @@ -11,7 +11,6 @@ PT018.py:14:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -Suggested fix: 11 11 | 12 12 | 13 13 | def test_error(): @@ -35,7 +34,6 @@ PT018.py:15:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -Suggested fix: 12 12 | 13 13 | def test_error(): 14 14 | assert something and something_else @@ -59,7 +57,6 @@ PT018.py:16:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -Suggested fix: 13 13 | def test_error(): 14 14 | assert something and something_else 15 15 | assert something and something_else and something_third @@ -83,7 +80,6 @@ PT018.py:17:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -Suggested fix: 14 14 | assert something and something_else 15 15 | assert something and something_else and something_third 16 16 | assert something and not something_else @@ -107,7 +103,6 @@ PT018.py:18:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -Suggested fix: 15 15 | assert something and something_else and something_third 16 16 | assert something and not something_else 17 17 | assert something and (something_else or something_third) @@ -131,7 +126,6 @@ PT018.py:19:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -Suggested fix: 16 16 | assert something and not something_else 17 17 | assert something and (something_else or something_third) 18 18 | assert not something and something_else @@ -155,7 +149,6 @@ PT018.py:20:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -Suggested fix: 17 17 | assert something and (something_else or something_third) 18 18 | assert not something and something_else 19 19 | assert not (something or something_else) @@ -182,7 +175,6 @@ PT018.py:21:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -Suggested fix: 18 18 | assert not something and something_else 19 19 | assert not (something or something_else) 20 20 | assert not (something or something_else or something_third) @@ -213,7 +205,6 @@ PT018.py:24:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -Suggested fix: 21 21 | assert something and something_else == """error 22 22 | message 23 23 | """ @@ -237,7 +228,6 @@ PT018.py:33:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -Suggested fix: 30 30 | ) 31 31 | 32 32 | # recursive case @@ -261,7 +251,6 @@ PT018.py:34:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -Suggested fix: 31 31 | 32 32 | # recursive case 33 33 | assert not (a or not (b or c)) @@ -313,7 +302,6 @@ PT018.py:44:1: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -Suggested fix: 41 41 | 42 42 | 43 43 | assert something # OK @@ -335,7 +323,6 @@ PT018.py:45:1: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -Suggested fix: 42 42 | 43 43 | assert something # OK 44 44 | assert something and something_else # Error @@ -393,7 +380,6 @@ PT018.py:59:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -Suggested fix: 59 59 | assert not ( 60 60 | self.find_graph_output(node.output[0]) 61 61 | or self.find_graph_input(node.input[0]) @@ -424,7 +410,6 @@ PT018.py:65:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -Suggested fix: 62 62 | or self.find_graph_output(node.input[0]) 63 63 | ) 64 64 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT022.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT022.snap index 1b4e5352c85c5..3e45a20ad89ca 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT022.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT022.snap @@ -10,7 +10,6 @@ PT022.py:17:5: PT022 [*] No teardown in fixture `error`, use `return` instead of | = help: Replace `yield` with `return` -Suggested fix: 14 14 | @pytest.fixture() 15 15 | def error(): 16 16 | resource = acquire_resource() @@ -31,7 +30,6 @@ PT022.py:37:5: PT022 [*] No teardown in fixture `error`, use `return` instead of | = help: Replace `yield` with `return` -Suggested fix: 32 32 | 33 33 | 34 34 | @pytest.fixture() @@ -55,7 +53,6 @@ PT022.py:43:5: PT022 [*] No teardown in fixture `error`, use `return` instead of | = help: Replace `yield` with `return` -Suggested fix: 38 38 | 39 39 | 40 40 | @pytest.fixture() diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_default.snap index 1246a1d3674fa..1fe5b3b796fd9 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_default.snap @@ -10,7 +10,6 @@ PT023.py:12:1: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | = help: Add/remove parentheses -Suggested fix: 9 9 | # Without parentheses 10 10 | 11 11 | @@ -31,7 +30,6 @@ PT023.py:17:1: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | = help: Add/remove parentheses -Suggested fix: 14 14 | pass 15 15 | 16 16 | @@ -53,7 +51,6 @@ PT023.py:24:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | = help: Add/remove parentheses -Suggested fix: 21 21 | 22 22 | 23 23 | class TestClass: @@ -75,7 +72,6 @@ PT023.py:30:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | = help: Add/remove parentheses -Suggested fix: 27 27 | 28 28 | 29 29 | class TestClass: @@ -98,7 +94,6 @@ PT023.py:38:9: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | = help: Add/remove parentheses -Suggested fix: 35 35 | 36 36 | class TestClass: 37 37 | class TestNestedClass: diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_no_parentheses.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_no_parentheses.snap index 8aed97f95209a..a874367498d7e 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_no_parentheses.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_no_parentheses.snap @@ -10,7 +10,6 @@ PT023.py:46:1: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | = help: Add/remove parentheses -Suggested fix: 43 43 | # With parentheses 44 44 | 45 45 | @@ -31,7 +30,6 @@ PT023.py:51:1: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | = help: Add/remove parentheses -Suggested fix: 48 48 | pass 49 49 | 50 50 | @@ -53,7 +51,6 @@ PT023.py:58:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | = help: Add/remove parentheses -Suggested fix: 55 55 | 56 56 | 57 57 | class TestClass: @@ -75,7 +72,6 @@ PT023.py:64:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | = help: Add/remove parentheses -Suggested fix: 61 61 | 62 62 | 63 63 | class TestClass: @@ -98,7 +94,6 @@ PT023.py:72:9: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | = help: Add/remove parentheses -Suggested fix: 69 69 | 70 70 | class TestClass: 71 71 | class TestNestedClass: diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT024.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT024.snap index 9de6c7d2b0145..af5eecce63f06 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT024.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT024.snap @@ -10,7 +10,6 @@ PT024.py:14:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures | = help: Remove `pytest.mark.asyncio` -Suggested fix: 11 11 | pass 12 12 | 13 13 | @@ -30,7 +29,6 @@ PT024.py:20:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures | = help: Remove `pytest.mark.asyncio` -Suggested fix: 17 17 | return 0 18 18 | 19 19 | @@ -51,7 +49,6 @@ PT024.py:27:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures | = help: Remove `pytest.mark.asyncio` -Suggested fix: 24 24 | 25 25 | 26 26 | @pytest.fixture() @@ -72,7 +69,6 @@ PT024.py:33:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures | = help: Remove `pytest.mark.asyncio` -Suggested fix: 30 30 | 31 31 | 32 32 | @pytest.fixture() diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT025.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT025.snap index 677ff95feece7..96635176197e1 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT025.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT025.snap @@ -10,7 +10,6 @@ PT025.py:9:1: PT025 [*] `pytest.mark.usefixtures` has no effect on fixtures | = help: Remove `pytest.mark.usefixtures` -Suggested fix: 6 6 | pass 7 7 | 8 8 | @@ -31,7 +30,6 @@ PT025.py:16:1: PT025 [*] `pytest.mark.usefixtures` has no effect on fixtures | = help: Remove `pytest.mark.usefixtures` -Suggested fix: 13 13 | 14 14 | 15 15 | @pytest.fixture() diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap index 6ea0a7ce20a4b..afe0d2c3239f8 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap @@ -10,7 +10,6 @@ PT026.py:19:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters | = help: Remove `usefixtures` decorator or pass parameters -Suggested fix: 16 16 | pass 17 17 | 18 18 | @@ -31,7 +30,6 @@ PT026.py:24:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters | = help: Remove `usefixtures` decorator or pass parameters -Suggested fix: 21 21 | pass 22 22 | 23 23 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap index 192a1d2a47a09..3d8ab412b591b 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap @@ -12,7 +12,6 @@ PT027_0.py:6:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assert | = help: Replace `assertRaises` with `pytest.raises` -Suggested fix: 1 1 | import unittest 2 |+import pytest 2 3 | @@ -37,7 +36,6 @@ PT027_0.py:8:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assert | = help: Replace `assertRaises` with `pytest.raises` -Suggested fix: 1 1 | import unittest 2 |+import pytest 2 3 | @@ -64,7 +62,6 @@ PT027_0.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `failU | = help: Replace `failUnlessRaises` with `pytest.raises` -Suggested fix: 1 1 | import unittest 2 |+import pytest 2 3 | @@ -92,7 +89,6 @@ PT027_0.py:14:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegex` with `pytest.raises` -Suggested fix: 1 1 | import unittest 2 |+import pytest 2 3 | @@ -120,7 +116,6 @@ PT027_0.py:17:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegex` with `pytest.raises` -Suggested fix: 1 1 | import unittest 2 |+import pytest 2 3 | @@ -149,7 +144,6 @@ PT027_0.py:20:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegex` with `pytest.raises` -Suggested fix: 1 1 | import unittest 2 |+import pytest 2 3 | @@ -180,7 +174,6 @@ PT027_0.py:25:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegex` with `pytest.raises` -Suggested fix: 1 1 | import unittest 2 |+import pytest 2 3 | @@ -210,7 +203,6 @@ PT027_0.py:30:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegexp` with `pytest.raises` -Suggested fix: 1 1 | import unittest 2 |+import pytest 2 3 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap index 427faf353d0ba..c5d8c9f96712a 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap @@ -10,7 +10,6 @@ PT027_1.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaises` with `pytest.raises` -Suggested fix: 8 8 | raise ValueError 9 9 | 10 10 | def test_errors(self): diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap index 5775764ba4a20..ddbf738749576 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap @@ -10,7 +10,6 @@ doubles_all.py:1:1: Q002 [*] Double quote docstring found but single quotes pref | = help: Replace double quotes docstring with single quotes -Suggested fix: 1 |-"""This is a docstring.""" 1 |+'''This is a docstring.''' 2 2 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap index 27687aa43842a..24890365c4f3d 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap @@ -12,7 +12,6 @@ doubles_all.py:3:28: Q000 [*] Double quotes found but single quotes preferred | = help: Replace double quotes with single quotes -Suggested fix: 1 1 | """This is a docstring.""" 2 2 | 3 |-this_is_an_inline_string = "double quote string" diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap index d47b36d30b71d..750336227542c 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap @@ -13,7 +13,6 @@ doubles_all.py:5:30: Q001 [*] Double quote multiline found but single quotes pre | = help: Replace double multiline quotes with single quotes -Suggested fix: 2 2 | 3 3 | this_is_an_inline_string = "double quote string" 4 4 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap index 4c2f8e0baa1c9..a36a1b7ffd0a3 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap @@ -14,7 +14,6 @@ docstring_doubles.py:5:1: Q001 [*] Double quote multiline found but single quote | = help: Replace double multiline quotes with single quotes -Suggested fix: 2 2 | Double quotes multiline module docstring 3 3 | """ 4 4 | @@ -43,7 +42,6 @@ docstring_doubles.py:16:5: Q001 [*] Double quote multiline found but single quot | = help: Replace double multiline quotes with single quotes -Suggested fix: 13 13 | Double quotes multiline class docstring 14 14 | """ 15 15 | @@ -70,7 +68,6 @@ docstring_doubles.py:21:21: Q001 [*] Double quote multiline found but single quo | = help: Replace double multiline quotes with single quotes -Suggested fix: 18 18 | """ 19 19 | 20 20 | # The colon in the list indexing below is an edge case for the docstring scanner @@ -98,7 +95,6 @@ docstring_doubles.py:30:9: Q001 [*] Double quote multiline found but single quot | = help: Replace double multiline quotes with single quotes -Suggested fix: 27 27 | 28 28 | some_expression = 'hello world' 29 29 | @@ -125,7 +121,6 @@ docstring_doubles.py:35:13: Q001 [*] Double quote multiline found but single quo | = help: Replace double multiline quotes with single quotes -Suggested fix: 32 32 | """ 33 33 | 34 34 | if l: diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap index ce831e79d6ab9..a61ebe79d4bec 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap @@ -12,7 +12,6 @@ docstring_doubles_class.py:3:5: Q001 [*] Double quote multiline found but single | = help: Replace double multiline quotes with single quotes -Suggested fix: 1 1 | class SingleLineDocstrings(): 2 2 | """ Double quotes single line class docstring """ 3 |- """ Not a docstring """ @@ -34,7 +33,6 @@ docstring_doubles_class.py:5:23: Q001 [*] Double quote multiline found but singl | = help: Replace double multiline quotes with single quotes -Suggested fix: 2 2 | """ Double quotes single line class docstring """ 3 3 | """ Not a docstring """ 4 4 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap index f06c82efba593..64add3dde8f81 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap @@ -11,7 +11,6 @@ docstring_doubles_function.py:3:5: Q001 [*] Double quote multiline found but sin | = help: Replace double multiline quotes with single quotes -Suggested fix: 1 1 | def foo(): 2 2 | """function without params, single line docstring""" 3 |- """ not a docstring""" @@ -32,7 +31,6 @@ docstring_doubles_function.py:11:5: Q001 [*] Double quote multiline found but si | = help: Replace double multiline quotes with single quotes -Suggested fix: 8 8 | """ 9 9 | function without params, multiline docstring 10 10 | """ @@ -55,7 +53,6 @@ docstring_doubles_function.py:15:39: Q001 [*] Double quote multiline found but s | = help: Replace double multiline quotes with single quotes -Suggested fix: 12 12 | return 13 13 | 14 14 | @@ -80,7 +77,6 @@ docstring_doubles_function.py:17:5: Q001 [*] Double quote multiline found but si | = help: Replace double multiline quotes with single quotes -Suggested fix: 14 14 | 15 15 | def fun_with_params_no_docstring(a, b=""" 16 16 | not a @@ -101,7 +97,6 @@ docstring_doubles_function.py:22:5: Q001 [*] Double quote multiline found but si | = help: Replace double multiline quotes with single quotes -Suggested fix: 19 19 | 20 20 | 21 21 | def fun_with_params_no_docstring2(a, b=c[foo():], c=\ diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap index a2248776f5b75..1eadffa6e02e9 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap @@ -14,7 +14,6 @@ docstring_doubles_module_multiline.py:4:1: Q001 [*] Double quote multiline found | = help: Replace double multiline quotes with single quotes -Suggested fix: 1 1 | """ 2 2 | Double quotes multiline module docstring 3 3 | """ @@ -40,7 +39,6 @@ docstring_doubles_module_multiline.py:9:1: Q001 [*] Double quote multiline found | = help: Replace double multiline quotes with single quotes -Suggested fix: 6 6 | """ 7 7 | def foo(): 8 8 | pass diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap index f48a18fd1122f..b75220e12b839 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap @@ -11,7 +11,6 @@ docstring_doubles_module_singleline.py:2:1: Q001 [*] Double quote multiline foun | = help: Replace double multiline quotes with single quotes -Suggested fix: 1 1 | """ Double quotes singleline module docstring """ 2 |-""" this is not a docstring """ 2 |+''' this is not a docstring ''' @@ -30,7 +29,6 @@ docstring_doubles_module_singleline.py:6:1: Q001 [*] Double quote multiline foun | = help: Replace double multiline quotes with single quotes -Suggested fix: 3 3 | 4 4 | def foo(): 5 5 | pass diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap index d665dcbf3ab26..ca0b9b16904b0 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap @@ -12,7 +12,6 @@ docstring_singles.py:1:1: Q002 [*] Single quote docstring found but double quote | = help: Replace single quotes docstring with double quotes -Suggested fix: 1 |-''' 1 |+""" 2 2 | Single quotes multiline module docstring @@ -38,7 +37,6 @@ docstring_singles.py:14:5: Q002 [*] Single quote docstring found but double quot | = help: Replace single quotes docstring with double quotes -Suggested fix: 11 11 | class Cls(MakeKlass(''' 12 12 | class params \t not a docstring 13 13 | ''')): @@ -67,7 +65,6 @@ docstring_singles.py:26:9: Q002 [*] Single quote docstring found but double quot | = help: Replace single quotes docstring with double quotes -Suggested fix: 23 23 | def f(self, bar=''' 24 24 | definitely not a docstring''', 25 25 | val=l[Cls():3]): diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap index 5ecabc16d72ca..d3d17a5922eec 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap @@ -10,7 +10,6 @@ docstring_singles_class.py:2:5: Q002 [*] Single quote docstring found but double | = help: Replace single quotes docstring with double quotes -Suggested fix: 1 1 | class SingleLineDocstrings(): 2 |- ''' Double quotes single line class docstring ''' 2 |+ """ Double quotes single line class docstring """ @@ -29,7 +28,6 @@ docstring_singles_class.py:6:9: Q002 [*] Single quote docstring found but double | = help: Replace single quotes docstring with double quotes -Suggested fix: 3 3 | ''' Not a docstring ''' 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): @@ -50,7 +48,6 @@ docstring_singles_class.py:9:29: Q002 [*] Single quote docstring found but doubl | = help: Replace single quotes docstring with double quotes -Suggested fix: 6 6 | ''' Double quotes single line method docstring''' 7 7 | pass 8 8 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap index 198234214c006..abea62aeb296b 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap @@ -11,7 +11,6 @@ docstring_singles_function.py:2:5: Q002 [*] Single quote docstring found but dou | = help: Replace single quotes docstring with double quotes -Suggested fix: 1 1 | def foo(): 2 |- '''function without params, single line docstring''' 2 |+ """function without params, single line docstring""" @@ -34,7 +33,6 @@ docstring_singles_function.py:8:5: Q002 [*] Single quote docstring found but dou | = help: Replace single quotes docstring with double quotes -Suggested fix: 5 5 | 6 6 | 7 7 | def foo2(): @@ -57,7 +55,6 @@ docstring_singles_function.py:27:5: Q002 [*] Single quote docstring found but do | = help: Replace single quotes docstring with double quotes -Suggested fix: 24 24 | 25 25 | 26 26 | def function_with_single_docstring(a): diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap index b01b0c9afa9b5..5f313c0649158 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap @@ -19,7 +19,6 @@ docstring_singles_mixed_quotes_class_var_1.py:2:33: Q002 [*] Single quote docstr | = help: Replace single quotes docstring with double quotes -Suggested fix: 1 1 | class SingleLineDocstrings(): 2 |- ''"Start with empty string" ' and lint docstring safely' 2 |+ ''"Start with empty string" " and lint docstring safely" @@ -47,7 +46,6 @@ docstring_singles_mixed_quotes_class_var_1.py:6:37: Q002 [*] Single quote docstr | = help: Replace single quotes docstring with double quotes -Suggested fix: 3 3 | ''' Not a docstring ''' 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): @@ -77,7 +75,6 @@ docstring_singles_mixed_quotes_class_var_1.py:9:57: Q002 [*] Single quote docstr | = help: Replace single quotes docstring with double quotes -Suggested fix: 6 6 | ''"Start with empty string" ' and lint docstring safely' 7 7 | pass 8 8 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap index 55c2f12e531c1..a960f22d3c4c6 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap @@ -10,7 +10,6 @@ docstring_singles_mixed_quotes_class_var_2.py:2:5: Q002 [*] Single quote docstri | = help: Replace single quotes docstring with double quotes -Suggested fix: 1 1 | class SingleLineDocstrings(): 2 |- 'Do not'" start with empty string" ' and lint docstring safely' 2 |+ "Do not"" start with empty string" ' and lint docstring safely' @@ -29,7 +28,6 @@ docstring_singles_mixed_quotes_class_var_2.py:2:40: Q002 [*] Single quote docstr | = help: Replace single quotes docstring with double quotes -Suggested fix: 1 1 | class SingleLineDocstrings(): 2 |- 'Do not'" start with empty string" ' and lint docstring safely' 2 |+ 'Do not'" start with empty string" " and lint docstring safely" @@ -48,7 +46,6 @@ docstring_singles_mixed_quotes_class_var_2.py:6:9: Q002 [*] Single quote docstri | = help: Replace single quotes docstring with double quotes -Suggested fix: 3 3 | ''' Not a docstring ''' 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): @@ -69,7 +66,6 @@ docstring_singles_mixed_quotes_class_var_2.py:6:44: Q002 [*] Single quote docstr | = help: Replace single quotes docstring with double quotes -Suggested fix: 3 3 | ''' Not a docstring ''' 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): @@ -90,7 +86,6 @@ docstring_singles_mixed_quotes_class_var_2.py:9:29: Q002 [*] Single quote docstr | = help: Replace single quotes docstring with double quotes -Suggested fix: 6 6 | 'Do not'" start with empty string" ' and lint docstring safely' 7 7 | pass 8 8 | @@ -108,7 +103,6 @@ docstring_singles_mixed_quotes_class_var_2.py:9:64: Q002 [*] Single quote docstr | = help: Replace single quotes docstring with double quotes -Suggested fix: 6 6 | 'Do not'" start with empty string" ' and lint docstring safely' 7 7 | pass 8 8 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap index c89b998a10af2..eb98a4b96425f 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap @@ -19,7 +19,6 @@ docstring_singles_mixed_quotes_module_singleline_var_1.py:1:29: Q002 [*] Single | = help: Replace single quotes docstring with double quotes -Suggested fix: 1 |-''"Start with empty string" ' and lint docstring safely' 1 |+''"Start with empty string" " and lint docstring safely" 2 2 | @@ -37,7 +36,6 @@ docstring_singles_mixed_quotes_module_singleline_var_1.py:5:1: Q001 [*] Double q | = help: Replace double multiline quotes with single quotes -Suggested fix: 2 2 | 3 3 | def foo(): 4 4 | pass diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap index f58f247893c91..9bdc99dd0c236 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap @@ -10,7 +10,6 @@ docstring_singles_mixed_quotes_module_singleline_var_2.py:1:1: Q002 [*] Single q | = help: Replace single quotes docstring with double quotes -Suggested fix: 1 |-'Do not'" start with empty string" ' and lint docstring safely' 1 |+"Do not"" start with empty string" ' and lint docstring safely' 2 2 | @@ -28,7 +27,6 @@ docstring_singles_mixed_quotes_module_singleline_var_2.py:1:36: Q002 [*] Single | = help: Replace single quotes docstring with double quotes -Suggested fix: 1 |-'Do not'" start with empty string" ' and lint docstring safely' 1 |+'Do not'" start with empty string" " and lint docstring safely" 2 2 | @@ -46,7 +44,6 @@ docstring_singles_mixed_quotes_module_singleline_var_2.py:5:1: Q001 [*] Double q | = help: Replace double multiline quotes with single quotes -Suggested fix: 2 2 | 3 3 | def foo(): 4 4 | pass diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap index 45ce3e07dac2d..9c0f24d31c3bd 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap @@ -12,7 +12,6 @@ docstring_singles_module_multiline.py:1:1: Q002 [*] Single quote docstring found | = help: Replace single quotes docstring with double quotes -Suggested fix: 1 |-''' 1 |+""" 2 2 | Double quotes multiline module docstring diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap index 69178f5f61dde..c693a27ead08e 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap @@ -9,7 +9,6 @@ docstring_singles_module_singleline.py:1:1: Q002 [*] Single quote docstring foun | = help: Replace single quotes docstring with double quotes -Suggested fix: 1 |-''' Double quotes singleline module docstring ''' 1 |+""" Double quotes singleline module docstring """ 2 2 | ''' this is not a docstring ''' diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap index 209167ba368b6..f7d0f83f1912c 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap @@ -12,7 +12,6 @@ docstring_doubles.py:1:1: Q002 [*] Double quote docstring found but single quote | = help: Replace double quotes docstring with single quotes -Suggested fix: 1 |-""" 1 |+''' 2 2 | Double quotes multiline module docstring @@ -37,7 +36,6 @@ docstring_doubles.py:12:5: Q002 [*] Double quote docstring found but single quot | = help: Replace double quotes docstring with single quotes -Suggested fix: 9 9 | l = [] 10 10 | 11 11 | class Cls: @@ -66,7 +64,6 @@ docstring_doubles.py:24:9: Q002 [*] Double quote docstring found but single quot | = help: Replace double quotes docstring with single quotes -Suggested fix: 21 21 | def f(self, bar=""" 22 22 | definitely not a docstring""", 23 23 | val=l[Cls():3]): diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap index 77a57c55ebebe..787e796e98062 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap @@ -10,7 +10,6 @@ docstring_doubles_class.py:2:5: Q002 [*] Double quote docstring found but single | = help: Replace double quotes docstring with single quotes -Suggested fix: 1 1 | class SingleLineDocstrings(): 2 |- """ Double quotes single line class docstring """ 2 |+ ''' Double quotes single line class docstring ''' @@ -29,7 +28,6 @@ docstring_doubles_class.py:6:9: Q002 [*] Double quote docstring found but single | = help: Replace double quotes docstring with single quotes -Suggested fix: 3 3 | """ Not a docstring """ 4 4 | 5 5 | def foo(self, bar="""not a docstring"""): @@ -50,7 +48,6 @@ docstring_doubles_class.py:9:29: Q002 [*] Double quote docstring found but singl | = help: Replace double quotes docstring with single quotes -Suggested fix: 6 6 | """ Double quotes single line method docstring""" 7 7 | pass 8 8 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap index f9e3355a51a53..ab723aadb7a9d 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap @@ -11,7 +11,6 @@ docstring_doubles_function.py:2:5: Q002 [*] Double quote docstring found but sin | = help: Replace double quotes docstring with single quotes -Suggested fix: 1 1 | def foo(): 2 |- """function without params, single line docstring""" 2 |+ '''function without params, single line docstring''' @@ -34,7 +33,6 @@ docstring_doubles_function.py:8:5: Q002 [*] Double quote docstring found but sin | = help: Replace double quotes docstring with single quotes -Suggested fix: 5 5 | 6 6 | 7 7 | def foo2(): @@ -57,7 +55,6 @@ docstring_doubles_function.py:27:5: Q002 [*] Double quote docstring found but si | = help: Replace double quotes docstring with single quotes -Suggested fix: 24 24 | 25 25 | 26 26 | def function_with_single_docstring(a): diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap index b5a5b37cd361d..f37db03ef67d4 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap @@ -10,7 +10,6 @@ docstring_doubles_mixed_quotes_class_var_2.py:2:5: Q002 [*] Double quote docstri | = help: Replace double quotes docstring with single quotes -Suggested fix: 1 1 | class SingleLineDocstrings(): 2 |- "Do not"' start with empty string' ' and lint docstring safely' 2 |+ 'Do not'' start with empty string' ' and lint docstring safely' @@ -29,7 +28,6 @@ docstring_doubles_mixed_quotes_class_var_2.py:6:9: Q002 [*] Double quote docstri | = help: Replace double quotes docstring with single quotes -Suggested fix: 3 3 | """ Not a docstring """ 4 4 | 5 5 | def foo(self, bar="""not a docstring"""): @@ -50,7 +48,6 @@ docstring_doubles_mixed_quotes_class_var_2.py:9:29: Q002 [*] Double quote docstr | = help: Replace double quotes docstring with single quotes -Suggested fix: 6 6 | "Do not"' start with empty string' ' and lint docstring safely' 7 7 | pass 8 8 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap index 627dbd5aafcef..448e4bb5fb1a5 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap @@ -10,7 +10,6 @@ docstring_doubles_mixed_quotes_module_singleline_var_2.py:1:1: Q002 [*] Double q | = help: Replace double quotes docstring with single quotes -Suggested fix: 1 |-"Do not"' start with empty string' ' and lint docstring safely' 1 |+'Do not'' start with empty string' ' and lint docstring safely' 2 2 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap index 7f5027bbdc20e..2d8cf2f6ed6e0 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap @@ -12,7 +12,6 @@ docstring_doubles_module_multiline.py:1:1: Q002 [*] Double quote docstring found | = help: Replace double quotes docstring with single quotes -Suggested fix: 1 |-""" 1 |+''' 2 2 | Double quotes multiline module docstring diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap index ee0b75d663a0f..4c9e7da755d50 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap @@ -9,7 +9,6 @@ docstring_doubles_module_singleline.py:1:1: Q002 [*] Double quote docstring foun | = help: Replace double quotes docstring with single quotes -Suggested fix: 1 |-""" Double quotes singleline module docstring """ 1 |+''' Double quotes singleline module docstring ''' 2 2 | """ this is not a docstring """ diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap index 515f7a3ac3ab0..4d0698b9187fe 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap @@ -14,7 +14,6 @@ docstring_singles.py:5:1: Q001 [*] Single quote multiline found but double quote | = help: Replace single multiline quotes with double quotes -Suggested fix: 2 2 | Single quotes multiline module docstring 3 3 | ''' 4 4 | @@ -43,7 +42,6 @@ docstring_singles.py:11:21: Q001 [*] Single quote multiline found but double quo | = help: Replace single multiline quotes with double quotes -Suggested fix: 8 8 | 9 9 | l = [] 10 10 | @@ -72,7 +70,6 @@ docstring_singles.py:18:5: Q001 [*] Single quote multiline found but double quot | = help: Replace single multiline quotes with double quotes -Suggested fix: 15 15 | Single quotes multiline class docstring 16 16 | ''' 17 17 | @@ -99,7 +96,6 @@ docstring_singles.py:23:21: Q001 [*] Single quote multiline found but double quo | = help: Replace single multiline quotes with double quotes -Suggested fix: 20 20 | ''' 21 21 | 22 22 | # The colon in the list indexing below is an edge case for the docstring scanner @@ -127,7 +123,6 @@ docstring_singles.py:32:9: Q001 [*] Single quote multiline found but double quot | = help: Replace single multiline quotes with double quotes -Suggested fix: 29 29 | 30 30 | some_expression = 'hello world' 31 31 | @@ -154,7 +149,6 @@ docstring_singles.py:37:13: Q001 [*] Single quote multiline found but double quo | = help: Replace single multiline quotes with double quotes -Suggested fix: 34 34 | ''' 35 35 | 36 36 | if l: diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap index a607e41bf5f4d..7f0b17582ea71 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap @@ -12,7 +12,6 @@ docstring_singles_class.py:3:5: Q001 [*] Single quote multiline found but double | = help: Replace single multiline quotes with double quotes -Suggested fix: 1 1 | class SingleLineDocstrings(): 2 2 | ''' Double quotes single line class docstring ''' 3 |- ''' Not a docstring ''' @@ -34,7 +33,6 @@ docstring_singles_class.py:5:23: Q001 [*] Single quote multiline found but doubl | = help: Replace single multiline quotes with double quotes -Suggested fix: 2 2 | ''' Double quotes single line class docstring ''' 3 3 | ''' Not a docstring ''' 4 4 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap index 5caf4931eeefa..4d17f42a1ff56 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap @@ -11,7 +11,6 @@ docstring_singles_function.py:3:5: Q001 [*] Single quote multiline found but dou | = help: Replace single multiline quotes with double quotes -Suggested fix: 1 1 | def foo(): 2 2 | '''function without params, single line docstring''' 3 |- ''' not a docstring''' @@ -32,7 +31,6 @@ docstring_singles_function.py:11:5: Q001 [*] Single quote multiline found but do | = help: Replace single multiline quotes with double quotes -Suggested fix: 8 8 | ''' 9 9 | function without params, multiline docstring 10 10 | ''' @@ -55,7 +53,6 @@ docstring_singles_function.py:15:39: Q001 [*] Single quote multiline found but d | = help: Replace single multiline quotes with double quotes -Suggested fix: 12 12 | return 13 13 | 14 14 | @@ -80,7 +77,6 @@ docstring_singles_function.py:17:5: Q001 [*] Single quote multiline found but do | = help: Replace single multiline quotes with double quotes -Suggested fix: 14 14 | 15 15 | def fun_with_params_no_docstring(a, b=''' 16 16 | not a @@ -101,7 +97,6 @@ docstring_singles_function.py:22:5: Q001 [*] Single quote multiline found but do | = help: Replace single multiline quotes with double quotes -Suggested fix: 19 19 | 20 20 | 21 21 | def fun_with_params_no_docstring2(a, b=c[foo():], c=\ diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap index f8a1396a8b853..ded426f9d2e01 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap @@ -14,7 +14,6 @@ docstring_singles_module_multiline.py:4:1: Q001 [*] Single quote multiline found | = help: Replace single multiline quotes with double quotes -Suggested fix: 1 1 | ''' 2 2 | Double quotes multiline module docstring 3 3 | ''' @@ -40,7 +39,6 @@ docstring_singles_module_multiline.py:9:1: Q001 [*] Single quote multiline found | = help: Replace single multiline quotes with double quotes -Suggested fix: 6 6 | ''' 7 7 | def foo(): 8 8 | pass diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap index 2669311a27ef9..62186a9c0d95c 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap @@ -11,7 +11,6 @@ docstring_singles_module_singleline.py:2:1: Q001 [*] Single quote multiline foun | = help: Replace single multiline quotes with double quotes -Suggested fix: 1 1 | ''' Double quotes singleline module docstring ''' 2 |-''' this is not a docstring ''' 2 |+""" this is not a docstring """ @@ -30,7 +29,6 @@ docstring_singles_module_singleline.py:6:1: Q001 [*] Single quote multiline foun | = help: Replace single multiline quotes with double quotes -Suggested fix: 3 3 | 4 4 | def foo(): 5 5 | pass diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap index 4e2552a2af942..9fdeffc1d344a 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap @@ -10,7 +10,6 @@ singles.py:1:25: Q000 [*] Single quotes found but double quotes preferred | = help: Replace single quotes with double quotes -Suggested fix: 1 |-this_should_be_linted = 'single quote string' 1 |+this_should_be_linted = "single quote string" 2 2 | this_should_be_linted = u'double quote string' @@ -29,7 +28,6 @@ singles.py:2:25: Q000 [*] Single quotes found but double quotes preferred | = help: Replace single quotes with double quotes -Suggested fix: 1 1 | this_should_be_linted = 'single quote string' 2 |-this_should_be_linted = u'double quote string' 2 |+this_should_be_linted = u"double quote string" @@ -49,7 +47,6 @@ singles.py:3:25: Q000 [*] Single quotes found but double quotes preferred | = help: Replace single quotes with double quotes -Suggested fix: 1 1 | this_should_be_linted = 'single quote string' 2 2 | this_should_be_linted = u'double quote string' 3 |-this_should_be_linted = f'double quote string' diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap index 6f301798de9ec..cd962252ed281 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap @@ -10,7 +10,6 @@ singles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 1 |-this_should_raise_Q003 = "This is a \"string\"" 1 |+this_should_raise_Q003 = 'This is a "string"' 2 2 | this_is_fine = "'This' is a \"string\"" @@ -29,7 +28,6 @@ singles_escaped.py:9:5: Q003 [*] Change outer quotes to avoid escaping inner quo | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 6 6 | this_is_fine = R"This is a \"string\"" 7 7 | this_should_raise = ( 8 8 | "This is a" @@ -51,7 +49,6 @@ singles_escaped.py:13:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 10 10 | ) 11 11 | 12 12 | # Same as above, but with f-strings @@ -73,7 +70,6 @@ singles_escaped.py:21:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 18 18 | fR"This is a \"string\"" 19 19 | foo = ( 20 20 | f"This is a" @@ -96,7 +92,6 @@ singles_escaped.py:31:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 28 28 | # f'"foo" {"nested"}' 29 29 | # 30 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -118,7 +113,6 @@ singles_escaped.py:32:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 29 29 | # 30 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 31 31 | f"\"foo\" {"foo"}" # Q003 @@ -141,7 +135,6 @@ singles_escaped.py:33:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 30 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 31 31 | f"\"foo\" {"foo"}" # Q003 32 32 | f"\"foo\" {f"foo"}" # Q003 @@ -164,7 +157,6 @@ singles_escaped.py:33:12: Q003 [*] Change outer quotes to avoid escaping inner q | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 30 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 31 31 | f"\"foo\" {"foo"}" # Q003 32 32 | f"\"foo\" {f"foo"}" # Q003 @@ -186,7 +178,6 @@ singles_escaped.py:36:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 33 33 | f"\"foo\" {f"\"foo\""} \"\"" # Q003 34 34 | 35 35 | f"normal {f"nested"} normal" @@ -208,7 +199,6 @@ singles_escaped.py:38:15: Q003 [*] Change outer quotes to avoid escaping inner q | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 35 35 | f"normal {f"nested"} normal" 36 36 | f"\"normal\" {f"nested"} normal" # Q003 37 37 | f"\"normal\" {f"nested"} 'single quotes'" @@ -227,7 +217,6 @@ singles_escaped.py:39:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 36 36 | f"\"normal\" {f"nested"} normal" # Q003 37 37 | f"\"normal\" {f"nested"} 'single quotes'" 38 38 | f"\"normal\" {f"\"nested\" {"other"} normal"} 'single quotes'" # Q003 diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_py311.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_py311.snap index e155dd4ffe7b9..59f8e92fe29c8 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_py311.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_py311.snap @@ -10,7 +10,6 @@ singles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 1 |-this_should_raise_Q003 = "This is a \"string\"" 1 |+this_should_raise_Q003 = 'This is a "string"' 2 2 | this_is_fine = "'This' is a \"string\"" @@ -29,7 +28,6 @@ singles_escaped.py:9:5: Q003 [*] Change outer quotes to avoid escaping inner quo | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 6 6 | this_is_fine = R"This is a \"string\"" 7 7 | this_should_raise = ( 8 8 | "This is a" @@ -51,7 +49,6 @@ singles_escaped.py:13:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 10 10 | ) 11 11 | 12 12 | # Same as above, but with f-strings @@ -73,7 +70,6 @@ singles_escaped.py:21:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 18 18 | fR"This is a \"string\"" 19 19 | foo = ( 20 20 | f"This is a" diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap index e8ff426953038..58b1c7028e185 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap @@ -10,7 +10,6 @@ singles_escaped_unnecessary.py:1:26: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 1 |-this_should_raise_Q004 = "This is a \'string\'" 1 |+this_should_raise_Q004 = "This is a 'string'" 2 2 | this_should_raise_Q004 = "'This' is a \'string\'" @@ -29,7 +28,6 @@ singles_escaped_unnecessary.py:2:26: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 1 1 | this_should_raise_Q004 = "This is a \'string\'" 2 |-this_should_raise_Q004 = "'This' is a \'string\'" 2 |+this_should_raise_Q004 = "'This' is a 'string'" @@ -49,7 +47,6 @@ singles_escaped_unnecessary.py:9:5: Q004 [*] Unnecessary escape on inner quote c | = help: Remove backslash -Suggested fix: 6 6 | this_is_fine = R"This is a \'string\'" 7 7 | this_should_raise_Q004 = ( 8 8 | "This is a" @@ -71,7 +68,6 @@ singles_escaped_unnecessary.py:13:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 10 10 | ) 11 11 | 12 12 | # Same as above, but with f-strings @@ -94,7 +90,6 @@ singles_escaped_unnecessary.py:14:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 11 11 | 12 12 | # Same as above, but with f-strings 13 13 | f"This is a \'string\'" # Q004 @@ -116,7 +111,6 @@ singles_escaped_unnecessary.py:21:5: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 18 18 | fR"This is a \'string\'" 19 19 | this_should_raise_Q004 = ( 20 20 | f"This is a" @@ -139,7 +133,6 @@ singles_escaped_unnecessary.py:31:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 28 28 | # f'"foo" {"nested"}' 29 29 | # 30 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -161,7 +154,6 @@ singles_escaped_unnecessary.py:32:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 29 29 | # 30 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 31 31 | f"\'foo\' {"foo"}" # Q004 @@ -184,7 +176,6 @@ singles_escaped_unnecessary.py:33:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 30 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 31 31 | f"\'foo\' {"foo"}" # Q004 32 32 | f"\'foo\' {f"foo"}" # Q004 @@ -207,7 +198,6 @@ singles_escaped_unnecessary.py:33:12: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 30 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 31 31 | f"\'foo\' {"foo"}" # Q004 32 32 | f"\'foo\' {f"foo"}" # Q004 @@ -229,7 +219,6 @@ singles_escaped_unnecessary.py:36:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 33 33 | f"\'foo\' {f"\'foo\'"} \'\'" # Q004 34 34 | 35 35 | f"normal {f"nested"} normal" @@ -252,7 +241,6 @@ singles_escaped_unnecessary.py:37:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 34 34 | 35 35 | f"normal {f"nested"} normal" 36 36 | f"\'normal\' {f"nested"} normal" # Q004 @@ -274,7 +262,6 @@ singles_escaped_unnecessary.py:38:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 35 35 | f"normal {f"nested"} normal" 36 36 | f"\'normal\' {f"nested"} normal" # Q004 37 37 | f"\'normal\' {f"nested"} 'single quotes'" @@ -296,7 +283,6 @@ singles_escaped_unnecessary.py:38:15: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 35 35 | f"normal {f"nested"} normal" 36 36 | f"\'normal\' {f"nested"} normal" # Q004 37 37 | f"\'normal\' {f"nested"} 'single quotes'" @@ -319,7 +305,6 @@ singles_escaped_unnecessary.py:39:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 36 36 | f"\'normal\' {f"nested"} normal" # Q004 37 37 | f"\'normal\' {f"nested"} 'single quotes'" 38 38 | f"\'normal\' {f"\'nested\' {"other"} normal"} 'single quotes'" # Q004 @@ -342,7 +327,6 @@ singles_escaped_unnecessary.py:39:15: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 36 36 | f"\'normal\' {f"nested"} normal" # Q004 37 37 | f"\'normal\' {f"nested"} 'single quotes'" 38 38 | f"\'normal\' {f"\'nested\' {"other"} normal"} 'single quotes'" # Q004 @@ -365,7 +349,6 @@ singles_escaped_unnecessary.py:43:26: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 40 40 | 41 41 | # Make sure we do not unescape quotes 42 42 | this_is_fine = "This is an \\'escaped\\' quote" @@ -385,7 +368,6 @@ singles_escaped_unnecessary.py:46:5: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 43 43 | this_should_raise_Q004 = "This is an \\\'escaped\\\' quote with an extra backslash" # Q004 44 44 | 45 45 | # Invalid escapes in bytestrings are also triggered: diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap index eb3931f8dd5b3..c98ff346aae2f 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap @@ -11,7 +11,6 @@ singles_implicit.py:2:5: Q000 [*] Single quotes found but double quotes preferre | = help: Replace single quotes with double quotes -Suggested fix: 1 1 | x = ( 2 |- 'This' 2 |+ "This" @@ -32,7 +31,6 @@ singles_implicit.py:3:5: Q000 [*] Single quotes found but double quotes preferre | = help: Replace single quotes with double quotes -Suggested fix: 1 1 | x = ( 2 2 | 'This' 3 |- 'is' @@ -53,7 +51,6 @@ singles_implicit.py:4:5: Q000 [*] Single quotes found but double quotes preferre | = help: Replace single quotes with double quotes -Suggested fix: 1 1 | x = ( 2 2 | 'This' 3 3 | 'is' @@ -75,7 +72,6 @@ singles_implicit.py:8:5: Q000 [*] Single quotes found but double quotes preferre | = help: Replace single quotes with double quotes -Suggested fix: 5 5 | ) 6 6 | 7 7 | x = ( @@ -98,7 +94,6 @@ singles_implicit.py:9:5: Q000 [*] Single quotes found but double quotes preferre | = help: Replace single quotes with double quotes -Suggested fix: 6 6 | 7 7 | x = ( 8 8 | 'This' \ @@ -120,7 +115,6 @@ singles_implicit.py:10:5: Q000 [*] Single quotes found but double quotes preferr | = help: Replace single quotes with double quotes -Suggested fix: 7 7 | x = ( 8 8 | 'This' \ 9 9 | 'is' \ @@ -141,7 +135,6 @@ singles_implicit.py:27:1: Q000 [*] Single quotes found but double quotes preferr | = help: Replace single quotes with double quotes -Suggested fix: 24 24 | 25 25 | if True: 26 26 | 'This can use "single" quotes' diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap index addbb8359506d..7b06ad71ef5d1 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap @@ -13,7 +13,6 @@ singles_multiline_string.py:1:5: Q001 [*] Single quote multiline found but doubl | = help: Replace single multiline quotes with double quotes -Suggested fix: 1 |-s = ''' This 'should' 1 |+s = """ This 'should' 2 2 | be diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_would_be_triple_quotes.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_would_be_triple_quotes.py.snap index 917992575cd59..3d603de2bae5a 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_would_be_triple_quotes.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_would_be_triple_quotes.py.snap @@ -17,7 +17,6 @@ singles_would_be_triple_quotes.py:1:33: Q000 [*] Single quotes found but double | = help: Replace single quotes with double quotes -Suggested fix: 1 |-s = ''"Start with empty string" ' and lint docstring safely' 1 |+s = ''"Start with empty string" " and lint docstring safely" 2 2 | s = 'Do not'" start with empty string" ' and lint docstring safely' @@ -32,7 +31,6 @@ singles_would_be_triple_quotes.py:2:5: Q000 [*] Single quotes found but double q | = help: Replace single quotes with double quotes -Suggested fix: 1 1 | s = ''"Start with empty string" ' and lint docstring safely' 2 |-s = 'Do not'" start with empty string" ' and lint docstring safely' 2 |+s = "Do not"" start with empty string" ' and lint docstring safely' @@ -47,7 +45,6 @@ singles_would_be_triple_quotes.py:2:40: Q000 [*] Single quotes found but double | = help: Replace single quotes with double quotes -Suggested fix: 1 1 | s = ''"Start with empty string" ' and lint docstring safely' 2 |-s = 'Do not'" start with empty string" ' and lint docstring safely' 2 |+s = 'Do not'" start with empty string" " and lint docstring safely" diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap index 58861e61d07e3..f0d14f9528909 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap @@ -10,7 +10,6 @@ doubles.py:1:25: Q000 [*] Double quotes found but single quotes preferred | = help: Replace double quotes with single quotes -Suggested fix: 1 |-this_should_be_linted = "double quote string" 1 |+this_should_be_linted = 'double quote string' 2 2 | this_should_be_linted = u"double quote string" @@ -29,7 +28,6 @@ doubles.py:2:25: Q000 [*] Double quotes found but single quotes preferred | = help: Replace double quotes with single quotes -Suggested fix: 1 1 | this_should_be_linted = "double quote string" 2 |-this_should_be_linted = u"double quote string" 2 |+this_should_be_linted = u'double quote string' @@ -48,7 +46,6 @@ doubles.py:3:25: Q000 [*] Double quotes found but single quotes preferred | = help: Replace double quotes with single quotes -Suggested fix: 1 1 | this_should_be_linted = "double quote string" 2 2 | this_should_be_linted = u"double quote string" 3 |-this_should_be_linted = f"double quote string" diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap index 95dbad67cf008..57ed1bb1c9ab2 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap @@ -10,7 +10,6 @@ doubles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 1 |-this_should_raise_Q003 = 'This is a \'string\'' 1 |+this_should_raise_Q003 = "This is a 'string'" 2 2 | this_should_raise_Q003 = 'This is \\ a \\\'string\'' @@ -29,7 +28,6 @@ doubles_escaped.py:2:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 1 1 | this_should_raise_Q003 = 'This is a \'string\'' 2 |-this_should_raise_Q003 = 'This is \\ a \\\'string\'' 2 |+this_should_raise_Q003 = "This is \\ a \\'string'" @@ -49,7 +47,6 @@ doubles_escaped.py:10:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 7 7 | this_is_fine = R'This is a \'string\'' 8 8 | this_should_raise = ( 9 9 | 'This is a' @@ -71,7 +68,6 @@ doubles_escaped.py:14:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 11 11 | ) 12 12 | 13 13 | # Same as above, but with f-strings @@ -94,7 +90,6 @@ doubles_escaped.py:15:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 12 12 | 13 13 | # Same as above, but with f-strings 14 14 | f'This is a \'string\'' # Q003 @@ -116,7 +111,6 @@ doubles_escaped.py:23:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 20 20 | fR'This is a \'string\'' 21 21 | foo = ( 22 22 | f'This is a' @@ -139,7 +133,6 @@ doubles_escaped.py:33:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 30 30 | # f"'foo' {'nested'}" 31 31 | # 32 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -161,7 +154,6 @@ doubles_escaped.py:34:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 31 31 | # 32 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 33 33 | f'\'foo\' {'nested'}' # Q003 @@ -184,7 +176,6 @@ doubles_escaped.py:35:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 32 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 33 33 | f'\'foo\' {'nested'}' # Q003 34 34 | f'\'foo\' {f'nested'}' # Q003 @@ -207,7 +198,6 @@ doubles_escaped.py:35:12: Q003 [*] Change outer quotes to avoid escaping inner q | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 32 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 33 33 | f'\'foo\' {'nested'}' # Q003 34 34 | f'\'foo\' {f'nested'}' # Q003 @@ -229,7 +219,6 @@ doubles_escaped.py:38:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 35 35 | f'\'foo\' {f'\'nested\''} \'\'' # Q003 36 36 | 37 37 | f'normal {f'nested'} normal' @@ -251,7 +240,6 @@ doubles_escaped.py:40:15: Q003 [*] Change outer quotes to avoid escaping inner q | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 37 37 | f'normal {f'nested'} normal' 38 38 | f'\'normal\' {f'nested'} normal' # Q003 39 39 | f'\'normal\' {f'nested'} "double quotes"' @@ -270,7 +258,6 @@ doubles_escaped.py:41:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 38 38 | f'\'normal\' {f'nested'} normal' # Q003 39 39 | f'\'normal\' {f'nested'} "double quotes"' 40 40 | f'\'normal\' {f'\'nested\' {'other'} normal'} "double quotes"' # Q003 diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_py311.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_py311.snap index 45781253d715a..7d774f74bd53d 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_py311.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_py311.snap @@ -10,7 +10,6 @@ doubles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 1 |-this_should_raise_Q003 = 'This is a \'string\'' 1 |+this_should_raise_Q003 = "This is a 'string'" 2 2 | this_should_raise_Q003 = 'This is \\ a \\\'string\'' @@ -29,7 +28,6 @@ doubles_escaped.py:2:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 1 1 | this_should_raise_Q003 = 'This is a \'string\'' 2 |-this_should_raise_Q003 = 'This is \\ a \\\'string\'' 2 |+this_should_raise_Q003 = "This is \\ a \\'string'" @@ -49,7 +47,6 @@ doubles_escaped.py:10:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 7 7 | this_is_fine = R'This is a \'string\'' 8 8 | this_should_raise = ( 9 9 | 'This is a' @@ -71,7 +68,6 @@ doubles_escaped.py:14:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 11 11 | ) 12 12 | 13 13 | # Same as above, but with f-strings @@ -94,7 +90,6 @@ doubles_escaped.py:15:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 12 12 | 13 13 | # Same as above, but with f-strings 14 14 | f'This is a \'string\'' # Q003 @@ -116,7 +111,6 @@ doubles_escaped.py:23:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -Suggested fix: 20 20 | fR'This is a \'string\'' 21 21 | foo = ( 22 22 | f'This is a' diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap index f7e98b9cbbb77..c405a484e55a7 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap @@ -10,7 +10,6 @@ doubles_escaped_unnecessary.py:1:26: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 1 |-this_should_raise_Q004 = 'This is a \"string\"' 1 |+this_should_raise_Q004 = 'This is a "string"' 2 2 | this_should_raise_Q004 = 'This is \\ a \\\"string\"' @@ -29,7 +28,6 @@ doubles_escaped_unnecessary.py:2:26: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 1 1 | this_should_raise_Q004 = 'This is a \"string\"' 2 |-this_should_raise_Q004 = 'This is \\ a \\\"string\"' 2 |+this_should_raise_Q004 = 'This is \\ a \\"string"' @@ -50,7 +48,6 @@ doubles_escaped_unnecessary.py:3:16: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 1 1 | this_should_raise_Q004 = 'This is a \"string\"' 2 2 | this_should_raise_Q004 = 'This is \\ a \\\"string\"' 3 |-this_is_fine = '"This" is a \"string\"' @@ -71,7 +68,6 @@ doubles_escaped_unnecessary.py:10:5: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 7 7 | this_is_fine = R'This is a \"string\"' 8 8 | this_should_raise_Q004 = ( 9 9 | 'This is a' @@ -93,7 +89,6 @@ doubles_escaped_unnecessary.py:14:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 11 11 | ) 12 12 | 13 13 | # Same as above, but with f-strings @@ -116,7 +111,6 @@ doubles_escaped_unnecessary.py:15:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 12 12 | 13 13 | # Same as above, but with f-strings 14 14 | f'This is a \"string\"' # Q004 @@ -139,7 +133,6 @@ doubles_escaped_unnecessary.py:16:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 13 13 | # Same as above, but with f-strings 14 14 | f'This is a \"string\"' # Q004 15 15 | f'This is \\ a \\\"string\"' # Q004 @@ -161,7 +154,6 @@ doubles_escaped_unnecessary.py:23:5: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 20 20 | fR'This is a \"string\"' 21 21 | this_should_raise_Q004 = ( 22 22 | f'This is a' @@ -184,7 +176,6 @@ doubles_escaped_unnecessary.py:33:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 30 30 | # f"'foo' {'nested'}" 31 31 | # 32 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -206,7 +197,6 @@ doubles_escaped_unnecessary.py:34:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 31 31 | # 32 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 33 33 | f'\"foo\" {'nested'}' # Q004 @@ -229,7 +219,6 @@ doubles_escaped_unnecessary.py:35:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 32 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 33 33 | f'\"foo\" {'nested'}' # Q004 34 34 | f'\"foo\" {f'nested'}' # Q004 @@ -252,7 +241,6 @@ doubles_escaped_unnecessary.py:35:12: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 32 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. 33 33 | f'\"foo\" {'nested'}' # Q004 34 34 | f'\"foo\" {f'nested'}' # Q004 @@ -274,7 +262,6 @@ doubles_escaped_unnecessary.py:38:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 35 35 | f'\"foo\" {f'\"nested\"'} \"\"' # Q004 36 36 | 37 37 | f'normal {f'nested'} normal' @@ -297,7 +284,6 @@ doubles_escaped_unnecessary.py:39:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 36 36 | 37 37 | f'normal {f'nested'} normal' 38 38 | f'\"normal\" {f'nested'} normal' # Q004 @@ -319,7 +305,6 @@ doubles_escaped_unnecessary.py:40:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 37 37 | f'normal {f'nested'} normal' 38 38 | f'\"normal\" {f'nested'} normal' # Q004 39 39 | f'\"normal\" {f'nested'} "double quotes"' @@ -341,7 +326,6 @@ doubles_escaped_unnecessary.py:40:15: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 37 37 | f'normal {f'nested'} normal' 38 38 | f'\"normal\" {f'nested'} normal' # Q004 39 39 | f'\"normal\" {f'nested'} "double quotes"' @@ -364,7 +348,6 @@ doubles_escaped_unnecessary.py:41:1: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 38 38 | f'\"normal\" {f'nested'} normal' # Q004 39 39 | f'\"normal\" {f'nested'} "double quotes"' 40 40 | f'\"normal\" {f'\"nested\" {'other'} normal'} "double quotes"' # Q004 @@ -387,7 +370,6 @@ doubles_escaped_unnecessary.py:41:15: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 38 38 | f'\"normal\" {f'nested'} normal' # Q004 39 39 | f'\"normal\" {f'nested'} "double quotes"' 40 40 | f'\"normal\" {f'\"nested\" {'other'} normal'} "double quotes"' # Q004 @@ -408,7 +390,6 @@ doubles_escaped_unnecessary.py:45:26: Q004 [*] Unnecessary escape on inner quote | = help: Remove backslash -Suggested fix: 42 42 | 43 43 | # Make sure we do not unescape quotes 44 44 | this_is_fine = 'This is an \\"escaped\\" quote' diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap index a40bc0525aee7..3fe80d9ebd34a 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap @@ -11,7 +11,6 @@ doubles_implicit.py:2:5: Q000 [*] Double quotes found but single quotes preferre | = help: Replace double quotes with single quotes -Suggested fix: 1 1 | x = ( 2 |- "This" 2 |+ 'This' @@ -32,7 +31,6 @@ doubles_implicit.py:3:5: Q000 [*] Double quotes found but single quotes preferre | = help: Replace double quotes with single quotes -Suggested fix: 1 1 | x = ( 2 2 | "This" 3 |- "is" @@ -53,7 +51,6 @@ doubles_implicit.py:4:5: Q000 [*] Double quotes found but single quotes preferre | = help: Replace double quotes with single quotes -Suggested fix: 1 1 | x = ( 2 2 | "This" 3 3 | "is" @@ -75,7 +72,6 @@ doubles_implicit.py:8:5: Q000 [*] Double quotes found but single quotes preferre | = help: Replace double quotes with single quotes -Suggested fix: 5 5 | ) 6 6 | 7 7 | x = ( @@ -98,7 +94,6 @@ doubles_implicit.py:9:5: Q000 [*] Double quotes found but single quotes preferre | = help: Replace double quotes with single quotes -Suggested fix: 6 6 | 7 7 | x = ( 8 8 | "This" \ @@ -120,7 +115,6 @@ doubles_implicit.py:10:5: Q000 [*] Double quotes found but single quotes preferr | = help: Replace double quotes with single quotes -Suggested fix: 7 7 | x = ( 8 8 | "This" \ 9 9 | "is" \ @@ -141,7 +135,6 @@ doubles_implicit.py:27:1: Q000 [*] Double quotes found but single quotes preferr | = help: Replace double quotes with single quotes -Suggested fix: 24 24 | 25 25 | if True: 26 26 | "This can use 'double' quotes" diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap index 72a085987c5db..a6d4d77b58010 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap @@ -13,7 +13,6 @@ doubles_multiline_string.py:1:5: Q001 [*] Double quote multiline found but singl | = help: Replace double multiline quotes with single quotes -Suggested fix: 1 |-s = """ This "should" 1 |+s = ''' This "should" 2 2 | be diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_would_be_triple_quotes.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_would_be_triple_quotes.py.snap index 892506f1a7d2f..7582f82084c8b 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_would_be_triple_quotes.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_would_be_triple_quotes.py.snap @@ -17,7 +17,6 @@ doubles_would_be_triple_quotes.py:2:5: Q000 [*] Double quotes found but single q | = help: Replace double quotes with single quotes -Suggested fix: 1 1 | s = ""'Start with empty string' ' and lint docstring safely' 2 |-s = "Do not"' start with empty string' ' and lint docstring safely' 2 |+s = 'Do not'' start with empty string' ' and lint docstring safely' diff --git a/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap b/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap index d67b9362402c7..dbcf1ef0167a3 100644 --- a/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap +++ b/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap @@ -12,7 +12,6 @@ RSE102.py:5:21: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -Suggested fix: 2 2 | y = 6 + "7" 3 3 | except TypeError: 4 4 | # RSE102 @@ -34,7 +33,6 @@ RSE102.py:13:16: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -Suggested fix: 10 10 | raise 11 11 | 12 12 | # RSE102 @@ -56,7 +54,6 @@ RSE102.py:16:17: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -Suggested fix: 13 13 | raise TypeError() 14 14 | 15 15 | # RSE102 @@ -79,7 +76,6 @@ RSE102.py:20:5: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -Suggested fix: 17 17 | 18 18 | # RSE102 19 19 | raise TypeError \ @@ -102,7 +98,6 @@ RSE102.py:24:5: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -Suggested fix: 21 21 | 22 22 | # RSE102 23 23 | raise TypeError \ @@ -127,7 +122,6 @@ RSE102.py:27:16: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -Suggested fix: 24 24 | (); 25 25 | 26 26 | # RSE102 @@ -154,7 +148,6 @@ RSE102.py:32:19: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -Suggested fix: 29 29 | ) 30 30 | 31 31 | # RSE102 @@ -181,7 +174,6 @@ RSE102.py:37:16: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -Suggested fix: 34 34 | ) 35 35 | 36 36 | # RSE102 @@ -205,7 +197,6 @@ RSE102.py:74:17: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -Suggested fix: 71 71 | 72 72 | 73 73 | # RSE102 @@ -227,7 +218,6 @@ RSE102.py:76:17: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -Suggested fix: 73 73 | # RSE102 74 74 | raise IndexError()from ZeroDivisionError 75 75 | @@ -250,7 +240,6 @@ RSE102.py:79:17: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -Suggested fix: 76 76 | raise IndexError()\ 77 77 | from ZeroDivisionError 78 78 | @@ -273,7 +262,6 @@ RSE102.py:81:17: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -Suggested fix: 78 78 | 79 79 | raise IndexError() from ZeroDivisionError 80 80 | @@ -295,7 +283,6 @@ RSE102.py:84:10: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -Suggested fix: 81 81 | raise IndexError(); 82 82 | 83 83 | # RSE102 @@ -316,7 +303,6 @@ RSE102.py:107:27: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -Suggested fix: 104 104 | # RSE102 105 105 | future = executor.submit(float, "a") 106 106 | if future.exception(): diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET501_RET501.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET501_RET501.py.snap index 7fcf22779af54..4522cc2fc6762 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET501_RET501.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET501_RET501.py.snap @@ -10,7 +10,6 @@ RET501.py:4:5: RET501 [*] Do not explicitly `return None` in function if it is t | = help: Remove explicit `return None` -Suggested fix: 1 1 | def x(y): 2 2 | if not y: 3 3 | return @@ -33,7 +32,6 @@ RET501.py:14:9: RET501 [*] Do not explicitly `return None` in function if it is | = help: Remove explicit `return None` -Suggested fix: 11 11 | 12 12 | def get(self, key: str) -> None: 13 13 | print(f"{key} not found") diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET502_RET502.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET502_RET502.py.snap index d0a26a8fd538c..b18c1a7aad0ab 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET502_RET502.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET502_RET502.py.snap @@ -11,7 +11,6 @@ RET502.py:3:9: RET502 [*] Do not implicitly `return None` in function able to re | = help: Add explicit `None` return value -Suggested fix: 1 1 | def x(y): 2 2 | if not y: 3 |- return # error diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap index 793b0d64ebd35..6a9711074312a 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap @@ -13,7 +13,6 @@ RET503.py:21:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -Suggested fix: 20 20 | def x(y): 21 21 | if not y: 22 22 | return 1 @@ -35,7 +34,6 @@ RET503.py:28:9: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -Suggested fix: 26 26 | def x(y): 27 27 | if not y: 28 28 | print() # error @@ -55,7 +53,6 @@ RET503.py:37:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -Suggested fix: 35 35 | return 1 36 36 | 37 37 | print() # error @@ -79,7 +76,6 @@ RET503.py:42:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -Suggested fix: 42 42 | for i in range(10): 43 43 | if i > 10: 44 44 | return i @@ -99,7 +95,6 @@ RET503.py:53:9: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -Suggested fix: 51 51 | return i 52 52 | else: 53 53 | print() # error @@ -119,7 +114,6 @@ RET503.py:60:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -Suggested fix: 58 58 | if x > 0: 59 59 | return False 60 60 | no_such_function() # error @@ -139,7 +133,6 @@ RET503.py:67:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -Suggested fix: 65 65 | if x > 0: 66 66 | return False 67 67 | print("", end="") # error @@ -163,7 +156,6 @@ RET503.py:83:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -Suggested fix: 84 84 | if y > 0: 85 85 | return 1 86 86 | y += 1 @@ -187,7 +179,6 @@ RET503.py:114:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -Suggested fix: 115 115 | if i > y: 116 116 | break 117 117 | return z @@ -213,7 +204,6 @@ RET503.py:121:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -Suggested fix: 125 125 | else: 126 126 | return z 127 127 | return None @@ -236,7 +226,6 @@ RET503.py:131:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -Suggested fix: 132 132 | if i < y: 133 133 | continue 134 134 | return z @@ -262,7 +251,6 @@ RET503.py:138:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -Suggested fix: 142 142 | else: 143 143 | return z 144 144 | return None @@ -284,7 +272,6 @@ RET503.py:275:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -Suggested fix: 274 274 | 275 275 | for value in values: 276 276 | print(value) @@ -304,7 +291,6 @@ RET503.py:292:13: RET503 [*] Missing explicit `return` at the end of function ab | = help: Add explicit `return` statement -Suggested fix: 290 290 | return 1 291 291 | case 1: 292 292 | print() # error @@ -326,7 +312,6 @@ RET503.py:301:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -Suggested fix: 300 300 | def example(): 301 301 | if True: 302 302 | return "" @@ -347,7 +332,6 @@ RET503.py:306:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -Suggested fix: 305 305 | def example(): 306 306 | if True: 307 307 | return "" @@ -368,7 +352,6 @@ RET503.py:311:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -Suggested fix: 310 310 | def example(): 311 311 | if True: 312 312 | return "" # type: ignore @@ -389,7 +372,6 @@ RET503.py:316:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -Suggested fix: 315 315 | def example(): 316 316 | if True: 317 317 | return "" ; @@ -411,7 +393,6 @@ RET503.py:321:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -Suggested fix: 321 321 | if True: 322 322 | return "" \ 323 323 | ; # type: ignore @@ -431,7 +412,6 @@ RET503.py:329:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -Suggested fix: 328 328 | return 1 329 329 | x = 2 \ 330 330 | @@ -451,7 +431,6 @@ RET503.py:339:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -Suggested fix: 337 337 | if x == 5: 338 338 | return 5 339 339 | bar() @@ -471,7 +450,6 @@ RET503.py:354:13: RET503 [*] Missing explicit `return` at the end of function ab | = help: Add explicit `return` statement -Suggested fix: 352 352 | return "third" 353 353 | case _: 354 354 | raises(string) @@ -491,7 +469,6 @@ RET503.py:370:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -Suggested fix: 368 368 | if baz() > 3: 369 369 | return 1 370 370 | bar() diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap index 563f89ded4c83..74c8dedbefa6a 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap @@ -10,7 +10,6 @@ RET504.py:6:12: RET504 [*] Unnecessary assignment to `a` before `return` stateme | = help: Remove unnecessary assignment -Suggested fix: 2 2 | # Errors 3 3 | ### 4 4 | def x(): @@ -32,7 +31,6 @@ RET504.py:23:12: RET504 [*] Unnecessary assignment to `formatted` before `return | = help: Remove unnecessary assignment -Suggested fix: 19 19 | def x(): 20 20 | formatted = _USER_AGENT_FORMATTER.format(format_string, **values) 21 21 | # clean up after any blank components @@ -54,7 +52,6 @@ RET504.py:246:12: RET504 [*] Unnecessary assignment to `queryset` before `return | = help: Remove unnecessary assignment -Suggested fix: 242 242 | 243 243 | def get_queryset(): 244 244 | queryset = Model.filter(a=1) @@ -76,7 +73,6 @@ RET504.py:251:12: RET504 [*] Unnecessary assignment to `queryset` before `return | = help: Remove unnecessary assignment -Suggested fix: 247 247 | 248 248 | 249 249 | def get_queryset(): @@ -98,7 +94,6 @@ RET504.py:269:12: RET504 [*] Unnecessary assignment to `val` before `return` sta | = help: Remove unnecessary assignment -Suggested fix: 265 265 | def str_to_bool(val): 266 266 | if isinstance(val, bool): 267 267 | return val @@ -120,7 +115,6 @@ RET504.py:321:12: RET504 [*] Unnecessary assignment to `x` before `return` state | = help: Remove unnecessary assignment -Suggested fix: 317 317 | # `with` statements 318 318 | def foo(): 319 319 | with open("foo.txt", "r") as f: @@ -142,7 +136,6 @@ RET504.py:342:12: RET504 [*] Unnecessary assignment to `b` before `return` state | = help: Remove unnecessary assignment -Suggested fix: 338 338 | # Fix cases 339 339 | def foo(): 340 340 | a = 1 @@ -164,7 +157,6 @@ RET504.py:348:12: RET504 [*] Unnecessary assignment to `b` before `return` state | = help: Remove unnecessary assignment -Suggested fix: 344 344 | 345 345 | def foo(): 346 346 | a = 1 @@ -186,7 +178,6 @@ RET504.py:354:12: RET504 [*] Unnecessary assignment to `b` before `return` state | = help: Remove unnecessary assignment -Suggested fix: 350 350 | 351 351 | def foo(): 352 352 | a = 1 @@ -208,7 +199,6 @@ RET504.py:359:12: RET504 [*] Unnecessary assignment to `a` before `return` state | = help: Remove unnecessary assignment -Suggested fix: 355 355 | 356 356 | 357 357 | def foo(): @@ -230,7 +220,6 @@ RET504.py:365:12: RET504 [*] Unnecessary assignment to `D` before `return` state | = help: Remove unnecessary assignment -Suggested fix: 361 361 | 362 362 | # Regression test for: https://github.com/astral-sh/ruff/issues/7098 363 363 | def mavko_debari(P_kbar): @@ -252,7 +241,6 @@ RET504.py:400:12: RET504 [*] Unnecessary assignment to `y` before `return` state | = help: Remove unnecessary assignment -Suggested fix: 396 396 | x = 2 397 397 | with contextlib.suppress(Exception): 398 398 | x = 1 @@ -274,7 +262,6 @@ RET504.py:423:16: RET504 [*] Unnecessary assignment to `services` before `return | = help: Remove unnecessary assignment -Suggested fix: 419 419 | # See: https://github.com/astral-sh/ruff/issues/10732 420 420 | def func(a: dict[str, int]) -> list[dict[str, int]]: 421 421 | if "services" in a: diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET505_RET505.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET505_RET505.py.snap index 67e9d8e6470f6..8a3d5f83b52fd 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET505_RET505.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET505_RET505.py.snap @@ -12,7 +12,6 @@ RET505.py:8:5: RET505 [*] Unnecessary `elif` after `return` statement | = help: Remove unnecessary `elif` -Suggested fix: 5 5 | if x: # [no-else-return] 6 6 | a = 1 7 7 | return y @@ -35,7 +34,6 @@ RET505.py:23:5: RET505 [*] Unnecessary `elif` after `return` statement | = help: Remove unnecessary `elif` -Suggested fix: 20 20 | else: 21 21 | b = 2 22 22 | return @@ -58,7 +56,6 @@ RET505.py:41:5: RET505 [*] Unnecessary `elif` after `return` statement | = help: Remove unnecessary `elif` -Suggested fix: 38 38 | if x: # [no-else-return] 39 39 | a = 1 40 40 | return y @@ -81,7 +78,6 @@ RET505.py:53:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -Suggested fix: 50 50 | if x: # [no-else-return] 51 51 | a = 1 52 52 | return y @@ -107,7 +103,6 @@ RET505.py:64:9: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -Suggested fix: 61 61 | if y: # [no-else-return] 62 62 | b = 2 63 63 | return y @@ -133,7 +128,6 @@ RET505.py:79:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -Suggested fix: 76 76 | else: 77 77 | b = 2 78 78 | return @@ -157,7 +151,6 @@ RET505.py:89:9: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -Suggested fix: 86 86 | if y: # [no-else-return] 87 87 | a = 4 88 88 | return @@ -181,7 +174,6 @@ RET505.py:99:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -Suggested fix: 96 96 | def bar4(x): 97 97 | if x: # [no-else-return] 98 98 | return True @@ -211,7 +203,6 @@ RET505.py:109:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -Suggested fix: 106 106 | def fibo(n): 107 107 | if n<2: 108 108 | return n; @@ -237,7 +228,6 @@ RET505.py:145:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -Suggested fix: 142 142 | def bar4(x): 143 143 | if True: 144 144 | return @@ -262,7 +252,6 @@ RET505.py:153:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -Suggested fix: 150 150 | def bar5(): 151 151 | if True: 152 152 | return @@ -287,7 +276,6 @@ RET505.py:160:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -Suggested fix: 157 157 | def bar6(): 158 158 | if True: 159 159 | return @@ -314,7 +302,6 @@ RET505.py:169:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -Suggested fix: 166 166 | def bar7(): 167 167 | if True: 168 168 | return @@ -338,7 +325,6 @@ RET505.py:177:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -Suggested fix: 174 174 | def bar8(): 175 175 | if True: 176 176 | return @@ -360,7 +346,6 @@ RET505.py:183:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -Suggested fix: 180 180 | def bar9(): 181 181 | if True: 182 182 | return @@ -382,7 +367,6 @@ RET505.py:200:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -Suggested fix: 197 197 | # Regression test for: https://github.com/astral-sh/ruff/issues/9732 198 198 | def sb(self): 199 199 | if self._sb is not None: return self._sb @@ -405,7 +389,6 @@ RET505.py:207:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -Suggested fix: 204 204 | if x: # [no-else-return] 205 205 | a = 1 206 206 | return y @@ -432,7 +415,6 @@ RET505.py:217:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -Suggested fix: 214 214 | if x: # [no-else-return] 215 215 | a = 1 216 216 | return y @@ -460,7 +442,6 @@ RET505.py:227:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -Suggested fix: 224 224 | if x: # [no-else-return] 225 225 | a = 1 226 226 | return y @@ -488,7 +469,6 @@ RET505.py:237:5: RET505 [*] Unnecessary `else` after `return` statement | = help: Remove unnecessary `else` -Suggested fix: 234 234 | if x: # [no-else-return] 235 235 | a = 1 236 236 | return y diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET506_RET506.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET506_RET506.py.snap index 5e623556e9ffe..6ed414c7c0a93 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET506_RET506.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET506_RET506.py.snap @@ -12,7 +12,6 @@ RET506.py:8:5: RET506 [*] Unnecessary `elif` after `raise` statement | = help: Remove unnecessary `elif` -Suggested fix: 5 5 | if x: # [no-else-raise] 6 6 | a = 1 7 7 | raise Exception(y) @@ -35,7 +34,6 @@ RET506.py:23:5: RET506 [*] Unnecessary `elif` after `raise` statement | = help: Remove unnecessary `elif` -Suggested fix: 20 20 | else: 21 21 | b = 2 22 22 | raise Exception(x) @@ -58,7 +56,6 @@ RET506.py:34:5: RET506 [*] Unnecessary `else` after `raise` statement | = help: Remove unnecessary `else` -Suggested fix: 31 31 | if x: # [no-else-raise] 32 32 | a = 1 33 33 | raise Exception(y) @@ -84,7 +81,6 @@ RET506.py:45:9: RET506 [*] Unnecessary `else` after `raise` statement | = help: Remove unnecessary `else` -Suggested fix: 42 42 | if y: # [no-else-raise] 43 43 | b = 2 44 44 | raise Exception(y) @@ -110,7 +106,6 @@ RET506.py:60:5: RET506 [*] Unnecessary `else` after `raise` statement | = help: Remove unnecessary `else` -Suggested fix: 57 57 | else: 58 58 | b = 2 59 59 | raise Exception(x) @@ -134,7 +129,6 @@ RET506.py:70:9: RET506 [*] Unnecessary `else` after `raise` statement | = help: Remove unnecessary `else` -Suggested fix: 67 67 | if y: # [no-else-raise] 68 68 | a = 4 69 69 | raise Exception(x) @@ -158,7 +152,6 @@ RET506.py:80:5: RET506 [*] Unnecessary `else` after `raise` statement | = help: Remove unnecessary `else` -Suggested fix: 77 77 | def bar4(x): 78 78 | if x: # [no-else-raise] 79 79 | raise Exception(True) diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET507_RET507.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET507_RET507.py.snap index e863b00d8b3c9..eb0bcffe42fec 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET507_RET507.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET507_RET507.py.snap @@ -12,7 +12,6 @@ RET507.py:8:9: RET507 [*] Unnecessary `elif` after `continue` statement | = help: Remove unnecessary `elif` -Suggested fix: 5 5 | for i in x: 6 6 | if i < y: # [no-else-continue] 7 7 | continue @@ -35,7 +34,6 @@ RET507.py:22:9: RET507 [*] Unnecessary `elif` after `continue` statement | = help: Remove unnecessary `elif` -Suggested fix: 19 19 | else: 20 20 | b = 2 21 21 | continue @@ -57,7 +55,6 @@ RET507.py:36:9: RET507 [*] Unnecessary `else` after `continue` statement | = help: Remove unnecessary `else` -Suggested fix: 33 33 | for i in x: 34 34 | if i < y: # [no-else-continue] 35 35 | continue @@ -81,7 +78,6 @@ RET507.py:47:13: RET507 [*] Unnecessary `else` after `continue` statement | = help: Remove unnecessary `else` -Suggested fix: 44 44 | if z: # [no-else-continue] 45 45 | b = 2 46 46 | continue @@ -107,7 +103,6 @@ RET507.py:63:9: RET507 [*] Unnecessary `else` after `continue` statement | = help: Remove unnecessary `else` -Suggested fix: 60 60 | else: 61 61 | b = 2 62 62 | continue @@ -131,7 +126,6 @@ RET507.py:74:13: RET507 [*] Unnecessary `else` after `continue` statement | = help: Remove unnecessary `else` -Suggested fix: 71 71 | if y: # [no-else-continue] 72 72 | a = 4 73 73 | continue @@ -155,7 +149,6 @@ RET507.py:85:9: RET507 [*] Unnecessary `else` after `continue` statement | = help: Remove unnecessary `else` -Suggested fix: 82 82 | for i in range(10): 83 83 | if x: # [no-else-continue] 84 84 | continue diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET508_RET508.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET508_RET508.py.snap index c05aeb9b17721..1acb7cffd975d 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET508_RET508.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET508_RET508.py.snap @@ -12,7 +12,6 @@ RET508.py:8:9: RET508 [*] Unnecessary `elif` after `break` statement | = help: Remove unnecessary `elif` -Suggested fix: 5 5 | for i in x: 6 6 | if i > y: # [no-else-break] 7 7 | break @@ -35,7 +34,6 @@ RET508.py:22:9: RET508 [*] Unnecessary `elif` after `break` statement | = help: Remove unnecessary `elif` -Suggested fix: 19 19 | else: 20 20 | b = 2 21 21 | break @@ -57,7 +55,6 @@ RET508.py:33:9: RET508 [*] Unnecessary `else` after `break` statement | = help: Remove unnecessary `else` -Suggested fix: 30 30 | for i in x: 31 31 | if i > y: # [no-else-break] 32 32 | break @@ -81,7 +78,6 @@ RET508.py:44:13: RET508 [*] Unnecessary `else` after `break` statement | = help: Remove unnecessary `else` -Suggested fix: 41 41 | if z: # [no-else-break] 42 42 | b = 2 43 43 | break @@ -107,7 +103,6 @@ RET508.py:60:9: RET508 [*] Unnecessary `else` after `break` statement | = help: Remove unnecessary `else` -Suggested fix: 57 57 | else: 58 58 | b = 2 59 59 | break @@ -131,7 +126,6 @@ RET508.py:71:13: RET508 [*] Unnecessary `else` after `break` statement | = help: Remove unnecessary `else` -Suggested fix: 68 68 | if y: # [no-else-break] 69 69 | a = 4 70 70 | break @@ -155,7 +149,6 @@ RET508.py:82:9: RET508 [*] Unnecessary `else` after `break` statement | = help: Remove unnecessary `else` -Suggested fix: 79 79 | for i in range(10): 80 80 | if x: # [no-else-break] 81 81 | break @@ -184,7 +177,6 @@ RET508.py:158:13: RET508 [*] Unnecessary `else` after `break` statement | = help: Remove unnecessary `else` -Suggested fix: 155 155 | else: 156 156 | if i > w: 157 157 | break diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap index cd659ed5cab20..d1ef589847cd1 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap @@ -9,7 +9,6 @@ SIM101.py:1:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing | = help: Merge `isinstance` calls for `a` -Suggested fix: 1 |-if isinstance(a, int) or isinstance(a, float): # SIM101 1 |+if isinstance(a, (int, float)): # SIM101 2 2 | pass @@ -28,7 +27,6 @@ SIM101.py:4:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing | = help: Merge `isinstance` calls for `a` -Suggested fix: 1 1 | if isinstance(a, int) or isinstance(a, float): # SIM101 2 2 | pass 3 3 | @@ -50,7 +48,6 @@ SIM101.py:7:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing | = help: Merge `isinstance` calls for `a` -Suggested fix: 4 4 | if isinstance(a, (int, float)) or isinstance(a, bool): # SIM101 5 5 | pass 6 6 | @@ -72,7 +69,6 @@ SIM101.py:10:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -Suggested fix: 7 7 | if isinstance(a, int) or isinstance(a, float) or isinstance(b, bool): # SIM101 8 8 | pass 9 9 | @@ -94,7 +90,6 @@ SIM101.py:16:5: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -Suggested fix: 13 13 | if isinstance(a, int) or isinstance(b, bool) or isinstance(a, float): # SIM101 14 14 | pass 15 15 | @@ -116,7 +111,6 @@ SIM101.py:19:4: SIM101 [*] Multiple `isinstance` calls for expression, merge int | = help: Merge `isinstance` calls -Suggested fix: 16 16 | if (isinstance(a, int) or isinstance(a, float)) and isinstance(b, bool): # SIM101 17 17 | pass 18 18 | @@ -148,7 +142,6 @@ SIM101.py:38:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -Suggested fix: 35 35 | if isinstance(a, int) or unrelated_condition or isinstance(a, float): 36 36 | pass 37 37 | @@ -170,7 +163,6 @@ SIM101.py:41:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -Suggested fix: 38 38 | if x or isinstance(a, int) or isinstance(a, float): 39 39 | pass 40 40 | @@ -191,7 +183,6 @@ SIM101.py:53:3: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -Suggested fix: 50 50 | pass 51 51 | 52 52 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722460483 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap index 42f69c8df6c22..5732ade9df827 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap @@ -11,7 +11,6 @@ SIM102.py:2:1: SIM102 [*] Use a single `if` statement instead of nested `if` sta | = help: Combine `if` statements using `and` -Suggested fix: 1 1 | # SIM102 2 |-if a: 3 |- if b: @@ -35,7 +34,6 @@ SIM102.py:7:1: SIM102 [*] Use a single `if` statement instead of nested `if` sta | = help: Combine `if` statements using `and` -Suggested fix: 4 4 | c 5 5 | 6 6 | # SIM102 @@ -64,7 +62,6 @@ SIM102.py:8:5: SIM102 [*] Use a single `if` statement instead of nested `if` sta | = help: Combine `if` statements using `and` -Suggested fix: 5 5 | 6 6 | # SIM102 7 7 | if a: @@ -90,7 +87,6 @@ SIM102.py:15:1: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -Suggested fix: 12 12 | # SIM102 13 13 | if a: 14 14 | pass @@ -127,7 +123,6 @@ SIM102.py:26:1: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -Suggested fix: 23 23 | c 24 24 | 25 25 | # SIM102 @@ -157,7 +152,6 @@ SIM102.py:51:5: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -Suggested fix: 48 48 | 49 49 | while x > 0: 50 50 | # SIM102 @@ -195,7 +189,6 @@ SIM102.py:67:1: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -Suggested fix: 64 64 | 65 65 | 66 66 | # SIM102 @@ -236,7 +229,6 @@ SIM102.py:83:5: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -Suggested fix: 80 80 | 81 81 | while x > 0: 82 82 | # SIM102 @@ -267,7 +259,6 @@ SIM102.py:90:1: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -Suggested fix: 87 87 | print("Bad module!") 88 88 | 89 89 | # SIM102 (auto-fixable) @@ -311,7 +302,6 @@ SIM102.py:106:5: SIM102 [*] Use a single `if` statement instead of nested `if` s | = help: Combine `if` statements using `and` -Suggested fix: 103 103 | # SIM102 104 104 | # Regression test for https://github.com/apache/airflow/blob/145b16caaa43f0c42bffd97344df916c602cddde/airflow/configuration.py#L1161 105 105 | if a: @@ -339,7 +329,6 @@ SIM102.py:132:5: SIM102 [*] Use a single `if` statement instead of nested `if` s | = help: Combine `if` statements using `and` -Suggested fix: 129 129 | # OK 130 130 | if a: 131 131 | # SIM 102 @@ -366,7 +355,6 @@ SIM102.py:165:5: SIM102 [*] Use a single `if` statement instead of nested `if` s | = help: Combine `if` statements using `and` -Suggested fix: 162 162 | def f(): 163 163 | if a: 164 164 | pass diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap index 20759bbb86fb6..ca06668cb1b32 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap @@ -14,7 +14,6 @@ SIM103.py:3:5: SIM103 [*] Return the condition `bool(a)` directly | = help: Replace with `return bool(a)` -Suggested fix: 1 1 | def f(): 2 2 | # SIM103 3 |- if a: @@ -41,7 +40,6 @@ SIM103.py:11:5: SIM103 [*] Return the condition `a == b` directly | = help: Replace with `return a == b` -Suggested fix: 8 8 | 9 9 | def f(): 10 10 | # SIM103 @@ -69,7 +67,6 @@ SIM103.py:21:5: SIM103 [*] Return the condition `bool(b)` directly | = help: Replace with `return bool(b)` -Suggested fix: 18 18 | # SIM103 19 19 | if a: 20 20 | return 1 @@ -97,7 +94,6 @@ SIM103.py:32:9: SIM103 [*] Return the condition `bool(b)` directly | = help: Replace with `return bool(b)` -Suggested fix: 29 29 | if a: 30 30 | return 1 31 31 | else: @@ -125,7 +121,6 @@ SIM103.py:57:5: SIM103 [*] Return the condition `not a` directly | = help: Replace with `return not a` -Suggested fix: 54 54 | 55 55 | def f(): 56 56 | # SIM103 @@ -166,7 +161,6 @@ SIM103.py:91:5: SIM103 [*] Return the condition `not (keys is not None and notic | = help: Replace with `return not (keys is not None and notice.key not in keys)` -Suggested fix: 88 88 | 89 89 | def f(): 90 90 | # SIM103 @@ -193,7 +187,6 @@ SIM103.py:104:5: SIM103 [*] Return the condition `bool(a)` directly | = help: Replace with `return bool(a)` -Suggested fix: 101 101 | 102 102 | def f(): 103 103 | # SIM103 @@ -219,7 +212,6 @@ SIM103.py:111:5: SIM103 [*] Return the condition `not a` directly | = help: Replace with `return not a` -Suggested fix: 108 108 | 109 109 | def f(): 110 110 | # SIM103 @@ -244,7 +236,6 @@ SIM103.py:117:5: SIM103 [*] Return the condition `10 < a` directly | = help: Replace with `return 10 < a` -Suggested fix: 114 114 | 115 115 | 116 116 | def f(): @@ -269,7 +260,6 @@ SIM103.py:123:5: SIM103 [*] Return the condition `not 10 < a` directly | = help: Replace with `return not 10 < a` -Suggested fix: 120 120 | 121 121 | 122 122 | def f(): diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap index 5e4e68bd78ba4..36f17d26185fe 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap @@ -12,7 +12,6 @@ SIM105_0.py:6:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `tr | = help: Replace with `contextlib.suppress(ValueError)` -Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -43,7 +42,6 @@ SIM105_0.py:13:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` inst | = help: Replace with `contextlib.suppress(ValueError, OSError)` -Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -76,7 +74,6 @@ SIM105_0.py:19:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` inst | = help: Replace with `contextlib.suppress(ValueError, OSError)` -Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -109,7 +106,6 @@ SIM105_0.py:25:1: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `tr | = help: Replace with `contextlib.suppress(Exception)` -Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -142,7 +138,6 @@ SIM105_0.py:31:1: SIM105 [*] Use `contextlib.suppress(a.Error, b.Error)` instead | = help: Replace with `contextlib.suppress(a.Error, b.Error)` -Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -175,7 +170,6 @@ SIM105_0.py:85:5: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `t | = help: Replace with `contextlib.suppress(ValueError)` -Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -224,7 +218,6 @@ SIM105_0.py:117:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try | = help: Replace with `contextlib.suppress(OSError)` -Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -258,7 +251,6 @@ SIM105_0.py:122:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try | = help: Replace with `contextlib.suppress(OSError)` -Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -291,7 +283,6 @@ SIM105_0.py:126:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try | = help: Replace with `contextlib.suppress(OSError)` -Suggested fix: 1 |+import contextlib 1 2 | def foo(): 2 3 | pass diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap index 20508b7d3ed94..84761e419652e 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap @@ -12,7 +12,6 @@ SIM105_1.py:5:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `tr | = help: Replace with `contextlib.suppress(ValueError)` -Suggested fix: 1 1 | """Case: There's a random import, so it should add `contextlib` after it.""" 2 2 | import math 3 |+import contextlib diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap index fa1779140411b..1cb19addae311 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap @@ -12,7 +12,6 @@ SIM105_2.py:10:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `t | = help: Replace with `contextlib.suppress(ValueError)` -Suggested fix: 7 7 | 8 8 | 9 9 | # SIM105 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap index 033399cd6607c..11a20ff3fb39e 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap @@ -11,7 +11,6 @@ SIM105_4.py:2:1: SIM105 [*] Use `contextlib.suppress(ImportError)` instead of `t | = help: Replace with `contextlib.suppress(ImportError)` -Suggested fix: 1 1 | #!/usr/bin/env python 2 |-try: 2 |+import contextlib diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap index 72ba2c077b982..251196206e6e7 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap @@ -14,7 +14,6 @@ SIM108.py:2:1: SIM108 [*] Use ternary operator `b = c if a else d` instead of `i | = help: Replace `if`-`else`-block with `b = c if a else d` -Suggested fix: 1 1 | # SIM108 2 |-if a: 3 |- b = c @@ -40,7 +39,6 @@ SIM108.py:30:5: SIM108 [*] Use ternary operator `b = 1 if a else 2` instead of ` | = help: Replace `if`-`else`-block with `b = 1 if a else 2` -Suggested fix: 27 27 | if True: 28 28 | pass 29 29 | else: @@ -79,7 +77,6 @@ SIM108.py:82:1: SIM108 [*] Use ternary operator `b = "cccccccccccccccccccccccccc | = help: Replace `if`-`else`-block with `b = "cccccccccccccccccccccccccccccccccß" if a else "ddddddddddddddddddddddddddddddddd💣"` -Suggested fix: 79 79 | 80 80 | 81 81 | # SIM108 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap index a698deb16006f..d8bd3fffa72cd 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap @@ -10,7 +10,6 @@ SIM109.py:2:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compari | = help: Replace with `a in (b, c)` -Suggested fix: 1 1 | # SIM109 2 |-if a == b or a == c: 2 |+if a in (b, c): @@ -29,7 +28,6 @@ SIM109.py:6:5: SIM109 [*] Use `a in (b, c)` instead of multiple equality compari | = help: Replace with `a in (b, c)` -Suggested fix: 3 3 | d 4 4 | 5 5 | # SIM109 @@ -50,7 +48,6 @@ SIM109.py:10:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compar | = help: Replace with `a in (b, c)` -Suggested fix: 7 7 | d 8 8 | 9 9 | # SIM109 @@ -71,7 +68,6 @@ SIM109.py:14:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compar | = help: Replace with `a in (b, c)` -Suggested fix: 11 11 | d 12 12 | 13 13 | # SIM109 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap index 6f0a065ad0f9d..671c977478cd5 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap @@ -14,7 +14,6 @@ SIM110.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead o | = help: Replace with `return any(check(x) for x in iterable)` -Suggested fix: 1 1 | def f(): 2 2 | # SIM110 3 |- for x in iterable: @@ -41,7 +40,6 @@ SIM110.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -Suggested fix: 22 22 | 23 23 | def f(): 24 24 | # SIM111 @@ -69,7 +67,6 @@ SIM110.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` inst | = help: Replace with `return all(x.is_empty() for x in iterable)` -Suggested fix: 30 30 | 31 31 | def f(): 32 32 | # SIM111 @@ -98,7 +95,6 @@ SIM110.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -Suggested fix: 52 52 | 53 53 | def f(): 54 54 | # SIM110 @@ -128,7 +124,6 @@ SIM110.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -Suggested fix: 61 61 | 62 62 | def f(): 63 63 | # SIM111 @@ -159,7 +154,6 @@ SIM110.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -Suggested fix: 70 70 | 71 71 | def f(): 72 72 | # SIM110 @@ -190,7 +184,6 @@ SIM110.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -Suggested fix: 80 80 | 81 81 | def f(): 82 82 | # SIM111 @@ -244,7 +237,6 @@ SIM110.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -Suggested fix: 141 141 | x = 1 142 142 | 143 143 | # SIM110 @@ -271,7 +263,6 @@ SIM110.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` ins | = help: Replace with `return all(not check(x) for x in iterable)` -Suggested fix: 151 151 | x = 1 152 152 | 153 153 | # SIM111 @@ -299,7 +290,6 @@ SIM110.py:162:5: SIM110 [*] Use `return any(x.isdigit() for x in "012ß9💣2ℝ | = help: Replace with `return any(x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ")` -Suggested fix: 159 159 | 160 160 | def f(): 161 161 | # SIM110 @@ -329,7 +319,6 @@ SIM110.py:184:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -Suggested fix: 181 181 | 182 182 | async def f(): 183 183 | # SIM110 @@ -359,7 +348,6 @@ SIM110.py:191:5: SIM110 [*] Use `return any(check(x) for x in await iterable)` i | = help: Replace with `return any(check(x) for x in await iterable)` -Suggested fix: 188 188 | 189 189 | async def f(): 190 190 | # SIM110 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap index cddc7aa027145..e5edcc3018ac6 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap @@ -14,7 +14,6 @@ SIM111.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead o | = help: Replace with `return any(check(x) for x in iterable)` -Suggested fix: 1 1 | def f(): 2 2 | # SIM110 3 |- for x in iterable: @@ -41,7 +40,6 @@ SIM111.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -Suggested fix: 22 22 | 23 23 | def f(): 24 24 | # SIM111 @@ -69,7 +67,6 @@ SIM111.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` inst | = help: Replace with `return all(x.is_empty() for x in iterable)` -Suggested fix: 30 30 | 31 31 | def f(): 32 32 | # SIM111 @@ -98,7 +95,6 @@ SIM111.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -Suggested fix: 52 52 | 53 53 | def f(): 54 54 | # SIM110 @@ -128,7 +124,6 @@ SIM111.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -Suggested fix: 61 61 | 62 62 | def f(): 63 63 | # SIM111 @@ -159,7 +154,6 @@ SIM111.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -Suggested fix: 70 70 | 71 71 | def f(): 72 72 | # SIM110 @@ -190,7 +184,6 @@ SIM111.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -Suggested fix: 80 80 | 81 81 | def f(): 82 82 | # SIM111 @@ -244,7 +237,6 @@ SIM111.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -Suggested fix: 141 141 | x = 1 142 142 | 143 143 | # SIM110 @@ -271,7 +263,6 @@ SIM111.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` ins | = help: Replace with `return all(not check(x) for x in iterable)` -Suggested fix: 151 151 | x = 1 152 152 | 153 153 | # SIM111 @@ -299,7 +290,6 @@ SIM111.py:162:5: SIM110 [*] Use `return all(x in y for x in iterable)` instead o | = help: Replace with `return all(x in y for x in iterable)` -Suggested fix: 159 159 | 160 160 | def f(): 161 161 | # SIM111 @@ -327,7 +317,6 @@ SIM111.py:170:5: SIM110 [*] Use `return all(x <= y for x in iterable)` instead o | = help: Replace with `return all(x <= y for x in iterable)` -Suggested fix: 167 167 | 168 168 | def f(): 169 169 | # SIM111 @@ -355,7 +344,6 @@ SIM111.py:178:5: SIM110 [*] Use `return all(not x.isdigit() for x in "012ß9💣 | = help: Replace with `return all(not x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9")` -Suggested fix: 175 175 | 176 176 | def f(): 177 177 | # SIM111 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap index b5592397f0624..8ee9d5386aef8 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap @@ -11,7 +11,6 @@ SIM112.py:4:12: SIM112 [*] Use capitalized environment variable `FOO` instead of | = help: Replace `foo` with `FOO` -Suggested fix: 1 1 | import os 2 2 | 3 3 | # Bad @@ -78,7 +77,6 @@ SIM112.py:14:18: SIM112 [*] Use capitalized environment variable `FOO` instead o | = help: Replace `foo` with `FOO` -Suggested fix: 11 11 | 12 12 | env = os.environ.get('foo') 13 13 | @@ -110,7 +108,6 @@ SIM112.py:19:22: SIM112 [*] Use capitalized environment variable `FOO` instead o | = help: Replace `foo` with `FOO` -Suggested fix: 16 16 | if env := os.environ.get('foo'): 17 17 | pass 18 18 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM114_SIM114.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM114_SIM114.py.snap index 12cbac068fdda..595c252b42485 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM114_SIM114.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM114_SIM114.py.snap @@ -14,7 +14,6 @@ SIM114.py:2:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -Suggested fix: 1 1 | # Errors 2 |-if a: 3 |- b @@ -40,7 +39,6 @@ SIM114.py:7:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -Suggested fix: 4 4 | elif c: 5 5 | b 6 6 | @@ -70,7 +68,6 @@ SIM114.py:12:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -Suggested fix: 9 9 | elif c: # but not on the second branch 10 10 | b 11 11 | @@ -103,7 +100,6 @@ SIM114.py:19:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -Suggested fix: 16 16 | for _ in range(20): 17 17 | print("hello") 18 18 | @@ -143,7 +139,6 @@ SIM114.py:28:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -Suggested fix: 25 25 | for _ in range(20): 26 26 | print("hello") 27 27 | @@ -178,7 +173,6 @@ SIM114.py:29:5: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -Suggested fix: 26 26 | print("hello") 27 27 | 28 28 | if x == 1: @@ -210,7 +204,6 @@ SIM114.py:36:5: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -Suggested fix: 33 33 | for _ in range(20): 34 34 | print("hello") 35 35 | elif x == 2: @@ -254,7 +247,6 @@ SIM114.py:43:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -Suggested fix: 55 55 | and i == 12 56 56 | and j == 13 57 57 | and k == 14 @@ -282,7 +274,6 @@ SIM114.py:67:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -Suggested fix: 64 64 | pass 65 65 | elif result.eofs == "S": 66 66 | skipped = 1 @@ -310,7 +301,6 @@ SIM114.py:69:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -Suggested fix: 66 66 | skipped = 1 67 67 | elif result.eofs == "F": 68 68 | errors = 1 @@ -336,7 +326,6 @@ SIM114.py:71:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -Suggested fix: 68 68 | errors = 1 69 69 | elif result.eofs == "E": 70 70 | errors = 1 @@ -365,7 +354,6 @@ SIM114.py:118:5: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -Suggested fix: 115 115 | def func(): 116 116 | a = True 117 117 | b = False @@ -392,7 +380,6 @@ SIM114.py:122:5: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -Suggested fix: 119 119 | return 3 120 120 | elif a == b: 121 121 | return 3 @@ -419,7 +406,6 @@ SIM114.py:132:5: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -Suggested fix: 129 129 | """Ensure that the named expression is parenthesized when merged.""" 130 130 | a = True 131 131 | b = False @@ -443,7 +429,6 @@ SIM114.py:138:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -Suggested fix: 135 135 | return 3 136 136 | 137 137 | @@ -465,7 +450,6 @@ SIM114.py:144:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -Suggested fix: 141 141 | b 142 142 | 143 143 | @@ -487,7 +471,6 @@ SIM114.py:148:1: SIM114 [*] Combine `if` branches using logical `or` operator | = help: Combine `if` branches -Suggested fix: 145 145 | elif c: b 146 146 | 147 147 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap index 91e05d165252d..7f247e76537cc 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap @@ -11,7 +11,6 @@ SIM117.py:2:1: SIM117 [*] Use a single `with` statement with multiple contexts i | = help: Combine `with` statements -Suggested fix: 1 1 | # SIM117 2 |-with A() as a: 3 |- with B() as b: @@ -35,7 +34,6 @@ SIM117.py:7:1: SIM117 [*] Use a single `with` statement with multiple contexts i | = help: Combine `with` statements -Suggested fix: 4 4 | print("hello") 5 5 | 6 6 | # SIM117 @@ -74,7 +72,6 @@ SIM117.py:19:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -Suggested fix: 16 16 | print("hello") 17 17 | 18 18 | # SIM117 @@ -101,7 +98,6 @@ SIM117.py:47:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -Suggested fix: 44 44 | print("hello") 45 45 | 46 46 | # SIM117 @@ -129,7 +125,6 @@ SIM117.py:53:5: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -Suggested fix: 50 50 | 51 51 | while True: 52 52 | # SIM117 @@ -169,7 +164,6 @@ SIM117.py:68:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -Suggested fix: 67 67 | # SIM117 68 68 | with ( 69 69 | A() as a, @@ -198,7 +192,6 @@ SIM117.py:76:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -Suggested fix: 73 73 | print("hello") 74 74 | 75 75 | # SIM117 @@ -235,7 +228,6 @@ SIM117.py:84:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -Suggested fix: 83 83 | # SIM117 84 84 | with ( 85 85 | A() as a, @@ -265,7 +257,6 @@ SIM117.py:95:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -Suggested fix: 92 92 | print("hello") 93 93 | 94 94 | # SIM117 (auto-fixable) @@ -312,7 +303,6 @@ SIM117.py:126:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -Suggested fix: 123 123 | f(b2, c2, d2) 124 124 | 125 125 | # SIM117 @@ -350,7 +340,6 @@ SIM117.py:163:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -Suggested fix: 160 160 | pass 161 161 | 162 162 | # Do not suppress combination, if a context manager is already combined with another. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap index 096643745f8cf..8a6b968027ae5 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap @@ -12,7 +12,6 @@ SIM118.py:3:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -Suggested fix: 1 1 | obj = {} 2 2 | 3 |-key in obj.keys() # SIM118 @@ -34,7 +33,6 @@ SIM118.py:5:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys | = help: Remove `.keys()` -Suggested fix: 2 2 | 3 3 | key in obj.keys() # SIM118 4 4 | @@ -57,7 +55,6 @@ SIM118.py:7:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -Suggested fix: 4 4 | 5 5 | key not in obj.keys() # SIM118 6 6 | @@ -80,7 +77,6 @@ SIM118.py:9:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys | = help: Remove `.keys()` -Suggested fix: 6 6 | 7 7 | foo["bar"] in obj.keys() # SIM118 8 8 | @@ -103,7 +99,6 @@ SIM118.py:11:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -Suggested fix: 8 8 | 9 9 | foo["bar"] not in obj.keys() # SIM118 10 10 | @@ -126,7 +121,6 @@ SIM118.py:13:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.key | = help: Remove `.keys()` -Suggested fix: 10 10 | 11 11 | foo['bar'] in obj.keys() # SIM118 12 12 | @@ -149,7 +143,6 @@ SIM118.py:15:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -Suggested fix: 12 12 | 13 13 | foo['bar'] not in obj.keys() # SIM118 14 14 | @@ -172,7 +165,6 @@ SIM118.py:17:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.key | = help: Remove `.keys()` -Suggested fix: 14 14 | 15 15 | foo() in obj.keys() # SIM118 16 16 | @@ -194,7 +186,6 @@ SIM118.py:19:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -Suggested fix: 16 16 | 17 17 | foo() not in obj.keys() # SIM118 18 18 | @@ -217,7 +208,6 @@ SIM118.py:26:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -Suggested fix: 23 23 | if some_property(key): 24 24 | del obj[key] 25 25 | @@ -240,7 +230,6 @@ SIM118.py:28:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -Suggested fix: 25 25 | 26 26 | [k for k in obj.keys()] # SIM118 27 27 | @@ -263,7 +252,6 @@ SIM118.py:30:11: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -Suggested fix: 27 27 | 28 28 | {k for k in obj.keys()} # SIM118 29 29 | @@ -286,7 +274,6 @@ SIM118.py:32:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -Suggested fix: 29 29 | 30 30 | {k: k for k in obj.keys()} # SIM118 31 31 | @@ -309,7 +296,6 @@ SIM118.py:34:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -Suggested fix: 31 31 | 32 32 | (k for k in obj.keys()) # SIM118 33 33 | @@ -332,7 +318,6 @@ SIM118.py:36:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -Suggested fix: 33 33 | 34 34 | key in (obj or {}).keys() # SIM118 35 35 | @@ -354,7 +339,6 @@ SIM118.py:50:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -Suggested fix: 47 47 | 48 48 | 49 49 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124 @@ -376,7 +360,6 @@ SIM118.py:51:2: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -Suggested fix: 48 48 | 49 49 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124 50 50 | key in obj.keys()and foo @@ -399,7 +382,6 @@ SIM118.py:52:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -Suggested fix: 49 49 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124 50 50 | key in obj.keys()and foo 51 51 | (key in obj.keys())and foo @@ -425,7 +407,6 @@ SIM118.py:55:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -Suggested fix: 55 55 | for key in ( 56 56 | self.experiment.surveys[0] 57 57 | .stations[0] @@ -445,7 +426,6 @@ SIM118.py:65:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -Suggested fix: 62 62 | from builtins import dict as SneakyDict 63 63 | 64 64 | d = SneakyDict() diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM201_SIM201.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM201_SIM201.py.snap index 9bf00cdfd3d71..0a21596fdac86 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM201_SIM201.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM201_SIM201.py.snap @@ -10,7 +10,6 @@ SIM201.py:2:4: SIM201 [*] Use `a != b` instead of `not a == b` | = help: Replace with `!=` operator -Suggested fix: 1 1 | # SIM201 2 |-if not a == b: 2 |+if a != b: @@ -29,7 +28,6 @@ SIM201.py:6:4: SIM201 [*] Use `a != b + c` instead of `not a == b + c` | = help: Replace with `!=` operator -Suggested fix: 3 3 | pass 4 4 | 5 5 | # SIM201 @@ -50,7 +48,6 @@ SIM201.py:10:4: SIM201 [*] Use `a + b != c` instead of `not a + b == c` | = help: Replace with `!=` operator -Suggested fix: 7 7 | pass 8 8 | 9 9 | # SIM201 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap index e38fefe496ded..5398388710202 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap @@ -10,7 +10,6 @@ SIM202.py:2:4: SIM202 [*] Use `a == b` instead of `not a != b` | = help: Replace with `==` operator -Suggested fix: 1 1 | # SIM202 2 |-if not a != b: 2 |+if a == b: @@ -29,7 +28,6 @@ SIM202.py:6:4: SIM202 [*] Use `a == b + c` instead of `not a != b + c` | = help: Replace with `==` operator -Suggested fix: 3 3 | pass 4 4 | 5 5 | # SIM202 @@ -50,7 +48,6 @@ SIM202.py:10:4: SIM202 [*] Use `a + b == c` instead of `not a + b != c` | = help: Replace with `==` operator -Suggested fix: 7 7 | pass 8 8 | 9 9 | # SIM202 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap index 8dcd4b24d3d83..51f9798a13ba4 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap @@ -9,7 +9,6 @@ SIM208.py:1:4: SIM208 [*] Use `a` instead of `not (not a)` | = help: Replace with `a` -Suggested fix: 1 |-if not (not a): # SIM208 1 |+if a: # SIM208 2 2 | pass @@ -28,7 +27,6 @@ SIM208.py:4:4: SIM208 [*] Use `a == b` instead of `not (not a == b)` | = help: Replace with `a == b` -Suggested fix: 1 1 | if not (not a): # SIM208 2 2 | pass 3 3 | @@ -51,7 +49,6 @@ SIM208.py:16:5: SIM208 [*] Use `b` instead of `not (not b)` | = help: Replace with `b` -Suggested fix: 13 13 | if not a != b: # OK 14 14 | pass 15 15 | @@ -74,7 +71,6 @@ SIM208.py:18:3: SIM208 [*] Use `a` instead of `not (not a)` | = help: Replace with `a` -Suggested fix: 15 15 | 16 16 | a = not not b # SIM208 17 17 | @@ -96,7 +92,6 @@ SIM208.py:20:9: SIM208 [*] Use `a` instead of `not (not a)` | = help: Replace with `a` -Suggested fix: 17 17 | 18 18 | f(not not a) # SIM208 19 19 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap index 87c06bea3cc44..b81ce52379de8 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap @@ -10,7 +10,6 @@ SIM210.py:1:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` | = help: Replace with `bool(...) -Suggested fix: 1 |-a = True if b else False # SIM210 1 |+a = bool(b) # SIM210 2 2 | @@ -30,7 +29,6 @@ SIM210.py:3:5: SIM210 [*] Remove unnecessary `True if ... else False` | = help: Remove unnecessary `True if ... else False` -Suggested fix: 1 1 | a = True if b else False # SIM210 2 2 | 3 |-a = True if b != c else False # SIM210 @@ -52,7 +50,6 @@ SIM210.py:5:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` | = help: Replace with `bool(...) -Suggested fix: 2 2 | 3 3 | a = True if b != c else False # SIM210 4 4 | @@ -83,7 +80,6 @@ SIM210.py:19:11: SIM210 [*] Remove unnecessary `True if ... else False` | = help: Remove unnecessary `True if ... else False` -Suggested fix: 16 16 | 17 17 | 18 18 | # Regression test for: https://github.com/astral-sh/ruff/issues/7076 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap index 35306b1ea3a5d..f60f9edd37826 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap @@ -10,7 +10,6 @@ SIM211.py:1:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | = help: Replace with `not ...` -Suggested fix: 1 |-a = False if b else True # SIM211 1 |+a = not b # SIM211 2 2 | @@ -30,7 +29,6 @@ SIM211.py:3:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | = help: Replace with `not ...` -Suggested fix: 1 1 | a = False if b else True # SIM211 2 2 | 3 |-a = False if b != c else True # SIM211 @@ -52,7 +50,6 @@ SIM211.py:5:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | = help: Replace with `not ...` -Suggested fix: 2 2 | 3 3 | a = False if b != c else True # SIM211 4 4 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap index 73c3e98277931..14a10705bf47e 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap @@ -10,7 +10,6 @@ SIM212.py:1:5: SIM212 [*] Use `a if a else b` instead of `b if not a else a` | = help: Replace with `a if a else b` -Suggested fix: 1 |-c = b if not a else a # SIM212 1 |+c = a if a else b # SIM212 2 2 | @@ -30,7 +29,6 @@ SIM212.py:3:5: SIM212 [*] Use `a if a else b + c` instead of `b + c if not a els | = help: Replace with `a if a else b + c` -Suggested fix: 1 1 | c = b if not a else a # SIM212 2 2 | 3 |-c = b + c if not a else a # SIM212 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap index d51da47aa76a1..dd145389de7db 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap @@ -9,7 +9,6 @@ SIM220.py:1:4: SIM220 [*] Use `False` instead of `a and not a` | = help: Replace with `False` -Suggested fix: 1 |-if a and not a: 1 |+if False: 2 2 | pass @@ -28,7 +27,6 @@ SIM220.py:4:5: SIM220 [*] Use `False` instead of `a and not a` | = help: Replace with `False` -Suggested fix: 1 1 | if a and not a: 2 2 | pass 3 3 | @@ -50,7 +48,6 @@ SIM220.py:7:5: SIM220 [*] Use `False` instead of `a and not a` | = help: Replace with `False` -Suggested fix: 4 4 | if (a and not a) and b: 5 5 | pass 6 6 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap index 99bf61000d5d3..fc06a05f1b5ca 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap @@ -9,7 +9,6 @@ SIM221.py:1:4: SIM221 [*] Use `True` instead of `a or not a` | = help: Replace with `True` -Suggested fix: 1 |-if a or not a: 1 |+if True: 2 2 | pass @@ -28,7 +27,6 @@ SIM221.py:4:5: SIM221 [*] Use `True` instead of `a or not a` | = help: Replace with `True` -Suggested fix: 1 1 | if a or not a: 2 2 | pass 3 3 | @@ -50,7 +48,6 @@ SIM221.py:7:5: SIM221 [*] Use `True` instead of `a or not a` | = help: Replace with `True` -Suggested fix: 4 4 | if (a or not a) or b: 5 5 | pass 6 6 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap index aa314e68a2360..bdb3b9dc9ddcf 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap @@ -9,7 +9,6 @@ SIM222.py:1:4: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -Suggested fix: 1 |-if a or True: # SIM222 1 |+if True: # SIM222 2 2 | pass @@ -28,7 +27,6 @@ SIM222.py:4:4: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -Suggested fix: 1 1 | if a or True: # SIM222 2 2 | pass 3 3 | @@ -50,7 +48,6 @@ SIM222.py:7:10: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -Suggested fix: 4 4 | if (a or b) or True: # SIM222 5 5 | pass 6 6 | @@ -72,7 +69,6 @@ SIM222.py:24:16: SIM222 [*] Use `True` instead of `True or ...` | = help: Replace with `True` -Suggested fix: 21 21 | if a or f() or b or g() or True: # OK 22 22 | pass 23 23 | @@ -94,7 +90,6 @@ SIM222.py:27:4: SIM222 [*] Use `True` instead of `True or ...` | = help: Replace with `True` -Suggested fix: 24 24 | if a or f() or True or g() or b: # SIM222 25 25 | pass 26 26 | @@ -116,7 +111,6 @@ SIM222.py:30:4: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -Suggested fix: 27 27 | if True or f() or a or g() or b: # SIM222 28 28 | pass 29 29 | @@ -137,7 +131,6 @@ SIM222.py:47:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -Suggested fix: 44 44 | pass 45 45 | 46 46 | @@ -160,7 +153,6 @@ SIM222.py:49:6: SIM222 [*] Use `"foo"` instead of `"foo" or ...` | = help: Replace with `"foo"` -Suggested fix: 46 46 | 47 47 | a or "" or True # SIM222 48 48 | @@ -183,7 +175,6 @@ SIM222.py:51:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -Suggested fix: 48 48 | 49 49 | a or "foo" or True or "bar" # SIM222 50 50 | @@ -206,7 +197,6 @@ SIM222.py:53:6: SIM222 [*] Use `1` instead of `1 or ...` | = help: Replace with `1` -Suggested fix: 50 50 | 51 51 | a or 0 or True # SIM222 52 52 | @@ -229,7 +219,6 @@ SIM222.py:55:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -Suggested fix: 52 52 | 53 53 | a or 1 or True or 2 # SIM222 54 54 | @@ -252,7 +241,6 @@ SIM222.py:57:6: SIM222 [*] Use `0.1` instead of `0.1 or ...` | = help: Replace with `0.1` -Suggested fix: 54 54 | 55 55 | a or 0.0 or True # SIM222 56 56 | @@ -275,7 +263,6 @@ SIM222.py:59:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -Suggested fix: 56 56 | 57 57 | a or 0.1 or True or 0.2 # SIM222 58 58 | @@ -298,7 +285,6 @@ SIM222.py:61:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -Suggested fix: 58 58 | 59 59 | a or [] or True # SIM222 60 60 | @@ -321,7 +307,6 @@ SIM222.py:63:6: SIM222 [*] Use `[1]` instead of `[1] or ...` | = help: Replace with `[1]` -Suggested fix: 60 60 | 61 61 | a or list([]) or True # SIM222 62 62 | @@ -344,7 +329,6 @@ SIM222.py:65:6: SIM222 [*] Use `list([1])` instead of `list([1]) or ...` | = help: Replace with `list([1])` -Suggested fix: 62 62 | 63 63 | a or [1] or True or [2] # SIM222 64 64 | @@ -367,7 +351,6 @@ SIM222.py:67:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -Suggested fix: 64 64 | 65 65 | a or list([1]) or True or list([2]) # SIM222 66 66 | @@ -390,7 +373,6 @@ SIM222.py:69:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -Suggested fix: 66 66 | 67 67 | a or {} or True # SIM222 68 68 | @@ -413,7 +395,6 @@ SIM222.py:71:6: SIM222 [*] Use `{1: 1}` instead of `{1: 1} or ...` | = help: Replace with `{1: 1}` -Suggested fix: 68 68 | 69 69 | a or dict() or True # SIM222 70 70 | @@ -436,7 +417,6 @@ SIM222.py:73:6: SIM222 [*] Use `dict({1: 1})` instead of `dict({1: 1}) or ...` | = help: Replace with `dict({1: 1})` -Suggested fix: 70 70 | 71 71 | a or {1: 1} or True or {2: 2} # SIM222 72 72 | @@ -459,7 +439,6 @@ SIM222.py:75:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -Suggested fix: 72 72 | 73 73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222 74 74 | @@ -482,7 +461,6 @@ SIM222.py:77:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -Suggested fix: 74 74 | 75 75 | a or set() or True # SIM222 76 76 | @@ -505,7 +483,6 @@ SIM222.py:79:6: SIM222 [*] Use `{1}` instead of `{1} or ...` | = help: Replace with `{1}` -Suggested fix: 76 76 | 77 77 | a or set(set()) or True # SIM222 78 78 | @@ -528,7 +505,6 @@ SIM222.py:81:6: SIM222 [*] Use `set({1})` instead of `set({1}) or ...` | = help: Replace with `set({1})` -Suggested fix: 78 78 | 79 79 | a or {1} or True or {2} # SIM222 80 80 | @@ -551,7 +527,6 @@ SIM222.py:83:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -Suggested fix: 80 80 | 81 81 | a or set({1}) or True or set({2}) # SIM222 82 82 | @@ -574,7 +549,6 @@ SIM222.py:85:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -Suggested fix: 82 82 | 83 83 | a or () or True # SIM222 84 84 | @@ -597,7 +571,6 @@ SIM222.py:87:6: SIM222 [*] Use `(1,)` instead of `(1,) or ...` | = help: Replace with `(1,)` -Suggested fix: 84 84 | 85 85 | a or tuple(()) or True # SIM222 86 86 | @@ -620,7 +593,6 @@ SIM222.py:89:6: SIM222 [*] Use `tuple((1,))` instead of `tuple((1,)) or ...` | = help: Replace with `tuple((1,))` -Suggested fix: 86 86 | 87 87 | a or (1,) or True or (2,) # SIM222 88 88 | @@ -643,7 +615,6 @@ SIM222.py:91:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -Suggested fix: 88 88 | 89 89 | a or tuple((1,)) or True or tuple((2,)) # SIM222 90 90 | @@ -666,7 +637,6 @@ SIM222.py:93:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -Suggested fix: 90 90 | 91 91 | a or frozenset() or True # SIM222 92 92 | @@ -689,7 +659,6 @@ SIM222.py:95:6: SIM222 [*] Use `frozenset({1})` instead of `frozenset({1}) or .. | = help: Replace with `frozenset({1})` -Suggested fix: 92 92 | 93 93 | a or frozenset(frozenset()) or True # SIM222 94 94 | @@ -710,7 +679,6 @@ SIM222.py:97:6: SIM222 [*] Use `frozenset(frozenset({1}))` instead of `frozenset | = help: Replace with `frozenset(frozenset({1}))` -Suggested fix: 94 94 | 95 95 | a or frozenset({1}) or True or frozenset({2}) # SIM222 96 96 | @@ -733,7 +701,6 @@ SIM222.py:102:6: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -Suggested fix: 99 99 | 100 100 | # Inside test `a` is simplified. 101 101 | @@ -756,7 +723,6 @@ SIM222.py:104:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -Suggested fix: 101 101 | 102 102 | bool(a or [1] or True or [2]) # SIM222 103 103 | @@ -778,7 +744,6 @@ SIM222.py:106:5: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -Suggested fix: 103 103 | 104 104 | assert a or [1] or True or [2] # SIM222 105 105 | @@ -800,7 +765,6 @@ SIM222.py:106:35: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -Suggested fix: 103 103 | 104 104 | assert a or [1] or True or [2] # SIM222 105 105 | @@ -823,7 +787,6 @@ SIM222.py:109:6: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -Suggested fix: 106 106 | if (a or [1] or True or [2]) and (a or [1] or True or [2]): # SIM222 107 107 | pass 108 108 | @@ -845,7 +808,6 @@ SIM222.py:111:7: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -Suggested fix: 108 108 | 109 109 | 0 if a or [1] or True or [2] else 1 # SIM222 110 110 | @@ -868,7 +830,6 @@ SIM222.py:118:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -Suggested fix: 115 115 | 0 116 116 | for a in range(10) 117 117 | for b in range(10) @@ -890,7 +851,6 @@ SIM222.py:119:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -Suggested fix: 116 116 | for a in range(10) 117 117 | for b in range(10) 118 118 | if a or [1] or True or [2] # SIM222 @@ -913,7 +873,6 @@ SIM222.py:126:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -Suggested fix: 123 123 | 0 124 124 | for a in range(10) 125 125 | for b in range(10) @@ -935,7 +894,6 @@ SIM222.py:127:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -Suggested fix: 124 124 | for a in range(10) 125 125 | for b in range(10) 126 126 | if a or [1] or True or [2] # SIM222 @@ -958,7 +916,6 @@ SIM222.py:134:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -Suggested fix: 131 131 | 0: 0 132 132 | for a in range(10) 133 133 | for b in range(10) @@ -980,7 +937,6 @@ SIM222.py:135:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -Suggested fix: 132 132 | for a in range(10) 133 133 | for b in range(10) 134 134 | if a or [1] or True or [2] # SIM222 @@ -1003,7 +959,6 @@ SIM222.py:142:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -Suggested fix: 139 139 | 0 140 140 | for a in range(10) 141 141 | for b in range(10) @@ -1025,7 +980,6 @@ SIM222.py:143:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -Suggested fix: 140 140 | for a in range(10) 141 141 | for b in range(10) 142 142 | if a or [1] or True or [2] # SIM222 @@ -1048,7 +1002,6 @@ SIM222.py:148:6: SIM222 [*] Use `[1]` instead of `[1] or ...` | = help: Replace with `[1]` -Suggested fix: 145 145 | 146 146 | # Outside test `a` is not simplified. 147 147 | @@ -1070,7 +1023,6 @@ SIM222.py:150:10: SIM222 [*] Use `[1]` instead of `[1] or ...` | = help: Replace with `[1]` -Suggested fix: 147 147 | 148 148 | a or [1] or True or [2] # SIM222 149 149 | @@ -1092,7 +1044,6 @@ SIM222.py:153:11: SIM222 [*] Use `[1]` instead of `[1] or ...` | = help: Replace with `[1]` -Suggested fix: 150 150 | if (a or [1] or True or [2]) == (a or [1]): # SIM222 151 151 | pass 152 152 | @@ -1113,7 +1064,6 @@ SIM222.py:157:30: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) o | = help: Replace with `(int, int, int)` -Suggested fix: 154 154 | pass 155 155 | 156 156 | # Regression test for: https://github.com/astral-sh/ruff/issues/7099 @@ -1133,7 +1083,6 @@ SIM222.py:161:31: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) o | = help: Replace with `(int, int, int)` -Suggested fix: 158 158 | m, s = divmod(s0, 60) 159 159 | 160 160 | @@ -1155,7 +1104,6 @@ SIM222.py:168:7: SIM222 [*] Use `"bar"` instead of `... or "bar"` | = help: Replace with `"bar"` -Suggested fix: 165 165 | # Regression test for: https://github.com/astral-sh/ruff/issues/9479 166 166 | print(f"{a}{b}" or "bar") 167 167 | print(f"{a}{''}" or "bar") diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap index 445071e1db77b..d1ddb9f6e5dbd 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap @@ -9,7 +9,6 @@ SIM223.py:1:4: SIM223 [*] Use `False` instead of `... and False` | = help: Replace with `False` -Suggested fix: 1 |-if a and False: # SIM223 1 |+if False: # SIM223 2 2 | pass @@ -28,7 +27,6 @@ SIM223.py:4:4: SIM223 [*] Use `False` instead of `... and False` | = help: Replace with `False` -Suggested fix: 1 1 | if a and False: # SIM223 2 2 | pass 3 3 | @@ -50,7 +48,6 @@ SIM223.py:7:10: SIM223 [*] Use `False` instead of `... and False` | = help: Replace with `False` -Suggested fix: 4 4 | if (a or b) and False: # SIM223 5 5 | pass 6 6 | @@ -72,7 +69,6 @@ SIM223.py:19:18: SIM223 [*] Use `False` instead of `False and ...` | = help: Replace with `False` -Suggested fix: 16 16 | if a and f() and b and g() and False: # OK 17 17 | pass 18 18 | @@ -94,7 +90,6 @@ SIM223.py:22:4: SIM223 [*] Use `False` instead of `False and ...` | = help: Replace with `False` -Suggested fix: 19 19 | if a and f() and False and g() and b: # SIM223 20 20 | pass 21 21 | @@ -116,7 +111,6 @@ SIM223.py:25:4: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 22 22 | if False and f() and a and g() and b: # SIM223 23 23 | pass 24 24 | @@ -137,7 +131,6 @@ SIM223.py:42:7: SIM223 [*] Use `""` instead of `"" and ...` | = help: Replace with `""` -Suggested fix: 39 39 | pass 40 40 | 41 41 | @@ -160,7 +153,6 @@ SIM223.py:44:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 41 41 | 42 42 | a and "" and False # SIM223 43 43 | @@ -183,7 +175,6 @@ SIM223.py:46:7: SIM223 [*] Use `0` instead of `0 and ...` | = help: Replace with `0` -Suggested fix: 43 43 | 44 44 | a and "foo" and False and "bar" # SIM223 45 45 | @@ -206,7 +197,6 @@ SIM223.py:48:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 45 45 | 46 46 | a and 0 and False # SIM223 47 47 | @@ -229,7 +219,6 @@ SIM223.py:50:7: SIM223 [*] Use `0.0` instead of `0.0 and ...` | = help: Replace with `0.0` -Suggested fix: 47 47 | 48 48 | a and 1 and False and 2 # SIM223 49 49 | @@ -252,7 +241,6 @@ SIM223.py:52:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 49 49 | 50 50 | a and 0.0 and False # SIM223 51 51 | @@ -275,7 +263,6 @@ SIM223.py:54:7: SIM223 [*] Use `[]` instead of `[] and ...` | = help: Replace with `[]` -Suggested fix: 51 51 | 52 52 | a and 0.1 and False and 0.2 # SIM223 53 53 | @@ -298,7 +285,6 @@ SIM223.py:56:7: SIM223 [*] Use `list([])` instead of `list([]) and ...` | = help: Replace with `list([])` -Suggested fix: 53 53 | 54 54 | a and [] and False # SIM223 55 55 | @@ -321,7 +307,6 @@ SIM223.py:58:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 55 55 | 56 56 | a and list([]) and False # SIM223 57 57 | @@ -344,7 +329,6 @@ SIM223.py:60:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 57 57 | 58 58 | a and [1] and False and [2] # SIM223 59 59 | @@ -367,7 +351,6 @@ SIM223.py:62:7: SIM223 [*] Use `{}` instead of `{} and ...` | = help: Replace with `{}` -Suggested fix: 59 59 | 60 60 | a and list([1]) and False and list([2]) # SIM223 61 61 | @@ -390,7 +373,6 @@ SIM223.py:64:7: SIM223 [*] Use `dict()` instead of `dict() and ...` | = help: Replace with `dict()` -Suggested fix: 61 61 | 62 62 | a and {} and False # SIM223 63 63 | @@ -413,7 +395,6 @@ SIM223.py:66:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 63 63 | 64 64 | a and dict() and False # SIM223 65 65 | @@ -436,7 +417,6 @@ SIM223.py:68:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 65 65 | 66 66 | a and {1: 1} and False and {2: 2} # SIM223 67 67 | @@ -459,7 +439,6 @@ SIM223.py:70:7: SIM223 [*] Use `set()` instead of `set() and ...` | = help: Replace with `set()` -Suggested fix: 67 67 | 68 68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223 69 69 | @@ -482,7 +461,6 @@ SIM223.py:72:7: SIM223 [*] Use `set(set())` instead of `set(set()) and ...` | = help: Replace with `set(set())` -Suggested fix: 69 69 | 70 70 | a and set() and False # SIM223 71 71 | @@ -505,7 +483,6 @@ SIM223.py:74:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 71 71 | 72 72 | a and set(set()) and False # SIM223 73 73 | @@ -528,7 +505,6 @@ SIM223.py:76:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 73 73 | 74 74 | a and {1} and False and {2} # SIM223 75 75 | @@ -551,7 +527,6 @@ SIM223.py:78:7: SIM223 [*] Use `()` instead of `() and ...` | = help: Replace with `()` -Suggested fix: 75 75 | 76 76 | a and set({1}) and False and set({2}) # SIM223 77 77 | @@ -574,7 +549,6 @@ SIM223.py:80:7: SIM223 [*] Use `tuple(())` instead of `tuple(()) and ...` | = help: Replace with `tuple(())` -Suggested fix: 77 77 | 78 78 | a and () and False # SIM222 79 79 | @@ -597,7 +571,6 @@ SIM223.py:82:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 79 79 | 80 80 | a and tuple(()) and False # SIM222 81 81 | @@ -620,7 +593,6 @@ SIM223.py:84:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 81 81 | 82 82 | a and (1,) and False and (2,) # SIM222 83 83 | @@ -643,7 +615,6 @@ SIM223.py:86:7: SIM223 [*] Use `frozenset()` instead of `frozenset() and ...` | = help: Replace with `frozenset()` -Suggested fix: 83 83 | 84 84 | a and tuple((1,)) and False and tuple((2,)) # SIM222 85 85 | @@ -666,7 +637,6 @@ SIM223.py:88:7: SIM223 [*] Use `frozenset(frozenset())` instead of `frozenset(fr | = help: Replace with `frozenset(frozenset())` -Suggested fix: 85 85 | 86 86 | a and frozenset() and False # SIM222 87 87 | @@ -689,7 +659,6 @@ SIM223.py:90:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 87 87 | 88 88 | a and frozenset(frozenset()) and False # SIM222 89 89 | @@ -710,7 +679,6 @@ SIM223.py:92:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 89 89 | 90 90 | a and frozenset({1}) and False and frozenset({2}) # SIM222 91 91 | @@ -733,7 +701,6 @@ SIM223.py:97:6: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 94 94 | 95 95 | # Inside test `a` is simplified. 96 96 | @@ -756,7 +723,6 @@ SIM223.py:99:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 96 96 | 97 97 | bool(a and [] and False and []) # SIM223 98 98 | @@ -778,7 +744,6 @@ SIM223.py:101:5: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 98 98 | 99 99 | assert a and [] and False and [] # SIM223 100 100 | @@ -800,7 +765,6 @@ SIM223.py:101:36: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 98 98 | 99 99 | assert a and [] and False and [] # SIM223 100 100 | @@ -823,7 +787,6 @@ SIM223.py:104:6: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 101 101 | if (a and [] and False and []) or (a and [] and False and []): # SIM223 102 102 | pass 103 103 | @@ -845,7 +808,6 @@ SIM223.py:106:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 103 103 | 104 104 | 0 if a and [] and False and [] else 1 # SIM222 105 105 | @@ -868,7 +830,6 @@ SIM223.py:113:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 110 110 | 0 111 111 | for a in range(10) 112 112 | for b in range(10) @@ -890,7 +851,6 @@ SIM223.py:114:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 111 111 | for a in range(10) 112 112 | for b in range(10) 113 113 | if a and [] and False and [] # SIM223 @@ -913,7 +873,6 @@ SIM223.py:121:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 118 118 | 0 119 119 | for a in range(10) 120 120 | for b in range(10) @@ -935,7 +894,6 @@ SIM223.py:122:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 119 119 | for a in range(10) 120 120 | for b in range(10) 121 121 | if a and [] and False and [] # SIM223 @@ -958,7 +916,6 @@ SIM223.py:129:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 126 126 | 0: 0 127 127 | for a in range(10) 128 128 | for b in range(10) @@ -980,7 +937,6 @@ SIM223.py:130:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 127 127 | for a in range(10) 128 128 | for b in range(10) 129 129 | if a and [] and False and [] # SIM223 @@ -1003,7 +959,6 @@ SIM223.py:137:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 134 134 | 0 135 135 | for a in range(10) 136 136 | for b in range(10) @@ -1025,7 +980,6 @@ SIM223.py:138:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -Suggested fix: 135 135 | for a in range(10) 136 136 | for b in range(10) 137 137 | if a and [] and False and [] # SIM223 @@ -1048,7 +1002,6 @@ SIM223.py:143:7: SIM223 [*] Use `[]` instead of `[] and ...` | = help: Replace with `[]` -Suggested fix: 140 140 | 141 141 | # Outside test `a` is not simplified. 142 142 | @@ -1070,7 +1023,6 @@ SIM223.py:145:11: SIM223 [*] Use `[]` instead of `[] and ...` | = help: Replace with `[]` -Suggested fix: 142 142 | 143 143 | a and [] and False and [] # SIM223 144 144 | @@ -1092,7 +1044,6 @@ SIM223.py:148:12: SIM223 [*] Use `[]` instead of `[] and ...` | = help: Replace with `[]` -Suggested fix: 145 145 | if (a and [] and False and []) == (a and []): # SIM223 146 146 | pass 147 147 | @@ -1114,7 +1065,6 @@ SIM223.py:154:7: SIM223 [*] Use `f"{''}{''}"` instead of `f"{''}{''}" and ...` | = help: Replace with `f"{''}{''}"` -Suggested fix: 151 151 | # Regression test for: https://github.com/astral-sh/ruff/issues/9479 152 152 | print(f"{a}{b}" and "bar") 153 153 | print(f"{a}{''}" and "bar") diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM300_SIM300.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM300_SIM300.py.snap index ef273065290a7..79e6f69a51b4e 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM300_SIM300.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM300_SIM300.py.snap @@ -11,7 +11,6 @@ SIM300.py:2:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `compare == "yoda"` -Suggested fix: 1 1 | # Errors 2 |-"yoda" == compare # SIM300 2 |+compare == "yoda" # SIM300 @@ -32,7 +31,6 @@ SIM300.py:3:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `age == 42` -Suggested fix: 1 1 | # Errors 2 2 | "yoda" == compare # SIM300 3 |-42 == age # SIM300 @@ -54,7 +52,6 @@ SIM300.py:4:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `compare == ("a", "b")` -Suggested fix: 1 1 | # Errors 2 2 | "yoda" == compare # SIM300 3 3 | 42 == age # SIM300 @@ -77,7 +74,6 @@ SIM300.py:5:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `compare >= "yoda"` -Suggested fix: 2 2 | "yoda" == compare # SIM300 3 3 | 42 == age # SIM300 4 4 | ("a", "b") == compare # SIM300 @@ -100,7 +96,6 @@ SIM300.py:6:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `compare > "yoda"` -Suggested fix: 3 3 | 42 == age # SIM300 4 4 | ("a", "b") == compare # SIM300 5 5 | "yoda" <= compare # SIM300 @@ -123,7 +118,6 @@ SIM300.py:7:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `age < 42` -Suggested fix: 4 4 | ("a", "b") == compare # SIM300 5 5 | "yoda" <= compare # SIM300 6 6 | "yoda" < compare # SIM300 @@ -146,7 +140,6 @@ SIM300.py:8:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `age < -42` -Suggested fix: 5 5 | "yoda" <= compare # SIM300 6 6 | "yoda" < compare # SIM300 7 7 | 42 > age # SIM300 @@ -169,7 +162,6 @@ SIM300.py:9:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `age < +42` -Suggested fix: 6 6 | "yoda" < compare # SIM300 7 7 | 42 > age # SIM300 8 8 | -42 > age # SIM300 @@ -192,7 +184,6 @@ SIM300.py:10:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `age == YODA` -Suggested fix: 7 7 | 42 > age # SIM300 8 8 | -42 > age # SIM300 9 9 | +42 > age # SIM300 @@ -215,7 +206,6 @@ SIM300.py:11:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `age < YODA` -Suggested fix: 8 8 | -42 > age # SIM300 9 9 | +42 > age # SIM300 10 10 | YODA == age # SIM300 @@ -238,7 +228,6 @@ SIM300.py:12:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `age <= YODA` -Suggested fix: 9 9 | +42 > age # SIM300 10 10 | YODA == age # SIM300 11 11 | YODA > age # SIM300 @@ -261,7 +250,6 @@ SIM300.py:13:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `age == JediOrder.YODA` -Suggested fix: 10 10 | YODA == age # SIM300 11 11 | YODA > age # SIM300 12 12 | YODA >= age # SIM300 @@ -284,7 +272,6 @@ SIM300.py:14:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `(number - 100) > 0` -Suggested fix: 11 11 | YODA > age # SIM300 12 12 | YODA >= age # SIM300 13 13 | JediOrder.YODA == age # SIM300 @@ -306,7 +293,6 @@ SIM300.py:15:1: SIM300 [*] Yoda condition detected | = help: Rewrite as `A[0][0] > B` -Suggested fix: 12 12 | YODA >= age # SIM300 13 13 | JediOrder.YODA == age # SIM300 14 14 | 0 < (number - 100) # SIM300 @@ -329,7 +315,6 @@ SIM300.py:16:5: SIM300 [*] Yoda condition detected | = help: Rewrite as `A[0][0] > (B)` -Suggested fix: 13 13 | JediOrder.YODA == age # SIM300 14 14 | 0 < (number - 100) # SIM300 15 15 | B> 10 75 75 | #: E225 E225 @@ -103,7 +99,6 @@ E22.py:78:2: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -Suggested fix: 75 75 | #: E225 E225 76 76 | i=i+ 1 77 77 | #: E225 E225 @@ -126,7 +121,6 @@ E22.py:80:6: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -Suggested fix: 77 77 | #: E225 E225 78 78 | i=i +1 79 79 | #: E225 @@ -149,7 +143,6 @@ E22.py:82:6: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -Suggested fix: 79 79 | #: E225 80 80 | i = 1and 1 81 81 | #: E225 @@ -172,7 +165,6 @@ E22.py:84:2: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -Suggested fix: 81 81 | #: E225 82 82 | i = 1or 0 83 83 | #: E225 @@ -195,7 +187,6 @@ E22.py:86:2: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -Suggested fix: 83 83 | #: E225 84 84 | 1is 1 85 85 | #: E225 @@ -218,7 +209,6 @@ E22.py:92:2: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -Suggested fix: 89 89 | #: E225 90 90 | i = 1@ 2 91 91 | #: E225 E226 @@ -241,7 +231,6 @@ E22.py:94:3: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -Suggested fix: 91 91 | #: E225 E226 92 92 | i=i+1 93 93 | #: E225 E226 @@ -264,7 +253,6 @@ E22.py:96:2: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -Suggested fix: 93 93 | #: E225 E226 94 94 | i =i+1 95 95 | #: E225 E226 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E226_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E226_E22.py.snap index 7e51d33c7934f..deef5951b206b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E226_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E226_E22.py.snap @@ -12,7 +12,6 @@ E22.py:60:7: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 57 57 | #: E225 58 58 | c =-1 59 59 | #: E225 @@ -35,7 +34,6 @@ E22.py:62:11: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 59 59 | #: E225 60 60 | x = x /2 - 1 61 61 | #: E225 @@ -58,7 +56,6 @@ E22.py:64:10: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 61 61 | #: E225 62 62 | c = alpha -4 63 63 | #: E225 @@ -81,7 +78,6 @@ E22.py:66:7: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 63 63 | #: E225 64 64 | c = alpha- 4 65 65 | #: E225 @@ -104,7 +100,6 @@ E22.py:68:13: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 65 65 | #: E225 66 66 | z = x **y 67 67 | #: E225 @@ -127,7 +122,6 @@ E22.py:70:12: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 67 67 | #: E225 68 68 | z = (x + 1) **y 69 69 | #: E225 @@ -150,7 +144,6 @@ E22.py:76:4: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 73 73 | #: E225 74 74 | _1kB = _1MB>> 10 75 75 | #: E225 E225 @@ -173,7 +166,6 @@ E22.py:78:5: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 75 75 | #: E225 E225 76 76 | i=i+ 1 77 77 | #: E225 E225 @@ -196,7 +188,6 @@ E22.py:88:7: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 85 85 | #: E225 86 86 | 1in [] 87 87 | #: E225 @@ -219,7 +210,6 @@ E22.py:90:6: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 87 87 | #: E225 88 88 | i = 1 @2 89 89 | #: E225 @@ -242,7 +232,6 @@ E22.py:92:4: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 89 89 | #: E225 90 90 | i = 1@ 2 91 91 | #: E225 E226 @@ -265,7 +254,6 @@ E22.py:94:5: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 91 91 | #: E225 E226 92 92 | i=i+1 93 93 | #: E225 E226 @@ -288,7 +276,6 @@ E22.py:96:5: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 93 93 | #: E225 E226 94 94 | i =i+1 95 95 | #: E225 E226 @@ -311,7 +298,6 @@ E22.py:98:8: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 95 95 | #: E225 E226 96 96 | i= i+1 97 97 | #: E225 E226 @@ -334,7 +320,6 @@ E22.py:98:11: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 95 95 | #: E225 E226 96 96 | i= i+1 97 97 | #: E225 E226 @@ -356,7 +341,6 @@ E22.py:100:7: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 97 97 | #: E225 E226 98 98 | c = (a +b)*(a - b) 99 99 | #: E225 E226 @@ -378,7 +362,6 @@ E22.py:100:11: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 97 97 | #: E225 E226 98 98 | c = (a +b)*(a - b) 99 99 | #: E225 E226 @@ -400,7 +383,6 @@ E22.py:104:6: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 101 101 | #: 102 102 | 103 103 | #: E226 @@ -423,7 +405,6 @@ E22.py:106:7: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 103 103 | #: E226 104 104 | z = 2//30 105 105 | #: E226 E226 @@ -446,7 +427,6 @@ E22.py:106:15: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 103 103 | #: E226 104 104 | z = 2//30 105 105 | #: E226 E226 @@ -469,7 +449,6 @@ E22.py:110:6: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 107 107 | #: E226 108 108 | norman = True+False 109 109 | #: E226 @@ -492,7 +471,6 @@ E22.py:112:6: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 109 109 | #: E226 110 110 | x = x*2 - 1 111 111 | #: E226 @@ -515,7 +493,6 @@ E22.py:114:11: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 111 111 | #: E226 112 112 | x = x/2 - 1 113 113 | #: E226 E226 @@ -538,7 +515,6 @@ E22.py:114:17: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 111 111 | #: E226 112 112 | x = x/2 - 1 113 113 | #: E226 E226 @@ -561,7 +537,6 @@ E22.py:116:12: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 113 113 | #: E226 E226 114 114 | hypot2 = x*x + y*y 115 115 | #: E226 @@ -584,7 +559,6 @@ E22.py:119:14: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -Suggested fix: 116 116 | c = (a + b)*(a - b) 117 117 | #: E226 118 118 | def halves(n): diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E227_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E227_E22.py.snap index 74034ac50cab3..499ee2c033e76 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E227_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E227_E22.py.snap @@ -12,7 +12,6 @@ E22.py:72:13: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -Suggested fix: 69 69 | #: E225 70 70 | z = (x + 1)** y 71 71 | #: E225 @@ -35,7 +34,6 @@ E22.py:74:12: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -Suggested fix: 71 71 | #: E225 72 72 | _1kB = _1MB >>10 73 73 | #: E225 @@ -58,7 +56,6 @@ E22.py:121:12: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -Suggested fix: 118 118 | def halves(n): 119 119 | return (i//2 for i in range(n)) 120 120 | #: E227 @@ -81,7 +78,6 @@ E22.py:123:12: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -Suggested fix: 120 120 | #: E227 121 121 | _1kB = _1MB>>10 122 122 | #: E227 @@ -104,7 +100,6 @@ E22.py:125:6: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -Suggested fix: 122 122 | #: E227 123 123 | _1MB = _1kB<<10 124 124 | #: E227 @@ -127,7 +122,6 @@ E22.py:127:6: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -Suggested fix: 124 124 | #: E227 125 125 | a = b|c 126 126 | #: E227 @@ -150,7 +144,6 @@ E22.py:129:6: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -Suggested fix: 126 126 | #: E227 127 127 | b = c&a 128 128 | #: E227 @@ -173,7 +166,6 @@ E22.py:154:11: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -Suggested fix: 151 151 | func1(lambda *args, **kw: (args, kw)) 152 152 | func2(lambda a, b=h[:], c=0: (a, b, c)) 153 153 | if not -5 < x < +5: diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E228_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E228_E22.py.snap index e86d004857cfe..de3650c45f246 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E228_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E228_E22.py.snap @@ -12,7 +12,6 @@ E22.py:131:6: E228 [*] Missing whitespace around modulo operator | = help: Add missing whitespace -Suggested fix: 128 128 | #: E227 129 129 | c = b^a 130 130 | #: E228 @@ -35,7 +34,6 @@ E22.py:133:10: E228 [*] Missing whitespace around modulo operator | = help: Add missing whitespace -Suggested fix: 130 130 | #: E228 131 131 | a = b%c 132 132 | #: E228 @@ -57,7 +55,6 @@ E22.py:135:26: E228 [*] Missing whitespace around modulo operator | = help: Add missing whitespace -Suggested fix: 132 132 | #: E228 133 133 | msg = fmt%(errno, errmsg) 134 134 | #: E228 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap index 131088d038eaf..1b27d16ced389 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap @@ -11,7 +11,6 @@ E23.py:2:7: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -Suggested fix: 1 1 | #: E231 2 |-a = (1,2) 2 |+a = (1, 2) @@ -32,7 +31,6 @@ E23.py:4:5: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -Suggested fix: 1 1 | #: E231 2 2 | a = (1,2) 3 3 | #: E231 @@ -55,7 +53,6 @@ E23.py:6:10: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -Suggested fix: 3 3 | #: E231 4 4 | a[b1,:] 5 5 | #: E231 @@ -77,7 +74,6 @@ E23.py:19:10: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -Suggested fix: 16 16 | 17 17 | def foo() -> None: 18 18 | #: E231 @@ -99,7 +95,6 @@ E23.py:29:20: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -Suggested fix: 26 26 | #: E231:2:20 27 27 | mdtypes_template = { 28 28 | 'tag_full': [('mdtype', 'u4'), ('byte_count', 'u4')], @@ -121,7 +116,6 @@ E23.py:33:6: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -Suggested fix: 30 30 | } 31 31 | 32 32 | # E231 @@ -143,7 +137,6 @@ E23.py:47:37: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -Suggested fix: 44 44 | snapshot.file_uri[len(f's3://{self.s3_bucket_name}/'):] 45 45 | 46 46 | #: E231 @@ -166,7 +159,6 @@ E23.py:60:13: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -Suggested fix: 57 57 | """Primary function.""" 58 58 | results = { 59 59 | "k1": [1], @@ -189,7 +181,6 @@ E23.py:65:17: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -Suggested fix: 62 62 | results_in_tuple = ( 63 63 | { 64 64 | "k1": [1], @@ -212,7 +203,6 @@ E23.py:71:17: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -Suggested fix: 68 68 | results_in_list = [ 69 69 | { 70 70 | "k1": [1], @@ -235,7 +225,6 @@ E23.py:76:17: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -Suggested fix: 73 73 | ] 74 74 | results_in_list_first = [ 75 75 | { @@ -258,7 +247,6 @@ E23.py:82:13: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -Suggested fix: 79 79 | 80 80 | x = [ 81 81 | { @@ -281,7 +269,6 @@ E23.py:84:13: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -Suggested fix: 81 81 | { 82 82 | "k1":[2], # E231 83 83 | "k2": x[2:4], @@ -304,7 +291,6 @@ E23.py:87:26: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -Suggested fix: 84 84 | "k3":[2], # E231 85 85 | "k4": [2], 86 86 | "k5": [2], @@ -327,7 +313,6 @@ E23.py:87:28: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -Suggested fix: 84 84 | "k3":[2], # E231 85 85 | "k4": [2], 86 86 | "k5": [2], @@ -350,7 +335,6 @@ E23.py:87:30: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -Suggested fix: 84 84 | "k3":[2], # E231 85 85 | "k4": [2], 86 86 | "k5": [2], @@ -373,7 +357,6 @@ E23.py:92:21: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -Suggested fix: 89 89 | { 90 90 | "k1": [ 91 91 | { @@ -396,7 +379,6 @@ E23.py:92:24: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -Suggested fix: 89 89 | { 90 90 | "k1": [ 91 91 | { @@ -419,7 +401,6 @@ E23.py:95:25: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -Suggested fix: 92 92 | "ka":[2,3], # E231 93 93 | }, 94 94 | { @@ -442,7 +423,6 @@ E23.py:98:21: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -Suggested fix: 95 95 | "kb": [2,3], # E231 96 96 | }, 97 97 | { @@ -465,7 +445,6 @@ E23.py:101:25: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -Suggested fix: 98 98 | "ka":[2, 3], # E231 99 99 | "kb": [2, 3], # Ok 100 100 | "kc": [2, 3], # Ok @@ -488,7 +467,6 @@ E23.py:102:21: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -Suggested fix: 99 99 | "kb": [2, 3], # Ok 100 100 | "kc": [2, 3], # Ok 101 101 | "kd": [2,3], # E231 @@ -511,7 +489,6 @@ E23.py:102:24: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -Suggested fix: 99 99 | "kb": [2, 3], # Ok 100 100 | "kc": [2, 3], # Ok 101 101 | "kd": [2,3], # E231 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E241_E24.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E241_E24.py.snap index 4817a48a74df3..bdce7011836ae 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E241_E24.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E241_E24.py.snap @@ -11,7 +11,6 @@ E24.py:2:8: E241 [*] Multiple spaces after comma | = help: Replace with single space -Suggested fix: 1 1 | #: E241 2 |-a = (1, 2) 2 |+a = (1, 2) @@ -32,7 +31,6 @@ E24.py:11:18: E241 [*] Multiple spaces after comma | = help: Replace with single space -Suggested fix: 8 8 | b = (1, 20) # space before 20 9 9 | #: E241 E241 E241 10 10 | # issue 135 @@ -53,7 +51,6 @@ E24.py:12:19: E241 [*] Multiple spaces after comma | = help: Replace with single space -Suggested fix: 9 9 | #: E241 E241 E241 10 10 | # issue 135 11 11 | more_spaces = [a, b, @@ -72,7 +69,6 @@ E24.py:13:18: E241 [*] Multiple spaces after comma | = help: Replace with single space -Suggested fix: 10 10 | # issue 135 11 11 | more_spaces = [a, b, 12 12 | ef, +h, diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E242_E24.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E242_E24.py.snap index df2b2b1b71f6b..579e06ed1dfb0 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E242_E24.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E242_E24.py.snap @@ -12,7 +12,6 @@ E24.py:6:8: E242 [*] Tab after comma | = help: Replace with single space -Suggested fix: 3 3 | #: Okay 4 4 | b = (1, 20) 5 5 | #: E242 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E251_E25.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E251_E25.py.snap index c38f7e2608136..5ab54ede68535 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E251_E25.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E251_E25.py.snap @@ -11,7 +11,6 @@ E25.py:2:12: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -Suggested fix: 1 1 | #: E251 E251 2 |-def foo(bar = False): 2 |+def foo(bar= False): @@ -31,7 +30,6 @@ E25.py:2:14: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -Suggested fix: 1 1 | #: E251 E251 2 |-def foo(bar = False): 2 |+def foo(bar =False): @@ -52,7 +50,6 @@ E25.py:6:9: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -Suggested fix: 3 3 | '''Test function with an error in declaration''' 4 4 | pass 5 5 | #: E251 @@ -75,7 +72,6 @@ E25.py:8:8: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -Suggested fix: 5 5 | #: E251 6 6 | foo(bar= True) 7 7 | #: E251 @@ -98,7 +94,6 @@ E25.py:10:8: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -Suggested fix: 7 7 | #: E251 8 8 | foo(bar =True) 9 9 | #: E251 E251 @@ -121,7 +116,6 @@ E25.py:10:10: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -Suggested fix: 7 7 | #: E251 8 8 | foo(bar =True) 9 9 | #: E251 E251 @@ -144,7 +138,6 @@ E25.py:12:14: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -Suggested fix: 9 9 | #: E251 E251 10 10 | foo(bar = True) 11 11 | #: E251 @@ -169,7 +162,6 @@ E25.py:15:29: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -Suggested fix: 12 12 | y = bar(root= "sdasd") 13 13 | #: E251:2:29 14 14 | parser.add_argument('--long-option', @@ -195,7 +187,6 @@ E25.py:18:45: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -Suggested fix: 15 15 | default= 16 16 | "/rather/long/filesystem/path/here/blah/blah/blah") 17 17 | #: E251:1:45 @@ -219,7 +210,6 @@ E25.py:23:8: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -Suggested fix: 20 20 | #: E251:3:8 E251:3:10 21 21 | foo(True, 22 22 | baz=(1, 2), @@ -242,7 +232,6 @@ E25.py:23:10: E251 [*] Unexpected spaces around keyword / parameter equals | = help: Remove whitespace -Suggested fix: 20 20 | #: E251:3:8 E251:3:10 21 21 | foo(True, 22 22 | baz=(1, 2), diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E252_E25.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E252_E25.py.snap index ad127391f307f..f20c5d197321b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E252_E25.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E252_E25.py.snap @@ -12,7 +12,6 @@ E25.py:46:15: E252 [*] Missing whitespace around parameter equals | = help: Add missing whitespace -Suggested fix: 43 43 | async def add(a: int = 0, b: int = 0) -> int: 44 44 | return a + b 45 45 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 @@ -35,7 +34,6 @@ E25.py:46:15: E252 [*] Missing whitespace around parameter equals | = help: Add missing whitespace -Suggested fix: 43 43 | async def add(a: int = 0, b: int = 0) -> int: 44 44 | return a + b 45 45 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 @@ -58,7 +56,6 @@ E25.py:46:26: E252 [*] Missing whitespace around parameter equals | = help: Add missing whitespace -Suggested fix: 43 43 | async def add(a: int = 0, b: int = 0) -> int: 44 44 | return a + b 45 45 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 @@ -81,7 +78,6 @@ E25.py:46:36: E252 [*] Missing whitespace around parameter equals | = help: Add missing whitespace -Suggested fix: 43 43 | async def add(a: int = 0, b: int = 0) -> int: 44 44 | return a + b 45 45 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E261_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E261_E26.py.snap index a3d64ec4bf7f3..37d64ecf72279 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E261_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E261_E26.py.snap @@ -11,7 +11,6 @@ E26.py:2:5: E261 [*] Insert at least two spaces before an inline comment | = help: Insert spaces -Suggested fix: 1 1 | #: E261:1:5 2 |-pass # an inline comment 2 |+pass # an inline comment diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap index 2190347b94ae9..e4d0cc1725938 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap @@ -12,7 +12,6 @@ E26.py:4:12: E262 [*] Inline comment should start with `# ` | = help: Format space -Suggested fix: 1 1 | #: E261:1:5 2 2 | pass # an inline comment 3 3 | #: E262:1:12 @@ -35,7 +34,6 @@ E26.py:6:12: E262 [*] Inline comment should start with `# ` | = help: Format space -Suggested fix: 3 3 | #: E262:1:12 4 4 | x = x + 1 #Increment x 5 5 | #: E262:1:12 @@ -58,7 +56,6 @@ E26.py:8:12: E262 [*] Inline comment should start with `# ` | = help: Format space -Suggested fix: 5 5 | #: E262:1:12 6 6 | x = x + 1 # Increment x 7 7 | #: E262:1:12 @@ -81,7 +78,6 @@ E26.py:63:9: E262 [*] Inline comment should start with `# ` | = help: Format space -Suggested fix: 60 60 | #: E262:3:9 61 61 | # -*- coding: utf8 -*- 62 62 | #  (One space one NBSP) Ok for block comment @@ -104,7 +100,6 @@ E26.py:66:9: E262 [*] Inline comment should start with `# ` | = help: Format space -Suggested fix: 63 63 | a = 42 #  (One space one NBSP) 64 64 | #: E262:2:9 65 65 | # (Two spaces) Ok for block comment @@ -127,7 +122,6 @@ E26.py:84:8: E262 [*] Inline comment should start with `# ` | = help: Format space -Suggested fix: 81 81 | #: E266:1:3 82 82 | ## Foo 83 83 | @@ -147,7 +141,6 @@ E26.py:86:8: E262 [*] Inline comment should start with `# ` | = help: Format space -Suggested fix: 83 83 | 84 84 | a = 1 ## Foo 85 85 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap index 05ee6766a7180..82891e11b832e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap @@ -12,7 +12,6 @@ E26.py:10:1: E265 [*] Block comment should start with `# ` | = help: Format space -Suggested fix: 7 7 | #: E262:1:12 8 8 | x = y + 1 #: Increment x 9 9 | #: E265:1:1 @@ -35,7 +34,6 @@ E26.py:14:1: E265 [*] Block comment should start with `# ` | = help: Format space -Suggested fix: 11 11 | a = 1 12 12 | #: E265:2:1 13 13 | m = 42 @@ -58,7 +56,6 @@ E26.py:25:1: E265 [*] Block comment should start with `# ` | = help: Format space -Suggested fix: 22 22 | ### Of course it is unused 23 23 | return 24 24 | #: E265:1:1 E266:2:1 @@ -80,7 +77,6 @@ E26.py:32:1: E265 [*] Block comment should start with `# ` | = help: Format space -Suggested fix: 29 29 | #: 30 30 | 31 31 | #: Okay @@ -102,7 +98,6 @@ E26.py:73:1: E265 [*] Block comment should start with `# ` | = help: Format space -Suggested fix: 70 70 | # E Means test is giving error (E) 71 71 | # F Means test is failing (F) 72 72 | # EF Means test is giving error and Failing @@ -125,7 +120,6 @@ E26.py:78:1: E265 [*] Block comment should start with `# ` | = help: Format space -Suggested fix: 75 75 | 76 76 | #: Colon prefix is okay 77 77 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap index 3d582186b09f6..d0cc4e734e595 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap @@ -11,7 +11,6 @@ E26.py:19:5: E266 [*] Too many leading `#` before block comment | = help: Remove leading `#` -Suggested fix: 16 16 | #: E266:3:5 E266:6:5 17 17 | def how_it_feel(r): 18 18 | @@ -34,7 +33,6 @@ E26.py:22:5: E266 [*] Too many leading `#` before block comment | = help: Remove leading `#` -Suggested fix: 19 19 | ### This is a variable ### 20 20 | a = 42 21 21 | @@ -57,7 +55,6 @@ E26.py:26:1: E266 [*] Too many leading `#` before block comment | = help: Remove leading `#` -Suggested fix: 23 23 | return 24 24 | #: E265:1:1 E266:2:1 25 25 | ##if DEBUG: @@ -79,7 +76,6 @@ E26.py:69:1: E266 [*] Too many leading `#` before block comment | = help: Remove leading `#` -Suggested fix: 66 66 | a = 42 # (Two spaces) 67 67 | 68 68 | #: E265:5:1 @@ -102,7 +98,6 @@ E26.py:82:1: E266 [*] Too many leading `#` before block comment | = help: Remove leading `#` -Suggested fix: 79 79 | 80 80 | # We should strip the space, but preserve the hashes. 81 81 | #: E266:1:3 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap index 96548873e4c95..eeae4942df307 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap @@ -12,7 +12,6 @@ E27.py:4:9: E271 [*] Multiple spaces after keyword | = help: Replace with single space -Suggested fix: 1 1 | #: Okay 2 2 | True and False 3 3 | #: E271 @@ -35,7 +34,6 @@ E27.py:6:5: E271 [*] Multiple spaces after keyword | = help: Replace with single space -Suggested fix: 3 3 | #: E271 4 4 | True and False 5 5 | #: E272 @@ -58,7 +56,6 @@ E27.py:8:3: E271 [*] Multiple spaces after keyword | = help: Replace with single space -Suggested fix: 5 5 | #: E272 6 6 | True and False 7 7 | #: E271 @@ -81,7 +78,6 @@ E27.py:15:6: E271 [*] Multiple spaces after keyword | = help: Replace with single space -Suggested fix: 12 12 | #: E273 E274 13 13 | True and False 14 14 | #: E271 @@ -104,7 +100,6 @@ E27.py:17:6: E271 [*] Multiple spaces after keyword | = help: Replace with single space -Suggested fix: 14 14 | #: E271 15 15 | a and b 16 16 | #: E271 @@ -127,7 +122,6 @@ E27.py:19:6: E271 [*] Multiple spaces after keyword | = help: Replace with single space -Suggested fix: 16 16 | #: E271 17 17 | 1 and b 18 18 | #: E271 @@ -150,7 +144,6 @@ E27.py:21:7: E271 [*] Multiple spaces after keyword | = help: Replace with single space -Suggested fix: 18 18 | #: E271 19 19 | a and 2 20 20 | #: E271 E272 @@ -173,7 +166,6 @@ E27.py:23:7: E271 [*] Multiple spaces after keyword | = help: Replace with single space -Suggested fix: 20 20 | #: E271 E272 21 21 | 1 and b 22 22 | #: E271 E272 @@ -196,7 +188,6 @@ E27.py:36:14: E271 [*] Multiple spaces after keyword | = help: Replace with single space -Suggested fix: 33 33 | from u import (a, b) 34 34 | from v import c, d 35 35 | #: E271 @@ -218,7 +209,6 @@ E27.py:71:5: E271 [*] Multiple spaces after keyword | = help: Replace with single space -Suggested fix: 68 68 | # Soft keywords 69 69 | 70 70 | #: E271 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E272_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E272_E27.py.snap index 1cc5186885e61..2b82d9eb7d9c7 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E272_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E272_E27.py.snap @@ -12,7 +12,6 @@ E27.py:21:2: E272 [*] Multiple spaces before keyword | = help: Replace with single space -Suggested fix: 18 18 | #: E271 19 19 | a and 2 20 20 | #: E271 E272 @@ -35,7 +34,6 @@ E27.py:23:2: E272 [*] Multiple spaces before keyword | = help: Replace with single space -Suggested fix: 20 20 | #: E271 E272 21 21 | 1 and b 22 22 | #: E271 E272 @@ -58,7 +56,6 @@ E27.py:25:5: E272 [*] Multiple spaces before keyword | = help: Replace with single space -Suggested fix: 22 22 | #: E271 E272 23 23 | a and 2 24 24 | #: E272 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E273_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E273_E27.py.snap index 7658cbe23833d..37fcddbba3bef 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E273_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E273_E27.py.snap @@ -12,7 +12,6 @@ E27.py:11:9: E273 [*] Tab after keyword | = help: Replace with single space -Suggested fix: 8 8 | if 1: 9 9 | pass 10 10 | #: E273 @@ -35,7 +34,6 @@ E27.py:13:5: E273 [*] Tab after keyword | = help: Replace with single space -Suggested fix: 10 10 | #: E273 11 11 | True and False 12 12 | #: E273 E274 @@ -58,7 +56,6 @@ E27.py:13:10: E273 [*] Tab after keyword | = help: Replace with single space -Suggested fix: 10 10 | #: E273 11 11 | True and False 12 12 | #: E273 E274 @@ -81,7 +78,6 @@ E27.py:27:6: E273 [*] Tab after keyword | = help: Replace with single space -Suggested fix: 24 24 | #: E272 25 25 | this and False 26 26 | #: E273 @@ -104,7 +100,6 @@ E27.py:31:10: E273 [*] Tab after keyword | = help: Replace with single space -Suggested fix: 28 28 | #: E274 29 29 | a and b 30 30 | #: E273 E274 @@ -126,7 +121,6 @@ E27.py:74:5: E273 [*] Tab after keyword | = help: Replace with single space -Suggested fix: 71 71 | type Number = int 72 72 | 73 73 | #: E273 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E274_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E274_E27.py.snap index 3ee9524798118..ee5470deb8b2d 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E274_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E274_E27.py.snap @@ -12,7 +12,6 @@ E27.py:29:2: E274 [*] Tab before keyword | = help: Replace with single space -Suggested fix: 26 26 | #: E273 27 27 | a and b 28 28 | #: E274 @@ -35,7 +34,6 @@ E27.py:31:5: E274 [*] Tab before keyword | = help: Replace with single space -Suggested fix: 28 28 | #: E274 29 29 | a and b 30 30 | #: E273 E274 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E275_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E275_E27.py.snap index 1860286af5822..8bd46d54c5939 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E275_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E275_E27.py.snap @@ -12,7 +12,6 @@ E27.py:38:8: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -Suggested fix: 35 35 | #: E271 36 36 | from w import (e, f) 37 37 | #: E275 @@ -35,7 +34,6 @@ E27.py:40:24: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -Suggested fix: 37 37 | #: E275 38 38 | from w import(e, f) 39 39 | #: E275 @@ -58,7 +56,6 @@ E27.py:43:28: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -Suggested fix: 40 40 | from importable.module import(e, f) 41 41 | #: E275 42 42 | try: @@ -81,7 +78,6 @@ E27.py:47:1: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -Suggested fix: 44 44 | except ImportError: 45 45 | pass 46 46 | #: E275 @@ -104,7 +100,6 @@ E27.py:55:5: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -Suggested fix: 52 52 | matched = {"true": True, "false": False} 53 53 | #: E275:2:11 54 54 | if True: @@ -126,7 +121,6 @@ E27.py:77:1: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -Suggested fix: 74 74 | type Number = int 75 75 | 76 76 | #: E275 @@ -148,7 +142,6 @@ E27.py:78:5: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -Suggested fix: 75 75 | 76 76 | #: E275 77 77 | match(foo): diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30.py.snap index dae7fc542a2cd..4fc5aecbe5efa 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30.py.snap @@ -12,7 +12,6 @@ E30.py:478:5: E301 [*] Expected 1 blank line, found 0 | = help: Add missing blank line -Suggested fix: 475 475 | 476 476 | def func1(): 477 477 | pass @@ -34,7 +33,6 @@ E30.py:489:5: E301 [*] Expected 1 blank line, found 0 | = help: Add missing blank line -Suggested fix: 485 485 | 486 486 | def fn1(): 487 487 | pass @@ -55,7 +53,6 @@ E30.py:499:5: E301 [*] Expected 1 blank line, found 0 | = help: Add missing blank line -Suggested fix: 496 496 | """Class for minimal repo.""" 497 497 | 498 498 | columns = [] @@ -77,7 +74,6 @@ E30.py:511:5: E301 [*] Expected 1 blank line, found 0 | = help: Add missing blank line -Suggested fix: 508 508 | 509 509 | def method(cls) -> None: 510 510 | pass @@ -99,7 +95,6 @@ E30.py:526:5: E301 [*] Expected 1 blank line, found 0 | = help: Add missing blank line -Suggested fix: 523 523 | @overload 524 524 | def bar(self, x: str) -> str: 525 525 | ... diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap index ca166b6480717..c441d62c0ccf6 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap @@ -12,7 +12,6 @@ E30.py:533:1: E302 [*] Expected 2 blank lines, found 0 | = help: Add missing blank line(s) -Suggested fix: 530 530 | 531 531 | # E302 532 532 | """Main module.""" @@ -35,7 +34,6 @@ E30.py:540:1: E302 [*] Expected 2 blank lines, found 0 | = help: Add missing blank line(s) -Suggested fix: 537 537 | 538 538 | # E302 539 539 | import sys @@ -58,7 +56,6 @@ E30.py:549:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 546 546 | def a(): 547 547 | pass 548 548 | @@ -80,7 +77,6 @@ E30.py:560:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 557 557 | 558 558 | # comment 559 559 | @@ -102,7 +98,6 @@ E30.py:569:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 566 566 | def a(): 567 567 | pass 568 568 | @@ -124,7 +119,6 @@ E30.py:578:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 575 575 | async def x(): 576 576 | pass 577 577 | @@ -145,7 +139,6 @@ E30.py:586:1: E302 [*] Expected 2 blank lines, found 0 | = help: Add missing blank line(s) -Suggested fix: 583 583 | # E302 584 584 | def bar(): 585 585 | pass @@ -168,7 +161,6 @@ E30.py:592:1: E302 [*] Expected 2 blank lines, found 0 | = help: Add missing blank line(s) -Suggested fix: 589 589 | 590 590 | # E302 591 591 | def bar(): pass @@ -190,7 +182,6 @@ E30.py:602:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 598 598 | def f(): 599 599 | pass 600 600 | @@ -212,7 +203,6 @@ E30.py:624:1: E302 [*] Expected 2 blank lines, found 0 | = help: Add missing blank line(s) -Suggested fix: 621 621 | 622 622 | # E302 623 623 | class A:... @@ -235,7 +225,6 @@ E30.py:634:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 631 631 | @overload 632 632 | def fn(a: str) -> str: ... 633 633 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap index 213239e29b24c..c650a84858e15 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap @@ -11,7 +11,6 @@ E302_first_line_docstring.py:3:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 1 1 | """Test where the error is after the module's docstring.""" 2 2 | 3 |+ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap index 2781a2731d8c9..dc9cff95a65af 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap @@ -11,7 +11,6 @@ E302_first_line_expression.py:3:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 1 1 | "Test where the first line is a comment, " + "and the rule violation follows it." 2 2 | 3 |+ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap index 127622c1120ac..b4cbd34cb55b3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap @@ -11,7 +11,6 @@ E302_first_line_function.py:4:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 1 1 | def fn1(): 2 2 | pass 3 3 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap index fd0eb470a0b5e..7bb06c20c2688 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap @@ -11,7 +11,6 @@ E302_first_line_statement.py:3:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 1 1 | print("Test where the first line is a statement, and the rule violation follows it.") 2 2 | 3 |+ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap index 2ae243a2ab943..e6c64b4065423 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap @@ -10,7 +10,6 @@ E30.py:617:2: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 613 613 | def method1(): 614 614 | return 1 615 615 | @@ -30,7 +29,6 @@ E30.py:644:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 640 640 | def fn(): 641 641 | _ = None 642 642 | @@ -50,7 +48,6 @@ E30.py:656:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 652 652 | def fn(): 653 653 | _ = None 654 654 | @@ -69,7 +66,6 @@ E30.py:667:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -Suggested fix: 663 663 | print() 664 664 | 665 665 | @@ -89,7 +85,6 @@ E30.py:676:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -Suggested fix: 672 672 | print() 673 673 | 674 674 | @@ -107,7 +102,6 @@ E30.py:687:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 683 683 | def a(): 684 684 | print() 685 685 | @@ -127,7 +121,6 @@ E30.py:690:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 686 686 | 687 687 | # comment 688 688 | @@ -148,7 +141,6 @@ E30.py:701:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -Suggested fix: 697 697 | #!python 698 698 | 699 699 | @@ -168,7 +160,6 @@ E30.py:713:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 709 709 | def a(self): 710 710 | pass 711 711 | @@ -187,7 +178,6 @@ E30.py:723:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 719 719 | if True: 720 720 | a = 1 721 721 | @@ -205,7 +195,6 @@ E30.py:731:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 727 727 | # E303 728 728 | class Test: 729 729 | @@ -225,7 +214,6 @@ E30.py:734:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 730 730 | 731 731 | # comment 732 732 | @@ -245,7 +233,6 @@ E30.py:748:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 744 744 | 745 745 | # wrongly indented comment 746 746 | @@ -264,7 +251,6 @@ E30.py:758:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 754 754 | def fn(): 755 755 | pass 756 756 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_comment.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_comment.py.snap index c5dcc09cef3b3..883ac567a3f7b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_comment.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_comment.py.snap @@ -9,7 +9,6 @@ E303_first_line_comment.py:5:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -Suggested fix: 1 1 | # Test where the first line is a comment, and the rule violation follows it. 2 2 | 3 3 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_docstring.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_docstring.py.snap index aebb989cf551c..1dce813febffc 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_docstring.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_docstring.py.snap @@ -9,7 +9,6 @@ E303_first_line_docstring.py:5:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -Suggested fix: 1 1 | """Test where the error is after the module's docstring.""" 2 2 | 3 3 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_expression.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_expression.py.snap index 6646ea6c5a12f..f134f85bbfd3b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_expression.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_expression.py.snap @@ -9,7 +9,6 @@ E303_first_line_expression.py:5:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -Suggested fix: 1 1 | "Test where the first line is a comment, " + "and the rule violation follows it." 2 2 | 3 3 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_statement.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_statement.py.snap index 80f014d4cac1c..70017e2516730 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_statement.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_statement.py.snap @@ -9,7 +9,6 @@ E303_first_line_statement.py:5:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -Suggested fix: 1 1 | print("Test where the first line is a statement, and the rule violation follows it.") 2 2 | 3 3 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap index 27658a231c174..f36573f435849 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap @@ -12,7 +12,6 @@ E30.py:765:1: E304 [*] Blank lines found after function decorator (1) | = help: Remove extraneous blank line(s) -Suggested fix: 761 761 | 762 762 | # E304 763 763 | @decorator @@ -33,7 +32,6 @@ E30.py:774:1: E304 [*] Blank lines found after function decorator (1) | = help: Remove extraneous blank line(s) -Suggested fix: 769 769 | 770 770 | # E304 771 771 | @decorator @@ -54,7 +52,6 @@ E30.py:786:1: E304 [*] Blank lines found after function decorator (2) | = help: Remove extraneous blank line(s) -Suggested fix: 778 778 | 779 779 | # E304 780 780 | @decorator diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap index 0bb2d72a34d4b..cbd7fba2b8cf4 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap @@ -10,7 +10,6 @@ E30.py:798:1: E305 [*] Expected 2 blank lines after class or function definition | = help: Add missing blank line(s) -Suggested fix: 795 795 | # comment 796 796 | 797 797 | # another comment @@ -31,7 +30,6 @@ E30.py:809:1: E305 [*] Expected 2 blank lines after class or function definition | = help: Add missing blank line(s) -Suggested fix: 806 806 | # comment 807 807 | 808 808 | # another comment @@ -54,7 +52,6 @@ E30.py:821:1: E305 [*] Expected 2 blank lines after class or function definition | = help: Add missing blank line(s) -Suggested fix: 818 818 | 819 819 | # another comment 820 820 | @@ -75,7 +72,6 @@ E30.py:833:1: E305 [*] Expected 2 blank lines after class or function definition | = help: Add missing blank line(s) -Suggested fix: 830 830 | print() 831 831 | 832 832 | # Two spaces before comments, too. @@ -98,7 +94,6 @@ E30.py:846:1: E305 [*] Expected 2 blank lines after class or function definition | = help: Add missing blank line(s) -Suggested fix: 843 843 | def main(): 844 844 | blah, blah 845 845 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30.py.snap index 1da9a9adaf932..7e0bb86884779 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30.py.snap @@ -12,7 +12,6 @@ E30.py:854:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -Suggested fix: 851 851 | # E306:3:5 852 852 | def a(): 853 853 | x = 1 @@ -34,7 +33,6 @@ E30.py:862:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -Suggested fix: 859 859 | #: E306:3:5 860 860 | async def a(): 861 861 | x = 1 @@ -56,7 +54,6 @@ E30.py:870:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -Suggested fix: 867 867 | #: E306:3:5 E306:5:9 868 868 | def a(): 869 869 | x = 2 @@ -78,7 +75,6 @@ E30.py:872:9: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -Suggested fix: 869 869 | x = 2 870 870 | def b(): 871 871 | x = 1 @@ -100,7 +96,6 @@ E30.py:880:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -Suggested fix: 877 877 | # E306:3:5 E306:6:5 878 878 | def a(): 879 879 | x = 1 @@ -122,7 +117,6 @@ E30.py:883:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -Suggested fix: 880 880 | class C: 881 881 | pass 882 882 | x = 2 @@ -143,7 +137,6 @@ E30.py:892:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -Suggested fix: 889 889 | def foo(): 890 890 | def bar(): 891 891 | pass @@ -165,7 +158,6 @@ E30.py:899:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -Suggested fix: 896 896 | # E306:3:5 897 897 | def foo(): 898 898 | def bar(): pass @@ -187,7 +179,6 @@ E30.py:907:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -Suggested fix: 904 904 | # E306 905 905 | def a(): 906 906 | x = 2 @@ -209,7 +200,6 @@ E30.py:916:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -Suggested fix: 913 913 | # E306 914 914 | def a(): 915 915 | x = 2 @@ -231,7 +221,6 @@ E30.py:925:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | = help: Add missing blank line -Suggested fix: 922 922 | # E306 923 923 | def a(): 924 924 | x = 2 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap index d911b80f06080..0993a890f8e4e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap @@ -11,7 +11,6 @@ E40.py:2:1: E401 [*] Multiple imports on one line | = help: Split imports -Suggested fix: 1 1 | #: E401 2 |-import os, sys 2 |+import os @@ -31,7 +30,6 @@ E40.py:65:1: E401 [*] Multiple imports on one line | = help: Split imports -Suggested fix: 62 62 | import bar 63 63 | 64 64 | #: E401 @@ -55,7 +53,6 @@ E40.py:66:1: E401 [*] Multiple imports on one line | = help: Split imports -Suggested fix: 63 63 | 64 64 | #: E401 65 65 | import re as regex, string # also with a comment! @@ -76,7 +73,6 @@ E40.py:68:8: E401 [*] Multiple imports on one line | = help: Split imports -Suggested fix: 65 65 | import re as regex, string # also with a comment! 66 66 | import re as regex, string; x = 1 67 67 | @@ -98,7 +94,6 @@ E40.py:72:5: E401 [*] Multiple imports on one line | = help: Split imports -Suggested fix: 69 69 | 70 70 | 71 71 | def blah(): @@ -121,7 +116,6 @@ E40.py:75:9: E401 [*] Multiple imports on one line | = help: Split imports -Suggested fix: 72 72 | import datetime as dt, copy 73 73 | 74 74 | def nested_and_tested(): @@ -144,7 +138,6 @@ E40.py:77:16: E401 [*] Multiple imports on one line | = help: Split imports -Suggested fix: 74 74 | def nested_and_tested(): 75 75 | import builtins, textwrap as tw 76 76 | @@ -166,7 +159,6 @@ E40.py:78:9: E401 [*] Multiple imports on one line | = help: Split imports -Suggested fix: 75 75 | import builtins, textwrap as tw 76 76 | 77 77 | x = 1; import re as regex, string @@ -186,7 +178,6 @@ E40.py:80:14: E401 [*] Multiple imports on one line | = help: Split imports -Suggested fix: 77 77 | x = 1; import re as regex, string 78 78 | import re as regex, string; x = 1 79 79 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E70.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E70.py.snap index 269c59cf96355..3db9ba2ca588c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E70.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E70.py.snap @@ -12,7 +12,6 @@ E70.py:10:13: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -Suggested fix: 7 7 | #: E702:1:17 8 8 | import bdist_egg; bdist_egg.write_safety_flag(cmd.egg_info, safe) 9 9 | #: E703:1:13 @@ -35,7 +34,6 @@ E70.py:12:23: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -Suggested fix: 9 9 | #: E703:1:13 10 10 | import shlex; 11 11 | #: E702:1:9 E703:1:23 @@ -58,7 +56,6 @@ E70.py:25:14: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -Suggested fix: 22 22 | while all is round: 23 23 | def f(x): return 2*x 24 24 | #: E704:1:8 E702:1:11 E703:1:14 @@ -81,7 +78,6 @@ E70.py:68:1: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -Suggested fix: 64 64 | while 1: 65 65 | 1;... 66 66 | #: E703:2:1 @@ -105,7 +101,6 @@ E70.py:71:4: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -Suggested fix: 68 68 | ; 69 69 | #: E701:2:3 70 70 | a = \ diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E703.ipynb.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E703.ipynb.snap index b7ccb55cc192f..96f5112847bf5 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E703.ipynb.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E703.ipynb.snap @@ -12,7 +12,6 @@ E703.ipynb:5:2: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -Suggested fix: 2 2 | # Simple case 3 3 | x; 4 4 | # Only skip the last expression @@ -35,7 +34,6 @@ E703.ipynb:9:6: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -Suggested fix: 6 6 | x; 7 7 | # Nested expressions isn't relevant 8 8 | if True: diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap index 46984e9b68f63..7bb0dfdfc066f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap @@ -11,7 +11,6 @@ E711.py:2:11: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -Suggested fix: 1 1 | #: E711 2 |-if res == None: 2 |+if res is None: @@ -32,7 +31,6 @@ E711.py:5:11: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -Suggested fix: 2 2 | if res == None: 3 3 | pass 4 4 | #: E711 @@ -55,7 +53,6 @@ E711.py:8:4: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -Suggested fix: 5 5 | if res != None: 6 6 | pass 7 7 | #: E711 @@ -78,7 +75,6 @@ E711.py:11:4: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -Suggested fix: 8 8 | if None == res: 9 9 | pass 10 10 | #: E711 @@ -101,7 +97,6 @@ E711.py:14:14: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -Suggested fix: 11 11 | if None != res: 12 12 | pass 13 13 | #: E711 @@ -124,7 +119,6 @@ E711.py:17:14: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -Suggested fix: 14 14 | if res[1] == None: 15 15 | pass 16 16 | #: E711 @@ -147,7 +141,6 @@ E711.py:20:4: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -Suggested fix: 17 17 | if res[1] != None: 18 18 | pass 19 19 | #: E711 @@ -169,7 +162,6 @@ E711.py:23:4: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -Suggested fix: 20 20 | if None != res[1]: 21 21 | pass 22 22 | #: E711 @@ -191,7 +183,6 @@ E711.py:26:9: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -Suggested fix: 23 23 | if None == res[1]: 24 24 | pass 25 25 | @@ -213,7 +204,6 @@ E711.py:26:17: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -Suggested fix: 23 23 | if None == res[1]: 24 24 | pass 25 25 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap index 0d8d57d925aac..0401928623ae4 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap @@ -11,7 +11,6 @@ E712.py:2:4: E712 [*] Avoid equality comparisons to `True`; use `if res:` for tr | = help: Replace with `res` -Suggested fix: 1 1 | #: E712 2 |-if res == True: 2 |+if res is True: @@ -32,7 +31,6 @@ E712.py:5:4: E712 [*] Avoid inequality comparisons to `False`; use `if res:` for | = help: Replace with `res` -Suggested fix: 2 2 | if res == True: 3 3 | pass 4 4 | #: E712 @@ -55,7 +53,6 @@ E712.py:8:4: E712 [*] Avoid inequality comparisons to `True`; use `if not res:` | = help: Replace with `not res` -Suggested fix: 5 5 | if res != False: 6 6 | pass 7 7 | #: E712 @@ -78,7 +75,6 @@ E712.py:11:4: E712 [*] Avoid equality comparisons to `False`; use `if not res:` | = help: Replace with `not res` -Suggested fix: 8 8 | if True != res: 9 9 | pass 10 10 | #: E712 @@ -101,7 +97,6 @@ E712.py:14:4: E712 [*] Avoid equality comparisons to `True`; use `if res[1]:` fo | = help: Replace with `res[1]` -Suggested fix: 11 11 | if False == res: 12 12 | pass 13 13 | #: E712 @@ -124,7 +119,6 @@ E712.py:17:4: E712 [*] Avoid inequality comparisons to `False`; use `if res[1]:` | = help: Replace with `res[1]` -Suggested fix: 14 14 | if res[1] == True: 15 15 | pass 16 16 | #: E712 @@ -147,7 +141,6 @@ E712.py:20:12: E712 [*] Avoid equality comparisons to `True`; use `if cond:` for | = help: Replace with `cond` -Suggested fix: 17 17 | if res[1] != False: 18 18 | pass 19 19 | #: E712 @@ -170,7 +163,6 @@ E712.py:20:36: E712 [*] Avoid equality comparisons to `False`; use `if not cond: | = help: Replace with `not cond` -Suggested fix: 17 17 | if res[1] != False: 18 18 | pass 19 19 | #: E712 @@ -192,7 +184,6 @@ E712.py:22:4: E712 [*] Avoid equality comparisons to `True`; use `if TrueElement | = help: Replace with `TrueElement` -Suggested fix: 19 19 | #: E712 20 20 | var = 1 if cond == True else -1 if cond == False else cond 21 21 | #: E712 @@ -214,7 +205,6 @@ E712.py:25:4: E712 [*] Avoid equality comparisons to `True` or `False` | = help: Replace comparison -Suggested fix: 22 22 | if (True) == TrueElement or x == TrueElement: 23 23 | pass 24 24 | @@ -236,7 +226,6 @@ E712.py:25:4: E712 [*] Avoid equality comparisons to `True` or `False` | = help: Replace comparison -Suggested fix: 22 22 | if (True) == TrueElement or x == TrueElement: 23 23 | pass 24 24 | @@ -258,7 +247,6 @@ E712.py:28:3: E712 [*] Avoid equality comparisons to `True`; use `if TrueElement | = help: Replace with `TrueElement` -Suggested fix: 25 25 | if res == True != False: 26 26 | pass 27 27 | @@ -280,7 +268,6 @@ E712.py:31:4: E712 [*] Avoid equality comparisons to `True`; use `if yield i:` f | = help: Replace with `yield i` -Suggested fix: 28 28 | if(True) == TrueElement or x == TrueElement: 29 29 | pass 30 30 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E713_E713.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E713_E713.py.snap index 2bd3b258880bb..368c81dc21dfb 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E713_E713.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E713_E713.py.snap @@ -11,7 +11,6 @@ E713.py:2:8: E713 [*] Test for membership should be `not in` | = help: Convert to `not in` -Suggested fix: 1 1 | #: E713 2 |-if not X in Y: 2 |+if X not in Y: @@ -32,7 +31,6 @@ E713.py:5:8: E713 [*] Test for membership should be `not in` | = help: Convert to `not in` -Suggested fix: 2 2 | if not X in Y: 3 3 | pass 4 4 | #: E713 @@ -55,7 +53,6 @@ E713.py:8:8: E713 [*] Test for membership should be `not in` | = help: Convert to `not in` -Suggested fix: 5 5 | if not X.B in Y: 6 6 | pass 7 7 | #: E713 @@ -78,7 +75,6 @@ E713.py:11:23: E713 [*] Test for membership should be `not in` | = help: Convert to `not in` -Suggested fix: 8 8 | if not X in Y and Z == "zero": 9 9 | pass 10 10 | #: E713 @@ -100,7 +96,6 @@ E713.py:14:9: E713 [*] Test for membership should be `not in` | = help: Convert to `not in` -Suggested fix: 11 11 | if X == "zero" or not Y in Z: 12 12 | pass 13 13 | #: E713 @@ -121,7 +116,6 @@ E713.py:40:12: E713 [*] Test for membership should be `not in` | = help: Convert to `not in` -Suggested fix: 37 37 | assert {"x": not foo} in bar 38 38 | assert [42, not foo] in bar 39 39 | assert not (re.search(r"^.:\\Users\\[^\\]*\\Downloads\\.*") is None) diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E714_E714.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E714_E714.py.snap index 40938154e41c8..ab11cdebfec14 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E714_E714.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E714_E714.py.snap @@ -11,7 +11,6 @@ E714.py:2:8: E714 [*] Test for object identity should be `is not` | = help: Convert to `is not` -Suggested fix: 1 1 | #: E714 2 |-if not X is Y: 2 |+if X is not Y: @@ -31,7 +30,6 @@ E714.py:5:8: E714 [*] Test for object identity should be `is not` | = help: Convert to `is not` -Suggested fix: 2 2 | if not X is Y: 3 3 | pass 4 4 | #: E714 @@ -52,7 +50,6 @@ E714.py:39:13: E714 [*] Test for object identity should be `is not` | = help: Convert to `is not` -Suggested fix: 36 36 | assert (not foo) in bar 37 37 | assert {"x": not foo} in bar 38 38 | assert [42, not foo] in bar diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap index e0be1920a31f6..95f9310189a1b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap @@ -10,7 +10,6 @@ E731.py:3:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -Suggested fix: 1 1 | def scope(): 2 2 | # E731 3 |- f = lambda x: 2 * x @@ -31,7 +30,6 @@ E731.py:8:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -Suggested fix: 5 5 | 6 6 | def scope(): 7 7 | # E731 @@ -53,7 +51,6 @@ E731.py:14:9: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `this` as a `def` -Suggested fix: 11 11 | def scope(): 12 12 | # E731 13 13 | while False: @@ -75,7 +72,6 @@ E731.py:19:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -Suggested fix: 16 16 | 17 17 | def scope(): 18 18 | # E731 @@ -97,7 +93,6 @@ E731.py:24:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -Suggested fix: 21 21 | 22 22 | def scope(): 23 23 | # E731 @@ -119,7 +114,6 @@ E731.py:57:5: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -Suggested fix: 54 54 | 55 55 | class Scope: 56 56 | # E731 @@ -143,7 +137,6 @@ E731.py:73:9: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `x` as a `def` -Suggested fix: 70 70 | 71 71 | x: Callable[[int], int] 72 72 | if True: @@ -166,7 +159,6 @@ E731.py:75:9: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `x` as a `def` -Suggested fix: 72 72 | if True: 73 73 | x = lambda: 1 74 74 | else: @@ -188,7 +180,6 @@ E731.py:86:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -Suggested fix: 83 83 | 84 84 | # ParamSpec cannot be used in this context, so do not preserve the annotation. 85 85 | P = ParamSpec("P") @@ -210,7 +201,6 @@ E731.py:94:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -Suggested fix: 91 91 | 92 92 | from typing import Callable 93 93 | @@ -232,7 +222,6 @@ E731.py:102:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -Suggested fix: 99 99 | 100 100 | from typing import Callable 101 101 | @@ -254,7 +243,6 @@ E731.py:110:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -Suggested fix: 107 107 | 108 108 | from typing import Callable 109 109 | @@ -276,7 +264,6 @@ E731.py:119:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -Suggested fix: 116 116 | 117 117 | from collections.abc import Callable 118 118 | @@ -298,7 +285,6 @@ E731.py:127:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -Suggested fix: 124 124 | 125 125 | from collections.abc import Callable 126 126 | @@ -320,7 +306,6 @@ E731.py:135:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -Suggested fix: 132 132 | 133 133 | from collections.abc import Callable 134 134 | @@ -342,7 +327,6 @@ E731.py:139:5: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `CELSIUS` as a `def` -Suggested fix: 136 136 | 137 137 | 138 138 | class TemperatureScales(Enum): @@ -364,7 +348,6 @@ E731.py:140:5: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `FAHRENHEIT` as a `def` -Suggested fix: 137 137 | 138 138 | class TemperatureScales(Enum): 139 139 | CELSIUS = (lambda deg_c: deg_c) @@ -389,7 +372,6 @@ E731.py:147:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -Suggested fix: 144 144 | def scope(): 145 145 | # E731 146 146 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W29.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W29.py.snap index e23a9f26632c8..4f7211b5a196a 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W29.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W29.py.snap @@ -12,7 +12,6 @@ W29.py:4:6: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -Suggested fix: 1 1 | #: Okay 2 2 | # 情 3 3 | #: W291:1:6 @@ -35,7 +34,6 @@ W29.py:11:35: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -Suggested fix: 8 8 | bang = 12 9 9 | #: W291:2:35 10 10 | '''multiline @@ -58,7 +56,6 @@ W29.py:13:6: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -Suggested fix: 10 10 | '''multiline 11 11 | string with trailing whitespace''' 12 12 | #: W291 W292 noeol diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap index 32ccdc6b6cd2f..a50fc89a1a6fa 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap @@ -9,7 +9,6 @@ W291.py:1:23: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -Suggested fix: 1 |-'''trailing whitespace 1 |+'''trailing whitespace 2 2 | inside a multiline string''' @@ -28,7 +27,6 @@ W291.py:4:24: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -Suggested fix: 1 1 | '''trailing whitespace 2 2 | inside a multiline string''' 3 3 | @@ -50,7 +48,6 @@ W291.py:8:8: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -Suggested fix: 5 5 | inside a multiline f-string''' 6 6 | 7 7 | # Trailing whitespace after `{` @@ -72,7 +69,6 @@ W291.py:14:10: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -Suggested fix: 11 11 | 12 12 | # Trailing whitespace after `2` 13 13 | f'abc { diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W292_W292_0.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W292_W292_0.py.snap index d45a3bf622cd2..5ef72fcad084f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W292_W292_0.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W292_W292_0.py.snap @@ -9,7 +9,6 @@ W292_0.py:2:9: W292 [*] No newline at end of file | = help: Add trailing newline -Suggested fix: 1 1 | def fn() -> None: 2 |- pass 2 |+ pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W29.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W29.py.snap index 9e9571af3684e..bb3c4d95f1a10 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W29.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W29.py.snap @@ -12,7 +12,6 @@ W29.py:7:1: W293 [*] Blank line contains whitespace | = help: Remove whitespace from blank line -Suggested fix: 4 4 | print 5 5 | #: W293:2:1 6 6 | class Foo(object): diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap index 54eea3f8ce757..1ca6eafd70215 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap @@ -11,7 +11,6 @@ W293.py:4:1: W293 [*] Blank line contains whitespace | = help: Remove whitespace from blank line -Suggested fix: 1 1 | # See: https://github.com/astral-sh/ruff/issues/9323 2 2 | class Chassis(RobotModuleTemplate): 3 3 | """底盘信息推送控制 @@ -32,7 +31,6 @@ W293.py:10:1: W293 [*] Blank line contains whitespace | = help: Remove whitespace from blank line -Suggested fix: 5 5 | """\ 6 6 | 7 7 | @@ -56,7 +54,6 @@ W293.py:16:1: W293 [*] Blank line contains whitespace | = help: Remove whitespace from blank line -Suggested fix: 11 11 | 12 12 | 13 13 | "abc\ @@ -79,7 +76,6 @@ W293.py:18:1: W293 [*] Blank line contains whitespace | = help: Remove whitespace from blank line -Suggested fix: 15 15 | \ 16 16 | 17 17 | '''blank line with whitespace diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_0.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_0.py.snap index e27211e490d63..3487a52ec6a3e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_0.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_0.py.snap @@ -11,7 +11,6 @@ W605_0.py:2:10: W605 [*] Invalid escape sequence: `\.` | = help: Use a raw string literal -Suggested fix: 1 1 | #: W605:1:10 2 |-regex = '\.png$' 2 |+regex = r'\.png$' @@ -31,7 +30,6 @@ W605_0.py:6:1: W605 [*] Invalid escape sequence: `\.` | = help: Use a raw string literal -Suggested fix: 2 2 | regex = '\.png$' 3 3 | 4 4 | #: W605:2:1 @@ -53,7 +51,6 @@ W605_0.py:11:6: W605 [*] Invalid escape sequence: `\_` | = help: Use a raw string literal -Suggested fix: 8 8 | 9 9 | #: W605:2:6 10 10 | f( @@ -76,7 +73,6 @@ W605_0.py:18:6: W605 [*] Invalid escape sequence: `\_` | = help: Use a raw string literal -Suggested fix: 12 12 | ) 13 13 | 14 14 | #: W605:4:6 @@ -96,7 +92,6 @@ W605_0.py:23:39: W605 [*] Invalid escape sequence: `\_` | = help: Add backslash to escape sequence -Suggested fix: 20 20 | """ 21 21 | 22 22 | #: W605:1:38 @@ -119,7 +114,6 @@ W605_0.py:28:12: W605 [*] Invalid escape sequence: `\.` | = help: Use a raw string literal -Suggested fix: 25 25 | 26 26 | def f(): 27 27 | #: W605:1:11 @@ -142,7 +136,6 @@ W605_0.py:45:12: W605 [*] Invalid escape sequence: `\_` | = help: Add backslash to escape sequence -Suggested fix: 42 42 | \w 43 43 | ''' # noqa 44 44 | @@ -164,7 +157,6 @@ W605_0.py:48:6: W605 [*] Invalid escape sequence: `\ ` | = help: Use a raw string literal -Suggested fix: 45 45 | regex = '\\\_' 46 46 | 47 47 | #: W605:1:7 @@ -186,7 +178,6 @@ W605_0.py:53:9: W605 [*] Invalid escape sequence: `\.` | = help: Add backslash to escape sequence -Suggested fix: 50 50 | #: W605:1:13 51 51 | ( 52 52 | "foo \ @@ -208,7 +199,6 @@ W605_0.py:57:6: W605 [*] Invalid escape sequence: `\.` | = help: Add backslash to escape sequence -Suggested fix: 54 54 | ) 55 55 | 56 56 | #: W605:1:6 @@ -228,7 +218,6 @@ W605_0.py:60:13: W605 [*] Invalid escape sequence: `\.` | = help: Add backslash to escape sequence -Suggested fix: 57 57 | "foo \. bar \t" 58 58 | 59 59 | #: W605:1:13 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_1.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_1.py.snap index edfa987216b11..07d2088731e50 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_1.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_1.py.snap @@ -11,7 +11,6 @@ W605_1.py:4:11: W605 [*] Invalid escape sequence: `\.` | = help: Use a raw string literal -Suggested fix: 1 1 | # Same as `W605_0.py` but using f-strings instead. 2 2 | 3 3 | #: W605:1:10 @@ -33,7 +32,6 @@ W605_1.py:8:1: W605 [*] Invalid escape sequence: `\.` | = help: Use a raw string literal -Suggested fix: 4 4 | regex = f'\.png$' 5 5 | 6 6 | #: W605:2:1 @@ -55,7 +53,6 @@ W605_1.py:13:7: W605 [*] Invalid escape sequence: `\_` | = help: Use a raw string literal -Suggested fix: 10 10 | 11 11 | #: W605:2:6 12 12 | f( @@ -78,7 +75,6 @@ W605_1.py:20:6: W605 [*] Invalid escape sequence: `\_` | = help: Use a raw string literal -Suggested fix: 14 14 | ) 15 15 | 16 16 | #: W605:4:6 @@ -98,7 +94,6 @@ W605_1.py:25:40: W605 [*] Invalid escape sequence: `\_` | = help: Add backslash to escape sequence -Suggested fix: 22 22 | """ 23 23 | 24 24 | #: W605:1:38 @@ -121,7 +116,6 @@ W605_1.py:43:13: W605 [*] Invalid escape sequence: `\_` | = help: Add backslash to escape sequence -Suggested fix: 40 40 | \w 41 41 | ''' # noqa 42 42 | @@ -143,7 +137,6 @@ W605_1.py:44:11: W605 [*] Invalid escape sequence: `\{` | = help: Use a raw string literal -Suggested fix: 41 41 | ''' # noqa 42 42 | 43 43 | regex = f'\\\_' @@ -166,7 +159,6 @@ W605_1.py:45:11: W605 [*] Invalid escape sequence: `\{` | = help: Use a raw string literal -Suggested fix: 42 42 | 43 43 | regex = f'\\\_' 44 44 | value = f'\{{1}}' @@ -189,7 +181,6 @@ W605_1.py:46:14: W605 [*] Invalid escape sequence: `\}` | = help: Use a raw string literal -Suggested fix: 43 43 | regex = f'\\\_' 44 44 | value = f'\{{1}}' 45 45 | value = f'\{1}' @@ -211,7 +202,6 @@ W605_1.py:47:14: W605 [*] Invalid escape sequence: `\{` | = help: Use a raw string literal -Suggested fix: 44 44 | value = f'\{{1}}' 45 45 | value = f'\{1}' 46 46 | value = f'{1:\}' @@ -234,7 +224,6 @@ W605_1.py:48:15: W605 [*] Invalid escape sequence: `\{` | = help: Use a raw string literal -Suggested fix: 45 45 | value = f'\{1}' 46 46 | value = f'{1:\}' 47 47 | value = f"{f"\{1}"}" @@ -256,7 +245,6 @@ W605_1.py:57:9: W605 [*] Invalid escape sequence: `\d` | = help: Use a raw string literal -Suggested fix: 54 54 | value = f"{rf"\{1}"}" 55 55 | 56 56 | # Regression tests for https://github.com/astral-sh/ruff/issues/10434 @@ -277,7 +265,6 @@ W605_1.py:58:11: W605 [*] Invalid escape sequence: `\d` | = help: Add backslash to escape sequence -Suggested fix: 55 55 | 56 56 | # Regression tests for https://github.com/astral-sh/ruff/issues/10434 57 57 | f"{{}}+-\d" @@ -296,7 +283,6 @@ W605_1.py:59:12: W605 [*] Invalid escape sequence: `\d` | = help: Add backslash to escape sequence -Suggested fix: 56 56 | # Regression tests for https://github.com/astral-sh/ruff/issues/10434 57 57 | f"{{}}+-\d" 58 58 | f"\n{{}}+-\d+" diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E301_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E301_notebook.snap index 9bb2bd91a1854..90dfcb9bf7330 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E301_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E301_notebook.snap @@ -12,7 +12,6 @@ E30.ipynb:13:5: E301 [*] Expected 1 blank line, found 0 | = help: Add missing blank line -Suggested fix: 10 10 | 11 11 | def method(cls) -> None: 12 12 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap index 72d32965f8fa8..2c2c7a34345a8 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap @@ -12,7 +12,6 @@ E30.ipynb:21:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 18 18 | def a(): 19 19 | pass 20 20 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap index c56bcbd2e0e37..f8ac6e51c3524 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap @@ -10,7 +10,6 @@ E30.ipynb:29:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 25 25 | def fn(): 26 26 | _ = None 27 27 | @@ -30,7 +29,6 @@ E30.ipynb:39:1: E303 [*] Too many blank lines (4) | = help: Remove extraneous blank line(s) -Suggested fix: 34 34 | # E303 35 35 | 36 36 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_typing_stub.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_typing_stub.snap index f1b784f863b9b..cad9326985a5c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_typing_stub.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_typing_stub.snap @@ -10,7 +10,6 @@ E30.pyi:17:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 13 13 | @overload 14 14 | def a(arg: int, name: str): ... 15 15 | @@ -30,7 +29,6 @@ E30.pyi:22:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 18 18 | def grouped2(): ... 19 19 | def grouped3( ): ... 20 20 | @@ -49,7 +47,6 @@ E30.pyi:35:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 31 31 | 32 32 | def with_blank_line(): ... 33 33 | @@ -69,7 +66,6 @@ E30.pyi:43:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 39 39 | pass 40 40 | b = "test" 41 41 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap index 8d8c2e29b290b..e1a34824ad6d0 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap @@ -12,7 +12,6 @@ E30.ipynb:45:1: E304 [*] Blank lines found after function decorator (1) | = help: Remove extraneous blank line(s) -Suggested fix: 41 41 | # end 42 42 | # E304 43 43 | @decorator diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_typing_stub.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_typing_stub.snap index b2cdc81225968..f733c7bc60f84 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_typing_stub.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_typing_stub.snap @@ -10,7 +10,6 @@ E30.pyi:32:5: E304 [*] Blank lines found after function decorator (1) | = help: Remove extraneous blank line(s) -Suggested fix: 28 28 | def grouped2(): ... 29 29 | def grouped3( ): ... 30 30 | @decorated diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E305_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E305_notebook.snap index 9ccffc3176133..531153a81af0e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E305_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E305_notebook.snap @@ -11,7 +11,6 @@ E30.ipynb:55:1: E305 [*] Expected 2 blank lines after class or function definiti | = help: Add missing blank line(s) -Suggested fix: 52 52 | # comment 53 53 | 54 54 | # another comment diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E306_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E306_notebook.snap index 94f0ef101befc..2dea5bca3a280 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E306_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E306_notebook.snap @@ -12,7 +12,6 @@ E30.ipynb:60:5: E306 [*] Expected 1 blank line before a nested definition, found | = help: Add missing blank line -Suggested fix: 57 57 | # E306:3:5 58 58 | def a(): 59 59 | x = 1 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(-1)-between(0).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(-1)-between(0).snap index 0c6cec371514c..b11cfa0fd3468 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(-1)-between(0).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(-1)-between(0).snap @@ -15,7 +15,6 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 1 1 | import json 2 |- 3 |- @@ -37,7 +36,6 @@ E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 20 20 | 21 21 | abcd.foo() 22 22 | @@ -63,7 +61,6 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -85,7 +82,6 @@ E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 32 32 | 33 33 | abcd.foo() 34 34 | @@ -106,7 +102,6 @@ E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 38 38 | if TYPE_CHECKING: 39 39 | from typing_extensions import TypeAlias 40 40 | @@ -126,7 +121,6 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 59 59 | 60 60 | from typing import Any, Sequence 61 61 | @@ -144,7 +138,6 @@ E30_isort.py:62:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 59 59 | 60 60 | from typing import Any, Sequence 61 61 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(0)-between(0).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(0)-between(0).snap index 4788064b64e77..a45f6803c6c01 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(0)-between(0).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(0)-between(0).snap @@ -15,7 +15,6 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 1 1 | import json 2 |- 3 |- @@ -40,7 +39,6 @@ E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 20 20 | 21 21 | abcd.foo() 22 22 | @@ -66,7 +64,6 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -88,7 +85,6 @@ E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 32 32 | 33 33 | abcd.foo() 34 34 | @@ -109,7 +105,6 @@ E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 38 38 | if TYPE_CHECKING: 39 39 | from typing_extensions import TypeAlias 40 40 | @@ -129,7 +124,6 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 58 58 | 59 59 | 60 60 | from typing import Any, Sequence diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(1)-between(1).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(1)-between(1).snap index 084a92f2d74a4..8529d8f36f275 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(1)-between(1).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(1)-between(1).snap @@ -15,7 +15,6 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 1 1 | import json 2 2 | 3 |- @@ -39,7 +38,6 @@ E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 20 20 | 21 21 | abcd.foo() 22 22 | @@ -65,7 +63,6 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -87,7 +84,6 @@ E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 32 32 | 33 33 | abcd.foo() 34 34 | @@ -108,7 +104,6 @@ E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 38 38 | if TYPE_CHECKING: 39 39 | from typing_extensions import TypeAlias 40 40 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(4)-between(4).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(4)-between(4).snap index e93791d6944de..653655a97d9ab 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(4)-between(4).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(4)-between(4).snap @@ -15,7 +15,6 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 2 2 | 3 3 | 4 4 | @@ -38,7 +37,6 @@ E30_isort.py:8:1: E302 [*] Expected 4 blank lines, found 2 | = help: Add missing blank line(s) -Suggested fix: 5 5 | from typing import Any, Sequence 6 6 | 7 7 | @@ -61,7 +59,6 @@ E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 20 20 | 21 21 | abcd.foo() 22 22 | @@ -87,7 +84,6 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -109,7 +105,6 @@ E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 32 32 | 33 33 | abcd.foo() 34 34 | @@ -130,7 +125,6 @@ E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 38 38 | if TYPE_CHECKING: 39 39 | from typing_extensions import TypeAlias 40 40 | @@ -150,7 +144,6 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 59 59 | 60 60 | from typing import Any, Sequence 61 61 | @@ -170,7 +163,6 @@ E30_isort.py:62:1: E302 [*] Expected 4 blank lines, found 1 | = help: Add missing blank line(s) -Suggested fix: 59 59 | 60 60 | from typing import Any, Sequence 61 61 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_typing_stub_isort.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_typing_stub_isort.snap index d252a2d6bbdd7..b39772aaa74ec 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_typing_stub_isort.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_typing_stub_isort.snap @@ -15,7 +15,6 @@ E30_isort.pyi:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 1 1 | import json 2 |- 3 |- @@ -35,7 +34,6 @@ E30_isort.pyi:5:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -Suggested fix: 1 1 | import json 2 2 | 3 |- @@ -53,7 +51,6 @@ E30_isort.pyi:8:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 4 4 | 5 5 | from typing import Any, Sequence 6 6 | @@ -73,7 +70,6 @@ E30_isort.pyi:11:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 7 7 | 8 8 | class MissingCommand(TypeError): ... # noqa: N818 9 9 | @@ -92,7 +88,6 @@ E30_isort.pyi:17:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 13 13 | backend_object: str | None 14 14 | backend: Any 15 15 | @@ -112,7 +107,6 @@ E30_isort.pyi:21:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 17 17 | if __name__ == "__main__": 18 18 | import abcd 19 19 | @@ -138,7 +132,6 @@ E30_isort.pyi:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -157,7 +150,6 @@ E30_isort.pyi:30:5: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -178,7 +170,6 @@ E30_isort.pyi:33:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 29 29 | 30 30 | from typing_extensions import TypeAlias 31 31 | @@ -196,7 +187,6 @@ E30_isort.pyi:45:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 41 41 | def __call__2(self, name: str, *args: Any, **kwargs: Any) -> Any: 42 42 | ... 43 43 | @@ -214,7 +204,6 @@ E30_isort.pyi:48:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 44 44 | 45 45 | def _exit(self) -> None: ... 46 46 | @@ -232,7 +221,6 @@ E30_isort.pyi:51:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 47 47 | 48 48 | def _optional_commands(self) -> dict[str, bool]: ... 49 49 | @@ -250,7 +238,6 @@ E30_isort.pyi:54:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 50 50 | 51 51 | def run(argv: Sequence[str]) -> int: ... 52 52 | @@ -268,7 +255,6 @@ E30_isort.pyi:57:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 53 53 | 54 54 | def read_line(fd: int = 0) -> bytearray: ... 55 55 | @@ -288,7 +274,6 @@ E30_isort.pyi:60:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 56 56 | 57 57 | def flush() -> None: ... 58 58 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap index 695ffa8571581..74c2821c72e86 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap @@ -12,7 +12,6 @@ constant_literals.py:4:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 1 1 | ### 2 2 | # Errors 3 3 | ### @@ -35,7 +34,6 @@ constant_literals.py:6:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 3 3 | ### 4 4 | if "abc" is "def": # F632 (fix) 5 5 | pass @@ -58,7 +56,6 @@ constant_literals.py:8:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 5 5 | pass 6 6 | if "abc" is None: # F632 (fix, but leaves behind unfixable E711) 7 7 | pass @@ -81,7 +78,6 @@ constant_literals.py:10:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 7 7 | pass 8 8 | if None is "abc": # F632 (fix, but leaves behind unfixable E711) 9 9 | pass @@ -104,7 +100,6 @@ constant_literals.py:12:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 9 9 | pass 10 10 | if "abc" is False: # F632 (fix, but leaves behind unfixable E712) 11 11 | pass @@ -127,7 +122,6 @@ constant_literals.py:14:4: E712 [*] Avoid equality comparisons to `False`; use ` | = help: Replace with `not None` -Suggested fix: 11 11 | pass 12 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) 13 13 | pass @@ -150,7 +144,6 @@ constant_literals.py:14:13: E711 [*] Comparison to `None` should be `cond is Non | = help: Replace with `cond is None` -Suggested fix: 11 11 | pass 12 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) 13 13 | pass @@ -172,7 +165,6 @@ constant_literals.py:16:4: E711 [*] Comparison to `None` should be `cond is None | = help: Replace with `cond is None` -Suggested fix: 13 13 | pass 14 14 | if False == None: # E711, E712 (fix) 15 15 | pass @@ -194,7 +186,6 @@ constant_literals.py:16:4: E712 [*] Avoid equality comparisons to `False`; use ` | = help: Replace with `not None` -Suggested fix: 13 13 | pass 14 14 | if False == None: # E711, E712 (fix) 15 15 | pass @@ -216,7 +207,6 @@ constant_literals.py:20:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 17 17 | pass 18 18 | 19 19 | named_var = [] @@ -239,7 +229,6 @@ constant_literals.py:22:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 19 19 | named_var = [] 20 20 | if [] is []: # F632 (fix) 21 21 | pass @@ -262,7 +251,6 @@ constant_literals.py:24:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 21 21 | pass 22 22 | if named_var is []: # F632 (fix) 23 23 | pass @@ -285,7 +273,6 @@ constant_literals.py:26:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 23 23 | pass 24 24 | if [] is named_var: # F632 (fix) 25 25 | pass @@ -308,7 +295,6 @@ constant_literals.py:28:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 25 25 | pass 26 26 | if named_var is [1]: # F632 (fix) 27 27 | pass @@ -330,7 +316,6 @@ constant_literals.py:30:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 27 27 | pass 28 28 | if [1] is named_var: # F632 (fix) 29 29 | pass @@ -352,7 +337,6 @@ constant_literals.py:34:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 31 31 | pass 32 32 | 33 33 | named_var = {} @@ -375,7 +359,6 @@ constant_literals.py:36:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 33 33 | named_var = {} 34 34 | if {} is {}: # F632 (fix) 35 35 | pass @@ -398,7 +381,6 @@ constant_literals.py:38:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 35 35 | pass 36 36 | if named_var is {}: # F632 (fix) 37 37 | pass @@ -421,7 +403,6 @@ constant_literals.py:40:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 37 37 | pass 38 38 | if {} is named_var: # F632 (fix) 39 39 | pass @@ -444,7 +425,6 @@ constant_literals.py:42:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 39 39 | pass 40 40 | if named_var is {1}: # F632 (fix) 41 41 | pass @@ -466,7 +446,6 @@ constant_literals.py:44:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 41 41 | pass 42 42 | if {1} is named_var: # F632 (fix) 43 43 | pass @@ -488,7 +467,6 @@ constant_literals.py:48:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 45 45 | pass 46 46 | 47 47 | named_var = {1: 1} @@ -511,7 +489,6 @@ constant_literals.py:50:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 47 47 | named_var = {1: 1} 48 48 | if {1: 1} is {1: 1}: # F632 (fix) 49 49 | pass @@ -534,7 +511,6 @@ constant_literals.py:52:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 49 49 | pass 50 50 | if named_var is {1: 1}: # F632 (fix) 51 51 | pass @@ -557,7 +533,6 @@ constant_literals.py:54:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 51 51 | pass 52 52 | if {1: 1} is named_var: # F632 (fix) 53 53 | pass @@ -580,7 +555,6 @@ constant_literals.py:56:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 53 53 | pass 54 54 | if named_var is {1: 1}: # F632 (fix) 55 55 | pass @@ -602,7 +576,6 @@ constant_literals.py:58:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 55 55 | pass 56 56 | if {1: 1} is named_var: # F632 (fix) 57 57 | pass diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap index 99b85c95560c1..8f354a5380de1 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap @@ -12,7 +12,6 @@ E502.py:9:9: E502 [*] Redundant backslash | = help: Remove redundant backslash -Suggested fix: 6 6 | 3 \ 7 7 | + 4 8 8 | @@ -33,7 +32,6 @@ E502.py:10:11: E502 [*] Redundant backslash | = help: Remove redundant backslash -Suggested fix: 7 7 | + 4 8 8 | 9 9 | a = (3 -\ @@ -55,7 +53,6 @@ E502.py:14:9: E502 [*] Redundant backslash | = help: Remove redundant backslash -Suggested fix: 11 11 | 7) 12 12 | 13 13 | z = 5 + \ @@ -78,7 +75,6 @@ E502.py:15:11: E502 [*] Redundant backslash | = help: Remove redundant backslash -Suggested fix: 12 12 | 13 13 | z = 5 + \ 14 14 | (3 -\ @@ -100,7 +96,6 @@ E502.py:23:17: E502 [*] Redundant backslash | = help: Remove redundant backslash -Suggested fix: 20 20 | 2] 21 21 | 22 22 | b = [ @@ -123,7 +118,6 @@ E502.py:24:8: E502 [*] Redundant backslash | = help: Remove redundant backslash -Suggested fix: 21 21 | 22 22 | b = [ 23 23 | 2 + 4 + 5 + \ @@ -145,7 +139,6 @@ E502.py:29:11: E502 [*] Redundant backslash | = help: Remove redundant backslash -Suggested fix: 26 26 | ] 27 27 | 28 28 | c = (True and @@ -168,7 +161,6 @@ E502.py:30:14: E502 [*] Redundant backslash | = help: Remove redundant backslash -Suggested fix: 27 27 | 28 28 | c = (True and 29 29 | False \ @@ -190,7 +182,6 @@ E502.py:31:14: E502 [*] Redundant backslash | = help: Remove redundant backslash -Suggested fix: 28 28 | c = (True and 29 29 | False \ 30 30 | or False \ @@ -212,7 +203,6 @@ E502.py:44:14: E502 [*] Redundant backslash | = help: Remove redundant backslash -Suggested fix: 41 41 | 42 42 | 43 43 | s = { @@ -232,7 +222,6 @@ E502.py:55:12: E502 [*] Redundant backslash | = help: Remove redundant backslash -Suggested fix: 52 52 | } 53 53 | 54 54 | @@ -255,7 +244,6 @@ E502.py:61:9: E502 [*] Redundant backslash | = help: Remove redundant backslash -Suggested fix: 58 58 | y = ( 59 59 | 2 + 2 # \ 60 60 | + 3 # \ @@ -277,7 +265,6 @@ E502.py:82:12: E502 [*] Redundant backslash | = help: Remove redundant backslash -Suggested fix: 79 79 | x = "abc" \ 80 80 | "xyz" 81 81 | @@ -298,7 +285,6 @@ E502.py:87:14: E502 [*] Redundant backslash | = help: Remove redundant backslash -Suggested fix: 84 84 | 85 85 | 86 86 | def foo(): diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap index 498775fcb05a2..719fbcf758c82 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap @@ -10,7 +10,6 @@ W391_0.py:14:1: W391 [*] Extra newline at end of file | = help: Remove trailing newline -Suggested fix: 11 11 | if __name__ == '__main__': 12 12 | foo() 13 13 | bar() diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_2.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_2.py.snap index cbc5775ea65bb..56881f40c25c4 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_2.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_2.py.snap @@ -12,7 +12,6 @@ W391_2.py:14:1: W391 [*] Too many newlines at end of file | = help: Remove trailing newlines -Suggested fix: 11 11 | if __name__ == '__main__': 12 12 | foo() 13 13 | bar() diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__shebang.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__shebang.snap index a75fec953b699..4e4740aa8dc01 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__shebang.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__shebang.snap @@ -11,7 +11,6 @@ shebang.py:3:1: E265 [*] Block comment should start with `# ` | = help: Format space -Suggested fix: 1 1 | #!/usr/bin/python 2 2 | # 3 |-#! diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(-1)-between(0).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(-1)-between(0).snap index 980336738e245..75e6d1195cc48 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(-1)-between(0).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(-1)-between(0).snap @@ -15,7 +15,6 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 1 1 | import json 2 |- 3 |- @@ -33,7 +32,6 @@ E30_isort.py:5:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -Suggested fix: 1 1 | import json 2 2 | 3 3 | @@ -53,7 +51,6 @@ E30_isort.py:21:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 17 17 | if __name__ == "__main__": 18 18 | import abcd 19 19 | @@ -79,7 +76,6 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -98,7 +94,6 @@ E30_isort.py:30:5: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -119,7 +114,6 @@ E30_isort.py:33:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 29 29 | 30 30 | from typing_extensions import TypeAlias 31 31 | @@ -139,7 +133,6 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 59 59 | 60 60 | from typing import Any, Sequence 61 61 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(0)-between(0).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(0)-between(0).snap index 906f14df95850..e7e7d017c4c9d 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(0)-between(0).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(0)-between(0).snap @@ -15,7 +15,6 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 1 1 | import json 2 |- 3 |- @@ -36,7 +35,6 @@ E30_isort.py:5:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -Suggested fix: 1 1 | import json 2 2 | 3 3 | @@ -54,7 +52,6 @@ E30_isort.py:8:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 3 3 | 4 4 | 5 5 | from typing import Any, Sequence @@ -75,7 +72,6 @@ E30_isort.py:21:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 17 17 | if __name__ == "__main__": 18 18 | import abcd 19 19 | @@ -101,7 +97,6 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -120,7 +115,6 @@ E30_isort.py:30:5: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -141,7 +135,6 @@ E30_isort.py:33:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 29 29 | 30 30 | from typing_extensions import TypeAlias 31 31 | @@ -161,7 +154,6 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 58 58 | 59 59 | 60 60 | from typing import Any, Sequence @@ -179,7 +171,6 @@ E30_isort.py:62:1: E303 [*] Too many blank lines (1) | = help: Remove extraneous blank line(s) -Suggested fix: 58 58 | 59 59 | 60 60 | from typing import Any, Sequence diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(1)-between(1).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(1)-between(1).snap index df3d7f2b44733..ea6db5026c732 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(1)-between(1).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(1)-between(1).snap @@ -15,7 +15,6 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 1 1 | import json 2 2 | 3 |- @@ -35,7 +34,6 @@ E30_isort.py:5:1: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -Suggested fix: 1 1 | import json 2 2 | 3 3 | @@ -53,7 +51,6 @@ E30_isort.py:8:1: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 4 4 | 5 5 | from typing import Any, Sequence 6 6 | @@ -73,7 +70,6 @@ E30_isort.py:21:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 17 17 | if __name__ == "__main__": 18 18 | import abcd 19 19 | @@ -99,7 +95,6 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -118,7 +113,6 @@ E30_isort.py:30:5: E303 [*] Too many blank lines (3) | = help: Remove extraneous blank line(s) -Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -139,7 +133,6 @@ E30_isort.py:33:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 29 29 | 30 30 | from typing_extensions import TypeAlias 31 31 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(4)-between(4).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(4)-between(4).snap index ae7a1683aa67c..8cb3360ee3f42 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(4)-between(4).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(4)-between(4).snap @@ -15,7 +15,6 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 2 2 | 3 3 | 4 4 | @@ -40,7 +39,6 @@ E30_isort.py:21:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 17 17 | if __name__ == "__main__": 18 18 | import abcd 19 19 | @@ -66,7 +64,6 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 25 25 | if TYPE_CHECKING: 26 26 | import os 27 27 | @@ -87,7 +84,6 @@ E30_isort.py:33:5: E303 [*] Too many blank lines (2) | = help: Remove extraneous blank line(s) -Suggested fix: 29 29 | 30 30 | from typing_extensions import TypeAlias 31 31 | @@ -107,7 +103,6 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 59 59 | 60 60 | from typing import Any, Sequence 61 61 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__w292_4.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__w292_4.snap index 7128563a5e66a..25f07bb2c76e9 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__w292_4.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__w292_4.snap @@ -8,7 +8,6 @@ W292_4.py:1:2: W292 [*] No newline at end of file | = help: Add trailing newline -Suggested fix: 1 |- 1 |+ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap index c369e24f23007..97543fb450048 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap @@ -13,7 +13,6 @@ D.py:129:5: D200 [*] One-line docstring should fit on one line | = help: Reformat to one line -Suggested fix: 126 126 | '(found 3)') 127 127 | @expect('D212: Multi-line docstring summary should start at the first line') 128 128 | def asdlkfasd(): @@ -39,7 +38,6 @@ D.py:597:5: D200 [*] One-line docstring should fit on one line | = help: Reformat to one line -Suggested fix: 594 594 | '(found 3)') 595 595 | @expect('D212: Multi-line docstring summary should start at the first line') 596 596 | def one_liner(): @@ -65,7 +63,6 @@ D.py:606:5: D200 [*] One-line docstring should fit on one line | = help: Reformat to one line -Suggested fix: 603 603 | '(found 3)') 604 604 | @expect('D212: Multi-line docstring summary should start at the first line') 605 605 | def one_liner(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap index 8fead4c9eca31..9c8dcb8c30531 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap @@ -21,7 +21,6 @@ D200.py:7:5: D200 [*] One-line docstring should fit on one line | = help: Reformat to one line -Suggested fix: 4 4 | 5 5 | 6 6 | def func(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D201_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D201_D.py.snap index 22bbbbe9f6722..f4d9eb1b997d7 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D201_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D201_D.py.snap @@ -10,7 +10,6 @@ D.py:137:5: D201 [*] No blank lines allowed before function docstring (found 1) | = help: Remove blank line(s) before function docstring -Suggested fix: 133 133 | 134 134 | @expect('D201: No blank lines allowed before function docstring (found 1)') 135 135 | def leading_space(): @@ -32,7 +31,6 @@ D.py:151:5: D201 [*] No blank lines allowed before function docstring (found 1) | = help: Remove blank line(s) before function docstring -Suggested fix: 147 147 | @expect('D201: No blank lines allowed before function docstring (found 1)') 148 148 | @expect('D202: No blank lines allowed after function docstring (found 1)') 149 149 | def trailing_and_leading_space(): @@ -56,7 +54,6 @@ D.py:546:5: D201 [*] No blank lines allowed before function docstring (found 1) | = help: Remove blank line(s) before function docstring -Suggested fix: 542 542 | @expect('D201: No blank lines allowed before function docstring (found 1)') 543 543 | @expect('D213: Multi-line docstring summary should start at the second line') 544 544 | def multiline_leading_space(): @@ -82,7 +79,6 @@ D.py:568:5: D201 [*] No blank lines allowed before function docstring (found 1) | = help: Remove blank line(s) before function docstring -Suggested fix: 564 564 | @expect('D202: No blank lines allowed after function docstring (found 1)') 565 565 | @expect('D213: Multi-line docstring summary should start at the second line') 566 566 | def multiline_trailing_and_leading_space(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D.py.snap index 2b1b840b81a03..51649e6cd268c 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D.py.snap @@ -12,7 +12,6 @@ D.py:142:5: D202 [*] No blank lines allowed after function docstring (found 1) | = help: Remove blank line(s) after function docstring -Suggested fix: 140 140 | @expect('D202: No blank lines allowed after function docstring (found 1)') 141 141 | def trailing_space(): 142 142 | """Leading space.""" @@ -34,7 +33,6 @@ D.py:151:5: D202 [*] No blank lines allowed after function docstring (found 1) | = help: Remove blank line(s) after function docstring -Suggested fix: 149 149 | def trailing_and_leading_space(): 150 150 | 151 151 | """Trailing and leading space.""" @@ -60,7 +58,6 @@ D.py:555:5: D202 [*] No blank lines allowed after function docstring (found 1) | = help: Remove blank line(s) after function docstring -Suggested fix: 556 556 | 557 557 | More content. 558 558 | """ @@ -86,7 +83,6 @@ D.py:568:5: D202 [*] No blank lines allowed after function docstring (found 1) | = help: Remove blank line(s) after function docstring -Suggested fix: 569 569 | 570 570 | More content. 571 571 | """ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D202.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D202.py.snap index 95514dfc21901..6608aa9a44749 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D202.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D202.py.snap @@ -10,7 +10,6 @@ D202.py:57:5: D202 [*] No blank lines allowed after function docstring (found 2) | = help: Remove blank line(s) after function docstring -Suggested fix: 55 55 | # D202 56 56 | def outer(): 57 57 | """This is a docstring.""" @@ -31,7 +30,6 @@ D202.py:68:5: D202 [*] No blank lines allowed after function docstring (found 2) | = help: Remove blank line(s) after function docstring -Suggested fix: 66 66 | # D202 67 67 | def outer(): 68 68 | """This is a docstring.""" @@ -54,7 +52,6 @@ D202.py:80:5: D202 [*] No blank lines allowed after function docstring (found 1) | = help: Remove blank line(s) after function docstring -Suggested fix: 78 78 | # D202 79 79 | def outer(): 80 80 | """This is a docstring.""" diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D203_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D203_D.py.snap index daa9034a4f6fd..9d54c19b0901c 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D203_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D203_D.py.snap @@ -9,7 +9,6 @@ D.py:161:5: D203 [*] 1 blank line required before class docstring | = help: Insert 1 blank line before class docstring -Suggested fix: 158 158 | 159 159 | 160 160 | class LeadingSpaceMissing: @@ -29,7 +28,6 @@ D.py:192:5: D203 [*] 1 blank line required before class docstring | = help: Insert 1 blank line before class docstring -Suggested fix: 189 189 | 190 190 | 191 191 | class LeadingAndTrailingSpaceMissing: @@ -58,7 +56,6 @@ D.py:526:5: D203 [*] 1 blank line required before class docstring | = help: Insert 1 blank line before class docstring -Suggested fix: 523 523 | # This is reproducing a bug where AttributeError is raised when parsing class 524 524 | # parameters as functions for Google / Numpy conventions. 525 525 | class Blah: # noqa: D203,D213 @@ -79,7 +76,6 @@ D.py:649:5: D203 [*] 1 blank line required before class docstring | = help: Insert 1 blank line before class docstring -Suggested fix: 646 646 | " 647 647 | 648 648 | class StatementOnSameLineAsDocstring: @@ -98,7 +94,6 @@ D.py:654:5: D203 [*] 1 blank line required before class docstring | = help: Insert 1 blank line before class docstring -Suggested fix: 651 651 | pass 652 652 | 653 653 | class StatementOnSameLineAsDocstring: @@ -119,7 +114,6 @@ D.py:658:5: D203 [*] 1 blank line required before class docstring | = help: Insert 1 blank line before class docstring -Suggested fix: 655 655 | 656 656 | 657 657 | class CommentAfterDocstring: diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D204_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D204_D.py.snap index b6f73c9140c6f..8515a7f7aea84 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D204_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D204_D.py.snap @@ -11,7 +11,6 @@ D.py:181:5: D204 [*] 1 blank line required after class docstring | = help: Insert 1 blank line after class docstring -Suggested fix: 179 179 | class TrailingSpace: 180 180 | 181 181 | """TrailingSpace.""" @@ -31,7 +30,6 @@ D.py:192:5: D204 [*] 1 blank line required after class docstring | = help: Insert 1 blank line after class docstring -Suggested fix: 190 190 | 191 191 | class LeadingAndTrailingSpaceMissing: 192 192 | """Leading and trailing space missing.""" @@ -52,7 +50,6 @@ D.py:649:5: D204 [*] 1 blank line required after class docstring | = help: Insert 1 blank line after class docstring -Suggested fix: 646 646 | " 647 647 | 648 648 | class StatementOnSameLineAsDocstring: @@ -74,7 +71,6 @@ D.py:654:5: D204 [*] 1 blank line required after class docstring | = help: Insert 1 blank line after class docstring -Suggested fix: 651 651 | pass 652 652 | 653 653 | class StatementOnSameLineAsDocstring: @@ -98,7 +94,6 @@ D.py:658:5: D204 [*] 1 blank line required after class docstring | = help: Insert 1 blank line after class docstring -Suggested fix: 656 656 | 657 657 | class CommentAfterDocstring: 658 658 | "After this docstring there's a comment." # priorities=1 diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D205_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D205_D.py.snap index ffd97b59c2e08..3766fb2f17cdd 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D205_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D205_D.py.snap @@ -29,7 +29,6 @@ D.py:210:5: D205 [*] 1 blank line required between summary line and description | = help: Insert single blank line -Suggested fix: 209 209 | def multi_line_two_separating_blanks(): 210 210 | """Summary. 211 211 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D207_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D207_D.py.snap index 873d546cc53d2..d9799972a5f9d 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D207_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D207_D.py.snap @@ -12,7 +12,6 @@ D.py:232:1: D207 [*] Docstring is under-indented | = help: Increase indentation -Suggested fix: 229 229 | def asdfsdf(): 230 230 | """Summary. 231 231 | @@ -33,7 +32,6 @@ D.py:244:1: D207 [*] Docstring is under-indented | = help: Increase indentation -Suggested fix: 241 241 | 242 242 | Description. 243 243 | @@ -55,7 +53,6 @@ D.py:440:1: D207 [*] Docstring is under-indented | = help: Increase indentation -Suggested fix: 437 437 | @expect('D213: Multi-line docstring summary should start at the second line') 438 438 | def docstring_start_in_same_line(): """First Line. 439 439 | @@ -75,7 +72,6 @@ D.py:441:1: D207 [*] Docstring is under-indented | = help: Increase indentation -Suggested fix: 438 438 | def docstring_start_in_same_line(): """First Line. 439 439 | 440 440 | Second Line diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D.py.snap index affeff64014cb..e992984919cdc 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D.py.snap @@ -12,7 +12,6 @@ D.py:252:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 249 249 | def asdfsdsdf24(): 250 250 | """Summary. 251 251 | @@ -33,7 +32,6 @@ D.py:264:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 261 261 | 262 262 | Description. 263 263 | @@ -56,7 +54,6 @@ D.py:272:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 269 269 | def asdfsdfsdsdsdfsdf24(): 270 270 | """Summary. 271 271 | @@ -79,7 +76,6 @@ D.py:673:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 670 670 | def retain_extra_whitespace(): 671 671 | """Summary. 672 672 | @@ -101,7 +97,6 @@ D.py:674:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 671 671 | """Summary. 672 672 | 673 673 | This is overindented @@ -123,7 +118,6 @@ D.py:675:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 672 672 | 673 673 | This is overindented 674 674 | And so is this, but it we should preserve the extra space on this line relative @@ -146,7 +140,6 @@ D.py:682:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 679 679 | def retain_extra_whitespace_multiple(): 680 680 | """Summary. 681 681 | @@ -168,7 +161,6 @@ D.py:683:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 680 680 | """Summary. 681 681 | 682 682 | This is overindented @@ -191,7 +183,6 @@ D.py:684:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 681 681 | 682 682 | This is overindented 683 683 | And so is this, but it we should preserve the extra space on this line relative @@ -214,7 +205,6 @@ D.py:685:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 682 682 | This is overindented 683 683 | And so is this, but it we should preserve the extra space on this line relative 684 684 | to the one before @@ -237,7 +227,6 @@ D.py:686:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 683 683 | And so is this, but it we should preserve the extra space on this line relative 684 684 | to the one before 685 685 | This is also overindented @@ -259,7 +248,6 @@ D.py:687:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 684 684 | to the one before 685 685 | This is also overindented 686 686 | And so is this, but it we should preserve the extra space on this line relative @@ -282,7 +270,6 @@ D.py:695:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 692 692 | def retain_extra_whitespace_deeper(): 693 693 | """Summary. 694 694 | @@ -304,7 +291,6 @@ D.py:696:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 693 693 | """Summary. 694 694 | 695 695 | This is overindented @@ -327,7 +313,6 @@ D.py:697:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 694 694 | 695 695 | This is overindented 696 696 | And so is this, but it we should preserve the extra space on this line relative @@ -349,7 +334,6 @@ D.py:698:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 695 695 | This is overindented 696 696 | And so is this, but it we should preserve the extra space on this line relative 697 697 | to the one before @@ -372,7 +356,6 @@ D.py:704:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 701 701 | def retain_extra_whitespace_followed_by_same_offset(): 702 702 | """Summary. 703 703 | @@ -394,7 +377,6 @@ D.py:705:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 702 702 | """Summary. 703 703 | 704 704 | This is overindented @@ -417,7 +399,6 @@ D.py:706:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 703 703 | 704 704 | This is overindented 705 705 | And so is this, but it we should preserve the extra space on this line relative @@ -439,7 +420,6 @@ D.py:707:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 704 704 | This is overindented 705 705 | And so is this, but it we should preserve the extra space on this line relative 706 706 | This is overindented @@ -461,7 +441,6 @@ D.py:723:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 720 720 | def inconsistent_indent_byte_size(): 721 721 | """There's a non-breaking space (2-bytes) after 3 spaces (https://github.com/astral-sh/ruff/issues/9080). 722 722 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D208.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D208.py.snap index c67210248eaa6..3a837c2f27933 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D208.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D208.py.snap @@ -10,7 +10,6 @@ D208.py:2:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 1 1 | """ 2 |- Author 2 |+Author @@ -31,7 +30,6 @@ D208.py:8:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 5 5 | 6 6 | class Platform: 7 7 | """ Remove sampler @@ -53,7 +51,6 @@ D208.py:9:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 6 6 | class Platform: 7 7 | """ Remove sampler 8 8 | Args: @@ -74,7 +71,6 @@ D208.py:10:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -Suggested fix: 7 7 | """ Remove sampler 8 8 | Args: 9 9 |     Returns: diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D209_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D209_D.py.snap index 51008577bacd2..2f11a35b523a1 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D209_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D209_D.py.snap @@ -13,7 +13,6 @@ D.py:281:5: D209 [*] Multi-line docstring closing quotes should be on a separate | = help: Move closing quotes to new line -Suggested fix: 280 280 | def asdfljdf24(): 281 281 | """Summary. 282 282 | @@ -38,7 +37,6 @@ D.py:588:5: D209 [*] Multi-line docstring closing quotes should be on a separate | = help: Move closing quotes to new line -Suggested fix: 587 587 | def asdfljdjgf24(): 588 588 | """Summary. 589 589 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D210_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D210_D.py.snap index 13deeaca76d22..00edac9188b7e 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D210_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D210_D.py.snap @@ -10,7 +10,6 @@ D.py:288:5: D210 [*] No whitespaces allowed surrounding docstring text | = help: Trim surrounding whitespace -Suggested fix: 285 285 | 286 286 | @expect('D210: No whitespaces allowed surrounding docstring text') 287 287 | def endswith(): @@ -31,7 +30,6 @@ D.py:293:5: D210 [*] No whitespaces allowed surrounding docstring text | = help: Trim surrounding whitespace -Suggested fix: 290 290 | 291 291 | @expect('D210: No whitespaces allowed surrounding docstring text') 292 292 | def around(): @@ -56,7 +54,6 @@ D.py:299:5: D210 [*] No whitespaces allowed surrounding docstring text | = help: Trim surrounding whitespace -Suggested fix: 296 296 | @expect('D210: No whitespaces allowed surrounding docstring text') 297 297 | @expect('D213: Multi-line docstring summary should start at the second line') 298 298 | def multiline(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D211_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D211_D.py.snap index 282cada7287a4..c7ca8ccfc8192 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D211_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D211_D.py.snap @@ -10,7 +10,6 @@ D.py:170:5: D211 [*] No blank lines allowed before class docstring | = help: Remove blank line(s) before class docstring -Suggested fix: 166 166 | 167 167 | 168 168 | class WithLeadingSpace: @@ -31,7 +30,6 @@ D.py:181:5: D211 [*] No blank lines allowed before class docstring | = help: Remove blank line(s) before class docstring -Suggested fix: 177 177 | 178 178 | 179 179 | class TrailingSpace: diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D212_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D212_D.py.snap index 41334443c68c2..11c869c3b1b8f 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D212_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D212_D.py.snap @@ -13,7 +13,6 @@ D.py:129:5: D212 [*] Multi-line docstring summary should start at the first line | = help: Remove whitespace after opening quotes -Suggested fix: 126 126 | '(found 3)') 127 127 | @expect('D212: Multi-line docstring summary should start at the first line') 128 128 | def asdlkfasd(): @@ -38,7 +37,6 @@ D.py:597:5: D212 [*] Multi-line docstring summary should start at the first line | = help: Remove whitespace after opening quotes -Suggested fix: 594 594 | '(found 3)') 595 595 | @expect('D212: Multi-line docstring summary should start at the first line') 596 596 | def one_liner(): @@ -64,7 +62,6 @@ D.py:624:5: D212 [*] Multi-line docstring summary should start at the first line | = help: Remove whitespace after opening quotes -Suggested fix: 621 621 | '(found 3)') 622 622 | @expect('D212: Multi-line docstring summary should start at the first line') 623 623 | def one_liner(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D213_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D213_D.py.snap index bf3b52ff6a109..5ee81adf4db8d 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D213_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D213_D.py.snap @@ -14,7 +14,6 @@ D.py:200:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 197 197 | '(found 0)') 198 198 | @expect('D213: Multi-line docstring summary should start at the second line') 199 199 | def multi_line_zero_separating_blanks(): @@ -42,7 +41,6 @@ D.py:210:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 207 207 | '(found 2)') 208 208 | @expect('D213: Multi-line docstring summary should start at the second line') 209 209 | def multi_line_two_separating_blanks(): @@ -69,7 +67,6 @@ D.py:220:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 217 217 | 218 218 | @expect('D213: Multi-line docstring summary should start at the second line') 219 219 | def multi_line_one_separating_blanks(): @@ -96,7 +93,6 @@ D.py:230:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 227 227 | @expect('D207: Docstring is under-indented') 228 228 | @expect('D213: Multi-line docstring summary should start at the second line') 229 229 | def asdfsdf(): @@ -123,7 +119,6 @@ D.py:240:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 237 237 | @expect('D207: Docstring is under-indented') 238 238 | @expect('D213: Multi-line docstring summary should start at the second line') 239 239 | def asdsdfsdffsdf(): @@ -150,7 +145,6 @@ D.py:250:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 247 247 | @expect('D208: Docstring is over-indented') 248 248 | @expect('D213: Multi-line docstring summary should start at the second line') 249 249 | def asdfsdsdf24(): @@ -177,7 +171,6 @@ D.py:260:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 257 257 | @expect('D208: Docstring is over-indented') 258 258 | @expect('D213: Multi-line docstring summary should start at the second line') 259 259 | def asdfsdsdfsdf24(): @@ -204,7 +197,6 @@ D.py:270:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 267 267 | @expect('D208: Docstring is over-indented') 268 268 | @expect('D213: Multi-line docstring summary should start at the second line') 269 269 | def asdfsdfsdsdsdfsdf24(): @@ -229,7 +221,6 @@ D.py:281:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 278 278 | 'line') 279 279 | @expect('D213: Multi-line docstring summary should start at the second line') 280 280 | def asdfljdf24(): @@ -255,7 +246,6 @@ D.py:299:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 296 296 | @expect('D210: No whitespaces allowed surrounding docstring text') 297 297 | @expect('D213: Multi-line docstring summary should start at the second line') 298 298 | def multiline(): @@ -283,7 +273,6 @@ D.py:343:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 340 340 | 341 341 | @expect('D213: Multi-line docstring summary should start at the second line') 342 342 | def exceptions_of_D301(): @@ -310,7 +299,6 @@ D.py:383:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 380 380 | 381 381 | @expect('D213: Multi-line docstring summary should start at the second line') 382 382 | def new_209(): @@ -337,7 +325,6 @@ D.py:392:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 389 389 | 390 390 | @expect('D213: Multi-line docstring summary should start at the second line') 391 391 | def old_209(): @@ -363,7 +350,6 @@ D.py:438:37: D213 [*] Multi-line docstring summary should start at the second li | = help: Insert line break and indentation after opening quotes -Suggested fix: 435 435 | 436 436 | @expect("D207: Docstring is under-indented") 437 437 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -390,7 +376,6 @@ D.py:450:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 447 447 | 448 448 | @expect('D213: Multi-line docstring summary should start at the second line') 449 449 | def a_following_valid_function(x=None): @@ -421,7 +406,6 @@ D.py:526:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 523 523 | # This is reproducing a bug where AttributeError is raised when parsing class 524 524 | # parameters as functions for Google / Numpy conventions. 525 525 | class Blah: # noqa: D203,D213 @@ -447,7 +431,6 @@ D.py:546:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 543 543 | @expect('D213: Multi-line docstring summary should start at the second line') 544 544 | def multiline_leading_space(): 545 545 | @@ -475,7 +458,6 @@ D.py:555:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 552 552 | @expect('D202: No blank lines allowed after function docstring (found 1)') 553 553 | @expect('D213: Multi-line docstring summary should start at the second line') 554 554 | def multiline_trailing_space(): @@ -503,7 +485,6 @@ D.py:568:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 565 565 | @expect('D213: Multi-line docstring summary should start at the second line') 566 566 | def multiline_trailing_and_leading_space(): 567 567 | @@ -528,7 +509,6 @@ D.py:588:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 585 585 | 'line') 586 586 | @expect('D213: Multi-line docstring summary should start at the second line') 587 587 | def asdfljdjgf24(): @@ -553,7 +533,6 @@ D.py:606:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 603 603 | '(found 3)') 604 604 | @expect('D212: Multi-line docstring summary should start at the first line') 605 605 | def one_liner(): @@ -578,7 +557,6 @@ D.py:615:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 612 612 | '(found 3)') 613 613 | @expect('D212: Multi-line docstring summary should start at the first line') 614 614 | def one_liner(): @@ -605,7 +583,6 @@ D.py:671:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 668 668 | 669 669 | 670 670 | def retain_extra_whitespace(): @@ -635,7 +612,6 @@ D.py:680:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 677 677 | 678 678 | 679 679 | def retain_extra_whitespace_multiple(): @@ -665,7 +641,6 @@ D.py:693:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 690 690 | 691 691 | 692 692 | def retain_extra_whitespace_deeper(): @@ -693,7 +668,6 @@ D.py:702:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 699 699 | """ 700 700 | 701 701 | def retain_extra_whitespace_followed_by_same_offset(): @@ -720,7 +694,6 @@ D.py:712:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 709 709 | 710 710 | 711 711 | def retain_extra_whitespace_not_overindented(): @@ -745,7 +718,6 @@ D.py:721:5: D213 [*] Multi-line docstring summary should start at the second lin | = help: Insert line break and indentation after opening quotes -Suggested fix: 718 718 | 719 719 | 720 720 | def inconsistent_indent_byte_size(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_D214_module.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_D214_module.py.snap index bb5960fc2d15a..a532a728a7f53 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_D214_module.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_D214_module.py.snap @@ -12,7 +12,6 @@ D214_module.py:3:5: D214 [*] Section is over-indented ("Returns") | = help: Remove over-indentation from "Returns" -Suggested fix: 1 1 | """A module docstring with D214 violations 2 2 | 3 |- Returns @@ -34,7 +33,6 @@ D214_module.py:7:5: D214 [*] Section is over-indented ("Args") | = help: Remove over-indentation from "Args" -Suggested fix: 4 4 | ----- 5 5 | valid returns 6 6 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_sections.py.snap index e5a4c231e5370..b8494d3941cf2 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_sections.py.snap @@ -12,7 +12,6 @@ sections.py:146:9: D214 [*] Section is over-indented ("Returns") | = help: Remove over-indentation from "Returns" -Suggested fix: 143 143 | def section_overindented(): # noqa: D416 144 144 | """Toggle the gizmo. 145 145 | @@ -34,7 +33,6 @@ sections.py:563:9: D214 [*] Section is over-indented ("Returns") | = help: Remove over-indentation from "Returns" -Suggested fix: 560 560 | Args: 561 561 | Here's a note. 562 562 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_D215.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_D215.py.snap index 4db3eea4ce59c..906536fcf1268 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_D215.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_D215.py.snap @@ -11,7 +11,6 @@ D215.py:3:5: D215 [*] Section underline is over-indented ("TODO") | = help: Remove over-indentation from "TODO" underline -Suggested fix: 1 1 | """ 2 2 | TODO: 3 |- - diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_sections.py.snap index 9958081b070a3..f2e765ba5d42b 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_sections.py.snap @@ -10,7 +10,6 @@ sections.py:159:9: D215 [*] Section underline is over-indented ("Returns") | = help: Remove over-indentation from "Returns" underline -Suggested fix: 156 156 | """Toggle the gizmo. 157 157 | 158 158 | Returns @@ -31,7 +30,6 @@ sections.py:173:9: D215 [*] Section underline is over-indented ("Returns") | = help: Remove over-indentation from "Returns" underline -Suggested fix: 170 170 | """Toggle the gizmo. 171 171 | 172 172 | Returns diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap index 8f6951b28568f..ab1d24850337f 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap @@ -10,7 +10,6 @@ D.py:307:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -Suggested fix: 304 304 | 305 305 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') 306 306 | def triple_single_quotes_raw(): @@ -31,7 +30,6 @@ D.py:312:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -Suggested fix: 309 309 | 310 310 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') 311 311 | def triple_single_quotes_raw_uppercase(): @@ -52,7 +50,6 @@ D.py:317:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -Suggested fix: 314 314 | 315 315 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') 316 316 | def single_quotes_raw(): @@ -73,7 +70,6 @@ D.py:322:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -Suggested fix: 319 319 | 320 320 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') 321 321 | def single_quotes_raw_uppercase(): @@ -94,7 +90,6 @@ D.py:328:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -Suggested fix: 325 325 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') 326 326 | @expect('D301: Use r""" if any backslashes in a docstring') 327 327 | def single_quotes_raw_uppercase_backslash(): @@ -118,7 +113,6 @@ D.py:645:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -Suggested fix: 642 642 | 643 643 | 644 644 | def single_line_docstring_with_an_escaped_backslash(): @@ -142,7 +136,6 @@ D.py:649:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -Suggested fix: 646 646 | " 647 647 | 648 648 | class StatementOnSameLineAsDocstring: @@ -162,7 +155,6 @@ D.py:654:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -Suggested fix: 651 651 | pass 652 652 | 653 653 | class StatementOnSameLineAsDocstring: @@ -184,7 +176,6 @@ D.py:658:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -Suggested fix: 655 655 | 656 656 | 657 657 | class CommentAfterDocstring: @@ -206,7 +197,6 @@ D.py:664:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -Suggested fix: 661 661 | 662 662 | 663 663 | def newline_after_closing_quote(self): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap index eb0bdbd320c51..b703b2b291b77 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap @@ -17,7 +17,6 @@ D300.py:10:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -Suggested fix: 7 7 | 8 8 | 9 9 | def contains_quote(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.py.snap index b101454b81747..b19cb6282972c 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.py.snap @@ -10,7 +10,6 @@ D.py:333:5: D301 [*] Use `r"""` if any backslashes in a docstring | = help: Add `r` prefix -Suggested fix: 330 330 | 331 331 | @expect('D301: Use r""" if any backslashes in a docstring') 332 332 | def double_quotes_backslash(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D301.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D301.py.snap index 7333e055a6640..436e78a3b7f3e 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D301.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D301.py.snap @@ -9,7 +9,6 @@ D301.py:2:5: D301 [*] Use `r"""` if any backslashes in a docstring | = help: Add `r` prefix -Suggested fix: 1 1 | def double_quotes_backslash(): 2 |- """Sum\\mary.""" 2 |+ r"""Sum\\mary.""" @@ -38,7 +37,6 @@ D301.py:93:5: D301 [*] Use `r"""` if any backslashes in a docstring | = help: Add `r` prefix -Suggested fix: 90 90 | 91 91 | 92 92 | def should_add_raw_for_single_double_quote_escape(): @@ -61,7 +59,6 @@ D301.py:99:5: D301 [*] Use `r"""` if any backslashes in a docstring | = help: Add `r` prefix -Suggested fix: 96 96 | 97 97 | 98 98 | def should_add_raw_for_single_single_quote_escape(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap index 7cab5b122a5d3..123e14e416a7a 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap @@ -10,7 +10,6 @@ D.py:355:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 352 352 | @expect("D415: First line should end with a period, question mark, " 353 353 | "or exclamation point (not 'y')") 354 354 | def lwnlkjl(): @@ -31,7 +30,6 @@ D.py:406:25: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 403 403 | @expect("D400: First line should end with a period (not 'r')") 404 404 | @expect("D415: First line should end with a period, question mark," 405 405 | " or exclamation point (not 'r')") @@ -53,7 +51,6 @@ D.py:410:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 407 407 | 408 408 | 409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 @@ -75,7 +72,6 @@ D.py:416:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 413 413 | 414 414 | 415 415 | def decorator_for_test(func): # noqa: D400,D401,D415 @@ -95,7 +91,6 @@ D.py:422:35: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 419 419 | 420 420 | 421 421 | @ignored_decorator @@ -116,7 +111,6 @@ D.py:429:49: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 426 426 | @expect("D400: First line should end with a period (not 'r')") 427 427 | @expect("D415: First line should end with a period, question mark," 428 428 | " or exclamation point (not 'r')") @@ -138,7 +132,6 @@ D.py:470:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 467 467 | @expect("D415: First line should end with a period, question mark, " 468 468 | "or exclamation point (not 'g')") 469 469 | def docstring_bad(): @@ -159,7 +152,6 @@ D.py:475:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 472 472 | 473 473 | 474 474 | def docstring_bad_ignore_all(): # noqa @@ -180,7 +172,6 @@ D.py:480:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 477 477 | 478 478 | 479 479 | def docstring_bad_ignore_one(): # noqa: D400,D401,D415 @@ -202,7 +193,6 @@ D.py:487:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 484 484 | @expect("D401: First line should be in imperative mood " 485 485 | "(perhaps 'Run', not 'Runs')") 486 486 | def docstring_ignore_some_violations_but_catch_D401(): # noqa: E501,D400,D415 @@ -222,7 +212,6 @@ D.py:514:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 511 511 | 512 512 | 513 513 | def valid_google_string(): # noqa: D400 @@ -243,7 +232,6 @@ D.py:520:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 517 517 | @expect("D415: First line should end with a period, question mark, " 518 518 | "or exclamation point (not 'g')") 519 519 | def bad_google_string(): # noqa: D400 @@ -264,7 +252,6 @@ D.py:581:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 578 578 | @expect("D415: First line should end with a period, question mark, " 579 579 | "or exclamation point (not '\"')") 580 580 | def endswith_quote(): @@ -288,7 +275,6 @@ D.py:615:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 612 612 | '(found 3)') 613 613 | @expect('D212: Multi-line docstring summary should start at the first line') 614 614 | def one_liner(): @@ -309,7 +295,6 @@ D.py:639:17: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 636 636 | """ This is a docstring that starts with a space.""" # noqa: D210 637 637 | 638 638 | @@ -330,7 +315,6 @@ D.py:641:18: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 638 638 | 639 639 | class SameLine: """This is a docstring on the same line""" 640 640 | @@ -352,7 +336,6 @@ D.py:664:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 662 662 | 663 663 | def newline_after_closing_quote(self): 664 664 | "We enforce a newline after the closing quote for a multi-line docstring \ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap index 5ff0896f71448..aae6363caaead 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap @@ -10,7 +10,6 @@ D400.py:2:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 1 1 | def f(): 2 |- "Here's a line without a period" 2 |+ "Here's a line without a period." @@ -29,7 +28,6 @@ D400.py:7:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 4 4 | 5 5 | 6 6 | def f(): @@ -54,7 +52,6 @@ D400.py:12:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 11 11 | def f(): 12 12 | """ 13 13 | Here's a line without a period, @@ -75,7 +72,6 @@ D400.py:20:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 17 17 | 18 18 | 19 19 | def f(): @@ -99,7 +95,6 @@ D400.py:25:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 24 24 | def f(): 25 25 | """ 26 26 | Here's a line without a period, @@ -123,7 +118,6 @@ D400.py:32:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 31 31 | def f(): 32 32 | """ 33 33 | Here's a line without a period, @@ -144,7 +138,6 @@ D400.py:39:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 36 36 | 37 37 | 38 38 | def f(): @@ -165,7 +158,6 @@ D400.py:44:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 41 41 | 42 42 | 43 43 | def f(): @@ -190,7 +182,6 @@ D400.py:49:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 48 48 | def f(): 49 49 | r""" 50 50 | Here's a line without a period, @@ -211,7 +202,6 @@ D400.py:57:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 54 54 | 55 55 | 56 56 | def f(): @@ -235,7 +225,6 @@ D400.py:62:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 61 61 | def f(): 62 62 | r""" 63 63 | Here's a line without a period, @@ -259,7 +248,6 @@ D400.py:69:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 68 68 | def f(): 69 69 | r""" 70 70 | Here's a line without a period, @@ -285,7 +273,6 @@ D400.py:97:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 95 95 | 96 96 | def f(): 97 97 | """ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D403_D403.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D403_D403.py.snap index 34c9897b9f9dc..4eb763e2019ab 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D403_D403.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D403_D403.py.snap @@ -11,7 +11,6 @@ D403.py:2:5: D403 [*] First word of the first line should be capitalized: `this` | = help: Capitalize `this` to `This` -Suggested fix: 1 1 | def bad_function(): 2 |- """this docstring is not capitalized""" 2 |+ """This docstring is not capitalized""" @@ -31,7 +30,6 @@ D403.py:30:5: D403 [*] First word of the first line should be capitalized: `sing | = help: Capitalize `singleword` to `Singleword` -Suggested fix: 27 27 | """th•s is not capitalized.""" 28 28 | 29 29 | def single_word(): @@ -51,7 +49,6 @@ D403.py:33:5: D403 [*] First word of the first line should be capitalized: `sing | = help: Capitalize `singleword` to `Singleword` -Suggested fix: 30 30 | """singleword.""" 31 31 | 32 32 | def single_word_no_dot(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D405_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D405_sections.py.snap index 61e2b39889f5f..97ca13c634eb4 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D405_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D405_sections.py.snap @@ -12,7 +12,6 @@ sections.py:19:5: D405 [*] Section name should be properly capitalized ("returns | = help: Capitalize "returns" -Suggested fix: 16 16 | def not_capitalized(): # noqa: D416 17 17 | """Toggle the gizmo. 18 18 | @@ -34,7 +33,6 @@ sections.py:218:5: D405 [*] Section name should be properly capitalized ("Short | = help: Capitalize "Short summary" -Suggested fix: 215 215 | def multiple_sections(): # noqa: D416 216 216 | """Toggle the gizmo. 217 217 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D406_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D406_sections.py.snap index 5e22d4fe73007..bcd67b4066091 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D406_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D406_sections.py.snap @@ -12,7 +12,6 @@ sections.py:32:5: D406 [*] Section name should end with a newline ("Returns") | = help: Add newline after "Returns" -Suggested fix: 29 29 | def superfluous_suffix(): # noqa: D416 30 30 | """Toggle the gizmo. 31 31 | @@ -34,7 +33,6 @@ sections.py:227:5: D406 [*] Section name should end with a newline ("Raises") | = help: Add newline after "Raises" -Suggested fix: 224 224 | Returns 225 225 | ------ 226 226 | Many many wonderful things. @@ -57,7 +55,6 @@ sections.py:590:5: D406 [*] Section name should end with a newline ("Parameters" | = help: Add newline after "Parameters" -Suggested fix: 587 587 | def test_lowercase_sub_section_header_should_be_valid(parameters: list[str], value: int): # noqa: D213 588 588 | """Test that lower case subsection header is valid even if it has the same name as section kind. 589 589 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D407_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D407_sections.py.snap index 6f6ce5e78a2b9..5364a8efc3abf 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D407_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D407_sections.py.snap @@ -11,7 +11,6 @@ sections.py:44:5: D407 [*] Missing dashed underline after section ("Returns") | = help: Add dashed line under "Returns" -Suggested fix: 42 42 | """Toggle the gizmo. 43 43 | 44 44 | Returns @@ -33,7 +32,6 @@ sections.py:56:5: D407 [*] Missing dashed underline after section ("Returns") | = help: Add dashed line under "Returns" -Suggested fix: 54 54 | """Toggle the gizmo. 55 55 | 56 56 | Returns @@ -53,7 +51,6 @@ sections.py:67:5: D407 [*] Missing dashed underline after section ("Returns") | = help: Add dashed line under "Returns" -Suggested fix: 64 64 | def no_underline_and_no_newline(): # noqa: D416 65 65 | """Toggle the gizmo. 66 66 | @@ -76,7 +73,6 @@ sections.py:227:5: D407 [*] Missing dashed underline after section ("Raises") | = help: Add dashed line under "Raises" -Suggested fix: 225 225 | ------ 226 226 | Many many wonderful things. 227 227 | Raises: @@ -97,7 +93,6 @@ sections.py:263:5: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -Suggested fix: 261 261 | """Toggle the gizmo. 262 262 | 263 263 | Args: @@ -119,7 +114,6 @@ sections.py:266:5: D407 [*] Missing dashed underline after section ("Returns") | = help: Add dashed line under "Returns" -Suggested fix: 264 264 | note: A random string. 265 265 | 266 266 | Returns: @@ -140,7 +134,6 @@ sections.py:268:5: D407 [*] Missing dashed underline after section ("Raises") | = help: Add dashed line under "Raises" -Suggested fix: 266 266 | Returns: 267 267 | 268 268 | Raises: @@ -161,7 +154,6 @@ sections.py:280:5: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -Suggested fix: 278 278 | """Toggle the gizmo. 279 279 | 280 280 | Args @@ -183,7 +175,6 @@ sections.py:297:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -Suggested fix: 295 295 | Will this work when referencing x? 296 296 | 297 297 | Args: @@ -204,7 +195,6 @@ sections.py:312:5: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -Suggested fix: 310 310 | """Toggle the gizmo. 311 311 | 312 312 | Args: @@ -226,7 +216,6 @@ sections.py:324:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -Suggested fix: 322 322 | """Test a valid args section. 323 323 | 324 324 | Args: @@ -247,7 +236,6 @@ sections.py:336:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -Suggested fix: 334 334 | """Test a valid args section. 335 335 | 336 336 | Args: @@ -269,7 +257,6 @@ sections.py:348:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -Suggested fix: 346 346 | """Test a valid args section. 347 347 | 348 348 | Args: @@ -290,7 +277,6 @@ sections.py:361:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -Suggested fix: 359 359 | """Test a valid args section. 360 360 | 361 361 | Args: @@ -311,7 +297,6 @@ sections.py:373:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -Suggested fix: 371 371 | """Test a valid args section. 372 372 | 373 373 | Args: @@ -333,7 +318,6 @@ sections.py:382:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -Suggested fix: 380 380 | """Do stuff. 381 381 | 382 382 | Args: @@ -354,7 +338,6 @@ sections.py:503:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -Suggested fix: 501 501 | Testing this incorrectly indented docstring. 502 502 | 503 503 | Args: @@ -374,7 +357,6 @@ sections.py:522:5: D407 [*] Missing dashed underline after section ("Parameters" | = help: Add dashed line under "Parameters" -Suggested fix: 519 519 | """Equal length equals should be replaced with dashes. 520 520 | 521 521 | Parameters @@ -395,7 +377,6 @@ sections.py:530:5: D407 [*] Missing dashed underline after section ("Parameters" | = help: Add dashed line under "Parameters" -Suggested fix: 527 527 | """Here, the length of equals is not the same. 528 528 | 529 529 | Parameters @@ -417,7 +398,6 @@ sections.py:550:5: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -Suggested fix: 548 548 | """Below, `returns:` should _not_ be considered a section header. 549 549 | 550 550 | Args: @@ -438,7 +418,6 @@ sections.py:560:5: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -Suggested fix: 558 558 | """Below, `Returns:` should be considered a section header. 559 559 | 560 560 | Args: @@ -459,7 +438,6 @@ sections.py:563:9: D407 [*] Missing dashed underline after section ("Returns") | = help: Add dashed line under "Returns" -Suggested fix: 561 561 | Here's a note. 562 562 | 563 563 | Returns: @@ -481,7 +459,6 @@ sections.py:602:4: D407 [*] Missing dashed underline after section ("Parameters" | = help: Add dashed line under "Parameters" -Suggested fix: 600 600 | """Test that lower case subsection header is valid even if it is of a different kind. 601 601 | 602 602 | Parameters diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D408_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D408_sections.py.snap index e3e6037e3e1d0..2fca13d22bcab 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D408_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D408_sections.py.snap @@ -11,7 +11,6 @@ sections.py:98:5: D408 [*] Section underline should be in the line following the | = help: Add underline to "Returns" -Suggested fix: 94 94 | """Toggle the gizmo. 95 95 | 96 96 | Returns diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D409_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D409_sections.py.snap index 7fe772992929d..8fb6cb8f7b5ef 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D409_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D409_sections.py.snap @@ -10,7 +10,6 @@ sections.py:111:5: D409 [*] Section underline should match the length of its nam | = help: Adjust underline length to match "Returns" -Suggested fix: 108 108 | """Toggle the gizmo. 109 109 | 110 110 | Returns @@ -32,7 +31,6 @@ sections.py:225:5: D409 [*] Section underline should match the length of its nam | = help: Adjust underline length to match "Returns" -Suggested fix: 222 222 | returns. 223 223 | 224 224 | Returns @@ -54,7 +52,6 @@ sections.py:578:5: D409 [*] Section underline should match the length of its nam | = help: Adjust underline length to match "Other Parameters" -Suggested fix: 575 575 | A dictionary of string attributes 576 576 | 577 577 | Other Parameters diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_D410.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_D410.py.snap index f1914505ddc36..9d8321c821850 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_D410.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_D410.py.snap @@ -12,7 +12,6 @@ D410.py:4:5: D410 [*] Missing blank line after section ("Parameters") | = help: Add blank line after "Parameters" -Suggested fix: 7 7 | _description_ 8 8 | b : int 9 9 | _description_ @@ -34,7 +33,6 @@ D410.py:21:5: D410 [*] Missing blank line after section ("Parameters") | = help: Add blank line after "Parameters" -Suggested fix: 20 20 | 21 21 | Parameters 22 22 | ---------- diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_sections.py.snap index 4743ab09231f1..23b9ae4d8102a 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_sections.py.snap @@ -12,7 +12,6 @@ sections.py:78:5: D410 [*] Missing blank line after section ("Returns") | = help: Add blank line after "Returns" -Suggested fix: 77 77 | 78 78 | Returns 79 79 | ------- @@ -34,7 +33,6 @@ sections.py:224:5: D410 [*] Missing blank line after section ("Returns") | = help: Add blank line after "Returns" -Suggested fix: 224 224 | Returns 225 225 | ------ 226 226 | Many many wonderful things. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D411_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D411_sections.py.snap index 8371223a2bb06..e27d436d66439 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D411_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D411_sections.py.snap @@ -11,7 +11,6 @@ sections.py:80:5: D411 [*] Missing blank line before section ("Yields") | = help: Add blank line before "Yields" -Suggested fix: 77 77 | 78 78 | Returns 79 79 | ------- @@ -32,7 +31,6 @@ sections.py:134:5: D411 [*] Missing blank line before section ("Returns") | = help: Add blank line before "Returns" -Suggested fix: 131 131 | """Toggle the gizmo. 132 132 | 133 133 | The function's description. @@ -53,7 +51,6 @@ sections.py:227:5: D411 [*] Missing blank line before section ("Raises") | = help: Add blank line before "Raises" -Suggested fix: 224 224 | Returns 225 225 | ------ 226 226 | Many many wonderful things. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sections.py.snap index 45ddeccf61e0b..653f2593387b4 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sections.py.snap @@ -11,7 +11,6 @@ sections.py:218:5: D412 [*] No blank lines allowed between a section header and | = help: Remove blank line(s) -Suggested fix: 217 217 | 218 218 | Short summary 219 219 | ------------- diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sphinx.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sphinx.py.snap index 8d0d05639e3c2..e7a7f35282177 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sphinx.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sphinx.py.snap @@ -10,7 +10,6 @@ sphinx.py:13:5: D412 [*] No blank lines allowed between a section header and its | = help: Remove blank line(s) -Suggested fix: 12 12 | """ 13 13 | Example: 14 14 | @@ -30,7 +29,6 @@ sphinx.py:24:5: D412 [*] No blank lines allowed between a section header and its | = help: Remove blank line(s) -Suggested fix: 23 23 | """ 24 24 | Example: 25 25 | @@ -52,7 +50,6 @@ sphinx.py:47:5: D412 [*] No blank lines allowed between a section header and its | = help: Remove blank line(s) -Suggested fix: 47 47 | Example 48 48 | ------- 49 49 | @@ -73,7 +70,6 @@ sphinx.py:59:5: D412 [*] No blank lines allowed between a section header and its | = help: Remove blank line(s) -Suggested fix: 59 59 | Example 60 60 | ------- 61 61 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap index 96eb74cddffd3..812b6bebec7eb 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap @@ -12,7 +12,6 @@ D413.py:7:1: D413 [*] Missing blank line after last section ("Returns") | = help: Add blank line after "Returns" -Suggested fix: 6 6 | 7 7 | Returns: 8 8 | the value @@ -34,7 +33,6 @@ D413.py:19:5: D413 [*] Missing blank line after last section ("Returns") | = help: Add blank line after "Returns" -Suggested fix: 18 18 | 19 19 | Returns: 20 20 | the value @@ -55,7 +53,6 @@ D413.py:58:5: D413 [*] Missing blank line after last section ("Returns") | = help: Add blank line after "Returns" -Suggested fix: 56 56 | with a hanging indent 57 57 | 58 58 | Returns: @@ -80,7 +77,6 @@ D413.py:69:5: D413 [*] Missing blank line after last section ("Returns") | = help: Add blank line after "Returns" -Suggested fix: 68 68 | 69 69 | Returns: 70 70 | the value diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap index da2d033ba7000..e6939c5f4db69 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap @@ -10,7 +10,6 @@ sections.py:67:5: D413 [*] Missing blank line after last section ("Returns") | = help: Add blank line after "Returns" -Suggested fix: 64 64 | def no_underline_and_no_newline(): # noqa: D416 65 65 | """Toggle the gizmo. 66 66 | @@ -35,7 +34,6 @@ sections.py:122:5: D413 [*] Missing blank line after last section ("Returns") | = help: Add blank line after "Returns" -Suggested fix: 122 122 | Returns 123 123 | ------- 124 124 | A value of some sort. @@ -57,7 +55,6 @@ sections.py:172:5: D413 [*] Missing blank line after last section ("Returns") | = help: Add blank line after "Returns" -Suggested fix: 171 171 | 172 172 | Returns 173 173 | ------- @@ -79,7 +76,6 @@ sections.py:521:5: D413 [*] Missing blank line after last section ("Parameters") | = help: Add blank line after "Parameters" -Suggested fix: 520 520 | 521 521 | Parameters 522 522 | ========== @@ -101,7 +97,6 @@ sections.py:529:5: D413 [*] Missing blank line after last section ("Parameters") | = help: Add blank line after "Parameters" -Suggested fix: 528 528 | 529 529 | Parameters 530 530 | =========== @@ -122,7 +117,6 @@ sections.py:550:5: D413 [*] Missing blank line after last section ("Args") | = help: Add blank line after "Args" -Suggested fix: 551 551 | Here's a note. 552 552 | 553 553 | returns: @@ -143,7 +137,6 @@ sections.py:563:9: D413 [*] Missing blank line after last section ("Returns") | = help: Add blank line after "Returns" -Suggested fix: 561 561 | Here's a note. 562 562 | 563 563 | Returns: @@ -165,7 +158,6 @@ sections.py:590:5: D413 [*] Missing blank line after last section ("Parameters") | = help: Add blank line after "Parameters" -Suggested fix: 593 593 | A list of string parameters 594 594 | value: 595 595 | Some value diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap index 88c2c4e777dbd..3c3628eda59ff 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap @@ -10,7 +10,6 @@ D.py:355:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -Suggested fix: 352 352 | @expect("D415: First line should end with a period, question mark, " 353 353 | "or exclamation point (not 'y')") 354 354 | def lwnlkjl(): @@ -31,7 +30,6 @@ D.py:406:25: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -Suggested fix: 403 403 | @expect("D400: First line should end with a period (not 'r')") 404 404 | @expect("D415: First line should end with a period, question mark," 405 405 | " or exclamation point (not 'r')") @@ -53,7 +51,6 @@ D.py:410:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -Suggested fix: 407 407 | 408 408 | 409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 @@ -75,7 +72,6 @@ D.py:416:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -Suggested fix: 413 413 | 414 414 | 415 415 | def decorator_for_test(func): # noqa: D400,D401,D415 @@ -95,7 +91,6 @@ D.py:422:35: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -Suggested fix: 419 419 | 420 420 | 421 421 | @ignored_decorator @@ -116,7 +111,6 @@ D.py:429:49: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -Suggested fix: 426 426 | @expect("D400: First line should end with a period (not 'r')") 427 427 | @expect("D415: First line should end with a period, question mark," 428 428 | " or exclamation point (not 'r')") @@ -138,7 +132,6 @@ D.py:470:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -Suggested fix: 467 467 | @expect("D415: First line should end with a period, question mark, " 468 468 | "or exclamation point (not 'g')") 469 469 | def docstring_bad(): @@ -159,7 +152,6 @@ D.py:475:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -Suggested fix: 472 472 | 473 473 | 474 474 | def docstring_bad_ignore_all(): # noqa @@ -180,7 +172,6 @@ D.py:480:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -Suggested fix: 477 477 | 478 478 | 479 479 | def docstring_bad_ignore_one(): # noqa: D400,D401,D415 @@ -202,7 +193,6 @@ D.py:487:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -Suggested fix: 484 484 | @expect("D401: First line should be in imperative mood " 485 485 | "(perhaps 'Run', not 'Runs')") 486 486 | def docstring_ignore_some_violations_but_catch_D401(): # noqa: E501,D400,D415 @@ -223,7 +213,6 @@ D.py:520:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -Suggested fix: 517 517 | @expect("D415: First line should end with a period, question mark, " 518 518 | "or exclamation point (not 'g')") 519 519 | def bad_google_string(): # noqa: D400 @@ -244,7 +233,6 @@ D.py:581:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -Suggested fix: 578 578 | @expect("D415: First line should end with a period, question mark, " 579 579 | "or exclamation point (not '\"')") 580 580 | def endswith_quote(): @@ -268,7 +256,6 @@ D.py:615:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -Suggested fix: 612 612 | '(found 3)') 613 613 | @expect('D212: Multi-line docstring summary should start at the first line') 614 614 | def one_liner(): @@ -289,7 +276,6 @@ D.py:639:17: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -Suggested fix: 636 636 | """ This is a docstring that starts with a space.""" # noqa: D210 637 637 | 638 638 | @@ -310,7 +296,6 @@ D.py:641:18: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -Suggested fix: 638 638 | 639 639 | class SameLine: """This is a docstring on the same line""" 640 640 | @@ -332,7 +317,6 @@ D.py:664:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -Suggested fix: 662 662 | 663 663 | def newline_after_closing_quote(self): 664 664 | "We enforce a newline after the closing quote for a multi-line docstring \ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap index 81b0ff61f40ec..d733e6f3ca70c 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap @@ -8,7 +8,6 @@ bom.py:1:1: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -Suggested fix: 1 |-''' SAM macro definitions ''' 1 |+""" SAM macro definitions """ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap index eef6ed5e461ce..138946ad3f758 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap @@ -11,7 +11,6 @@ D209_D400.py:2:5: D209 [*] Multi-line docstring closing quotes should be on a se | = help: Move closing quotes to new line -Suggested fix: 1 1 | def lorem(): 2 2 | """lorem ipsum dolor sit amet consectetur adipiscing elit 3 |- sed do eiusmod tempor incididunt ut labore et dolore magna aliqua""" @@ -30,7 +29,6 @@ D209_D400.py:2:5: D400 [*] First line should end with a period | = help: Add period -Suggested fix: 1 1 | def lorem(): 2 2 | """lorem ipsum dolor sit amet consectetur adipiscing elit 3 |- sed do eiusmod tempor incididunt ut labore et dolore magna aliqua""" diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_0.py.snap index ef08dd13aed84..c6510aaab1b21 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_0.py.snap @@ -11,7 +11,6 @@ F401_0.py:2:8: F401 [*] `functools` imported but unused | = help: Remove unused import: `functools` -Suggested fix: 1 1 | from __future__ import all_feature_names 2 |-import functools, os 2 |+import os @@ -32,7 +31,6 @@ F401_0.py:6:5: F401 [*] `collections.OrderedDict` imported but unused | = help: Remove unused import: `collections.OrderedDict` -Suggested fix: 3 3 | from datetime import datetime 4 4 | from collections import ( 5 5 | Counter, @@ -54,7 +52,6 @@ F401_0.py:12:8: F401 [*] `logging.handlers` imported but unused | = help: Remove unused import: `logging.handlers` -Suggested fix: 9 9 | import multiprocessing.pool 10 10 | import multiprocessing.process 11 11 | import logging.config @@ -74,7 +71,6 @@ F401_0.py:32:12: F401 [*] `shelve` imported but unused | = help: Remove unused import: `shelve` -Suggested fix: 29 29 | from models import Fruit, Nut, Vegetable 30 30 | 31 31 | if TYPE_CHECKING: @@ -96,7 +92,6 @@ F401_0.py:33:12: F401 [*] `importlib` imported but unused | = help: Remove unused import: `importlib` -Suggested fix: 30 30 | 31 31 | if TYPE_CHECKING: 32 32 | import shelve @@ -118,7 +113,6 @@ F401_0.py:37:12: F401 [*] `pathlib` imported but unused | = help: Remove unused import: `pathlib` -Suggested fix: 34 34 | 35 35 | if TYPE_CHECKING: 36 36 | """Hello, world!""" @@ -137,7 +131,6 @@ F401_0.py:52:16: F401 [*] `pickle` imported but unused | = help: Remove unused import: `pickle` -Suggested fix: 49 49 | z = multiprocessing.pool.ThreadPool() 50 50 | 51 51 | def b(self) -> None: @@ -159,7 +152,6 @@ F401_0.py:93:16: F401 [*] `x` imported but unused | = help: Remove unused import: `x` -Suggested fix: 90 90 | # Test: match statements. 91 91 | match *0, 1, *2: 92 92 | case 0,: @@ -179,7 +171,6 @@ F401_0.py:94:16: F401 [*] `y` imported but unused | = help: Remove unused import: `y` -Suggested fix: 91 91 | match *0, 1, *2: 92 92 | case 0,: 93 93 | import x @@ -201,7 +192,6 @@ F401_0.py:99:8: F401 [*] `foo.bar.baz` imported but unused | = help: Remove unused import: `foo.bar.baz` -Suggested fix: 96 96 | 97 97 | # Test: access a sub-importation via an alias. 98 98 | import foo.bar as bop @@ -223,7 +213,6 @@ F401_0.py:105:12: F401 [*] `a1` imported but unused | = help: Remove unused import: `a1` -Suggested fix: 102 102 | 103 103 | # Test: isolated deletions. 104 104 | if TYPE_CHECKING: @@ -243,7 +232,6 @@ F401_0.py:107:12: F401 [*] `a2` imported but unused | = help: Remove unused import: `a2` -Suggested fix: 104 104 | if TYPE_CHECKING: 105 105 | import a1 106 106 | @@ -265,7 +253,6 @@ F401_0.py:112:16: F401 [*] `b1` imported but unused | = help: Remove unused import: `b1` -Suggested fix: 109 109 | 110 110 | match *0, 1, *2: 111 111 | case 0,: @@ -285,7 +272,6 @@ F401_0.py:114:16: F401 [*] `b2` imported but unused | = help: Remove unused import: `b2` -Suggested fix: 111 111 | case 0,: 112 112 | import b1 113 113 | @@ -304,7 +290,6 @@ F401_0.py:122:1: F401 [*] `datameta_client_lib.model_helpers.noqa` imported but | = help: Remove unused import: `datameta_client_lib.model_helpers.noqa` -Suggested fix: 118 118 | from datameta_client_lib.model_utils import ( # noqa: F401 119 119 | noqa ) 120 120 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_11.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_11.py.snap index 74cd36fee92a0..e0bc330d108cc 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_11.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_11.py.snap @@ -9,7 +9,6 @@ F401_11.py:4:27: F401 [*] `pathlib.PurePath` imported but unused | = help: Remove unused import: `pathlib.PurePath` -Suggested fix: 1 1 | """Test: parsing of nested string annotations.""" 2 2 | 3 3 | from typing import List diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_15.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_15.py.snap index 569aa08e02d65..f771102bca0f8 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_15.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_15.py.snap @@ -9,7 +9,6 @@ F401_15.py:5:25: F401 [*] `pathlib.Path` imported but unused | = help: Remove unused import: `pathlib.Path` -Suggested fix: 2 2 | from django.db.models import ForeignKey 3 3 | 4 4 | if TYPE_CHECKING: diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_17.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_17.py.snap index 1b94137781220..ae335b01c5486 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_17.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_17.py.snap @@ -11,7 +11,6 @@ F401_17.py:12:27: F401 [*] `threading.Thread` imported but unused | = help: Remove unused import: `threading.Thread` -Suggested fix: 9 9 | 10 10 | 11 11 | def fn(thread: Thread): @@ -32,7 +31,6 @@ F401_17.py:20:27: F401 [*] `threading.Thread` imported but unused | = help: Remove unused import: `threading.Thread` -Suggested fix: 17 17 | 18 18 | 19 19 | def fn(thread: Thread): diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_18.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_18.py.snap index c8fc75027baeb..da0082b0478c1 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_18.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_18.py.snap @@ -9,7 +9,6 @@ F401_18.py:5:12: F401 [*] `__future__` imported but unused | = help: Remove unused import: `__future__` -Suggested fix: 2 2 | 3 3 | 4 4 | def f(): diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_23.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_23.py.snap index 8724bbed817f3..9c178c5dde53c 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_23.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_23.py.snap @@ -10,7 +10,6 @@ F401_23.py:4:16: F401 [*] `re.RegexFlag` imported but unused | = help: Remove unused import: `re.RegexFlag` -Suggested fix: 1 1 | """Test: ensure that we treat strings in `typing.Annotation` as type definitions.""" 2 2 | 3 3 | from pathlib import Path diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_5.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_5.py.snap index a9248fdea650d..cf583375b8414 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_5.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_5.py.snap @@ -11,7 +11,6 @@ F401_5.py:2:17: F401 [*] `a.b.c` imported but unused | = help: Remove unused import: `a.b.c` -Suggested fix: 1 1 | """Test: removal of multi-segment and aliases imports.""" 2 |-from a.b import c 3 2 | from d.e import f as g @@ -31,7 +30,6 @@ F401_5.py:3:22: F401 [*] `d.e.f` imported but unused | = help: Remove unused import: `d.e.f` -Suggested fix: 1 1 | """Test: removal of multi-segment and aliases imports.""" 2 2 | from a.b import c 3 |-from d.e import f as g @@ -50,7 +48,6 @@ F401_5.py:4:8: F401 [*] `h.i` imported but unused | = help: Remove unused import: `h.i` -Suggested fix: 1 1 | """Test: removal of multi-segment and aliases imports.""" 2 2 | from a.b import c 3 3 | from d.e import f as g @@ -68,7 +65,6 @@ F401_5.py:5:15: F401 [*] `j.k` imported but unused | = help: Remove unused import: `j.k` -Suggested fix: 2 2 | from a.b import c 3 3 | from d.e import f as g 4 4 | import h.i diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_6.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_6.py.snap index b623c432a946a..1e69b44488886 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_6.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_6.py.snap @@ -11,7 +11,6 @@ F401_6.py:7:25: F401 [*] `.background.BackgroundTasks` imported but unused | = help: Remove unused import: `.background.BackgroundTasks` -Suggested fix: 4 4 | from .applications import FastAPI as FastAPI 5 5 | 6 6 | # F401 `background.BackgroundTasks` imported but unused @@ -32,7 +31,6 @@ F401_6.py:10:43: F401 [*] `.datastructures.UploadFile` imported but unused | = help: Remove unused import: `.datastructures.UploadFile` -Suggested fix: 7 7 | from .background import BackgroundTasks 8 8 | 9 9 | # F401 `datastructures.UploadFile` imported but unused @@ -53,7 +51,6 @@ F401_6.py:16:8: F401 [*] `background` imported but unused | = help: Remove unused import: `background` -Suggested fix: 13 13 | import applications as applications 14 14 | 15 15 | # F401 `background` imported but unused @@ -72,7 +69,6 @@ F401_6.py:19:26: F401 [*] `datastructures` imported but unused | = help: Remove unused import: `datastructures` -Suggested fix: 16 16 | import background 17 17 | 18 18 | # F401 `datastructures` imported but unused diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_7.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_7.py.snap index 19238d0e467b5..b0cd94c82ebc6 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_7.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_7.py.snap @@ -11,7 +11,6 @@ F401_7.py:30:5: F401 [*] `typing.Union` imported but unused | = help: Remove unused import: `typing.Union` -Suggested fix: 27 27 | # This should ignore the first error. 28 28 | from typing import ( 29 29 | Mapping, # noqa: F401 @@ -32,7 +31,6 @@ F401_7.py:66:20: F401 [*] `typing.Awaitable` imported but unused | = help: Remove unused import -Suggested fix: 63 63 | from typing import AsyncIterable, AsyncGenerator # noqa 64 64 | 65 65 | # This should mark F501 as unused. @@ -48,7 +46,6 @@ F401_7.py:66:31: F401 [*] `typing.AwaitableGenerator` imported but unused | = help: Remove unused import -Suggested fix: 63 63 | from typing import AsyncIterable, AsyncGenerator # noqa 64 64 | 65 65 | # This should mark F501 as unused. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_9.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_9.py.snap index eb23d63cad473..ef62c7266e12d 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_9.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_9.py.snap @@ -9,7 +9,6 @@ F401_9.py:4:22: F401 [*] `foo.baz` imported but unused | = help: Remove unused import: `foo.baz` -Suggested fix: 1 1 | """Test: late-binding of `__all__`.""" 2 2 | 3 3 | __all__ = ("bar",) diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_24____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_24____init__.py.snap index 9bf626c5a068d..6c70f9b9c98ea 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_24____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_24____init__.py.snap @@ -8,7 +8,6 @@ __init__.py:19:8: F401 [*] `sys` imported but unused | = help: Remove unused import: `sys` -Suggested fix: 16 16 | import argparse as argparse # Ok: is redundant alias 17 17 | 18 18 | @@ -26,7 +25,6 @@ __init__.py:33:15: F401 [*] `.unused` imported but unused; consider removing, ad | = help: Remove unused import: `.unused` -Suggested fix: 30 30 | from . import aliased as aliased # Ok: is redundant alias 31 31 | 32 32 | @@ -44,7 +42,6 @@ __init__.py:36:26: F401 [*] `.renamed` imported but unused; consider removing, a | = help: Remove unused import: `.renamed` -Suggested fix: 33 33 | from . import unused # F401: change to redundant alias 34 34 | 35 35 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_25__all_nonempty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_25__all_nonempty____init__.py.snap index 37017a60dd6b1..fed30706878aa 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_25__all_nonempty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_25__all_nonempty____init__.py.snap @@ -8,7 +8,6 @@ __init__.py:19:8: F401 [*] `sys` imported but unused | = help: Remove unused import: `sys` -Suggested fix: 16 16 | import argparse # Ok: is exported in __all__ 17 17 | 18 18 | @@ -26,7 +25,6 @@ __init__.py:36:15: F401 [*] `.unused` imported but unused; consider removing, ad | = help: Remove unused import: `.unused` -Suggested fix: 33 33 | from . import exported # Ok: is exported in __all__ 34 34 | 35 35 | @@ -44,7 +42,6 @@ __init__.py:39:26: F401 [*] `.renamed` imported but unused; consider removing, a | = help: Remove unused import: `.renamed` -Suggested fix: 36 36 | from . import unused # F401: add to __all__ 37 37 | 38 38 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_26__all_empty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_26__all_empty____init__.py.snap index 4a98e21b26252..bb880dc2b2cc2 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_26__all_empty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_26__all_empty____init__.py.snap @@ -8,7 +8,6 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add | = help: Remove unused import: `.unused` -Suggested fix: 2 2 | """ 3 3 | 4 4 | @@ -26,7 +25,6 @@ __init__.py:8:26: F401 [*] `.renamed` imported but unused; consider removing, ad | = help: Remove unused import: `.renamed` -Suggested fix: 5 5 | from . import unused # F401: add to __all__ 6 6 | 7 7 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_27__all_mistyped____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_27__all_mistyped____init__.py.snap index 6a5c48aa83d98..06c0900b6e310 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_27__all_mistyped____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_27__all_mistyped____init__.py.snap @@ -8,7 +8,6 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add | = help: Remove unused import: `.unused` -Suggested fix: 2 2 | """ 3 3 | 4 4 | @@ -26,7 +25,6 @@ __init__.py:8:26: F401 [*] `.renamed` imported but unused; consider removing, ad | = help: Remove unused import: `.renamed` -Suggested fix: 5 5 | from . import unused # F401: recommend add to all w/o fix 6 6 | 7 7 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_28__all_multiple____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_28__all_multiple____init__.py.snap index d0b11ad06e44e..ac9a2d4e23082 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_28__all_multiple____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_28__all_multiple____init__.py.snap @@ -8,7 +8,6 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add | = help: Remove unused import -Suggested fix: 2 2 | """ 3 3 | 4 4 | @@ -26,7 +25,6 @@ __init__.py:5:34: F401 [*] `.renamed` imported but unused; consider removing, ad | = help: Remove unused import -Suggested fix: 2 2 | """ 3 3 | 4 4 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap index 2d03b8c755293..512b4c8b24156 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap @@ -12,7 +12,6 @@ __init__.py:8:15: F401 [*] `.unused` imported but unused; consider removing, add | = help: Remove unused import -Suggested fix: 5 5 | 6 6 | import sys 7 7 | @@ -35,7 +34,6 @@ __init__.py:8:44: F401 [*] `.renamed` imported but unused; consider removing, ad | = help: Remove unused import -Suggested fix: 5 5 | 6 6 | import sys 7 7 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_30.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_30.py.snap index 7b42b5f341833..bcb61e2b69ee8 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_30.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_30.py.snap @@ -10,8 +10,9 @@ F401_30.py:6:19: F401 [*] `.main.MaμToMan` imported but unused | = help: Remove unused import: `.main.MaμToMan` -ℹ Safe fix 3 3 | even if they have characters in them that undergo NFKC normalization 4 4 | """ 5 5 | 6 |-from .main import MaµToMan + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F504.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F504.py.snap index ed1ab01707841..dacb8234f4358 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F504.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F504.py.snap @@ -12,7 +12,6 @@ F504.py:3:1: F504 [*] `%`-format string has unused named argument(s): b | = help: Remove extra named arguments: b -Suggested fix: 1 1 | # Ruff has no way of knowing if the following are F505s 2 2 | a = "wrong" 3 |-"%(a)s %(c)s" % {a: "?", "b": "!"} # F504 ("b" not used) @@ -33,7 +32,6 @@ F504.py:8:1: F504 [*] `%`-format string has unused named argument(s): b | = help: Remove extra named arguments: b -Suggested fix: 5 5 | hidden = {"a": "!"} 6 6 | "%(a)s %(c)s" % {"x": 1, **hidden} # Ok (cannot see through splat) 7 7 | @@ -55,7 +53,6 @@ F504.py:9:1: F504 [*] `%`-format string has unused named argument(s): b | = help: Remove extra named arguments: b -Suggested fix: 6 6 | "%(a)s %(c)s" % {"x": 1, **hidden} # Ok (cannot see through splat) 7 7 | 8 8 | "%(a)s" % {"a": 1, r"b": "!"} # F504 ("b" not used) @@ -78,7 +75,6 @@ F504.py:11:1: F504 [*] `%`-format string has unused named argument(s): ab | = help: Remove extra named arguments: ab -Suggested fix: 8 8 | "%(a)s" % {"a": 1, r"b": "!"} # F504 ("b" not used) 9 9 | "%(a)s" % {'a': 1, u"b": "!"} # F504 ("b" not used) 10 10 | @@ -100,7 +96,6 @@ F504.py:14:1: F504 [*] `%`-format string has unused named argument(s): test1, te | = help: Remove extra named arguments: test1, test2 -Suggested fix: 12 12 | 13 13 | # https://github.com/astral-sh/ruff/issues/4899 14 14 | "" % { diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F50x.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F50x.py.snap index 60beaf494a76a..665e8b841da36 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F50x.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F50x.py.snap @@ -12,7 +12,6 @@ F50x.py:8:1: F504 [*] `%`-format string has unused named argument(s): baz | = help: Remove extra named arguments: baz -Suggested fix: 5 5 | '%s %s' % (1,) # F507 6 6 | '%s %s' % (1, 2, 3) # F507 7 7 | '%(bar)s' % {} # F505 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F522_F522.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F522_F522.py.snap index d9662ec8288aa..46a2dc467606b 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F522_F522.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F522_F522.py.snap @@ -10,7 +10,6 @@ F522.py:1:1: F522 [*] `.format` call has unused named argument(s): bar | = help: Remove extra named arguments: bar -Suggested fix: 1 |-"{}".format(1, bar=2) # F522 1 |+"{}".format(1, ) # F522 2 2 | "{bar}{}".format(1, bar=2, spam=3) # F522 @@ -29,7 +28,6 @@ F522.py:2:1: F522 [*] `.format` call has unused named argument(s): spam | = help: Remove extra named arguments: spam -Suggested fix: 1 1 | "{}".format(1, bar=2) # F522 2 |-"{bar}{}".format(1, bar=2, spam=3) # F522 2 |+"{bar}{}".format(1, bar=2, ) # F522 @@ -50,7 +48,6 @@ F522.py:4:1: F522 [*] `.format` call has unused named argument(s): eggs, ham | = help: Remove extra named arguments: eggs, ham -Suggested fix: 1 1 | "{}".format(1, bar=2) # F522 2 2 | "{bar}{}".format(1, bar=2, spam=3) # F522 3 3 | "{bar:{spam}}".format(bar=2, spam=3) # No issues @@ -72,7 +69,6 @@ F522.py:5:2: F522 [*] `.format` call has unused named argument(s): x | = help: Remove extra named arguments: x -Suggested fix: 3 3 | "{bar:{spam}}".format(bar=2, spam=3) # No issues 4 4 | "{bar:{spam}}".format(bar=2, spam=3, eggs=4, ham=5) # F522 5 5 | ('' diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F523_F523.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F523_F523.py.snap index 4d7387ce1c4a5..848dfa58e5332 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F523_F523.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F523_F523.py.snap @@ -11,7 +11,6 @@ F523.py:2:1: F523 [*] `.format` call has unused arguments at position(s): 1 | = help: Remove extra positional arguments at position(s): 1 -Suggested fix: 1 1 | # With indexes 2 |-"{0}".format(1, 2) # F523 2 |+"{0}".format(1, ) # F523 @@ -43,7 +42,6 @@ F523.py:5:1: F523 [*] `.format` call has unused arguments at position(s): 2 | = help: Remove extra positional arguments at position(s): 2 -Suggested fix: 2 2 | "{0}".format(1, 2) # F523 3 3 | "{1}".format(1, 2, 3) # F523 4 4 | "{1:{0}}".format(1, 2) # No issues @@ -65,7 +63,6 @@ F523.py:6:1: F523 [*] `.format` call has unused arguments at position(s): 1 | = help: Remove extra positional arguments at position(s): 1 -Suggested fix: 3 3 | "{1}".format(1, 2, 3) # F523 4 4 | "{1:{0}}".format(1, 2) # No issues 5 5 | "{1:{0}}".format(1, 2, 3) # F523 @@ -98,7 +95,6 @@ F523.py:10:1: F523 [*] `.format` call has unused arguments at position(s): 1 | = help: Remove extra positional arguments at position(s): 1 -Suggested fix: 7 7 | "{1.arg[1]!r:0{2['arg']}{1}}".format(1, 2, 3, 4) # F523 8 8 | 9 9 | # With no indexes @@ -121,7 +117,6 @@ F523.py:11:1: F523 [*] `.format` call has unused arguments at position(s): 1, 2 | = help: Remove extra positional arguments at position(s): 1, 2 -Suggested fix: 8 8 | 9 9 | # With no indexes 10 10 | "{}".format(1, 2) # F523 @@ -144,7 +139,6 @@ F523.py:13:1: F523 [*] `.format` call has unused arguments at position(s): 2 | = help: Remove extra positional arguments at position(s): 2 -Suggested fix: 10 10 | "{}".format(1, 2) # F523 11 11 | "{}".format(1, 2, 3) # F523 12 12 | "{:{}}".format(1, 2) # No issues @@ -177,7 +171,6 @@ F523.py:22:1: F523 [*] `.format` call has unused arguments at position(s): 1, 2 | = help: Remove extra positional arguments at position(s): 1, 2 -Suggested fix: 19 19 | "{0}{1}".format(1, 2, 3, *args) # F523 20 20 | 21 21 | # With nested quotes @@ -199,7 +192,6 @@ F523.py:23:1: F523 [*] `.format` call has unused arguments at position(s): 2 | = help: Remove extra positional arguments at position(s): 2 -Suggested fix: 20 20 | 21 21 | # With nested quotes 22 22 | "''1{0}".format(1, 2, 3) # F523 @@ -222,7 +214,6 @@ F523.py:24:1: F523 [*] `.format` call has unused arguments at position(s): 2 | = help: Remove extra positional arguments at position(s): 2 -Suggested fix: 21 21 | # With nested quotes 22 22 | "''1{0}".format(1, 2, 3) # F523 23 23 | "\"\"{1}{0}".format(1, 2, 3) # F523 @@ -275,7 +266,6 @@ F523.py:32:2: F523 [*] `.format` call has unused arguments at position(s): 0 | = help: Remove extra positional arguments at position(s): 0 -Suggested fix: 30 30 | 31 31 | # Multiline 32 32 | ('' diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F541_F541.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F541_F541.py.snap index e93e634b11304..7f88e9c5ed4ea 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F541_F541.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F541_F541.py.snap @@ -11,7 +11,6 @@ F541.py:6:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 3 3 | b = f"ghi{'jkl'}" 4 4 | 5 5 | # Errors @@ -34,7 +33,6 @@ F541.py:7:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 4 4 | 5 5 | # Errors 6 6 | c = f"def" @@ -57,7 +55,6 @@ F541.py:9:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 6 6 | c = f"def" 7 7 | d = f"def" + "ghi" 8 8 | e = ( @@ -80,7 +77,6 @@ F541.py:13:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 10 10 | "ghi" 11 11 | ) 12 12 | f = ( @@ -103,7 +99,6 @@ F541.py:14:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 11 11 | ) 12 12 | f = ( 13 13 | f"a" @@ -126,7 +121,6 @@ F541.py:16:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 13 13 | f"a" 14 14 | F"b" 15 15 | "c" @@ -149,7 +143,6 @@ F541.py:17:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 14 14 | F"b" 15 15 | "c" 16 16 | rf"d" @@ -172,7 +165,6 @@ F541.py:19:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 16 16 | rf"d" 17 17 | fr"e" 18 18 | ) @@ -194,7 +186,6 @@ F541.py:25:13: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 22 22 | g = f"ghi{123:{45}}" 23 23 | 24 24 | # Error @@ -216,7 +207,6 @@ F541.py:34:7: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 31 31 | f"{f'{v:0.2f}'}" 32 32 | 33 33 | # Errors @@ -239,7 +229,6 @@ F541.py:35:4: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 32 32 | 33 33 | # Errors 34 34 | f"{v:{f'0.2f'}}" @@ -262,7 +251,6 @@ F541.py:36:1: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 33 33 | # Errors 34 34 | f"{v:{f'0.2f'}}" 35 35 | f"{f''}" @@ -285,7 +273,6 @@ F541.py:37:1: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 34 34 | f"{v:{f'0.2f'}}" 35 35 | f"{f''}" 36 36 | f"{{test}}" @@ -308,7 +295,6 @@ F541.py:38:1: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 35 35 | f"{f''}" 36 36 | f"{{test}}" 37 37 | f'{{ 40 }}' @@ -331,7 +317,6 @@ F541.py:39:1: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 36 36 | f"{{test}}" 37 37 | f'{{ 40 }}' 38 38 | f"{{a {{x}}" @@ -354,7 +339,6 @@ F541.py:40:3: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 37 37 | f'{{ 40 }}' 38 38 | f"{{a {{x}}" 39 39 | f"{{{{x}}}}" @@ -377,7 +361,6 @@ F541.py:41:3: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 38 38 | f"{{a {{x}}" 39 39 | f"{{{{x}}}}" 40 40 | ""f"" @@ -400,7 +383,6 @@ F541.py:42:4: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 39 39 | f"{{{{x}}}}" 40 40 | ""f"" 41 41 | ''f"" @@ -421,7 +403,6 @@ F541.py:43:7: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 40 40 | ""f"" 41 41 | ''f"" 42 42 | (""f""r"") @@ -440,7 +421,6 @@ F541.py:44:1: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -Suggested fix: 41 41 | ''f"" 42 42 | (""f""r"") 43 43 | f"{v:{f"0.2f"}}" diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap index 4364601a59d14..d267993acb4dc 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap @@ -76,7 +76,6 @@ F601.py:18:5: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -Suggested fix: 15 15 | "a": 1, 16 16 | "a": 2, 17 17 | "a": 3, @@ -120,7 +119,6 @@ F601.py:25:5: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -Suggested fix: 22 22 | "a": 1, 23 23 | "a": 2, 24 24 | "a": 3, @@ -152,7 +150,6 @@ F601.py:31:5: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -Suggested fix: 28 28 | 29 29 | x = { 30 30 | "a": 1, @@ -228,7 +225,6 @@ F601.py:45:5: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -Suggested fix: 42 42 | a: 2, 43 43 | "a": 3, 44 44 | a: 3, @@ -249,7 +245,6 @@ F601.py:49:14: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -Suggested fix: 46 46 | a: 4, 47 47 | } 48 48 | @@ -271,7 +266,6 @@ F601.py:50:22: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -Suggested fix: 47 47 | } 48 48 | 49 49 | x = {"a": 1, "a": 1} @@ -303,7 +297,6 @@ F601.py:58:19: F601 [*] Dictionary key literal `"x"` repeated | = help: Remove repeated key literal `"x"` -Suggested fix: 55 55 | } 56 56 | 57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/4897 @@ -323,7 +316,6 @@ F601.py:60:21: F601 [*] Dictionary key literal `"x"` repeated | = help: Remove repeated key literal `"x"` -Suggested fix: 57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/4897 58 58 | t={"x":"test123", "x":("test123")} 59 59 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap index 15fefe7ed3d69..9a2106b0fbaee 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap @@ -44,7 +44,6 @@ F602.py:13:5: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -Suggested fix: 10 10 | a: 1, 11 11 | a: 2, 12 12 | a: 3, @@ -88,7 +87,6 @@ F602.py:20:5: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -Suggested fix: 17 17 | a: 1, 18 18 | a: 2, 19 19 | a: 3, @@ -120,7 +118,6 @@ F602.py:26:5: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -Suggested fix: 23 23 | 24 24 | x = { 25 25 | a: 1, @@ -174,7 +171,6 @@ F602.py:35:5: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -Suggested fix: 32 32 | x = { 33 33 | a: 1, 34 34 | "a": 1, @@ -227,7 +223,6 @@ F602.py:44:12: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -Suggested fix: 41 41 | a: 4, 42 42 | } 43 43 | @@ -245,7 +240,6 @@ F602.py:45:18: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -Suggested fix: 42 42 | } 43 43 | 44 44 | x = {a: 1, a: 1} diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F632_F632.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F632_F632.py.snap index 17f9bfa08edc2..421b503544d0a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F632_F632.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F632_F632.py.snap @@ -9,7 +9,6 @@ F632.py:1:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 1 |-if x is "abc": 1 |+if x == "abc": 2 2 | pass @@ -28,7 +27,6 @@ F632.py:4:4: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -Suggested fix: 1 1 | if x is "abc": 2 2 | pass 3 3 | @@ -52,7 +50,6 @@ F632.py:7:4: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -Suggested fix: 4 4 | if 123 is not y: 5 5 | pass 6 6 | @@ -75,7 +72,6 @@ F632.py:11:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 8 8 | not y: 9 9 | pass 10 10 | @@ -97,7 +93,6 @@ F632.py:14:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 11 11 | if "123" is x < 3: 12 12 | pass 13 13 | @@ -119,7 +114,6 @@ F632.py:17:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 14 14 | if "123" != x is 3: 15 15 | pass 16 16 | @@ -141,7 +135,6 @@ F632.py:20:14: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -Suggested fix: 17 17 | if ("123" != x) is 3: 18 18 | pass 19 19 | @@ -166,7 +159,6 @@ F632.py:23:2: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -Suggested fix: 20 20 | if "123" != (x is 3): 21 21 | pass 22 22 | @@ -192,7 +184,6 @@ F632.py:26:2: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -Suggested fix: 23 23 | {2 is 24 24 | not ''} 25 25 | @@ -214,7 +205,6 @@ F632.py:30:4: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -Suggested fix: 27 27 | not ''} 28 28 | 29 29 | # Regression test for @@ -235,7 +225,6 @@ F632.py:30:11: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -Suggested fix: 27 27 | not ''} 28 28 | 29 29 | # Regression test for @@ -255,7 +244,6 @@ F632.py:34:12: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -Suggested fix: 31 31 | pass 32 32 | 33 33 | # Regression test for https://github.com/astral-sh/ruff/issues/11736 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap index ecb33301c94de..cbc830b1bb3ed 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap @@ -11,7 +11,6 @@ F811_17.py:6:12: F811 [*] Redefinition of unused `fu` from line 2 | = help: Remove definition: `fu` -Suggested fix: 3 3 | 4 4 | 5 5 | def bar(): diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_21.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_21.py.snap index e90997bfc4fc6..ade687fee660f 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_21.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_21.py.snap @@ -11,7 +11,6 @@ F811_21.py:32:5: F811 [*] Redefinition of unused `Sequence` from line 26 | = help: Remove definition: `Sequence` -Suggested fix: 29 29 | # This should ignore the first error. 30 30 | from typing import ( 31 31 | List, # noqa: F811 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_6.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_6.py.snap index 5e1f027a4b139..3218f772d92bd 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_6.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_6.py.snap @@ -11,7 +11,6 @@ F811_6.py:6:12: F811 [*] Redefinition of unused `os` from line 5 | = help: Remove definition: `os` -Suggested fix: 3 3 | i = 2 4 4 | if i == 1: 5 5 | import os diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_8.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_8.py.snap index b0751f68623c4..2c376a5569ebd 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_8.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_8.py.snap @@ -12,7 +12,6 @@ F811_8.py:5:12: F811 [*] Redefinition of unused `os` from line 4 | = help: Remove definition: `os` -Suggested fix: 2 2 | 3 3 | try: 4 4 | import os diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap index 27df95f7a68c1..910448f67bd5a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap @@ -11,7 +11,6 @@ F841_0.py:3:22: F841 [*] Local variable `e` is assigned to but never used | = help: Remove assignment to unused variable `e` -Suggested fix: 1 1 | try: 2 2 | 1 / 0 3 |-except ValueError as e: @@ -31,7 +30,6 @@ F841_0.py:16:5: F841 [*] Local variable `z` is assigned to but never used | = help: Remove assignment to unused variable `z` -Suggested fix: 13 13 | def f(): 14 14 | x = 1 15 15 | y = 2 @@ -52,7 +50,6 @@ F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used | = help: Remove assignment to unused variable `foo` -Suggested fix: 17 17 | 18 18 | 19 19 | def f(): @@ -74,7 +71,6 @@ F841_0.py:21:6: F841 [*] Local variable `a` is assigned to but never used | = help: Remove assignment to unused variable `a` -Suggested fix: 18 18 | 19 19 | def f(): 20 20 | foo = (1, 2) @@ -97,7 +93,6 @@ F841_0.py:21:9: F841 [*] Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -Suggested fix: 18 18 | 19 19 | def f(): 20 20 | foo = (1, 2) @@ -118,7 +113,6 @@ F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used | = help: Remove assignment to unused variable `baz` -Suggested fix: 23 23 | bar = (1, 2) 24 24 | (c, d) = bar 25 25 | @@ -141,7 +135,6 @@ F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -Suggested fix: 48 48 | 49 49 | def c(): 50 50 | # F841 @@ -162,7 +155,6 @@ F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used | = help: Remove assignment to unused variable `my_file` -Suggested fix: 76 76 | 77 77 | 78 78 | def f(): @@ -185,7 +177,6 @@ F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used | = help: Remove assignment to unused variable `my_file` -Suggested fix: 82 82 | 83 83 | def f(): 84 84 | with ( @@ -208,7 +199,6 @@ F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used | = help: Remove assignment to unused variable `msg3` -Suggested fix: 99 99 | def f(x: int): 100 100 | msg1 = "Hello, world!" 101 101 | msg2 = "Hello, world!" @@ -230,7 +220,6 @@ F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used | = help: Remove assignment to unused variable `Baz` -Suggested fix: 112 112 | 113 113 | Foo = enum.Enum("Foo", "A B") 114 114 | Bar = enum.Enum("Bar", "A B") diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap index f91d7ab3ac756..3305f378e0027 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap @@ -9,7 +9,6 @@ F841_1.py:6:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -Suggested fix: 3 3 | 4 4 | 5 5 | def f(): @@ -29,7 +28,6 @@ F841_1.py:6:8: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -Suggested fix: 3 3 | 4 4 | 5 5 | def f(): @@ -49,7 +47,6 @@ F841_1.py:16:14: F841 [*] Local variable `coords` is assigned to but never used | = help: Remove assignment to unused variable `coords` -Suggested fix: 13 13 | 14 14 | 15 15 | def f(): @@ -69,7 +66,6 @@ F841_1.py:20:5: F841 [*] Local variable `coords` is assigned to but never used | = help: Remove assignment to unused variable `coords` -Suggested fix: 17 17 | 18 18 | 19 19 | def f(): @@ -89,7 +85,6 @@ F841_1.py:24:6: F841 [*] Local variable `a` is assigned to but never used | = help: Remove assignment to unused variable `a` -Suggested fix: 21 21 | 22 22 | 23 23 | def f(): @@ -106,7 +101,6 @@ F841_1.py:24:9: F841 [*] Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -Suggested fix: 21 21 | 22 22 | 23 23 | def f(): @@ -123,7 +117,6 @@ F841_1.py:24:15: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -Suggested fix: 21 21 | 22 22 | 23 23 | def f(): @@ -140,7 +133,6 @@ F841_1.py:24:18: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -Suggested fix: 21 21 | 22 22 | 23 23 | def f(): diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap index 919d4d3b61bf5..7303a4da8772d 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap @@ -10,7 +10,6 @@ F841_3.py:5:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -Suggested fix: 2 2 | 3 3 | 4 4 | def f(): @@ -32,7 +31,6 @@ F841_3.py:6:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -Suggested fix: 3 3 | 4 4 | def f(): 5 5 | x = 1 @@ -52,7 +50,6 @@ F841_3.py:13:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -Suggested fix: 10 10 | 11 11 | 12 12 | def f(): @@ -74,7 +71,6 @@ F841_3.py:14:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -Suggested fix: 11 11 | 12 12 | def f(): 13 13 | x: int = 1 @@ -94,7 +90,6 @@ F841_3.py:21:19: F841 [*] Local variable `x1` is assigned to but never used | = help: Remove assignment to unused variable `x1` -Suggested fix: 18 18 | 19 19 | 20 20 | def f(): @@ -116,7 +111,6 @@ F841_3.py:27:20: F841 [*] Local variable `x3` is assigned to but never used | = help: Remove assignment to unused variable `x3` -Suggested fix: 24 24 | with foo() as (x2, y2): 25 25 | pass 26 26 | @@ -138,7 +132,6 @@ F841_3.py:27:33: F841 [*] Local variable `y3` is assigned to but never used | = help: Remove assignment to unused variable `y3` -Suggested fix: 24 24 | with foo() as (x2, y2): 25 25 | pass 26 26 | @@ -160,7 +153,6 @@ F841_3.py:27:46: F841 [*] Local variable `z3` is assigned to but never used | = help: Remove assignment to unused variable `z3` -Suggested fix: 24 24 | with foo() as (x2, y2): 25 25 | pass 26 26 | @@ -182,7 +174,6 @@ F841_3.py:32:6: F841 [*] Local variable `x1` is assigned to but never used | = help: Remove assignment to unused variable `x1` -Suggested fix: 29 29 | 30 30 | 31 31 | def f(): @@ -204,7 +195,6 @@ F841_3.py:32:10: F841 [*] Local variable `y1` is assigned to but never used | = help: Remove assignment to unused variable `y1` -Suggested fix: 29 29 | 30 30 | 31 31 | def f(): @@ -226,7 +216,6 @@ F841_3.py:33:16: F841 [*] Local variable `coords2` is assigned to but never used | = help: Remove assignment to unused variable `coords2` -Suggested fix: 30 30 | 31 31 | def f(): 32 32 | (x1, y1) = (1, 2) @@ -247,7 +236,6 @@ F841_3.py:34:5: F841 [*] Local variable `coords3` is assigned to but never used | = help: Remove assignment to unused variable `coords3` -Suggested fix: 31 31 | def f(): 32 32 | (x1, y1) = (1, 2) 33 33 | (x2, y2) = coords2 = (1, 2) @@ -269,7 +257,6 @@ F841_3.py:40:26: F841 [*] Local variable `x1` is assigned to but never used | = help: Remove assignment to unused variable `x1` -Suggested fix: 37 37 | def f(): 38 38 | try: 39 39 | 1 / 0 @@ -291,7 +278,6 @@ F841_3.py:45:47: F841 [*] Local variable `x2` is assigned to but never used | = help: Remove assignment to unused variable `x2` -Suggested fix: 42 42 | 43 43 | try: 44 44 | 1 / 0 @@ -313,7 +299,6 @@ F841_3.py:50:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -Suggested fix: 47 47 | 48 48 | 49 49 | def f(a, b): @@ -335,7 +320,6 @@ F841_3.py:56:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -Suggested fix: 53 53 | else b 54 54 | ) 55 55 | @@ -358,7 +342,6 @@ F841_3.py:61:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -Suggested fix: 58 58 | 59 59 | 60 60 | def f(a, b): @@ -383,7 +366,6 @@ F841_3.py:67:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -Suggested fix: 64 64 | else b 65 65 | ) 66 66 | @@ -404,7 +386,6 @@ F841_3.py:72:24: F841 [*] Local variable `cm` is assigned to but never used | = help: Remove assignment to unused variable `cm` -Suggested fix: 69 69 | 70 70 | 71 71 | def f(): @@ -425,7 +406,6 @@ F841_3.py:77:25: F841 [*] Local variable `cm` is assigned to but never used | = help: Remove assignment to unused variable `cm` -Suggested fix: 74 74 | 75 75 | 76 76 | def f(): @@ -446,7 +426,6 @@ F841_3.py:87:26: F841 [*] Local variable `cm` is assigned to but never used | = help: Remove assignment to unused variable `cm` -Suggested fix: 84 84 | 85 85 | 86 86 | def f(): @@ -468,7 +447,6 @@ F841_3.py:92:5: F841 [*] Local variable `toplevel` is assigned to but never used | = help: Remove assignment to unused variable `toplevel` -Suggested fix: 89 89 | 90 90 | 91 91 | def f(): @@ -488,7 +466,6 @@ F841_3.py:98:5: F841 [*] Local variable `toplevel` is assigned to but never used | = help: Remove assignment to unused variable `toplevel` -Suggested fix: 95 95 | 96 96 | 97 97 | def f(): @@ -508,7 +485,6 @@ F841_3.py:98:16: F841 [*] Local variable `tt` is assigned to but never used | = help: Remove assignment to unused variable `tt` -Suggested fix: 95 95 | 96 96 | 97 97 | def f(): @@ -528,7 +504,6 @@ F841_3.py:102:5: F841 [*] Local variable `toplevel` is assigned to but never use | = help: Remove assignment to unused variable `toplevel` -Suggested fix: 99 99 | 100 100 | 101 101 | def f(): @@ -548,7 +523,6 @@ F841_3.py:106:14: F841 [*] Local variable `toplevel` is assigned to but never us | = help: Remove assignment to unused variable `toplevel` -Suggested fix: 103 103 | 104 104 | 105 105 | def f(): @@ -568,7 +542,6 @@ F841_3.py:110:5: F841 [*] Local variable `toplevel` is assigned to but never use | = help: Remove assignment to unused variable `toplevel` -Suggested fix: 107 107 | 108 108 | 109 109 | def f(): @@ -588,7 +561,6 @@ F841_3.py:110:16: F841 [*] Local variable `tt` is assigned to but never used | = help: Remove assignment to unused variable `tt` -Suggested fix: 107 107 | 108 108 | 109 109 | def f(): @@ -670,7 +642,6 @@ F841_3.py:155:17: F841 [*] Local variable `e` is assigned to but never used | = help: Remove assignment to unused variable `e` -Suggested fix: 152 152 | def f() -> None: 153 153 | try: 154 154 | print("hello") @@ -691,7 +662,6 @@ F841_3.py:160:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -Suggested fix: 157 157 | 158 158 | 159 159 | def f(): @@ -711,7 +681,6 @@ F841_3.py:161:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -Suggested fix: 158 158 | 159 159 | def f(): 160 160 | x = 1 @@ -732,7 +701,6 @@ F841_3.py:165:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -Suggested fix: 162 162 | 163 163 | 164 164 | def f(): @@ -752,7 +720,6 @@ F841_3.py:167:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -Suggested fix: 164 164 | def f(): 165 165 | x = 1 166 166 | @@ -772,7 +739,6 @@ F841_3.py:173:6: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -Suggested fix: 170 170 | def f(): 171 171 | (x) = foo() 172 172 | ((x)) = foo() diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_4.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_4.py.snap index 575541f4ffd71..6b5fec942c19b 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_4.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_4.py.snap @@ -10,7 +10,6 @@ F841_4.py:12:5: F841 [*] Local variable `a` is assigned to but never used | = help: Remove assignment to unused variable `a` -Suggested fix: 9 9 | 10 10 | 11 11 | def bar(): diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F901_F901.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F901_F901.py.snap index 607ba00e08df9..2026e1a322650 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F901_F901.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F901_F901.py.snap @@ -9,7 +9,6 @@ F901.py:2:11: F901 [*] `raise NotImplemented` should be `raise NotImplementedErr | = help: Use `raise NotImplementedError` -Suggested fix: 1 1 | def f() -> None: 2 |- raise NotImplemented() 2 |+ raise NotImplementedError() @@ -27,7 +26,6 @@ F901.py:6:11: F901 [*] `raise NotImplemented` should be `raise NotImplementedErr | = help: Use `raise NotImplementedError` -Suggested fix: 3 3 | 4 4 | 5 5 | def g() -> None: @@ -48,7 +46,6 @@ F901.py:11:11: F901 [*] `raise NotImplemented` should be `raise NotImplementedEr | = help: Use `raise NotImplementedError` -Suggested fix: 1 |+import builtins 1 2 | def f() -> None: 2 3 | raise NotImplemented() diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_global_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_global_scope.snap index 997efecd66b90..b510b9c7fe79c 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_global_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_global_scope.snap @@ -11,7 +11,6 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove unused import: `os` -Suggested fix: 2 2 | import os 3 3 | 4 4 | def f(): diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_local_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_local_scope.snap index 247ccf8a73331..879b30449c37e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_local_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_local_scope.snap @@ -10,7 +10,6 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove unused import: `os` -Suggested fix: 1 1 | 2 |-import os 3 2 | @@ -29,7 +28,6 @@ Suggested fix: | = help: Remove definition: `os` -Suggested fix: 2 2 | import os 3 3 | 4 4 | def f(): diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_import_shadow_in_local_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_import_shadow_in_local_scope.snap index c0aeb30762798..13aa14ffca58e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_import_shadow_in_local_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_import_shadow_in_local_scope.snap @@ -10,7 +10,6 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove unused import: `os` -Suggested fix: 1 1 | 2 |-import os 3 2 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap index 3c0bca8f776a9..03472bf20eee3 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap @@ -12,7 +12,6 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove definition: `os` -Suggested fix: 1 1 | 2 2 | def f(): 3 3 | import os diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f401_preview_first_party_submodule_dunder_all.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f401_preview_first_party_submodule_dunder_all.snap index 0d7b4c45059e9..d4b19d5a5ce3f 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f401_preview_first_party_submodule_dunder_all.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f401_preview_first_party_submodule_dunder_all.snap @@ -10,9 +10,10 @@ __init__.py:2:8: F401 [*] `submodule.a` imported but unused; consider removing, | = help: Add `submodule` to __all__ -ℹ Safe fix 1 1 | 2 2 | import submodule.a 3 |-__all__ = ['FOO'] 3 |+__all__ = ['FOO', 'submodule'] 4 4 | FOO = 42 + + Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap index aebcff605cd7e..a43e9903f68ee 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap @@ -11,7 +11,6 @@ F841_0.py:3:22: F841 [*] Local variable `e` is assigned to but never used | = help: Remove assignment to unused variable `e` -Suggested fix: 1 1 | try: 2 2 | 1 / 0 3 |-except ValueError as e: @@ -31,7 +30,6 @@ F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used | = help: Remove assignment to unused variable `foo` -Suggested fix: 17 17 | 18 18 | 19 19 | def f(): @@ -73,7 +71,6 @@ F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used | = help: Remove assignment to unused variable `baz` -Suggested fix: 23 23 | bar = (1, 2) 24 24 | (c, d) = bar 25 25 | @@ -95,7 +92,6 @@ F841_0.py:35:5: F841 [*] Local variable `_` is assigned to but never used | = help: Remove assignment to unused variable `_` -Suggested fix: 32 32 | 33 33 | 34 34 | def f(): @@ -116,7 +112,6 @@ F841_0.py:36:5: F841 [*] Local variable `__` is assigned to but never used | = help: Remove assignment to unused variable `__` -Suggested fix: 33 33 | 34 34 | def f(): 35 35 | _ = 1 @@ -136,7 +131,6 @@ F841_0.py:37:5: F841 [*] Local variable `_discarded` is assigned to but never us | = help: Remove assignment to unused variable `_discarded` -Suggested fix: 34 34 | def f(): 35 35 | _ = 1 36 36 | __ = 1 @@ -158,7 +152,6 @@ F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -Suggested fix: 48 48 | 49 49 | def c(): 50 50 | # F841 @@ -179,7 +172,6 @@ F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used | = help: Remove assignment to unused variable `my_file` -Suggested fix: 76 76 | 77 77 | 78 78 | def f(): @@ -202,7 +194,6 @@ F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used | = help: Remove assignment to unused variable `my_file` -Suggested fix: 82 82 | 83 83 | def f(): 84 84 | with ( @@ -225,7 +216,6 @@ F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used | = help: Remove assignment to unused variable `msg3` -Suggested fix: 99 99 | def f(x: int): 100 100 | msg1 = "Hello, world!" 101 101 | msg2 = "Hello, world!" @@ -247,7 +237,6 @@ F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used | = help: Remove assignment to unused variable `Baz` -Suggested fix: 112 112 | 113 113 | Foo = enum.Enum("Foo", "A B") 114 114 | Bar = enum.Enum("Bar", "A B") @@ -288,7 +277,6 @@ F841_0.py:152:25: F841 [*] Local variable `_` is assigned to but never used | = help: Remove assignment to unused variable `_` -Suggested fix: 149 149 | def f(): 150 150 | try: 151 151 | pass diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__future_annotations.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__future_annotations.snap index dfc692d780557..3e72b6eecf3b7 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__future_annotations.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__future_annotations.snap @@ -11,7 +11,6 @@ future_annotations.py:8:5: F401 [*] `models.Nut` imported but unused | = help: Remove unused import: `models.Nut` -Suggested fix: 5 5 | 6 6 | from models import ( 7 7 | Fruit, diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_multiple_unbinds_from_module_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_multiple_unbinds_from_module_scope.snap index 1fad839e9da69..6ea60e08f1bc2 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_multiple_unbinds_from_module_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_multiple_unbinds_from_module_scope.snap @@ -11,7 +11,6 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -Suggested fix: 4 4 | def f(): 5 5 | try: 6 6 | pass @@ -33,7 +32,6 @@ Suggested fix: | = help: Remove assignment to unused variable `x` -Suggested fix: 9 9 | 10 10 | try: 11 11 | pass diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_class_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_class_scope.snap index ca50e1cba3fbb..61faa64ea794a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_class_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_class_scope.snap @@ -11,7 +11,6 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -Suggested fix: 5 5 | def f(): 6 6 | try: 7 7 | pass diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_module_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_module_scope.snap index 95ccc929b258b..93373ffece0e9 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_module_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_module_scope.snap @@ -11,7 +11,6 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -Suggested fix: 4 4 | def f(): 5 5 | try: 6 6 | pass diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_nested_module_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_nested_module_scope.snap index f38b9262d3366..72f45fa5fd981 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_nested_module_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_nested_module_scope.snap @@ -11,7 +11,6 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -Suggested fix: 4 4 | def f(): 5 5 | try: 6 6 | pass @@ -33,7 +32,6 @@ Suggested fix: | = help: Remove assignment to unused variable `x` -Suggested fix: 10 10 | def g(): 11 11 | try: 12 12 | pass diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__multi_statement_lines.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__multi_statement_lines.snap index 01fd17ba548ba..a332c14d47de5 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__multi_statement_lines.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__multi_statement_lines.snap @@ -10,7 +10,6 @@ multi_statement_lines.py:2:12: F401 [*] `foo1` imported but unused | = help: Remove unused import: `foo1` -Suggested fix: 1 1 | if True: 2 |- import foo1; x = 1 2 |+ x = 1 @@ -31,7 +30,6 @@ multi_statement_lines.py:3:12: F401 [*] `foo2` imported but unused | = help: Remove unused import: `foo2` -Suggested fix: 1 1 | if True: 2 2 | import foo1; x = 1 3 |- import foo2; x = 1 @@ -51,7 +49,6 @@ multi_statement_lines.py:6:12: F401 [*] `foo3` imported but unused | = help: Remove unused import: `foo3` -Suggested fix: 3 3 | import foo2; x = 1 4 4 | 5 5 | if True: @@ -73,7 +70,6 @@ multi_statement_lines.py:10:12: F401 [*] `foo4` imported but unused | = help: Remove unused import: `foo4` -Suggested fix: 7 7 | x = 1 8 8 | 9 9 | if True: @@ -94,7 +90,6 @@ multi_statement_lines.py:14:19: F401 [*] `foo5` imported but unused | = help: Remove unused import: `foo5` -Suggested fix: 11 11 | ; x = 1 12 12 | 13 13 | if True: @@ -117,7 +112,6 @@ multi_statement_lines.py:19:17: F401 [*] `foo6` imported but unused | = help: Remove unused import: `foo6` -Suggested fix: 15 15 | 16 16 | 17 17 | if True: @@ -141,7 +135,6 @@ multi_statement_lines.py:23:18: F401 [*] `foo7` imported but unused | = help: Remove unused import: `foo7` -Suggested fix: 20 20 | 21 21 | if True: 22 22 | x = 1 \ @@ -162,7 +155,6 @@ multi_statement_lines.py:26:19: F401 [*] `foo8` imported but unused | = help: Remove unused import: `foo8` -Suggested fix: 23 23 | ; import foo7 24 24 | 25 25 | if True: @@ -185,7 +177,6 @@ multi_statement_lines.py:27:23: F401 [*] `foo9` imported but unused | = help: Remove unused import: `foo9` -Suggested fix: 24 24 | 25 25 | if True: 26 26 | x = 1; import foo8; x = 1 @@ -207,7 +198,6 @@ multi_statement_lines.py:31:16: F401 [*] `foo10` imported but unused | = help: Remove unused import: `foo10` -Suggested fix: 28 28 | 29 29 | if True: 30 30 | x = 1; \ @@ -230,7 +220,6 @@ multi_statement_lines.py:36:17: F401 [*] `foo11` imported but unused | = help: Remove unused import: `foo11` -Suggested fix: 33 33 | 34 34 | if True: 35 35 | x = 1 \ @@ -252,7 +241,6 @@ multi_statement_lines.py:42:16: F401 [*] `foo12` imported but unused | = help: Remove unused import: `foo12` -Suggested fix: 37 37 | ;x = 1 38 38 | 39 39 | if True: @@ -275,7 +263,6 @@ multi_statement_lines.py:47:12: F401 [*] `foo13` imported but unused | = help: Remove unused import: `foo13` -Suggested fix: 42 42 | import foo12 43 43 | 44 44 | if True: @@ -300,7 +287,6 @@ multi_statement_lines.py:53:12: F401 [*] `foo14` imported but unused | = help: Remove unused import: `foo14` -Suggested fix: 50 50 | if True: 51 51 | x = 1; \ 52 52 | # \ @@ -322,7 +308,6 @@ multi_statement_lines.py:57:8: F401 [*] `foo15` imported but unused | = help: Remove unused import: `foo15` -Suggested fix: 53 53 | import foo14 54 54 | 55 55 | # Continuation, but not as the last content in the file. @@ -344,7 +329,6 @@ multi_statement_lines.py:62:8: F401 [*] `foo16` imported but unused | = help: Remove unused import: `foo16` -Suggested fix: 58 58 | 59 59 | # Continuation, followed by end-of-file. (Removing `import foo` would cause a syntax 60 60 | # error.) diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap index 6114e9113259e..7fd26d08d0014 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap @@ -8,7 +8,6 @@ __init__.py:19:8: F401 [*] `sys` imported but unused | = help: Remove unused import: `sys` -Suggested fix: 16 16 | import argparse as argparse # Ok: is redundant alias 17 17 | 18 18 | @@ -26,7 +25,6 @@ __init__.py:33:15: F401 [*] `.unused` imported but unused; consider removing, ad | = help: Use an explicit re-export: `unused as unused` -Suggested fix: 30 30 | from . import aliased as aliased # Ok: is redundant alias 31 31 | 32 32 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap index 24bf30beac4f4..fe6739b2b8ab1 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap @@ -8,7 +8,6 @@ __init__.py:19:8: F401 [*] `sys` imported but unused | = help: Remove unused import: `sys` -Suggested fix: 16 16 | import argparse # Ok: is exported in __all__ 17 17 | 18 18 | @@ -26,7 +25,6 @@ __init__.py:36:15: F401 [*] `.unused` imported but unused; consider removing, ad | = help: Add unused import `unused` to __all__ -Suggested fix: 39 39 | from . import renamed as bees # F401: add to __all__ 40 40 | 41 41 | @@ -42,7 +40,6 @@ __init__.py:39:26: F401 [*] `.renamed` imported but unused; consider removing, a | = help: Add unused import `bees` to __all__ -Suggested fix: 39 39 | from . import renamed as bees # F401: add to __all__ 40 40 | 41 41 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_26__all_empty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_26__all_empty____init__.py.snap index 5418d94b1907f..71bbd5bef05d8 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_26__all_empty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_26__all_empty____init__.py.snap @@ -8,7 +8,6 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add | = help: Add unused import `unused` to __all__ -Suggested fix: 8 8 | from . import renamed as bees # F401: add to __all__ 9 9 | 10 10 | @@ -24,7 +23,6 @@ __init__.py:8:26: F401 [*] `.renamed` imported but unused; consider removing, ad | = help: Add unused import `bees` to __all__ -Suggested fix: 8 8 | from . import renamed as bees # F401: add to __all__ 9 9 | 10 10 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_28__all_multiple____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_28__all_multiple____init__.py.snap index f05ec9469c125..6aeed928cca8a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_28__all_multiple____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_28__all_multiple____init__.py.snap @@ -8,7 +8,6 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add | = help: Add unused import `unused` to __all__ -Suggested fix: 5 5 | from . import unused, renamed as bees # F401: add to __all__ 6 6 | 7 7 | @@ -24,7 +23,6 @@ __init__.py:5:34: F401 [*] `.renamed` imported but unused; consider removing, ad | = help: Add unused import `bees` to __all__ -Suggested fix: 5 5 | from . import unused, renamed as bees # F401: add to __all__ 6 6 | 7 7 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap index 52f8bc5dd1ba8..e681c520ee19e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap @@ -10,7 +10,6 @@ __init__.py:1:8: F401 [*] `os` imported but unused | = help: Remove unused import: `os` -Suggested fix: 1 |-import os 2 1 | 3 2 | print(__path__) diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F841_F841_4.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F841_F841_4.py.snap index e218cfda8bcbc..3721c0f11197a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F841_F841_4.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F841_F841_4.py.snap @@ -10,7 +10,6 @@ F841_4.py:12:5: F841 [*] Local variable `a` is assigned to but never used | = help: Remove assignment to unused variable `a` -Suggested fix: 9 9 | 10 10 | 11 11 | def bar(): @@ -31,7 +30,6 @@ F841_4.py:13:5: F841 [*] Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -Suggested fix: 10 10 | 11 11 | def bar(): 12 12 | a = foo() @@ -52,7 +50,6 @@ F841_4.py:13:8: F841 [*] Local variable `c` is assigned to but never used | = help: Remove assignment to unused variable `c` -Suggested fix: 10 10 | 11 11 | def bar(): 12 12 | a = foo() diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_double_shadowing_except.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_double_shadowing_except.snap index 46f6aad63755b..c9ce15855414c 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_double_shadowing_except.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_double_shadowing_except.snap @@ -12,7 +12,6 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -Suggested fix: 4 4 | 5 5 | try: 6 6 | 1 / 0 @@ -34,7 +33,6 @@ Suggested fix: | = help: Remove assignment to unused variable `x` -Suggested fix: 6 6 | 1 / 0 7 7 | except ValueError as x: 8 8 | pass diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_shadowing_except.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_shadowing_except.snap index 301f56b4431c6..12208560a0bec 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_shadowing_except.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_shadowing_except.snap @@ -11,7 +11,6 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -Suggested fix: 4 4 | 5 5 | try: 6 6 | 1 / 0 diff --git a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap index 16f4decf9e714..dbc0738a24f3c 100644 --- a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap +++ b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap @@ -39,7 +39,6 @@ PGH004_0.py:18:8: PGH004 [*] Use a colon when specifying `noqa` rule codes | = help: Add missing colon -Suggested fix: 15 15 | x = 2 # noqa:X100 16 16 | 17 17 | # PGH004 @@ -61,7 +60,6 @@ PGH004_0.py:21:8: PGH004 [*] Use a colon when specifying `noqa` rule codes | = help: Add missing colon -Suggested fix: 18 18 | x = 2 # noqa X100 19 19 | 20 20 | # PGH004 @@ -83,7 +81,6 @@ PGH004_0.py:24:8: PGH004 [*] Do not add spaces between `noqa` and its colon | = help: Remove space(s) before colon -Suggested fix: 21 21 | x = 2 # noqa X100, X200 22 22 | 23 23 | # PGH004 @@ -105,7 +102,6 @@ PGH004_0.py:27:8: PGH004 [*] Do not add spaces between `noqa` and its colon | = help: Remove space(s) before colon -Suggested fix: 24 24 | x = 2 # noqa : X300 25 25 | 26 26 | # PGH004 @@ -125,7 +121,6 @@ PGH004_0.py:30:8: PGH004 [*] Do not add spaces between `noqa` and its colon | = help: Remove space(s) before colon -Suggested fix: 27 27 | x = 2 # noqa : X400 28 28 | 29 29 | # PGH004 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0208_iteration_over_set.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0208_iteration_over_set.py.snap index c821d7dce0f4c..2aa0a21f067fe 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0208_iteration_over_set.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0208_iteration_over_set.py.snap @@ -11,7 +11,6 @@ iteration_over_set.py:3:13: PLC0208 [*] Use a sequence type instead of a `set` w | = help: Convert to `tuple` -Suggested fix: 1 1 | # Errors 2 2 | 3 |-for item in {1}: @@ -32,7 +31,6 @@ iteration_over_set.py:6:13: PLC0208 [*] Use a sequence type instead of a `set` w | = help: Convert to `tuple` -Suggested fix: 3 3 | for item in {1}: 4 4 | print(f"I can count to {item}!") 5 5 | @@ -54,7 +52,6 @@ iteration_over_set.py:9:13: PLC0208 [*] Use a sequence type instead of a `set` w | = help: Convert to `tuple` -Suggested fix: 6 6 | for item in {"apples", "lemons", "water"}: # flags in-line set literals 7 7 | print(f"I like {item}.") 8 8 | @@ -79,7 +76,6 @@ iteration_over_set.py:12:13: PLC0208 [*] Use a sequence type instead of a `set` | = help: Convert to `tuple` -Suggested fix: 9 9 | for item in {1,}: 10 10 | print(f"I can count to {item}!") 11 11 | @@ -105,7 +101,6 @@ iteration_over_set.py:17:28: PLC0208 [*] Use a sequence type instead of a `set` | = help: Convert to `tuple` -Suggested fix: 14 14 | }: # flags in-line set literals 15 15 | print(f"I like {item}.") 16 16 | @@ -128,7 +123,6 @@ iteration_over_set.py:19:27: PLC0208 [*] Use a sequence type instead of a `set` | = help: Convert to `tuple` -Suggested fix: 16 16 | 17 17 | numbers_list = [i for i in {1, 2, 3}] # flags sets in list comprehensions 18 18 | @@ -151,7 +145,6 @@ iteration_over_set.py:21:36: PLC0208 [*] Use a sequence type instead of a `set` | = help: Convert to `tuple` -Suggested fix: 18 18 | 19 19 | numbers_set = {i for i in {1, 2, 3}} # flags sets in set comprehensions 20 20 | @@ -174,7 +167,6 @@ iteration_over_set.py:23:27: PLC0208 [*] Use a sequence type instead of a `set` | = help: Convert to `tuple` -Suggested fix: 20 20 | 21 21 | numbers_dict = {str(i): i for i in {1, 2, 3}} # flags sets in dict comprehensions 22 22 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap index b67a3ed633433..f6a51062ea01e 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap @@ -12,7 +12,6 @@ import_aliasing.py:6:8: PLC0414 [*] Import alias does not rename original packag | = help: Remove import alias -Suggested fix: 3 3 | # 1. useless-import-alias 4 4 | # 2. consider-using-from-import 5 5 | @@ -34,7 +33,6 @@ import_aliasing.py:7:25: PLC0414 [*] Import alias does not rename original packa | = help: Remove import alias -Suggested fix: 4 4 | # 2. consider-using-from-import 5 5 | 6 6 | import collections as collections # [useless-import-alias] @@ -57,7 +55,6 @@ import_aliasing.py:16:15: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -Suggested fix: 13 13 | import os 14 14 | import os as OS 15 15 | from sys import version @@ -80,7 +77,6 @@ import_aliasing.py:19:19: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -Suggested fix: 16 16 | from . import bar as bar # [useless-import-alias] 17 17 | from . import bar as Bar 18 18 | from . import bar @@ -103,7 +99,6 @@ import_aliasing.py:20:23: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -Suggested fix: 17 17 | from . import bar as Bar 18 18 | from . import bar 19 19 | from ..foo import bar as bar # [useless-import-alias] @@ -126,7 +121,6 @@ import_aliasing.py:22:15: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -Suggested fix: 19 19 | from ..foo import bar as bar # [useless-import-alias] 20 20 | from ..foo.bar import foobar as foobar # [useless-import-alias] 21 21 | from ..foo.bar import foobar as anotherfoobar @@ -149,7 +143,6 @@ import_aliasing.py:23:27: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -Suggested fix: 20 20 | from ..foo.bar import foobar as foobar # [useless-import-alias] 21 21 | from ..foo.bar import foobar as anotherfoobar 22 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] @@ -172,7 +165,6 @@ import_aliasing.py:25:21: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -Suggested fix: 22 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] 23 23 | from . import foo as bar, foo2 as foo2 # [useless-import-alias] 24 24 | from . import foo as bar, foo2 as bar2 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap index f88002221efb7..d3cefc880aa37 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap @@ -11,7 +11,6 @@ unnecessary_dunder_call.py:4:7: PLC2801 [*] Unnecessary dunder call to `__add__` | = help: Use `+` operator -Suggested fix: 1 1 | from typing import Any 2 2 | 3 3 | a = 2 @@ -34,7 +33,6 @@ unnecessary_dunder_call.py:5:7: PLC2801 [*] Unnecessary dunder call to `__sub__` | = help: Use `-` operator -Suggested fix: 2 2 | 3 3 | a = 2 4 4 | print((3.0).__add__(4.0)) # PLC2801 @@ -57,7 +55,6 @@ unnecessary_dunder_call.py:6:7: PLC2801 [*] Unnecessary dunder call to `__mul__` | = help: Use `*` operator -Suggested fix: 3 3 | a = 2 4 4 | print((3.0).__add__(4.0)) # PLC2801 5 5 | print((3.0).__sub__(4.0)) # PLC2801 @@ -80,7 +77,6 @@ unnecessary_dunder_call.py:7:7: PLC2801 [*] Unnecessary dunder call to `__truedi | = help: Use `/` operator -Suggested fix: 4 4 | print((3.0).__add__(4.0)) # PLC2801 5 5 | print((3.0).__sub__(4.0)) # PLC2801 6 6 | print((3.0).__mul__(4.0)) # PLC2801 @@ -103,7 +99,6 @@ unnecessary_dunder_call.py:8:7: PLC2801 [*] Unnecessary dunder call to `__floord | = help: Use `//` operator -Suggested fix: 5 5 | print((3.0).__sub__(4.0)) # PLC2801 6 6 | print((3.0).__mul__(4.0)) # PLC2801 7 7 | print((3.0).__truediv__(4.0)) # PLC2801 @@ -126,7 +121,6 @@ unnecessary_dunder_call.py:9:7: PLC2801 [*] Unnecessary dunder call to `__mod__` | = help: Use `%` operator -Suggested fix: 6 6 | print((3.0).__mul__(4.0)) # PLC2801 7 7 | print((3.0).__truediv__(4.0)) # PLC2801 8 8 | print((3.0).__floordiv__(4.0)) # PLC2801 @@ -149,7 +143,6 @@ unnecessary_dunder_call.py:10:7: PLC2801 [*] Unnecessary dunder call to `__eq__` | = help: Use `==` operator -Suggested fix: 7 7 | print((3.0).__truediv__(4.0)) # PLC2801 8 8 | print((3.0).__floordiv__(4.0)) # PLC2801 9 9 | print((3.0).__mod__(4.0)) # PLC2801 @@ -172,7 +165,6 @@ unnecessary_dunder_call.py:11:7: PLC2801 [*] Unnecessary dunder call to `__ne__` | = help: Use `!=` operator -Suggested fix: 8 8 | print((3.0).__floordiv__(4.0)) # PLC2801 9 9 | print((3.0).__mod__(4.0)) # PLC2801 10 10 | print((3.0).__eq__(4.0)) # PLC2801 @@ -195,7 +187,6 @@ unnecessary_dunder_call.py:12:7: PLC2801 [*] Unnecessary dunder call to `__lt__` | = help: Use `<` operator -Suggested fix: 9 9 | print((3.0).__mod__(4.0)) # PLC2801 10 10 | print((3.0).__eq__(4.0)) # PLC2801 11 11 | print((3.0).__ne__(4.0)) # PLC2801 @@ -218,7 +209,6 @@ unnecessary_dunder_call.py:13:7: PLC2801 [*] Unnecessary dunder call to `__le__` | = help: Use `<=` operator -Suggested fix: 10 10 | print((3.0).__eq__(4.0)) # PLC2801 11 11 | print((3.0).__ne__(4.0)) # PLC2801 12 12 | print((3.0).__lt__(4.0)) # PLC2801 @@ -241,7 +231,6 @@ unnecessary_dunder_call.py:14:7: PLC2801 [*] Unnecessary dunder call to `__gt__` | = help: Use `>` operator -Suggested fix: 11 11 | print((3.0).__ne__(4.0)) # PLC2801 12 12 | print((3.0).__lt__(4.0)) # PLC2801 13 13 | print((3.0).__le__(4.0)) # PLC2801 @@ -264,7 +253,6 @@ unnecessary_dunder_call.py:15:7: PLC2801 [*] Unnecessary dunder call to `__ge__` | = help: Use `>=` operator -Suggested fix: 12 12 | print((3.0).__lt__(4.0)) # PLC2801 13 13 | print((3.0).__le__(4.0)) # PLC2801 14 14 | print((3.0).__gt__(4.0)) # PLC2801 @@ -287,7 +275,6 @@ unnecessary_dunder_call.py:16:7: PLC2801 [*] Unnecessary dunder call to `__str__ | = help: Use `str()` builtin -Suggested fix: 13 13 | print((3.0).__le__(4.0)) # PLC2801 14 14 | print((3.0).__gt__(4.0)) # PLC2801 15 15 | print((3.0).__ge__(4.0)) # PLC2801 @@ -310,7 +297,6 @@ unnecessary_dunder_call.py:17:7: PLC2801 [*] Unnecessary dunder call to `__repr_ | = help: Use `repr()` builtin -Suggested fix: 14 14 | print((3.0).__gt__(4.0)) # PLC2801 15 15 | print((3.0).__ge__(4.0)) # PLC2801 16 16 | print((3.0).__str__()) # PLC2801 @@ -333,7 +319,6 @@ unnecessary_dunder_call.py:18:7: PLC2801 [*] Unnecessary dunder call to `__len__ | = help: Use `len()` builtin -Suggested fix: 15 15 | print((3.0).__ge__(4.0)) # PLC2801 16 16 | print((3.0).__str__()) # PLC2801 17 17 | print((3.0).__repr__()) # PLC2801 @@ -367,7 +352,6 @@ unnecessary_dunder_call.py:20:8: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -Suggested fix: 17 17 | print((3.0).__repr__()) # PLC2801 18 18 | print([1, 2, 3].__len__()) # PLC2801 19 19 | print((1).__neg__()) # PLC2801 @@ -390,7 +374,6 @@ unnecessary_dunder_call.py:21:8: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -Suggested fix: 18 18 | print([1, 2, 3].__len__()) # PLC2801 19 19 | print((1).__neg__()) # PLC2801 20 20 | print(-a.__sub__(1)) # PLC2801 @@ -413,7 +396,6 @@ unnecessary_dunder_call.py:22:10: PLC2801 [*] Unnecessary dunder call to `__sub_ | = help: Use `-` operator -Suggested fix: 19 19 | print((1).__neg__()) # PLC2801 20 20 | print(-a.__sub__(1)) # PLC2801 21 21 | print(-(a).__sub__(1)) # PLC2801 @@ -436,7 +418,6 @@ unnecessary_dunder_call.py:23:7: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -Suggested fix: 20 20 | print(-a.__sub__(1)) # PLC2801 21 21 | print(-(a).__sub__(1)) # PLC2801 22 22 | print(-(-a.__sub__(1))) # PLC2801 @@ -459,7 +440,6 @@ unnecessary_dunder_call.py:24:8: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -Suggested fix: 21 21 | print(-(a).__sub__(1)) # PLC2801 22 22 | print(-(-a.__sub__(1))) # PLC2801 23 23 | print((5 - a).__sub__(1)) # PLC2801 @@ -482,7 +462,6 @@ unnecessary_dunder_call.py:25:8: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -Suggested fix: 22 22 | print(-(-a.__sub__(1))) # PLC2801 23 23 | print((5 - a).__sub__(1)) # PLC2801 24 24 | print(-(5 - a).__sub__(1)) # PLC2801 @@ -505,7 +484,6 @@ unnecessary_dunder_call.py:26:13: PLC2801 [*] Unnecessary dunder call to `__sub_ | = help: Use `-` operator -Suggested fix: 23 23 | print((5 - a).__sub__(1)) # PLC2801 24 24 | print(-(5 - a).__sub__(1)) # PLC2801 25 25 | print(-(-5 - a).__sub__(1)) # PLC2801 @@ -528,7 +506,6 @@ unnecessary_dunder_call.py:27:7: PLC2801 [*] Unnecessary dunder call to `__rsub_ | = help: Use `-` operator -Suggested fix: 24 24 | print(-(5 - a).__sub__(1)) # PLC2801 25 25 | print(-(-5 - a).__sub__(1)) # PLC2801 26 26 | print(+-+-+-a.__sub__(1)) # PLC2801 @@ -551,7 +528,6 @@ unnecessary_dunder_call.py:28:7: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -Suggested fix: 25 25 | print(-(-5 - a).__sub__(1)) # PLC2801 26 26 | print(+-+-+-a.__sub__(1)) # PLC2801 27 27 | print(a.__rsub__(2 - 1)) # PLC2801 @@ -574,7 +550,6 @@ unnecessary_dunder_call.py:29:7: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -Suggested fix: 26 26 | print(+-+-+-a.__sub__(1)) # PLC2801 27 27 | print(a.__rsub__(2 - 1)) # PLC2801 28 28 | print(a.__sub__(((((1)))))) # PLC2801 @@ -602,7 +577,6 @@ unnecessary_dunder_call.py:30:7: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -Suggested fix: 27 27 | print(a.__rsub__(2 - 1)) # PLC2801 28 28 | print(a.__sub__(((((1)))))) # PLC2801 29 29 | print(a.__sub__(((((2 - 1)))))) # PLC2801 @@ -635,7 +609,6 @@ unnecessary_dunder_call.py:35:7: PLC2801 [*] Unnecessary dunder call to `__rsub_ | = help: Use `-` operator -Suggested fix: 32 32 | + 33 33 | 4 34 34 | )) @@ -663,7 +636,6 @@ unnecessary_dunder_call.py:40:11: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -Suggested fix: 37 37 | + 38 38 | 4 39 39 | )) @@ -686,7 +658,6 @@ unnecessary_dunder_call.py:41:9: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -Suggested fix: 38 38 | 4 39 39 | )) 40 40 | print(2 * a.__add__(3)) # PLC2801 @@ -709,7 +680,6 @@ unnecessary_dunder_call.py:42:10: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -Suggested fix: 39 39 | )) 40 40 | print(2 * a.__add__(3)) # PLC2801 41 41 | x = 2 * a.__add__(3) # PLC2801 @@ -732,7 +702,6 @@ unnecessary_dunder_call.py:43:5: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -Suggested fix: 40 40 | print(2 * a.__add__(3)) # PLC2801 41 41 | x = 2 * a.__add__(3) # PLC2801 42 42 | x = 2 * -a.__add__(3) # PLC2801 @@ -755,7 +724,6 @@ unnecessary_dunder_call.py:44:6: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -Suggested fix: 41 41 | x = 2 * a.__add__(3) # PLC2801 42 42 | x = 2 * -a.__add__(3) # PLC2801 43 43 | x = a.__add__(3) # PLC2801 @@ -777,7 +745,6 @@ unnecessary_dunder_call.py:45:5: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -Suggested fix: 42 42 | x = 2 * -a.__add__(3) # PLC2801 43 43 | x = a.__add__(3) # PLC2801 44 44 | x = -a.__add__(3) # PLC2801 @@ -800,7 +767,6 @@ unnecessary_dunder_call.py:46:6: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -Suggested fix: 43 43 | x = a.__add__(3) # PLC2801 44 44 | x = -a.__add__(3) # PLC2801 45 45 | x = (-a).__add__(3) # PLC2801 @@ -831,7 +797,6 @@ unnecessary_dunder_call.py:52:16: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -Suggested fix: 49 49 | print(a.__call__()) # PLC2801 (no fix, intentional) 50 50 | 51 51 | # Lambda expressions @@ -853,7 +818,6 @@ unnecessary_dunder_call.py:55:7: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -Suggested fix: 52 52 | blah = lambda: a.__add__(1) # PLC2801 53 53 | 54 54 | # If expressions @@ -875,7 +839,6 @@ unnecessary_dunder_call.py:55:34: PLC2801 [*] Unnecessary dunder call to `__sub_ | = help: Use `-` operator -Suggested fix: 52 52 | blah = lambda: a.__add__(1) # PLC2801 53 53 | 54 54 | # If expressions @@ -897,7 +860,6 @@ unnecessary_dunder_call.py:58:13: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -Suggested fix: 55 55 | print(a.__add__(1) if a > 0 else a.__sub__(1)) # PLC2801 56 56 | 57 57 | # Dict/Set/List/Tuple @@ -920,7 +882,6 @@ unnecessary_dunder_call.py:59:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -Suggested fix: 56 56 | 57 57 | # Dict/Set/List/Tuple 58 58 | print({"a": a.__add__(1)}) # PLC2801 @@ -942,7 +903,6 @@ unnecessary_dunder_call.py:60:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -Suggested fix: 57 57 | # Dict/Set/List/Tuple 58 58 | print({"a": a.__add__(1)}) # PLC2801 59 59 | print({a.__add__(1)}) # PLC2801 @@ -965,7 +925,6 @@ unnecessary_dunder_call.py:61:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -Suggested fix: 58 58 | print({"a": a.__add__(1)}) # PLC2801 59 59 | print({a.__add__(1)}) # PLC2801 60 60 | print([a.__add__(1)]) # PLC2801 @@ -987,7 +946,6 @@ unnecessary_dunder_call.py:64:11: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -Suggested fix: 61 61 | print((a.__add__(1),)) # PLC2801 62 62 | 63 63 | # Comprehension variants @@ -1010,7 +968,6 @@ unnecessary_dunder_call.py:65:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -Suggested fix: 62 62 | 63 63 | # Comprehension variants 64 64 | print({i: i.__add__(1) for i in range(5)}) # PLC2801 @@ -1032,7 +989,6 @@ unnecessary_dunder_call.py:66:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -Suggested fix: 63 63 | # Comprehension variants 64 64 | print({i: i.__add__(1) for i in range(5)}) # PLC2801 65 65 | print({i.__add__(1) for i in range(5)}) # PLC2801 @@ -1055,7 +1011,6 @@ unnecessary_dunder_call.py:67:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -Suggested fix: 64 64 | print({i: i.__add__(1) for i in range(5)}) # PLC2801 65 65 | print({i.__add__(1) for i in range(5)}) # PLC2801 66 66 | print([i.__add__(1) for i in range(5)]) # PLC2801 @@ -1076,7 +1031,6 @@ unnecessary_dunder_call.py:70:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -Suggested fix: 67 67 | print((i.__add__(1) for i in range(5))) # PLC2801 68 68 | 69 69 | # Generators @@ -1098,7 +1052,6 @@ unnecessary_dunder_call.py:74:13: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -Suggested fix: 71 71 | print(next(gen)) 72 72 | 73 73 | # Subscripts @@ -1120,7 +1073,6 @@ unnecessary_dunder_call.py:77:9: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -Suggested fix: 74 74 | print({"a": a.__add__(1)}["a"]) # PLC2801 75 75 | 76 76 | # Starred @@ -1140,7 +1092,6 @@ unnecessary_dunder_call.py:80:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -Suggested fix: 77 77 | print(*[a.__add__(1)]) # PLC2801 78 78 | 79 79 | # Slices @@ -1160,7 +1111,6 @@ unnecessary_dunder_call.py:80:22: PLC2801 [*] Unnecessary dunder call to `__sub_ | = help: Use `-` operator -Suggested fix: 77 77 | print(*[a.__add__(1)]) # PLC2801 78 78 | 79 79 | # Slices diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0241_duplicate_bases.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0241_duplicate_bases.py.snap index 79e68e06cf85c..b2b761702c774 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0241_duplicate_bases.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0241_duplicate_bases.py.snap @@ -10,7 +10,6 @@ duplicate_bases.py:13:13: PLE0241 [*] Duplicate base `A` for class `F1` | = help: Remove duplicate base -Suggested fix: 10 10 | 11 11 | 12 12 | # Duplicate base class is last. @@ -30,7 +29,6 @@ duplicate_bases.py:17:13: PLE0241 [*] Duplicate base `A` for class `F2` | = help: Remove duplicate base -Suggested fix: 14 14 | ... 15 15 | 16 16 | @@ -53,7 +51,6 @@ duplicate_bases.py:23:5: PLE0241 [*] Duplicate base `A` for class `F3` | = help: Remove duplicate base -Suggested fix: 19 19 | 20 20 | 21 21 | class F3( @@ -75,7 +72,6 @@ duplicate_bases.py:30:5: PLE0241 [*] Duplicate base `A` for class `F4` | = help: Remove duplicate base -Suggested fix: 27 27 | 28 28 | class F4( 29 29 | A, @@ -95,7 +91,6 @@ duplicate_bases.py:36:13: PLE0241 [*] Duplicate base `A` for class `G1` | = help: Remove duplicate base -Suggested fix: 33 33 | 34 34 | 35 35 | # Duplicate base class is not last. @@ -115,7 +110,6 @@ duplicate_bases.py:40:13: PLE0241 [*] Duplicate base `A` for class `G2` | = help: Remove duplicate base -Suggested fix: 37 37 | ... 38 38 | 39 39 | @@ -138,7 +132,6 @@ duplicate_bases.py:46:5: PLE0241 [*] Duplicate base `A` for class `G3` | = help: Remove duplicate base -Suggested fix: 43 43 | 44 44 | class G3( 45 45 | A, @@ -160,7 +153,6 @@ duplicate_bases.py:54:5: PLE0241 [*] Duplicate base `A` for class `G4` | = help: Remove duplicate base -Suggested fix: 51 51 | 52 52 | class G4( 53 53 | A, diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap index e9e09f285906f..b2364e5303ea8 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap @@ -10,7 +10,6 @@ dict_iter_missing_items.py:13:13: PLE1141 [*] Unpacking a dictionary in iteratio | = help: Add a call to `.items()` -Suggested fix: 10 10 | s2 = {1, 2, 3} 11 11 | 12 12 | # Errors @@ -32,7 +31,6 @@ dict_iter_missing_items.py:16:13: PLE1141 [*] Unpacking a dictionary in iteratio | = help: Add a call to `.items()` -Suggested fix: 13 13 | for k, v in d: 14 14 | pass 15 15 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap index 63b5eeb59f03e..eab840df6c25e 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap @@ -11,7 +11,6 @@ singledispatch_method.py:10:5: PLE1519 [*] `@singledispatch` decorator should no | = help: Replace with `@singledispatchmethod` -Suggested fix: 7 7 | 8 8 | 9 9 | class Board: @@ -34,7 +33,6 @@ singledispatch_method.py:15:5: PLE1519 [*] `@singledispatch` decorator should no | = help: Replace with `@singledispatchmethod` -Suggested fix: 12 12 | def convert_position(cls, position): 13 13 | pass 14 14 | @@ -57,7 +55,6 @@ singledispatch_method.py:23:5: PLE1519 [*] `@singledispatch` decorator should no | = help: Replace with `@singledispatchmethod` -Suggested fix: 20 20 | def place(self, position): 21 21 | pass 22 22 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1520_singledispatchmethod_function.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1520_singledispatchmethod_function.py.snap index aaaa8c2367839..d1a8e6426dd57 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1520_singledispatchmethod_function.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1520_singledispatchmethod_function.py.snap @@ -10,7 +10,6 @@ singledispatchmethod_function.py:4:1: PLE1520 [*] `@singledispatchmethod` decora | = help: Replace with `@singledispatch` -Suggested fix: 1 |-from functools import singledispatchmethod 1 |+from functools import singledispatchmethod, singledispatch 2 2 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters.py.snap index 76bff19c45454..d894609645f4a 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters.py.snap @@ -11,7 +11,6 @@ invalid_characters.py:15:6: PLE2510 [*] Invalid unescaped character backspace, u | = help: Replace with escape sequence -Suggested fix: 12 12 | # (Pylint, "C0414") => Rule::UselessImportAlias, 13 13 | # (Pylint, "C3002") => Rule::UnnecessaryDirectLambdaCall, 14 14 | #foo = 'hi' @@ -34,7 +33,6 @@ invalid_characters.py:16:7: PLE2510 [*] Invalid unescaped character backspace, u | = help: Replace with escape sequence -Suggested fix: 13 13 | # (Pylint, "C3002") => Rule::UnnecessaryDirectLambdaCall, 14 14 | #foo = 'hi' 15 15 | b = '␈' @@ -57,7 +55,6 @@ invalid_characters.py:55:21: PLE2510 [*] Invalid unescaped character backspace, | = help: Replace with escape sequence -Suggested fix: 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 54 54 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2512_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2512_invalid_characters.py.snap index 3429c28be497a..3b1ade9e0f9bc 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2512_invalid_characters.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2512_invalid_characters.py.snap @@ -11,7 +11,6 @@ invalid_characters.py:24:12: PLE2512 [*] Invalid unescaped character SUB, use "\ | = help: Replace with escape sequence -Suggested fix: 21 21 | cr_ok = '\\r' 22 22 | cr_ok = f'\\r' 23 23 | @@ -33,7 +32,6 @@ invalid_characters.py:25:13: PLE2512 [*] Invalid unescaped character SUB, use "\ | = help: Replace with escape sequence -Suggested fix: 22 22 | cr_ok = f'\\r' 23 23 | 24 24 | sub = 'sub ' @@ -56,7 +54,6 @@ invalid_characters.py:55:25: PLE2512 [*] Invalid unescaped character SUB, use "\ | = help: Replace with escape sequence -Suggested fix: 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 54 54 | @@ -78,7 +75,6 @@ invalid_characters.py:58:12: PLE2512 [*] Invalid unescaped character SUB, use "\ | = help: Replace with escape sequence -Suggested fix: 55 55 | nested_fstrings = f'␈{f'{f'␛'}'}' 56 56 | 57 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2513_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2513_invalid_characters.py.snap index 73b9d4c4121d0..a354cc91c136d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2513_invalid_characters.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2513_invalid_characters.py.snap @@ -11,7 +11,6 @@ invalid_characters.py:30:16: PLE2513 [*] Invalid unescaped character ESC, use "\ | = help: Replace with escape sequence -Suggested fix: 27 27 | sub_ok = '\x1a' 28 28 | sub_ok = f'\x1a' 29 29 | @@ -33,7 +32,6 @@ invalid_characters.py:31:17: PLE2513 [*] Invalid unescaped character ESC, use "\ | = help: Replace with escape sequence -Suggested fix: 28 28 | sub_ok = f'\x1a' 29 29 | 30 30 | esc = 'esc esc ␛' @@ -56,7 +54,6 @@ invalid_characters.py:55:29: PLE2513 [*] Invalid unescaped character ESC, use "\ | = help: Replace with escape sequence -Suggested fix: 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 54 54 | @@ -77,7 +74,6 @@ invalid_characters.py:60:12: PLE2513 [*] Invalid unescaped character ESC, use "\ | = help: Replace with escape sequence -Suggested fix: 57 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 58 58 | x = f"""}}ab""" 59 59 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998256 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2514_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2514_invalid_characters.py.snap index c959cf2b898640c175e5e41b7479375cf55b859d..4d184966b882efcc34b1601cf4f1b94dc3faed95 100644 GIT binary patch delta 16 YcmeBVf6cZ*lyS2P;|#{hrl#wsEG(A1FxFj`2AuY4QYO@IAOmwlyYnb)}0CJxYUH||9 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2515_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2515_invalid_characters.py.snap index 8f9f822fd9048..26adf27387a11 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2515_invalid_characters.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2515_invalid_characters.py.snap @@ -11,7 +11,6 @@ invalid_characters.py:44:13: PLE2515 [*] Invalid unescaped character zero-width- | = help: Replace with escape sequence -Suggested fix: 41 41 | nul_ok = '\0' 42 42 | nul_ok = f'\0' 43 43 | @@ -33,7 +32,6 @@ invalid_characters.py:45:14: PLE2515 [*] Invalid unescaped character zero-width- | = help: Replace with escape sequence -Suggested fix: 42 42 | nul_ok = f'\0' 43 43 | 44 44 | zwsp = 'zero​width' @@ -56,7 +54,6 @@ invalid_characters.py:50:36: PLE2515 [*] Invalid unescaped character zero-width- | = help: Replace with escape sequence -Suggested fix: 47 47 | zwsp_ok = '\u200b' 48 48 | zwsp_ok = f'\u200b' 49 49 | @@ -78,7 +75,6 @@ invalid_characters.py:51:37: PLE2515 [*] Invalid unescaped character zero-width- | = help: Replace with escape sequence -Suggested fix: 48 48 | zwsp_ok = f'\u200b' 49 49 | 50 50 | zwsp_after_multibyte_character = "ಫ​" @@ -100,7 +96,6 @@ invalid_characters.py:52:60: PLE2515 [*] Invalid unescaped character zero-width- | = help: Replace with escape sequence -Suggested fix: 49 49 | 50 50 | zwsp_after_multibyte_character = "ಫ​" 51 51 | zwsp_after_multibyte_character = f"ಫ​" @@ -122,7 +117,6 @@ invalid_characters.py:52:61: PLE2515 [*] Invalid unescaped character zero-width- | = help: Replace with escape sequence -Suggested fix: 49 49 | 50 50 | zwsp_after_multibyte_character = "ಫ​" 51 51 | zwsp_after_multibyte_character = f"ಫ​" @@ -145,7 +139,6 @@ invalid_characters.py:53:61: PLE2515 [*] Invalid unescaped character zero-width- | = help: Replace with escape sequence -Suggested fix: 50 50 | zwsp_after_multibyte_character = "ಫ​" 51 51 | zwsp_after_multibyte_character = f"ಫ​" 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" @@ -168,7 +161,6 @@ invalid_characters.py:53:62: PLE2515 [*] Invalid unescaped character zero-width- | = help: Replace with escape sequence -Suggested fix: 50 50 | zwsp_after_multibyte_character = "ಫ​" 51 51 | zwsp_after_multibyte_character = f"ಫ​" 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap index bde36377e5ceb..a8f052d3bee85 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap @@ -12,7 +12,6 @@ modified_iterating_set.py:4:1: PLE4703 [*] Iterated set `nums` is modified withi | = help: Iterate over a copy of `nums` -Suggested fix: 1 1 | # Errors 2 2 | 3 3 | nums = {1, 2, 3} @@ -35,7 +34,6 @@ modified_iterating_set.py:8:1: PLE4703 [*] Iterated set `animals` is modified wi | = help: Iterate over a copy of `animals` -Suggested fix: 5 5 | nums.add(num + 1) 6 6 | 7 7 | animals = {"dog", "cat", "cow"} @@ -58,7 +56,6 @@ modified_iterating_set.py:12:1: PLE4703 [*] Iterated set `fruits` is modified wi | = help: Iterate over a copy of `fruits` -Suggested fix: 9 9 | animals.pop("cow") 10 10 | 11 11 | fruits = {"apple", "orange", "grape"} @@ -81,7 +78,6 @@ modified_iterating_set.py:16:1: PLE4703 [*] Iterated set `planets` is modified w | = help: Iterate over a copy of `planets` -Suggested fix: 13 13 | fruits.clear() 14 14 | 15 15 | planets = {"mercury", "venus", "earth"} @@ -104,7 +100,6 @@ modified_iterating_set.py:20:1: PLE4703 [*] Iterated set `colors` is modified wi | = help: Iterate over a copy of `colors` -Suggested fix: 17 17 | planets.discard("mercury") 18 18 | 19 19 | colors = {"red", "green", "blue"} @@ -128,7 +123,6 @@ modified_iterating_set.py:24:1: PLE4703 [*] Iterated set `odds` is modified with | = help: Iterate over a copy of `odds` -Suggested fix: 21 21 | colors.remove("red") 22 22 | 23 23 | odds = {1, 3, 5} diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0202_no_method_decorator.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0202_no_method_decorator.py.snap index d9c44b4931ae7..d56c30fbdc21a 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0202_no_method_decorator.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0202_no_method_decorator.py.snap @@ -12,7 +12,6 @@ no_method_decorator.py:9:5: PLR0202 [*] Class method defined without decorator | = help: Add @classmethod decorator -Suggested fix: 6 6 | def __init__(self, color): 7 7 | self.color = color 8 8 | @@ -37,7 +36,6 @@ no_method_decorator.py:22:5: PLR0202 [*] Class method defined without decorator | = help: Add @classmethod decorator -Suggested fix: 19 19 | pick_one_color = staticmethod(pick_one_color) 20 20 | 21 21 | class Class: diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0203_no_method_decorator.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0203_no_method_decorator.py.snap index f30159f2f7178..dc4fa8182659b 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0203_no_method_decorator.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0203_no_method_decorator.py.snap @@ -12,7 +12,6 @@ no_method_decorator.py:15:5: PLR0203 [*] Static method defined without decorator | = help: Add @staticmethod decorator -Suggested fix: 12 12 | 13 13 | pick_colors = classmethod(pick_colors) 14 14 | @@ -38,7 +37,6 @@ no_method_decorator.py:27:5: PLR0203 [*] Static method defined without decorator | = help: Add @staticmethod decorator -Suggested fix: 24 24 | 25 25 | class_method = classmethod(class_method);another_statement 26 26 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0402_import_aliasing.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0402_import_aliasing.py.snap index b06ab4c295bf8..96cbd31d04bf0 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0402_import_aliasing.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0402_import_aliasing.py.snap @@ -12,7 +12,6 @@ import_aliasing.py:9:8: PLR0402 [*] Use `from os import path` in lieu of alias | = help: Replace with `from os import path` -Suggested fix: 6 6 | import collections as collections # [useless-import-alias] 7 7 | from collections import OrderedDict as OrderedDict # [useless-import-alias] 8 8 | from collections import OrderedDict as o_dict @@ -35,7 +34,6 @@ import_aliasing.py:11:8: PLR0402 [*] Use `from foo.bar import foobar` in lieu of | = help: Replace with `from foo.bar import foobar` -Suggested fix: 8 8 | from collections import OrderedDict as o_dict 9 9 | import os.path as path # [consider-using-from-import] 10 10 | import os.path as p diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1711_useless_return.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1711_useless_return.py.snap index 042fcaab4c246..5ee525567d7df 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1711_useless_return.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1711_useless_return.py.snap @@ -10,7 +10,6 @@ useless_return.py:6:5: PLR1711 [*] Useless `return` statement at end of function | = help: Remove useless `return` statement -Suggested fix: 3 3 | 4 4 | def print_python_version(): 5 5 | print(sys.version) @@ -30,7 +29,6 @@ useless_return.py:11:5: PLR1711 [*] Useless `return` statement at end of functio | = help: Remove useless `return` statement -Suggested fix: 8 8 | 9 9 | def print_python_version(): 10 10 | print(sys.version) @@ -50,7 +48,6 @@ useless_return.py:16:5: PLR1711 [*] Useless `return` statement at end of functio | = help: Remove useless `return` statement -Suggested fix: 13 13 | 14 14 | def print_python_version(): 15 15 | print(sys.version) @@ -70,7 +67,6 @@ useless_return.py:22:9: PLR1711 [*] Useless `return` statement at end of functio | = help: Remove useless `return` statement -Suggested fix: 19 19 | class SomeClass: 20 20 | def print_python_version(self): 21 21 | print(sys.version) @@ -90,7 +86,6 @@ useless_return.py:50:5: PLR1711 [*] Useless `return` statement at end of functio | = help: Remove useless `return` statement -Suggested fix: 47 47 | def print_python_version(): 48 48 | """This function returns None.""" 49 49 | print(sys.version) @@ -110,7 +105,6 @@ useless_return.py:60:9: PLR1711 [*] Useless `return` statement at end of functio | = help: Remove useless `return` statement -Suggested fix: 57 57 | 58 58 | def get(self, key: str) -> None: 59 59 | print(f"{key} not found") diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1714_repeated_equality_comparison.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1714_repeated_equality_comparison.py.snap index 95232292ff921..6186f3d7ca963 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1714_repeated_equality_comparison.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1714_repeated_equality_comparison.py.snap @@ -11,7 +11,6 @@ repeated_equality_comparison.py:2:1: PLR1714 [*] Consider merging multiple compa | = help: Merge multiple comparisons -Suggested fix: 1 1 | # Errors. 2 |-foo == "a" or foo == "b" 2 |+foo in ("a", "b") @@ -32,7 +31,6 @@ repeated_equality_comparison.py:4:1: PLR1714 [*] Consider merging multiple compa | = help: Merge multiple comparisons -Suggested fix: 1 1 | # Errors. 2 2 | foo == "a" or foo == "b" 3 3 | @@ -55,7 +53,6 @@ repeated_equality_comparison.py:6:1: PLR1714 [*] Consider merging multiple compa | = help: Merge multiple comparisons -Suggested fix: 3 3 | 4 4 | foo != "a" and foo != "b" 5 5 | @@ -78,7 +75,6 @@ repeated_equality_comparison.py:8:1: PLR1714 [*] Consider merging multiple compa | = help: Merge multiple comparisons -Suggested fix: 5 5 | 6 6 | foo == "a" or foo == "b" or foo == "c" 7 7 | @@ -101,7 +97,6 @@ repeated_equality_comparison.py:10:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -Suggested fix: 7 7 | 8 8 | foo != "a" and foo != "b" and foo != "c" 9 9 | @@ -124,7 +119,6 @@ repeated_equality_comparison.py:12:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -Suggested fix: 9 9 | 10 10 | foo == a or foo == "b" or foo == 3 # Mixed types. 11 11 | @@ -147,7 +141,6 @@ repeated_equality_comparison.py:14:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -Suggested fix: 11 11 | 12 12 | "a" == foo or "b" == foo or "c" == foo 13 13 | @@ -170,7 +163,6 @@ repeated_equality_comparison.py:16:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -Suggested fix: 13 13 | 14 14 | "a" != foo and "b" != foo and "c" != foo 15 15 | @@ -193,7 +185,6 @@ repeated_equality_comparison.py:18:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -Suggested fix: 15 15 | 16 16 | "a" == foo or foo == "b" or "c" == foo 17 17 | @@ -216,7 +207,6 @@ repeated_equality_comparison.py:20:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -Suggested fix: 17 17 | 18 18 | foo == bar or baz == foo or qux == foo 19 19 | @@ -239,7 +229,6 @@ repeated_equality_comparison.py:22:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -Suggested fix: 19 19 | 20 20 | foo == "a" or "b" == foo or foo == "c" 21 21 | @@ -262,7 +251,6 @@ repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -Suggested fix: 21 21 | 22 22 | foo != "a" and "b" != foo and foo != "c" 23 23 | @@ -285,7 +273,6 @@ repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -Suggested fix: 21 21 | 22 22 | foo != "a" and "b" != foo and foo != "c" 23 23 | @@ -308,7 +295,6 @@ repeated_equality_comparison.py:26:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -Suggested fix: 23 23 | 24 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets 25 25 | @@ -331,7 +317,6 @@ repeated_equality_comparison.py:61:16: PLR1714 [*] Consider merging multiple com | = help: Merge multiple comparisons -Suggested fix: 58 58 | 59 59 | foo == "a" or "c" == bar or foo == "b" or "d" == bar # Multiple targets 60 60 | @@ -354,7 +339,6 @@ repeated_equality_comparison.py:63:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -Suggested fix: 60 60 | 61 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets 62 62 | @@ -377,7 +361,6 @@ repeated_equality_comparison.py:63:29: PLR1714 [*] Consider merging multiple com | = help: Merge multiple comparisons -Suggested fix: 60 60 | 61 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets 62 62 | @@ -400,7 +383,6 @@ repeated_equality_comparison.py:65:16: PLR1714 [*] Consider merging multiple com | = help: Merge multiple comparisons -Suggested fix: 62 62 | 63 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets 64 64 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap index d3696081527b4..49281ef831d5c 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap @@ -9,7 +9,6 @@ sys_exit_alias_0.py:1:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -Suggested fix: 1 |-exit(0) 1 |+import sys 2 |+sys.exit(0) @@ -27,7 +26,6 @@ sys_exit_alias_0.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -Suggested fix: 1 |+import sys 1 2 | exit(0) 2 |-quit(0) @@ -47,7 +45,6 @@ sys_exit_alias_0.py:6:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -Suggested fix: 1 |+import sys 1 2 | exit(0) 2 3 | quit(0) @@ -69,7 +66,6 @@ sys_exit_alias_0.py:7:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -Suggested fix: 1 |+import sys 1 2 | exit(0) 2 3 | quit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap index 10e1785f6ab10..260905cc97b94 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap @@ -11,7 +11,6 @@ sys_exit_alias_1.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -Suggested fix: 1 1 | import sys 2 2 | 3 |-exit(0) @@ -30,7 +29,6 @@ sys_exit_alias_1.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -Suggested fix: 1 1 | import sys 2 2 | 3 3 | exit(0) @@ -51,7 +49,6 @@ sys_exit_alias_1.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -Suggested fix: 5 5 | 6 6 | 7 7 | def main(): @@ -72,7 +69,6 @@ sys_exit_alias_1.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -Suggested fix: 6 6 | 7 7 | def main(): 8 8 | exit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap index 95d56d4db0f92..599f22e62d146 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap @@ -10,7 +10,6 @@ sys_exit_alias_11.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -Suggested fix: 1 1 | from sys import * 2 |+import sys 2 3 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap index 5834deaadc7e7..9fe3547e83fc8 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap @@ -10,7 +10,6 @@ sys_exit_alias_12.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -Suggested fix: 1 |-import os \ 1 |+import os; import sys \ 2 2 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap index 975062776f8c4..064d2c1dcbccc 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap @@ -11,7 +11,6 @@ sys_exit_alias_2.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -Suggested fix: 1 1 | import sys as sys2 2 2 | 3 |-exit(0) @@ -30,7 +29,6 @@ sys_exit_alias_2.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -Suggested fix: 1 1 | import sys as sys2 2 2 | 3 3 | exit(0) @@ -51,7 +49,6 @@ sys_exit_alias_2.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -Suggested fix: 5 5 | 6 6 | 7 7 | def main(): @@ -70,7 +67,6 @@ sys_exit_alias_2.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -Suggested fix: 6 6 | 7 7 | def main(): 8 8 | exit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap index 1279304c106a0..5710cb7ad9648 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap @@ -9,7 +9,6 @@ sys_exit_alias_3.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -Suggested fix: 1 1 | from sys import exit 2 2 | 3 3 | exit(0) @@ -30,7 +29,6 @@ sys_exit_alias_3.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -Suggested fix: 6 6 | 7 7 | def main(): 8 8 | exit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap index 4fb6fffbcd1b7..e835ddefb16f1 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap @@ -11,7 +11,6 @@ sys_exit_alias_4.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -Suggested fix: 1 1 | from sys import exit as exit2 2 2 | 3 |-exit(0) @@ -30,7 +29,6 @@ sys_exit_alias_4.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -Suggested fix: 1 1 | from sys import exit as exit2 2 2 | 3 3 | exit(0) @@ -51,7 +49,6 @@ sys_exit_alias_4.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -Suggested fix: 5 5 | 6 6 | 7 7 | def main(): @@ -70,7 +67,6 @@ sys_exit_alias_4.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -Suggested fix: 6 6 | 7 7 | def main(): 8 8 | exit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap index bb5b903b9a421..c80c4346f8bf6 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap @@ -11,7 +11,6 @@ sys_exit_alias_5.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -Suggested fix: 1 1 | from sys import * 2 |+import sys 2 3 | @@ -31,7 +30,6 @@ sys_exit_alias_5.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -Suggested fix: 1 1 | from sys import * 2 |+import sys 2 3 | @@ -53,7 +51,6 @@ sys_exit_alias_5.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -Suggested fix: 1 1 | from sys import * 2 |+import sys 2 3 | @@ -77,7 +74,6 @@ sys_exit_alias_5.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -Suggested fix: 1 1 | from sys import * 2 |+import sys 2 3 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap index aae23399b13a6..e22439d67e0f8 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap @@ -9,7 +9,6 @@ sys_exit_alias_6.py:1:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -Suggested fix: 1 |-exit(0) 1 |+import sys 2 |+sys.exit(0) @@ -27,7 +26,6 @@ sys_exit_alias_6.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -Suggested fix: 1 |+import sys 1 2 | exit(0) 2 |-quit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap index 6f0af913c8041..6c62a98f66315 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap @@ -9,7 +9,6 @@ sys_exit_alias_7.py:2:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -Suggested fix: 1 |+import sys 1 2 | def main(): 2 |- exit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap index 284bc6b8a9b0d..3a50f62c2c56c 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap @@ -9,7 +9,6 @@ sys_exit_alias_8.py:5:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -Suggested fix: 1 |-from sys import argv 1 |+from sys import argv, exit 2 2 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap index 864b5eab2290f..f08ee7439ae18 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap @@ -9,7 +9,6 @@ sys_exit_alias_9.py:2:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -Suggested fix: 1 |+import sys 1 2 | def main(): 2 |- exit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1730_if_stmt_min_max.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1730_if_stmt_min_max.py.snap index bc14269c7db00..98720a364bb24 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1730_if_stmt_min_max.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1730_if_stmt_min_max.py.snap @@ -12,7 +12,6 @@ if_stmt_min_max.py:8:1: PLR1730 [*] Replace `if` statement with `value = max(val | = help: Replace with `value = max(value, 10)` -Suggested fix: 5 5 | value3 = 3 6 6 | 7 7 | # Positive @@ -37,7 +36,6 @@ if_stmt_min_max.py:11:1: PLR1730 [*] Replace `if` statement with `value = max(10 | = help: Replace with `value = max(10, value)` -Suggested fix: 8 8 | if value < 10: # [max-instead-of-if] 9 9 | value = 10 10 10 | @@ -62,7 +60,6 @@ if_stmt_min_max.py:14:1: PLR1730 [*] Replace `if` statement with `value = max(va | = help: Replace with `value = max(value, value2)` -Suggested fix: 11 11 | if value <= 10: # [max-instead-of-if] 12 12 | value = 10 13 13 | @@ -87,7 +84,6 @@ if_stmt_min_max.py:17:1: PLR1730 [*] Replace `if` statement with `value = min(va | = help: Replace with `value = min(value, 10)` -Suggested fix: 14 14 | if value < value2: # [max-instead-of-if] 15 15 | value = value2 16 16 | @@ -112,7 +108,6 @@ if_stmt_min_max.py:20:1: PLR1730 [*] Replace `if` statement with `value = min(10 | = help: Replace with `value = min(10, value)` -Suggested fix: 17 17 | if value > 10: # [min-instead-of-if] 18 18 | value = 10 19 19 | @@ -135,7 +130,6 @@ if_stmt_min_max.py:23:1: PLR1730 [*] Replace `if` statement with `value = min(va | = help: Replace with `value = min(value, value2)` -Suggested fix: 20 20 | if value >= 10: # [min-instead-of-if] 21 21 | value = 10 22 22 | @@ -159,7 +153,6 @@ if_stmt_min_max.py:33:1: PLR1730 [*] Replace `if` statement with `A1.value = max | = help: Replace with `A1.value = max(A1.value, 10)` -Suggested fix: 30 30 | 31 31 | 32 32 | A1 = A() @@ -182,7 +175,6 @@ if_stmt_min_max.py:36:1: PLR1730 [*] Replace `if` statement with `A1.value = min | = help: Replace with `A1.value = min(A1.value, 10)` -Suggested fix: 33 33 | if A1.value < 10: # [max-instead-of-if] 34 34 | A1.value = 10 35 35 | @@ -207,7 +199,6 @@ if_stmt_min_max.py:60:1: PLR1730 [*] Replace `if` statement with `A2 = max(A2, A | = help: Replace with `A2 = max(A2, A1)` -Suggested fix: 57 57 | A1 = AA(0) 58 58 | A2 = AA(3) 59 59 | @@ -232,7 +223,6 @@ if_stmt_min_max.py:63:1: PLR1730 [*] Replace `if` statement with `A2 = max(A1, A | = help: Replace with `A2 = max(A1, A2)` -Suggested fix: 60 60 | if A2 < A1: # [max-instead-of-if] 61 61 | A2 = A1 62 62 | @@ -257,7 +247,6 @@ if_stmt_min_max.py:66:1: PLR1730 [*] Replace `if` statement with `A2 = min(A2, A | = help: Replace with `A2 = min(A2, A1)` -Suggested fix: 63 63 | if A2 <= A1: # [max-instead-of-if] 64 64 | A2 = A1 65 65 | @@ -282,7 +271,6 @@ if_stmt_min_max.py:69:1: PLR1730 [*] Replace `if` statement with `A2 = min(A1, A | = help: Replace with `A2 = min(A1, A2)` -Suggested fix: 66 66 | if A2 > A1: # [min-instead-of-if] 67 67 | A2 = A1 68 68 | @@ -309,7 +297,6 @@ if_stmt_min_max.py:132:1: PLR1730 [*] Replace `if` statement with `min` call | = help: Replace with `min` call -Suggested fix: 129 129 | value = 2 130 130 | 131 131 | # Parenthesized expressions @@ -338,7 +325,6 @@ if_stmt_min_max.py:143:9: PLR1730 [*] Replace `if` statement with `self._min = m | = help: Replace with `self._min = min(value, self._min)` -Suggested fix: 140 140 | _max = 0 141 141 | 142 142 | def foo(self, value) -> None: @@ -364,7 +350,6 @@ if_stmt_min_max.py:145:9: PLR1730 [*] Replace `if` statement with `self._max = m | = help: Replace with `self._max = max(value, self._max)` -Suggested fix: 142 142 | def foo(self, value) -> None: 143 143 | if value < self._min: 144 144 | self._min = value @@ -390,7 +375,6 @@ if_stmt_min_max.py:148:9: PLR1730 [*] Replace `if` statement with `self._min = m | = help: Replace with `self._min = max(self._min, value)` -Suggested fix: 145 145 | if value > self._max: 146 146 | self._max = value 147 147 | @@ -416,7 +400,6 @@ if_stmt_min_max.py:150:9: PLR1730 [*] Replace `if` statement with `self._max = m | = help: Replace with `self._max = min(self._max, value)` -Suggested fix: 147 147 | 148 148 | if self._min < value: 149 149 | self._min = value @@ -442,7 +425,6 @@ if_stmt_min_max.py:153:9: PLR1730 [*] Replace `if` statement with `self._min = m | = help: Replace with `self._min = min(self._min, value)` -Suggested fix: 150 150 | if self._max > value: 151 151 | self._max = value 152 152 | @@ -468,7 +450,6 @@ if_stmt_min_max.py:155:9: PLR1730 [*] Replace `if` statement with `self._max = m | = help: Replace with `self._max = max(self._max, value)` -Suggested fix: 152 152 | 153 153 | if value <= self._min: 154 154 | self._min = value @@ -494,7 +475,6 @@ if_stmt_min_max.py:158:9: PLR1730 [*] Replace `if` statement with `self._min = m | = help: Replace with `self._min = max(value, self._min)` -Suggested fix: 155 155 | if value >= self._max: 156 156 | self._max = value 157 157 | @@ -517,7 +497,6 @@ if_stmt_min_max.py:160:9: PLR1730 [*] Replace `if` statement with `self._max = m | = help: Replace with `self._max = min(value, self._max)` -Suggested fix: 157 157 | 158 158 | if self._min <= value: 159 159 | self._min = value diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap index dd5d6e7294efb..37d4939db8fd5 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap @@ -11,7 +11,6 @@ unnecessary_dict_index_lookup.py:4:6: PLR1733 [*] Unnecessary lookup of dictiona | = help: Use existing variable -Suggested fix: 1 1 | FRUITS = {"apple": 1, "orange": 10, "berry": 22} 2 2 | 3 3 | def fix_these(): @@ -33,7 +32,6 @@ unnecessary_dict_index_lookup.py:5:6: PLR1733 [*] Unnecessary lookup of dictiona | = help: Use existing variable -Suggested fix: 2 2 | 3 3 | def fix_these(): 4 4 | [FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()] # PLR1733 @@ -56,7 +54,6 @@ unnecessary_dict_index_lookup.py:6:18: PLR1733 [*] Unnecessary lookup of diction | = help: Use existing variable -Suggested fix: 3 3 | def fix_these(): 4 4 | [FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()] # PLR1733 5 5 | {FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()} # PLR1733 @@ -78,7 +75,6 @@ unnecessary_dict_index_lookup.py:9:15: PLR1733 [*] Unnecessary lookup of diction | = help: Use existing variable -Suggested fix: 6 6 | {fruit_name: FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()} # PLR1733 7 7 | 8 8 | for fruit_name, fruit_count in FRUITS.items(): @@ -100,7 +96,6 @@ unnecessary_dict_index_lookup.py:10:16: PLR1733 [*] Unnecessary lookup of dictio | = help: Use existing variable -Suggested fix: 7 7 | 8 8 | for fruit_name, fruit_count in FRUITS.items(): 9 9 | print(FRUITS[fruit_name]) # PLR1733 @@ -121,7 +116,6 @@ unnecessary_dict_index_lookup.py:11:16: PLR1733 [*] Unnecessary lookup of dictio | = help: Use existing variable -Suggested fix: 8 8 | for fruit_name, fruit_count in FRUITS.items(): 9 9 | print(FRUITS[fruit_name]) # PLR1733 10 10 | blah = FRUITS[fruit_name] # PLR1733 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap index 8dc794434b2a1..c864914278f0d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap @@ -11,7 +11,6 @@ unnecessary_list_index_lookup.py:7:6: PLR1736 [*] List index lookup in `enumerat | = help: Use the loop variable directly -Suggested fix: 4 4 | 5 5 | 6 6 | def fix_these(): @@ -33,7 +32,6 @@ unnecessary_list_index_lookup.py:8:6: PLR1736 [*] List index lookup in `enumerat | = help: Use the loop variable directly -Suggested fix: 5 5 | 6 6 | def fix_these(): 7 7 | [letters[index] for index, letter in enumerate(letters)] # PLR1736 @@ -56,7 +54,6 @@ unnecessary_list_index_lookup.py:9:14: PLR1736 [*] List index lookup in `enumera | = help: Use the loop variable directly -Suggested fix: 6 6 | def fix_these(): 7 7 | [letters[index] for index, letter in enumerate(letters)] # PLR1736 8 8 | {letters[index] for index, letter in enumerate(letters)} # PLR1736 @@ -78,7 +75,6 @@ unnecessary_list_index_lookup.py:12:15: PLR1736 [*] List index lookup in `enumer | = help: Use the loop variable directly -Suggested fix: 9 9 | {letter: letters[index] for index, letter in enumerate(letters)} # PLR1736 10 10 | 11 11 | for index, letter in enumerate(letters): @@ -100,7 +96,6 @@ unnecessary_list_index_lookup.py:13:16: PLR1736 [*] List index lookup in `enumer | = help: Use the loop variable directly -Suggested fix: 10 10 | 11 11 | for index, letter in enumerate(letters): 12 12 | print(letters[index]) # PLR1736 @@ -123,7 +118,6 @@ unnecessary_list_index_lookup.py:14:16: PLR1736 [*] List index lookup in `enumer | = help: Use the loop variable directly -Suggested fix: 11 11 | for index, letter in enumerate(letters): 12 12 | print(letters[index]) # PLR1736 13 13 | blah = letters[index] # PLR1736 @@ -145,7 +139,6 @@ unnecessary_list_index_lookup.py:17:15: PLR1736 [*] List index lookup in `enumer | = help: Use the loop variable directly -Suggested fix: 14 14 | assert letters[index] == "d" # PLR1736 15 15 | 16 16 | for index, letter in builtins.enumerate(letters): @@ -167,7 +160,6 @@ unnecessary_list_index_lookup.py:18:16: PLR1736 [*] List index lookup in `enumer | = help: Use the loop variable directly -Suggested fix: 15 15 | 16 16 | for index, letter in builtins.enumerate(letters): 17 17 | print(letters[index]) # PLR1736 @@ -188,7 +180,6 @@ unnecessary_list_index_lookup.py:19:16: PLR1736 [*] List index lookup in `enumer | = help: Use the loop variable directly -Suggested fix: 16 16 | for index, letter in builtins.enumerate(letters): 17 17 | print(letters[index]) # PLR1736 18 18 | blah = letters[index] # PLR1736 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap index 183725b382fc3..a93e37c1c3838 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap @@ -12,7 +12,6 @@ empty_comment.py:3:1: PLR2044 [*] Line with empty comment | = help: Delete the empty comment -Suggested fix: 1 1 | # this line has a non-empty comment and is OK 2 2 | # this line is also OK, but the three following lines are not 3 |-# @@ -32,7 +31,6 @@ empty_comment.py:4:5: PLR2044 [*] Line with empty comment | = help: Delete the empty comment -Suggested fix: 1 1 | # this line has a non-empty comment and is OK 2 2 | # this line is also OK, but the three following lines are not 3 3 | # @@ -54,7 +52,6 @@ empty_comment.py:5:9: PLR2044 [*] Line with empty comment | = help: Delete the empty comment -Suggested fix: 2 2 | # this line is also OK, but the three following lines are not 3 3 | # 4 4 | # @@ -73,7 +70,6 @@ empty_comment.py:18:11: PLR2044 [*] Line with empty comment | = help: Delete the empty comment -Suggested fix: 15 15 | 16 16 | 17 17 | def foo(): # this comment is OK, the one below is not @@ -95,7 +91,6 @@ empty_comment.py:44:1: PLR2044 [*] Line with empty comment | = help: Delete the empty comment -Suggested fix: 42 42 | # These should be removed, despite being an empty "block comment". 43 43 | 44 44 | # @@ -116,7 +111,6 @@ empty_comment.py:45:1: PLR2044 [*] Line with empty comment | = help: Delete the empty comment -Suggested fix: 42 42 | # These should be removed, despite being an empty "block comment". 43 43 | 44 44 | # @@ -135,7 +129,6 @@ empty_comment.py:58:2: PLR2044 [*] Line with empty comment | = help: Delete the empty comment -Suggested fix: 55 55 | # This should be removed. 56 56 | 57 57 | α = 1 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR5501_collapsible_else_if.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR5501_collapsible_else_if.py.snap index 76f5b2a9d4297..9d07874ee02a2 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR5501_collapsible_else_if.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR5501_collapsible_else_if.py.snap @@ -13,7 +13,6 @@ collapsible_else_if.py:37:5: PLR5501 [*] Use `elif` instead of `else` then `if`, | = help: Convert to `elif` -Suggested fix: 34 34 | def not_ok0(): 35 35 | if 1: 36 36 | pass @@ -41,7 +40,6 @@ collapsible_else_if.py:45:5: PLR5501 [*] Use `elif` instead of `else` then `if`, | = help: Convert to `elif` -Suggested fix: 42 42 | def not_ok1(): 43 43 | if 1: 44 44 | pass @@ -73,7 +71,6 @@ collapsible_else_if.py:55:5: PLR5501 [*] Use `elif` instead of `else` then `if`, | = help: Convert to `elif` -Suggested fix: 52 52 | def not_ok1_with_comments(): 53 53 | if 1: 54 54 | pass @@ -105,7 +102,6 @@ collapsible_else_if.py:69:5: PLR5501 [*] Use `elif` instead of `else` then `if`, | = help: Convert to `elif` -Suggested fix: 66 66 | print(1) 67 67 | elif True: 68 68 | print(2) @@ -135,7 +131,6 @@ collapsible_else_if.py:79:5: PLR5501 [*] Use `elif` instead of `else` then `if`, | = help: Convert to `elif` -Suggested fix: 76 76 | def not_ok3(): 77 77 | if 1: 78 78 | pass @@ -163,7 +158,6 @@ collapsible_else_if.py:87:5: PLR5501 [*] Use `elif` instead of `else` then `if`, | = help: Convert to `elif` -Suggested fix: 84 84 | def not_ok4(): 85 85 | if 1: 86 86 | pass @@ -192,7 +186,6 @@ collapsible_else_if.py:96:5: PLR5501 [*] Use `elif` instead of `else` then `if`, | = help: Convert to `elif` -Suggested fix: 93 93 | def not_ok5(): 94 94 | if 1: 95 95 | pass diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap index 0b6977b48c4f2..74a5c92b04c92 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap @@ -12,7 +12,6 @@ non_augmented_assignment.py:16:1: PLR6104 [*] Use `+=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 13 13 | some_set = {"elem"} 14 14 | mat1, mat2 = None, None 15 15 | @@ -34,7 +33,6 @@ non_augmented_assignment.py:17:1: PLR6104 [*] Use `-=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 14 14 | mat1, mat2 = None, None 15 15 | 16 16 | some_string = some_string + "a very long end of string" @@ -57,7 +55,6 @@ non_augmented_assignment.py:18:1: PLR6104 [*] Use `+=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 15 15 | 16 16 | some_string = some_string + "a very long end of string" 17 17 | index = index - 1 @@ -80,7 +77,6 @@ non_augmented_assignment.py:19:1: PLR6104 [*] Use `|=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 16 16 | some_string = some_string + "a very long end of string" 17 17 | index = index - 1 18 18 | a_list = a_list + ["to concat"] @@ -103,7 +99,6 @@ non_augmented_assignment.py:20:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 17 17 | index = index - 1 18 18 | a_list = a_list + ["to concat"] 19 19 | some_set = some_set | {"to concat"} @@ -126,7 +121,6 @@ non_augmented_assignment.py:21:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 18 18 | a_list = a_list + ["to concat"] 19 19 | some_set = some_set | {"to concat"} 20 20 | to_multiply = to_multiply * 5 @@ -149,7 +143,6 @@ non_augmented_assignment.py:22:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 19 19 | some_set = some_set | {"to concat"} 20 20 | to_multiply = to_multiply * 5 21 21 | to_multiply = 5 * to_multiply @@ -172,7 +165,6 @@ non_augmented_assignment.py:23:1: PLR6104 [*] Use `/=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 20 20 | to_multiply = to_multiply * 5 21 21 | to_multiply = 5 * to_multiply 22 22 | to_multiply = to_multiply * to_multiply @@ -195,7 +187,6 @@ non_augmented_assignment.py:24:1: PLR6104 [*] Use `//=` to perform an augmented | = help: Replace with augmented assignment -Suggested fix: 21 21 | to_multiply = 5 * to_multiply 22 22 | to_multiply = to_multiply * to_multiply 23 23 | to_divide = to_divide / 5 @@ -218,7 +209,6 @@ non_augmented_assignment.py:25:1: PLR6104 [*] Use `**=` to perform an augmented | = help: Replace with augmented assignment -Suggested fix: 22 22 | to_multiply = to_multiply * to_multiply 23 23 | to_divide = to_divide / 5 24 24 | to_divide = to_divide // 5 @@ -241,7 +231,6 @@ non_augmented_assignment.py:27:1: PLR6104 [*] Use `**=` to perform an augmented | = help: Replace with augmented assignment -Suggested fix: 24 24 | to_divide = to_divide // 5 25 25 | to_cube = to_cube**3 26 26 | to_cube = 3**to_cube @@ -264,7 +253,6 @@ non_augmented_assignment.py:28:1: PLR6104 [*] Use `%=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 25 25 | to_cube = to_cube**3 26 26 | to_cube = 3**to_cube 27 27 | to_cube = to_cube**to_cube @@ -287,7 +275,6 @@ non_augmented_assignment.py:29:1: PLR6104 [*] Use `&=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 26 26 | to_cube = 3**to_cube 27 27 | to_cube = to_cube**to_cube 28 28 | timeDiffSeconds = timeDiffSeconds % 60 @@ -310,7 +297,6 @@ non_augmented_assignment.py:30:1: PLR6104 [*] Use `|=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 27 27 | to_cube = to_cube**to_cube 28 28 | timeDiffSeconds = timeDiffSeconds % 60 29 29 | flags = flags & 0x1 @@ -333,7 +319,6 @@ non_augmented_assignment.py:31:1: PLR6104 [*] Use `^=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 28 28 | timeDiffSeconds = timeDiffSeconds % 60 29 29 | flags = flags & 0x1 30 30 | flags = flags | 0x1 @@ -356,7 +341,6 @@ non_augmented_assignment.py:32:1: PLR6104 [*] Use `<<=` to perform an augmented | = help: Replace with augmented assignment -Suggested fix: 29 29 | flags = flags & 0x1 30 30 | flags = flags | 0x1 31 31 | flags = flags ^ 0x1 @@ -379,7 +363,6 @@ non_augmented_assignment.py:33:1: PLR6104 [*] Use `>>=` to perform an augmented | = help: Replace with augmented assignment -Suggested fix: 30 30 | flags = flags | 0x1 31 31 | flags = flags ^ 0x1 32 32 | flags = flags << 1 @@ -401,7 +384,6 @@ non_augmented_assignment.py:34:1: PLR6104 [*] Use `@=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 31 31 | flags = flags ^ 0x1 32 32 | flags = flags << 1 33 33 | flags = flags >> 1 @@ -424,7 +406,6 @@ non_augmented_assignment.py:35:1: PLR6104 [*] Use `+=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 32 32 | flags = flags << 1 33 33 | flags = flags >> 1 34 34 | mat1 = mat1 @ mat2 @@ -447,7 +428,6 @@ non_augmented_assignment.py:37:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 34 34 | mat1 = mat1 @ mat2 35 35 | a_list[1] = a_list[1] + 1 36 36 | @@ -469,7 +449,6 @@ non_augmented_assignment.py:38:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 35 35 | a_list[1] = a_list[1] + 1 36 36 | 37 37 | a_list[0:2] = a_list[0:2] * 3 @@ -491,7 +470,6 @@ non_augmented_assignment.py:39:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 36 36 | 37 37 | a_list[0:2] = a_list[0:2] * 3 38 38 | a_list[:2] = a_list[:2] * 3 @@ -514,7 +492,6 @@ non_augmented_assignment.py:40:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 37 37 | a_list[0:2] = a_list[0:2] * 3 38 38 | a_list[:2] = a_list[:2] * 3 39 39 | a_list[1:] = a_list[1:] * 3 @@ -535,7 +512,6 @@ non_augmented_assignment.py:42:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 39 39 | a_list[1:] = a_list[1:] * 3 40 40 | a_list[:] = a_list[:] * 3 41 41 | @@ -556,7 +532,6 @@ non_augmented_assignment.py:47:9: PLR6104 [*] Use `+=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 44 44 | 45 45 | class T: 46 46 | def t(self): @@ -578,7 +553,6 @@ non_augmented_assignment.py:51:1: PLR6104 [*] Use `+=` to perform an augmented a | = help: Replace with augmented assignment -Suggested fix: 48 48 | 49 49 | 50 50 | obj = T() diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6201_literal_membership.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6201_literal_membership.py.snap index 7db505fc27a9e..375040b494656 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6201_literal_membership.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6201_literal_membership.py.snap @@ -11,7 +11,6 @@ literal_membership.py:2:6: PLR6201 [*] Use a set literal when testing for member | = help: Convert to `set` -Suggested fix: 1 1 | # Errors 2 |-1 in [1, 2, 3] 2 |+1 in {1, 2, 3} @@ -32,7 +31,6 @@ literal_membership.py:3:6: PLR6201 [*] Use a set literal when testing for member | = help: Convert to `set` -Suggested fix: 1 1 | # Errors 2 2 | 1 in [1, 2, 3] 3 |-1 in (1, 2, 3) @@ -57,7 +55,6 @@ literal_membership.py:4:6: PLR6201 [*] Use a set literal when testing for member | = help: Convert to `set` -Suggested fix: 1 1 | # Errors 2 2 | 1 in [1, 2, 3] 3 3 | 1 in (1, 2, 3) @@ -83,7 +80,6 @@ literal_membership.py:9:70: PLR6201 [*] Use a set literal when testing for membe | = help: Convert to `set` -Suggested fix: 6 6 | ) 7 7 | fruits = ["cherry", "grapes"] 8 8 | "cherry" in fruits diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap index d4e5184f9ca05..b2673a2f450a9 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap @@ -9,7 +9,6 @@ unnecessary_lambda.py:1:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -Suggested fix: 1 |-_ = lambda: print() # [unnecessary-lambda] 1 |+_ = print # [unnecessary-lambda] 2 2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda] @@ -28,7 +27,6 @@ unnecessary_lambda.py:2:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -Suggested fix: 1 1 | _ = lambda: print() # [unnecessary-lambda] 2 |-_ = lambda x, y: min(x, y) # [unnecessary-lambda] 2 |+_ = min # [unnecessary-lambda] @@ -49,7 +47,6 @@ unnecessary_lambda.py:4:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -Suggested fix: 1 1 | _ = lambda: print() # [unnecessary-lambda] 2 2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda] 3 3 | @@ -71,7 +68,6 @@ unnecessary_lambda.py:5:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -Suggested fix: 2 2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda] 3 3 | 4 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] @@ -93,7 +89,6 @@ unnecessary_lambda.py:6:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -Suggested fix: 3 3 | 4 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] 5 5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda] @@ -116,7 +111,6 @@ unnecessary_lambda.py:7:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -Suggested fix: 4 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] 5 5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda] 6 6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda] @@ -138,7 +132,6 @@ unnecessary_lambda.py:9:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -Suggested fix: 6 6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda] 7 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] 8 8 | @@ -160,7 +153,6 @@ unnecessary_lambda.py:10:5: PLW0108 [*] Lambda may be unnecessary; consider inli | = help: Inline function call -Suggested fix: 7 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] 8 8 | 9 9 | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda] diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap index 77e90922c540f..8c88e0a14357e 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap @@ -12,7 +12,6 @@ useless_else_on_loop.py:9:5: PLW0120 [*] `else` clause on loop without a `break` | = help: Remove `else` -Suggested fix: 6 6 | for i in range(10): 7 7 | if i % 2: 8 8 | return i @@ -36,7 +35,6 @@ useless_else_on_loop.py:18:5: PLW0120 [*] `else` clause on loop without a `break | = help: Remove `else` -Suggested fix: 15 15 | """else + return is not acceptable.""" 16 16 | while True: 17 17 | return 1 @@ -59,7 +57,6 @@ useless_else_on_loop.py:30:1: PLW0120 [*] `else` clause on loop without a `break | = help: Remove `else` -Suggested fix: 27 27 | for _ in range(10): 28 28 | break 29 29 | @@ -82,7 +79,6 @@ useless_else_on_loop.py:37:1: PLW0120 [*] `else` clause on loop without a `break | = help: Remove `else` -Suggested fix: 34 34 | while True: 35 35 | while False: 36 36 | break @@ -106,7 +102,6 @@ useless_else_on_loop.py:42:1: PLW0120 [*] `else` clause on loop without a `break | = help: Remove `else` -Suggested fix: 39 39 | 40 40 | for j in range(10): 41 41 | pass @@ -134,7 +129,6 @@ useless_else_on_loop.py:88:5: PLW0120 [*] `else` clause on loop without a `break | = help: Remove `else` -Suggested fix: 85 85 | break 86 86 | else: 87 87 | print("all right") @@ -158,7 +152,6 @@ useless_else_on_loop.py:98:9: PLW0120 [*] `else` clause on loop without a `break | = help: Remove `else` -Suggested fix: 95 95 | for _ in range(10): 96 96 | for _ in range(3): 97 97 | pass @@ -184,7 +177,6 @@ useless_else_on_loop.py:144:5: PLW0120 [*] `else` clause on loop without a `brea | = help: Remove `else` -Suggested fix: 141 141 | """Retain the comment within the `else` block""" 142 142 | for j in range(10): 143 143 | pass diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap index 08399d7b2b302..ea0c5caa9be7d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap @@ -10,7 +10,6 @@ useless_exception_statement.py:7:5: PLW0133 [*] Missing `raise` statement on exc | = help: Add `raise` keyword -Suggested fix: 4 4 | 5 5 | # Test case 1: Useless exception statement 6 6 | def func(): @@ -33,7 +32,6 @@ useless_exception_statement.py:13:9: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -Suggested fix: 10 10 | # Test case 2: Useless exception statement in try-except block 11 11 | def func(): 12 12 | try: @@ -54,7 +52,6 @@ useless_exception_statement.py:21:9: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -Suggested fix: 18 18 | # Test case 3: Useless exception statement in if statement 19 19 | def func(): 20 20 | if True: @@ -75,7 +72,6 @@ useless_exception_statement.py:28:13: PLW0133 [*] Missing `raise` statement on e | = help: Add `raise` keyword -Suggested fix: 25 25 | def func(): 26 26 | class Class: 27 27 | def __init__(self): @@ -98,7 +94,6 @@ useless_exception_statement.py:34:9: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -Suggested fix: 31 31 | # Test case 5: Useless exception statement in function 32 32 | def func(): 33 33 | def inner(): @@ -119,7 +114,6 @@ useless_exception_statement.py:42:9: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -Suggested fix: 39 39 | # Test case 6: Useless exception statement in while loop 40 40 | def func(): 41 41 | while True: @@ -140,7 +134,6 @@ useless_exception_statement.py:50:13: PLW0133 [*] Missing `raise` statement on e | = help: Add `raise` keyword -Suggested fix: 47 47 | class Class(ABC): 48 48 | @abstractmethod 49 49 | def method(self): @@ -161,7 +154,6 @@ useless_exception_statement.py:56:9: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -Suggested fix: 53 53 | # Test case 8: Useless exception statement inside context manager 54 54 | def func(): 55 55 | with suppress(AttributeError): @@ -182,7 +174,6 @@ useless_exception_statement.py:61:5: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -Suggested fix: 58 58 | 59 59 | # Test case 9: Useless exception statement in parentheses 60 60 | def func(): @@ -203,7 +194,6 @@ useless_exception_statement.py:66:12: PLW0133 [*] Missing `raise` statement on e | = help: Add `raise` keyword -Suggested fix: 63 63 | 64 64 | # Test case 10: Useless exception statement in continuation 65 65 | def func(): @@ -224,7 +214,6 @@ useless_exception_statement.py:71:5: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -Suggested fix: 68 68 | 69 69 | # Test case 11: Useless warning statement 70 70 | def func(): diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0245_super_without_brackets.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0245_super_without_brackets.py.snap index 4c3c308f590b0..dbbe105188267 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0245_super_without_brackets.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0245_super_without_brackets.py.snap @@ -11,7 +11,6 @@ super_without_brackets.py:10:26: PLW0245 [*] `super` call is missing parentheses | = help: Add parentheses to `super` call -Suggested fix: 7 7 | class BadDog(Animal): 8 8 | @staticmethod 9 9 | def speak(): diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap index db9f3f126c3a3..a85eab5ca8d09 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap @@ -11,7 +11,6 @@ subprocess_run_without_check.py:4:1: PLW1510 [*] `subprocess.run` without explic | = help: Add explicit `check=False` -Suggested fix: 1 1 | import subprocess 2 2 | 3 3 | # Errors. @@ -34,7 +33,6 @@ subprocess_run_without_check.py:5:1: PLW1510 [*] `subprocess.run` without explic | = help: Add explicit `check=False` -Suggested fix: 2 2 | 3 3 | # Errors. 4 4 | subprocess.run("ls") @@ -57,7 +55,6 @@ subprocess_run_without_check.py:6:1: PLW1510 [*] `subprocess.run` without explic | = help: Add explicit `check=False` -Suggested fix: 5 5 | subprocess.run("ls", shell=True) 6 6 | subprocess.run( 7 7 | ["ls"], @@ -80,7 +77,6 @@ subprocess_run_without_check.py:10:1: PLW1510 [*] `subprocess.run` without expli | = help: Add explicit `check=False` -Suggested fix: 7 7 | ["ls"], 8 8 | shell=False, 9 9 | ) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap index eba3ae1705741..2774a92a8ea18 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap @@ -11,7 +11,6 @@ unspecified_encoding.py:8:1: PLW1514 [*] `open` in text mode without explicit `e | = help: Add explicit `encoding` argument -Suggested fix: 5 5 | import codecs 6 6 | 7 7 | # Errors. @@ -34,7 +33,6 @@ unspecified_encoding.py:9:1: PLW1514 [*] `io.TextIOWrapper` without explicit `en | = help: Add explicit `encoding` argument -Suggested fix: 6 6 | 7 7 | # Errors. 8 8 | open("test.txt") @@ -57,7 +55,6 @@ unspecified_encoding.py:10:1: PLW1514 [*] `io.TextIOWrapper` without explicit `e | = help: Add explicit `encoding` argument -Suggested fix: 7 7 | # Errors. 8 8 | open("test.txt") 9 9 | io.TextIOWrapper(io.FileIO("test.txt")) @@ -80,7 +77,6 @@ unspecified_encoding.py:11:1: PLW1514 [*] `tempfile.NamedTemporaryFile` in text | = help: Add explicit `encoding` argument -Suggested fix: 8 8 | open("test.txt") 9 9 | io.TextIOWrapper(io.FileIO("test.txt")) 10 10 | hugo.TextIOWrapper(hugo.FileIO("test.txt")) @@ -103,7 +99,6 @@ unspecified_encoding.py:12:1: PLW1514 [*] `tempfile.TemporaryFile` in text mode | = help: Add explicit `encoding` argument -Suggested fix: 9 9 | io.TextIOWrapper(io.FileIO("test.txt")) 10 10 | hugo.TextIOWrapper(hugo.FileIO("test.txt")) 11 11 | tempfile.NamedTemporaryFile("w") @@ -125,7 +120,6 @@ unspecified_encoding.py:13:1: PLW1514 [*] `codecs.open` in text mode without exp | = help: Add explicit `encoding` argument -Suggested fix: 10 10 | hugo.TextIOWrapper(hugo.FileIO("test.txt")) 11 11 | tempfile.NamedTemporaryFile("w") 12 12 | tempfile.TemporaryFile("w") @@ -148,7 +142,6 @@ unspecified_encoding.py:14:1: PLW1514 [*] `tempfile.SpooledTemporaryFile` in tex | = help: Add explicit `encoding` argument -Suggested fix: 11 11 | tempfile.NamedTemporaryFile("w") 12 12 | tempfile.TemporaryFile("w") 13 13 | codecs.open("test.txt") @@ -171,7 +164,6 @@ unspecified_encoding.py:46:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -Suggested fix: 43 43 | tempfile.SpooledTemporaryFile(0, "wb") 44 44 | tempfile.SpooledTemporaryFile(0, ) 45 45 | @@ -193,7 +185,6 @@ unspecified_encoding.py:47:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -Suggested fix: 44 44 | tempfile.SpooledTemporaryFile(0, ) 45 45 | 46 46 | open("test.txt",) @@ -216,7 +207,6 @@ unspecified_encoding.py:48:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -Suggested fix: 46 46 | open("test.txt",) 47 47 | open() 48 48 | open( @@ -239,7 +229,6 @@ unspecified_encoding.py:51:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -Suggested fix: 49 49 | "test.txt", # comment 50 50 | ) 51 51 | open( @@ -262,7 +251,6 @@ unspecified_encoding.py:55:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -Suggested fix: 52 52 | "test.txt", 53 53 | # comment 54 54 | ) @@ -285,7 +273,6 @@ unspecified_encoding.py:56:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -Suggested fix: 54 54 | ) 55 55 | open(("test.txt"),) 56 56 | open( @@ -308,7 +295,6 @@ unspecified_encoding.py:59:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -Suggested fix: 57 57 | ("test.txt"), # comment 58 58 | ) 59 59 | open( @@ -331,7 +317,6 @@ unspecified_encoding.py:64:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -Suggested fix: 61 61 | # comment 62 62 | ) 63 63 | @@ -353,7 +338,6 @@ unspecified_encoding.py:65:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -Suggested fix: 63 63 | 64 64 | open((("test.txt")),) 65 65 | open( @@ -376,7 +360,6 @@ unspecified_encoding.py:68:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -Suggested fix: 66 66 | (("test.txt")), # comment 67 67 | ) 68 68 | open( @@ -398,7 +381,6 @@ unspecified_encoding.py:77:1: PLW1514 [*] `pathlib.Path(...).open` in text mode | = help: Add explicit `encoding` argument -Suggested fix: 74 74 | from pathlib import Path 75 75 | 76 76 | # Errors. @@ -421,7 +403,6 @@ unspecified_encoding.py:78:1: PLW1514 [*] `pathlib.Path(...).open` in text mode | = help: Add explicit `encoding` argument -Suggested fix: 75 75 | 76 76 | # Errors. 77 77 | Path("foo.txt").open() @@ -443,7 +424,6 @@ unspecified_encoding.py:79:8: PLW1514 [*] `pathlib.Path(...).read_text` without | = help: Add explicit `encoding` argument -Suggested fix: 76 76 | # Errors. 77 77 | Path("foo.txt").open() 78 78 | Path("foo.txt").open("w") @@ -466,7 +446,6 @@ unspecified_encoding.py:80:1: PLW1514 [*] `pathlib.Path(...).write_text` without | = help: Add explicit `encoding` argument -Suggested fix: 77 77 | Path("foo.txt").open() 78 78 | Path("foo.txt").open("w") 79 79 | text = Path("foo.txt").read_text() diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap index 3ec76d23410fa..c658e3be9e17f 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap @@ -11,7 +11,6 @@ nested_min_max.py:2:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -Suggested fix: 1 1 | min(1, 2, 3) 2 |-min(1, min(2, 3)) 2 |+min(1, 2, 3) @@ -32,7 +31,6 @@ nested_min_max.py:3:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -Suggested fix: 1 1 | min(1, 2, 3) 2 2 | min(1, min(2, 3)) 3 |-min(1, min(2, min(3, 4))) @@ -54,7 +52,6 @@ nested_min_max.py:3:8: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -Suggested fix: 1 1 | min(1, 2, 3) 2 2 | min(1, min(2, 3)) 3 |-min(1, min(2, min(3, 4))) @@ -76,7 +73,6 @@ nested_min_max.py:4:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -Suggested fix: 1 1 | min(1, 2, 3) 2 2 | min(1, min(2, 3)) 3 3 | min(1, min(2, min(3, 4))) @@ -99,7 +95,6 @@ nested_min_max.py:7:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -Suggested fix: 4 4 | min(1, foo("a", "b"), min(3, 4)) 5 5 | min(1, max(2, 3)) 6 6 | max(1, 2, 3) @@ -121,7 +116,6 @@ nested_min_max.py:8:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -Suggested fix: 5 5 | min(1, max(2, 3)) 6 6 | max(1, 2, 3) 7 7 | max(1, max(2, 3)) @@ -143,7 +137,6 @@ nested_min_max.py:8:8: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -Suggested fix: 5 5 | min(1, max(2, 3)) 6 6 | max(1, 2, 3) 7 7 | max(1, max(2, 3)) @@ -166,7 +159,6 @@ nested_min_max.py:9:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -Suggested fix: 6 6 | max(1, 2, 3) 7 7 | max(1, max(2, 3)) 8 8 | max(1, max(2, max(3, 4))) @@ -189,7 +181,6 @@ nested_min_max.py:15:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -Suggested fix: 12 12 | min(1, min(2, 3), key=test) 13 13 | min(1, min(2, 3, key=test)) 14 14 | # This will still trigger, to merge the calls without keyword args. @@ -224,7 +215,6 @@ nested_min_max.py:24:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -Suggested fix: 21 21 | ) 22 22 | 23 23 | # Handle iterable expressions. @@ -247,7 +237,6 @@ nested_min_max.py:25:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -Suggested fix: 22 22 | 23 23 | # Handle iterable expressions. 24 24 | min(1, min(a)) @@ -269,7 +258,6 @@ nested_min_max.py:26:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -Suggested fix: 23 23 | # Handle iterable expressions. 24 24 | min(1, min(a)) 25 25 | min(1, min(i for i in range(10))) @@ -292,7 +280,6 @@ nested_min_max.py:27:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -Suggested fix: 24 24 | min(1, min(a)) 25 25 | min(1, min(i for i in range(10))) 26 26 | max(1, max(a)) @@ -314,7 +301,6 @@ nested_min_max.py:41:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -Suggested fix: 38 38 | max(max(tuples_list)) 39 39 | 40 40 | # Starred argument should be copied as it is. @@ -334,7 +320,6 @@ nested_min_max.py:44:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -Suggested fix: 41 41 | max(1, max(*a)) 42 42 | 43 43 | import builtins diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP001.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP001.py.snap index fbac30d5c8534..db998b4135e14 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP001.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP001.py.snap @@ -9,7 +9,6 @@ UP001.py:2:5: UP001 [*] `__metaclass__ = type` is implied | = help: Remove `__metaclass__ = type` -Suggested fix: 1 1 | class A: 2 |- __metaclass__ = type 2 |+ pass @@ -29,7 +28,6 @@ UP001.py:6:5: UP001 [*] `__metaclass__ = type` is implied | = help: Remove `__metaclass__ = type` -Suggested fix: 3 3 | 4 4 | 5 5 | class B: diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP003.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP003.py.snap index 046895dad3a6c..f0c8468d37aa1 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP003.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP003.py.snap @@ -10,7 +10,6 @@ UP003.py:1:1: UP003 [*] Use `str` instead of `type(...)` | = help: Replace `type(...)` with `str` -Suggested fix: 1 |-type("") 1 |+str 2 2 | type(b"") @@ -29,7 +28,6 @@ UP003.py:2:1: UP003 [*] Use `bytes` instead of `type(...)` | = help: Replace `type(...)` with `bytes` -Suggested fix: 1 1 | type("") 2 |-type(b"") 2 |+bytes @@ -50,7 +48,6 @@ UP003.py:3:1: UP003 [*] Use `int` instead of `type(...)` | = help: Replace `type(...)` with `int` -Suggested fix: 1 1 | type("") 2 2 | type(b"") 3 |-type(0) @@ -71,7 +68,6 @@ UP003.py:4:1: UP003 [*] Use `float` instead of `type(...)` | = help: Replace `type(...)` with `float` -Suggested fix: 1 1 | type("") 2 2 | type(b"") 3 3 | type(0) @@ -94,7 +90,6 @@ UP003.py:5:1: UP003 [*] Use `complex` instead of `type(...)` | = help: Replace `type(...)` with `complex` -Suggested fix: 2 2 | type(b"") 3 3 | type(0) 4 4 | type(0.0) @@ -114,7 +109,6 @@ UP003.py:14:29: UP003 [*] Use `str` instead of `type(...)` | = help: Replace `type(...)` with `str` -Suggested fix: 11 11 | y = x.dtype.type(0.0) 12 12 | 13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459841 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP004.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP004.py.snap index 0ccafd3c50a58..463684bf16938 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP004.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP004.py.snap @@ -9,7 +9,6 @@ UP004.py:5:9: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 2 2 | ... 3 3 | 4 4 | @@ -31,7 +30,6 @@ UP004.py:10:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 6 6 | ... 7 7 | 8 8 | @@ -55,7 +53,6 @@ UP004.py:16:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 12 12 | ... 13 13 | 14 14 | @@ -81,7 +78,6 @@ UP004.py:24:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 19 19 | ... 20 20 | 21 21 | @@ -107,7 +103,6 @@ UP004.py:31:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 26 26 | ... 27 27 | 28 28 | @@ -132,7 +127,6 @@ UP004.py:37:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 33 33 | ... 34 34 | 35 35 | @@ -158,7 +152,6 @@ UP004.py:45:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 40 40 | ... 41 41 | 42 42 | @@ -185,7 +178,6 @@ UP004.py:53:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 48 48 | ... 49 49 | 50 50 | @@ -212,7 +204,6 @@ UP004.py:61:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 56 56 | ... 57 57 | 58 58 | @@ -239,7 +230,6 @@ UP004.py:69:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 64 64 | ... 65 65 | 66 66 | @@ -263,7 +253,6 @@ UP004.py:75:12: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 72 72 | ... 73 73 | 74 74 | @@ -283,7 +272,6 @@ UP004.py:79:9: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 76 76 | ... 77 77 | 78 78 | @@ -305,7 +293,6 @@ UP004.py:84:5: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 81 81 | 82 82 | 83 83 | class B( @@ -327,7 +314,6 @@ UP004.py:92:5: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 89 89 | 90 90 | class B( 91 91 | A, @@ -348,7 +334,6 @@ UP004.py:98:5: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 95 95 | 96 96 | 97 97 | class B( @@ -370,7 +355,6 @@ UP004.py:108:5: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 105 105 | class B( 106 106 | # Comment on A. 107 107 | A, @@ -391,7 +375,6 @@ UP004.py:119:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 115 115 | ... 116 116 | 117 117 | @@ -415,7 +398,6 @@ UP004.py:125:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 121 121 | ... 122 122 | 123 123 | @@ -439,7 +421,6 @@ UP004.py:131:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 127 127 | ... 128 128 | 129 129 | @@ -462,7 +443,6 @@ UP004.py:137:9: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 134 134 | ... 135 135 | 136 136 | @@ -482,7 +462,6 @@ UP004.py:137:17: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 134 134 | ... 135 135 | 136 136 | @@ -503,7 +482,6 @@ UP004.py:142:9: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 139 139 | 140 140 | 141 141 | @decorator() @@ -524,7 +502,6 @@ UP004.py:146:9: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 143 143 | ... 144 144 | 145 145 | @decorator() # class A(object): @@ -546,7 +523,6 @@ UP004.py:159:15: UP004 [*] Class `Unusual` inherits from `object` | = help: Remove `object` inheritance -Suggested fix: 156 156 | 157 157 | import builtins 158 158 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap index 87fc9c41ac2f8..704e53e70100f 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap @@ -12,7 +12,6 @@ UP005.py:6:9: UP005 [*] `assertEquals` is deprecated, use `assertEqual` | = help: Replace `assertEqual` with `assertEquals` -Suggested fix: 3 3 | 4 4 | class Suite(unittest.TestCase): 5 5 | def test(self) -> None: @@ -35,7 +34,6 @@ UP005.py:7:9: UP005 [*] `assertEquals` is deprecated, use `assertEqual` | = help: Replace `assertEqual` with `assertEquals` -Suggested fix: 4 4 | class Suite(unittest.TestCase): 5 5 | def test(self) -> None: 6 6 | self.assertEquals (1, 2) @@ -57,7 +55,6 @@ UP005.py:9:9: UP005 [*] `failUnlessAlmostEqual` is deprecated, use `assertAlmost | = help: Replace `assertAlmostEqual` with `failUnlessAlmostEqual` -Suggested fix: 6 6 | self.assertEquals (1, 2) 7 7 | self.assertEquals(1, 2) 8 8 | self.assertEqual(3, 4) @@ -76,7 +73,6 @@ UP005.py:10:9: UP005 [*] `assertNotRegexpMatches` is deprecated, use `assertNotR | = help: Replace `assertNotRegex` with `assertNotRegexpMatches` -Suggested fix: 7 7 | self.assertEquals(1, 2) 8 8 | self.assertEqual(3, 4) 9 9 | self.failUnlessAlmostEqual(1, 1.1) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap index c55f00adc9e72..662ac44c7aaa4 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap @@ -9,7 +9,6 @@ UP006_0.py:4:10: UP006 [*] Use `list` instead of `typing.List` for type annotati | = help: Replace with `list` -Suggested fix: 1 1 | import typing 2 2 | 3 3 | @@ -29,7 +28,6 @@ UP006_0.py:11:10: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -Suggested fix: 8 8 | from typing import List 9 9 | 10 10 | @@ -49,7 +47,6 @@ UP006_0.py:18:10: UP006 [*] Use `list` instead of `t.List` for type annotation | = help: Replace with `list` -Suggested fix: 15 15 | import typing as t 16 16 | 17 17 | @@ -69,7 +66,6 @@ UP006_0.py:25:10: UP006 [*] Use `list` instead of `IList` for type annotation | = help: Replace with `list` -Suggested fix: 22 22 | from typing import List as IList 23 23 | 24 24 | @@ -89,7 +85,6 @@ UP006_0.py:29:11: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -Suggested fix: 26 26 | ... 27 27 | 28 28 | @@ -109,7 +104,6 @@ UP006_0.py:33:12: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -Suggested fix: 30 30 | ... 31 31 | 32 32 | @@ -129,7 +123,6 @@ UP006_0.py:37:11: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -Suggested fix: 34 34 | ... 35 35 | 36 36 | @@ -149,7 +142,6 @@ UP006_0.py:41:13: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -Suggested fix: 38 38 | ... 39 39 | 40 40 | @@ -177,7 +169,6 @@ UP006_0.py:49:11: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -Suggested fix: 46 46 | ... 47 47 | 48 48 | @@ -197,7 +188,6 @@ UP006_0.py:49:17: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -Suggested fix: 46 46 | ... 47 47 | 48 48 | @@ -217,7 +207,6 @@ UP006_0.py:53:11: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -Suggested fix: 50 50 | ... 51 51 | 52 52 | @@ -261,7 +250,6 @@ UP006_0.py:61:10: UP006 [*] Use `collections.deque` instead of `typing.Deque` fo | = help: Replace with `collections.deque` -Suggested fix: 20 20 | 21 21 | 22 22 | from typing import List as IList @@ -289,7 +277,6 @@ UP006_0.py:65:10: UP006 [*] Use `collections.defaultdict` instead of `typing.Def | = help: Replace with `collections.defaultdict` -Suggested fix: 20 20 | 21 21 | 22 22 | from typing import List as IList diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap index 38e58596fbeca..3551787421b95 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap @@ -9,7 +9,6 @@ UP006_1.py:9:10: UP006 [*] Use `collections.defaultdict` instead of `typing.Defa | = help: Replace with `collections.defaultdict` -Suggested fix: 6 6 | from collections import defaultdict 7 7 | 8 8 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap index 8d8fb7e0eba7e..be7713f8e5202 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap @@ -9,7 +9,6 @@ UP006_3.py:7:11: UP006 [*] Use `collections.defaultdict` instead of `typing.Defa | = help: Replace with `collections.defaultdict` -Suggested fix: 4 4 | from collections import defaultdict 5 5 | 6 6 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap index 2ed628134f1a6..84ab950d987fe 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap @@ -9,7 +9,6 @@ UP007.py:6:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 3 3 | from typing import Union 4 4 | 5 5 | @@ -29,7 +28,6 @@ UP007.py:10:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 7 7 | ... 8 8 | 9 9 | @@ -49,7 +47,6 @@ UP007.py:14:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 11 11 | ... 12 12 | 13 13 | @@ -69,7 +66,6 @@ UP007.py:14:26: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 11 11 | ... 12 12 | 13 13 | @@ -89,7 +85,6 @@ UP007.py:18:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 15 15 | ... 16 16 | 17 17 | @@ -109,7 +104,6 @@ UP007.py:22:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 19 19 | ... 20 20 | 21 21 | @@ -129,7 +123,6 @@ UP007.py:26:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 23 23 | ... 24 24 | 25 25 | @@ -149,7 +142,6 @@ UP007.py:30:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 27 27 | ... 28 28 | 29 29 | @@ -169,7 +161,6 @@ UP007.py:34:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 31 31 | ... 32 32 | 33 33 | @@ -189,7 +180,6 @@ UP007.py:38:11: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 35 35 | ... 36 36 | 37 37 | @@ -209,7 +199,6 @@ UP007.py:38:27: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 35 35 | ... 36 36 | 37 37 | @@ -229,7 +218,6 @@ UP007.py:42:11: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 39 39 | ... 40 40 | 41 41 | @@ -250,7 +238,6 @@ UP007.py:55:8: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 52 52 | 53 53 | 54 54 | def f() -> None: @@ -294,7 +281,6 @@ UP007.py:60:8: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 57 57 | 58 58 | x = Union[str, int] 59 59 | x = Union["str", "int"] @@ -315,7 +301,6 @@ UP007.py:61:8: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 58 58 | x = Union[str, int] 59 59 | x = Union["str", "int"] 60 60 | x: Union[str, int] @@ -412,7 +397,6 @@ UP007.py:102:28: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 99 99 | 100 100 | # Regression test for: https://github.com/astral-sh/ruff/issues/7131 101 101 | class ServiceRefOrValue: @@ -436,7 +420,6 @@ UP007.py:110:28: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 107 107 | 108 108 | # Regression test for: https://github.com/astral-sh/ruff/issues/7201 109 109 | class ServiceRefOrValue: @@ -457,7 +440,6 @@ UP007.py:120:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 117 117 | 118 118 | 119 119 | # Regression test for: https://github.com/astral-sh/ruff/issues/8609 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap index da6e68284da36..6e5020ea41d8c 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap @@ -11,7 +11,6 @@ UP008.py:17:23: UP008 [*] Use `super()` instead of `super(__class__, self)` | = help: Remove `__super__` parameters -ℹ Unsafe fix 14 14 | Parent.super(1, 2) # ok 15 15 | 16 16 | def wrong(self): @@ -21,6 +20,8 @@ UP008.py:17:23: UP008 [*] Use `super()` instead of `super(__class__, self)` 19 19 | super( 20 20 | Child, + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP008.py:18:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | 16 | def wrong(self): @@ -32,7 +33,6 @@ UP008.py:18:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | = help: Remove `__super__` parameters -ℹ Unsafe fix 15 15 | 16 16 | def wrong(self): 17 17 | parent = super(Child, self) # wrong @@ -42,6 +42,8 @@ UP008.py:18:14: UP008 [*] Use `super()` instead of `super(__class__, self)` 20 20 | Child, 21 21 | self, + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP008.py:19:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | 17 | parent = super(Child, self) # wrong @@ -55,7 +57,6 @@ UP008.py:19:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | = help: Remove `__super__` parameters -ℹ Unsafe fix 16 16 | def wrong(self): 17 17 | parent = super(Child, self) # wrong 18 18 | super(Child, self).method # wrong @@ -68,6 +69,8 @@ UP008.py:19:14: UP008 [*] Use `super()` instead of `super(__class__, self)` 24 21 | 25 22 | class BaseClass: + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP008.py:36:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | 34 | class MyClass(BaseClass): @@ -78,7 +81,6 @@ UP008.py:36:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | = help: Remove `__super__` parameters -ℹ Unsafe fix 33 33 | 34 34 | class MyClass(BaseClass): 35 35 | def normal(self): @@ -88,6 +90,8 @@ UP008.py:36:14: UP008 [*] Use `super()` instead of `super(__class__, self)` 38 38 | 39 39 | def different_argument(self, other): + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP008.py:50:18: UP008 [*] Use `super()` instead of `super(__class__, self)` | 49 | def inner_argument(self): @@ -97,7 +101,6 @@ UP008.py:50:18: UP008 [*] Use `super()` instead of `super(__class__, self)` | = help: Remove `__super__` parameters -ℹ Unsafe fix 47 47 | super(MyClass, self).f() # CANNOT use super() 48 48 | 49 49 | def inner_argument(self): @@ -107,6 +110,8 @@ UP008.py:50:18: UP008 [*] Use `super()` instead of `super(__class__, self)` 52 52 | 53 53 | outer_argument() + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP008.py:74:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | 72 | class DataClass: @@ -117,7 +122,6 @@ UP008.py:74:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | = help: Remove `__super__` parameters -ℹ Unsafe fix 71 71 | @dataclass 72 72 | class DataClass: 73 73 | def normal(self): @@ -125,4 +129,6 @@ UP008.py:74:14: UP008 [*] Use `super()` instead of `super(__class__, self)` 74 |+ super().f() # Error 75 75 | super().f() # OK 76 76 | -77 77 | +77 77 | + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_0.py.snap index 9573c7c72b889..35d4d69b580de 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_0.py.snap @@ -10,7 +10,6 @@ UP009_0.py:1:1: UP009 [*] UTF-8 encoding declaration is unnecessary | = help: Remove unnecessary coding comment -Suggested fix: 1 |-# coding=utf8 2 1 | 3 2 | print("Hello world") diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_1.py.snap index 5fbc80587022b..745d5e6ccddc9 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_1.py.snap @@ -11,7 +11,6 @@ UP009_1.py:2:1: UP009 [*] UTF-8 encoding declaration is unnecessary | = help: Remove unnecessary coding comment -Suggested fix: 1 1 | #!/usr/bin/python 2 |-# -*- coding: utf-8 -*- 3 2 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_6.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_6.py.snap index 9f0b065b0bbf9..93efa1ab1cf4f 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_6.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_6.py.snap @@ -9,7 +9,6 @@ UP009_6.py:1:2: UP009 [*] UTF-8 encoding declaration is unnecessary | = help: Remove unnecessary coding comment -Suggested fix: 1 |- # coding=utf8 2 1 | print("Hello world") 3 2 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_7.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_7.py.snap index bbd6be37d42d6..81b5f0e10e4c7 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_7.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_7.py.snap @@ -9,7 +9,6 @@ UP009_7.py:1:2: UP009 [*] UTF-8 encoding declaration is unnecessary | = help: Remove unnecessary coding comment -Suggested fix: 1 |- # coding=utf8 2 1 | print("Hello world") 3 2 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap index 4a54d87c03004..19df38775639e 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap @@ -10,7 +10,6 @@ UP010.py:1:1: UP010 [*] Unnecessary `__future__` imports `generators`, `nested_s | = help: Remove unnecessary `__future__` import -Suggested fix: 1 |-from __future__ import nested_scopes, generators 2 1 | from __future__ import with_statement, unicode_literals 3 2 | from __future__ import absolute_import, division @@ -28,7 +27,6 @@ UP010.py:2:1: UP010 [*] Unnecessary `__future__` imports `unicode_literals`, `wi | = help: Remove unnecessary `__future__` import -Suggested fix: 1 1 | from __future__ import nested_scopes, generators 2 |-from __future__ import with_statement, unicode_literals 3 2 | from __future__ import absolute_import, division @@ -48,7 +46,6 @@ UP010.py:3:1: UP010 [*] Unnecessary `__future__` imports `absolute_import`, `div | = help: Remove unnecessary `__future__` import -Suggested fix: 1 1 | from __future__ import nested_scopes, generators 2 2 | from __future__ import with_statement, unicode_literals 3 |-from __future__ import absolute_import, division @@ -69,7 +66,6 @@ UP010.py:4:1: UP010 [*] Unnecessary `__future__` import `generator_stop` for tar | = help: Remove unnecessary `__future__` import -Suggested fix: 1 1 | from __future__ import nested_scopes, generators 2 2 | from __future__ import with_statement, unicode_literals 3 3 | from __future__ import absolute_import, division @@ -90,7 +86,6 @@ UP010.py:5:1: UP010 [*] Unnecessary `__future__` imports `generator_stop`, `prin | = help: Remove unnecessary `__future__` import -Suggested fix: 2 2 | from __future__ import with_statement, unicode_literals 3 3 | from __future__ import absolute_import, division 4 4 | from __future__ import generator_stop @@ -112,7 +107,6 @@ UP010.py:6:1: UP010 [*] Unnecessary `__future__` import `generators` for target | = help: Remove unnecessary `__future__` import -Suggested fix: 3 3 | from __future__ import absolute_import, division 4 4 | from __future__ import generator_stop 5 5 | from __future__ import print_function, generator_stop @@ -133,7 +127,6 @@ UP010.py:9:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for tar | = help: Remove unnecessary `__future__` import -Suggested fix: 6 6 | from __future__ import invalid_module, generators 7 7 | 8 8 | if True: @@ -155,7 +148,6 @@ UP010.py:10:5: UP010 [*] Unnecessary `__future__` import `generators` for target | = help: Remove unnecessary `__future__` import -Suggested fix: 7 7 | 8 8 | if True: 9 9 | from __future__ import generator_stop @@ -175,7 +167,6 @@ UP010.py:13:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for ta | = help: Remove unnecessary `__future__` import -Suggested fix: 10 10 | from __future__ import generators 11 11 | 12 12 | if True: @@ -193,7 +184,6 @@ UP010.py:14:5: UP010 [*] Unnecessary `__future__` import `generators` for target | = help: Remove unnecessary `__future__` import -Suggested fix: 11 11 | 12 12 | if True: 13 13 | from __future__ import generator_stop diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP011.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP011.py.snap index b866ae2f00384..a86cc25f837f1 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP011.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP011.py.snap @@ -10,7 +10,6 @@ UP011.py:5:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` | = help: Remove unnecessary parentheses -Suggested fix: 2 2 | from functools import lru_cache 3 3 | 4 4 | @@ -31,7 +30,6 @@ UP011.py:10:11: UP011 [*] Unnecessary parentheses to `functools.lru_cache` | = help: Remove unnecessary parentheses -Suggested fix: 7 7 | pass 8 8 | 9 9 | @@ -53,7 +51,6 @@ UP011.py:16:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` | = help: Remove unnecessary parentheses -Suggested fix: 13 13 | 14 14 | 15 15 | @other_decorator @@ -74,7 +71,6 @@ UP011.py:21:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` | = help: Remove unnecessary parentheses -Suggested fix: 18 18 | pass 19 19 | 20 20 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP012.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP012.py.snap index 0d68336762953..7e5d14c1a7c00 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP012.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP012.py.snap @@ -11,7 +11,6 @@ UP012.py:2:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 1 1 | # ASCII literals should be replaced by a bytes literal 2 |-"foo".encode("utf-8") # b"foo" 2 |+b"foo" # b"foo" @@ -32,7 +31,6 @@ UP012.py:3:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 1 1 | # ASCII literals should be replaced by a bytes literal 2 2 | "foo".encode("utf-8") # b"foo" 3 |-"foo".encode("u8") # b"foo" @@ -54,7 +52,6 @@ UP012.py:4:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 1 1 | # ASCII literals should be replaced by a bytes literal 2 2 | "foo".encode("utf-8") # b"foo" 3 3 | "foo".encode("u8") # b"foo" @@ -77,7 +74,6 @@ UP012.py:5:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 2 2 | "foo".encode("utf-8") # b"foo" 3 3 | "foo".encode("u8") # b"foo" 4 4 | "foo".encode() # b"foo" @@ -100,7 +96,6 @@ UP012.py:6:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 3 3 | "foo".encode("u8") # b"foo" 4 4 | "foo".encode() # b"foo" 5 5 | "foo".encode("UTF8") # b"foo" @@ -123,7 +118,6 @@ UP012.py:7:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 4 4 | "foo".encode() # b"foo" 5 5 | "foo".encode("UTF8") # b"foo" 6 6 | U"foo".encode("utf-8") # b"foo" @@ -152,7 +146,6 @@ UP012.py:8:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 5 5 | "foo".encode("UTF8") # b"foo" 6 6 | U"foo".encode("utf-8") # b"foo" 7 7 | "foo".encode(encoding="utf-8") # b"foo" @@ -184,7 +177,6 @@ UP012.py:16:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 13 13 | "utf-8" 14 14 | ) 15 15 | ( @@ -211,7 +203,6 @@ UP012.py:20:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 17 17 | "Ipsum".encode() 18 18 | ) 19 19 | ( @@ -235,7 +226,6 @@ UP012.py:24:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 21 21 | "Ipsum".encode() # Comment 22 22 | ) 23 23 | ( @@ -257,7 +247,6 @@ UP012.py:32:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -Suggested fix: 29 29 | string.encode("utf-8") 30 30 | 31 31 | bar = "bar" @@ -282,7 +271,6 @@ UP012.py:36:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -Suggested fix: 33 33 | encoding = "latin" 34 34 | "foo".encode(encoding) 35 35 | f"foo{bar}".encode(encoding) @@ -306,7 +294,6 @@ UP012.py:53:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -Suggested fix: 50 50 | "unicode text©".encode(encoding="utf-8", errors="replace") 51 51 | 52 52 | # Unicode literals should only be stripped of default encoding. @@ -329,7 +316,6 @@ UP012.py:55:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -Suggested fix: 52 52 | # Unicode literals should only be stripped of default encoding. 53 53 | "unicode text©".encode("utf-8") # "unicode text©".encode() 54 54 | "unicode text©".encode() @@ -352,7 +338,6 @@ UP012.py:57:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 54 54 | "unicode text©".encode() 55 55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode() 56 56 | @@ -374,7 +359,6 @@ UP012.py:58:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 55 55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode() 56 56 | 57 57 | r"foo\o".encode("utf-8") # br"foo\o" @@ -397,7 +381,6 @@ UP012.py:59:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 56 56 | 57 57 | r"foo\o".encode("utf-8") # br"foo\o" 58 58 | u"foo".encode("utf-8") # b"foo" @@ -419,7 +402,6 @@ UP012.py:60:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 57 57 | r"foo\o".encode("utf-8") # br"foo\o" 58 58 | u"foo".encode("utf-8") # b"foo" 59 59 | R"foo\o".encode("utf-8") # br"foo\o" @@ -442,7 +424,6 @@ UP012.py:61:7: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 58 58 | u"foo".encode("utf-8") # b"foo" 59 59 | R"foo\o".encode("utf-8") # br"foo\o" 60 60 | U"foo".encode("utf-8") # b"foo" @@ -467,7 +448,6 @@ UP012.py:64:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 62 62 | 63 63 | # `encode` on parenthesized strings. 64 64 | ( @@ -497,7 +477,6 @@ UP012.py:69:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 67 67 | ).encode() 68 68 | 69 69 | (( @@ -524,7 +503,6 @@ UP012.py:74:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -Suggested fix: 71 71 | "def" 72 72 | )).encode() 73 73 | @@ -546,7 +524,6 @@ UP012.py:75:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -Suggested fix: 72 72 | )).encode() 73 73 | 74 74 | (f"foo{bar}").encode("utf-8") @@ -568,7 +545,6 @@ UP012.py:76:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -Suggested fix: 73 73 | 74 74 | (f"foo{bar}").encode("utf-8") 75 75 | (f"foo{bar}").encode(encoding="utf-8") @@ -589,7 +565,6 @@ UP012.py:77:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -Suggested fix: 74 74 | (f"foo{bar}").encode("utf-8") 75 75 | (f"foo{bar}").encode(encoding="utf-8") 76 76 | ("unicode text©").encode("utf-8") @@ -612,7 +587,6 @@ UP012.py:82:17: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 79 79 | 80 80 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459882 81 81 | def _match_ignore(line): @@ -633,7 +607,6 @@ UP012.py:86:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -Suggested fix: 83 83 | 84 84 | # Not a valid type annotation but this test shouldn't result in a panic. 85 85 | # Refer: https://github.com/astral-sh/ruff/issues/11736 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap index e4f7999e05fd5..26d4a149b85f8 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap @@ -11,7 +11,6 @@ UP013.py:5:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class sy | = help: Convert `MyType` to class syntax -Suggested fix: 2 2 | import typing 3 3 | 4 4 | # dict literal @@ -35,7 +34,6 @@ UP013.py:8:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class sy | = help: Convert `MyType` to class syntax -Suggested fix: 5 5 | MyType = TypedDict("MyType", {"a": int, "b": str}) 6 6 | 7 7 | # dict call @@ -59,7 +57,6 @@ UP013.py:11:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -Suggested fix: 8 8 | MyType = TypedDict("MyType", dict(a=int, b=str)) 9 9 | 10 10 | # kwargs @@ -83,7 +80,6 @@ UP013.py:14:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -Suggested fix: 11 11 | MyType = TypedDict("MyType", a=int, b=str) 12 12 | 13 13 | # Empty TypedDict @@ -105,7 +101,6 @@ UP013.py:17:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -Suggested fix: 14 14 | MyType = TypedDict("MyType") 15 15 | 16 16 | # Literal values @@ -129,7 +124,6 @@ UP013.py:18:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -Suggested fix: 15 15 | 16 16 | # Literal values 17 17 | MyType = TypedDict("MyType", {"a": "hello"}) @@ -152,7 +146,6 @@ UP013.py:21:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -Suggested fix: 18 18 | MyType = TypedDict("MyType", a="hello") 19 19 | 20 20 | # NotRequired @@ -175,7 +168,6 @@ UP013.py:24:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -Suggested fix: 21 21 | MyType = TypedDict("MyType", {"a": NotRequired[dict]}) 22 22 | 23 23 | # total @@ -199,7 +191,6 @@ UP013.py:27:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -Suggested fix: 24 24 | MyType = TypedDict("MyType", {"x": int, "y": int}, total=False) 25 25 | 26 26 | # using Literal type @@ -222,7 +213,6 @@ UP013.py:30:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -Suggested fix: 27 27 | MyType = TypedDict("MyType", {"key": Literal["value"]}) 28 28 | 29 29 | # using namespace TypedDict @@ -245,7 +235,6 @@ UP013.py:40:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -Suggested fix: 37 37 | MyType = TypedDict("MyType", {"a": int, "b": str, **c}) 38 38 | 39 39 | # Empty dict literal @@ -266,7 +255,6 @@ UP013.py:43:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -Suggested fix: 40 40 | MyType = TypedDict("MyType", {}) 41 41 | 42 42 | # Empty dict call diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap index 773cef6361892..b4f73e6495185 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap @@ -11,7 +11,6 @@ UP014.py:5:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class s | = help: Convert `MyType` to class syntax -Suggested fix: 2 2 | import typing 3 3 | 4 4 | # with complex annotations @@ -35,7 +34,6 @@ UP014.py:8:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class s | = help: Convert `MyType` to class syntax -Suggested fix: 5 5 | MyType = NamedTuple("MyType", [("a", int), ("b", tuple[str, ...])]) 6 6 | 7 7 | # with namespace @@ -59,7 +57,6 @@ UP014.py:14:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class | = help: Convert `MyType` to class syntax -Suggested fix: 11 11 | MyType = NamedTuple("MyType", [("x-y", int), ("b", tuple[str, ...])]) 12 12 | 13 13 | # no fields @@ -82,7 +79,6 @@ UP014.py:17:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class | = help: Convert `MyType` to class syntax -Suggested fix: 14 14 | MyType = typing.NamedTuple("MyType") 15 15 | 16 16 | # empty fields @@ -105,7 +101,6 @@ UP014.py:20:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class | = help: Convert `MyType` to class syntax -Suggested fix: 17 17 | MyType = typing.NamedTuple("MyType", []) 18 18 | 19 19 | # keywords diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015.py.snap index 785acf0ef8d6a..7ffc71c59c4c3 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015.py.snap @@ -10,7 +10,6 @@ UP015.py:1:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 1 |-open("foo", "U") 1 |+open("foo") 2 2 | open("foo", "Ur") @@ -29,7 +28,6 @@ UP015.py:2:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 1 1 | open("foo", "U") 2 |-open("foo", "Ur") 2 |+open("foo") @@ -50,7 +48,6 @@ UP015.py:3:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 1 1 | open("foo", "U") 2 2 | open("foo", "Ur") 3 |-open("foo", "Ub") @@ -72,7 +69,6 @@ UP015.py:4:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 1 1 | open("foo", "U") 2 2 | open("foo", "Ur") 3 3 | open("foo", "Ub") @@ -95,7 +91,6 @@ UP015.py:5:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 2 2 | open("foo", "Ur") 3 3 | open("foo", "Ub") 4 4 | open("foo", "rUb") @@ -118,7 +113,6 @@ UP015.py:6:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 3 3 | open("foo", "Ub") 4 4 | open("foo", "rUb") 5 5 | open("foo", "r") @@ -140,7 +134,6 @@ UP015.py:7:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 4 4 | open("foo", "rUb") 5 5 | open("foo", "r") 6 6 | open("foo", "rt") @@ -163,7 +156,6 @@ UP015.py:8:1: UP015 [*] Unnecessary open mode parameters, use ""w"" | = help: Replace with ""w"" -Suggested fix: 5 5 | open("foo", "r") 6 6 | open("foo", "rt") 7 7 | open("f", "r", encoding="UTF-8") @@ -186,7 +178,6 @@ UP015.py:10:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 7 7 | open("f", "r", encoding="UTF-8") 8 8 | open("f", "wt") 9 9 | @@ -209,7 +200,6 @@ UP015.py:12:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 9 9 | 10 10 | with open("foo", "U") as f: 11 11 | pass @@ -232,7 +222,6 @@ UP015.py:14:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 11 11 | pass 12 12 | with open("foo", "Ur") as f: 13 13 | pass @@ -255,7 +244,6 @@ UP015.py:16:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 13 13 | pass 14 14 | with open("foo", "Ub") as f: 15 15 | pass @@ -278,7 +266,6 @@ UP015.py:18:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 15 15 | pass 16 16 | with open("foo", "rUb") as f: 17 17 | pass @@ -301,7 +288,6 @@ UP015.py:20:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 17 17 | pass 18 18 | with open("foo", "r") as f: 19 19 | pass @@ -324,7 +310,6 @@ UP015.py:22:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 19 19 | pass 20 20 | with open("foo", "rt") as f: 21 21 | pass @@ -346,7 +331,6 @@ UP015.py:24:6: UP015 [*] Unnecessary open mode parameters, use ""w"" | = help: Replace with ""w"" -Suggested fix: 21 21 | pass 22 22 | with open("foo", "r", encoding="UTF-8") as f: 23 23 | pass @@ -368,7 +352,6 @@ UP015.py:27:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 24 24 | with open("foo", "wt") as f: 25 25 | pass 26 26 | @@ -390,7 +373,6 @@ UP015.py:28:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 25 25 | pass 26 26 | 27 27 | open(f("a", "b", "c"), "U") @@ -413,7 +395,6 @@ UP015.py:30:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 27 27 | open(f("a", "b", "c"), "U") 28 28 | open(f("a", "b", "c"), "Ub") 29 29 | @@ -435,7 +416,6 @@ UP015.py:32:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 29 29 | 30 30 | with open(f("a", "b", "c"), "U") as f: 31 31 | pass @@ -458,7 +438,6 @@ UP015.py:35:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 32 32 | with open(f("a", "b", "c"), "Ub") as f: 33 33 | pass 34 34 | @@ -481,7 +460,6 @@ UP015.py:35:30: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 32 32 | with open(f("a", "b", "c"), "Ub") as f: 33 33 | pass 34 34 | @@ -503,7 +481,6 @@ UP015.py:37:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 34 34 | 35 35 | with open("foo", "U") as fa, open("bar", "U") as fb: 36 36 | pass @@ -525,7 +502,6 @@ UP015.py:37:31: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 34 34 | 35 35 | with open("foo", "U") as fa, open("bar", "U") as fb: 36 36 | pass @@ -548,7 +524,6 @@ UP015.py:40:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 37 37 | with open("foo", "Ub") as fa, open("bar", "Ub") as fb: 38 38 | pass 39 39 | @@ -569,7 +544,6 @@ UP015.py:41:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 38 38 | pass 39 39 | 40 40 | open("foo", mode="U") @@ -592,7 +566,6 @@ UP015.py:42:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 39 39 | 40 40 | open("foo", mode="U") 41 41 | open(name="foo", mode="U") @@ -615,7 +588,6 @@ UP015.py:44:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 41 41 | open(name="foo", mode="U") 42 42 | open(mode="U", name="foo") 43 43 | @@ -638,7 +610,6 @@ UP015.py:46:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 43 43 | 44 44 | with open("foo", mode="U") as f: 45 45 | pass @@ -660,7 +631,6 @@ UP015.py:48:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 45 45 | pass 46 46 | with open(name="foo", mode="U") as f: 47 47 | pass @@ -683,7 +653,6 @@ UP015.py:51:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 48 48 | with open(mode="U", name="foo") as f: 49 49 | pass 50 50 | @@ -704,7 +673,6 @@ UP015.py:52:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 49 49 | pass 50 50 | 51 51 | open("foo", mode="Ub") @@ -727,7 +695,6 @@ UP015.py:53:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 50 50 | 51 51 | open("foo", mode="Ub") 52 52 | open(name="foo", mode="Ub") @@ -750,7 +717,6 @@ UP015.py:55:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 52 52 | open(name="foo", mode="Ub") 53 53 | open(mode="Ub", name="foo") 54 54 | @@ -773,7 +739,6 @@ UP015.py:57:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 54 54 | 55 55 | with open("foo", mode="Ub") as f: 56 56 | pass @@ -795,7 +760,6 @@ UP015.py:59:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 56 56 | pass 57 57 | with open(name="foo", mode="Ub") as f: 58 58 | pass @@ -818,7 +782,6 @@ UP015.py:62:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 59 59 | with open(mode="Ub", name="foo") as f: 60 60 | pass 61 61 | @@ -840,7 +803,6 @@ UP015.py:63:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 60 60 | pass 61 61 | 62 62 | open(file="foo", mode='U', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) @@ -862,7 +824,6 @@ UP015.py:64:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 61 61 | 62 62 | open(file="foo", mode='U', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 63 63 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='U') @@ -885,7 +846,6 @@ UP015.py:65:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 62 62 | open(file="foo", mode='U', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 63 63 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='U') 64 64 | open(file="foo", buffering=-1, encoding=None, errors=None, mode='U', newline=None, closefd=True, opener=None) @@ -908,7 +868,6 @@ UP015.py:67:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 64 64 | open(file="foo", buffering=-1, encoding=None, errors=None, mode='U', newline=None, closefd=True, opener=None) 65 65 | open(mode='U', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 66 66 | @@ -930,7 +889,6 @@ UP015.py:68:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 65 65 | open(mode='U', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 66 66 | 67 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) @@ -952,7 +910,6 @@ UP015.py:69:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 66 66 | 67 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 68 68 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='Ub') @@ -975,7 +932,6 @@ UP015.py:70:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -Suggested fix: 67 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 68 68 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='Ub') 69 69 | open(file="foo", buffering=-1, encoding=None, errors=None, mode='Ub', newline=None, closefd=True, opener=None) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015_1.py.snap index 527a088e672a0..1381d568b0442 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015_1.py.snap @@ -10,7 +10,6 @@ UP015_1.py:3:5: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -Suggested fix: 1 1 | # Not a valid type annotation but this test shouldn't result in a panic. 2 2 | # Refer: https://github.com/astral-sh/ruff/issues/11736 3 |-x: 'open("foo", "r")' diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP018.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP018.py.snap index 5b121f87a7833..e8f7a8a59767b 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP018.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP018.py.snap @@ -11,7 +11,6 @@ UP018.py:37:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) | = help: Replace with string literal -Suggested fix: 34 34 | int().denominator 35 35 | 36 36 | # These become literals @@ -34,7 +33,6 @@ UP018.py:38:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) | = help: Replace with string literal -Suggested fix: 35 35 | 36 36 | # These become literals 37 37 | str() @@ -58,7 +56,6 @@ UP018.py:39:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) | = help: Replace with string literal -Suggested fix: 36 36 | # These become literals 37 37 | str() 38 38 | str("foo") @@ -83,7 +80,6 @@ UP018.py:41:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) | = help: Replace with bytes literal -Suggested fix: 38 38 | str("foo") 39 39 | str(""" 40 40 | foo""") @@ -106,7 +102,6 @@ UP018.py:42:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) | = help: Replace with bytes literal -Suggested fix: 39 39 | str(""" 40 40 | foo""") 41 41 | bytes() @@ -130,7 +125,6 @@ UP018.py:43:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) | = help: Replace with bytes literal -Suggested fix: 40 40 | foo""") 41 41 | bytes() 42 42 | bytes(b"foo") @@ -155,7 +149,6 @@ UP018.py:45:4: UP018 [*] Unnecessary `str` call (rewrite as a literal) | = help: Replace with string literal -Suggested fix: 42 42 | bytes(b"foo") 43 43 | bytes(b""" 44 44 | foo""") @@ -178,7 +171,6 @@ UP018.py:46:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | = help: Replace with integer literal -Suggested fix: 43 43 | bytes(b""" 44 44 | foo""") 45 45 | f"{str()}" @@ -201,7 +193,6 @@ UP018.py:47:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | = help: Replace with integer literal -Suggested fix: 44 44 | foo""") 45 45 | f"{str()}" 46 46 | int() @@ -224,7 +215,6 @@ UP018.py:48:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | = help: Replace with float literal -Suggested fix: 45 45 | f"{str()}" 46 46 | int() 47 47 | int(1) @@ -247,7 +237,6 @@ UP018.py:49:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | = help: Replace with float literal -Suggested fix: 46 46 | int() 47 47 | int(1) 48 48 | float() @@ -270,7 +259,6 @@ UP018.py:50:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) | = help: Replace with boolean literal -Suggested fix: 47 47 | int(1) 48 48 | float() 49 49 | float(1.0) @@ -292,7 +280,6 @@ UP018.py:51:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) | = help: Replace with boolean literal -Suggested fix: 48 48 | float() 49 49 | float(1.0) 50 50 | bool() @@ -315,7 +302,6 @@ UP018.py:52:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) | = help: Replace with boolean literal -Suggested fix: 49 49 | float(1.0) 50 50 | bool() 51 51 | bool(True) @@ -337,7 +323,6 @@ UP018.py:55:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | = help: Replace with integer literal -Suggested fix: 52 52 | bool(False) 53 53 | 54 54 | # These become a literal but retain parentheses @@ -359,7 +344,6 @@ UP018.py:58:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | = help: Replace with integer literal -Suggested fix: 55 55 | int(1).denominator 56 56 | 57 57 | # These too are literals in spirit @@ -382,7 +366,6 @@ UP018.py:59:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | = help: Replace with integer literal -Suggested fix: 56 56 | 57 57 | # These too are literals in spirit 58 58 | int(+1) @@ -403,7 +386,6 @@ UP018.py:60:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | = help: Replace with float literal -Suggested fix: 57 57 | # These too are literals in spirit 58 58 | int(+1) 59 59 | int(-1) @@ -422,7 +404,6 @@ UP018.py:61:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | = help: Replace with float literal -Suggested fix: 58 58 | int(+1) 59 59 | int(-1) 60 60 | float(+1.0) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP019.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP019.py.snap index 50ef49e1b8141..99970f9592f58 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP019.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP019.py.snap @@ -9,7 +9,6 @@ UP019.py:7:22: UP019 [*] `typing.Text` is deprecated, use `str` | = help: Replace with `str` -Suggested fix: 4 4 | from typing import Text as Goodbye 5 5 | 6 6 | @@ -29,7 +28,6 @@ UP019.py:11:29: UP019 [*] `typing.Text` is deprecated, use `str` | = help: Replace with `str` -Suggested fix: 8 8 | print(word) 9 9 | 10 10 | @@ -49,7 +47,6 @@ UP019.py:15:28: UP019 [*] `typing.Text` is deprecated, use `str` | = help: Replace with `str` -Suggested fix: 12 12 | print(word) 13 13 | 14 14 | @@ -69,7 +66,6 @@ UP019.py:19:29: UP019 [*] `typing.Text` is deprecated, use `str` | = help: Replace with `str` -Suggested fix: 16 16 | print(word) 17 17 | 18 18 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap index deed6b05160bd..880c86d833c98 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap @@ -11,7 +11,6 @@ UP020.py:3:6: UP020 [*] Use builtin `open` | = help: Replace with builtin `open` -Suggested fix: 1 1 | import io 2 2 | 3 |-with io.open("f.txt", mode="r", buffering=-1, **kwargs) as f: @@ -32,7 +31,6 @@ UP020.py:8:6: UP020 [*] Use builtin `open` | = help: Replace with builtin `open` -Suggested fix: 4 4 | print(f.read()) 5 5 | 6 6 | from io import open diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap index 251eb3828305e..8e3b8d5a621ef 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap @@ -11,7 +11,6 @@ UP021.py:5:25: UP021 [*] `universal_newlines` is deprecated, use `text` | = help: Replace with `text` keyword argument -Suggested fix: 2 2 | from subprocess import run 3 3 | 4 4 | # Errors @@ -33,7 +32,6 @@ UP021.py:6:25: UP021 [*] `universal_newlines` is deprecated, use `text` | = help: Replace with `text` keyword argument -Suggested fix: 3 3 | 4 4 | # Errors 5 5 | subprocess.run(["foo"], universal_newlines=True, check=True) @@ -56,7 +54,6 @@ UP021.py:7:14: UP021 [*] `universal_newlines` is deprecated, use `text` | = help: Replace with `text` keyword argument -Suggested fix: 4 4 | # Errors 5 5 | subprocess.run(["foo"], universal_newlines=True, check=True) 6 6 | subprocess.run(["foo"], universal_newlines=True, text=True) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap index ff44f225e512b..68ac48a9a44c1 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap @@ -12,7 +12,6 @@ UP022.py:4:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stde | = help: Replace with `capture_output` keyword argument -Suggested fix: 1 1 | from subprocess import run 2 2 | import subprocess 3 3 | @@ -35,7 +34,6 @@ UP022.py:6:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stde | = help: Replace with `capture_output` keyword argument -Suggested fix: 3 3 | 4 4 | output = run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 5 5 | @@ -58,7 +56,6 @@ UP022.py:8:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stde | = help: Replace with `capture_output` keyword argument -Suggested fix: 5 5 | 6 6 | output = subprocess.run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 7 7 | @@ -84,7 +81,6 @@ UP022.py:10:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `std | = help: Replace with `capture_output` keyword argument -Suggested fix: 8 8 | output = subprocess.run(stdout=subprocess.PIPE, args=["foo"], stderr=subprocess.PIPE) 9 9 | 10 10 | output = subprocess.run( @@ -110,7 +106,6 @@ UP022.py:14:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `std | = help: Replace with `capture_output` keyword argument -Suggested fix: 12 12 | ) 13 13 | 14 14 | output = subprocess.run( @@ -142,7 +137,6 @@ UP022.py:18:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `std | = help: Replace with `capture_output` keyword argument -Suggested fix: 17 17 | 18 18 | output = subprocess.run( 19 19 | ["foo"], @@ -174,7 +168,6 @@ UP022.py:29:14: UP022 [*] Prefer `capture_output` over sending `stdout` and `std | = help: Replace with `capture_output` keyword argument -Suggested fix: 28 28 | if output: 29 29 | output = subprocess.run( 30 30 | ["foo"], diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap index 8df712e79458e..7b157918060f8 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap @@ -10,7 +10,6 @@ UP023.py:2:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -Suggested fix: 1 1 | # These two imports have something after cElementTree, so they should be fixed. 2 |-from xml.etree.cElementTree import XML, Element, SubElement 2 |+from xml.etree.ElementTree import XML, Element, SubElement @@ -31,7 +30,6 @@ UP023.py:3:8: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -Suggested fix: 1 1 | # These two imports have something after cElementTree, so they should be fixed. 2 2 | from xml.etree.cElementTree import XML, Element, SubElement 3 |-import xml.etree.cElementTree as ET @@ -51,7 +49,6 @@ UP023.py:6:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -Suggested fix: 3 3 | import xml.etree.cElementTree as ET 4 4 | 5 5 | # Weird spacing should not cause issues. @@ -74,7 +71,6 @@ UP023.py:7:11: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -Suggested fix: 4 4 | 5 5 | # Weird spacing should not cause issues. 6 6 | from xml.etree.cElementTree import XML @@ -100,7 +96,6 @@ UP023.py:10:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -Suggested fix: 7 7 | import xml.etree.cElementTree as ET 8 8 | 9 9 | # Multi line imports should also work fine. @@ -122,7 +117,6 @@ UP023.py:16:12: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -Suggested fix: 13 13 | SubElement, 14 14 | ) 15 15 | if True: @@ -145,7 +139,6 @@ UP023.py:17:27: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -Suggested fix: 14 14 | ) 15 15 | if True: 16 16 | import xml.etree.cElementTree as ET @@ -168,7 +161,6 @@ UP023.py:19:23: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -Suggested fix: 16 16 | import xml.etree.cElementTree as ET 17 17 | from xml.etree import cElementTree as CET 18 18 | @@ -191,7 +183,6 @@ UP023.py:21:20: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -Suggested fix: 18 18 | 19 19 | from xml.etree import cElementTree as ET 20 20 | @@ -213,7 +204,6 @@ UP023.py:24:32: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -Suggested fix: 21 21 | import contextlib, xml.etree.cElementTree as ET 22 22 | 23 23 | # This should fix the second, but not the first invocation. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_0.py.snap index 51562dec82951..2406846f3abe2 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_0.py.snap @@ -11,7 +11,6 @@ UP024_0.py:6:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `EnvironmentError` with builtin `OSError` -Suggested fix: 3 3 | # These should be fixed 4 4 | try: 5 5 | pass @@ -33,7 +32,6 @@ UP024_0.py:11:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `IOError` with builtin `OSError` -Suggested fix: 8 8 | 9 9 | try: 10 10 | pass @@ -55,7 +53,6 @@ UP024_0.py:16:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `WindowsError` with builtin `OSError` -Suggested fix: 13 13 | 14 14 | try: 15 15 | pass @@ -77,7 +74,6 @@ UP024_0.py:21:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `mmap.error` with builtin `OSError` -Suggested fix: 18 18 | 19 19 | try: 20 20 | pass @@ -99,7 +95,6 @@ UP024_0.py:26:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `select.error` with builtin `OSError` -Suggested fix: 23 23 | 24 24 | try: 25 25 | pass @@ -121,7 +116,6 @@ UP024_0.py:31:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `socket.error` with builtin `OSError` -Suggested fix: 28 28 | 29 29 | try: 30 30 | pass @@ -143,7 +137,6 @@ UP024_0.py:36:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `error` with builtin `OSError` -Suggested fix: 33 33 | 34 34 | try: 35 35 | pass @@ -166,7 +159,6 @@ UP024_0.py:43:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -Suggested fix: 40 40 | 41 41 | try: 42 42 | pass @@ -189,7 +181,6 @@ UP024_0.py:47:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -Suggested fix: 44 44 | pass 45 45 | try: 46 46 | pass @@ -211,7 +202,6 @@ UP024_0.py:51:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -Suggested fix: 48 48 | pass 49 49 | try: 50 50 | pass @@ -233,7 +223,6 @@ UP024_0.py:58:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -Suggested fix: 55 55 | 56 56 | try: 57 57 | pass @@ -256,7 +245,6 @@ UP024_0.py:65:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -Suggested fix: 62 62 | from .mmap import error 63 63 | try: 64 64 | pass @@ -278,7 +266,6 @@ UP024_0.py:87:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `mmap.error` with builtin `OSError` -Suggested fix: 84 84 | pass 85 85 | try: 86 86 | pass @@ -300,7 +287,6 @@ UP024_0.py:105:11: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -Suggested fix: 102 102 | def get_owner_id_from_mac_address(): 103 103 | try: 104 104 | mac_address = get_primary_mac_address() @@ -322,7 +308,6 @@ UP024_0.py:114:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `os.error` with builtin `OSError` -Suggested fix: 111 111 | 112 112 | try: 113 113 | pass diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_1.py.snap index ed5e43c8a3662..7c00ffe350748 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_1.py.snap @@ -12,7 +12,6 @@ UP024_1.py:5:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -Suggested fix: 2 2 | 3 3 | try: 4 4 | pass @@ -34,7 +33,6 @@ UP024_1.py:7:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -Suggested fix: 4 4 | pass 5 5 | except (OSError, mmap.error, IOError): 6 6 | pass @@ -61,7 +59,6 @@ UP024_1.py:12:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -Suggested fix: 9 9 | 10 10 | try: 11 11 | pass diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_2.py.snap index dab440351e81e..aaeee7b155b91 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_2.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_2.py.snap @@ -12,7 +12,6 @@ UP024_2.py:10:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `socket.error` with builtin `OSError` -Suggested fix: 7 7 | 8 8 | # Testing the modules 9 9 | import socket, mmap, select @@ -34,7 +33,6 @@ UP024_2.py:11:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `mmap.error` with builtin `OSError` -Suggested fix: 8 8 | # Testing the modules 9 9 | import socket, mmap, select 10 10 | raise socket.error @@ -57,7 +55,6 @@ UP024_2.py:12:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `select.error` with builtin `OSError` -Suggested fix: 9 9 | import socket, mmap, select 10 10 | raise socket.error 11 11 | raise mmap.error @@ -80,7 +77,6 @@ UP024_2.py:14:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `socket.error` with builtin `OSError` -Suggested fix: 11 11 | raise mmap.error 12 12 | raise select.error 13 13 | @@ -101,7 +97,6 @@ UP024_2.py:15:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `mmap.error` with builtin `OSError` -Suggested fix: 12 12 | raise select.error 13 13 | 14 14 | raise socket.error() @@ -124,7 +119,6 @@ UP024_2.py:16:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `select.error` with builtin `OSError` -Suggested fix: 13 13 | 14 14 | raise socket.error() 15 15 | raise mmap.error(1) @@ -147,7 +141,6 @@ UP024_2.py:18:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `socket.error` with builtin `OSError` -Suggested fix: 15 15 | raise mmap.error(1) 16 16 | raise select.error(1, 2) 17 17 | @@ -169,7 +162,6 @@ UP024_2.py:25:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `error` with builtin `OSError` -Suggested fix: 22 22 | ) 23 23 | 24 24 | from mmap import error @@ -191,7 +183,6 @@ UP024_2.py:28:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `error` with builtin `OSError` -Suggested fix: 25 25 | raise error 26 26 | 27 27 | from socket import error @@ -213,7 +204,6 @@ UP024_2.py:31:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `error` with builtin `OSError` -Suggested fix: 28 28 | raise error(1) 29 29 | 30 30 | from select import error @@ -235,7 +225,6 @@ UP024_2.py:34:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `EnvironmentError` with builtin `OSError` -Suggested fix: 31 31 | raise error(1, 2) 32 32 | 33 33 | # Testing the names @@ -257,7 +246,6 @@ UP024_2.py:35:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `IOError` with builtin `OSError` -Suggested fix: 32 32 | 33 33 | # Testing the names 34 34 | raise EnvironmentError @@ -280,7 +268,6 @@ UP024_2.py:36:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `WindowsError` with builtin `OSError` -Suggested fix: 33 33 | # Testing the names 34 34 | raise EnvironmentError 35 35 | raise IOError @@ -303,7 +290,6 @@ UP024_2.py:38:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `EnvironmentError` with builtin `OSError` -Suggested fix: 35 35 | raise IOError 36 36 | raise WindowsError 37 37 | @@ -324,7 +310,6 @@ UP024_2.py:39:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `IOError` with builtin `OSError` -Suggested fix: 36 36 | raise WindowsError 37 37 | 38 38 | raise EnvironmentError() @@ -347,7 +332,6 @@ UP024_2.py:40:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `WindowsError` with builtin `OSError` -Suggested fix: 37 37 | 38 38 | raise EnvironmentError() 39 39 | raise IOError(1) @@ -370,7 +354,6 @@ UP024_2.py:42:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `EnvironmentError` with builtin `OSError` -Suggested fix: 39 39 | raise IOError(1) 40 40 | raise WindowsError(1, 2) 41 41 | @@ -393,7 +376,6 @@ UP024_2.py:48:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `WindowsError` with builtin `OSError` -Suggested fix: 45 45 | 3, 46 46 | ) 47 47 | @@ -413,7 +395,6 @@ UP024_2.py:49:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `EnvironmentError` with builtin `OSError` -Suggested fix: 46 46 | ) 47 47 | 48 48 | raise WindowsError @@ -432,7 +413,6 @@ UP024_2.py:50:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `IOError` with builtin `OSError` -Suggested fix: 47 47 | 48 48 | raise WindowsError 49 49 | raise EnvironmentError(1) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_4.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_4.py.snap index c447aa4ea7a71..865bfe0939cd9 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_4.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_4.py.snap @@ -11,7 +11,6 @@ UP024_4.py:9:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -Suggested fix: 6 6 | conn = Connection(settings.CELERY_BROKER_URL) 7 7 | conn.ensure_connection(max_retries=2) 8 8 | conn._close() diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP025.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP025.py.snap index da34c741b4b70..4c77e2cf70d79 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP025.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP025.py.snap @@ -10,7 +10,6 @@ UP025.py:1:1: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -Suggested fix: 1 |-u"Hello" 1 |+"Hello" 2 2 | @@ -30,7 +29,6 @@ UP025.py:3:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -Suggested fix: 1 1 | u"Hello" 2 2 | 3 |-x = u"Hello" # UP025 @@ -52,7 +50,6 @@ UP025.py:5:1: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -Suggested fix: 2 2 | 3 3 | x = u"Hello" # UP025 4 4 | @@ -75,7 +72,6 @@ UP025.py:7:7: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -Suggested fix: 4 4 | 5 5 | u'world' # UP025 6 6 | @@ -98,7 +94,6 @@ UP025.py:9:7: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -Suggested fix: 6 6 | 7 7 | print(u"Hello") # UP025 8 8 | @@ -121,7 +116,6 @@ UP025.py:13:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -Suggested fix: 10 10 | 11 11 | import foo 12 12 | @@ -144,7 +138,6 @@ UP025.py:13:15: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -Suggested fix: 10 10 | 11 11 | import foo 12 12 | @@ -167,7 +160,6 @@ UP025.py:13:27: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -Suggested fix: 10 10 | 11 11 | import foo 12 12 | @@ -190,7 +182,6 @@ UP025.py:13:39: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -Suggested fix: 10 10 | 11 11 | import foo 12 12 | @@ -212,7 +203,6 @@ UP025.py:16:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -Suggested fix: 13 13 | foo(u"Hello", U"world", a=u"Hello", b=u"world") # UP025 14 14 | 15 15 | # Retain quotes when fixing. @@ -235,7 +225,6 @@ UP025.py:17:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -Suggested fix: 14 14 | 15 15 | # Retain quotes when fixing. 16 16 | x = u'hello' # UP025 @@ -257,7 +246,6 @@ UP025.py:18:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -Suggested fix: 15 15 | # Retain quotes when fixing. 16 16 | x = u'hello' # UP025 17 17 | x = u"""hello""" # UP025 @@ -280,7 +268,6 @@ UP025.py:19:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -Suggested fix: 16 16 | x = u'hello' # UP025 17 17 | x = u"""hello""" # UP025 18 18 | x = u'''hello''' # UP025 @@ -302,7 +289,6 @@ UP025.py:27:7: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -Suggested fix: 24 24 | def hello(): 25 25 | return"Hello" # OK 26 26 | @@ -320,7 +306,6 @@ UP025.py:28:8: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -Suggested fix: 25 25 | return"Hello" # OK 26 26 | 27 27 | f"foo"u"bar" # OK diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap index 232ad3f0eede8..1f1fd515e907a 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap @@ -12,7 +12,6 @@ UP026.py:3:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 1 1 | # Error (`from unittest import mock`) 2 2 | if True: 3 |- import mock @@ -34,7 +33,6 @@ UP026.py:7:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 4 4 | 5 5 | # Error (`from unittest import mock`) 6 6 | if True: @@ -58,7 +56,6 @@ UP026.py:11:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 8 8 | 9 9 | # Error (`from unittest.mock import *`) 10 10 | if True: @@ -80,7 +77,6 @@ UP026.py:14:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 11 11 | from mock import * 12 12 | 13 13 | # Error (`from unittest import mock`) @@ -102,7 +98,6 @@ UP026.py:17:20: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 14 14 | import mock.mock 15 15 | 16 16 | # Error (`from unittest import mock`) @@ -124,7 +119,6 @@ UP026.py:20:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 17 17 | import contextlib, mock, sys 18 18 | 19 19 | # Error (`from unittest import mock`) @@ -147,7 +141,6 @@ UP026.py:24:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 21 21 | x = "This code should be preserved one line below the mock" 22 22 | 23 23 | # Error (`from unittest import mock`) @@ -174,7 +167,6 @@ UP026.py:27:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 24 24 | from mock import mock 25 25 | 26 26 | # Error (keep trailing comma) @@ -208,7 +200,6 @@ UP026.py:33:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 30 30 | b, 31 31 | c, 32 32 | ) @@ -241,7 +232,6 @@ UP026.py:41:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 38 38 | ) 39 39 | 40 40 | # Error (avoid trailing comma) @@ -275,7 +265,6 @@ UP026.py:47:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 44 44 | b, 45 45 | c 46 46 | ) @@ -304,7 +293,6 @@ UP026.py:53:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 50 50 | c, 51 51 | mock 52 52 | ) @@ -328,7 +316,6 @@ UP026.py:54:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 51 51 | mock 52 52 | ) 53 53 | from mock import mock, a, b, c @@ -358,7 +345,6 @@ UP026.py:58:9: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 55 55 | 56 56 | if True: 57 57 | if False: @@ -386,7 +372,6 @@ UP026.py:69:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 66 66 | import os, io 67 67 | 68 68 | # Error (`from unittest import mock`) @@ -409,7 +394,6 @@ UP026.py:69:14: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 66 66 | import os, io 67 67 | 68 68 | # Error (`from unittest import mock`) @@ -432,7 +416,6 @@ UP026.py:72:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 69 69 | import mock, mock 70 70 | 71 71 | # Error (`from unittest import mock as foo`) @@ -454,7 +437,6 @@ UP026.py:75:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 72 72 | import mock as foo 73 73 | 74 74 | # Error (`from unittest import mock as foo`) @@ -477,7 +459,6 @@ UP026.py:79:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 76 76 | 77 77 | if True: 78 78 | # This should yield multiple, aliased imports. @@ -502,7 +483,6 @@ UP026.py:79:25: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 76 76 | 77 77 | if True: 78 78 | # This should yield multiple, aliased imports. @@ -527,7 +507,6 @@ UP026.py:79:38: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 76 76 | 77 77 | if True: 78 78 | # This should yield multiple, aliased imports. @@ -551,7 +530,6 @@ UP026.py:82:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 79 79 | import mock as foo, mock as bar, mock 80 80 | 81 81 | # This should yield multiple, aliased imports, and preserve `os`. @@ -576,7 +554,6 @@ UP026.py:82:25: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 79 79 | import mock as foo, mock as bar, mock 80 80 | 81 81 | # This should yield multiple, aliased imports, and preserve `os`. @@ -601,7 +578,6 @@ UP026.py:82:38: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 79 79 | import mock as foo, mock as bar, mock 80 80 | 81 81 | # This should yield multiple, aliased imports, and preserve `os`. @@ -625,7 +601,6 @@ UP026.py:86:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -Suggested fix: 83 83 | 84 84 | if True: 85 85 | # This should yield multiple, aliased imports. @@ -647,7 +622,6 @@ UP026.py:93:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Replace `mock.mock` with `mock` -Suggested fix: 90 90 | x = mock.Mock() 91 91 | 92 92 | # Error (`mock.Mock()`). diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap index 9ce8a3b2cd738..955a990f9b26c 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap @@ -11,7 +11,6 @@ UP027.py:2:17: UP027 [*] Replace unpacked list comprehension with a generator ex | = help: Replace with generator expression -Suggested fix: 1 1 | # Should change 2 |-foo, bar, baz = [fn(x) for x in items] 2 |+foo, bar, baz = (fn(x) for x in items) @@ -32,7 +31,6 @@ UP027.py:4:16: UP027 [*] Replace unpacked list comprehension with a generator ex | = help: Replace with generator expression -Suggested fix: 1 1 | # Should change 2 2 | foo, bar, baz = [fn(x) for x in items] 3 3 | @@ -55,7 +53,6 @@ UP027.py:6:26: UP027 [*] Replace unpacked list comprehension with a generator ex | = help: Replace with generator expression -Suggested fix: 3 3 | 4 4 | foo, bar, baz =[fn(x) for x in items] 5 5 | @@ -78,7 +75,6 @@ UP027.py:8:17: UP027 [*] Replace unpacked list comprehension with a generator ex | = help: Replace with generator expression -Suggested fix: 5 5 | 6 6 | foo, bar, baz = [fn(x) for x in items] 7 7 | @@ -105,7 +101,6 @@ UP027.py:10:17: UP027 [*] Replace unpacked list comprehension with a generator e | = help: Replace with generator expression -Suggested fix: 7 7 | 8 8 | foo, bar, baz = [[i for i in fn(x)] for x in items] 9 9 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap index cec51349939cb..d62cb55153e92 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap @@ -11,7 +11,6 @@ UP028_0.py:2:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -Suggested fix: 1 1 | def f(): 2 |- for x in y: 3 |- yield x @@ -32,7 +31,6 @@ UP028_0.py:7:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -Suggested fix: 4 4 | 5 5 | 6 6 | def g(): @@ -55,7 +53,6 @@ UP028_0.py:12:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -Suggested fix: 9 9 | 10 10 | 11 11 | def h(): @@ -78,7 +75,6 @@ UP028_0.py:17:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -Suggested fix: 14 14 | 15 15 | 16 16 | def i(): @@ -101,7 +97,6 @@ UP028_0.py:22:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -Suggested fix: 19 19 | 20 20 | 21 21 | def j(): @@ -124,7 +119,6 @@ UP028_0.py:27:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -Suggested fix: 24 24 | 25 25 | 26 26 | def k(): @@ -154,7 +148,6 @@ UP028_0.py:33:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -Suggested fix: 30 30 | 31 31 | def f(): # Comment one\n' 32 32 | # Comment two\n' @@ -183,7 +176,6 @@ UP028_0.py:44:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -Suggested fix: 41 41 | 42 42 | 43 43 | def f(): @@ -208,7 +200,6 @@ UP028_0.py:49:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -Suggested fix: 46 46 | 47 47 | 48 48 | def f(): @@ -235,7 +226,6 @@ UP028_0.py:55:9: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -Suggested fix: 52 52 | def f(): 53 53 | def func(): 54 54 | # This comment is preserved\n' @@ -260,7 +250,6 @@ UP028_0.py:67:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -Suggested fix: 64 64 | def f(): 65 65 | for x in y: 66 66 | yield x @@ -284,7 +273,6 @@ UP028_0.py:72:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -Suggested fix: 69 69 | 70 70 | 71 71 | def f(): @@ -311,7 +299,6 @@ UP028_0.py:79:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -Suggested fix: 76 76 | 77 77 | # Regression test for: https://github.com/astral-sh/ruff/issues/7103 78 78 | def _serve_method(fn): diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap index 49966d061f530..5484106a8927a 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap @@ -10,7 +10,6 @@ UP029.py:1:1: UP029 [*] Unnecessary builtin import: `*` | = help: Remove unnecessary builtin import -Suggested fix: 1 |-from builtins import * 2 1 | from builtins import ascii, bytes, compile 3 2 | from builtins import str as _str @@ -28,7 +27,6 @@ UP029.py:2:1: UP029 [*] Unnecessary builtin imports: `ascii`, `bytes` | = help: Remove unnecessary builtin import -Suggested fix: 1 1 | from builtins import * 2 |-from builtins import ascii, bytes, compile 2 |+from builtins import compile @@ -49,7 +47,6 @@ UP029.py:4:1: UP029 [*] Unnecessary builtin imports: `filter`, `zip` | = help: Remove unnecessary builtin import -Suggested fix: 1 1 | from builtins import * 2 2 | from builtins import ascii, bytes, compile 3 3 | from builtins import str as _str @@ -72,7 +69,6 @@ UP029.py:5:1: UP029 [*] Unnecessary builtin import: `open` | = help: Remove unnecessary builtin import -Suggested fix: 2 2 | from builtins import ascii, bytes, compile 3 3 | from builtins import str as _str 4 4 | from six.moves import filter, zip, zip_longest diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap index 7f244a03d4059..17769a0a81460 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap @@ -12,7 +12,6 @@ UP030_0.py:3:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 1 1 | # Invalid calls; errors expected. 2 2 | 3 |-"{0}" "{1}" "{2}".format(1, 2, 3) @@ -36,7 +35,6 @@ UP030_0.py:5:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 2 2 | 3 3 | "{0}" "{1}" "{2}".format(1, 2, 3) 4 4 | @@ -61,7 +59,6 @@ UP030_0.py:9:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 6 6 | "first", "second", "third", "fourth" 7 7 | ) 8 8 | @@ -84,7 +81,6 @@ UP030_0.py:11:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 8 8 | 9 9 | '{0}'.format(1) 10 10 | @@ -107,7 +103,6 @@ UP030_0.py:13:5: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 10 10 | 11 11 | '{0:x}'.format(30) 12 12 | @@ -130,7 +125,6 @@ UP030_0.py:15:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 12 12 | 13 13 | x = '{0}'.format(1) 14 14 | @@ -155,7 +149,6 @@ UP030_0.py:17:5: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 14 14 | 15 15 | '''{0}\n{1}\n'''.format(1, 2) 16 16 | @@ -180,7 +173,6 @@ UP030_0.py:20:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 17 17 | x = "foo {0}" \ 18 18 | "bar {1}".format(1, 2) 19 19 | @@ -203,7 +195,6 @@ UP030_0.py:22:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 19 19 | 20 20 | ("{0}").format(1) 21 21 | @@ -226,7 +217,6 @@ UP030_0.py:25:5: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 22 22 | "\N{snowman} {0}".format(1) 23 23 | 24 24 | print( @@ -251,7 +241,6 @@ UP030_0.py:30:5: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 27 27 | ) 28 28 | 29 29 | print( @@ -287,7 +276,6 @@ UP030_0.py:39:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 36 36 | args = list(range(10)) 37 37 | kwargs = {x: x for x in range(10)} 38 38 | @@ -310,7 +298,6 @@ UP030_0.py:41:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 38 38 | 39 39 | "{0}".format(*args) 40 40 | @@ -333,7 +320,6 @@ UP030_0.py:43:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 40 40 | 41 41 | "{0}".format(**kwargs) 42 42 | @@ -356,7 +342,6 @@ UP030_0.py:45:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 42 42 | 43 43 | "{0}_{1}".format(*args) 44 44 | @@ -379,7 +364,6 @@ UP030_0.py:47:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 44 44 | 45 45 | "{0}_{1}".format(1, *args) 46 46 | @@ -402,7 +386,6 @@ UP030_0.py:49:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 46 46 | 47 47 | "{0}_{1}".format(1, 2, *args) 48 48 | @@ -425,7 +408,6 @@ UP030_0.py:51:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 48 48 | 49 49 | "{0}_{1}".format(*args, 1, 2) 50 50 | @@ -448,7 +430,6 @@ UP030_0.py:53:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 50 50 | 51 51 | "{0}_{1}_{2}".format(1, **kwargs) 52 52 | @@ -471,7 +452,6 @@ UP030_0.py:55:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 52 52 | 53 53 | "{0}_{1}_{2}".format(1, 2, **kwargs) 54 54 | @@ -494,7 +474,6 @@ UP030_0.py:57:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 54 54 | 55 55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs) 56 56 | @@ -517,7 +496,6 @@ UP030_0.py:59:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 56 56 | 57 57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs) 58 58 | @@ -537,7 +515,6 @@ UP030_0.py:61:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -Suggested fix: 58 58 | 59 59 | "{1}_{0}".format(1, 2, *args) 60 60 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap index 01a7e21e92527..cc833ae94977d 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap @@ -11,7 +11,6 @@ UP031_0.py:4:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 1 1 | a, b, x, y = 1, 2, 3, 4 2 2 | 3 3 | # UP031 @@ -21,6 +20,8 @@ UP031_0.py:4:7: UP031 [*] Use format specifiers instead of percent format 6 6 | print('%s%s' % (a, b)) 7 7 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:6:7: UP031 [*] Use format specifiers instead of percent format | 4 | print('%s %s' % (a, b)) @@ -32,7 +33,6 @@ UP031_0.py:6:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 3 3 | # UP031 4 4 | print('%s %s' % (a, b)) 5 5 | @@ -42,6 +42,8 @@ UP031_0.py:6:7: UP031 [*] Use format specifiers instead of percent format 8 8 | print("trivial" % ()) 9 9 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:8:7: UP031 [*] Use format specifiers instead of percent format | 6 | print('%s%s' % (a, b)) @@ -53,7 +55,6 @@ UP031_0.py:8:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 5 5 | 6 6 | print('%s%s' % (a, b)) 7 7 | @@ -63,6 +64,8 @@ UP031_0.py:8:7: UP031 [*] Use format specifiers instead of percent format 10 10 | print("%s" % ("simple",)) 11 11 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:10:7: UP031 [*] Use format specifiers instead of percent format | 8 | print("trivial" % ()) @@ -74,7 +77,6 @@ UP031_0.py:10:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 7 7 | 8 8 | print("trivial" % ()) 9 9 | @@ -84,6 +86,8 @@ UP031_0.py:10:7: UP031 [*] Use format specifiers instead of percent format 12 12 | print("%s" % ("%s" % ("nested",),)) 13 13 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:12:7: UP031 [*] Use format specifiers instead of percent format | 10 | print("%s" % ("simple",)) @@ -95,7 +99,6 @@ UP031_0.py:12:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 9 9 | 10 10 | print("%s" % ("simple",)) 11 11 | @@ -105,6 +108,8 @@ UP031_0.py:12:7: UP031 [*] Use format specifiers instead of percent format 14 14 | print("%s%% percent" % (15,)) 15 15 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:12:15: UP031 [*] Use format specifiers instead of percent format | 10 | print("%s" % ("simple",)) @@ -116,7 +121,6 @@ UP031_0.py:12:15: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 9 9 | 10 10 | print("%s" % ("simple",)) 11 11 | @@ -126,6 +130,8 @@ UP031_0.py:12:15: UP031 [*] Use format specifiers instead of percent format 14 14 | print("%s%% percent" % (15,)) 15 15 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:14:7: UP031 [*] Use format specifiers instead of percent format | 12 | print("%s" % ("%s" % ("nested",),)) @@ -137,7 +143,6 @@ UP031_0.py:14:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 11 11 | 12 12 | print("%s" % ("%s" % ("nested",),)) 13 13 | @@ -147,6 +152,8 @@ UP031_0.py:14:7: UP031 [*] Use format specifiers instead of percent format 16 16 | print("%f" % (15,)) 17 17 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:16:7: UP031 [*] Use format specifiers instead of percent format | 14 | print("%s%% percent" % (15,)) @@ -158,7 +165,6 @@ UP031_0.py:16:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 13 13 | 14 14 | print("%s%% percent" % (15,)) 15 15 | @@ -168,6 +174,8 @@ UP031_0.py:16:7: UP031 [*] Use format specifiers instead of percent format 18 18 | print("%.f" % (15,)) 19 19 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:18:7: UP031 [*] Use format specifiers instead of percent format | 16 | print("%f" % (15,)) @@ -179,7 +187,6 @@ UP031_0.py:18:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 15 15 | 16 16 | print("%f" % (15,)) 17 17 | @@ -189,6 +196,8 @@ UP031_0.py:18:7: UP031 [*] Use format specifiers instead of percent format 20 20 | print("%.3f" % (15,)) 21 21 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:20:7: UP031 [*] Use format specifiers instead of percent format | 18 | print("%.f" % (15,)) @@ -200,7 +209,6 @@ UP031_0.py:20:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 17 17 | 18 18 | print("%.f" % (15,)) 19 19 | @@ -210,6 +218,8 @@ UP031_0.py:20:7: UP031 [*] Use format specifiers instead of percent format 22 22 | print("%3f" % (15,)) 23 23 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:22:7: UP031 [*] Use format specifiers instead of percent format | 20 | print("%.3f" % (15,)) @@ -221,7 +231,6 @@ UP031_0.py:22:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 19 19 | 20 20 | print("%.3f" % (15,)) 21 21 | @@ -231,6 +240,8 @@ UP031_0.py:22:7: UP031 [*] Use format specifiers instead of percent format 24 24 | print("%-5f" % (5,)) 25 25 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:24:7: UP031 [*] Use format specifiers instead of percent format | 22 | print("%3f" % (15,)) @@ -242,7 +253,6 @@ UP031_0.py:24:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 21 21 | 22 22 | print("%3f" % (15,)) 23 23 | @@ -252,6 +262,8 @@ UP031_0.py:24:7: UP031 [*] Use format specifiers instead of percent format 26 26 | print("%9f" % (5,)) 27 27 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:26:7: UP031 [*] Use format specifiers instead of percent format | 24 | print("%-5f" % (5,)) @@ -263,7 +275,6 @@ UP031_0.py:26:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 23 23 | 24 24 | print("%-5f" % (5,)) 25 25 | @@ -273,6 +284,8 @@ UP031_0.py:26:7: UP031 [*] Use format specifiers instead of percent format 28 28 | print("%#o" % (123,)) 29 29 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:28:7: UP031 [*] Use format specifiers instead of percent format | 26 | print("%9f" % (5,)) @@ -284,7 +297,6 @@ UP031_0.py:28:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 25 25 | 26 26 | print("%9f" % (5,)) 27 27 | @@ -294,6 +306,8 @@ UP031_0.py:28:7: UP031 [*] Use format specifiers instead of percent format 30 30 | print("brace {} %s" % (1,)) 31 31 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:30:7: UP031 [*] Use format specifiers instead of percent format | 28 | print("%#o" % (123,)) @@ -305,7 +319,6 @@ UP031_0.py:30:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 27 27 | 28 28 | print("%#o" % (123,)) 29 29 | @@ -315,6 +328,8 @@ UP031_0.py:30:7: UP031 [*] Use format specifiers instead of percent format 32 32 | print(( 33 33 | "foo %s " + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:33:5: UP031 [*] Use format specifiers instead of percent format | 32 | print(( @@ -326,7 +341,6 @@ UP031_0.py:33:5: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 30 30 | print("brace {} %s" % (1,)) 31 31 | 32 32 | print(( @@ -338,6 +352,8 @@ UP031_0.py:33:5: UP031 [*] Use format specifiers instead of percent format 36 36 | 37 37 | print( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:38:3: UP031 [*] Use format specifiers instead of percent format | 37 | print( @@ -350,7 +366,6 @@ UP031_0.py:38:3: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 35 35 | )) 36 36 | 37 37 | print( @@ -360,6 +375,8 @@ UP031_0.py:38:3: UP031 [*] Use format specifiers instead of percent format 40 40 | ) 41 41 | ) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:43:7: UP031 [*] Use format specifiers instead of percent format | 41 | ) @@ -371,7 +388,6 @@ UP031_0.py:43:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 40 40 | ) 41 41 | ) 42 42 | @@ -381,6 +397,8 @@ UP031_0.py:43:7: UP031 [*] Use format specifiers instead of percent format 45 45 | print("%(k)s" % {"k": "v"}) 46 46 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:45:7: UP031 [*] Use format specifiers instead of percent format | 43 | print("foo %s " % (x,)) @@ -392,7 +410,6 @@ UP031_0.py:45:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 42 42 | 43 43 | print("foo %s " % (x,)) 44 44 | @@ -402,6 +419,8 @@ UP031_0.py:45:7: UP031 [*] Use format specifiers instead of percent format 47 47 | print("%(k)s" % { 48 48 | "k": "v", + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format | 45 | print("%(k)s" % {"k": "v"}) @@ -417,7 +436,6 @@ UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 44 44 | 45 45 | print("%(k)s" % {"k": "v"}) 46 46 | @@ -433,6 +451,8 @@ UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format 52 52 | print("%(to_list)s" % {"to_list": []}) 53 53 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:52:7: UP031 [*] Use format specifiers instead of percent format | 50 | }) @@ -444,7 +464,6 @@ UP031_0.py:52:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 49 49 | "i": "j" 50 50 | }) 51 51 | @@ -454,6 +473,8 @@ UP031_0.py:52:7: UP031 [*] Use format specifiers instead of percent format 54 54 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) 55 55 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:54:7: UP031 [*] Use format specifiers instead of percent format | 52 | print("%(to_list)s" % {"to_list": []}) @@ -465,7 +486,6 @@ UP031_0.py:54:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 51 51 | 52 52 | print("%(to_list)s" % {"to_list": []}) 53 53 | @@ -475,6 +495,8 @@ UP031_0.py:54:7: UP031 [*] Use format specifiers instead of percent format 56 56 | print("%(ab)s" % {"a" "b": 1}) 57 57 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:56:7: UP031 [*] Use format specifiers instead of percent format | 54 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) @@ -486,7 +508,6 @@ UP031_0.py:56:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 53 53 | 54 54 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) 55 55 | @@ -496,6 +517,8 @@ UP031_0.py:56:7: UP031 [*] Use format specifiers instead of percent format 58 58 | print("%(a)s" % {"a" : 1}) 59 59 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:58:7: UP031 [*] Use format specifiers instead of percent format | 56 | print("%(ab)s" % {"a" "b": 1}) @@ -505,7 +528,6 @@ UP031_0.py:58:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 55 55 | 56 56 | print("%(ab)s" % {"a" "b": 1}) 57 57 | @@ -515,6 +537,8 @@ UP031_0.py:58:7: UP031 [*] Use format specifiers instead of percent format 60 60 | 61 61 | print( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:62:5: UP031 [*] Use format specifiers instead of percent format | 61 | print( @@ -526,7 +550,6 @@ UP031_0.py:62:5: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 59 59 | 60 60 | 61 61 | print( @@ -538,6 +561,8 @@ UP031_0.py:62:5: UP031 [*] Use format specifiers instead of percent format 65 65 | 66 66 | bar = {"bar": y} + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:68:5: UP031 [*] Use format specifiers instead of percent format | 66 | bar = {"bar": y} @@ -550,7 +575,6 @@ UP031_0.py:68:5: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 65 65 | 66 66 | bar = {"bar": y} 67 67 | print( @@ -562,6 +586,8 @@ UP031_0.py:68:5: UP031 [*] Use format specifiers instead of percent format 71 71 | 72 72 | print("%s \N{snowman}" % (a,)) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:72:7: UP031 [*] Use format specifiers instead of percent format | 70 | ) @@ -573,7 +599,6 @@ UP031_0.py:72:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 69 69 | "bar %(bar)s" % {"foo": x, **bar} 70 70 | ) 71 71 | @@ -583,6 +608,8 @@ UP031_0.py:72:7: UP031 [*] Use format specifiers instead of percent format 74 74 | print("%(foo)s \N{snowman}" % {"foo": 1}) 75 75 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:74:7: UP031 [*] Use format specifiers instead of percent format | 72 | print("%s \N{snowman}" % (a,)) @@ -594,7 +621,6 @@ UP031_0.py:74:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 71 71 | 72 72 | print("%s \N{snowman}" % (a,)) 73 73 | @@ -604,6 +630,8 @@ UP031_0.py:74:7: UP031 [*] Use format specifiers instead of percent format 76 76 | print(("foo %s " "bar %s") % (x, y)) 77 77 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:76:7: UP031 [*] Use format specifiers instead of percent format | 74 | print("%(foo)s \N{snowman}" % {"foo": 1}) @@ -615,7 +643,6 @@ UP031_0.py:76:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 73 73 | 74 74 | print("%(foo)s \N{snowman}" % {"foo": 1}) 75 75 | @@ -625,6 +652,8 @@ UP031_0.py:76:7: UP031 [*] Use format specifiers instead of percent format 78 78 | # Single-value expressions 79 79 | print('Hello %s' % "World") + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:79:7: UP031 [*] Use format specifiers instead of percent format | 78 | # Single-value expressions @@ -635,7 +664,6 @@ UP031_0.py:79:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 76 76 | print(("foo %s " "bar %s") % (x, y)) 77 77 | 78 78 | # Single-value expressions @@ -645,6 +673,8 @@ UP031_0.py:79:7: UP031 [*] Use format specifiers instead of percent format 81 81 | print('Hello %s (%s)' % bar) 82 82 | print('Hello %s (%s)' % bar.baz) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:80:7: UP031 [*] Use format specifiers instead of percent format | 78 | # Single-value expressions @@ -656,7 +686,6 @@ UP031_0.py:80:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 77 77 | 78 78 | # Single-value expressions 79 79 | print('Hello %s' % "World") @@ -666,6 +695,8 @@ UP031_0.py:80:7: UP031 [*] Use format specifiers instead of percent format 82 82 | print('Hello %s (%s)' % bar.baz) 83 83 | print('Hello %s (%s)' % bar['bop']) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:81:7: UP031 [*] Use format specifiers instead of percent format | 79 | print('Hello %s' % "World") @@ -677,7 +708,6 @@ UP031_0.py:81:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 78 78 | # Single-value expressions 79 79 | print('Hello %s' % "World") 80 80 | print('Hello %s' % f"World") @@ -687,6 +717,8 @@ UP031_0.py:81:7: UP031 [*] Use format specifiers instead of percent format 83 83 | print('Hello %s (%s)' % bar['bop']) 84 84 | print('Hello %(arg)s' % bar) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:82:7: UP031 [*] Use format specifiers instead of percent format | 80 | print('Hello %s' % f"World") @@ -698,7 +730,6 @@ UP031_0.py:82:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 79 79 | print('Hello %s' % "World") 80 80 | print('Hello %s' % f"World") 81 81 | print('Hello %s (%s)' % bar) @@ -708,6 +739,8 @@ UP031_0.py:82:7: UP031 [*] Use format specifiers instead of percent format 84 84 | print('Hello %(arg)s' % bar) 85 85 | print('Hello %(arg)s' % bar.baz) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:83:7: UP031 [*] Use format specifiers instead of percent format | 81 | print('Hello %s (%s)' % bar) @@ -719,7 +752,6 @@ UP031_0.py:83:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 80 80 | print('Hello %s' % f"World") 81 81 | print('Hello %s (%s)' % bar) 82 82 | print('Hello %s (%s)' % bar.baz) @@ -729,6 +761,8 @@ UP031_0.py:83:7: UP031 [*] Use format specifiers instead of percent format 85 85 | print('Hello %(arg)s' % bar.baz) 86 86 | print('Hello %(arg)s' % bar['bop']) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:84:7: UP031 [*] Use format specifiers instead of percent format | 82 | print('Hello %s (%s)' % bar.baz) @@ -740,7 +774,6 @@ UP031_0.py:84:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 81 81 | print('Hello %s (%s)' % bar) 82 82 | print('Hello %s (%s)' % bar.baz) 83 83 | print('Hello %s (%s)' % bar['bop']) @@ -750,6 +783,8 @@ UP031_0.py:84:7: UP031 [*] Use format specifiers instead of percent format 86 86 | print('Hello %(arg)s' % bar['bop']) 87 87 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:85:7: UP031 [*] Use format specifiers instead of percent format | 83 | print('Hello %s (%s)' % bar['bop']) @@ -760,7 +795,6 @@ UP031_0.py:85:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 82 82 | print('Hello %s (%s)' % bar.baz) 83 83 | print('Hello %s (%s)' % bar['bop']) 84 84 | print('Hello %(arg)s' % bar) @@ -770,6 +804,8 @@ UP031_0.py:85:7: UP031 [*] Use format specifiers instead of percent format 87 87 | 88 88 | # Hanging modulos + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:86:7: UP031 [*] Use format specifiers instead of percent format | 84 | print('Hello %(arg)s' % bar) @@ -781,7 +817,6 @@ UP031_0.py:86:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 83 83 | print('Hello %s (%s)' % bar['bop']) 84 84 | print('Hello %(arg)s' % bar) 85 85 | print('Hello %(arg)s' % bar.baz) @@ -791,6 +826,8 @@ UP031_0.py:86:7: UP031 [*] Use format specifiers instead of percent format 88 88 | # Hanging modulos 89 89 | ( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:89:1: UP031 [*] Use format specifiers instead of percent format | 88 | # Hanging modulos @@ -804,7 +841,6 @@ UP031_0.py:89:1: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 87 87 | 88 88 | # Hanging modulos 89 89 | ( @@ -818,6 +854,8 @@ UP031_0.py:89:1: UP031 [*] Use format specifiers instead of percent format 94 94 | ( 95 95 | "foo %(foo)s " + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:94:1: UP031 [*] Use format specifiers instead of percent format | 92 | ) % (x, y) @@ -832,7 +870,6 @@ UP031_0.py:94:1: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 92 92 | ) % (x, y) 93 93 | 94 94 | ( @@ -846,6 +883,8 @@ UP031_0.py:94:1: UP031 [*] Use format specifiers instead of percent format 99 99 | ( 100 100 | """foo %s""" + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:100:5: UP031 [*] Use format specifiers instead of percent format | 99 | ( @@ -857,7 +896,6 @@ UP031_0.py:100:5: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 97 97 | ) % {"foo": x, "bar": y} 98 98 | 99 99 | ( @@ -868,6 +906,8 @@ UP031_0.py:100:5: UP031 [*] Use format specifiers instead of percent format 103 102 | 104 103 | ( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:105:5: UP031 [*] Use format specifiers instead of percent format | 104 | ( @@ -881,7 +921,6 @@ UP031_0.py:105:5: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 103 103 | 104 104 | ( 105 105 | """ @@ -894,6 +933,8 @@ UP031_0.py:105:5: UP031 [*] Use format specifiers instead of percent format 110 109 | 111 110 | "%s" % ( + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:111:1: UP031 [*] Use format specifiers instead of percent format | 109 | ) @@ -905,7 +946,6 @@ UP031_0.py:111:1: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 108 108 | % (x,) 109 109 | ) 110 110 | @@ -915,6 +955,8 @@ UP031_0.py:111:1: UP031 [*] Use format specifiers instead of percent format 113 113 | ) 114 114 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:116:8: UP031 [*] Use format specifiers instead of percent format | 116 | path = "%s-%s-%s.pem" % ( @@ -929,7 +971,6 @@ UP031_0.py:116:8: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 113 113 | ) 114 114 | 115 115 | @@ -939,6 +980,8 @@ UP031_0.py:116:8: UP031 [*] Use format specifiers instead of percent format 118 118 | cert.not_valid_after.date().isoformat().replace("-", ""), # expiration date 119 119 | hexlify(cert.fingerprint(hashes.SHA256())).decode("ascii")[0:8], # fingerprint prefix + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:123:1: UP031 [*] Use format specifiers instead of percent format | 122 | # UP031 (no longer false negatives; now offer potentially unsafe fixes) @@ -949,7 +992,6 @@ UP031_0.py:123:1: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 120 120 | ) 121 121 | 122 122 | # UP031 (no longer false negatives; now offer potentially unsafe fixes) @@ -959,6 +1001,8 @@ UP031_0.py:123:1: UP031 [*] Use format specifiers instead of percent format 125 125 | 'Hello %s' % bar.baz 126 126 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:125:1: UP031 [*] Use format specifiers instead of percent format | 123 | 'Hello %s' % bar @@ -970,7 +1014,6 @@ UP031_0.py:125:1: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 122 122 | # UP031 (no longer false negatives; now offer potentially unsafe fixes) 123 123 | 'Hello %s' % bar 124 124 | @@ -980,6 +1023,8 @@ UP031_0.py:125:1: UP031 [*] Use format specifiers instead of percent format 127 127 | 'Hello %s' % bar['bop'] 128 128 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:127:1: UP031 [*] Use format specifiers instead of percent format | 125 | 'Hello %s' % bar.baz @@ -991,7 +1036,6 @@ UP031_0.py:127:1: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 124 124 | 125 125 | 'Hello %s' % bar.baz 126 126 | @@ -1001,6 +1045,8 @@ UP031_0.py:127:1: UP031 [*] Use format specifiers instead of percent format 129 129 | # Not a valid type annotation but this test shouldn't result in a panic. 130 130 | # Refer: https://github.com/astral-sh/ruff/issues/11736 + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:131:5: UP031 [*] Use format specifiers instead of percent format | 129 | # Not a valid type annotation but this test shouldn't result in a panic. @@ -1012,7 +1058,6 @@ UP031_0.py:131:5: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 128 128 | 129 129 | # Not a valid type annotation but this test shouldn't result in a panic. 130 130 | # Refer: https://github.com/astral-sh/ruff/issues/11736 @@ -1022,6 +1067,8 @@ UP031_0.py:131:5: UP031 [*] Use format specifiers instead of percent format 133 133 | # See: https://github.com/astral-sh/ruff/issues/12421 134 134 | print("%.2X" % 1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:134:7: UP031 [*] Use format specifiers instead of percent format | 133 | # See: https://github.com/astral-sh/ruff/issues/12421 @@ -1032,7 +1079,6 @@ UP031_0.py:134:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 131 131 | x: "'%s + %s' % (1, 2)" 132 132 | 133 133 | # See: https://github.com/astral-sh/ruff/issues/12421 @@ -1042,6 +1088,8 @@ UP031_0.py:134:7: UP031 [*] Use format specifiers instead of percent format 136 136 | print("%02X" % 1) 137 137 | print("%.00002X" % 1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:135:7: UP031 [*] Use format specifiers instead of percent format | 133 | # See: https://github.com/astral-sh/ruff/issues/12421 @@ -1053,7 +1101,6 @@ UP031_0.py:135:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 132 132 | 133 133 | # See: https://github.com/astral-sh/ruff/issues/12421 134 134 | print("%.2X" % 1) @@ -1063,6 +1110,8 @@ UP031_0.py:135:7: UP031 [*] Use format specifiers instead of percent format 137 137 | print("%.00002X" % 1) 138 138 | print("%.20X" % 1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:136:7: UP031 [*] Use format specifiers instead of percent format | 134 | print("%.2X" % 1) @@ -1074,7 +1123,6 @@ UP031_0.py:136:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 133 133 | # See: https://github.com/astral-sh/ruff/issues/12421 134 134 | print("%.2X" % 1) 135 135 | print("%.02X" % 1) @@ -1084,6 +1132,8 @@ UP031_0.py:136:7: UP031 [*] Use format specifiers instead of percent format 138 138 | print("%.20X" % 1) 139 139 | + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:137:7: UP031 [*] Use format specifiers instead of percent format | 135 | print("%.02X" % 1) @@ -1094,7 +1144,6 @@ UP031_0.py:137:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 134 134 | print("%.2X" % 1) 135 135 | print("%.02X" % 1) 136 136 | print("%02X" % 1) @@ -1104,6 +1153,8 @@ UP031_0.py:137:7: UP031 [*] Use format specifiers instead of percent format 139 139 | 140 140 | print("%2X" % 1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:138:7: UP031 [*] Use format specifiers instead of percent format | 136 | print("%02X" % 1) @@ -1115,7 +1166,6 @@ UP031_0.py:138:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 135 135 | print("%.02X" % 1) 136 136 | print("%02X" % 1) 137 137 | print("%.00002X" % 1) @@ -1125,6 +1175,8 @@ UP031_0.py:138:7: UP031 [*] Use format specifiers instead of percent format 140 140 | print("%2X" % 1) 141 141 | print("%02X" % 1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:140:7: UP031 [*] Use format specifiers instead of percent format | 138 | print("%.20X" % 1) @@ -1135,7 +1187,6 @@ UP031_0.py:140:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 137 137 | print("%.00002X" % 1) 138 138 | print("%.20X" % 1) 139 139 | @@ -1143,6 +1194,8 @@ UP031_0.py:140:7: UP031 [*] Use format specifiers instead of percent format 140 |+print("{:2X}".format(1)) 141 141 | print("%02X" % 1) + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. + UP031_0.py:141:7: UP031 [*] Use format specifiers instead of percent format | 140 | print("%2X" % 1) @@ -1151,9 +1204,10 @@ UP031_0.py:141:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Unsafe fix 138 138 | print("%.20X" % 1) 139 139 | 140 140 | print("%2X" % 1) 141 |-print("%02X" % 1) 141 |+print("{:02X}".format(1)) + + Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap index 440878d4fb516..52c2c315e8b35 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap @@ -12,7 +12,6 @@ UP032_0.py:5:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 2 2 | # Errors 3 3 | ### 4 4 | @@ -35,7 +34,6 @@ UP032_0.py:7:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 4 4 | 5 5 | "{} {}".format(a, b) 6 6 | @@ -58,7 +56,6 @@ UP032_0.py:9:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 6 6 | 7 7 | "{1} {0}".format(a, b) 8 8 | @@ -81,7 +78,6 @@ UP032_0.py:11:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 8 8 | 9 9 | "{0} {1} {0}".format(a, b) 10 10 | @@ -104,7 +100,6 @@ UP032_0.py:13:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 10 10 | 11 11 | "{x.y}".format(x=z) 12 12 | @@ -127,7 +122,6 @@ UP032_0.py:15:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 12 12 | 13 13 | "{x} {y} {x}".format(x=a, y=b) 14 14 | @@ -150,7 +144,6 @@ UP032_0.py:17:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 14 14 | 15 15 | "{.x} {.y}".format(a, b) 16 16 | @@ -173,7 +166,6 @@ UP032_0.py:19:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 16 16 | 17 17 | "{} {}".format(a.b, c.d) 18 18 | @@ -196,7 +188,6 @@ UP032_0.py:21:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 18 18 | 19 19 | "{}".format(a()) 20 20 | @@ -219,7 +210,6 @@ UP032_0.py:23:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 20 20 | 21 21 | "{}".format(a.b()) 22 22 | @@ -242,7 +232,6 @@ UP032_0.py:25:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 22 22 | 23 23 | "{}".format(a.b().c()) 24 24 | @@ -265,7 +254,6 @@ UP032_0.py:27:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 24 24 | 25 25 | "hello {}!".format(name) 26 26 | @@ -288,7 +276,6 @@ UP032_0.py:29:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 26 26 | 27 27 | "{}{b}{}".format(a, c, b=b) 28 28 | @@ -311,7 +298,6 @@ UP032_0.py:31:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 28 28 | 29 29 | "{}".format(0x0) 30 30 | @@ -334,7 +320,6 @@ UP032_0.py:33:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 30 30 | 31 31 | "{} {}".format(a, b) 32 32 | @@ -357,7 +342,6 @@ UP032_0.py:35:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 32 32 | 33 33 | """{} {}""".format(a, b) 34 34 | @@ -380,7 +364,6 @@ UP032_0.py:37:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 34 34 | 35 35 | "foo{}".format(1) 36 36 | @@ -403,7 +386,6 @@ UP032_0.py:39:5: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 36 36 | 37 37 | r"foo{}".format(1) 38 38 | @@ -426,7 +408,6 @@ UP032_0.py:41:7: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 38 38 | 39 39 | x = "{a}".format(a=1) 40 40 | @@ -449,7 +430,6 @@ UP032_0.py:43:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 40 40 | 41 41 | print("foo {} ".format(x)) 42 42 | @@ -472,7 +452,6 @@ UP032_0.py:45:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 42 42 | 43 43 | "{a[b]}".format(a=a) 44 44 | @@ -495,7 +474,6 @@ UP032_0.py:47:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 44 44 | 45 45 | "{a.a[b]}".format(a=a) 46 46 | @@ -518,7 +496,6 @@ UP032_0.py:49:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 46 46 | 47 47 | "{}{{}}{}".format(escaped, y) 48 48 | @@ -541,7 +518,6 @@ UP032_0.py:51:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 48 48 | 49 49 | "{}".format(a) 50 50 | @@ -564,7 +540,6 @@ UP032_0.py:53:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 50 50 | 51 51 | '({}={{0!e}})'.format(a) 52 52 | @@ -587,7 +562,6 @@ UP032_0.py:55:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 52 52 | 53 53 | "{[b]}".format(a) 54 54 | @@ -610,7 +584,6 @@ UP032_0.py:57:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 54 54 | 55 55 | '{[b]}'.format(a) 56 56 | @@ -633,7 +606,6 @@ UP032_0.py:59:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 56 56 | 57 57 | """{[b]}""".format(a) 58 58 | @@ -658,7 +630,6 @@ UP032_0.py:61:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 58 58 | 59 59 | '''{[b]}'''.format(a) 60 60 | @@ -685,7 +656,6 @@ UP032_0.py:65:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 62 62 | 1 63 63 | ) 64 64 | @@ -712,7 +682,6 @@ UP032_0.py:69:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 66 66 | 1111111111111111111111111111111111111111111111111111111111111111111111111, 67 67 | ) 68 68 | @@ -743,7 +712,6 @@ UP032_0.py:73:85: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 70 70 | {} 71 71 | """.format(1) 72 72 | @@ -772,7 +740,6 @@ UP032_0.py:79:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 76 76 | 111111 77 77 | ) 78 78 | @@ -798,7 +765,6 @@ UP032_0.py:81:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 79 79 | "{a}" "{b}".format(a=1, b=1) 80 80 | 81 81 | ( @@ -830,7 +796,6 @@ UP032_0.py:86:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 84 84 | ).format(a=1, b=1) 85 85 | 86 86 | ( @@ -865,7 +830,6 @@ UP032_0.py:94:5: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 93 93 | ( 94 94 | ( 95 95 | # comment @@ -896,7 +860,6 @@ UP032_0.py:104:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 102 102 | ) 103 103 | 104 104 | ( @@ -919,7 +882,6 @@ UP032_0.py:111:11: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 108 108 | 109 109 | 110 110 | def d(osname, version, release): @@ -939,7 +901,6 @@ UP032_0.py:115:10: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 112 112 | 113 113 | 114 114 | def e(): @@ -958,7 +919,6 @@ UP032_0.py:118:7: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 115 115 | yield"{}".format(1) 116 116 | 117 117 | @@ -978,7 +938,6 @@ UP032_0.py:122:12: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 119 119 | 120 120 | 121 121 | async def c(): @@ -998,7 +957,6 @@ UP032_0.py:126:12: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 123 123 | 124 124 | 125 125 | async def c(): @@ -1019,7 +977,6 @@ UP032_0.py:129:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 126 126 | return "{}".format(1 + await 3) 127 127 | 128 128 | @@ -1044,7 +1001,6 @@ UP032_0.py:160:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 157 157 | 158 158 | r'"\N{snowman} {}".format(a)' 159 159 | @@ -1077,7 +1033,6 @@ UP032_0.py:164:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 161 161 | 11111111111111111111111111111111111111111111111111111111111111111111111111, 162 162 | ) 163 163 | @@ -1115,7 +1070,6 @@ UP032_0.py:174:84: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 171 171 | 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111, 172 172 | ) 173 173 | @@ -1153,7 +1107,6 @@ UP032_0.py:209:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 206 206 | 207 207 | # The fixed string will exceed the line length, but it's still smaller than the 208 208 | # existing line length, so it's fine. @@ -1177,7 +1130,6 @@ UP032_0.py:212:18: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 209 209 | "".format(self.internal_ids, self.external_ids, self.properties, self.tags, self.others) 210 210 | 211 211 | # When fixing, trim the trailing empty string. @@ -1202,7 +1154,6 @@ UP032_0.py:216:18: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 213 213 | "".format(new_dict, d)) 214 214 | 215 215 | # When fixing, trim the trailing empty string. @@ -1227,7 +1178,6 @@ UP032_0.py:220:5: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 217 217 | .format(new_dict, d)) 218 218 | 219 219 | raise ValueError( @@ -1252,7 +1202,6 @@ UP032_0.py:225:5: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 222 222 | ) 223 223 | 224 224 | raise ValueError( @@ -1278,7 +1227,6 @@ UP032_0.py:231:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 229 229 | 230 230 | # The first string will be converted to an f-string and the curly braces in the second should be converted to be unescaped 231 231 | ( @@ -1302,7 +1250,6 @@ UP032_0.py:236:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 233 233 | "{{}}" 234 234 | ).format(a) 235 235 | @@ -1327,7 +1274,6 @@ UP032_0.py:240:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 238 238 | 239 239 | # Both strings will be converted to an f-string and the curly braces in the second should left escaped 240 240 | ( @@ -1354,7 +1300,6 @@ UP032_0.py:245:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 242 242 | "{{{}}}" 243 243 | ).format(a, b) 244 244 | @@ -1376,7 +1321,6 @@ UP032_0.py:248:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 245 245 | ("{}" "{{{}}}").format(a, b) 246 246 | 247 247 | # The dictionary should be parenthesized. @@ -1398,7 +1342,6 @@ UP032_0.py:251:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 248 248 | "{}".format({0: 1}[0]) 249 249 | 250 250 | # The dictionary should be parenthesized. @@ -1420,7 +1363,6 @@ UP032_0.py:254:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 251 251 | "{}".format({0: 1}.bar) 252 252 | 253 253 | # The dictionary should be parenthesized. @@ -1442,7 +1384,6 @@ UP032_0.py:261:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 258 258 | "{0} {0}".format(foo()) 259 259 | 260 260 | # The string _should_ be converted, since the function call is repeated in the arguments. @@ -1464,7 +1405,6 @@ UP032_0.py:264:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 261 261 | "{0} {1}".format(foo(), foo()) 262 262 | 263 263 | # The call should be removed, but the string itself should remain. @@ -1486,7 +1426,6 @@ UP032_0.py:267:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 264 264 | ''.format(self.project) 265 265 | 266 266 | # The call should be removed, but the string itself should remain. @@ -1507,7 +1446,6 @@ UP032_0.py:271:5: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 268 268 | 269 269 | # Not a valid type annotation but this test shouldn't result in a panic. 270 270 | # Refer: https://github.com/astral-sh/ruff/issues/11736 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap index e33290ea4624b..386a17514fecb 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap @@ -8,7 +8,6 @@ UP032_1.py:1:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 1 |-"{} {}".format(a, b) # Intentionally at start-of-file, to ensure graceful handling. 1 |+f"{a} {b}" # Intentionally at start-of-file, to ensure graceful handling. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap index 73b978b1c9a15..10d07aa21abb2 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap @@ -11,7 +11,6 @@ UP032_2.py:2:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 1 1 | # Errors 2 |-"{.real}".format(1) 2 |+f"{(1).real}" @@ -31,7 +30,6 @@ UP032_2.py:3:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 1 1 | # Errors 2 2 | "{.real}".format(1) 3 |-"{0.real}".format(1) @@ -53,7 +51,6 @@ UP032_2.py:4:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 1 1 | # Errors 2 2 | "{.real}".format(1) 3 3 | "{0.real}".format(1) @@ -76,7 +73,6 @@ UP032_2.py:6:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 3 3 | "{0.real}".format(1) 4 4 | "{a.real}".format(a=1) 5 5 | @@ -97,7 +93,6 @@ UP032_2.py:7:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 4 4 | "{a.real}".format(a=1) 5 5 | 6 6 | "{.real}".format(1.0) @@ -120,7 +115,6 @@ UP032_2.py:8:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 5 5 | 6 6 | "{.real}".format(1.0) 7 7 | "{0.real}".format(1.0) @@ -143,7 +137,6 @@ UP032_2.py:10:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 7 7 | "{0.real}".format(1.0) 8 8 | "{a.real}".format(a=1.0) 9 9 | @@ -164,7 +157,6 @@ UP032_2.py:11:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 8 8 | "{a.real}".format(a=1.0) 9 9 | 10 10 | "{.real}".format(1j) @@ -187,7 +179,6 @@ UP032_2.py:12:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 9 9 | 10 10 | "{.real}".format(1j) 11 11 | "{0.real}".format(1j) @@ -210,7 +201,6 @@ UP032_2.py:14:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 11 11 | "{0.real}".format(1j) 12 12 | "{a.real}".format(a=1j) 13 13 | @@ -231,7 +221,6 @@ UP032_2.py:15:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 12 12 | "{a.real}".format(a=1j) 13 13 | 14 14 | "{.real}".format(0b01) @@ -254,7 +243,6 @@ UP032_2.py:16:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 13 13 | 14 14 | "{.real}".format(0b01) 15 15 | "{0.real}".format(0b01) @@ -277,7 +265,6 @@ UP032_2.py:18:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 15 15 | "{0.real}".format(0b01) 16 16 | "{a.real}".format(a=0b01) 17 17 | @@ -299,7 +286,6 @@ UP032_2.py:19:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 16 16 | "{a.real}".format(a=0b01) 17 17 | 18 18 | "{}".format(1 + 2) @@ -322,7 +308,6 @@ UP032_2.py:20:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 17 17 | 18 18 | "{}".format(1 + 2) 19 19 | "{}".format([1, 2]) @@ -344,7 +329,6 @@ UP032_2.py:21:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 18 18 | "{}".format(1 + 2) 19 19 | "{}".format([1, 2]) 20 20 | "{}".format({1, 2}) @@ -367,7 +351,6 @@ UP032_2.py:22:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 19 19 | "{}".format([1, 2]) 20 20 | "{}".format({1, 2}) 21 21 | "{}".format({1: 2, 3: 4}) @@ -390,7 +373,6 @@ UP032_2.py:24:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 21 21 | "{}".format({1: 2, 3: 4}) 22 22 | "{}".format((i for i in range(2))) 23 23 | @@ -412,7 +394,6 @@ UP032_2.py:25:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 22 22 | "{}".format((i for i in range(2))) 23 23 | 24 24 | "{.real}".format(1 + 2) @@ -435,7 +416,6 @@ UP032_2.py:26:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 23 23 | 24 24 | "{.real}".format(1 + 2) 25 25 | "{.real}".format([1, 2]) @@ -456,7 +436,6 @@ UP032_2.py:27:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 24 24 | "{.real}".format(1 + 2) 25 25 | "{.real}".format([1, 2]) 26 26 | "{.real}".format({1, 2}) @@ -475,7 +454,6 @@ UP032_2.py:28:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -Suggested fix: 25 25 | "{.real}".format([1, 2]) 26 26 | "{.real}".format({1, 2}) 27 27 | "{.real}".format({1: 2, 3: 4}) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_0.py.snap index ec806a3dd0dab..90a6c6cbe2dcf 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_0.py.snap @@ -10,7 +10,6 @@ UP033_0.py:4:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_cac | = help: Rewrite with `@functools.cache -Suggested fix: 1 1 | import functools 2 2 | 3 3 | @@ -32,7 +31,6 @@ UP033_0.py:10:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca | = help: Rewrite with `@functools.cache -Suggested fix: 7 7 | 8 8 | 9 9 | @other_decorator @@ -53,7 +51,6 @@ UP033_0.py:15:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca | = help: Rewrite with `@functools.cache -Suggested fix: 12 12 | pass 13 13 | 14 14 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_1.py.snap index 6a9471ce4c467..16dbb72014b3a 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_1.py.snap @@ -10,7 +10,6 @@ UP033_1.py:4:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_cac | = help: Rewrite with `@functools.cache -Suggested fix: 1 |-from functools import lru_cache 1 |+from functools import lru_cache, cache 2 2 | @@ -33,7 +32,6 @@ UP033_1.py:10:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca | = help: Rewrite with `@functools.cache -Suggested fix: 1 |-from functools import lru_cache 1 |+from functools import lru_cache, cache 2 2 | @@ -60,7 +58,6 @@ UP033_1.py:15:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca | = help: Rewrite with `@functools.cache -Suggested fix: 1 |-from functools import lru_cache 1 |+from functools import lru_cache, cache 2 2 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP034.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP034.py.snap index 4ee8189e4954c..b3160ea7d7f9d 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP034.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP034.py.snap @@ -11,7 +11,6 @@ UP034.py:2:7: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -Suggested fix: 1 1 | # UP034 2 |-print(("foo")) 2 |+print("foo") @@ -31,7 +30,6 @@ UP034.py:5:7: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -Suggested fix: 2 2 | print(("foo")) 3 3 | 4 4 | # UP034 @@ -53,7 +51,6 @@ UP034.py:8:7: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -Suggested fix: 5 5 | print(("hell((goodybe))o")) 6 6 | 7 7 | # UP034 @@ -75,7 +72,6 @@ UP034.py:11:7: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -Suggested fix: 8 8 | print((("foo"))) 9 9 | 10 10 | # UP034 @@ -97,7 +93,6 @@ UP034.py:14:7: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -Suggested fix: 11 11 | print((((1)))) 12 12 | 13 13 | # UP034 @@ -119,7 +114,6 @@ UP034.py:18:5: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -Suggested fix: 15 15 | 16 16 | # UP034 17 17 | print( @@ -144,7 +138,6 @@ UP034.py:23:5: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -Suggested fix: 20 20 | 21 21 | # UP034 22 22 | print( @@ -170,7 +163,6 @@ UP034.py:30:13: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -Suggested fix: 27 27 | 28 28 | # UP034 29 29 | def f(): @@ -192,7 +184,6 @@ UP034.py:35:9: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -Suggested fix: 32 32 | # UP034 33 33 | if True: 34 34 | print( @@ -214,7 +205,6 @@ UP034.py:39:7: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -Suggested fix: 36 36 | ) 37 37 | 38 38 | # UP034 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap index ca712f56496ae..c07b7f8c232b9 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap @@ -11,7 +11,6 @@ UP035.py:2:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -Suggested fix: 1 1 | # UP035 2 |-from collections import Mapping 2 |+from collections.abc import Mapping @@ -32,7 +31,6 @@ UP035.py:4:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -Suggested fix: 1 1 | # UP035 2 2 | from collections import Mapping 3 3 | @@ -55,7 +53,6 @@ UP035.py:6:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Seque | = help: Import from `collections.abc` -Suggested fix: 3 3 | 4 4 | from collections import Mapping as MAP 5 5 | @@ -78,7 +75,6 @@ UP035.py:8:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -Suggested fix: 5 5 | 6 6 | from collections import Mapping, Sequence 7 7 | @@ -102,7 +98,6 @@ UP035.py:10:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -Suggested fix: 7 7 | 8 8 | from collections import Counter, Mapping 9 9 | @@ -127,7 +122,6 @@ UP035.py:12:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -Suggested fix: 9 9 | 10 10 | from collections import (Counter, Mapping) 11 11 | @@ -153,7 +147,6 @@ UP035.py:15:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -Suggested fix: 12 12 | from collections import (Counter, 13 13 | Mapping) 14 14 | @@ -178,7 +171,6 @@ UP035.py:18:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequ | = help: Import from `collections.abc` -Suggested fix: 15 15 | from collections import Counter, \ 16 16 | Mapping 17 17 | @@ -202,7 +194,6 @@ UP035.py:20:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -Suggested fix: 17 17 | 18 18 | from collections import Counter, Mapping, Sequence 19 19 | @@ -225,7 +216,6 @@ UP035.py:23:5: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -Suggested fix: 20 20 | from collections import Mapping as mapping, Counter 21 21 | 22 22 | if True: @@ -249,7 +239,6 @@ UP035.py:28:5: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -Suggested fix: 25 25 | if True: 26 26 | if True: 27 27 | pass @@ -273,7 +262,6 @@ UP035.py:30:10: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -Suggested fix: 27 27 | pass 28 28 | from collections import Mapping, Counter 29 29 | @@ -294,7 +282,6 @@ UP035.py:33:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -Suggested fix: 30 30 | if True: from collections import Mapping 31 31 | 32 32 | import os @@ -323,7 +310,6 @@ UP035.py:37:5: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Call | = help: Import from `collections.abc` -Suggested fix: 35 35 | 36 36 | if True: 37 37 | from collections import ( @@ -350,7 +336,6 @@ UP035.py:44:1: UP035 [*] Import from `collections.abc` instead: `Callable` | = help: Import from `collections.abc` -Suggested fix: 41 41 | Good, 42 42 | ) 43 43 | @@ -374,7 +359,6 @@ UP035.py:44:1: UP035 [*] Import from `collections` instead: `OrderedDict` | = help: Import from `collections` -Suggested fix: 41 41 | Good, 42 42 | ) 43 43 | @@ -398,7 +382,6 @@ UP035.py:44:1: UP035 [*] Import from `re` instead: `Match`, `Pattern` | = help: Import from `re` -Suggested fix: 41 41 | Good, 42 42 | ) 43 43 | @@ -474,7 +457,6 @@ UP035.py:51:1: UP035 [*] Import from `collections` instead: `OrderedDict` | = help: Import from `collections` -Suggested fix: 48 48 | 49 49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035) 50 50 | from typing import ContextManager @@ -497,7 +479,6 @@ UP035.py:52:1: UP035 [*] Import from `typing` instead: `OrderedDict` | = help: Import from `typing` -Suggested fix: 49 49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035) 50 50 | from typing import ContextManager 51 51 | from typing import OrderedDict @@ -520,7 +501,6 @@ UP035.py:53:1: UP035 [*] Import from `collections.abc` instead: `Callable` | = help: Import from `collections.abc` -Suggested fix: 50 50 | from typing import ContextManager 51 51 | from typing import OrderedDict 52 52 | from typing_extensions import OrderedDict @@ -543,7 +523,6 @@ UP035.py:54:1: UP035 [*] Import from `collections.abc` instead: `ByteString` | = help: Import from `collections.abc` -Suggested fix: 51 51 | from typing import OrderedDict 52 52 | from typing_extensions import OrderedDict 53 53 | from typing import Callable @@ -566,7 +545,6 @@ UP035.py:55:1: UP035 [*] Import from `collections.abc` instead: `Container` | = help: Import from `collections.abc` -Suggested fix: 52 52 | from typing_extensions import OrderedDict 53 53 | from typing import Callable 54 54 | from typing import ByteString @@ -589,7 +567,6 @@ UP035.py:56:1: UP035 [*] Import from `collections.abc` instead: `Hashable` | = help: Import from `collections.abc` -Suggested fix: 53 53 | from typing import Callable 54 54 | from typing import ByteString 55 55 | from typing import Container @@ -612,7 +589,6 @@ UP035.py:57:1: UP035 [*] Import from `collections.abc` instead: `ItemsView` | = help: Import from `collections.abc` -Suggested fix: 54 54 | from typing import ByteString 55 55 | from typing import Container 56 56 | from typing import Hashable @@ -635,7 +611,6 @@ UP035.py:58:1: UP035 [*] Import from `collections.abc` instead: `Iterable` | = help: Import from `collections.abc` -Suggested fix: 55 55 | from typing import Container 56 56 | from typing import Hashable 57 57 | from typing import ItemsView @@ -658,7 +633,6 @@ UP035.py:59:1: UP035 [*] Import from `collections.abc` instead: `Iterator` | = help: Import from `collections.abc` -Suggested fix: 56 56 | from typing import Hashable 57 57 | from typing import ItemsView 58 58 | from typing import Iterable @@ -681,7 +655,6 @@ UP035.py:60:1: UP035 [*] Import from `collections.abc` instead: `KeysView` | = help: Import from `collections.abc` -Suggested fix: 57 57 | from typing import ItemsView 58 58 | from typing import Iterable 59 59 | from typing import Iterator @@ -704,7 +677,6 @@ UP035.py:61:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -Suggested fix: 58 58 | from typing import Iterable 59 59 | from typing import Iterator 60 60 | from typing import KeysView @@ -727,7 +699,6 @@ UP035.py:62:1: UP035 [*] Import from `collections.abc` instead: `MappingView` | = help: Import from `collections.abc` -Suggested fix: 59 59 | from typing import Iterator 60 60 | from typing import KeysView 61 61 | from typing import Mapping @@ -750,7 +721,6 @@ UP035.py:63:1: UP035 [*] Import from `collections.abc` instead: `MutableMapping` | = help: Import from `collections.abc` -Suggested fix: 60 60 | from typing import KeysView 61 61 | from typing import Mapping 62 62 | from typing import MappingView @@ -773,7 +743,6 @@ UP035.py:64:1: UP035 [*] Import from `collections.abc` instead: `MutableSequence | = help: Import from `collections.abc` -Suggested fix: 61 61 | from typing import Mapping 62 62 | from typing import MappingView 63 63 | from typing import MutableMapping @@ -796,7 +765,6 @@ UP035.py:65:1: UP035 [*] Import from `collections.abc` instead: `MutableSet` | = help: Import from `collections.abc` -Suggested fix: 62 62 | from typing import MappingView 63 63 | from typing import MutableMapping 64 64 | from typing import MutableSequence @@ -819,7 +787,6 @@ UP035.py:66:1: UP035 [*] Import from `collections.abc` instead: `Sequence` | = help: Import from `collections.abc` -Suggested fix: 63 63 | from typing import MutableMapping 64 64 | from typing import MutableSequence 65 65 | from typing import MutableSet @@ -842,7 +809,6 @@ UP035.py:67:1: UP035 [*] Import from `collections.abc` instead: `Sized` | = help: Import from `collections.abc` -Suggested fix: 64 64 | from typing import MutableSequence 65 65 | from typing import MutableSet 66 66 | from typing import Sequence @@ -865,7 +831,6 @@ UP035.py:68:1: UP035 [*] Import from `collections.abc` instead: `ValuesView` | = help: Import from `collections.abc` -Suggested fix: 65 65 | from typing import MutableSet 66 66 | from typing import Sequence 67 67 | from typing import Sized @@ -888,7 +853,6 @@ UP035.py:69:1: UP035 [*] Import from `collections.abc` instead: `Awaitable` | = help: Import from `collections.abc` -Suggested fix: 66 66 | from typing import Sequence 67 67 | from typing import Sized 68 68 | from typing import ValuesView @@ -911,7 +875,6 @@ UP035.py:70:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterator` | = help: Import from `collections.abc` -Suggested fix: 67 67 | from typing import Sized 68 68 | from typing import ValuesView 69 69 | from typing import Awaitable @@ -934,7 +897,6 @@ UP035.py:71:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterable` | = help: Import from `collections.abc` -Suggested fix: 68 68 | from typing import ValuesView 69 69 | from typing import Awaitable 70 70 | from typing import AsyncIterator @@ -957,7 +919,6 @@ UP035.py:72:1: UP035 [*] Import from `collections.abc` instead: `Coroutine` | = help: Import from `collections.abc` -Suggested fix: 69 69 | from typing import Awaitable 70 70 | from typing import AsyncIterator 71 71 | from typing import AsyncIterable @@ -980,7 +941,6 @@ UP035.py:73:1: UP035 [*] Import from `collections.abc` instead: `Collection` | = help: Import from `collections.abc` -Suggested fix: 70 70 | from typing import AsyncIterator 71 71 | from typing import AsyncIterable 72 72 | from typing import Coroutine @@ -1003,7 +963,6 @@ UP035.py:74:1: UP035 [*] Import from `collections.abc` instead: `AsyncGenerator` | = help: Import from `collections.abc` -Suggested fix: 71 71 | from typing import AsyncIterable 72 72 | from typing import Coroutine 73 73 | from typing import Collection @@ -1026,7 +985,6 @@ UP035.py:75:1: UP035 [*] Import from `collections.abc` instead: `Reversible` | = help: Import from `collections.abc` -Suggested fix: 72 72 | from typing import Coroutine 73 73 | from typing import Collection 74 74 | from typing import AsyncGenerator @@ -1049,7 +1007,6 @@ UP035.py:76:1: UP035 [*] Import from `collections.abc` instead: `Generator` | = help: Import from `collections.abc` -Suggested fix: 73 73 | from typing import Collection 74 74 | from typing import AsyncGenerator 75 75 | from typing import Reversible @@ -1071,7 +1028,6 @@ UP035.py:77:1: UP035 [*] Import from `collections.abc` instead: `Callable` | = help: Import from `collections.abc` -Suggested fix: 74 74 | from typing import AsyncGenerator 75 75 | from typing import Reversible 76 76 | from typing import Generator @@ -1093,7 +1049,6 @@ UP035.py:84:1: UP035 [*] Import from `typing` instead: `SupportsIndex` | = help: Import from `typing` -Suggested fix: 81 81 | from a import b 82 82 | 83 83 | # UP035 on py312+ only @@ -1115,7 +1070,6 @@ UP035.py:87:1: UP035 [*] Import from `typing` instead: `NamedTuple` | = help: Import from `typing` -Suggested fix: 84 84 | from typing_extensions import SupportsIndex 85 85 | 86 86 | # UP035 on py312+ only @@ -1137,7 +1091,6 @@ UP035.py:90:1: UP035 [*] Import from `typing` instead: `dataclass_transform` | = help: Import from `typing` -Suggested fix: 87 87 | from typing_extensions import NamedTuple 88 88 | 89 89 | # UP035 on py312+ only: `typing_extensions` supports `frozen_default` (backported from 3.12). @@ -1159,7 +1112,6 @@ UP035.py:93:1: UP035 [*] Import from `enum` instead: `StrEnum` | = help: Import from `enum` -Suggested fix: 90 90 | from typing_extensions import dataclass_transform 91 91 | 92 92 | # UP035 @@ -1181,7 +1133,6 @@ UP035.py:96:1: UP035 [*] Import from `typing` instead: `override` | = help: Import from `typing` -Suggested fix: 93 93 | from backports.strenum import StrEnum 94 94 | 95 95 | # UP035 @@ -1203,7 +1154,6 @@ UP035.py:99:1: UP035 [*] Import from `collections.abc` instead: `Buffer` | = help: Import from `collections.abc` -Suggested fix: 96 96 | from typing_extensions import override 97 97 | 98 98 | # UP035 @@ -1225,7 +1175,6 @@ UP035.py:102:1: UP035 [*] Import from `types` instead: `get_original_bases` | = help: Import from `types` -Suggested fix: 99 99 | from typing_extensions import Buffer 100 100 | 101 101 | # UP035 @@ -1247,7 +1196,6 @@ UP035.py:105:1: UP035 [*] Import from `typing` instead: `TypeVar` | = help: Import from `typing` -Suggested fix: 102 102 | from typing_extensions import get_original_bases 103 103 | 104 104 | # UP035 on py313+ only @@ -1269,7 +1217,6 @@ UP035.py:108:1: UP035 [*] Import from `types` instead: `CapsuleType` | = help: Import from `types` -Suggested fix: 105 105 | from typing_extensions import TypeVar 106 106 | 107 107 | # UP035 on py313+ only @@ -1289,7 +1236,6 @@ UP035.py:111:1: UP035 [*] Import from `warnings` instead: `deprecated` | = help: Import from `warnings` -Suggested fix: 108 108 | from typing_extensions import CapsuleType 109 109 | 110 110 | # UP035 on py313+ only diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap index d9126999a9025..8d0b3c8af4b23 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap @@ -12,7 +12,6 @@ UP036_0.py:3:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 1 1 | import sys 2 2 | 3 |-if sys.version_info < (3,0): @@ -37,7 +36,6 @@ UP036_0.py:8:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 5 5 | else: 6 6 | print("py3") 7 7 | @@ -65,7 +63,6 @@ UP036_0.py:16:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 13 13 | else: 14 14 | print("py3") 15 15 | @@ -88,7 +85,6 @@ UP036_0.py:20:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 17 17 | else: print("PY3!") 18 18 | 19 19 | if True: @@ -114,7 +110,6 @@ UP036_0.py:25:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 22 22 | else: 23 23 | print("PY3") 24 24 | @@ -139,7 +134,6 @@ UP036_0.py:29:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 26 26 | else: 27 27 | print("py3") 28 28 | @@ -170,7 +164,6 @@ UP036_0.py:37:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 34 34 | print("py3") 35 35 | print("This the next") 36 36 | @@ -196,7 +189,6 @@ UP036_0.py:45:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 42 42 | 43 43 | x = 1 44 44 | @@ -221,7 +213,6 @@ UP036_0.py:53:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 50 50 | 51 51 | x = 1 52 52 | @@ -245,7 +236,6 @@ UP036_0.py:56:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 53 53 | if sys.version_info > (3,0): print("py3") 54 54 | else: print("py2") 55 55 | @@ -270,7 +260,6 @@ UP036_0.py:62:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 59 59 | print("py2") 60 60 | 61 61 | if True: @@ -296,7 +285,6 @@ UP036_0.py:67:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 64 64 | else: 65 65 | print("py2") 66 66 | @@ -321,7 +309,6 @@ UP036_0.py:73:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 70 70 | print("py3") 71 71 | 72 72 | def f(): @@ -350,7 +337,6 @@ UP036_0.py:86:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 83 83 | def g(): 84 84 | pass 85 85 | @@ -378,7 +364,6 @@ UP036_0.py:97:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 94 94 | pass 95 95 | 96 96 | if True: @@ -404,7 +389,6 @@ UP036_0.py:104:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 101 101 | 102 102 | # comment 103 103 | @@ -438,7 +422,6 @@ UP036_0.py:116:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 113 113 | print("py3") 114 114 | 115 115 | if True: @@ -461,7 +444,6 @@ UP036_0.py:122:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 119 119 | print(2+3) 120 120 | 121 121 | if True: @@ -482,7 +464,6 @@ UP036_0.py:125:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 122 122 | if sys.version_info > (3,): print(3) 123 123 | 124 124 | if True: @@ -505,7 +486,6 @@ UP036_0.py:130:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 127 127 | 128 128 | 129 129 | if True: @@ -534,7 +514,6 @@ UP036_0.py:140:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 137 137 | ] 138 138 | 139 139 | @@ -563,7 +542,6 @@ UP036_0.py:150:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 147 147 | ] 148 148 | 149 149 | @@ -600,7 +578,6 @@ UP036_0.py:163:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 160 160 | ("so is" 161 161 | "this for some reason") 162 162 | @@ -623,7 +600,6 @@ UP036_0.py:166:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 163 163 | if sys.version_info > (3, 0): expected_error = \ 164 164 | [] 165 165 | @@ -645,7 +621,6 @@ UP036_0.py:168:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 165 165 | 166 166 | if sys.version_info > (3, 0): expected_error = [] 167 167 | @@ -667,7 +642,6 @@ UP036_0.py:172:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 169 169 | expected_error = [] 170 170 | 171 171 | if True: @@ -689,7 +663,6 @@ UP036_0.py:176:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 173 173 | [] 174 174 | 175 175 | if True: @@ -710,7 +683,6 @@ UP036_0.py:179:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 176 176 | if sys.version_info > (3, 0): expected_error = [] 177 177 | 178 178 | if True: @@ -731,7 +703,6 @@ UP036_0.py:182:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 179 179 | if sys.version_info > (3, 0): \ 180 180 | expected_error = [] 181 181 | @@ -780,7 +751,6 @@ UP036_0.py:203:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 200 200 | if sys.version_info > (3,13): 201 201 | print("py3") 202 202 | @@ -802,7 +772,6 @@ UP036_0.py:207:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 204 204 | print("py3") 205 205 | 206 206 | # Slices on `sys.version_info` should be treated equivalently. @@ -825,7 +794,6 @@ UP036_0.py:210:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 207 207 | if sys.version_info[:2] >= (3,0): 208 208 | print("py3") 209 209 | @@ -849,7 +817,6 @@ UP036_0.py:219:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 216 216 | if sys.version_info[:3] > (3,14): 217 217 | print("py3") 218 218 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap index 715387e52f222..13cbc27b757d3 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap @@ -12,7 +12,6 @@ UP036_1.py:3:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 1 1 | import sys 2 2 | 3 |-if sys.version_info == 2: @@ -37,7 +36,6 @@ UP036_1.py:8:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 5 5 | else: 6 6 | 3 7 7 | @@ -63,7 +61,6 @@ UP036_1.py:13:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 10 10 | else: 11 11 | 3 12 12 | @@ -89,7 +86,6 @@ UP036_1.py:18:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 15 15 | else: 16 16 | 3 17 17 | @@ -115,7 +111,6 @@ UP036_1.py:23:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 20 20 | else: 21 21 | 2 22 22 | @@ -141,7 +136,6 @@ UP036_1.py:28:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 25 25 | else: 26 26 | 2 27 27 | @@ -167,7 +161,6 @@ UP036_1.py:35:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 32 32 | 33 33 | from sys import version_info 34 34 | @@ -193,7 +186,6 @@ UP036_1.py:42:6: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 39 39 | 40 40 | if True: 41 41 | print(1) @@ -216,7 +208,6 @@ UP036_1.py:49:6: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 46 46 | 47 47 | if True: 48 48 | print(1) @@ -241,7 +232,6 @@ UP036_1.py:56:6: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 53 53 | 54 54 | if True: 55 55 | print(1) @@ -263,7 +253,6 @@ UP036_1.py:62:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 59 59 | def f(): 60 60 | if True: 61 61 | print(1) @@ -286,7 +275,6 @@ UP036_1.py:67:6: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 64 64 | 65 65 | if True: 66 66 | print(1) @@ -308,7 +296,6 @@ UP036_1.py:75:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 72 72 | def f(): 73 73 | if True: 74 74 | print(1) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap index f71484c8ad438..bb3def085b1ae 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap @@ -12,7 +12,6 @@ UP036_2.py:4:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 1 1 | import sys 2 2 | from sys import version_info 3 3 | @@ -38,7 +37,6 @@ UP036_2.py:9:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 6 6 | else: 7 7 | 3-5 8 8 | @@ -64,7 +62,6 @@ UP036_2.py:14:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 11 11 | else: 12 12 | 3-5 13 13 | @@ -90,7 +87,6 @@ UP036_2.py:19:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 16 16 | else: 17 17 | 3-5 18 18 | @@ -116,7 +112,6 @@ UP036_2.py:24:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 21 21 | else: 22 22 | 3-5 23 23 | @@ -142,7 +137,6 @@ UP036_2.py:29:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 26 26 | else: 27 27 | 3+6 28 28 | @@ -168,7 +162,6 @@ UP036_2.py:34:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 31 31 | else: 32 32 | 3+6 33 33 | @@ -193,7 +186,6 @@ UP036_2.py:39:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 36 36 | else: 37 37 | 3+6 38 38 | @@ -216,7 +208,6 @@ UP036_2.py:42:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 39 39 | if sys.version_info >= (3, 5): 40 40 | pass 41 41 | @@ -237,7 +228,6 @@ UP036_2.py:46:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 43 43 | pass 44 44 | 45 45 | if True: @@ -261,7 +251,6 @@ UP036_2.py:49:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 46 46 | if sys.version_info < (3,0): 47 47 | pass 48 48 | @@ -286,7 +275,6 @@ UP036_2.py:54:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 51 51 | elif False: 52 52 | pass 53 53 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap index 9318e00d00d0b..b102e2a197e13 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap @@ -12,7 +12,6 @@ UP036_3.py:3:15: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 1 1 | import sys 2 2 | 3 |-if sys.version_info < (3,0): @@ -42,7 +41,6 @@ UP036_3.py:13:19: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 10 10 | print(f"PY3-{item}") 11 11 | 12 12 | if False: @@ -71,7 +69,6 @@ UP036_3.py:23:15: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 20 20 | print(f"PY3-{item}") 21 21 | 22 22 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap index 9d5db7df5042c..aa7f68bb9d913 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap @@ -10,7 +10,6 @@ UP036_4.py:4:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 1 1 | import sys 2 2 | 3 3 | if True: @@ -33,7 +32,6 @@ UP036_4.py:11:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 8 8 | if True: 9 9 | if foo: 10 10 | print() @@ -57,7 +55,6 @@ UP036_4.py:17:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 14 14 | if True: 15 15 | if foo: 16 16 | print() @@ -79,7 +76,6 @@ UP036_4.py:24:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 21 21 | 22 22 | if foo: 23 23 | print() @@ -102,7 +98,6 @@ UP036_4.py:27:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 24 24 | elif sys.version_info < (3, 3): 25 25 | cmd = [sys.executable, "-m", "test.regrtest"] 26 26 | @@ -125,7 +120,6 @@ UP036_4.py:32:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 29 29 | 30 30 | if foo: 31 31 | print() @@ -148,7 +142,6 @@ UP036_4.py:37:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 34 34 | else: 35 35 | cmd = [sys.executable, "-m", "test", "-j0"] 36 36 | @@ -174,7 +167,6 @@ UP036_4.py:42:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 39 39 | else: 40 40 | cmd = [sys.executable, "-m", "test", "-j0"] 41 41 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap index b7df20b2281a8..24bdc548f2c57 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap @@ -12,7 +12,6 @@ UP036_5.py:3:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 1 1 | import sys 2 2 | 3 |-if sys.version_info < (3, 8): @@ -43,7 +42,6 @@ UP036_5.py:18:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -Suggested fix: 15 15 | 16 16 | import sys 17 17 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap index ad354310e94c7..6708c75294dd4 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap @@ -9,7 +9,6 @@ UP037_0.py:18:14: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 15 15 | from mypy_extensions import Arg, DefaultArg, DefaultNamedArg, NamedArg, VarArg 16 16 | 17 17 | @@ -29,7 +28,6 @@ UP037_0.py:18:28: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 15 15 | from mypy_extensions import Arg, DefaultArg, DefaultNamedArg, NamedArg, VarArg 16 16 | 17 17 | @@ -49,7 +47,6 @@ UP037_0.py:19:8: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 16 16 | 17 17 | 18 18 | def foo(var: "MyClass") -> "MyClass": @@ -69,7 +66,6 @@ UP037_0.py:22:21: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 19 19 | x: "MyClass" 20 20 | 21 21 | @@ -89,7 +85,6 @@ UP037_0.py:26:16: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 23 23 | pass 24 24 | 25 25 | @@ -109,7 +104,6 @@ UP037_0.py:26:33: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 23 23 | pass 24 24 | 25 25 | @@ -130,7 +124,6 @@ UP037_0.py:30:10: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 27 27 | pass 28 28 | 29 29 | @@ -151,7 +144,6 @@ UP037_0.py:32:14: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 29 29 | 30 30 | x: Tuple["MyClass"] 31 31 | @@ -171,7 +163,6 @@ UP037_0.py:36:8: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 33 33 | 34 34 | 35 35 | class Foo(NamedTuple): @@ -191,7 +182,6 @@ UP037_0.py:40:27: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 37 37 | 38 38 | 39 39 | class D(TypedDict): @@ -211,7 +201,6 @@ UP037_0.py:44:31: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 41 41 | 42 42 | 43 43 | class D(TypedDict): @@ -232,7 +221,6 @@ UP037_0.py:47:14: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 44 44 | E: TypedDict("E", {"foo": "int"}) 45 45 | 46 46 | @@ -255,7 +243,6 @@ UP037_0.py:49:8: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 46 46 | 47 47 | x: Annotated["str", "metadata"] 48 48 | @@ -278,7 +265,6 @@ UP037_0.py:51:15: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 48 48 | 49 49 | x: Arg("str", "name") 50 50 | @@ -301,7 +287,6 @@ UP037_0.py:53:13: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 50 50 | 51 51 | x: DefaultArg("str", "name") 52 52 | @@ -324,7 +309,6 @@ UP037_0.py:55:20: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 52 52 | 53 53 | x: NamedArg("str", "name") 54 54 | @@ -347,7 +331,6 @@ UP037_0.py:57:20: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 54 54 | 55 55 | x: DefaultNamedArg("str", "name") 56 56 | @@ -370,7 +353,6 @@ UP037_0.py:59:11: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 56 56 | 57 57 | x: DefaultNamedArg("str", name="name") 58 58 | @@ -393,7 +375,6 @@ UP037_0.py:61:19: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 58 58 | 59 59 | x: VarArg("str") 60 60 | @@ -416,7 +397,6 @@ UP037_0.py:63:29: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 60 60 | 61 61 | x: List[List[List["MyClass"]]] 62 62 | @@ -439,7 +419,6 @@ UP037_0.py:63:45: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 60 60 | 61 61 | x: List[List[List["MyClass"]]] 62 62 | @@ -462,7 +441,6 @@ UP037_0.py:65:29: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 62 62 | 63 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 64 | @@ -485,7 +463,6 @@ UP037_0.py:65:36: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 62 62 | 63 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 64 | @@ -508,7 +485,6 @@ UP037_0.py:65:45: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 62 62 | 63 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 64 | @@ -531,7 +507,6 @@ UP037_0.py:65:52: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 62 62 | 63 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 64 | @@ -554,7 +529,6 @@ UP037_0.py:67:24: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 64 64 | 65 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) 66 66 | @@ -577,7 +551,6 @@ UP037_0.py:67:38: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 64 64 | 65 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) 66 66 | @@ -600,7 +573,6 @@ UP037_0.py:67:45: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 64 64 | 65 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) 66 66 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_1.py.snap index 542652b6211d1..e0a45a844c5d3 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_1.py.snap @@ -11,7 +11,6 @@ UP037_1.py:9:8: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -Suggested fix: 6 6 | 7 7 | def foo(): 8 8 | # UP037 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap index e250d48dace61..3badb7edafddf 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap @@ -9,7 +9,6 @@ UP038.py:1:1: UP038 [*] Use `X | Y` in `isinstance` call instead of `(X, Y)` | = help: Convert to `X | Y` -Suggested fix: 1 |-isinstance(1, (int, float)) # UP038 1 |+isinstance(1, int | float) # UP038 2 2 | issubclass("yes", (int, float, str)) # UP038 @@ -28,7 +27,6 @@ UP038.py:2:1: UP038 [*] Use `X | Y` in `issubclass` call instead of `(X, Y)` | = help: Convert to `X | Y` -Suggested fix: 1 1 | isinstance(1, (int, float)) # UP038 2 |-issubclass("yes", (int, float, str)) # UP038 2 |+issubclass("yes", int | float | str) # UP038 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP039.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP039.py.snap index 06ae6d6f6a979..d95b6476150ed 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP039.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP039.py.snap @@ -10,7 +10,6 @@ UP039.py:2:8: UP039 [*] Unnecessary parentheses after class definition | = help: Remove parentheses -Suggested fix: 1 1 | # Errors 2 |-class A(): 2 |+class A: @@ -29,7 +28,6 @@ UP039.py:6:8: UP039 [*] Unnecessary parentheses after class definition | = help: Remove parentheses -Suggested fix: 3 3 | pass 4 4 | 5 5 | @@ -50,7 +48,6 @@ UP039.py:12:9: UP039 [*] Unnecessary parentheses after class definition | = help: Remove parentheses -Suggested fix: 9 9 | 10 10 | 11 11 | class A \ @@ -71,7 +68,6 @@ UP039.py:17:8: UP039 [*] Unnecessary parentheses after class definition | = help: Remove parentheses -Suggested fix: 14 14 | 15 15 | 16 16 | @decorator() @@ -92,7 +88,6 @@ UP039.py:21:8: UP039 [*] Unnecessary parentheses after class definition | = help: Remove parentheses -Suggested fix: 18 18 | pass 19 19 | 20 20 | @decorator diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap index b7921a02ba7ce..afbe53c8b2c7c 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap @@ -10,7 +10,6 @@ UP040.py:5:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of th | = help: Use the `type` keyword -Suggested fix: 2 2 | from typing import TypeAlias 3 3 | 4 4 | # UP040 @@ -33,7 +32,6 @@ UP040.py:6:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of th | = help: Use the `type` keyword -Suggested fix: 3 3 | 4 4 | # UP040 5 5 | x: typing.TypeAlias = int @@ -56,7 +54,6 @@ UP040.py:10:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -Suggested fix: 7 7 | 8 8 | # UP040 simple generic 9 9 | T = typing.TypeVar["T"] @@ -79,7 +76,6 @@ UP040.py:14:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -Suggested fix: 11 11 | 12 12 | # UP040 call style generic 13 13 | T = typing.TypeVar("T") @@ -102,7 +98,6 @@ UP040.py:18:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -Suggested fix: 15 15 | 16 16 | # UP040 bounded generic 17 17 | T = typing.TypeVar("T", bound=int) @@ -125,7 +120,6 @@ UP040.py:22:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -Suggested fix: 19 19 | 20 20 | # UP040 constrained generic 21 21 | T = typing.TypeVar("T", int, str) @@ -148,7 +142,6 @@ UP040.py:26:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -Suggested fix: 23 23 | 24 24 | # UP040 contravariant generic 25 25 | T = typing.TypeVar("T", contravariant=True) @@ -171,7 +164,6 @@ UP040.py:30:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -Suggested fix: 27 27 | 28 28 | # UP040 covariant generic 29 29 | T = typing.TypeVar("T", covariant=True) @@ -194,7 +186,6 @@ UP040.py:36:5: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -Suggested fix: 33 33 | T = typing.TypeVar["T"] 34 34 | class Foo: 35 35 | # reference to global variable @@ -217,7 +208,6 @@ UP040.py:40:5: UP040 [*] Type alias `y` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -Suggested fix: 37 37 | 38 38 | # reference to class variable 39 39 | TCLS = typing.TypeVar["TCLS"] @@ -240,7 +230,6 @@ UP040.py:44:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -Suggested fix: 41 41 | 42 42 | # UP040 won't add generics in fix 43 43 | T = typing.TypeVar(*args) @@ -261,7 +250,6 @@ UP040.py:53:1: UP040 [*] Type alias `Decorator` uses `TypeAlias` annotation inst | = help: Use the `type` keyword -Suggested fix: 50 50 | # Ensure that "T" appears only once in the type parameters for the modernized 51 51 | # type alias. 52 52 | T = typing.TypeVar["T"] @@ -286,7 +274,6 @@ UP040.py:63:1: UP040 [*] Type alias `PositiveList` uses `TypeAliasType` assignme | = help: Use the `type` keyword -Suggested fix: 60 60 | 61 61 | # https://github.com/astral-sh/ruff/issues/11422 62 62 | T = TypeVar("T") @@ -313,7 +300,6 @@ UP040.py:69:1: UP040 [*] Type alias `PositiveList` uses `TypeAliasType` assignme | = help: Use the `type` keyword -Suggested fix: 66 66 | 67 67 | # Bound 68 68 | T = TypeVar("T", bound=SupportGt) @@ -338,7 +324,6 @@ UP040.py:77:1: UP040 [*] Type alias `Tuple3` uses `TypeAliasType` assignment ins | = help: Use the `type` keyword -Suggested fix: 74 74 | T1 = TypeVar("T1", bound=SupportGt) 75 75 | T2 = TypeVar("T2") 76 76 | T3 = TypeVar("T3") @@ -359,7 +344,6 @@ UP040.py:80:1: UP040 [*] Type alias `PositiveInt` uses `TypeAliasType` assignmen | = help: Use the `type` keyword -Suggested fix: 77 77 | Tuple3 = TypeAliasType("Tuple3", tuple[T1, T2, T3], type_params=(T1, T2, T3)) 78 78 | 79 79 | # No type_params @@ -382,7 +366,6 @@ UP040.py:81:1: UP040 [*] Type alias `PositiveInt` uses `TypeAliasType` assignmen | = help: Use the `type` keyword -Suggested fix: 78 78 | 79 79 | # No type_params 80 80 | PositiveInt = TypeAliasType("PositiveInt", Annotated[int, Gt(0)]) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.pyi.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.pyi.snap index bef8a31e78ac8..584dc63eb6bb0 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.pyi.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.pyi.snap @@ -11,7 +11,6 @@ UP040.pyi:6:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -Suggested fix: 3 3 | 4 4 | # UP040 5 5 | # Fixes in type stub files should be safe to apply unlike in regular code where runtime behavior could change @@ -30,7 +29,6 @@ UP040.pyi:7:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -Suggested fix: 4 4 | # UP040 5 5 | # Fixes in type stub files should be safe to apply unlike in regular code where runtime behavior could change 6 6 | x: typing.TypeAlias = int diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP041.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP041.py.snap index 9ff6ab8d55cb7..c0de306d315e3 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP041.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP041.py.snap @@ -11,7 +11,6 @@ UP041.py:5:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace `asyncio.TimeoutError` with builtin `TimeoutError` -Suggested fix: 2 2 | # These should be fixed 3 3 | try: 4 4 | pass @@ -33,7 +32,6 @@ UP041.py:10:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace `socket.timeout` with builtin `TimeoutError` -Suggested fix: 7 7 | 8 8 | try: 9 9 | pass @@ -55,7 +53,6 @@ UP041.py:17:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -Suggested fix: 14 14 | 15 15 | try: 16 16 | pass @@ -77,7 +74,6 @@ UP041.py:22:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -Suggested fix: 19 19 | 20 20 | try: 21 21 | pass @@ -99,7 +95,6 @@ UP041.py:27:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -Suggested fix: 24 24 | 25 25 | try: 26 26 | pass @@ -121,7 +116,6 @@ UP041.py:34:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -Suggested fix: 31 31 | 32 32 | try: 33 33 | pass @@ -143,7 +137,6 @@ UP041.py:42:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -Suggested fix: 39 39 | from .mmap import error 40 40 | try: 41 41 | pass diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP042.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP042.py.snap index 5ba7565497919..b0b948f05a85c 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP042.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP042.py.snap @@ -8,7 +8,6 @@ UP042.py:4:7: UP042 [*] Class A inherits from both `str` and `enum.Enum` | = help: Inherit from `enum.StrEnum` -Suggested fix: 1 |-from enum import Enum 1 |+from enum import Enum, StrEnum 2 2 | @@ -28,7 +27,6 @@ UP042.py:7:7: UP042 [*] Class B inherits from both `str` and `enum.Enum` | = help: Inherit from `enum.StrEnum` -Suggested fix: 1 |-from enum import Enum 1 |+from enum import Enum, StrEnum 2 2 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP043.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP043.py.snap index 9c6967056abc1..c62bdfa93b892 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP043.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP043.py.snap @@ -9,7 +9,6 @@ UP043.py:4:15: UP043 [*] Unnecessary default type arguments | = help: Remove default type arguments -Suggested fix: 1 1 | from typing import Generator, AsyncGenerator 2 2 | 3 3 | @@ -29,7 +28,6 @@ UP043.py:8:15: UP043 [*] Unnecessary default type arguments | = help: Remove default type arguments -Suggested fix: 5 5 | yield 42 6 6 | 7 7 | @@ -50,7 +48,6 @@ UP043.py:21:15: UP043 [*] Unnecessary default type arguments | = help: Remove default type arguments -Suggested fix: 18 18 | return foo 19 19 | 20 20 | @@ -70,7 +67,6 @@ UP043.py:31:21: UP043 [*] Unnecessary default type arguments | = help: Remove default type arguments -Suggested fix: 28 28 | return 42 29 29 | 30 30 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__async_timeout_error_alias_not_applied_py310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__async_timeout_error_alias_not_applied_py310.snap index 5febbd610d58c..a86308caa128b 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__async_timeout_error_alias_not_applied_py310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__async_timeout_error_alias_not_applied_py310.snap @@ -11,7 +11,6 @@ UP041.py:10:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace `socket.timeout` with builtin `TimeoutError` -Suggested fix: 7 7 | 8 8 | try: 9 9 | pass @@ -33,7 +32,6 @@ UP041.py:22:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -Suggested fix: 19 19 | 20 20 | try: 21 21 | pass @@ -55,7 +53,6 @@ UP041.py:27:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -Suggested fix: 24 24 | 25 25 | try: 26 26 | pass @@ -77,7 +74,6 @@ UP041.py:34:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -Suggested fix: 31 31 | 32 32 | try: 33 33 | pass diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap index ef6b3ed4b9ba4..e593cb3abc959 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap @@ -10,7 +10,6 @@ UP017.py:10:11: UP017 [*] Use `datetime.UTC` alias | = help: Convert to `datetime.UTC` alias -Suggested fix: 1 |+from datetime import UTC 1 2 | def func(): 2 3 | import datetime @@ -36,7 +35,6 @@ UP017.py:16:11: UP017 [*] Use `datetime.UTC` alias | = help: Convert to `datetime.UTC` alias -Suggested fix: 1 |+from datetime import UTC 1 2 | def func(): 2 3 | import datetime @@ -62,7 +60,6 @@ UP017.py:22:11: UP017 [*] Use `datetime.UTC` alias | = help: Convert to `datetime.UTC` alias -Suggested fix: 19 19 | def func(): 20 20 | import datetime 21 21 | @@ -83,7 +80,6 @@ UP017.py:28:11: UP017 [*] Use `datetime.UTC` alias | = help: Convert to `datetime.UTC` alias -Suggested fix: 25 25 | def func(): 26 26 | import datetime as dt 27 27 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_keep_runtime_typing_p310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_keep_runtime_typing_p310.snap index 7c65269010c18..3f2931da043a5 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_keep_runtime_typing_p310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_keep_runtime_typing_p310.snap @@ -10,7 +10,6 @@ future_annotations.py:34:18: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -Suggested fix: 31 31 | return cls(x=0, y=0) 32 32 | 33 33 | @@ -32,7 +31,6 @@ future_annotations.py:35:9: UP006 [*] Use `list` instead of `List` for type anno | = help: Replace with `list` -Suggested fix: 32 32 | 33 33 | 34 34 | def f(x: int) -> List[int]: @@ -53,7 +51,6 @@ future_annotations.py:42:27: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -Suggested fix: 39 39 | 40 40 | x: Optional[int] = None 41 41 | @@ -71,7 +68,6 @@ future_annotations.py:42:38: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -Suggested fix: 39 39 | 40 40 | x: Optional[int] = None 41 41 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap index bc57900284fa7..3bdb57a6a18cf 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap @@ -10,7 +10,6 @@ future_annotations.py:34:18: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -Suggested fix: 31 31 | return cls(x=0, y=0) 32 32 | 33 33 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap index 7c65269010c18..3f2931da043a5 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap @@ -10,7 +10,6 @@ future_annotations.py:34:18: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -Suggested fix: 31 31 | return cls(x=0, y=0) 32 32 | 33 33 | @@ -32,7 +31,6 @@ future_annotations.py:35:9: UP006 [*] Use `list` instead of `List` for type anno | = help: Replace with `list` -Suggested fix: 32 32 | 33 33 | 34 34 | def f(x: int) -> List[int]: @@ -53,7 +51,6 @@ future_annotations.py:42:27: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -Suggested fix: 39 39 | 40 40 | x: Optional[int] = None 41 41 | @@ -71,7 +68,6 @@ future_annotations.py:42:38: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -Suggested fix: 39 39 | 40 40 | x: Optional[int] = None 41 41 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap index 32569f886f2f8..9637ade1b0174 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap @@ -10,7 +10,6 @@ future_annotations.py:40:4: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 37 37 | return y 38 38 | 39 39 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap index e4d055dc25a6c..83f827e16ccd3 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap @@ -10,7 +10,6 @@ future_annotations.py:40:4: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 37 37 | return y 38 38 | 39 39 | @@ -30,7 +29,6 @@ future_annotations.py:42:21: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -Suggested fix: 39 39 | 40 40 | x: Optional[int] = None 41 41 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap index fee8c927d0bcd..b6eacde73f4ce 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap @@ -12,7 +12,6 @@ FURB105.py:3:1: FURB105 [*] Unnecessary empty string passed to `print` | = help: Remove empty string -Suggested fix: 1 1 | # Errors. 2 2 | 3 |-print("") @@ -33,7 +32,6 @@ FURB105.py:4:1: FURB105 [*] Unnecessary empty string and separator passed to `pr | = help: Remove empty string and separator -Suggested fix: 1 1 | # Errors. 2 2 | 3 3 | print("") @@ -56,7 +54,6 @@ FURB105.py:5:1: FURB105 [*] Unnecessary empty string passed to `print` | = help: Remove empty string -Suggested fix: 2 2 | 3 3 | print("") 4 4 | print("", sep=",") @@ -79,7 +76,6 @@ FURB105.py:6:1: FURB105 [*] Unnecessary empty string and separator passed to `pr | = help: Remove empty string and separator -Suggested fix: 3 3 | print("") 4 4 | print("", sep=",") 5 5 | print("", end="bar") @@ -102,7 +98,6 @@ FURB105.py:7:1: FURB105 [*] Unnecessary separator passed to `print` | = help: Remove separator -Suggested fix: 4 4 | print("", sep=",") 5 5 | print("", end="bar") 6 6 | print("", sep=",", end="bar") @@ -125,7 +120,6 @@ FURB105.py:8:1: FURB105 [*] Unnecessary empty string and separator passed to `pr | = help: Remove empty string and separator -Suggested fix: 5 5 | print("", end="bar") 6 6 | print("", sep=",", end="bar") 7 7 | print(sep="") @@ -148,7 +142,6 @@ FURB105.py:9:1: FURB105 [*] Unnecessary empty string and separator passed to `pr | = help: Remove empty string and separator -Suggested fix: 6 6 | print("", sep=",", end="bar") 7 7 | print(sep="") 8 8 | print("", sep="") @@ -171,7 +164,6 @@ FURB105.py:10:1: FURB105 [*] Unnecessary empty string and separator passed to `p | = help: Remove empty string and separator -Suggested fix: 7 7 | print(sep="") 8 8 | print("", sep="") 9 9 | print("", "", sep="") @@ -194,7 +186,6 @@ FURB105.py:11:1: FURB105 [*] Unnecessary empty string and separator passed to `p | = help: Remove empty string and separator -Suggested fix: 8 8 | print("", sep="") 9 9 | print("", "", sep="") 10 10 | print("", "", sep="", end="") @@ -217,7 +208,6 @@ FURB105.py:12:1: FURB105 [*] Unnecessary empty string and separator passed to `p | = help: Remove empty string and separator -Suggested fix: 9 9 | print("", "", sep="") 10 10 | print("", "", sep="", end="") 11 11 | print("", "", sep="", end="bar") @@ -240,7 +230,6 @@ FURB105.py:13:1: FURB105 [*] Unnecessary separator passed to `print` | = help: Remove separator -Suggested fix: 10 10 | print("", "", sep="", end="") 11 11 | print("", "", sep="", end="bar") 12 12 | print("", sep="", end="bar") @@ -263,7 +252,6 @@ FURB105.py:14:1: FURB105 [*] Unnecessary empty string and separator passed to `p | = help: Remove empty string and separator -Suggested fix: 11 11 | print("", "", sep="", end="bar") 12 12 | print("", sep="", end="bar") 13 13 | print(sep="", end="bar") @@ -286,7 +274,6 @@ FURB105.py:15:1: FURB105 [*] Unnecessary empty string and separator passed to `p | = help: Remove empty string and separator -Suggested fix: 12 12 | print("", sep="", end="bar") 13 13 | print(sep="", end="bar") 14 14 | print("", "foo", sep="") @@ -309,7 +296,6 @@ FURB105.py:16:1: FURB105 [*] Unnecessary empty string passed to `print` | = help: Remove empty string -Suggested fix: 13 13 | print(sep="", end="bar") 14 14 | print("", "foo", sep="") 15 15 | print("foo", "", sep="") @@ -332,7 +318,6 @@ FURB105.py:18:1: FURB105 [*] Unnecessary empty string passed to `print` | = help: Remove empty string -Suggested fix: 15 15 | print("foo", "", sep="") 16 16 | print("foo", "", "bar", sep="") 17 17 | print("", *args) @@ -354,7 +339,6 @@ FURB105.py:19:1: FURB105 [*] Unnecessary empty string passed to `print` | = help: Remove empty string -Suggested fix: 16 16 | print("foo", "", "bar", sep="") 17 17 | print("", *args) 18 18 | print("", *args, sep="") @@ -377,7 +361,6 @@ FURB105.py:20:1: FURB105 [*] Unnecessary separator passed to `print` | = help: Remove separator -Suggested fix: 17 17 | print("", *args) 18 18 | print("", *args, sep="") 19 19 | print("", **kwargs) diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap index 16aa8419a11ff..ec78f78f10bd1 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap @@ -10,7 +10,6 @@ FURB110.py:1:5: FURB110 [*] Replace ternary `if` expression with `or` operator | = help: Replace with `or` operator -Suggested fix: 1 |-z = x if x else y # FURB110 1 |+z = x or y # FURB110 2 2 | @@ -32,7 +31,6 @@ FURB110.py:3:5: FURB110 [*] Replace ternary `if` expression with `or` operator | = help: Replace with `or` operator -Suggested fix: 1 1 | z = x if x else y # FURB110 2 2 | 3 |-z = x \ @@ -58,7 +56,6 @@ FURB110.py:6:5: FURB110 [*] Replace ternary `if` expression with `or` operator | = help: Replace with `or` operator -Suggested fix: 3 3 | z = x \ 4 4 | if x else y # FURB110 5 5 | @@ -83,7 +80,6 @@ FURB110.py:10:5: FURB110 [*] Replace ternary `if` expression with `or` operator | = help: Replace with `or` operator -Suggested fix: 7 7 | else \ 8 8 | y # FURB110 9 9 | @@ -112,7 +108,6 @@ FURB110.py:13:5: FURB110 [*] Replace ternary `if` expression with `or` operator | = help: Replace with `or` operator -Suggested fix: 10 10 | z = x() if x() else y() # FURB110 11 11 | 12 12 | # FURB110 @@ -145,7 +140,6 @@ FURB110.py:23:5: FURB110 [*] Replace ternary `if` expression with `or` operator | = help: Replace with `or` operator -Suggested fix: 20 20 | 21 21 | # FURB110 22 22 | z = ( @@ -177,7 +171,6 @@ FURB110.py:34:5: FURB110 [*] Replace ternary `if` expression with `or` operator | = help: Replace with `or` operator -Suggested fix: 31 31 | 32 32 | # FURB110 33 33 | z = ( @@ -209,7 +202,6 @@ FURB110.py:44:5: FURB110 [*] Replace ternary `if` expression with `or` operator | = help: Replace with `or` operator -Suggested fix: 41 41 | 42 42 | # FURB110 43 43 | z = ( diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap index 3daf59f067d1f..30b9727ed5813 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap @@ -11,7 +11,6 @@ FURB113.py:23:1: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal | = help: Replace with `nums.extend((1, 2))` -Suggested fix: 20 20 | 21 21 | 22 22 | # FURB113 @@ -34,7 +33,6 @@ FURB113.py:29:1: FURB113 [*] Use `nums3.extend((1, 2))` instead of repeatedly ca | = help: Replace with `nums3.extend((1, 2))` -Suggested fix: 26 26 | 27 27 | 28 28 | # FURB113 @@ -57,7 +55,6 @@ FURB113.py:35:1: FURB113 [*] Use `nums4.extend((1, 2))` instead of repeatedly ca | = help: Replace with `nums4.extend((1, 2))` -Suggested fix: 32 32 | 33 33 | 34 34 | # FURB113 @@ -124,7 +121,6 @@ FURB113.py:56:1: FURB113 [*] Use `nums4.extend((1, 2))` instead of repeatedly ca | = help: Replace with `nums4.extend((1, 2))` -Suggested fix: 53 53 | nums3.append(1) 54 54 | nums.append(3) 55 55 | # FURB113 @@ -147,7 +143,6 @@ FURB113.py:62:1: FURB113 [*] Use `nums.extend((1, 2, 3))` instead of repeatedly | = help: Replace with `nums.extend((1, 2, 3))` -Suggested fix: 59 59 | pass 60 60 | 61 61 | # FURB113 @@ -172,7 +167,6 @@ FURB113.py:69:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal | = help: Replace with `nums.extend((1, 2))` -Suggested fix: 66 66 | 67 67 | if True: 68 68 | # FURB113 @@ -197,7 +191,6 @@ FURB113.py:75:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal | = help: Replace with `nums.extend((1, 2))` -Suggested fix: 72 72 | 73 73 | if True: 74 74 | # FURB113 @@ -234,7 +227,6 @@ FURB113.py:90:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly callin | = help: Replace with `x.extend((1, 2))` -Suggested fix: 87 87 | 88 88 | def yes_one(x: list[int]): 89 89 | # FURB113 @@ -258,7 +250,6 @@ FURB113.py:96:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly callin | = help: Replace with `x.extend((1, 2))` -Suggested fix: 93 93 | 94 94 | def yes_two(x: List[int]): 95 95 | # FURB113 @@ -282,7 +273,6 @@ FURB113.py:102:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli | = help: Replace with `x.extend((1, 2))` -Suggested fix: 99 99 | 100 100 | def yes_three(*, x: list[int]): 101 101 | # FURB113 @@ -306,7 +296,6 @@ FURB113.py:108:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli | = help: Replace with `x.extend((1, 2))` -Suggested fix: 105 105 | 106 106 | def yes_four(x: list[int], /): 107 107 | # FURB113 @@ -343,7 +332,6 @@ FURB113.py:122:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli | = help: Replace with `x.extend((1, 2))` -Suggested fix: 119 119 | 120 120 | def yes_six(x: list): 121 121 | # FURB113 diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap index 7b34765563586..f3f31c1816257 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap @@ -12,7 +12,6 @@ FURB116.py:6:7: FURB116 [*] Replace `oct` call with `f"{num:o}"` | = help: Replace with `f"{num:o}"` -Suggested fix: 3 3 | def return_num() -> int: 4 4 | return num 5 5 | @@ -33,7 +32,6 @@ FURB116.py:7:7: FURB116 [*] Replace `hex` call with `f"{num:x}"` | = help: Replace with `f"{num:x}"` -Suggested fix: 4 4 | return num 5 5 | 6 6 | print(oct(num)[2:]) # FURB116 @@ -56,7 +54,6 @@ FURB116.py:8:7: FURB116 [*] Replace `bin` call with `f"{num:b}"` | = help: Replace with `f"{num:b}"` -Suggested fix: 5 5 | 6 6 | print(oct(num)[2:]) # FURB116 7 7 | print(hex(num)[2:]) # FURB116 @@ -79,7 +76,6 @@ FURB116.py:10:7: FURB116 [*] Replace `oct` call with `f"{1337:o}"` | = help: Replace with `f"{1337:o}"` -Suggested fix: 7 7 | print(hex(num)[2:]) # FURB116 8 8 | print(bin(num)[2:]) # FURB116 9 9 | @@ -100,7 +96,6 @@ FURB116.py:11:7: FURB116 [*] Replace `hex` call with `f"{1337:x}"` | = help: Replace with `f"{1337:x}"` -Suggested fix: 8 8 | print(bin(num)[2:]) # FURB116 9 9 | 10 10 | print(oct(1337)[2:]) # FURB116 @@ -123,7 +118,6 @@ FURB116.py:12:7: FURB116 [*] Replace `bin` call with `f"{1337:b}"` | = help: Replace with `f"{1337:b}"` -Suggested fix: 9 9 | 10 10 | print(oct(1337)[2:]) # FURB116 11 11 | print(hex(1337)[2:]) # FURB116 diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap index 2461c99aa5a4d..744505325749f 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap @@ -11,7 +11,6 @@ FURB118.py:2:13: FURB118 [*] Use `operator.invert` instead of defining a lambda | = help: Replace with `operator.invert` -Suggested fix: 1 1 | # Errors. 2 |-op_bitnot = lambda x: ~x 2 |+import operator @@ -33,7 +32,6 @@ FURB118.py:3:10: FURB118 [*] Use `operator.not_` instead of defining a lambda | = help: Replace with `operator.not_` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -55,7 +53,6 @@ FURB118.py:4:10: FURB118 [*] Use `operator.pos` instead of defining a lambda | = help: Replace with `operator.pos` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -79,7 +76,6 @@ FURB118.py:5:10: FURB118 [*] Use `operator.neg` instead of defining a lambda | = help: Replace with `operator.neg` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -104,7 +100,6 @@ FURB118.py:7:10: FURB118 [*] Use `operator.add` instead of defining a lambda | = help: Replace with `operator.add` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -130,7 +125,6 @@ FURB118.py:8:10: FURB118 [*] Use `operator.sub` instead of defining a lambda | = help: Replace with `operator.sub` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -158,7 +152,6 @@ FURB118.py:9:11: FURB118 [*] Use `operator.mul` instead of defining a lambda | = help: Replace with `operator.mul` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -187,7 +180,6 @@ FURB118.py:10:14: FURB118 [*] Use `operator.matmul` instead of defining a lambda | = help: Replace with `operator.matmul` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -216,7 +208,6 @@ FURB118.py:11:14: FURB118 [*] Use `operator.truediv` instead of defining a lambd | = help: Replace with `operator.truediv` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -245,7 +236,6 @@ FURB118.py:12:10: FURB118 [*] Use `operator.mod` instead of defining a lambda | = help: Replace with `operator.mod` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -274,7 +264,6 @@ FURB118.py:13:10: FURB118 [*] Use `operator.pow` instead of defining a lambda | = help: Replace with `operator.pow` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -303,7 +292,6 @@ FURB118.py:14:13: FURB118 [*] Use `operator.lshift` instead of defining a lambda | = help: Replace with `operator.lshift` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -332,7 +320,6 @@ FURB118.py:15:13: FURB118 [*] Use `operator.rshift` instead of defining a lambda | = help: Replace with `operator.rshift` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -361,7 +348,6 @@ FURB118.py:16:12: FURB118 [*] Use `operator.or_` instead of defining a lambda | = help: Replace with `operator.or_` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -390,7 +376,6 @@ FURB118.py:17:10: FURB118 [*] Use `operator.xor` instead of defining a lambda | = help: Replace with `operator.xor` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -418,7 +403,6 @@ FURB118.py:18:13: FURB118 [*] Use `operator.and_` instead of defining a lambda | = help: Replace with `operator.and_` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -447,7 +431,6 @@ FURB118.py:19:15: FURB118 [*] Use `operator.floordiv` instead of defining a lamb | = help: Replace with `operator.floordiv` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -476,7 +459,6 @@ FURB118.py:21:9: FURB118 [*] Use `operator.eq` instead of defining a lambda | = help: Replace with `operator.eq` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -504,7 +486,6 @@ FURB118.py:22:9: FURB118 [*] Use `operator.ne` instead of defining a lambda | = help: Replace with `operator.ne` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -533,7 +514,6 @@ FURB118.py:23:9: FURB118 [*] Use `operator.lt` instead of defining a lambda | = help: Replace with `operator.lt` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -562,7 +542,6 @@ FURB118.py:24:10: FURB118 [*] Use `operator.le` instead of defining a lambda | = help: Replace with `operator.le` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -591,7 +570,6 @@ FURB118.py:25:9: FURB118 [*] Use `operator.gt` instead of defining a lambda | = help: Replace with `operator.gt` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -620,7 +598,6 @@ FURB118.py:26:10: FURB118 [*] Use `operator.ge` instead of defining a lambda | = help: Replace with `operator.ge` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -649,7 +626,6 @@ FURB118.py:27:9: FURB118 [*] Use `operator.is_` instead of defining a lambda | = help: Replace with `operator.is_` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -678,7 +654,6 @@ FURB118.py:28:12: FURB118 [*] Use `operator.is_not` instead of defining a lambda | = help: Replace with `operator.is_not` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -707,7 +682,6 @@ FURB118.py:29:9: FURB118 [*] Use `operator.contains` instead of defining a lambd | = help: Replace with `operator.contains` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -736,7 +710,6 @@ FURB118.py:30:17: FURB118 [*] Use `operator.itemgetter(0)` instead of defining a | = help: Replace with `operator.itemgetter(0)` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -765,7 +738,6 @@ FURB118.py:31:17: FURB118 [*] Use `operator.itemgetter(0, 1, 2)` instead of defi | = help: Replace with `operator.itemgetter(0, 1, 2)` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -794,7 +766,6 @@ FURB118.py:32:17: FURB118 [*] Use `operator.itemgetter(slice(1, None), 2)` inste | = help: Replace with `operator.itemgetter(slice(1, None), 2)` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -823,7 +794,6 @@ FURB118.py:33:17: FURB118 [*] Use `operator.itemgetter(slice(None))` instead of | = help: Replace with `operator.itemgetter(slice(None))` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -851,7 +821,6 @@ FURB118.py:34:17: FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defin | = help: Replace with `operator.itemgetter((0, 1))` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x @@ -878,7 +847,6 @@ FURB118.py:35:17: FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defin | = help: Replace with `operator.itemgetter((0, 1))` -Suggested fix: 1 1 | # Errors. 2 |+import operator 2 3 | op_bitnot = lambda x: ~x diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap index ca7eb052a0a45..10474ac61293c 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap @@ -12,7 +12,6 @@ FURB129.py:7:18: FURB129 [*] Instead of calling `readlines()`, iterate over file | = help: Remove `readlines()` -Suggested fix: 4 4 | 5 5 | # Errors 6 6 | with open("FURB129.py") as f: @@ -35,7 +34,6 @@ FURB129.py:9:35: FURB129 [*] Instead of calling `readlines()`, iterate over file | = help: Remove `readlines()` -Suggested fix: 6 6 | with open("FURB129.py") as f: 7 7 | for _line in f.readlines(): 8 8 | pass @@ -57,7 +55,6 @@ FURB129.py:10:35: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -Suggested fix: 7 7 | for _line in f.readlines(): 8 8 | pass 9 9 | a = [line.lower() for line in f.readlines()] @@ -80,7 +77,6 @@ FURB129.py:11:49: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -Suggested fix: 8 8 | pass 9 9 | a = [line.lower() for line in f.readlines()] 10 10 | b = {line.upper() for line in f.readlines()} @@ -101,7 +97,6 @@ FURB129.py:14:18: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -Suggested fix: 11 11 | c = {line.lower(): line.upper() for line in f.readlines()} 12 12 | 13 13 | with Path("FURB129.py").open() as f: @@ -123,7 +118,6 @@ FURB129.py:17:14: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -Suggested fix: 14 14 | for _line in f.readlines(): 15 15 | pass 16 16 | @@ -145,7 +139,6 @@ FURB129.py:20:14: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -Suggested fix: 17 17 | for _line in open("FURB129.py").readlines(): 18 18 | pass 19 19 | @@ -168,7 +161,6 @@ FURB129.py:26:18: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -Suggested fix: 23 23 | 24 24 | def func(): 25 25 | f = Path("FURB129.py").open() @@ -189,7 +181,6 @@ FURB129.py:32:18: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -Suggested fix: 29 29 | 30 30 | 31 31 | def func(f: io.BytesIO): @@ -212,7 +203,6 @@ FURB129.py:38:22: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -Suggested fix: 35 35 | 36 36 | def func(): 37 37 | with (open("FURB129.py") as f, foo as bar): @@ -233,7 +223,6 @@ FURB129.py:48:17: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -Suggested fix: 45 45 | 46 46 | 47 47 | with builtins.open("FURB129.py") as f: @@ -254,7 +243,6 @@ FURB129.py:56:17: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -Suggested fix: 53 53 | 54 54 | 55 55 | with o("FURB129.py") as f: diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap index d4e561f000ef1..7e9d41cc17d0e 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap @@ -9,7 +9,6 @@ FURB131.py:11:1: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -Suggested fix: 8 8 | # these should match 9 9 | 10 10 | # FURB131 @@ -29,7 +28,6 @@ FURB131.py:15:1: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -Suggested fix: 12 12 | 13 13 | 14 14 | # FURB131 @@ -66,7 +64,6 @@ FURB131.py:28:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -Suggested fix: 25 25 | 26 26 | def yes_one(x: list[int]): 27 27 | # FURB131 @@ -87,7 +84,6 @@ FURB131.py:33:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -Suggested fix: 30 30 | 31 31 | def yes_two(x: dict[int, str]): 32 32 | # FURB131 @@ -108,7 +104,6 @@ FURB131.py:38:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -Suggested fix: 35 35 | 36 36 | def yes_three(x: List[int]): 37 37 | # FURB131 @@ -129,7 +124,6 @@ FURB131.py:43:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -Suggested fix: 40 40 | 41 41 | def yes_four(x: Dict[int, str]): 42 42 | # FURB131 @@ -152,7 +146,6 @@ FURB131.py:48:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -Suggested fix: 45 45 | 46 46 | def yes_five(x: Dict[int, str]): 47 47 | # FURB131 @@ -175,7 +168,6 @@ FURB131.py:58:1: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -Suggested fix: 55 55 | 56 56 | sneaky = SneakyList() 57 57 | # FURB131 diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap index 3758da982faed..5b5142ad11d88 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap @@ -10,7 +10,6 @@ FURB132.py:12:1: FURB132 [*] Use `s.discard("x")` instead of check and `remove` | = help: Replace with `s.discard("x")` -Suggested fix: 9 9 | # these should match 10 10 | 11 11 | # FURB132 @@ -32,7 +31,6 @@ FURB132.py:22:1: FURB132 [*] Use `s3.discard("x")` instead of check and `remove` | = help: Replace with `s3.discard("x")` -Suggested fix: 19 19 | 20 20 | 21 21 | # FURB132 @@ -55,7 +53,6 @@ FURB132.py:28:1: FURB132 [*] Use `s.discard(var)` instead of check and `remove` | = help: Replace with `s.discard(var)` -Suggested fix: 25 25 | 26 26 | var = "y" 27 27 | # FURB132 @@ -76,7 +73,6 @@ FURB132.py:32:1: FURB132 [*] Use `s.discard(f"{var}:{var}")` instead of check an | = help: Replace with `s.discard(f"{var}:{var}")` -Suggested fix: 29 29 | s.remove(var) 30 30 | 31 31 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap index 36ebf9678738f..bcdfc7b468847 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap @@ -12,7 +12,6 @@ FURB136.py:4:1: FURB136 [*] Replace `x if x > y else y` with `max(y, x)` | = help: Replace with `max(y, x)` -Suggested fix: 1 1 | x = 1 2 2 | y = 2 3 3 | @@ -35,7 +34,6 @@ FURB136.py:6:1: FURB136 [*] Replace `x if x >= y else y` with `max(x, y)` | = help: Replace with `max(x, y)` -Suggested fix: 3 3 | 4 4 | x if x > y else y # FURB136 5 5 | @@ -58,7 +56,6 @@ FURB136.py:8:1: FURB136 [*] Replace `x if x < y else y` with `min(y, x)` | = help: Replace with `min(y, x)` -Suggested fix: 5 5 | 6 6 | x if x >= y else y # FURB136 7 7 | @@ -81,7 +78,6 @@ FURB136.py:10:1: FURB136 [*] Replace `x if x <= y else y` with `min(x, y)` | = help: Replace with `min(x, y)` -Suggested fix: 7 7 | 8 8 | x if x < y else y # FURB136 9 9 | @@ -104,7 +100,6 @@ FURB136.py:12:1: FURB136 [*] Replace `y if x > y else x` with `min(x, y)` | = help: Replace with `min(x, y)` -Suggested fix: 9 9 | 10 10 | x if x <= y else y # FURB136 11 11 | @@ -127,7 +122,6 @@ FURB136.py:14:1: FURB136 [*] Replace `y if x >= y else x` with `min(y, x)` | = help: Replace with `min(y, x)` -Suggested fix: 11 11 | 12 12 | y if x > y else x # FURB136 13 13 | @@ -150,7 +144,6 @@ FURB136.py:16:1: FURB136 [*] Replace `y if x < y else x` with `max(x, y)` | = help: Replace with `max(x, y)` -Suggested fix: 13 13 | 14 14 | y if x >= y else x # FURB136 15 15 | @@ -173,7 +166,6 @@ FURB136.py:18:1: FURB136 [*] Replace `y if x <= y else x` with `max(y, x)` | = help: Replace with `max(y, x)` -Suggested fix: 15 15 | 16 16 | y if x < y else x # FURB136 17 17 | @@ -197,7 +189,6 @@ FURB136.py:22:1: FURB136 [*] Replace `if` expression with `max(y, x)` | = help: Replace with `max(y, x)` -Suggested fix: 19 19 | 20 20 | x + y if x > y else y # OK 21 21 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap index 09446e1bf5368..d07440558c156 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap @@ -11,7 +11,6 @@ FURB140.py:7:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -Suggested fix: 1 |+from itertools import starmap 1 2 | def zipped(): 2 3 | return zip([1, 2, 3], "ABC") @@ -37,7 +36,6 @@ FURB140.py:10:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -Suggested fix: 1 |+from itertools import starmap 1 2 | def zipped(): 2 3 | return zip([1, 2, 3], "ABC") @@ -62,7 +60,6 @@ FURB140.py:13:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -Suggested fix: 1 |+from itertools import starmap 1 2 | def zipped(): 2 3 | return zip([1, 2, 3], "ABC") @@ -89,7 +86,6 @@ FURB140.py:19:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -Suggested fix: 16 16 | from itertools import starmap as sm 17 17 | 18 18 | # FURB140 @@ -111,7 +107,6 @@ FURB140.py:22:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -Suggested fix: 19 19 | [print(x, y) for x, y in zipped()] 20 20 | 21 21 | # FURB140 @@ -133,7 +128,6 @@ FURB140.py:25:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -Suggested fix: 22 22 | (print(x, y) for x, y in zipped()) 23 23 | 24 24 | # FURB140 @@ -156,7 +150,6 @@ FURB140.py:29:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -Suggested fix: 26 26 | 27 27 | # FURB140 (check it still flags starred arguments). 28 28 | # See https://github.com/astral-sh/ruff/issues/7636 @@ -178,7 +171,6 @@ FURB140.py:30:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -Suggested fix: 27 27 | # FURB140 (check it still flags starred arguments). 28 28 | # See https://github.com/astral-sh/ruff/issues/7636 29 29 | [foo(*t) for t in [(85, 60), (100, 80)]] @@ -201,7 +193,6 @@ FURB140.py:31:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -Suggested fix: 28 28 | # See https://github.com/astral-sh/ruff/issues/7636 29 29 | [foo(*t) for t in [(85, 60), (100, 80)]] 30 30 | (foo(*t) for t in [(85, 60), (100, 80)]) diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap index 98f05584c96f8..075b93eb5df0a 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap @@ -13,7 +13,6 @@ FURB142.py:5:1: FURB142 [*] Use of `set.add()` in a for loop | = help: Replace with `.update()` -Suggested fix: 2 2 | 3 3 | s = set() 4 4 | @@ -38,7 +37,6 @@ FURB142.py:8:1: FURB142 [*] Use of `set.add()` in a for loop | = help: Replace with `.update()` -Suggested fix: 5 5 | for x in [1, 2, 3]: 6 6 | s.add(x) 7 7 | @@ -63,7 +61,6 @@ FURB142.py:11:1: FURB142 [*] Use of `set.add()` in a for loop | = help: Replace with `.update()` -Suggested fix: 8 8 | for x in {1, 2, 3}: 9 9 | s.add(x) 10 10 | @@ -88,7 +85,6 @@ FURB142.py:14:1: FURB142 [*] Use of `set.discard()` in a for loop | = help: Replace with `.difference_update()` -Suggested fix: 11 11 | for x in (1, 2, 3): 12 12 | s.add(x) 13 13 | @@ -113,7 +109,6 @@ FURB142.py:17:1: FURB142 [*] Use of `set.add()` in a for loop | = help: Replace with `.update()` -Suggested fix: 14 14 | for x in (1, 2, 3): 15 15 | s.discard(x) 16 16 | @@ -138,7 +133,6 @@ FURB142.py:20:1: FURB142 [*] Use of `set.add()` in a for loop | = help: Replace with `.update()` -Suggested fix: 17 17 | for x in (1, 2, 3): 18 18 | s.add(x + 1) 19 19 | @@ -163,7 +157,6 @@ FURB142.py:25:1: FURB142 [*] Use of `set.add()` in a for loop | = help: Replace with `.update()` -Suggested fix: 22 22 | 23 23 | num = 123 24 24 | @@ -188,7 +181,6 @@ FURB142.py:28:1: FURB142 [*] Use of `set.add()` in a for loop | = help: Replace with `.update()` -Suggested fix: 25 25 | for x in (1, 2, 3): 26 26 | s.add(num) 27 27 | @@ -213,7 +205,6 @@ FURB142.py:31:1: FURB142 [*] Use of `set.add()` in a for loop | = help: Replace with `.update()` -Suggested fix: 28 28 | for x in (1, 2, 3): 29 29 | s.add((num, x)) 30 30 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap index afca142e10525..39bf463993065 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap @@ -11,7 +11,6 @@ FURB145.py:4:5: FURB145 [*] Prefer `copy` method over slicing | = help: Replace with `copy()` -Suggested fix: 1 1 | l = [1, 2, 3, 4, 5] 2 2 | 3 3 | # Errors. @@ -34,7 +33,6 @@ FURB145.py:5:11: FURB145 [*] Prefer `copy` method over slicing | = help: Replace with `copy()` -Suggested fix: 2 2 | 3 3 | # Errors. 4 4 | a = l[:] @@ -57,7 +55,6 @@ FURB145.py:6:8: FURB145 [*] Prefer `copy` method over slicing | = help: Replace with `copy()` -Suggested fix: 3 3 | # Errors. 4 4 | a = l[:] 5 5 | b, c = 1, l[:] @@ -80,7 +77,6 @@ FURB145.py:7:5: FURB145 [*] Prefer `copy` method over slicing | = help: Replace with `copy()` -Suggested fix: 4 4 | a = l[:] 5 5 | b, c = 1, l[:] 6 6 | d, e = l[:], 1 @@ -102,7 +98,6 @@ FURB145.py:8:1: FURB145 [*] Prefer `copy` method over slicing | = help: Replace with `copy()` -Suggested fix: 5 5 | b, c = 1, l[:] 6 6 | d, e = l[:], 1 7 7 | m = l[::] @@ -125,7 +120,6 @@ FURB145.py:9:7: FURB145 [*] Prefer `copy` method over slicing | = help: Replace with `copy()` -Suggested fix: 6 6 | d, e = l[:], 1 7 7 | m = l[::] 8 8 | l[:] diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap index 161b689a436ce..bdc62b000b1a2 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap @@ -10,7 +10,6 @@ FURB148.py:14:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -Suggested fix: 11 11 | books_tuple = ("Dune", "Foundation", "Neuromancer") 12 12 | 13 13 | # Errors @@ -32,7 +31,6 @@ FURB148.py:17:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -Suggested fix: 14 14 | for index, _ in enumerate(books): 15 15 | print(index) 16 16 | @@ -54,7 +52,6 @@ FURB148.py:20:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -Suggested fix: 17 17 | for index, _ in enumerate(books, start=0): 18 18 | print(index) 19 19 | @@ -116,7 +113,6 @@ FURB148.py:35:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -Suggested fix: 32 32 | for index, _ in enumerate(books, x): 33 33 | print(book) 34 34 | @@ -138,7 +134,6 @@ FURB148.py:38:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -Suggested fix: 35 35 | for _, book in enumerate(books): 36 36 | print(book) 37 37 | @@ -160,7 +155,6 @@ FURB148.py:41:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -Suggested fix: 38 38 | for _, book in enumerate(books, start=0): 39 39 | print(book) 40 40 | @@ -182,7 +176,6 @@ FURB148.py:44:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -Suggested fix: 41 41 | for _, book in enumerate(books, 0): 42 42 | print(book) 43 43 | @@ -204,7 +197,6 @@ FURB148.py:47:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -Suggested fix: 44 44 | for _, book in enumerate(books, start=1): 45 45 | print(book) 46 46 | @@ -226,7 +218,6 @@ FURB148.py:50:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -Suggested fix: 47 47 | for _, book in enumerate(books, 1): 48 48 | print(book) 49 49 | @@ -248,7 +239,6 @@ FURB148.py:53:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -Suggested fix: 50 50 | for _, book in enumerate(books, start=x): 51 51 | print(book) 52 52 | @@ -270,7 +260,6 @@ FURB148.py:56:22: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -Suggested fix: 53 53 | for _, book in enumerate(books, x): 54 54 | print(book) 55 55 | @@ -292,7 +281,6 @@ FURB148.py:59:21: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -Suggested fix: 56 56 | for index, (_, _) in enumerate(books): 57 57 | print(index) 58 58 | @@ -314,7 +302,6 @@ FURB148.py:62:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -Suggested fix: 59 59 | for (_, _), book in enumerate(books): 60 60 | print(book) 61 61 | @@ -336,7 +323,6 @@ FURB148.py:65:18: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -Suggested fix: 62 62 | for(index, _)in enumerate(books): 63 63 | print(index) 64 64 | @@ -358,7 +344,6 @@ FURB148.py:68:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -Suggested fix: 65 65 | for(index), _ in enumerate(books): 66 66 | print(index) 67 67 | @@ -380,7 +365,6 @@ FURB148.py:71:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -Suggested fix: 68 68 | for index, _ in enumerate(books_and_authors): 69 69 | print(index) 70 70 | @@ -402,7 +386,6 @@ FURB148.py:74:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -Suggested fix: 71 71 | for _, book in enumerate(books_and_authors): 72 72 | print(book) 73 73 | @@ -424,7 +407,6 @@ FURB148.py:77:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -Suggested fix: 74 74 | for index, _ in enumerate(books_set): 75 75 | print(index) 76 76 | @@ -446,7 +428,6 @@ FURB148.py:80:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -Suggested fix: 77 77 | for _, book in enumerate(books_set): 78 78 | print(book) 79 79 | @@ -468,7 +449,6 @@ FURB148.py:83:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -Suggested fix: 80 80 | for index, _ in enumerate(books_tuple): 81 81 | print(index) 82 82 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap index e2eb9bd530888..cd38704a74977 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap @@ -12,7 +12,6 @@ FURB152.py:3:5: FURB152 [*] Replace `3.14` with `math.pi` | = help: Use `math.pi` -Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -35,7 +34,6 @@ FURB152.py:5:5: FURB152 [*] Replace `6.28` with `math.tau` | = help: Use `math.tau` -Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -60,7 +58,6 @@ FURB152.py:7:5: FURB152 [*] Replace `2.71` with `math.e` | = help: Use `math.e` -Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -87,7 +84,6 @@ FURB152.py:11:5: FURB152 [*] Replace `3.141` with `math.pi` | = help: Use `math.pi` -Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -115,7 +111,6 @@ FURB152.py:13:5: FURB152 [*] Replace `3.142` with `math.pi` | = help: Use `math.pi` -Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -143,7 +138,6 @@ FURB152.py:15:5: FURB152 [*] Replace `3.1415` with `math.pi` | = help: Use `math.pi` -Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -171,7 +165,6 @@ FURB152.py:17:5: FURB152 [*] Replace `3.1416` with `math.pi` | = help: Use `math.pi` -Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -199,7 +192,6 @@ FURB152.py:19:5: FURB152 [*] Replace `3.141592` with `math.pi` | = help: Use `math.pi` -Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -227,7 +219,6 @@ FURB152.py:21:5: FURB152 [*] Replace `3.141593` with `math.pi` | = help: Use `math.pi` -Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -255,7 +246,6 @@ FURB152.py:23:5: FURB152 [*] Replace `3.14159265` with `math.pi` | = help: Use `math.pi` -Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -283,7 +273,6 @@ FURB152.py:25:5: FURB152 [*] Replace `3.141592653589793238462643383279` with `ma | = help: Use `math.pi` -Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -311,7 +300,6 @@ FURB152.py:31:5: FURB152 [*] Replace `2.718` with `math.e` | = help: Use `math.e` -Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -339,7 +327,6 @@ FURB152.py:33:5: FURB152 [*] Replace `2.7182` with `math.e` | = help: Use `math.e` -Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -367,7 +354,6 @@ FURB152.py:35:5: FURB152 [*] Replace `2.7183` with `math.e` | = help: Use `math.e` -Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | @@ -393,7 +379,6 @@ FURB152.py:45:5: FURB152 [*] Replace `2.7182000000000001` with `math.e` | = help: Use `math.e` -Suggested fix: 1 |+import math 1 2 | r = 3.1 # OK 2 3 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB154_FURB154.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB154_FURB154.py.snap index 59aaf68c97415..765cf9d29cdca 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB154_FURB154.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB154_FURB154.py.snap @@ -11,7 +11,6 @@ FURB154.py:4:5: FURB154 [*] Use of repeated consecutive `global` | = help: Merge `global` statements -Suggested fix: 1 1 | # Errors 2 2 | 3 3 | def f1(): @@ -35,7 +34,6 @@ FURB154.py:9:5: FURB154 [*] Use of repeated consecutive `global` | = help: Merge `global` statements -Suggested fix: 6 6 | 7 7 | 8 8 | def f3(): @@ -61,7 +59,6 @@ FURB154.py:15:5: FURB154 [*] Use of repeated consecutive `global` | = help: Merge `global` statements -Suggested fix: 12 12 | 13 13 | 14 14 | def f4(): @@ -85,7 +82,6 @@ FURB154.py:18:5: FURB154 [*] Use of repeated consecutive `global` | = help: Merge `global` statements -Suggested fix: 15 15 | global x 16 16 | global y 17 17 | pass @@ -110,7 +106,6 @@ FURB154.py:26:9: FURB154 [*] Use of repeated consecutive `nonlocal` | = help: Merge `nonlocal` statements -Suggested fix: 23 23 | x = y = z = 1 24 24 | 25 25 | def inner(): @@ -136,7 +131,6 @@ FURB154.py:30:9: FURB154 [*] Use of repeated consecutive `nonlocal` | = help: Merge `nonlocal` statements -Suggested fix: 27 27 | nonlocal y 28 28 | 29 29 | def inner2(): @@ -162,7 +156,6 @@ FURB154.py:35:9: FURB154 [*] Use of repeated consecutive `nonlocal` | = help: Merge `nonlocal` statements -Suggested fix: 32 32 | nonlocal z 33 33 | 34 34 | def inner3(): @@ -186,7 +179,6 @@ FURB154.py:38:9: FURB154 [*] Use of repeated consecutive `nonlocal` | = help: Merge `nonlocal` statements -Suggested fix: 35 35 | nonlocal x 36 36 | nonlocal y 37 37 | pass @@ -211,7 +203,6 @@ FURB154.py:46:9: FURB154 [*] Use of repeated consecutive `global` | = help: Merge `global` statements -Suggested fix: 43 43 | w = x = y = z = 1 44 44 | 45 45 | def inner(): @@ -237,7 +228,6 @@ FURB154.py:48:9: FURB154 [*] Use of repeated consecutive `nonlocal` | = help: Merge `nonlocal` statements -Suggested fix: 45 45 | def inner(): 46 46 | global w 47 47 | global x @@ -261,7 +251,6 @@ FURB154.py:53:9: FURB154 [*] Use of repeated consecutive `nonlocal` | = help: Merge `nonlocal` statements -Suggested fix: 50 50 | 51 51 | def inner2(): 52 52 | global x @@ -285,7 +274,6 @@ FURB154.py:58:5: FURB154 [*] Use of repeated consecutive `global` | = help: Merge `global` statements -Suggested fix: 55 55 | 56 56 | 57 57 | def f6(): diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap index 716f1bcccaad6..b1c6ee68a69f8 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap @@ -11,7 +11,6 @@ FURB157.py:5:9: FURB157 [*] Verbose expression in `Decimal` constructor | = help: Replace with `0` -Suggested fix: 2 2 | from decimal import Decimal 3 3 | 4 4 | # Errors @@ -34,7 +33,6 @@ FURB157.py:6:9: FURB157 [*] Verbose expression in `Decimal` constructor | = help: Replace with `-42` -Suggested fix: 3 3 | 4 4 | # Errors 5 5 | Decimal("0") @@ -57,7 +55,6 @@ FURB157.py:7:9: FURB157 [*] Verbose expression in `Decimal` constructor | = help: Replace with `"Infinity"` -Suggested fix: 4 4 | # Errors 5 5 | Decimal("0") 6 6 | Decimal("-42") @@ -80,7 +77,6 @@ FURB157.py:8:9: FURB157 [*] Verbose expression in `Decimal` constructor | = help: Replace with `"-Infinity"` -Suggested fix: 5 5 | Decimal("0") 6 6 | Decimal("-42") 7 7 | Decimal(float("Infinity")) @@ -103,7 +99,6 @@ FURB157.py:9:9: FURB157 [*] Verbose expression in `Decimal` constructor | = help: Replace with `"inf"` -Suggested fix: 6 6 | Decimal("-42") 7 7 | Decimal(float("Infinity")) 8 8 | Decimal(float("-Infinity")) @@ -126,7 +121,6 @@ FURB157.py:10:9: FURB157 [*] Verbose expression in `Decimal` constructor | = help: Replace with `"-inf"` -Suggested fix: 7 7 | Decimal(float("Infinity")) 8 8 | Decimal(float("-Infinity")) 9 9 | Decimal(float("inf")) @@ -148,7 +142,6 @@ FURB157.py:11:9: FURB157 [*] Verbose expression in `Decimal` constructor | = help: Replace with `"nan"` -Suggested fix: 8 8 | Decimal(float("-Infinity")) 9 9 | Decimal(float("inf")) 10 10 | Decimal(float("-inf")) @@ -171,7 +164,6 @@ FURB157.py:12:17: FURB157 [*] Verbose expression in `Decimal` constructor | = help: Replace with `0` -Suggested fix: 9 9 | Decimal(float("inf")) 10 10 | Decimal(float("-inf")) 11 11 | Decimal(float("nan")) diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap index 13c6897dcba67..c4fd18c322c35 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap @@ -12,7 +12,6 @@ FURB161.py:6:9: FURB161 [*] Use of `bin(x).count('1')` | = help: Replace with `(x).bit_count()` -Suggested fix: 3 3 | def ten() -> int: 4 4 | return 10 5 5 | @@ -34,7 +33,6 @@ FURB161.py:7:9: FURB161 [*] Use of `bin(10).count('1')` | = help: Replace with `(10).bit_count()` -Suggested fix: 4 4 | return 10 5 5 | 6 6 | count = bin(x).count("1") # FURB161 @@ -57,7 +55,6 @@ FURB161.py:8:9: FURB161 [*] Use of `bin(0b1010).count('1')` | = help: Replace with `0b1010.bit_count()` -Suggested fix: 5 5 | 6 6 | count = bin(x).count("1") # FURB161 7 7 | count = bin(10).count("1") # FURB161 @@ -80,7 +77,6 @@ FURB161.py:9:9: FURB161 [*] Use of `bin(0xA).count('1')` | = help: Replace with `0xA.bit_count()` -Suggested fix: 6 6 | count = bin(x).count("1") # FURB161 7 7 | count = bin(10).count("1") # FURB161 8 8 | count = bin(0b1010).count("1") # FURB161 @@ -103,7 +99,6 @@ FURB161.py:10:9: FURB161 [*] Use of `bin(0o12).count('1')` | = help: Replace with `0o12.bit_count()` -Suggested fix: 7 7 | count = bin(10).count("1") # FURB161 8 8 | count = bin(0b1010).count("1") # FURB161 9 9 | count = bin(0xA).count("1") # FURB161 @@ -126,7 +121,6 @@ FURB161.py:11:9: FURB161 [*] Use of `bin(0x10 + 0x1000).count('1')` | = help: Replace with `(0x10 + 0x1000).bit_count()` -Suggested fix: 8 8 | count = bin(0b1010).count("1") # FURB161 9 9 | count = bin(0xA).count("1") # FURB161 10 10 | count = bin(0o12).count("1") # FURB161 @@ -149,7 +143,6 @@ FURB161.py:12:9: FURB161 [*] Use of `bin(ten()).count('1')` | = help: Replace with `ten().bit_count()` -Suggested fix: 9 9 | count = bin(0xA).count("1") # FURB161 10 10 | count = bin(0o12).count("1") # FURB161 11 11 | count = bin(0x10 + 0x1000).count("1") # FURB161 @@ -171,7 +164,6 @@ FURB161.py:13:9: FURB161 [*] Use of `bin(10).count('1')` | = help: Replace with `(10).bit_count()` -Suggested fix: 10 10 | count = bin(0o12).count("1") # FURB161 11 11 | count = bin(0x10 + 0x1000).count("1") # FURB161 12 12 | count = bin(ten()).count("1") # FURB161 @@ -194,7 +186,6 @@ FURB161.py:14:9: FURB161 [*] Use of `bin("10" "15").count('1')` | = help: Replace with `("10" "15").bit_count()` -Suggested fix: 11 11 | count = bin(0x10 + 0x1000).count("1") # FURB161 12 12 | count = bin(ten()).count("1") # FURB161 13 13 | count = bin((10)).count("1") # FURB161 diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap index 46b37fe9974c0..f184bfd0b184f 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap @@ -11,7 +11,6 @@ FURB163.py:4:1: FURB163 [*] Prefer `math.log2(1)` over `math.log` with a redunda | = help: Replace with `math.log2(1)` -Suggested fix: 1 1 | import math 2 2 | 3 3 | # Errors @@ -34,7 +33,6 @@ FURB163.py:5:1: FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redund | = help: Replace with `math.log10(1)` -Suggested fix: 2 2 | 3 3 | # Errors 4 4 | math.log(1, 2) @@ -57,7 +55,6 @@ FURB163.py:6:1: FURB163 [*] Prefer `math.log(1)` over `math.log` with a redundan | = help: Replace with `math.log(1)` -Suggested fix: 3 3 | # Errors 4 4 | math.log(1, 2) 5 5 | math.log(1, 10) @@ -80,7 +77,6 @@ FURB163.py:8:1: FURB163 [*] Prefer `math.log2(foo)` over `math.log` with a redun | = help: Replace with `math.log2(foo)` -Suggested fix: 5 5 | math.log(1, 10) 6 6 | math.log(1, math.e) 7 7 | foo = ... @@ -103,7 +99,6 @@ FURB163.py:9:1: FURB163 [*] Prefer `math.log10(foo)` over `math.log` with a redu | = help: Replace with `math.log10(foo)` -Suggested fix: 6 6 | math.log(1, math.e) 7 7 | foo = ... 8 8 | math.log(foo, 2) @@ -126,7 +121,6 @@ FURB163.py:10:1: FURB163 [*] Prefer `math.log(foo)` over `math.log` with a redun | = help: Replace with `math.log(foo)` -Suggested fix: 7 7 | foo = ... 8 8 | math.log(foo, 2) 9 9 | math.log(foo, 10) @@ -148,7 +142,6 @@ FURB163.py:11:1: FURB163 [*] Prefer `math.log2(1)` over `math.log` with a redund | = help: Replace with `math.log2(1)` -Suggested fix: 8 8 | math.log(foo, 2) 9 9 | math.log(foo, 10) 10 10 | math.log(foo, math.e) @@ -171,7 +164,6 @@ FURB163.py:12:1: FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redun | = help: Replace with `math.log10(1)` -Suggested fix: 9 9 | math.log(foo, 10) 10 10 | math.log(foo, math.e) 11 11 | math.log(1, 2.0) diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap index d1a56d4eaa748..b054fc6f36c7d 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap @@ -11,7 +11,6 @@ FURB164.py:7:5: FURB164 [*] Verbose method `from_float` in `Fraction` constructi | = help: Replace with `Fraction` constructor -Suggested fix: 4 4 | import fractions 5 5 | 6 6 | # Errors @@ -34,7 +33,6 @@ FURB164.py:8:5: FURB164 [*] Verbose method `from_float` in `Fraction` constructi | = help: Replace with `Fraction` constructor -Suggested fix: 5 5 | 6 6 | # Errors 7 7 | _ = Fraction.from_float(0.1) @@ -57,7 +55,6 @@ FURB164.py:9:5: FURB164 [*] Verbose method `from_float` in `Fraction` constructi | = help: Replace with `Fraction` constructor -Suggested fix: 6 6 | # Errors 7 7 | _ = Fraction.from_float(0.1) 8 8 | _ = Fraction.from_float(-0.5) @@ -80,7 +77,6 @@ FURB164.py:10:5: FURB164 [*] Verbose method `from_float` in `Fraction` construct | = help: Replace with `Fraction` constructor -Suggested fix: 7 7 | _ = Fraction.from_float(0.1) 8 8 | _ = Fraction.from_float(-0.5) 9 9 | _ = Fraction.from_float(5.0) @@ -103,7 +99,6 @@ FURB164.py:11:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` constru | = help: Replace with `Fraction` constructor -Suggested fix: 8 8 | _ = Fraction.from_float(-0.5) 9 9 | _ = Fraction.from_float(5.0) 10 10 | _ = fractions.Fraction.from_float(4.2) @@ -126,7 +121,6 @@ FURB164.py:12:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` constru | = help: Replace with `Fraction` constructor -Suggested fix: 9 9 | _ = Fraction.from_float(5.0) 10 10 | _ = fractions.Fraction.from_float(4.2) 11 11 | _ = Fraction.from_decimal(Decimal("4.2")) @@ -149,7 +143,6 @@ FURB164.py:13:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` constru | = help: Replace with `Fraction` constructor -Suggested fix: 10 10 | _ = fractions.Fraction.from_float(4.2) 11 11 | _ = Fraction.from_decimal(Decimal("4.2")) 12 12 | _ = Fraction.from_decimal(Decimal("-4.2")) @@ -172,7 +165,6 @@ FURB164.py:13:27: FURB164 [*] Verbose method `from_float` in `Decimal` construct | = help: Replace with `Decimal` constructor -Suggested fix: 10 10 | _ = fractions.Fraction.from_float(4.2) 11 11 | _ = Fraction.from_decimal(Decimal("4.2")) 12 12 | _ = Fraction.from_decimal(Decimal("-4.2")) @@ -195,7 +187,6 @@ FURB164.py:14:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -Suggested fix: 11 11 | _ = Fraction.from_decimal(Decimal("4.2")) 12 12 | _ = Fraction.from_decimal(Decimal("-4.2")) 13 13 | _ = Fraction.from_decimal(Decimal.from_float(4.2)) @@ -218,7 +209,6 @@ FURB164.py:15:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -Suggested fix: 12 12 | _ = Fraction.from_decimal(Decimal("-4.2")) 13 13 | _ = Fraction.from_decimal(Decimal.from_float(4.2)) 14 14 | _ = Decimal.from_float(0.1) @@ -241,7 +231,6 @@ FURB164.py:16:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -Suggested fix: 13 13 | _ = Fraction.from_decimal(Decimal.from_float(4.2)) 14 14 | _ = Decimal.from_float(0.1) 15 15 | _ = Decimal.from_float(-0.5) @@ -264,7 +253,6 @@ FURB164.py:17:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -Suggested fix: 14 14 | _ = Decimal.from_float(0.1) 15 15 | _ = Decimal.from_float(-0.5) 16 16 | _ = Decimal.from_float(5.0) @@ -287,7 +275,6 @@ FURB164.py:18:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -Suggested fix: 15 15 | _ = Decimal.from_float(-0.5) 16 16 | _ = Decimal.from_float(5.0) 17 17 | _ = decimal.Decimal.from_float(4.2) @@ -310,7 +297,6 @@ FURB164.py:19:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -Suggested fix: 16 16 | _ = Decimal.from_float(5.0) 17 17 | _ = decimal.Decimal.from_float(4.2) 18 18 | _ = Decimal.from_float(float("inf")) @@ -333,7 +319,6 @@ FURB164.py:20:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -Suggested fix: 17 17 | _ = decimal.Decimal.from_float(4.2) 18 18 | _ = Decimal.from_float(float("inf")) 19 19 | _ = Decimal.from_float(float("-inf")) @@ -355,7 +340,6 @@ FURB164.py:21:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -Suggested fix: 18 18 | _ = Decimal.from_float(float("inf")) 19 19 | _ = Decimal.from_float(float("-inf")) 20 20 | _ = Decimal.from_float(float("Infinity")) @@ -378,7 +362,6 @@ FURB164.py:22:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi | = help: Replace with `Decimal` constructor -Suggested fix: 19 19 | _ = Decimal.from_float(float("-inf")) 20 20 | _ = Decimal.from_float(float("Infinity")) 21 21 | _ = Decimal.from_float(float("-Infinity")) diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap index bca5c61a6090e..a58de2bf68bf8 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap @@ -12,7 +12,6 @@ FURB166.py:3:5: FURB166 [*] Use of `int` with explicit `base=2` after removing p | = help: Replace with `base=0` -Suggested fix: 1 1 | # Errors 2 2 | 3 |-_ = int("0b1010"[2:], 2) @@ -32,7 +31,6 @@ FURB166.py:4:5: FURB166 [*] Use of `int` with explicit `base=8` after removing p | = help: Replace with `base=0` -Suggested fix: 1 1 | # Errors 2 2 | 3 3 | _ = int("0b1010"[2:], 2) @@ -55,7 +53,6 @@ FURB166.py:5:5: FURB166 [*] Use of `int` with explicit `base=16` after removing | = help: Replace with `base=0` -Suggested fix: 2 2 | 3 3 | _ = int("0b1010"[2:], 2) 4 4 | _ = int("0o777"[2:], 8) @@ -77,7 +74,6 @@ FURB166.py:8:5: FURB166 [*] Use of `int` with explicit `base=2` after removing p | = help: Replace with `base=0` -Suggested fix: 5 5 | _ = int("0xFFFF"[2:], 16) 6 6 | 7 7 | b = "0b11" @@ -100,7 +96,6 @@ FURB166.py:10:5: FURB166 [*] Use of `int` with explicit `base=16` after removing | = help: Replace with `base=0` -Suggested fix: 7 7 | b = "0b11" 8 8 | _ = int(b[2:], 2) 9 9 | @@ -121,7 +116,6 @@ FURB166.py:12:5: FURB166 [*] Use of `int` with explicit `base=16` after removing | = help: Replace with `base=0` -Suggested fix: 9 9 | 10 10 | _ = int("0xFFFF"[2:], base=16) 11 11 | @@ -142,7 +136,6 @@ FURB166.py:19:5: FURB166 [*] Use of `int` with explicit `base=16` after removing | = help: Replace with `base=0` -Suggested fix: 16 16 | return "0xFFF" 17 17 | 18 18 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB167_FURB167.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB167_FURB167.py.snap index 8c3071c521b21..cab8d1e076d8e 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB167_FURB167.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB167_FURB167.py.snap @@ -10,7 +10,6 @@ FURB167.py:13:42: FURB167 [*] Use of regular expression alias `re.I` | = help: Replace with `re.IGNORECASE` -Suggested fix: 10 10 | import re 11 11 | 12 12 | # FURB167 @@ -31,7 +30,6 @@ FURB167.py:21:39: FURB167 [*] Use of regular expression alias `re.I` | = help: Replace with `re.IGNORECASE` -Suggested fix: 1 |+import re 1 2 | def func(): 2 3 | import re diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB168_FURB168.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB168_FURB168.py.snap index 61e03e1a64da6..2b5fcce658cc5 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB168_FURB168.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB168_FURB168.py.snap @@ -11,7 +11,6 @@ FURB168.py:5:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if a | = help: Replace with `is` operator -Suggested fix: 2 2 | 3 3 | # Errors. 4 4 | @@ -33,7 +32,6 @@ FURB168.py:8:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if a | = help: Replace with `is` operator -Suggested fix: 5 5 | if isinstance(foo, type(None)): 6 6 | pass 7 7 | @@ -55,7 +53,6 @@ FURB168.py:11:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -Suggested fix: 8 8 | if isinstance(foo, (type(None))): 9 9 | pass 10 10 | @@ -77,7 +74,6 @@ FURB168.py:14:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -Suggested fix: 11 11 | if isinstance(foo, (type(None), type(None), type(None))): 12 12 | pass 13 13 | @@ -99,7 +95,6 @@ FURB168.py:17:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -Suggested fix: 14 14 | if isinstance(foo, None | None): 15 15 | pass 16 16 | @@ -121,7 +116,6 @@ FURB168.py:20:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -Suggested fix: 17 17 | if isinstance(foo, (None | None)): 18 18 | pass 19 19 | @@ -143,7 +137,6 @@ FURB168.py:23:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -Suggested fix: 20 20 | if isinstance(foo, None | type(None)): 21 21 | pass 22 22 | @@ -164,7 +157,6 @@ FURB168.py:27:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -Suggested fix: 24 24 | pass 25 25 | 26 26 | # A bit contrived, but is both technically valid and equivalent to the above. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB169_FURB169.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB169_FURB169.py.snap index 959ba376477c2..01908fcff7321 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB169_FURB169.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB169_FURB169.py.snap @@ -12,7 +12,6 @@ FURB169.py:5:1: FURB169 [*] Compare the identities of `foo` and `None` instead o | = help: Replace with `foo is None` -Suggested fix: 2 2 | 3 3 | # Error. 4 4 | @@ -35,7 +34,6 @@ FURB169.py:7:1: FURB169 [*] Compare the identities of `foo` and `None` instead o | = help: Replace with `foo is None` -Suggested fix: 4 4 | 5 5 | type(foo) is type(None) 6 6 | @@ -58,7 +56,6 @@ FURB169.py:9:1: FURB169 [*] Compare the identities of `None` and `None` instead | = help: Replace with `None is None` -Suggested fix: 6 6 | 7 7 | type(None) is type(foo) 8 8 | @@ -81,7 +78,6 @@ FURB169.py:11:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is not None` -Suggested fix: 8 8 | 9 9 | type(None) is type(None) 10 10 | @@ -104,7 +100,6 @@ FURB169.py:13:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is not None` -Suggested fix: 10 10 | 11 11 | type(foo) is not type(None) 12 12 | @@ -127,7 +122,6 @@ FURB169.py:15:1: FURB169 [*] Compare the identities of `None` and `None` instead | = help: Replace with `None is not None` -Suggested fix: 12 12 | 13 13 | type(None) is not type(foo) 14 14 | @@ -150,7 +144,6 @@ FURB169.py:17:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is None` -Suggested fix: 14 14 | 15 15 | type(None) is not type(None) 16 16 | @@ -173,7 +166,6 @@ FURB169.py:19:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is None` -Suggested fix: 16 16 | 17 17 | type(foo) == type(None) 18 18 | @@ -196,7 +188,6 @@ FURB169.py:21:1: FURB169 [*] Compare the identities of `None` and `None` instead | = help: Replace with `None is None` -Suggested fix: 18 18 | 19 19 | type(None) == type(foo) 20 20 | @@ -219,7 +210,6 @@ FURB169.py:23:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is not None` -Suggested fix: 20 20 | 21 21 | type(None) == type(None) 22 22 | @@ -242,7 +232,6 @@ FURB169.py:25:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is not None` -Suggested fix: 22 22 | 23 23 | type(foo) != type(None) 24 24 | @@ -265,7 +254,6 @@ FURB169.py:27:1: FURB169 [*] Compare the identities of `None` and `None` instead | = help: Replace with `None is not None` -Suggested fix: 24 24 | 25 25 | type(None) != type(foo) 26 26 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB171_FURB171.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB171_FURB171.py.snap index fdfd927f4b492..134afd53bd31a 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB171_FURB171.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB171_FURB171.py.snap @@ -11,7 +11,6 @@ FURB171.py:3:4: FURB171 [*] Membership test against single-item container | = help: Convert to equality test -Suggested fix: 1 1 | # Errors. 2 2 | 3 |-if 1 in (1,): @@ -32,7 +31,6 @@ FURB171.py:6:4: FURB171 [*] Membership test against single-item container | = help: Convert to equality test -Suggested fix: 3 3 | if 1 in (1,): 4 4 | print("Single-element tuple") 5 5 | @@ -54,7 +52,6 @@ FURB171.py:9:4: FURB171 [*] Membership test against single-item container | = help: Convert to equality test -Suggested fix: 6 6 | if 1 in [1]: 7 7 | print("Single-element list") 8 8 | @@ -76,7 +73,6 @@ FURB171.py:12:4: FURB171 [*] Membership test against single-item container | = help: Convert to equality test -Suggested fix: 9 9 | if 1 in {1}: 10 10 | print("Single-element set") 11 11 | @@ -98,7 +94,6 @@ FURB171.py:15:4: FURB171 [*] Membership test against single-item container | = help: Convert to inequality test -Suggested fix: 12 12 | if "a" in "a": 13 13 | print("Single-element string") 14 14 | @@ -120,7 +115,6 @@ FURB171.py:18:8: FURB171 [*] Membership test against single-item container | = help: Convert to equality test -Suggested fix: 15 15 | if 1 not in (1,): 16 16 | print("Check `not in` membership test") 17 17 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap index 7d731ac2b2b7d..be1cff3d645da 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap @@ -12,7 +12,6 @@ FURB180.py:7:10: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract b | = help: Replace with `abc.ABC` -Suggested fix: 4 4 | 5 5 | # Errors 6 6 | @@ -33,7 +32,6 @@ FURB180.py:12:10: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract | = help: Replace with `abc.ABC` -Suggested fix: 9 9 | def foo(self): pass 10 10 | 11 11 | @@ -54,7 +52,6 @@ FURB180.py:26:18: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract | = help: Replace with `abc.ABC` -Suggested fix: 23 23 | pass 24 24 | 25 25 | @@ -74,7 +71,6 @@ FURB180.py:31:34: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract | = help: Replace with `abc.ABC` -Suggested fix: 28 28 | def foo(self): pass 29 29 | 30 30 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap index 3bc4220379407..8e10386399136 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap @@ -12,7 +12,6 @@ FURB181.py:19:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -Suggested fix: 16 16 | 17 17 | # these will match 18 18 | @@ -34,7 +33,6 @@ FURB181.py:20:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -Suggested fix: 17 17 | # these will match 18 18 | 19 19 | blake2b().digest().hex() @@ -57,7 +55,6 @@ FURB181.py:21:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -Suggested fix: 18 18 | 19 19 | blake2b().digest().hex() 20 20 | blake2s().digest().hex() @@ -80,7 +77,6 @@ FURB181.py:22:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -Suggested fix: 19 19 | blake2b().digest().hex() 20 20 | blake2s().digest().hex() 21 21 | md5().digest().hex() @@ -103,7 +99,6 @@ FURB181.py:23:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -Suggested fix: 20 20 | blake2s().digest().hex() 21 21 | md5().digest().hex() 22 22 | sha1().digest().hex() @@ -126,7 +121,6 @@ FURB181.py:24:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -Suggested fix: 21 21 | md5().digest().hex() 22 22 | sha1().digest().hex() 23 23 | sha224().digest().hex() @@ -149,7 +143,6 @@ FURB181.py:25:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -Suggested fix: 22 22 | sha1().digest().hex() 23 23 | sha224().digest().hex() 24 24 | sha256().digest().hex() @@ -172,7 +165,6 @@ FURB181.py:26:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -Suggested fix: 23 23 | sha224().digest().hex() 24 24 | sha256().digest().hex() 25 25 | sha384().digest().hex() @@ -195,7 +187,6 @@ FURB181.py:27:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -Suggested fix: 24 24 | sha256().digest().hex() 25 25 | sha384().digest().hex() 26 26 | sha3_224().digest().hex() @@ -218,7 +209,6 @@ FURB181.py:28:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -Suggested fix: 25 25 | sha384().digest().hex() 26 26 | sha3_224().digest().hex() 27 27 | sha3_256().digest().hex() @@ -241,7 +231,6 @@ FURB181.py:29:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -Suggested fix: 26 26 | sha3_224().digest().hex() 27 27 | sha3_256().digest().hex() 28 28 | sha3_384().digest().hex() @@ -264,7 +253,6 @@ FURB181.py:30:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -Suggested fix: 27 27 | sha3_256().digest().hex() 28 28 | sha3_384().digest().hex() 29 29 | sha3_512().digest().hex() @@ -308,7 +296,6 @@ FURB181.py:34:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -Suggested fix: 31 31 | shake_128().digest(10).hex() 32 32 | shake_256().digest(10).hex() 33 33 | @@ -331,7 +318,6 @@ FURB181.py:36:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -Suggested fix: 33 33 | 34 34 | hashlib.sha256().digest().hex() 35 35 | @@ -354,7 +340,6 @@ FURB181.py:38:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -Suggested fix: 35 35 | 36 36 | sha256(b"text").digest().hex() 37 37 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB187_FURB187.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB187_FURB187.py.snap index 987cf596758d3..bd77a995c625a 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB187_FURB187.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB187_FURB187.py.snap @@ -10,7 +10,6 @@ FURB187.py:6:5: FURB187 [*] Use of assignment of `reversed` on list `l` | = help: Replace with `l.reverse()` -Suggested fix: 3 3 | 4 4 | def a(): 5 5 | l = [] @@ -31,7 +30,6 @@ FURB187.py:11:5: FURB187 [*] Use of assignment of `reversed` on list `l` | = help: Replace with `l.reverse()` -Suggested fix: 8 8 | 9 9 | def b(): 10 10 | l = [] @@ -52,7 +50,6 @@ FURB187.py:16:5: FURB187 [*] Use of assignment of `reversed` on list `l` | = help: Replace with `l.reverse()` -Suggested fix: 13 13 | 14 14 | def c(): 15 15 | l = [] diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap index 272a47b1f110e..0f0b28d2be446 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap @@ -12,7 +12,6 @@ FURB192.py:3:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum | = help: Replace with `min` -Suggested fix: 1 1 | # Errors 2 2 | 3 |-sorted(l)[0] @@ -34,7 +33,6 @@ FURB192.py:5:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum | = help: Replace with `max` -Suggested fix: 2 2 | 3 3 | sorted(l)[0] 4 4 | @@ -57,7 +55,6 @@ FURB192.py:7:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum | = help: Replace with `max` -Suggested fix: 4 4 | 5 5 | sorted(l)[-1] 6 6 | @@ -80,7 +77,6 @@ FURB192.py:9:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum | = help: Replace with `min` -Suggested fix: 6 6 | 7 7 | sorted(l, reverse=False)[-1] 8 8 | @@ -103,7 +99,6 @@ FURB192.py:11:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum | = help: Replace with `min` -Suggested fix: 8 8 | 9 9 | sorted(l, key=lambda x: x)[0] 10 10 | @@ -126,7 +121,6 @@ FURB192.py:13:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum | = help: Replace with `min` -Suggested fix: 10 10 | 11 11 | sorted(l, key=key_fn)[0] 12 12 | @@ -149,7 +143,6 @@ FURB192.py:17:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum | = help: Replace with `min` -Suggested fix: 14 14 | 15 15 | # Unsafe 16 16 | @@ -172,7 +165,6 @@ FURB192.py:19:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum | = help: Replace with `max` -Suggested fix: 16 16 | 17 17 | sorted(l, key=key_fn, reverse=True)[-1] 18 18 | @@ -195,7 +187,6 @@ FURB192.py:21:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum | = help: Replace with `min` -Suggested fix: 18 18 | 19 19 | sorted(l, reverse=True)[0] 20 20 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap index 42b3fa75e849f..787b5560851d1 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap @@ -9,7 +9,6 @@ RUF013_0.py:20:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 17 17 | pass 18 18 | 19 19 | @@ -29,7 +28,6 @@ RUF013_0.py:24:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 21 21 | pass 22 22 | 23 23 | @@ -49,7 +47,6 @@ RUF013_0.py:28:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 25 25 | pass 26 26 | 27 27 | @@ -69,7 +66,6 @@ RUF013_0.py:58:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 55 55 | pass 56 56 | 57 57 | @@ -89,7 +85,6 @@ RUF013_0.py:62:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 59 59 | pass 60 60 | 61 61 | @@ -109,7 +104,6 @@ RUF013_0.py:66:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 63 63 | pass 64 64 | 65 65 | @@ -129,7 +123,6 @@ RUF013_0.py:85:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 82 82 | pass 83 83 | 84 84 | @@ -149,7 +142,6 @@ RUF013_0.py:89:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 86 86 | pass 87 87 | 88 88 | @@ -169,7 +161,6 @@ RUF013_0.py:108:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 105 105 | pass 106 106 | 107 107 | @@ -189,7 +180,6 @@ RUF013_0.py:112:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 109 109 | pass 110 110 | 111 111 | @@ -209,7 +199,6 @@ RUF013_0.py:131:22: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 128 128 | pass 129 129 | 130 130 | @@ -229,7 +218,6 @@ RUF013_0.py:135:32: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 132 132 | pass 133 133 | 134 134 | @@ -251,7 +239,6 @@ RUF013_0.py:151:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 148 148 | 149 149 | 150 150 | def f( @@ -274,7 +261,6 @@ RUF013_0.py:152:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 149 149 | 150 150 | def f( 151 151 | arg1: int = None, # RUF013 @@ -297,7 +283,6 @@ RUF013_0.py:153:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 150 150 | def f( 151 151 | arg1: int = None, # RUF013 152 152 | arg2: Union[int, float] = None, # RUF013 @@ -317,7 +302,6 @@ RUF013_0.py:181:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 178 178 | pass 179 179 | 180 180 | @@ -337,7 +321,6 @@ RUF013_0.py:188:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 185 185 | # Quoted 186 186 | 187 187 | @@ -357,7 +340,6 @@ RUF013_0.py:192:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 189 189 | pass 190 190 | 191 191 | @@ -385,7 +367,6 @@ RUF013_0.py:204:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 201 201 | pass 202 202 | 203 203 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap index 6fd4ad0123f33..ab7219393bbad 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap @@ -9,7 +9,6 @@ RUF013_1.py:4:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -Suggested fix: 1 1 | # No `typing.Optional` import 2 |+from typing import Optional 2 3 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap index 6771c68b23d17..ddc6446b72580 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap @@ -52,7 +52,6 @@ RUF005.py:39:7: RUF005 [*] Consider `[1, 2, 3, *foo]` instead of concatenation | = help: Replace with `[1, 2, 3, *foo]` -Suggested fix: 36 36 | yay = Fun().yay 37 37 | 38 38 | foo = [4, 5, 6] @@ -75,7 +74,6 @@ RUF005.py:41:8: RUF005 [*] Consider `(7, 8, 9, *zoob)` instead of concatenation | = help: Replace with `(7, 8, 9, *zoob)` -Suggested fix: 38 38 | foo = [4, 5, 6] 39 39 | bar = [1, 2, 3] + foo 40 40 | zoob = tuple(bar) @@ -98,7 +96,6 @@ RUF005.py:42:8: RUF005 [*] Consider `(*quux, 10, 11, 12)` instead of concatenati | = help: Replace with `(*quux, 10, 11, 12)` -Suggested fix: 39 39 | bar = [1, 2, 3] + foo 40 40 | zoob = tuple(bar) 41 41 | quux = (7, 8, 9) + zoob @@ -121,7 +118,6 @@ RUF005.py:44:8: RUF005 [*] Consider `[*spom, 13, 14, 15]` instead of concatenati | = help: Replace with `[*spom, 13, 14, 15]` -Suggested fix: 41 41 | quux = (7, 8, 9) + zoob 42 42 | spam = quux + (10, 11, 12) 43 43 | spom = list(spam) @@ -144,7 +140,6 @@ RUF005.py:45:13: RUF005 [*] Consider `("we all say", *yay())` instead of concate | = help: Replace with `("we all say", *yay())` -Suggested fix: 42 42 | spam = quux + (10, 11, 12) 43 43 | spom = list(spam) 44 44 | eggs = spom + [13, 14, 15] @@ -166,7 +161,6 @@ RUF005.py:46:14: RUF005 [*] Consider `("we all think", *Fun().yay())` instead of | = help: Replace with `("we all think", *Fun().yay())` -Suggested fix: 43 43 | spom = list(spam) 44 44 | eggs = spom + [13, 14, 15] 45 45 | elatement = ("we all say",) + yay() @@ -189,7 +183,6 @@ RUF005.py:47:16: RUF005 [*] Consider `("we all feel", *Fun.words)` instead of co | = help: Replace with `("we all feel", *Fun.words)` -Suggested fix: 44 44 | eggs = spom + [13, 14, 15] 45 45 | elatement = ("we all say",) + yay() 46 46 | excitement = ("we all think",) + Fun().yay() @@ -212,7 +205,6 @@ RUF005.py:49:9: RUF005 [*] Consider iterable unpacking instead of concatenation | = help: Replace with iterable unpacking -Suggested fix: 46 46 | excitement = ("we all think",) + Fun().yay() 47 47 | astonishment = ("we all feel",) + Fun.words 48 48 | @@ -235,7 +227,6 @@ RUF005.py:49:39: RUF005 [*] Consider `("yes", "no", "pants", *zoob)` instead of | = help: Replace with `("yes", "no", "pants", *zoob)` -Suggested fix: 46 46 | excitement = ("we all think",) + Fun().yay() 47 47 | astonishment = ("we all feel",) + Fun.words 48 48 | @@ -258,7 +249,6 @@ RUF005.py:51:7: RUF005 [*] Consider `(*zoob,)` instead of concatenation | = help: Replace with `(*zoob,)` -Suggested fix: 48 48 | 49 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) 50 50 | @@ -282,7 +272,6 @@ RUF005.py:53:1: RUF005 [*] Consider `[*foo]` instead of concatenation | = help: Replace with `[*foo]` -Suggested fix: 50 50 | 51 51 | baz = () + zoob 52 52 | @@ -306,7 +295,6 @@ RUF005.py:56:15: RUF005 [*] Consider `[sys.executable, "-m", "pylint", *args, pa | = help: Replace with `[sys.executable, "-m", "pylint", *args, path]` -Suggested fix: 53 53 | [] + foo + [ 54 54 | ] 55 55 | @@ -327,7 +315,6 @@ RUF005.py:57:21: RUF005 [*] Consider iterable unpacking instead of concatenation | = help: Replace with iterable unpacking -Suggested fix: 54 54 | ] 55 55 | 56 56 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] @@ -350,7 +337,6 @@ RUF005.py:58:5: RUF005 [*] Consider `[*a, 2, 3, 4]` instead of concatenation | = help: Replace with `[*a, 2, 3, 4]` -Suggested fix: 55 55 | 56 56 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] 57 57 | pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) @@ -372,7 +358,6 @@ RUF005.py:61:4: RUF005 [*] Consider `[*a(), 'b']` instead of concatenation | = help: Replace with `[*a(), 'b']` -Suggested fix: 58 58 | b = a + [2, 3] + [4] 59 59 | 60 60 | # Uses the non-preferred quote style, which should be retained. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF010_RUF010.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF010_RUF010.py.snap index 520eb35b1dcf2..65e4372778beb 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF010_RUF010.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF010_RUF010.py.snap @@ -10,7 +10,6 @@ RUF010.py:9:4: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -Suggested fix: 6 6 | pass 7 7 | 8 8 | @@ -31,7 +30,6 @@ RUF010.py:9:16: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -Suggested fix: 6 6 | pass 7 7 | 8 8 | @@ -52,7 +50,6 @@ RUF010.py:9:29: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -Suggested fix: 6 6 | pass 7 7 | 8 8 | @@ -75,7 +72,6 @@ RUF010.py:11:4: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -Suggested fix: 8 8 | 9 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 10 10 | @@ -98,7 +94,6 @@ RUF010.py:11:19: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -Suggested fix: 8 8 | 9 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 10 10 | @@ -121,7 +116,6 @@ RUF010.py:11:35: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -Suggested fix: 8 8 | 9 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 10 10 | @@ -144,7 +138,6 @@ RUF010.py:13:5: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -Suggested fix: 10 10 | 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | @@ -167,7 +160,6 @@ RUF010.py:13:19: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -Suggested fix: 10 10 | 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | @@ -190,7 +182,6 @@ RUF010.py:13:34: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -Suggested fix: 10 10 | 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | @@ -213,7 +204,6 @@ RUF010.py:15:14: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -Suggested fix: 12 12 | 13 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 14 14 | @@ -236,7 +226,6 @@ RUF010.py:15:29: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -Suggested fix: 12 12 | 13 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 14 14 | @@ -258,7 +247,6 @@ RUF010.py:35:20: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -Suggested fix: 32 32 | ( 33 33 | f"Member of tuple mismatches type at index {i}. Expected {of_shape_i}. Got " 34 34 | " intermediary content " diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap index 50c10703aa812..23eb7efc12dce 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap @@ -9,7 +9,6 @@ RUF013_0.py:20:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 17 17 | pass 18 18 | 19 19 | @@ -29,7 +28,6 @@ RUF013_0.py:24:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 21 21 | pass 22 22 | 23 23 | @@ -49,7 +47,6 @@ RUF013_0.py:28:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 25 25 | pass 26 26 | 27 27 | @@ -69,7 +66,6 @@ RUF013_0.py:58:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 55 55 | pass 56 56 | 57 57 | @@ -89,7 +85,6 @@ RUF013_0.py:62:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 59 59 | pass 60 60 | 61 61 | @@ -109,7 +104,6 @@ RUF013_0.py:66:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 63 63 | pass 64 64 | 65 65 | @@ -129,7 +123,6 @@ RUF013_0.py:85:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 82 82 | pass 83 83 | 84 84 | @@ -149,7 +142,6 @@ RUF013_0.py:89:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 86 86 | pass 87 87 | 88 88 | @@ -169,7 +161,6 @@ RUF013_0.py:108:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 105 105 | pass 106 106 | 107 107 | @@ -189,7 +180,6 @@ RUF013_0.py:112:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 109 109 | pass 110 110 | 111 111 | @@ -209,7 +199,6 @@ RUF013_0.py:131:22: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 128 128 | pass 129 129 | 130 130 | @@ -229,7 +218,6 @@ RUF013_0.py:135:32: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 132 132 | pass 133 133 | 134 134 | @@ -251,7 +239,6 @@ RUF013_0.py:151:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 148 148 | 149 149 | 150 150 | def f( @@ -274,7 +261,6 @@ RUF013_0.py:152:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 149 149 | 150 150 | def f( 151 151 | arg1: int = None, # RUF013 @@ -297,7 +283,6 @@ RUF013_0.py:153:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 150 150 | def f( 151 151 | arg1: int = None, # RUF013 152 152 | arg2: Union[int, float] = None, # RUF013 @@ -317,7 +302,6 @@ RUF013_0.py:181:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 178 178 | pass 179 179 | 180 180 | @@ -337,7 +321,6 @@ RUF013_0.py:188:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 185 185 | # Quoted 186 186 | 187 187 | @@ -357,7 +340,6 @@ RUF013_0.py:192:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 189 189 | pass 190 190 | 191 191 | @@ -385,7 +367,6 @@ RUF013_0.py:204:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 201 201 | pass 202 202 | 203 203 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap index dcd89b6fc6832..ed8dcd75dcba0 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap @@ -9,7 +9,6 @@ RUF013_1.py:4:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 1 1 | # No `typing.Optional` import 2 2 | 3 3 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_3.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_3.py.snap index b4b3c5924a2a3..2b332914a836f 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_3.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_3.py.snap @@ -9,7 +9,6 @@ RUF013_3.py:4:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 1 1 | import typing 2 2 | 3 3 | @@ -29,7 +28,6 @@ RUF013_3.py:22:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 19 19 | pass 20 20 | 21 21 | @@ -49,7 +47,6 @@ RUF013_3.py:29:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -Suggested fix: 26 26 | # Literal 27 27 | 28 28 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap index 47070a7319fae..fd07f0c1c7d27 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap @@ -11,7 +11,6 @@ RUF015.py:4:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -Suggested fix: 1 1 | x = range(10) 2 2 | 3 3 | # RUF015 @@ -34,7 +33,6 @@ RUF015.py:5:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -Suggested fix: 2 2 | 3 3 | # RUF015 4 4 | list(x)[0] @@ -56,7 +54,6 @@ RUF015.py:6:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -Suggested fix: 3 3 | # RUF015 4 4 | list(x)[0] 5 5 | tuple(x)[0] @@ -79,7 +76,6 @@ RUF015.py:7:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -Suggested fix: 4 4 | list(x)[0] 5 5 | tuple(x)[0] 6 6 | list(i for i in x)[0] @@ -101,7 +97,6 @@ RUF015.py:29:1: RUF015 [*] Prefer `next(i + 1 for i in x)` over single element s | = help: Replace with `next(i + 1 for i in x)` -Suggested fix: 26 26 | [i for i in x][::] 27 27 | 28 28 | # RUF015 (doesn't mirror the underlying list) @@ -123,7 +118,6 @@ RUF015.py:30:1: RUF015 [*] Prefer `next(i for i in x if i > 5)` over single elem | = help: Replace with `next(i for i in x if i > 5)` -Suggested fix: 27 27 | 28 28 | # RUF015 (doesn't mirror the underlying list) 29 29 | [i + 1 for i in x][0] @@ -146,7 +140,6 @@ RUF015.py:31:1: RUF015 [*] Prefer `next((i, i + 1) for i in x)` over single elem | = help: Replace with `next((i, i + 1) for i in x)` -Suggested fix: 28 28 | # RUF015 (doesn't mirror the underlying list) 29 29 | [i + 1 for i in x][0] 30 30 | [i for i in x if i > 5][0] @@ -169,7 +162,6 @@ RUF015.py:35:1: RUF015 [*] Prefer `next(i + j for i in x for j in y)` over singl | = help: Replace with `next(i + j for i in x for j in y)` -Suggested fix: 32 32 | 33 33 | # RUF015 (multiple generators) 34 34 | y = range(10) @@ -191,7 +183,6 @@ RUF015.py:38:1: RUF015 [*] Prefer `next(iter(range(10)))` over single element sl | = help: Replace with `next(iter(range(10)))` -Suggested fix: 35 35 | [i + j for i in x for j in y][0] 36 36 | 37 37 | # RUF015 @@ -214,7 +205,6 @@ RUF015.py:39:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | = help: Replace with `next(iter(x.y))` -Suggested fix: 36 36 | 37 37 | # RUF015 38 38 | list(range(10))[0] @@ -237,7 +227,6 @@ RUF015.py:40:1: RUF015 [*] Prefer `next(iter(x["y"]))` over single element slice | = help: Replace with `next(iter(x["y"]))` -Suggested fix: 37 37 | # RUF015 38 38 | list(range(10))[0] 39 39 | list(x.y)[0] @@ -260,7 +249,6 @@ RUF015.py:41:1: RUF015 [*] Prefer `next(iter(range(10)))` over single element sl | = help: Replace with `next(iter(range(10)))` -Suggested fix: 38 38 | list(range(10))[0] 39 39 | list(x.y)[0] 40 40 | list(x["y"])[0] @@ -283,7 +271,6 @@ RUF015.py:42:1: RUF015 [*] Prefer `next(iter(x["y"]))` over single element slice | = help: Replace with `next(iter(x["y"]))` -Suggested fix: 39 39 | list(x.y)[0] 40 40 | list(x["y"])[0] 41 41 | [*range(10)][0] @@ -306,7 +293,6 @@ RUF015.py:43:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | = help: Replace with `next(iter(x.y))` -Suggested fix: 40 40 | list(x["y"])[0] 41 41 | [*range(10)][0] 42 42 | [*x["y"]][0] @@ -329,7 +315,6 @@ RUF015.py:44:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | = help: Replace with `next(iter(x.y))` -Suggested fix: 41 41 | [*range(10)][0] 42 42 | [*x["y"]][0] 43 43 | [*x.y][0] @@ -354,7 +339,6 @@ RUF015.py:45:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | = help: Replace with `next(iter(x.y))` -Suggested fix: 42 42 | [*x["y"]][0] 43 43 | [*x.y][0] 44 44 | [* x.y][0] @@ -383,7 +367,6 @@ RUF015.py:50:26: RUF015 [*] Prefer `next(...)` over single element slice | = help: Replace with `next(...)` -Suggested fix: 47 47 | ][0] 48 48 | 49 49 | # RUF015 (multi-line) @@ -409,7 +392,6 @@ RUF015.py:57:1: RUF015 [*] Prefer `next(zip(x, y))` over single element slice | = help: Replace with `next(zip(x, y))` -Suggested fix: 54 54 | ][0] 55 55 | 56 56 | # RUF015 (zip) @@ -432,7 +414,6 @@ RUF015.py:58:1: RUF015 [*] Prefer `next(zip(x, y))` over single element slice | = help: Replace with `next(zip(x, y))` -Suggested fix: 55 55 | 56 56 | # RUF015 (zip) 57 57 | list(zip(x, y))[0] @@ -454,7 +435,6 @@ RUF015.py:61:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -Suggested fix: 58 58 | [*zip(x, y)][0] 59 59 | 60 60 | # RUF015 (pop) @@ -476,7 +456,6 @@ RUF015.py:62:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -Suggested fix: 59 59 | 60 60 | # RUF015 (pop) 61 61 | list(x).pop(0) @@ -499,7 +478,6 @@ RUF015.py:63:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -Suggested fix: 60 60 | # RUF015 (pop) 61 61 | list(x).pop(0) 62 62 | [i for i in x].pop(0) @@ -520,7 +498,6 @@ RUF015.py:73:5: RUF015 [*] Prefer `next(iter(zip(x, y)))` over single element sl | = help: Replace with `next(iter(zip(x, y)))` -Suggested fix: 70 70 | 71 71 | def test(): 72 72 | zip = list # Overwrite the builtin zip diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap index 7617a5cfe2f93..83ca0eef545b2 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap @@ -11,7 +11,6 @@ RUF017_0.py:5:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -Suggested fix: 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] @@ -37,7 +36,6 @@ RUF017_0.py:6:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -Suggested fix: 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] @@ -64,7 +62,6 @@ RUF017_0.py:7:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -Suggested fix: 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] @@ -92,7 +89,6 @@ RUF017_0.py:8:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -Suggested fix: 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] @@ -122,7 +118,6 @@ RUF017_0.py:9:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -Suggested fix: 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] @@ -150,7 +145,6 @@ RUF017_0.py:21:5: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -Suggested fix: 18 18 | def func(): 19 19 | import functools, operator 20 20 | @@ -171,7 +165,6 @@ RUF017_0.py:26:5: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -Suggested fix: 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap index 5ad2325da20ba..351939a0618c2 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap @@ -8,7 +8,6 @@ RUF017_1.py:1:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -Suggested fix: 1 |-sum((factor.dims for factor in bases), []) 1 |+import functools 2 |+import operator diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF019_RUF019.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF019_RUF019.py.snap index 51fb832c1d9e5..98297a738054e 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF019_RUF019.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF019_RUF019.py.snap @@ -11,7 +11,6 @@ RUF019.py:3:4: RUF019 [*] Unnecessary key check before dictionary access | = help: Replace with `dict.get` -Suggested fix: 1 1 | d = {} 2 2 | # RUF019 3 |-if "k" in d and d["k"]: @@ -31,7 +30,6 @@ RUF019.py:7:4: RUF019 [*] Unnecessary key check before dictionary access | = help: Replace with `dict.get` -Suggested fix: 4 4 | pass 5 5 | 6 6 | k = "k" @@ -53,7 +51,6 @@ RUF019.py:10:4: RUF019 [*] Unnecessary key check before dictionary access | = help: Replace with `dict.get` -Suggested fix: 7 7 | if k in d and d[k]: 8 8 | pass 9 9 | @@ -75,7 +72,6 @@ RUF019.py:13:4: RUF019 [*] Unnecessary key check before dictionary access | = help: Replace with `dict.get` -Suggested fix: 10 10 | if (k) in d and d[k]: 11 11 | pass 12 12 | @@ -98,7 +94,6 @@ RUF019.py:16:6: RUF019 [*] Unnecessary key check before dictionary access | = help: Replace with `dict.get` -Suggested fix: 13 13 | if k in d and d[(k)]: 14 14 | pass 15 15 | @@ -121,7 +116,6 @@ RUF019.py:18:6: RUF019 [*] Unnecessary key check before dictionary access | = help: Replace with `dict.get` -Suggested fix: 15 15 | 16 16 | not ("key" in dct and dct["key"]) 17 17 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap index 5aea0c2cfa954..fd46f930d54fe 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap @@ -12,7 +12,6 @@ RUF020.py:3:7: RUF020 [*] `Union[Never, T]` is equivalent to `T` | = help: Remove `Never` -Suggested fix: 1 1 | from typing import Never, NoReturn, Union 2 2 | 3 |-Union[Never, int] @@ -33,7 +32,6 @@ RUF020.py:4:7: RUF020 [*] `Union[NoReturn, T]` is equivalent to `T` | = help: Remove `NoReturn` -Suggested fix: 1 1 | from typing import Never, NoReturn, Union 2 2 | 3 3 | Union[Never, int] @@ -56,7 +54,6 @@ RUF020.py:5:1: RUF020 [*] `Never | T` is equivalent to `T` | = help: Remove `Never` -Suggested fix: 2 2 | 3 3 | Union[Never, int] 4 4 | Union[NoReturn, int] @@ -79,7 +76,6 @@ RUF020.py:6:1: RUF020 [*] `NoReturn | T` is equivalent to `T` | = help: Remove `NoReturn` -Suggested fix: 3 3 | Union[Never, int] 4 4 | Union[NoReturn, int] 5 5 | Never | int @@ -100,7 +96,6 @@ RUF020.py:7:13: RUF020 [*] `Union[Never, T]` is equivalent to `T` | = help: Remove `Never` -Suggested fix: 4 4 | Union[NoReturn, int] 5 5 | Never | int 6 6 | NoReturn | int @@ -120,7 +115,6 @@ RUF020.py:7:32: RUF020 [*] `Union[NoReturn, T]` is equivalent to `T` | = help: Remove `NoReturn` -Suggested fix: 4 4 | Union[NoReturn, int] 5 5 | Never | int 6 6 | NoReturn | int @@ -139,7 +133,6 @@ RUF020.py:8:7: RUF020 [*] `Union[NoReturn, T]` is equivalent to `T` | = help: Remove `NoReturn` -Suggested fix: 5 5 | Never | int 6 6 | NoReturn | int 7 7 | Union[Union[Never, int], Union[NoReturn, int]] diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap index 33c15cb916a0b..db1db4b72cda5 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap @@ -10,7 +10,6 @@ RUF021.py:12:10: RUF021 [*] Parenthesize `a and b` expressions when chaining `an | = help: Parenthesize the `and` subexpression -Suggested fix: 9 9 | # as part of a chain. 10 10 | 11 11 | a, b, c = 1, 0, 2 @@ -33,7 +32,6 @@ RUF021.py:13:10: RUF021 [*] Parenthesize `a and b` expressions when chaining `an | = help: Parenthesize the `and` subexpression -Suggested fix: 10 10 | 11 11 | a, b, c = 1, 0, 2 12 12 | x = a or b and c # RUF021: => `a or (b and c)` @@ -55,7 +53,6 @@ RUF021.py:16:5: RUF021 [*] Parenthesize `a and b` expressions when chaining `and | = help: Parenthesize the `and` subexpression -Suggested fix: 13 13 | x = a or b and c # looooooooooooooooooooooooooooooong comment but it won't prevent an autofix 14 14 | 15 15 | a, b, c = 0, 1, 2 @@ -76,7 +73,6 @@ RUF021.py:19:14: RUF021 [*] Parenthesize `a and b` expressions when chaining `an | = help: Parenthesize the `and` subexpression -Suggested fix: 16 16 | y = a and b or c # RUF021: => `(a and b) or c` 17 17 | 18 18 | a, b, c, d = 1, 2, 0, 3 @@ -98,7 +94,6 @@ RUF021.py:26:11: RUF021 [*] Parenthesize `a and b` expressions when chaining `an | = help: Parenthesize the `and` subexpression -Suggested fix: 23 23 | 24 24 | if bool(): 25 25 | pass @@ -119,7 +114,6 @@ RUF021.py:30:7: RUF021 [*] Parenthesize `a and b` expressions when chaining `and | = help: Parenthesize the `and` subexpression -Suggested fix: 27 27 | pass 28 28 | 29 29 | a, b, c, d = 0, 1, 0, 2 @@ -140,7 +134,6 @@ RUF021.py:30:18: RUF021 [*] Parenthesize `a and b` expressions when chaining `an | = help: Parenthesize the `and` subexpression -Suggested fix: 27 27 | pass 28 28 | 29 29 | a, b, c, d = 0, 1, 0, 2 @@ -163,7 +156,6 @@ RUF021.py:35:44: RUF021 [*] Parenthesize `a and b` expressions when chaining `an | = help: Parenthesize the `and` subexpression -Suggested fix: 32 32 | 33 33 | b, c, d, e = 2, 3, 0, 4 34 34 | # RUF021: => `a or b or c or (d and e)`: @@ -185,7 +177,6 @@ RUF021.py:38:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and | = help: Parenthesize the `and` subexpression -Suggested fix: 35 35 | z = [a for a in range(5) if a or b or c or d and e] 36 36 | 37 37 | a, b, c, d = 0, 1, 3, 0 @@ -208,7 +199,6 @@ RUF021.py:40:4: RUF021 [*] Parenthesize `a and b` expressions when chaining `and | = help: Parenthesize the `and` subexpression -Suggested fix: 37 37 | a, b, c, d = 0, 1, 3, 0 38 38 | assert not a and b or c or d # RUF021: => `(not a and b) or c or d` 39 39 | @@ -233,7 +223,6 @@ RUF021.py:46:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and | = help: Parenthesize the `and` subexpression -Suggested fix: 43 43 | 44 44 | if ( 45 45 | some_reasonably_long_condition @@ -263,7 +252,6 @@ RUF021.py:48:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and | = help: Parenthesize the `and` subexpression -Suggested fix: 45 45 | some_reasonably_long_condition 46 46 | or some_other_reasonably_long_condition 47 47 | and some_third_reasonably_long_condition diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF022_RUF022.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF022_RUF022.py.snap index 8ce0ffb25acd3..683b55ffe9911 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF022_RUF022.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF022_RUF022.py.snap @@ -12,7 +12,6 @@ RUF022.py:5:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 2 2 | # Single-line __all__ definitions (nice 'n' easy!) 3 3 | ################################################## 4 4 | @@ -33,7 +32,6 @@ RUF022.py:6:12: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 3 3 | ################################################## 4 4 | 5 5 | __all__ = ["d", "c", "b", "a"] # a comment that is untouched @@ -56,7 +54,6 @@ RUF022.py:7:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 4 4 | 5 5 | __all__ = ["d", "c", "b", "a"] # a comment that is untouched 6 6 | __all__ += ["foo", "bar", "antipasti"] @@ -79,7 +76,6 @@ RUF022.py:11:17: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 8 8 | 9 9 | # Quoting style is retained, 10 10 | # but unnecessary parens are not @@ -102,7 +98,6 @@ RUF022.py:14:18: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 11 11 | __all__: list = ['b', "c", ((('a')))] 12 12 | # Trailing commas are also not retained in single-line `__all__` definitions 13 13 | # (but they are in multiline `__all__` definitions) @@ -124,7 +119,6 @@ RUF022.py:17:16: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 14 14 | __all__: tuple = ("b", "c", "a",) 15 15 | 16 16 | if bool(): @@ -147,7 +141,6 @@ RUF022.py:19:16: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 16 16 | if bool(): 17 17 | __all__ += ("x", "m", "a", "s") 18 18 | else: @@ -170,7 +163,6 @@ RUF022.py:21:22: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 18 18 | else: 19 19 | __all__ += "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) 20 20 | @@ -193,7 +185,6 @@ RUF022.py:23:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 20 20 | 21 21 | __all__: list[str] = ["the", "three", "little", "pigs"] 22 22 | @@ -215,7 +206,6 @@ RUF022.py:24:16: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 21 21 | __all__: list[str] = ["the", "three", "little", "pigs"] 22 22 | 23 23 | __all__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") @@ -237,7 +227,6 @@ RUF022.py:25:16: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 22 22 | 23 23 | __all__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") 24 24 | __all__.extend(["foo", "bar"]) @@ -260,7 +249,6 @@ RUF022.py:26:19: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 23 23 | __all__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") 24 24 | __all__.extend(["foo", "bar"]) 25 25 | __all__.extend(("foo", "bar")) @@ -290,7 +278,6 @@ RUF022.py:32:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 30 30 | #################################### 31 31 | 32 32 | __all__ = ( @@ -327,7 +314,6 @@ RUF022.py:40:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 38 38 | ) 39 39 | 40 40 | __all__ = [ @@ -388,7 +374,6 @@ RUF022.py:54:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 54 54 | __all__ = [ 55 55 | "APRIL", 56 56 | "AUGUST", @@ -452,7 +437,6 @@ RUF022.py:91:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 88 88 | ########################################## 89 89 | 90 90 | # comment0 @@ -495,7 +479,6 @@ RUF022.py:101:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 99 99 | # comment7 100 100 | 101 101 | __all__ = [ # comment0 @@ -537,7 +520,6 @@ RUF022.py:110:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 107 107 | # comment6 108 108 | ] # comment7 109 109 | @@ -626,7 +608,6 @@ RUF022.py:125:28: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 123 123 | "register_error", "lookup_error"] 124 124 | 125 125 | __all__: tuple[str, ...] = ( # a comment about the opening paren @@ -662,7 +643,6 @@ RUF022.py:138:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 136 136 | # Also, this doesn't end with a trailing comma, 137 137 | # so the autofix shouldn't introduce one: 138 138 | __all__ = ( @@ -697,7 +677,6 @@ RUF022.py:145:16: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 143 143 | ) 144 144 | 145 145 | __all__.extend(( # comment0 @@ -731,7 +710,6 @@ RUF022.py:155:5: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 153 153 | __all__.extend( # comment0 154 154 | # comment1 155 155 | ( # comment2 @@ -766,7 +744,6 @@ RUF022.py:164:16: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 162 162 | ) # comment2 163 163 | 164 164 | __all__.extend([ # comment0 @@ -800,7 +777,6 @@ RUF022.py:174:5: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 172 172 | __all__.extend( # comment0 173 173 | # comment1 174 174 | [ # comment2 @@ -832,7 +808,6 @@ RUF022.py:183:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 180 180 | ] # comment4 181 181 | ) # comment2 182 182 | @@ -865,7 +840,6 @@ RUF022.py:188:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 185 185 | "LabeledScale", "OptionMenu", 186 186 | ] 187 187 | @@ -901,7 +875,6 @@ RUF022.py:192:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 190 190 | ] 191 191 | 192 192 | __all__ = [ @@ -975,7 +948,6 @@ RUF022.py:225:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 223 223 | ############################################################ 224 224 | 225 225 | __all__ = ( @@ -1003,7 +975,6 @@ RUF022.py:229:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 227 227 | "dumps",) 228 228 | 229 229 | __all__ = [ @@ -1037,7 +1008,6 @@ RUF022.py:233:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 230 230 | "loads", 231 231 | "dumps" , ] 232 232 | @@ -1073,7 +1043,6 @@ RUF022.py:243:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 241 241 | ] 242 242 | 243 243 | __all__ = ( @@ -1117,7 +1086,6 @@ RUF022.py:253:11: RUF022 [*] `__all__` is not sorted | = help: Apply an isort-style sorting to `__all__` -Suggested fix: 251 251 | ) 252 252 | 253 253 | __all__ = ( # comment about the opening paren diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap index 417dc896b6173..66eea79f477d5 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap @@ -10,7 +10,6 @@ RUF023.py:6:17: RUF023 [*] `Klass.__slots__` is not sorted | = help: Apply a natural sort to `Klass.__slots__` -Suggested fix: 3 3 | ######################### 4 4 | 5 5 | class Klass: @@ -33,7 +32,6 @@ RUF023.py:7:17: RUF023 [*] `Klass.__slots__` is not sorted | = help: Apply a natural sort to `Klass.__slots__` -Suggested fix: 4 4 | 5 5 | class Klass: 6 6 | __slots__ = ["d", "c", "b", "a"] # a comment that is untouched @@ -56,7 +54,6 @@ RUF023.py:11:22: RUF023 [*] `Klass.__slots__` is not sorted | = help: Apply a natural sort to `Klass.__slots__` -Suggested fix: 8 8 | 9 9 | # Quoting style is retained, 10 10 | # but unnecessary parens are not @@ -79,7 +76,6 @@ RUF023.py:14:24: RUF023 [*] `Klass.__slots__` is not sorted | = help: Apply a natural sort to `Klass.__slots__` -Suggested fix: 11 11 | __slots__: set = {'b', "c", ((('a')))} 12 12 | # Trailing commas are also not retained for single-line definitions 13 13 | # (but they are in multiline definitions) @@ -102,7 +98,6 @@ RUF023.py:18:21: RUF023 [*] `Klass2.__slots__` is not sorted | = help: Apply a natural sort to `Klass2.__slots__` -Suggested fix: 15 15 | 16 16 | class Klass2: 17 17 | if bool(): @@ -125,7 +120,6 @@ RUF023.py:20:21: RUF023 [*] `Klass2.__slots__` is not sorted | = help: Apply a natural sort to `Klass2.__slots__` -Suggested fix: 17 17 | if bool(): 18 18 | __slots__ = {"x": "docs for x", "m": "docs for m", "a": "docs for a"} 19 19 | else: @@ -148,7 +142,6 @@ RUF023.py:22:28: RUF023 [*] `Klass2.__slots__` is not sorted | = help: Apply a natural sort to `Klass2.__slots__` -Suggested fix: 19 19 | else: 20 20 | __slots__ = "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) 21 21 | @@ -170,7 +163,6 @@ RUF023.py:23:17: RUF023 [*] `Klass2.__slots__` is not sorted | = help: Apply a natural sort to `Klass2.__slots__` -Suggested fix: 20 20 | __slots__ = "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) 21 21 | 22 22 | __slots__: list[str] = ["the", "three", "little", "pigs"] @@ -193,7 +185,6 @@ RUF023.py:26:17: RUF023 [*] `Klass2.__slots__` is not sorted | = help: Apply a natural sort to `Klass2.__slots__` -Suggested fix: 23 23 | __slots__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") 24 24 | # we use natural sort, 25 25 | # not alphabetical sort or "isort-style" sort @@ -222,7 +213,6 @@ RUF023.py:33:17: RUF023 [*] `Klass3.__slots__` is not sorted | = help: Apply a natural sort to `Klass3.__slots__` -Suggested fix: 31 31 | 32 32 | class Klass3: 33 33 | __slots__ = ( @@ -259,7 +249,6 @@ RUF023.py:40:17: RUF023 [*] `Klass3.__slots__` is not sorted | = help: Apply a natural sort to `Klass3.__slots__` -Suggested fix: 38 38 | "a0" 39 39 | ) 40 40 | __slots__ = [ @@ -296,7 +285,6 @@ RUF023.py:54:17: RUF023 [*] `Klass4.__slots__` is not sorted | = help: Apply a natural sort to `Klass4.__slots__` -Suggested fix: 51 51 | 52 52 | class Klass4: 53 53 | # comment0 @@ -339,7 +327,6 @@ RUF023.py:64:17: RUF023 [*] `Klass4.__slots__` is not sorted | = help: Apply a natural sort to `Klass4.__slots__` -Suggested fix: 62 62 | # comment7 63 63 | 64 64 | __slots__ = [ # comment0 @@ -402,7 +389,6 @@ RUF023.py:75:17: RUF023 [*] `PurePath.__slots__` is not sorted | = help: Apply a natural sort to `PurePath.__slots__` -Suggested fix: 73 73 | # from cpython/Lib/pathlib/__init__.py 74 74 | class PurePath: 75 75 | __slots__ = ( @@ -487,7 +473,6 @@ RUF023.py:113:17: RUF023 [*] `ArgumentDescriptor.__slots__` is not sorted | = help: Apply a natural sort to `ArgumentDescriptor.__slots__` -Suggested fix: 111 111 | # From cpython/Lib/pickletools.py 112 112 | class ArgumentDescriptor(object): 113 113 | __slots__ = ( @@ -585,7 +570,6 @@ RUF023.py:162:17: RUF023 [*] `BezierBuilder.__slots__` is not sorted | = help: Apply a natural sort to `BezierBuilder.__slots__` -Suggested fix: 159 159 | ############################################################ 160 160 | 161 161 | class BezierBuilder: @@ -614,7 +598,6 @@ RUF023.py:166:17: RUF023 [*] `BezierBuilder2.__slots__` is not sorted | = help: Apply a natural sort to `BezierBuilder2.__slots__` -Suggested fix: 163 163 | 'canvas',) 164 164 | 165 165 | class BezierBuilder2: @@ -649,7 +632,6 @@ RUF023.py:170:17: RUF023 [*] `BezierBuilder3.__slots__` is not sorted | = help: Apply a natural sort to `BezierBuilder3.__slots__` -Suggested fix: 167 167 | 'canvas' , } 168 168 | 169 169 | class BezierBuilder3: @@ -684,7 +666,6 @@ RUF023.py:181:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted | = help: Apply a natural sort to `BezierBuilder4.__slots__` -Suggested fix: 179 179 | 180 180 | class BezierBuilder4: 181 181 | __slots__ = ( @@ -715,7 +696,6 @@ RUF023.py:191:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted | = help: Apply a natural sort to `BezierBuilder4.__slots__` -Suggested fix: 188 188 | , 189 189 | ) 190 190 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap index 48a6e045973a6..d1b3fdd8410a5 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap @@ -11,7 +11,6 @@ RUF024.py:9:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkey | = help: Replace with comprehension -Suggested fix: 6 6 | ] 7 7 | 8 8 | # Errors. @@ -34,7 +33,6 @@ RUF024.py:10:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke | = help: Replace with comprehension -Suggested fix: 7 7 | 8 8 | # Errors. 9 9 | dict.fromkeys(pierogi_fillings, []) @@ -57,7 +55,6 @@ RUF024.py:11:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke | = help: Replace with comprehension -Suggested fix: 8 8 | # Errors. 9 9 | dict.fromkeys(pierogi_fillings, []) 10 10 | dict.fromkeys(pierogi_fillings, list()) @@ -80,7 +77,6 @@ RUF024.py:12:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke | = help: Replace with comprehension -Suggested fix: 9 9 | dict.fromkeys(pierogi_fillings, []) 10 10 | dict.fromkeys(pierogi_fillings, list()) 11 11 | dict.fromkeys(pierogi_fillings, {}) @@ -103,7 +99,6 @@ RUF024.py:13:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke | = help: Replace with comprehension -Suggested fix: 10 10 | dict.fromkeys(pierogi_fillings, list()) 11 11 | dict.fromkeys(pierogi_fillings, {}) 12 12 | dict.fromkeys(pierogi_fillings, set()) @@ -126,7 +121,6 @@ RUF024.py:14:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke | = help: Replace with comprehension -Suggested fix: 11 11 | dict.fromkeys(pierogi_fillings, {}) 12 12 | dict.fromkeys(pierogi_fillings, set()) 13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"}) @@ -149,7 +143,6 @@ RUF024.py:16:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke | = help: Replace with comprehension -Suggested fix: 13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"}) 14 14 | dict.fromkeys(pierogi_fillings, dict()) 15 15 | import builtins diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF025_RUF025.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF025_RUF025.py.snap index 7798bf19cac9f..0db5b5d87131d 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF025_RUF025.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF025_RUF025.py.snap @@ -10,7 +10,6 @@ RUF025.py:6:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict | = help: Replace with `dict.fromkeys(iterable, value)`) -Suggested fix: 3 3 | 4 4 | def func(): 5 5 | numbers = [1, 2, 3] @@ -31,7 +30,6 @@ RUF025.py:10:23: RUF025 [*] Unnecessary dict comprehension for iterable; use `di | = help: Replace with `dict.fromkeys(iterable)`) -Suggested fix: 7 7 | 8 8 | 9 9 | def func(): @@ -51,7 +49,6 @@ RUF025.py:15:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -Suggested fix: 12 12 | 13 13 | 14 14 | def func(): @@ -72,7 +69,6 @@ RUF025.py:26:7: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -Suggested fix: 23 23 | def f(data): 24 24 | return data 25 25 | @@ -92,7 +88,6 @@ RUF025.py:30:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -Suggested fix: 27 27 | 28 28 | 29 29 | def func(): @@ -112,7 +107,6 @@ RUF025.py:34:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -Suggested fix: 31 31 | 32 32 | 33 33 | def func(): @@ -132,7 +126,6 @@ RUF025.py:38:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -Suggested fix: 35 35 | 36 36 | 37 37 | def func(): @@ -152,7 +145,6 @@ RUF025.py:42:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -Suggested fix: 39 39 | 40 40 | 41 41 | def func(): @@ -172,7 +164,6 @@ RUF025.py:46:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -Suggested fix: 43 43 | 44 44 | 45 45 | def func(): @@ -192,7 +183,6 @@ RUF025.py:54:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -Suggested fix: 51 51 | return 1 52 52 | 53 53 | a = f() @@ -213,7 +203,6 @@ RUF025.py:59:6: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic | = help: Replace with `dict.fromkeys(iterable)`) -Suggested fix: 56 56 | 57 57 | def func(): 58 58 | values = ["a", "b", "c"] diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF026_RUF026.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF026_RUF026.py.snap index f5e6f5656fc5e..62ae0e1a34417 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF026_RUF026.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF026_RUF026.py.snap @@ -9,7 +9,6 @@ RUF026.py:11:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=int)` -Suggested fix: 8 8 | 9 9 | 10 10 | def func(): @@ -29,7 +28,6 @@ RUF026.py:15:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=float)` -Suggested fix: 12 12 | 13 13 | 14 14 | def func(): @@ -49,7 +47,6 @@ RUF026.py:19:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=dict)` -Suggested fix: 16 16 | 17 17 | 18 18 | def func(): @@ -69,7 +66,6 @@ RUF026.py:23:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=list)` -Suggested fix: 20 20 | 21 21 | 22 22 | def func(): @@ -89,7 +85,6 @@ RUF026.py:27:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=tuple)` -Suggested fix: 24 24 | 25 25 | 26 26 | def func(): @@ -110,7 +105,6 @@ RUF026.py:34:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=foo)` -Suggested fix: 31 31 | def foo(): 32 32 | pass 33 33 | @@ -130,7 +124,6 @@ RUF026.py:38:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=lambda: 1)` -Suggested fix: 35 35 | 36 36 | 37 37 | def func(): @@ -151,7 +144,6 @@ RUF026.py:44:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=deque)` -Suggested fix: 41 41 | def func(): 42 42 | from collections import deque 43 43 | @@ -172,7 +164,6 @@ RUF026.py:52:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=MyCallable())` -Suggested fix: 49 49 | def __call__(self): 50 50 | pass 51 51 | @@ -192,7 +183,6 @@ RUF026.py:56:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=tuple)` -Suggested fix: 53 53 | 54 54 | 55 55 | def func(): @@ -212,7 +202,6 @@ RUF026.py:60:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=tuple)` -Suggested fix: 57 57 | 58 58 | 59 59 | def func(): @@ -232,7 +221,6 @@ RUF026.py:64:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=tuple)` -Suggested fix: 61 61 | 62 62 | 63 63 | def func(): @@ -256,7 +244,6 @@ RUF026.py:68:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=tuple)` -Suggested fix: 66 66 | 67 67 | def func(): 68 68 | defaultdict( @@ -281,7 +268,6 @@ RUF026.py:75:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=tuple)` -Suggested fix: 73 73 | 74 74 | def func(): 75 75 | defaultdict( diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap index 68f26876380ef..550e116c28386 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap @@ -10,7 +10,6 @@ RUF027_0.py:5:7: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -Suggested fix: 2 2 | 3 3 | "always ignore this: {val}" 4 4 | @@ -32,7 +31,6 @@ RUF027_0.py:10:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -Suggested fix: 7 7 | 8 8 | def simple_cases(): 9 9 | a = 4 @@ -53,7 +51,6 @@ RUF027_0.py:11:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -Suggested fix: 8 8 | def simple_cases(): 9 9 | a = 4 10 10 | b = "{a}" # RUF027 @@ -75,7 +72,6 @@ RUF027_0.py:21:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -Suggested fix: 18 18 | 19 19 | def raw_string(): 20 20 | a = 4 @@ -96,7 +92,6 @@ RUF027_0.py:22:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -Suggested fix: 19 19 | def raw_string(): 20 20 | a = 4 21 21 | b = r"raw string with formatting: {a}" # RUF027 @@ -118,7 +113,6 @@ RUF027_0.py:27:11: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -Suggested fix: 24 24 | 25 25 | def print_name(name: str): 26 26 | a = 4 @@ -139,7 +133,6 @@ RUF027_0.py:28:11: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -Suggested fix: 25 25 | def print_name(name: str): 26 26 | a = 4 27 27 | print("Hello, {name}!") # RUF027 @@ -160,7 +153,6 @@ RUF027_0.py:33:33: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -Suggested fix: 30 30 | 31 31 | def nested_funcs(): 32 32 | a = 4 @@ -183,7 +175,6 @@ RUF027_0.py:39:19: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -Suggested fix: 36 36 | def tripled_quoted(): 37 37 | a = 4 38 38 | c = a @@ -207,7 +198,6 @@ RUF027_0.py:41:22: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -Suggested fix: 38 38 | c = a 39 39 | single_line = """ {a} """ # RUF027 40 40 | # RUF027 @@ -231,7 +221,6 @@ RUF027_0.py:49:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -Suggested fix: 46 46 | def single_quoted_multi_line(): 47 47 | a = 4 48 48 | # RUF027 @@ -253,7 +242,6 @@ RUF027_0.py:56:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -Suggested fix: 53 53 | 54 54 | def implicit_concat(): 55 55 | a = 4 @@ -274,7 +262,6 @@ RUF027_0.py:57:18: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -Suggested fix: 54 54 | def implicit_concat(): 55 55 | a = 4 56 56 | b = "{a}" "+" "{b}" r" \\ " # RUF027 for the first part only @@ -295,7 +282,6 @@ RUF027_0.py:62:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -Suggested fix: 59 59 | 60 60 | def escaped_chars(): 61 61 | a = 4 @@ -318,7 +304,6 @@ RUF027_0.py:70:18: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -Suggested fix: 67 67 | value.method = print_name 68 68 | first = "Wendy" 69 69 | last = "Appleseed" @@ -339,7 +324,6 @@ RUF027_0.py:74:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -Suggested fix: 71 71 | 72 72 | def format_specifiers(): 73 73 | a = 4 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF028_RUF028.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF028_RUF028.py.snap index d6609aafbdb62..2e739f863edb9 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF028_RUF028.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF028_RUF028.py.snap @@ -12,7 +12,6 @@ RUF028.py:3:9: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -Suggested fix: 1 1 | def fmt_off_between_lists(): 2 2 | test_list = [ 3 |- # fmt: off @@ -32,7 +31,6 @@ RUF028.py:12:5: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -Suggested fix: 9 9 | 10 10 | # note: the second `fmt: skip`` should be OK 11 11 | def fmt_skip_on_own_line(): @@ -53,7 +51,6 @@ RUF028.py:17:1: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -Suggested fix: 14 14 | 15 15 | 16 16 | @fmt_skip_on_own_line @@ -74,7 +71,6 @@ RUF028.py:24:1: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -Suggested fix: 21 21 | 22 22 | 23 23 | @fmt_off_between_decorators @@ -96,7 +92,6 @@ RUF028.py:33:5: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -Suggested fix: 30 30 | x = [1, 2, 3] 31 31 | for val in x: 32 32 | print(x) @@ -118,7 +113,6 @@ RUF028.py:39:5: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -Suggested fix: 36 36 | while False: 37 37 | print("while") 38 38 | # fmt: off @@ -140,7 +134,6 @@ RUF028.py:45:5: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -Suggested fix: 42 42 | if len(x) > 3: 43 43 | print("huh?") 44 44 | # fmt: on @@ -162,7 +155,6 @@ RUF028.py:52:5: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -Suggested fix: 49 49 | 50 50 | class Test: 51 51 | @classmethod @@ -184,7 +176,6 @@ RUF028.py:54:9: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -Suggested fix: 51 51 | @classmethod 52 52 | # fmt: off 53 53 | def cls_method_a( @@ -205,7 +196,6 @@ RUF028.py:62:13: RUF028 [*] This suppression comment is invalid because it canno | = help: Remove this comment -Suggested fix: 59 59 | 60 60 | def fmt_on_trailing(): 61 61 | # fmt: off @@ -226,7 +216,6 @@ RUF028.py:63:10: RUF028 [*] This suppression comment is invalid because it canno | = help: Remove this comment -Suggested fix: 60 60 | def fmt_on_trailing(): 61 61 | # fmt: off 62 62 | val = 5 # fmt: on diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap index 007bd033089d3..c13790730a9fd 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap @@ -12,7 +12,6 @@ RUF030.py:6:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 3 3 | # Standard Case 4 4 | # Expects: 5 5 | # - single StringLiteral @@ -35,7 +34,6 @@ RUF030.py:11:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 8 8 | # Concatenated string literals 9 9 | # Expects: 10 10 | # - single StringLiteral @@ -58,7 +56,6 @@ RUF030.py:16:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 13 13 | # Positional arguments, string literals 14 14 | # Expects: 15 15 | # - single StringLiteral concatenated with " " @@ -81,7 +78,6 @@ RUF030.py:21:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 18 18 | # Concatenated string literals combined with Positional arguments 19 19 | # Expects: 20 20 | # - single stringliteral concatenated with " " only between `print` and `is` @@ -104,7 +100,6 @@ RUF030.py:26:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 23 23 | # Positional arguments, string literals with a variable 24 24 | # Expects: 25 25 | # - single FString concatenated with " " @@ -127,7 +122,6 @@ RUF030.py:31:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 28 28 | # Mixed brackets string literals 29 29 | # Expects: 30 30 | # - single StringLiteral concatenated with " " @@ -150,7 +144,6 @@ RUF030.py:36:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 33 33 | # Mixed brackets with other brackets inside 34 34 | # Expects: 35 35 | # - single StringLiteral concatenated with " " and escaped brackets @@ -173,7 +166,6 @@ RUF030.py:41:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 38 38 | # Positional arguments, string literals with a separator 39 39 | # Expects: 40 40 | # - single StringLiteral concatenated with "|" @@ -196,7 +188,6 @@ RUF030.py:46:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 43 43 | # Positional arguments, string literals with None as separator 44 44 | # Expects: 45 45 | # - single StringLiteral concatenated with " " @@ -219,7 +210,6 @@ RUF030.py:51:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 48 48 | # Positional arguments, string literals with variable as separator, needs f-string 49 49 | # Expects: 50 50 | # - single FString concatenated with "{U00A0}" @@ -242,7 +232,6 @@ RUF030.py:56:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 53 53 | # Unnecessary f-string 54 54 | # Expects: 55 55 | # - single StringLiteral @@ -265,7 +254,6 @@ RUF030.py:61:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 58 58 | # Positional arguments, string literals and f-strings 59 59 | # Expects: 60 60 | # - single FString concatenated with " " @@ -288,7 +276,6 @@ RUF030.py:66:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 63 63 | # Positional arguments, string literals and f-strings with a separator 64 64 | # Expects: 65 65 | # - single FString concatenated with "|" @@ -311,7 +298,6 @@ RUF030.py:71:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 68 68 | # A single f-string 69 69 | # Expects: 70 70 | # - single FString @@ -334,7 +320,6 @@ RUF030.py:76:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 73 73 | # A single f-string with a redundant separator 74 74 | # Expects: 75 75 | # - single FString @@ -357,7 +342,6 @@ RUF030.py:83:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 80 80 | # - single FString concatenated with "{U00A0}", all placeholders preserved 81 81 | condition = "True is True" 82 82 | maintainer = "John Doe" @@ -380,7 +364,6 @@ RUF030.py:88:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 85 85 | # Empty print 86 86 | # Expects: 87 87 | # - `msg` entirely removed from assertion @@ -403,7 +386,6 @@ RUF030.py:93:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -Suggested fix: 90 90 | # Empty print with separator 91 91 | # Expects: 92 92 | # - `msg` entirely removed from assertion @@ -424,7 +406,6 @@ RUF030.py:108:14: RUF030 [*] `print()` expression in `assert` statement is likel | = help: Remove `print` -Suggested fix: 105 105 | # Use of `builtins.print` 106 106 | # Expects: 107 107 | # - single StringLiteral diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101.py.snap index 2c2c63c03178a..c63f3676b9772 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101.py.snap @@ -10,7 +10,6 @@ RUF101.py:1:15: RUF101 [*] `RUF940` is a redirect to `RUF950` | = help: Replace with `RUF950` -Suggested fix: 1 |-x = 2 # noqa: RUF940 2 1 | x = 2 # noqa: RUF950 2 |+x = 2 # noqa: RUF950 @@ -31,7 +30,6 @@ RUF101.py:3:15: RUF101 [*] `RUF940` is a redirect to `RUF950` | = help: Replace with `RUF950` -Suggested fix: 1 1 | x = 2 # noqa: RUF940 2 2 | x = 2 # noqa: RUF950 3 |-x = 2 # noqa: RUF940, RUF950 @@ -53,7 +51,6 @@ RUF101.py:4:23: RUF101 [*] `RUF940` is a redirect to `RUF950` | = help: Replace with `RUF950` -Suggested fix: 1 1 | x = 2 # noqa: RUF940 2 2 | x = 2 # noqa: RUF950 3 3 | x = 2 # noqa: RUF940, RUF950 @@ -74,7 +71,6 @@ RUF101.py:5:15: RUF101 [*] `RUF940` is a redirect to `RUF950` | = help: Replace with `RUF950` -Suggested fix: 2 2 | x = 2 # noqa: RUF950 3 3 | x = 2 # noqa: RUF940, RUF950 4 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 @@ -94,7 +90,6 @@ RUF101.py:5:31: RUF101 [*] `RUF940` is a redirect to `RUF950` | = help: Replace with `RUF950` -Suggested fix: 2 2 | x = 2 # noqa: RUF950 3 3 | x = 2 # noqa: RUF940, RUF950 4 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 @@ -113,7 +108,6 @@ RUF101.py:6:15: RUF101 [*] `RUF940` is a redirect to `RUF950` | = help: Replace with `RUF950` -Suggested fix: 3 3 | x = 2 # noqa: RUF940, RUF950 4 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 5 5 | x = 2 # noqa: RUF940, RUF950, RUF940 @@ -131,7 +125,6 @@ RUF101.py:6:31: RUF101 [*] `RUF940` is a redirect to `RUF950` | = help: Replace with `RUF950` -Suggested fix: 3 3 | x = 2 # noqa: RUF940, RUF950 4 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 5 5 | x = 2 # noqa: RUF940, RUF950, RUF940 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap index 1f5858da03de2..2588490f30ac2 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap @@ -10,7 +10,6 @@ noqa.py:23:5: F841 [*] Local variable `I` is assigned to but never used | = help: Remove assignment to unused variable `I` -Suggested fix: 20 20 | 21 21 | def f(): 22 22 | # Only `E741` should be ignored by the `noqa`. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap index 1b3d50d0b3ca1..dcbc2698f6322 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap @@ -10,7 +10,6 @@ RUF100_0.py:9:12: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -Suggested fix: 6 6 | b = 2 # noqa: F841 7 7 | 8 8 | # Invalid @@ -32,7 +31,6 @@ RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 10 10 | print(c) 11 11 | 12 12 | # Invalid @@ -54,7 +52,6 @@ RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 13 13 | d = 1 # noqa: E501 14 14 | 15 15 | # Invalid @@ -76,7 +73,6 @@ RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; n | = help: Remove unused `noqa` directive -Suggested fix: 16 16 | d = 1 # noqa: F841, E501 17 17 | 18 18 | # Invalid (and unimplemented or not enabled) @@ -98,7 +94,6 @@ RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) | = help: Remove unused `noqa` directive -Suggested fix: 19 19 | d = 1 # noqa: F841, W191, F821 20 20 | 21 21 | # Invalid (but external) @@ -120,7 +115,6 @@ RUF100_0.py:25:12: RUF100 [*] Unused `noqa` directive (unknown: `V500`) | = help: Remove unused `noqa` directive -Suggested fix: 22 22 | d = 1 # noqa: F841, V101 23 23 | 24 24 | # Invalid (but external) @@ -143,7 +137,6 @@ RUF100_0.py:29:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 26 26 | 27 27 | # fmt: off 28 28 | # Invalid - no space before # @@ -164,7 +157,6 @@ RUF100_0.py:32:5: F841 [*] Local variable `d` is assigned to but never used | = help: Remove assignment to unused variable `d` -Suggested fix: 29 29 | d = 1 # noqa: E501 30 30 | 31 31 | # Invalid - many spaces before # @@ -184,7 +176,6 @@ RUF100_0.py:32:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 29 29 | d = 1 # noqa: E501 30 30 | 31 31 | # Invalid - many spaces before # @@ -206,7 +197,6 @@ RUF100_0.py:58:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) | = help: Remove unused `noqa` directive -Suggested fix: 55 55 | https://github.com/PyCQA/pycodestyle/pull/258/files#diff-841c622497a8033d10152bfdfb15b20b92437ecdea21a260944ea86b77b51533 56 56 | 57 57 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. @@ -228,7 +218,6 @@ RUF100_0.py:66:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 63 63 | https://github.com/PyCQA/pycodestyle/pull/258/files#diff-841c622497a8033d10152bfdfb15b20b92437ecdea21a260944ea86b77b51533 64 64 | 65 65 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. @@ -250,7 +239,6 @@ RUF100_0.py:74:6: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -Suggested fix: 71 71 | https://github.com/PyCQA/pycodestyle/pull/258/files#diff-841c622497a8033d10152bfdfb15b20b92437ecdea21a260944ea86b77b51533 72 72 | 73 73 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. @@ -272,7 +260,6 @@ RUF100_0.py:88:8: F401 [*] `shelve` imported but unused | = help: Remove unused import: `shelve` -Suggested fix: 85 85 | 86 86 | import collections # noqa 87 87 | import os # noqa: F401, RUF100 @@ -300,7 +287,6 @@ RUF100_0.py:93:92: RUF100 [*] Unused `noqa` directive (unused: `F401`) | = help: Remove unused `noqa` directive -Suggested fix: 90 90 | 91 91 | print(sys.path) 92 92 | @@ -322,7 +308,6 @@ RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | = help: Remove unused `noqa` directive -Suggested fix: 104 104 | 105 105 | def f(): 106 106 | # Invalid - nonexistent error code with multibyte character @@ -343,7 +328,6 @@ RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used | = help: Remove assignment to unused variable `e` -Suggested fix: 105 105 | def f(): 106 106 | # Invalid - nonexistent error code with multibyte character 107 107 | d = 1 # …noqa: F841, E50 @@ -363,7 +347,6 @@ RUF100_0.py:108:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | = help: Remove unused `noqa` directive -Suggested fix: 105 105 | def f(): 106 106 | # Invalid - nonexistent error code with multibyte character 107 107 | d = 1 # …noqa: F841, E50 @@ -386,7 +369,6 @@ RUF100_0.py:118:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`; unkn | = help: Remove unused `noqa` directive -Suggested fix: 115 115 | 116 116 | # Check duplicate code detection 117 117 | def f(): @@ -409,7 +391,6 @@ RUF100_0.py:120:19: RUF100 [*] Unused `noqa` directive (duplicated: `SIM300`, `S | = help: Remove unused `noqa` directive -Suggested fix: 117 117 | def f(): 118 118 | x = 2 # noqa: F841, F841, X200 119 119 | @@ -432,7 +413,6 @@ RUF100_0.py:122:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`, `F84 | = help: Remove unused `noqa` directive -Suggested fix: 119 119 | 120 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 121 121 | @@ -455,7 +435,6 @@ RUF100_0.py:129:20: RUF100 [*] Unused `noqa` directive (duplicated: `S307`, `S30 | = help: Remove unused `noqa` directive -Suggested fix: 126 126 | 127 127 | # Allow code redirects 128 128 | x = eval(command) # noqa: PGH001, S307 @@ -476,7 +455,6 @@ RUF100_0.py:130:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`) | = help: Remove unused `noqa` directive -Suggested fix: 127 127 | # Allow code redirects 128 128 | x = eval(command) # noqa: PGH001, S307 129 129 | x = eval(command) # noqa: S307, PGH001, S307, S307, S307 @@ -495,7 +473,6 @@ RUF100_0.py:131:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`, `S | = help: Remove unused `noqa` directive -Suggested fix: 128 128 | x = eval(command) # noqa: PGH001, S307 129 129 | x = eval(command) # noqa: S307, PGH001, S307, S307, S307 130 130 | x = eval(command) # noqa: PGH001, S307, PGH001 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap index 002149c06d1ff..0e86f4814c3aa 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap @@ -10,7 +10,6 @@ RUF100_0.py:9:12: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -Suggested fix: 6 6 | b = 2 # noqa: F841 7 7 | 8 8 | # Invalid @@ -32,7 +31,6 @@ RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 10 10 | print(c) 11 11 | 12 12 | # Invalid @@ -54,7 +52,6 @@ RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 13 13 | d = 1 # noqa: E501 14 14 | 15 15 | # Invalid @@ -76,7 +73,6 @@ RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; n | = help: Remove unused `noqa` directive -Suggested fix: 16 16 | d = 1 # noqa: F841, E501 17 17 | 18 18 | # Invalid (and unimplemented or not enabled) @@ -98,7 +94,6 @@ RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) | = help: Remove unused `noqa` directive -Suggested fix: 19 19 | d = 1 # noqa: F841, W191, F821 20 20 | 21 21 | # Invalid (but external) @@ -121,7 +116,6 @@ RUF100_0.py:29:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 26 26 | 27 27 | # fmt: off 28 28 | # Invalid - no space before # @@ -142,7 +136,6 @@ RUF100_0.py:32:5: F841 [*] Local variable `d` is assigned to but never used | = help: Remove assignment to unused variable `d` -Suggested fix: 29 29 | d = 1 # noqa: E501 30 30 | 31 31 | # Invalid - many spaces before # @@ -162,7 +155,6 @@ RUF100_0.py:32:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 29 29 | d = 1 # noqa: E501 30 30 | 31 31 | # Invalid - many spaces before # @@ -184,7 +176,6 @@ RUF100_0.py:58:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) | = help: Remove unused `noqa` directive -Suggested fix: 55 55 | https://github.com/PyCQA/pycodestyle/pull/258/files#diff-841c622497a8033d10152bfdfb15b20b92437ecdea21a260944ea86b77b51533 56 56 | 57 57 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. @@ -206,7 +197,6 @@ RUF100_0.py:66:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 63 63 | https://github.com/PyCQA/pycodestyle/pull/258/files#diff-841c622497a8033d10152bfdfb15b20b92437ecdea21a260944ea86b77b51533 64 64 | 65 65 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. @@ -228,7 +218,6 @@ RUF100_0.py:74:6: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -Suggested fix: 71 71 | https://github.com/PyCQA/pycodestyle/pull/258/files#diff-841c622497a8033d10152bfdfb15b20b92437ecdea21a260944ea86b77b51533 72 72 | 73 73 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. @@ -250,7 +239,6 @@ RUF100_0.py:88:8: F401 [*] `shelve` imported but unused | = help: Remove unused import: `shelve` -Suggested fix: 85 85 | 86 86 | import collections # noqa 87 87 | import os # noqa: F401, RUF100 @@ -278,7 +266,6 @@ RUF100_0.py:93:92: RUF100 [*] Unused `noqa` directive (unused: `F401`) | = help: Remove unused `noqa` directive -Suggested fix: 90 90 | 91 91 | print(sys.path) 92 92 | @@ -300,7 +287,6 @@ RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | = help: Remove unused `noqa` directive -Suggested fix: 104 104 | 105 105 | def f(): 106 106 | # Invalid - nonexistent error code with multibyte character @@ -321,7 +307,6 @@ RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used | = help: Remove assignment to unused variable `e` -Suggested fix: 105 105 | def f(): 106 106 | # Invalid - nonexistent error code with multibyte character 107 107 | d = 1 # …noqa: F841, E50 @@ -341,7 +326,6 @@ RUF100_0.py:108:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | = help: Remove unused `noqa` directive -Suggested fix: 105 105 | def f(): 106 106 | # Invalid - nonexistent error code with multibyte character 107 107 | d = 1 # …noqa: F841, E50 @@ -364,7 +348,6 @@ RUF100_0.py:118:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`; unkn | = help: Remove unused `noqa` directive -Suggested fix: 115 115 | 116 116 | # Check duplicate code detection 117 117 | def f(): @@ -387,7 +370,6 @@ RUF100_0.py:120:19: RUF100 [*] Unused `noqa` directive (duplicated: `SIM300`, `S | = help: Remove unused `noqa` directive -Suggested fix: 117 117 | def f(): 118 118 | x = 2 # noqa: F841, F841, X200 119 119 | @@ -410,7 +392,6 @@ RUF100_0.py:122:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`, `F84 | = help: Remove unused `noqa` directive -Suggested fix: 119 119 | 120 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 121 121 | @@ -433,7 +414,6 @@ RUF100_0.py:129:20: RUF100 [*] Unused `noqa` directive (duplicated: `S307`, `S30 | = help: Remove unused `noqa` directive -Suggested fix: 126 126 | 127 127 | # Allow code redirects 128 128 | x = eval(command) # noqa: PGH001, S307 @@ -454,7 +434,6 @@ RUF100_0.py:130:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`) | = help: Remove unused `noqa` directive -Suggested fix: 127 127 | # Allow code redirects 128 128 | x = eval(command) # noqa: PGH001, S307 129 129 | x = eval(command) # noqa: S307, PGH001, S307, S307, S307 @@ -473,7 +452,6 @@ RUF100_0.py:131:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`, `S | = help: Remove unused `noqa` directive -Suggested fix: 128 128 | x = eval(command) # noqa: PGH001, S307 129 129 | x = eval(command) # noqa: S307, PGH001, S307, S307, S307 130 130 | x = eval(command) # noqa: PGH001, S307, PGH001 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap index f46717e1ee4b0..7642c0b4224f4 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap @@ -11,7 +11,6 @@ RUF100_1.py:37:9: F401 [*] `typing.Union` imported but unused | = help: Remove unused import: `typing.Union` -Suggested fix: 34 34 | # This should ignore the first error. 35 35 | from typing import ( 36 36 | Mapping, # noqa: F401 @@ -34,7 +33,6 @@ RUF100_1.py:52:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) | = help: Remove unused `noqa` directive -Suggested fix: 49 49 | def f(): 50 50 | # This should ignore the error, but the inner noqa should be marked as unused. 51 51 | from typing import ( # noqa: F401 @@ -56,7 +54,6 @@ RUF100_1.py:59:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) | = help: Remove unused `noqa` directive -Suggested fix: 56 56 | def f(): 57 57 | # This should ignore the error, but the inner noqa should be marked as unused. 58 58 | from typing import ( # noqa @@ -78,7 +75,6 @@ RUF100_1.py:66:16: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | = help: Remove unused `noqa` directive -Suggested fix: 63 63 | def f(): 64 64 | # This should ignore the error, but mark F501 as unused. 65 65 | from typing import ( # noqa: F401 @@ -101,7 +97,6 @@ RUF100_1.py:72:27: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | = help: Remove unused `noqa` directive -Suggested fix: 69 69 | 70 70 | def f(): 71 71 | # This should ignore the error, but mark F501 as unused. @@ -122,7 +117,6 @@ RUF100_1.py:89:24: F401 [*] `typing.Awaitable` imported but unused | = help: Remove unused import -Suggested fix: 86 86 | 87 87 | def f(): 88 88 | # This should mark F501 as unused. @@ -140,7 +134,6 @@ RUF100_1.py:89:35: F401 [*] `typing.AwaitableGenerator` imported but unused | = help: Remove unused import -Suggested fix: 86 86 | 87 87 | def f(): 88 88 | # This should mark F501 as unused. @@ -158,7 +151,6 @@ RUF100_1.py:89:55: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | = help: Remove unused `noqa` directive -Suggested fix: 86 86 | 87 87 | def f(): 88 88 | # This should mark F501 as unused. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap index f827e039dd0d2..593bad452aa19 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap @@ -8,7 +8,6 @@ RUF100_2.py:1:19: RUF100 [*] Unused `noqa` directive (unused: `F401`) | = help: Remove unused `noqa` directive -Suggested fix: 1 |-import itertools # noqa: F401 1 |+import itertools diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap index 4b51342c5d6ec..e391a103f2471 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap @@ -10,7 +10,6 @@ RUF100_3.py:1:1: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -Suggested fix: 1 |-# noqa 2 1 | # noqa # comment 3 2 | print() # noqa @@ -28,7 +27,6 @@ RUF100_3.py:2:1: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -Suggested fix: 1 1 | # noqa 2 |-# noqa # comment 2 |+# comment @@ -49,7 +47,6 @@ RUF100_3.py:3:10: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -Suggested fix: 1 1 | # noqa 2 2 | # noqa # comment 3 |-print() # noqa @@ -71,7 +68,6 @@ RUF100_3.py:4:10: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -Suggested fix: 1 1 | # noqa 2 2 | # noqa # comment 3 3 | print() # noqa @@ -94,7 +90,6 @@ RUF100_3.py:5:10: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -Suggested fix: 2 2 | # noqa # comment 3 3 | print() # noqa 4 4 | print() # noqa # comment @@ -117,7 +112,6 @@ RUF100_3.py:6:10: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -Suggested fix: 3 3 | print() # noqa 4 4 | print() # noqa # comment 5 5 | print() # noqa # comment @@ -140,7 +134,6 @@ RUF100_3.py:7:10: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -Suggested fix: 4 4 | print() # noqa # comment 5 5 | print() # noqa # comment 6 6 | print() # noqa comment @@ -163,7 +156,6 @@ RUF100_3.py:14:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -Suggested fix: 11 11 | print(a) # noqa comment 12 12 | print(a) # noqa comment 13 13 | @@ -184,7 +176,6 @@ RUF100_3.py:15:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -Suggested fix: 12 12 | print(a) # noqa comment 13 13 | 14 14 | # noqa: E501, F821 @@ -207,7 +198,6 @@ RUF100_3.py:16:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -Suggested fix: 13 13 | 14 14 | # noqa: E501, F821 15 15 | # noqa: E501, F821 # comment @@ -230,7 +220,6 @@ RUF100_3.py:17:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -Suggested fix: 14 14 | # noqa: E501, F821 15 15 | # noqa: E501, F821 # comment 16 16 | print() # noqa: E501, F821 @@ -253,7 +242,6 @@ RUF100_3.py:18:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -Suggested fix: 15 15 | # noqa: E501, F821 # comment 16 16 | print() # noqa: E501, F821 17 17 | print() # noqa: E501, F821 # comment @@ -276,7 +264,6 @@ RUF100_3.py:19:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -Suggested fix: 16 16 | print() # noqa: E501, F821 17 17 | print() # noqa: E501, F821 # comment 18 18 | print() # noqa: E501, F821 # comment @@ -299,7 +286,6 @@ RUF100_3.py:20:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -Suggested fix: 17 17 | print() # noqa: E501, F821 # comment 18 18 | print() # noqa: E501, F821 # comment 19 19 | print() # noqa: E501, F821 comment @@ -322,7 +308,6 @@ RUF100_3.py:21:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 18 18 | print() # noqa: E501, F821 # comment 19 19 | print() # noqa: E501, F821 comment 20 20 | print() # noqa: E501, F821 comment @@ -345,7 +330,6 @@ RUF100_3.py:22:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 19 19 | print() # noqa: E501, F821 comment 20 20 | print() # noqa: E501, F821 comment 21 21 | print(a) # noqa: E501, F821 @@ -368,7 +352,6 @@ RUF100_3.py:23:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 20 20 | print() # noqa: E501, F821 comment 21 21 | print(a) # noqa: E501, F821 22 22 | print(a) # noqa: E501, F821 # comment @@ -390,7 +373,6 @@ RUF100_3.py:24:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 21 21 | print(a) # noqa: E501, F821 22 22 | print(a) # noqa: E501, F821 # comment 23 23 | print(a) # noqa: E501, F821 # comment @@ -413,7 +395,6 @@ RUF100_3.py:25:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 22 22 | print(a) # noqa: E501, F821 # comment 23 23 | print(a) # noqa: E501, F821 # comment 24 24 | print(a) # noqa: E501, F821 comment @@ -444,7 +425,6 @@ RUF100_3.py:27:39: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 24 24 | print(a) # noqa: E501, F821 comment 25 25 | print(a) # noqa: E501, F821 comment 26 26 | @@ -462,7 +442,6 @@ RUF100_3.py:28:39: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 25 25 | print(a) # noqa: E501, F821 comment 26 26 | 27 27 | print(a) # comment with unicode µ # noqa: E501 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap index d5ece5dc4f83c..d711413d4b253 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap @@ -11,7 +11,6 @@ RUF100_5.py:7:5: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 4 4 | dictionary = { 5 5 | # "key1": 123, # noqa: ERA001 6 6 | # "key2": 456, # noqa @@ -29,7 +28,6 @@ RUF100_5.py:11:1: ERA001 Found commented-out code | = help: Remove commented-out code -Suggested fix: 8 8 | } 9 9 | 10 10 | @@ -44,7 +42,6 @@ RUF100_5.py:11:13: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -Suggested fix: 8 8 | } 9 9 | 10 10 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap index 2ee91ff9eb2b9..037e7aefd3e89 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap @@ -9,7 +9,6 @@ ruff_noqa_codes.py:8:5: F841 [*] Local variable `x` is assigned to but never use | = help: Remove assignment to unused variable `x` -Suggested fix: 5 5 | 6 6 | 7 7 | def f(): diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap index bff7955eac273..5067d64b50fd7 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap @@ -8,7 +8,6 @@ ruff_noqa_invalid.py:1:8: F401 [*] `os` imported but unused | = help: Remove unused import: `os` -Suggested fix: 1 |-import os # ruff: noqa: F401 2 1 | 3 2 | @@ -24,7 +23,6 @@ ruff_noqa_invalid.py:5:5: F841 [*] Local variable `x` is assigned to but never u | = help: Remove assignment to unused variable `x` -Suggested fix: 2 2 | 3 3 | 4 4 | def f(): diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap index 941b0fc6e2179..040278aeec522 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap @@ -12,7 +12,6 @@ TRY400.py:13:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -Suggested fix: 10 10 | try: 11 11 | a = 1 12 12 | except Exception: @@ -32,7 +31,6 @@ TRY400.py:16:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -Suggested fix: 13 13 | logging.error("Context message here") 14 14 | 15 15 | if True: @@ -55,7 +53,6 @@ TRY400.py:27:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -Suggested fix: 24 24 | try: 25 25 | a = 1 26 26 | except Exception: @@ -75,7 +72,6 @@ TRY400.py:30:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -Suggested fix: 27 27 | logger.error("Context message here") 28 28 | 29 29 | if True: @@ -98,7 +94,6 @@ TRY400.py:37:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -Suggested fix: 34 34 | try: 35 35 | a = 1 36 36 | except Exception: @@ -118,7 +113,6 @@ TRY400.py:40:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -Suggested fix: 37 37 | log.error("Context message here") 38 38 | 39 39 | if True: @@ -141,7 +135,6 @@ TRY400.py:47:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -Suggested fix: 44 44 | try: 45 45 | a = 1 46 46 | except Exception: @@ -161,7 +154,6 @@ TRY400.py:50:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -Suggested fix: 47 47 | self.logger.error("Context message here") 48 48 | 49 49 | if True: @@ -184,7 +176,6 @@ TRY400.py:100:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -Suggested fix: 97 97 | try: 98 98 | a = 1 99 99 | except Exception: @@ -204,7 +195,6 @@ TRY400.py:103:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -Suggested fix: 100 100 | error("Context message here") 101 101 | 102 102 | if True: @@ -225,7 +215,6 @@ TRY400.py:143:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -Suggested fix: 140 140 | try: 141 141 | b = 2 142 142 | except Exception: diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap index b6c5d6c61ec12..731bcd704a842 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap @@ -10,7 +10,6 @@ TRY201.py:20:15: TRY201 [*] Use `raise` without specifying exception name | = help: Remove exception name -Suggested fix: 17 17 | process() 18 18 | except MyException as e: 19 19 | logger.exception("process failed") @@ -31,7 +30,6 @@ TRY201.py:63:19: TRY201 [*] Use `raise` without specifying exception name | = help: Remove exception name -Suggested fix: 60 60 | except MyException as e: 61 61 | logger.exception("process failed") 62 62 | if True: @@ -51,7 +49,6 @@ TRY201.py:74:23: TRY201 [*] Use `raise` without specifying exception name | = help: Remove exception name -Suggested fix: 71 71 | if True: 72 72 | 73 73 | def foo(): diff --git a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__import_sorting.snap b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__import_sorting.snap index 462cafcdf91a8..63f27755e16a8 100644 --- a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__import_sorting.snap +++ b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__import_sorting.snap @@ -13,7 +13,6 @@ isort.ipynb:cell 1:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 1 |+import math 2 |+import random 1 3 | from pathlib import Path @@ -36,7 +35,6 @@ isort.ipynb:cell 2:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 1 1 | from pathlib import Path 2 2 | import random 3 3 | import math @@ -62,7 +60,6 @@ isort.ipynb:cell 3:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 6 6 | # Newline should be added here 7 7 | def foo(): 8 8 | pass @@ -84,7 +81,6 @@ isort.ipynb:cell 3:7:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -Suggested fix: 12 12 | %matplotlib \ 13 13 | --inline 14 14 | diff --git a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__ipy_escape_command.snap b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__ipy_escape_command.snap index ff9e2c4e0ca68..46c83ce4d1305 100644 --- a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__ipy_escape_command.snap +++ b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__ipy_escape_command.snap @@ -12,7 +12,6 @@ ipy_escape_command.ipynb:cell 1:5:8: F401 [*] `os` imported but unused | = help: Remove unused import: `os` -Suggested fix: 2 2 | 3 3 | %matplotlib inline 4 4 | @@ -31,7 +30,6 @@ ipy_escape_command.ipynb:cell 2:2:8: F401 [*] `sys` imported but unused | = help: Remove unused import: `sys` -Suggested fix: 6 6 | 7 7 | _ = math.pi 8 8 | %%timeit diff --git a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap index 67b10b332ecef..85e1bb6a7ca02 100644 --- a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap +++ b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap @@ -10,7 +10,6 @@ unused_variable.ipynb:cell 1:2:5: F841 [*] Local variable `foo1` is assigned to | = help: Remove assignment to unused variable `foo1` -Suggested fix: 1 1 | def f(): 2 |- foo1 = %matplotlib --list 2 |+ %matplotlib --list @@ -29,7 +28,6 @@ unused_variable.ipynb:cell 1:3:5: F841 [*] Local variable `foo2` is assigned to | = help: Remove assignment to unused variable `foo2` -Suggested fix: 1 1 | def f(): 2 2 | foo1 = %matplotlib --list 3 |- foo2: list[str] = %matplotlib --list @@ -49,7 +47,6 @@ unused_variable.ipynb:cell 2:2:5: F841 [*] Local variable `bar1` is assigned to | = help: Remove assignment to unused variable `bar1` -Suggested fix: 2 2 | foo1 = %matplotlib --list 3 3 | foo2: list[str] = %matplotlib --list 4 4 | def f(): @@ -68,7 +65,6 @@ unused_variable.ipynb:cell 2:3:5: F841 [*] Local variable `bar2` is assigned to | = help: Remove assignment to unused variable `bar2` -Suggested fix: 3 3 | foo2: list[str] = %matplotlib --list 4 4 | def f(): 5 5 | bar1 = !pwd From 8fabf4f3e18a6eb072e228dd8dad0fe0bec9b6cb Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Wed, 31 Jul 2024 11:59:43 -0600 Subject: [PATCH 3/4] Only show safe fixes in `check` output for now There are some open design questions about how the calls to action should work for unsafe and display-only fixes, so leave them aside for now. This hard-codes that behavior into the `Display` implementation, but with a tracking issue for moving that up to the `TextEmitter`, and also includes a TODO with a tracking issue for the design of the CTAs. --- crates/ruff/tests/integration_test.rs | 61 -- crates/ruff_linter/src/message/diff.rs | 21 +- ...s__eradicate__tests__ERA001_ERA001.py.snap | 148 ----- ...i-non-annotated-dependency_FAST002.py.snap | 163 ----- ...i-redundant-response-model_FAST001.py.snap | 91 --- ..._annotations__tests__auto_return_type.snap | 376 ------------ ...tations__tests__auto_return_type_py38.snap | 480 --------------- ...__flake8_annotations__tests__defaults.snap | 58 -- ...otations__tests__ignore_fully_untyped.snap | 29 - ..._annotations__tests__mypy_init_return.snap | 39 -- ...otations__tests__simple_magic_methods.snap | 137 ----- ...tions__tests__suppress_none_returning.snap | 20 - ...e8_async__tests__ASYNC105_ASYNC105.py.snap | 240 -------- ...e8_async__tests__ASYNC116_ASYNC116.py.snap | 79 --- ..._tests__preview__ASYNC116_ASYNC116.py.snap | 202 ------- ...flake8_bugbear__tests__B006_B006_1.py.snap | 9 - ...flake8_bugbear__tests__B006_B006_2.py.snap | 10 - ...flake8_bugbear__tests__B006_B006_3.py.snap | 10 - ...flake8_bugbear__tests__B006_B006_4.py.snap | 12 - ...flake8_bugbear__tests__B006_B006_5.py.snap | 176 ------ ...flake8_bugbear__tests__B006_B006_6.py.snap | 12 - ...flake8_bugbear__tests__B006_B006_7.py.snap | 12 - ...flake8_bugbear__tests__B006_B006_8.py.snap | 49 -- ...ke8_bugbear__tests__B006_B006_B008.py.snap | 233 -------- ...__flake8_bugbear__tests__B007_B007.py.snap | 40 -- ...__flake8_bugbear__tests__B011_B011.py.snap | 17 - ...extend_immutable_calls_arg_annotation.snap | 9 - ...8_comprehensions__tests__C400_C400.py.snap | 73 --- ...8_comprehensions__tests__C401_C401.py.snap | 123 ---- ...8_comprehensions__tests__C402_C402.py.snap | 130 ---- ...8_comprehensions__tests__C403_C403.py.snap | 114 ---- ...8_comprehensions__tests__C404_C404.py.snap | 95 --- ...8_comprehensions__tests__C405_C405.py.snap | 194 ------ ...8_comprehensions__tests__C406_C406.py.snap | 32 - ...8_comprehensions__tests__C408_C408.py.snap | 176 ------ ...low_dict_calls_with_keyword_arguments.snap | 66 --- ...8_comprehensions__tests__C409_C409.py.snap | 113 ---- ...8_comprehensions__tests__C410_C410.py.snap | 57 -- ...8_comprehensions__tests__C411_C411.py.snap | 6 - ...8_comprehensions__tests__C413_C413.py.snap | 116 ---- ...8_comprehensions__tests__C414_C414.py.snap | 240 -------- ...8_comprehensions__tests__C416_C416.py.snap | 68 --- ...8_comprehensions__tests__C417_C417.py.snap | 174 ------ ...8_comprehensions__tests__C418_C418.py.snap | 37 -- ...8_comprehensions__tests__C419_C419.py.snap | 78 --- ...sions__tests__preview__C419_C419_1.py.snap | 49 -- ...__rules__flake8_errmsg__tests__custom.snap | 145 ----- ...rules__flake8_errmsg__tests__defaults.snap | 183 ------ ...02_no_future_import_uses_lowercase.py.snap | 7 - ..._fa102_no_future_import_uses_union.py.snap | 13 - ..._no_future_import_uses_union_inner.py.snap | 13 - ...8_import_conventions__tests__defaults.snap | 131 ---- ..._import_conventions__tests__same_name.snap | 8 - ...ke8_import_conventions__tests__tricky.snap | 12 - ...ake8_logging__tests__LOG001_LOG001.py.snap | 17 - ...ake8_logging__tests__LOG002_LOG002.py.snap | 41 -- ...__flake8_pie__tests__PIE794_PIE794.py.snap | 52 -- ...__flake8_pie__tests__PIE810_PIE810.py.snap | 69 --- ...es__flake8_print__tests__T201_T201.py.snap | 37 -- ...es__flake8_print__tests__T203_T203.py.snap | 17 - ...flake8_pyi__tests__PYI025_PYI025_2.py.snap | 22 - ...lake8_pyi__tests__PYI025_PYI025_2.pyi.snap | 22 - ...flake8_pyi__tests__PYI025_PYI025_3.py.snap | 8 - ...lake8_pyi__tests__PYI025_PYI025_3.pyi.snap | 8 - ...es__flake8_pytest_style__tests__PT003.snap | 81 --- ...flake8_pytest_style__tests__PT006_csv.snap | 20 - ...e8_pytest_style__tests__PT006_default.snap | 100 ---- ...lake8_pytest_style__tests__PT006_list.snap | 80 --- ...est_style__tests__PT007_list_of_lists.snap | 109 ---- ...st_style__tests__PT007_list_of_tuples.snap | 109 ---- ...st_style__tests__PT007_tuple_of_lists.snap | 167 ------ ...t_style__tests__PT007_tuple_of_tuples.snap | 167 ------ ...es__flake8_pytest_style__tests__PT009.snap | 290 --------- ...es__flake8_pytest_style__tests__PT014.snap | 88 --- ...es__flake8_pytest_style__tests__PT018.snap | 177 ------ ...es__flake8_pytest_style__tests__PT026.snap | 20 - ...__flake8_pytest_style__tests__PT027_0.snap | 128 ---- ...__flake8_pytest_style__tests__PT027_1.snap | 9 - ...ry-paren-on-raise-exception_RSE102.py.snap | 18 - ...lake8_return__tests__RET503_RET503.py.snap | 205 ------- ...lake8_return__tests__RET504_RET504.py.snap | 141 ----- ...ke8_simplify__tests__SIM101_SIM101.py.snap | 86 --- ...ke8_simplify__tests__SIM102_SIM102.py.snap | 188 ------ ...ke8_simplify__tests__SIM103_SIM103.py.snap | 123 ---- ...8_simplify__tests__SIM105_SIM105_0.py.snap | 158 ----- ...8_simplify__tests__SIM105_SIM105_1.py.snap | 13 - ...8_simplify__tests__SIM105_SIM105_2.py.snap | 11 - ...8_simplify__tests__SIM105_SIM105_4.py.snap | 9 - ...ke8_simplify__tests__SIM108_SIM108.py.snap | 37 -- ...ke8_simplify__tests__SIM109_SIM109.py.snap | 39 -- ...ke8_simplify__tests__SIM110_SIM110.py.snap | 160 ----- ...ke8_simplify__tests__SIM110_SIM111.py.snap | 160 ----- ...ke8_simplify__tests__SIM112_SIM112.py.snap | 31 - ...ke8_simplify__tests__SIM117_SIM117.py.snap | 180 ------ ...ke8_simplify__tests__SIM118_SIM118.py.snap | 30 - ...ke8_simplify__tests__SIM210_SIM210.py.snap | 36 -- ...ke8_simplify__tests__SIM211_SIM211.py.snap | 26 - ...ke8_simplify__tests__SIM212_SIM212.py.snap | 17 - ...ke8_simplify__tests__SIM220_SIM220.py.snap | 28 - ...ke8_simplify__tests__SIM221_SIM221.py.snap | 28 - ...ke8_simplify__tests__SIM222_SIM222.py.snap | 516 ---------------- ...ke8_simplify__tests__SIM223_SIM223.py.snap | 496 ---------------- ...ke8_simplify__tests__SIM401_SIM401.py.snap | 99 ---- ...ts__tests__ban_parent_imports_package.snap | 57 -- ..._type_checking__tests__exempt_modules.snap | 17 - ...ke8_type_checking__tests__import_from.snap | 18 - ...ests__import_from_type_checking_block.snap | 17 - ...ype_checking__tests__multiple_members.snap | 37 -- ...sts__multiple_modules_different_types.snap | 27 - ...ng__tests__multiple_modules_same_type.snap | 25 - ...ype_checking__tests__no_typing_import.snap | 14 - ...mport-in-type-checking-block_quote.py.snap | 11 - ...ping-only-third-party-import_quote.py.snap | 257 -------- ...rt-in-type-checking-block_TCH004_1.py.snap | 10 - ...t-in-type-checking-block_TCH004_11.py.snap | 11 - ...t-in-type-checking-block_TCH004_12.py.snap | 13 - ...t-in-type-checking-block_TCH004_17.py.snap | 14 - ...rt-in-type-checking-block_TCH004_2.py.snap | 12 - ...rt-in-type-checking-block_TCH004_4.py.snap | 12 - ...rt-in-type-checking-block_TCH004_5.py.snap | 34 -- ...rt-in-type-checking-block_TCH004_9.py.snap | 23 - ...mport-in-type-checking-block_quote.py.snap | 16 - ...k_runtime_evaluated_base_classes_1.py.snap | 41 -- ...ock_runtime_evaluated_decorators_1.py.snap | 41 -- ...y-standard-library-import_init_var.py.snap | 29 - ...ing-only-third-party-import_strict.py.snap | 146 ----- ...ests__type_checking_block_after_usage.snap | 14 - ...g__tests__type_checking_block_comment.snap | 14 - ...ng__tests__type_checking_block_inline.snap | 13 - ...__tests__type_checking_block_own_line.snap | 13 - ...ing-only-first-party-import_TCH001.py.snap | 21 - ...nly-standard-library-import_TCH003.py.snap | 17 - ...rary-import_exempt_type_checking_1.py.snap | 13 - ...rary-import_exempt_type_checking_2.py.snap | 13 - ...rary-import_exempt_type_checking_3.py.snap | 14 - ...y-standard-library-import_init_var.py.snap | 14 - ...d-library-import_module__undefined.py.snap | 13 - ...t_runtime_evaluated_base_classes_3.py.snap | 17 - ...ort_runtime_evaluated_decorators_3.py.snap | 19 - ...ing-only-third-party-import_TCH002.py.snap | 159 ----- ...t_runtime_evaluated_base_classes_2.py.snap | 34 -- ...ort_runtime_evaluated_decorators_2.py.snap | 14 - ...-third-party-import_singledispatch.py.snap | 13 - ...ing-only-third-party-import_strict.py.snap | 37 -- ...hird-party-import_typing_modules_1.py.snap | 16 - ...hird-party-import_typing_modules_2.py.snap | 14 - ...s__typing_import_after_package_import.snap | 15 - ...__typing_import_before_package_import.snap | 13 - ...rules__flynt__tests__FLY002_FLY002.py.snap | 68 --- ...__tests__numpy2-deprecation_NPY201.py.snap | 15 - ...tests__numpy2-deprecation_NPY201_2.py.snap | 10 - ...tests__numpy2-deprecation_NPY201_3.py.snap | 15 - ...es__pandas_vet__tests__PD002_PD002.py.snap | 73 --- ..._rules__pandas_vet__tests__PD002_fail.snap | 8 - ...les__pep8_naming__tests__N804_N804.py.snap | 57 -- ...les__pep8_naming__tests__N805_N805.py.snap | 126 ---- ...naming__tests__classmethod_decorators.snap | 96 --- ...ing__tests__ignore_names_N804_N804.py.snap | 49 -- ...ing__tests__ignore_names_N805_N805.py.snap | 80 --- ...aming__tests__staticmethod_decorators.snap | 116 ---- ...__perflint__tests__PERF102_PERF102.py.snap | 119 ---- ...les__pycodestyle__tests__E711_E711.py.snap | 99 ---- ...les__pycodestyle__tests__E712_E712.py.snap | 129 ---- ...les__pycodestyle__tests__E731_E731.py.snap | 200 ------- ...les__pycodestyle__tests__W291_W291.py.snap | 17 - ...les__pycodestyle__tests__W293_W293.py.snap | 19 - ...pycodestyle__tests__constant_literals.snap | 40 -- ...__rules__pydocstyle__tests__D200_D.py.snap | 36 -- ...ules__pydocstyle__tests__D200_D200.py.snap | 11 - ...__rules__pydocstyle__tests__D301_D.py.snap | 11 - ...ules__pydocstyle__tests__D301_D301.py.snap | 28 - ...__rules__pydocstyle__tests__D400_D.py.snap | 171 ------ ...ules__pydocstyle__tests__D400_D400.py.snap | 129 ---- ...__rules__pydocstyle__tests__D415_D.py.snap | 161 ----- ...__rules__pydocstyle__tests__d209_d400.snap | 7 - ...eprecated_option_F401_24____init__.py.snap | 25 - ...on_F401_25__all_nonempty____init__.py.snap | 28 - ...ption_F401_26__all_empty____init__.py.snap | 19 - ...on_F401_27__all_mistyped____init__.py.snap | 19 - ...on_F401_28__all_multiple____init__.py.snap | 19 - ...F401_29__all_conditional____init__.py.snap | 21 - ..._rules__pyflakes__tests__F601_F601.py.snap | 73 --- ..._rules__pyflakes__tests__F602_F602.py.snap | 52 -- ...ules__pyflakes__tests__F841_F841_0.py.snap | 98 --- ...ules__pyflakes__tests__F841_F841_1.py.snap | 69 --- ...ules__pyflakes__tests__F841_F841_3.py.snap | 304 ---------- ...ules__pyflakes__tests__F841_F841_4.py.snap | 11 - ...lakes__tests__f841_dummy_variable_rgx.snap | 95 --- ...s__preview__F401_F401_24____init__.py.snap | 9 - ...01_F401_25__all_nonempty____init__.py.snap | 9 - ...kes__tests__preview__F401___init__.py.snap | 7 - ...lakes__tests__preview__F841_F841_4.py.snap | 31 - ...grep_hooks__tests__PGH004_PGH004_0.py.snap | 48 -- ...nt__tests__PLC0414_import_aliasing.py.snap | 81 --- ...s__PLC2801_unnecessary_dunder_call.py.snap | 510 ---------------- ...sts__PLE1519_singledispatch_method.py.snap | 31 - ...1520_singledispatchmethod_function.py.snap | 12 - ...ts__PLE4703_modified_iterating_set.py.snap | 61 -- ...R1714_repeated_equality_comparison.py.snap | 178 ------ ...t__tests__PLR1722_sys_exit_alias_0.py.snap | 40 -- ...t__tests__PLR1722_sys_exit_alias_1.py.snap | 39 -- ...__tests__PLR1722_sys_exit_alias_11.py.snap | 8 - ...__tests__PLR1722_sys_exit_alias_12.py.snap | 8 - ...t__tests__PLR1722_sys_exit_alias_2.py.snap | 35 -- ...t__tests__PLR1722_sys_exit_alias_3.py.snap | 20 - ...t__tests__PLR1722_sys_exit_alias_4.py.snap | 35 -- ...t__tests__PLR1722_sys_exit_alias_5.py.snap | 48 -- ...t__tests__PLR1722_sys_exit_alias_6.py.snap | 18 - ...t__tests__PLR1722_sys_exit_alias_7.py.snap | 10 - ...t__tests__PLR1722_sys_exit_alias_8.py.snap | 8 - ...t__tests__PLR1722_sys_exit_alias_9.py.snap | 10 - ...__PLR6104_non_augmented_assignment.py.snap | 261 -------- ..._tests__PLR6201_literal_membership.py.snap | 41 -- ..._tests__PLW0108_unnecessary_lambda.py.snap | 76 --- ...LW0133_useless_exception_statement.py.snap | 111 ---- ...W1510_subprocess_run_without_check.py.snap | 11 - ...ests__PLW1514_unspecified_encoding.py.snap | 211 ------- ...int__tests__PLW3301_nested_min_max.py.snap | 144 ----- ...er__rules__pyupgrade__tests__UP008.py.snap | 64 -- ...er__rules__pyupgrade__tests__UP022.py.snap | 74 --- ...__rules__pyupgrade__tests__UP028_0.py.snap | 150 ----- ...er__rules__pyupgrade__tests__UP029.py.snap | 34 -- ...__rules__pyupgrade__tests__UP030_0.py.snap | 234 -------- ...__rules__pyupgrade__tests__UP031_0.py.snap | 560 ------------------ ...__rules__pyupgrade__tests__UP036_0.py.snap | 439 -------------- ...__rules__pyupgrade__tests__UP036_1.py.snap | 152 ----- ...__rules__pyupgrade__tests__UP036_2.py.snap | 149 ----- ...__rules__pyupgrade__tests__UP036_3.py.snap | 46 -- ...__rules__pyupgrade__tests__UP036_4.py.snap | 87 --- ...__rules__pyupgrade__tests__UP036_5.py.snap | 46 -- ...er__rules__pyupgrade__tests__UP038.py.snap | 16 - ...er__rules__pyupgrade__tests__UP040.py.snap | 120 ---- ...er__rules__pyupgrade__tests__UP042.py.snap | 25 - ...tests__future_annotations_pep_585_p37.snap | 11 - ...tests__future_annotations_pep_604_p37.snap | 10 - ...es__refurb__tests__FURB110_FURB110.py.snap | 10 - ...es__refurb__tests__FURB113_FURB113.py.snap | 133 ----- ...es__refurb__tests__FURB129_FURB129.py.snap | 121 ---- ...es__refurb__tests__FURB131_FURB131.py.snap | 81 --- ...es__refurb__tests__FURB132_FURB132.py.snap | 45 -- ...es__refurb__tests__FURB148_FURB148.py.snap | 201 ------- ...es__refurb__tests__FURB166_FURB166.py.snap | 70 --- ...es__refurb__tests__FURB181_FURB181.py.snap | 151 ----- ...es__refurb__tests__FURB187_FURB187.py.snap | 31 - ...es__refurb__tests__FURB192_FURB192.py.snap | 31 - ..._ruff__tests__PY39_RUF013_RUF013_0.py.snap | 191 ------ ..._ruff__tests__PY39_RUF013_RUF013_1.py.snap | 10 - ..._rules__ruff__tests__RUF005_RUF005.py.snap | 152 ----- ...ules__ruff__tests__RUF013_RUF013_0.py.snap | 191 ------ ...ules__ruff__tests__RUF013_RUF013_1.py.snap | 9 - ...ules__ruff__tests__RUF013_RUF013_3.py.snap | 29 - ..._rules__ruff__tests__RUF015_RUF015.py.snap | 235 -------- ...ules__ruff__tests__RUF017_RUF017_0.py.snap | 99 ---- ...ules__ruff__tests__RUF017_RUF017_1.py.snap | 7 - ..._rules__ruff__tests__RUF024_RUF024.py.snap | 71 --- ..._rules__ruff__tests__RUF026_RUF026.py.snap | 143 ----- ...ules__ruff__tests__RUF027_RUF027_0.py.snap | 158 ----- ..._rules__ruff__tests__RUF028_RUF028.py.snap | 101 ---- ..._rules__ruff__tests__RUF030_RUF030.py.snap | 188 ------ ...ruff_linter__rules__ruff__tests__noqa.snap | 8 - ..._linter__rules__ruff__tests__ruf100_0.snap | 18 - ...__rules__ruff__tests__ruf100_0_prefix.snap | 18 - ..._linter__rules__ruff__tests__ruf100_5.snap | 15 - ...__rules__ruff__tests__ruff_noqa_codes.snap | 8 - ...rules__ruff__tests__ruff_noqa_invalid.snap | 8 - ..._error-instead-of-exception_TRY400.py.snap | 60 -- ...atops__tests__verbose-raise_TRY201.py.snap | 28 - ...inter__linter__tests__unused_variable.snap | 33 -- 268 files changed, 14 insertions(+), 20942 deletions(-) diff --git a/crates/ruff/tests/integration_test.rs b/crates/ruff/tests/integration_test.rs index 4e090b880ab67..02c93149486f3 100644 --- a/crates/ruff/tests/integration_test.rs +++ b/crates/ruff/tests/integration_test.rs @@ -1576,9 +1576,6 @@ fn check_hints_hidden_unsafe_fixes() { Run `ruff check --fix` to apply this fix. -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. - 1 |+# fix from stable-test-rule-unsafe-fix - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. Found 2 errors. [*] 1 fixable with the `--fix` option (1 hidden fix can be enabled with the `--unsafe-fixes` option). @@ -1597,10 +1594,6 @@ fn check_hints_hidden_unsafe_fixes_with_no_safe_fixes() { exit_code: 1 ----- stdout ----- -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. - 1 |+# fix from stable-test-rule-unsafe-fix - 1 2 | x = {'a': 1, 'a': 1} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. Found 1 error. No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option). @@ -1625,9 +1618,6 @@ fn check_no_hint_for_hidden_unsafe_fixes_when_disabled() { Run `ruff check --fix` to apply this fix. -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. - 1 |+# fix from stable-test-rule-unsafe-fix - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. Found 2 errors. [*] 1 fixable with the --fix option. @@ -1648,10 +1638,6 @@ fn check_no_hint_for_hidden_unsafe_fixes_with_no_safe_fixes_when_disabled() { exit_code: 1 ----- stdout ----- -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. - 1 |+# fix from stable-test-rule-unsafe-fix - 1 2 | x = {'a': 1, 'a': 1} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. Found 1 error. @@ -1675,9 +1661,6 @@ fn check_shows_unsafe_fixes_with_opt_in() { Run `ruff check --fix` to apply this fix. -:1:1: RUF902 [*] Hey this is a stable test rule with an unsafe fix. - 1 |+# fix from stable-test-rule-unsafe-fix - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. Found 2 errors. [*] 2 fixable with the --fix option. @@ -1700,10 +1683,6 @@ fn fix_applies_safe_fixes_by_default() { ----- stderr ----- -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. - 1 |+# fix from stable-test-rule-unsafe-fix - 1 2 | # fix from stable-test-rule-safe-fix - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. Found 2 errors (1 fixed, 1 remaining). No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option). @@ -1742,10 +1721,6 @@ fn fix_does_not_apply_display_only_fixes() { def add_to_list(item, some_list=[]): ... ----- stderr ----- -:1:1: RUF903 Hey this is a stable test rule with a display only fix. - 1 |+# fix from stable-test-rule-display-only-fix - 1 2 | def add_to_list(item, some_list=[]): ... - - Ruff cannot safely apply this fix. Found 1 error. "###); @@ -1765,10 +1740,6 @@ fn fix_does_not_apply_display_only_fixes_with_unsafe_fixes_enabled() { def add_to_list(item, some_list=[]): ... ----- stderr ----- -:1:1: RUF903 Hey this is a stable test rule with a display only fix. - 1 |+# fix from stable-test-rule-display-only-fix - 1 2 | def add_to_list(item, some_list=[]): ... - - Ruff cannot safely apply this fix. Found 1 error. "###); @@ -1787,9 +1758,6 @@ fn fix_only_unsafe_fixes_available() { ----- stderr ----- -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. - 1 |+# fix from stable-test-rule-unsafe-fix - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. Found 1 error. No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option). @@ -1927,14 +1895,8 @@ extend-unsafe-fixes = ["RUF901"] exit_code: 1 ----- stdout ----- -:1:1: RUF901 Hey this is a stable test rule with a safe fix. - 1 |+# fix from stable-test-rule-safe-fix - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. - 1 |+# fix from stable-test-rule-unsafe-fix - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. Found 2 errors. No fixes available (2 hidden fixes can be enabled with the `--unsafe-fixes` option). @@ -2014,9 +1976,6 @@ extend-safe-fixes = ["RUF902"] Run `ruff check --fix` to apply this fix. -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. - 1 |+# fix from stable-test-rule-unsafe-fix - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. Found 2 errors. [*] 1 fixable with the `--fix` option (1 hidden fix can be enabled with the `--unsafe-fixes` option). @@ -2054,12 +2013,6 @@ extend-safe-fixes = ["RUF9"] ----- stdout ----- -:1:1: RUF900 Hey this is a stable test rule. -:1:1: RUF901 Hey this is a stable test rule with a safe fix. - 1 |+# fix from stable-test-rule-safe-fix - 1 2 | x = {'a': 1, 'a': 1} - 2 3 | print(('foo')) - 3 4 | print(str('foo')) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. -:1:1: RUF902 [*] Hey this is a stable test rule with an unsafe fix. 1 |+# fix from stable-test-rule-unsafe-fix @@ -2070,12 +2023,6 @@ extend-safe-fixes = ["RUF9"] Run `ruff check --fix` to apply this fix. -:1:1: RUF903 Hey this is a stable test rule with a display only fix. - 1 |+# fix from stable-test-rule-display-only-fix - 1 2 | x = {'a': 1, 'a': 1} - 2 3 | print(('foo')) - 3 4 | print(str('foo')) - - Ruff cannot safely apply this fix. -:1:1: RUF920 Hey this is a deprecated test rule. -:1:1: RUF921 Hey this is another deprecated test rule. @@ -2185,14 +2132,6 @@ select = ["RUF017"] | = help: Replace with `functools.reduce` - 1 |+import functools - 2 |+import operator - 1 3 | x = [1, 2, 3] - 2 4 | y = [4, 5, 6] - 3 |-sum([x, y], []) - 5 |+functools.reduce(operator.iadd, [x, y], []) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. Found 1 error. No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option). diff --git a/crates/ruff_linter/src/message/diff.rs b/crates/ruff_linter/src/message/diff.rs index 468ddf72d1aad..bc1492b04ceee 100644 --- a/crates/ruff_linter/src/message/diff.rs +++ b/crates/ruff_linter/src/message/diff.rs @@ -36,6 +36,16 @@ impl<'a> Diff<'a> { impl Display for Diff<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + // TODO: Instead of hard-coding this in, the `TextEmitter` should be + // handling it. See https://github.com/astral-sh/ruff/issues/12597 for + // further discussion. + if matches!( + self.fix.applicability(), + Applicability::Unsafe | Applicability::DisplayOnly + ) { + return Ok(()); + } + // TODO(dhruvmanila): Add support for Notebook cells once it's user-facing let mut output = String::with_capacity(self.source_code.source_text().len()); let mut last_end = TextSize::default(); @@ -108,14 +118,11 @@ impl Display for Diff<'_> { } } - let action_message = match self.fix.applicability() { - Applicability::Safe => "Run `ruff check --fix` to apply this fix.", - Applicability::Unsafe => { - "Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix." - } - Applicability::DisplayOnly => "Ruff cannot safely apply this fix.", + // TODO: https://github.com/astral-sh/ruff/issues/12598 + match self.fix.applicability() { + Applicability::Safe => writeln!(f, "\n Run `ruff check --fix` to apply this fix.")?, + Applicability::Unsafe | Applicability::DisplayOnly => {} }; - writeln!(f, "\n {action_message}")?; Ok(()) } diff --git a/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap b/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap index 72a77e4727d46..b239a923143df 100644 --- a/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap +++ b/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap @@ -10,12 +10,6 @@ ERA001.py:1:1: ERA001 Found commented-out code | = help: Remove commented-out code -1 |-#import os -2 1 | # from foo import junk -3 2 | #a = 3 -4 3 | a = 4 - - Ruff cannot safely apply this fix. ERA001.py:2:1: ERA001 Found commented-out code | @@ -27,13 +21,6 @@ ERA001.py:2:1: ERA001 Found commented-out code | = help: Remove commented-out code -1 1 | #import os -2 |-# from foo import junk -3 2 | #a = 3 -4 3 | a = 4 -5 4 | #foo(1, 2, 3) - - Ruff cannot safely apply this fix. ERA001.py:3:1: ERA001 Found commented-out code | @@ -46,14 +33,6 @@ ERA001.py:3:1: ERA001 Found commented-out code | = help: Remove commented-out code -1 1 | #import os -2 2 | # from foo import junk -3 |-#a = 3 -4 3 | a = 4 -5 4 | #foo(1, 2, 3) -6 5 | - - Ruff cannot safely apply this fix. ERA001.py:5:1: ERA001 Found commented-out code | @@ -66,15 +45,6 @@ ERA001.py:5:1: ERA001 Found commented-out code | = help: Remove commented-out code -2 2 | # from foo import junk -3 3 | #a = 3 -4 4 | a = 4 -5 |-#foo(1, 2, 3) -6 5 | -7 6 | def foo(x, y, z): -8 7 | content = 1 # print('hello') - - Ruff cannot safely apply this fix. ERA001.py:13:5: ERA001 Found commented-out code | @@ -86,15 +56,6 @@ ERA001.py:13:5: ERA001 Found commented-out code | = help: Remove commented-out code -10 10 | -11 11 | # This is a real comment. -12 12 | # # This is a (nested) comment. -13 |- #return True -14 13 | return False -15 14 | -16 15 | #import os # noqa: ERA001 - - Ruff cannot safely apply this fix. ERA001.py:21:5: ERA001 Found commented-out code | @@ -105,15 +66,6 @@ ERA001.py:21:5: ERA001 Found commented-out code | = help: Remove commented-out code -18 18 | -19 19 | class A(): -20 20 | pass -21 |- # b = c -22 21 | -23 22 | -24 23 | dictionary = { - - Ruff cannot safely apply this fix. ERA001.py:26:5: ERA001 Found commented-out code | @@ -126,15 +78,6 @@ ERA001.py:26:5: ERA001 Found commented-out code | = help: Remove commented-out code -23 23 | -24 24 | dictionary = { -25 25 | # "key1": 123, # noqa: ERA001 -26 |- # "key2": 456, -27 26 | # "key3": 789, # test -28 27 | } -29 28 | - - Ruff cannot safely apply this fix. ERA001.py:27:5: ERA001 Found commented-out code | @@ -146,15 +89,6 @@ ERA001.py:27:5: ERA001 Found commented-out code | = help: Remove commented-out code -24 24 | dictionary = { -25 25 | # "key1": 123, # noqa: ERA001 -26 26 | # "key2": 456, -27 |- # "key3": 789, # test -28 27 | } -29 28 | -30 29 | #import os # noqa - - Ruff cannot safely apply this fix. ERA001.py:32:1: ERA001 Found commented-out code | @@ -167,15 +101,6 @@ ERA001.py:32:1: ERA001 Found commented-out code | = help: Remove commented-out code -29 29 | -30 30 | #import os # noqa -31 31 | -32 |-# case 1: -33 32 | # try: -34 33 | # try: # with comment -35 34 | # try: print() - - Ruff cannot safely apply this fix. ERA001.py:33:1: ERA001 Found commented-out code | @@ -187,15 +112,6 @@ ERA001.py:33:1: ERA001 Found commented-out code | = help: Remove commented-out code -30 30 | #import os # noqa -31 31 | -32 32 | # case 1: -33 |-# try: -34 33 | # try: # with comment -35 34 | # try: print() -36 35 | # except: - - Ruff cannot safely apply this fix. ERA001.py:34:1: ERA001 Found commented-out code | @@ -208,15 +124,6 @@ ERA001.py:34:1: ERA001 Found commented-out code | = help: Remove commented-out code -31 31 | -32 32 | # case 1: -33 33 | # try: -34 |-# try: # with comment -35 34 | # try: print() -36 35 | # except: -37 36 | # except Foo: - - Ruff cannot safely apply this fix. ERA001.py:35:1: ERA001 Found commented-out code | @@ -229,15 +136,6 @@ ERA001.py:35:1: ERA001 Found commented-out code | = help: Remove commented-out code -32 32 | # case 1: -33 33 | # try: -34 34 | # try: # with comment -35 |-# try: print() -36 35 | # except: -37 36 | # except Foo: -38 37 | # except Exception as e: print(e) - - Ruff cannot safely apply this fix. ERA001.py:36:1: ERA001 Found commented-out code | @@ -250,15 +148,6 @@ ERA001.py:36:1: ERA001 Found commented-out code | = help: Remove commented-out code -33 33 | # try: -34 34 | # try: # with comment -35 35 | # try: print() -36 |-# except: -37 36 | # except Foo: -38 37 | # except Exception as e: print(e) -39 38 | - - Ruff cannot safely apply this fix. ERA001.py:37:1: ERA001 Found commented-out code | @@ -270,15 +159,6 @@ ERA001.py:37:1: ERA001 Found commented-out code | = help: Remove commented-out code -34 34 | # try: # with comment -35 35 | # try: print() -36 36 | # except: -37 |-# except Foo: -38 37 | # except Exception as e: print(e) -39 38 | -40 39 | - - Ruff cannot safely apply this fix. ERA001.py:38:1: ERA001 Found commented-out code | @@ -289,15 +169,6 @@ ERA001.py:38:1: ERA001 Found commented-out code | = help: Remove commented-out code -35 35 | # try: print() -36 36 | # except: -37 37 | # except Foo: -38 |-# except Exception as e: print(e) -39 38 | -40 39 | -41 40 | # Script tag without an opening tag (Error) - - Ruff cannot safely apply this fix. ERA001.py:44:1: ERA001 Found commented-out code | @@ -309,15 +180,6 @@ ERA001.py:44:1: ERA001 Found commented-out code | = help: Remove commented-out code -41 41 | # Script tag without an opening tag (Error) -42 42 | -43 43 | # requires-python = ">=3.11" -44 |-# dependencies = [ -45 44 | # "requests<3", -46 45 | # "rich", -47 46 | # ] - - Ruff cannot safely apply this fix. ERA001.py:47:1: ERA001 Found commented-out code | @@ -328,13 +190,3 @@ ERA001.py:47:1: ERA001 Found commented-out code 48 | # /// | = help: Remove commented-out code - -44 44 | # dependencies = [ -45 45 | # "requests<3", -46 46 | # "rich", -47 |-# ] -48 47 | # /// -49 48 | -50 49 | # Script tag (OK) - - Ruff cannot safely apply this fix. diff --git a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-non-annotated-dependency_FAST002.py.snap b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-non-annotated-dependency_FAST002.py.snap index 48096f737d59a..56f0b57549cb1 100644 --- a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-non-annotated-dependency_FAST002.py.snap +++ b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-non-annotated-dependency_FAST002.py.snap @@ -12,24 +12,6 @@ FAST002.py:24:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -12 12 | Security, -13 13 | ) -14 14 | from pydantic import BaseModel - 15 |+from typing import Annotated -15 16 | -16 17 | app = FastAPI() -17 18 | router = APIRouter() --------------------------------------------------------------------------------- -21 22 | -22 23 | @app.get("/items/") -23 24 | def get_items( -24 |- current_user: User = Depends(get_current_user), - 25 |+ current_user: Annotated[User, Depends(get_current_user)], -25 26 | some_security_param: str = Security(get_oauth2_user), -26 27 | ): -27 28 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FAST002.py:25:5: FAST002 [*] FastAPI dependency without `Annotated` | @@ -42,24 +24,6 @@ FAST002.py:25:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -12 12 | Security, -13 13 | ) -14 14 | from pydantic import BaseModel - 15 |+from typing import Annotated -15 16 | -16 17 | app = FastAPI() -17 18 | router = APIRouter() --------------------------------------------------------------------------------- -22 23 | @app.get("/items/") -23 24 | def get_items( -24 25 | current_user: User = Depends(get_current_user), -25 |- some_security_param: str = Security(get_oauth2_user), - 26 |+ some_security_param: Annotated[str, Security(get_oauth2_user)], -26 27 | ): -27 28 | pass -28 29 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FAST002.py:32:5: FAST002 [*] FastAPI dependency without `Annotated` | @@ -72,24 +36,6 @@ FAST002.py:32:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -12 12 | Security, -13 13 | ) -14 14 | from pydantic import BaseModel - 15 |+from typing import Annotated -15 16 | -16 17 | app = FastAPI() -17 18 | router = APIRouter() --------------------------------------------------------------------------------- -29 30 | -30 31 | @app.post("/stuff/") -31 32 | def do_stuff( -32 |- some_query_param: str | None = Query(default=None), - 33 |+ some_query_param: Annotated[str | None, Query(default=None)], -33 34 | some_path_param: str = Path(), -34 35 | some_body_param: str = Body("foo"), -35 36 | some_cookie_param: str = Cookie(), - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FAST002.py:33:5: FAST002 [*] FastAPI dependency without `Annotated` | @@ -102,24 +48,6 @@ FAST002.py:33:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -12 12 | Security, -13 13 | ) -14 14 | from pydantic import BaseModel - 15 |+from typing import Annotated -15 16 | -16 17 | app = FastAPI() -17 18 | router = APIRouter() --------------------------------------------------------------------------------- -30 31 | @app.post("/stuff/") -31 32 | def do_stuff( -32 33 | some_query_param: str | None = Query(default=None), -33 |- some_path_param: str = Path(), - 34 |+ some_path_param: Annotated[str, Path()], -34 35 | some_body_param: str = Body("foo"), -35 36 | some_cookie_param: str = Cookie(), -36 37 | some_header_param: int = Header(default=5), - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FAST002.py:34:5: FAST002 [*] FastAPI dependency without `Annotated` | @@ -132,24 +60,6 @@ FAST002.py:34:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -12 12 | Security, -13 13 | ) -14 14 | from pydantic import BaseModel - 15 |+from typing import Annotated -15 16 | -16 17 | app = FastAPI() -17 18 | router = APIRouter() --------------------------------------------------------------------------------- -31 32 | def do_stuff( -32 33 | some_query_param: str | None = Query(default=None), -33 34 | some_path_param: str = Path(), -34 |- some_body_param: str = Body("foo"), - 35 |+ some_body_param: Annotated[str, Body("foo")], -35 36 | some_cookie_param: str = Cookie(), -36 37 | some_header_param: int = Header(default=5), -37 38 | some_file_param: UploadFile = File(), - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FAST002.py:35:5: FAST002 [*] FastAPI dependency without `Annotated` | @@ -162,24 +72,6 @@ FAST002.py:35:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -12 12 | Security, -13 13 | ) -14 14 | from pydantic import BaseModel - 15 |+from typing import Annotated -15 16 | -16 17 | app = FastAPI() -17 18 | router = APIRouter() --------------------------------------------------------------------------------- -32 33 | some_query_param: str | None = Query(default=None), -33 34 | some_path_param: str = Path(), -34 35 | some_body_param: str = Body("foo"), -35 |- some_cookie_param: str = Cookie(), - 36 |+ some_cookie_param: Annotated[str, Cookie()], -36 37 | some_header_param: int = Header(default=5), -37 38 | some_file_param: UploadFile = File(), -38 39 | some_form_param: str = Form(), - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FAST002.py:36:5: FAST002 [*] FastAPI dependency without `Annotated` | @@ -192,24 +84,6 @@ FAST002.py:36:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -12 12 | Security, -13 13 | ) -14 14 | from pydantic import BaseModel - 15 |+from typing import Annotated -15 16 | -16 17 | app = FastAPI() -17 18 | router = APIRouter() --------------------------------------------------------------------------------- -33 34 | some_path_param: str = Path(), -34 35 | some_body_param: str = Body("foo"), -35 36 | some_cookie_param: str = Cookie(), -36 |- some_header_param: int = Header(default=5), - 37 |+ some_header_param: Annotated[int, Header(default=5)], -37 38 | some_file_param: UploadFile = File(), -38 39 | some_form_param: str = Form(), -39 40 | ): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FAST002.py:37:5: FAST002 [*] FastAPI dependency without `Annotated` | @@ -222,24 +96,6 @@ FAST002.py:37:5: FAST002 [*] FastAPI dependency without `Annotated` | = help: Replace with `Annotated` -12 12 | Security, -13 13 | ) -14 14 | from pydantic import BaseModel - 15 |+from typing import Annotated -15 16 | -16 17 | app = FastAPI() -17 18 | router = APIRouter() --------------------------------------------------------------------------------- -34 35 | some_body_param: str = Body("foo"), -35 36 | some_cookie_param: str = Cookie(), -36 37 | some_header_param: int = Header(default=5), -37 |- some_file_param: UploadFile = File(), - 38 |+ some_file_param: Annotated[UploadFile, File()], -38 39 | some_form_param: str = Form(), -39 40 | ): -40 41 | # do stuff - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FAST002.py:38:5: FAST002 [*] FastAPI dependency without `Annotated` | @@ -251,22 +107,3 @@ FAST002.py:38:5: FAST002 [*] FastAPI dependency without `Annotated` 40 | # do stuff | = help: Replace with `Annotated` - -12 12 | Security, -13 13 | ) -14 14 | from pydantic import BaseModel - 15 |+from typing import Annotated -15 16 | -16 17 | app = FastAPI() -17 18 | router = APIRouter() --------------------------------------------------------------------------------- -35 36 | some_cookie_param: str = Cookie(), -36 37 | some_header_param: int = Header(default=5), -37 38 | some_file_param: UploadFile = File(), -38 |- some_form_param: str = Form(), - 39 |+ some_form_param: Annotated[str, Form()], -39 40 | ): -40 41 | # do stuff -41 42 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-redundant-response-model_FAST001.py.snap b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-redundant-response-model_FAST001.py.snap index e56838203de37..22fc250cde580 100644 --- a/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-redundant-response-model_FAST001.py.snap +++ b/crates/ruff_linter/src/rules/fastapi/snapshots/ruff_linter__rules__fastapi__tests__fast-api-redundant-response-model_FAST001.py.snap @@ -10,16 +10,6 @@ FAST001.py:17:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -14 14 | # Errors -15 15 | -16 16 | -17 |-@app.post("/items/", response_model=Item) - 17 |+@app.post("/items/") -18 18 | async def create_item(item: Item) -> Item: -19 19 | return item -20 20 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FAST001.py:22:22: FAST001 [*] FastAPI route with redundant `response_model` argument | @@ -30,16 +20,6 @@ FAST001.py:22:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -19 19 | return item -20 20 | -21 21 | -22 |-@app.post("/items/", response_model=list[Item]) - 22 |+@app.post("/items/") -23 23 | async def create_item(item: Item) -> list[Item]: -24 24 | return item -25 25 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FAST001.py:27:22: FAST001 [*] FastAPI route with redundant `response_model` argument | @@ -50,16 +30,6 @@ FAST001.py:27:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -24 24 | return item -25 25 | -26 26 | -27 |-@app.post("/items/", response_model=List[Item]) - 27 |+@app.post("/items/") -28 28 | async def create_item(item: Item) -> List[Item]: -29 29 | return item -30 30 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FAST001.py:32:22: FAST001 [*] FastAPI route with redundant `response_model` argument | @@ -70,16 +40,6 @@ FAST001.py:32:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -29 29 | return item -30 30 | -31 31 | -32 |-@app.post("/items/", response_model=Dict[str, Item]) - 32 |+@app.post("/items/") -33 33 | async def create_item(item: Item) -> Dict[str, Item]: -34 34 | return item -35 35 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FAST001.py:37:22: FAST001 [*] FastAPI route with redundant `response_model` argument | @@ -90,16 +50,6 @@ FAST001.py:37:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -34 34 | return item -35 35 | -36 36 | -37 |-@app.post("/items/", response_model=str) - 37 |+@app.post("/items/") -38 38 | async def create_item(item: Item) -> str: -39 39 | return item -40 40 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FAST001.py:42:21: FAST001 [*] FastAPI route with redundant `response_model` argument | @@ -110,16 +60,6 @@ FAST001.py:42:21: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -39 39 | return item -40 40 | -41 41 | -42 |-@app.get("/items/", response_model=Item) - 42 |+@app.get("/items/") -43 43 | async def create_item(item: Item) -> Item: -44 44 | return item -45 45 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FAST001.py:47:21: FAST001 [*] FastAPI route with redundant `response_model` argument | @@ -130,16 +70,6 @@ FAST001.py:47:21: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -44 44 | return item -45 45 | -46 46 | -47 |-@app.get("/items/", response_model=Item) - 47 |+@app.get("/items/") -48 48 | @app.post("/items/", response_model=Item) -49 49 | async def create_item(item: Item) -> Item: -50 50 | return item - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FAST001.py:48:22: FAST001 [*] FastAPI route with redundant `response_model` argument | @@ -151,16 +81,6 @@ FAST001.py:48:22: FAST001 [*] FastAPI route with redundant `response_model` argu | = help: Remove argument -45 45 | -46 46 | -47 47 | @app.get("/items/", response_model=Item) -48 |-@app.post("/items/", response_model=Item) - 48 |+@app.post("/items/") -49 49 | async def create_item(item: Item) -> Item: -50 50 | return item -51 51 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FAST001.py:53:24: FAST001 [*] FastAPI route with redundant `response_model` argument | @@ -170,14 +90,3 @@ FAST001.py:53:24: FAST001 [*] FastAPI route with redundant `response_model` argu 55 | return item | = help: Remove argument - -50 50 | return item -51 51 | -52 52 | -53 |-@router.get("/items/", response_model=Item) - 53 |+@router.get("/items/") -54 54 | async def create_item(item: Item) -> Item: -55 55 | return item -56 56 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type.snap index f3aec4ea80cba..18467e0cf9ebd 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type.snap @@ -9,13 +9,6 @@ auto_return_type.py:1:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `int` -1 |-def func(): - 1 |+def func() -> int: -2 2 | return 1 -3 3 | -4 4 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:5:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -25,16 +18,6 @@ auto_return_type.py:5:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `float` -2 2 | return 1 -3 3 | -4 4 | -5 |-def func(): - 5 |+def func() -> float: -6 6 | return 1.5 -7 7 | -8 8 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:9:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -45,16 +28,6 @@ auto_return_type.py:9:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `float` -6 6 | return 1.5 -7 7 | -8 8 | -9 |-def func(x: int): - 9 |+def func(x: int) -> float: -10 10 | if x > 0: -11 11 | return 1 -12 12 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:16:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -64,16 +37,6 @@ auto_return_type.py:16:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `bool` -13 13 | return 1.5 -14 14 | -15 15 | -16 |-def func(): - 16 |+def func() -> bool: -17 17 | return True -18 18 | -19 19 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:20:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -84,16 +47,6 @@ auto_return_type.py:20:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `None` -17 17 | return True -18 18 | -19 19 | -20 |-def func(x: int): - 20 |+def func(x: int) -> None: -21 21 | if x > 0: -22 22 | return None -23 23 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:27:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -103,16 +56,6 @@ auto_return_type.py:27:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `str | float` -24 24 | return -25 25 | -26 26 | -27 |-def func(x: int): - 27 |+def func(x: int) -> str | float: -28 28 | return 1 or 2.5 if x > 0 else 1.5 or "str" -29 29 | -30 30 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:31:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -122,16 +65,6 @@ auto_return_type.py:31:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `str | float` -28 28 | return 1 or 2.5 if x > 0 else 1.5 or "str" -29 29 | -30 30 | -31 |-def func(x: int): - 31 |+def func(x: int) -> str | float: -32 32 | return 1 + 2.5 if x > 0 else 1.5 or "str" -33 33 | -34 34 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:35:5: ANN201 Missing return type annotation for public function `func` | @@ -159,16 +92,6 @@ auto_return_type.py:45:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int` -42 42 | return {"foo": 1} -43 43 | -44 44 | -45 |-def func(x: int): - 45 |+def func(x: int) -> int: -46 46 | if not x: -47 47 | return 1 -48 48 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:52:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -179,16 +102,6 @@ auto_return_type.py:52:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int | None` -49 49 | return True -50 50 | -51 51 | -52 |-def func(x: int): - 52 |+def func(x: int) -> int | None: -53 53 | if not x: -54 54 | return 1 -55 55 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:59:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -199,16 +112,6 @@ auto_return_type.py:59:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `str | int | None` -56 56 | return None -57 57 | -58 58 | -59 |-def func(x: int): - 59 |+def func(x: int) -> str | int | None: -60 60 | if not x: -61 61 | return 1 -62 62 | elif x > 5: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:68:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -219,16 +122,6 @@ auto_return_type.py:68:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int | None` -65 65 | return None -66 66 | -67 67 | -68 |-def func(x: int): - 68 |+def func(x: int) -> int | None: -69 69 | if x: -70 70 | return 1 -71 71 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:73:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -238,16 +131,6 @@ auto_return_type.py:73:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `None` -70 70 | return 1 -71 71 | -72 72 | -73 |-def func(): - 73 |+def func() -> None: -74 74 | x = 1 -75 75 | -76 76 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:77:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -258,16 +141,6 @@ auto_return_type.py:77:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int | None` -74 74 | x = 1 -75 75 | -76 76 | -77 |-def func(x: int): - 77 |+def func(x: int) -> int | None: -78 78 | if x > 0: -79 79 | return 1 -80 80 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:82:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -278,16 +151,6 @@ auto_return_type.py:82:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `str | int | None` -79 79 | return 1 -80 80 | -81 81 | -82 |-def func(x: int): - 82 |+def func(x: int) -> str | int | None: -83 83 | match x: -84 84 | case [1, 2, 3]: -85 85 | return 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:90:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -298,16 +161,6 @@ auto_return_type.py:90:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int | None` -87 87 | return "foo" -88 88 | -89 89 | -90 |-def func(x: int): - 90 |+def func(x: int) -> int | None: -91 91 | for i in range(5): -92 92 | if i > 0: -93 93 | return 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:96:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -318,16 +171,6 @@ auto_return_type.py:96:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int` -93 93 | return 1 -94 94 | -95 95 | -96 |-def func(x: int): - 96 |+def func(x: int) -> int: -97 97 | for i in range(5): -98 98 | if i > 0: -99 99 | return 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:104:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -338,16 +181,6 @@ auto_return_type.py:104:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -101 101 | return 4 -102 102 | -103 103 | -104 |-def func(x: int): - 104 |+def func(x: int) -> int | None: -105 105 | for i in range(5): -106 106 | if i > 0: -107 107 | break - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:112:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -358,16 +191,6 @@ auto_return_type.py:112:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -109 109 | return 4 -110 110 | -111 111 | -112 |-def func(x: int): - 112 |+def func(x: int) -> int | None: -113 113 | try: -114 114 | pass -115 115 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:119:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -378,16 +201,6 @@ auto_return_type.py:119:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -116 116 | return 1 -117 117 | -118 118 | -119 |-def func(x: int): - 119 |+def func(x: int) -> int: -120 120 | try: -121 121 | pass -122 122 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:128:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -398,16 +211,6 @@ auto_return_type.py:128:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -125 125 | return 2 -126 126 | -127 127 | -128 |-def func(x: int): - 128 |+def func(x: int) -> int: -129 129 | try: -130 130 | pass -131 131 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:137:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -418,16 +221,6 @@ auto_return_type.py:137:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -134 134 | return 2 -135 135 | -136 136 | -137 |-def func(x: int): - 137 |+def func(x: int) -> int | None: -138 138 | try: -139 139 | return 1 -140 140 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:146:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -438,16 +231,6 @@ auto_return_type.py:146:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -143 143 | pass -144 144 | -145 145 | -146 |-def func(x: int): - 146 |+def func(x: int) -> int | None: -147 147 | while x > 0: -148 148 | break -149 149 | return 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:158:9: ANN201 Missing return type annotation for public function `method` | @@ -507,16 +290,6 @@ auto_return_type.py:180:9: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `float` -177 177 | pass -178 178 | -179 179 | @abstractmethod -180 |- def method(self): - 180 |+ def method(self) -> float: -181 181 | if self.x > 0: -182 182 | return 1 -183 183 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:187:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -527,16 +300,6 @@ auto_return_type.py:187:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -184 184 | return 1.5 -185 185 | -186 186 | -187 |-def func(x: int): - 187 |+def func(x: int) -> int | None: -188 188 | try: -189 189 | pass -190 190 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:194:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -547,16 +310,6 @@ auto_return_type.py:194:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -191 191 | return 2 -192 192 | -193 193 | -194 |-def func(x: int): - 194 |+def func(x: int) -> int: -195 195 | try: -196 196 | pass -197 197 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:203:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -567,24 +320,6 @@ auto_return_type.py:203:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Never` -151 151 | -152 152 | import abc -153 153 | from abc import abstractmethod - 154 |+from typing import Never -154 155 | -155 156 | -156 157 | class Foo(abc.ABC): --------------------------------------------------------------------------------- -200 201 | return 3 -201 202 | -202 203 | -203 |-def func(x: int): - 204 |+def func(x: int) -> Never: -204 205 | if not x: -205 206 | raise ValueError -206 207 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:210:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -595,16 +330,6 @@ auto_return_type.py:210:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -207 207 | raise TypeError -208 208 | -209 209 | -210 |-def func(x: int): - 210 |+def func(x: int) -> int: -211 211 | if not x: -212 212 | raise ValueError -213 213 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:234:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -615,16 +340,6 @@ auto_return_type.py:234:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -231 231 | return i -232 232 | -233 233 | -234 |-def func(x: int): - 234 |+def func(x: int) -> int: -235 235 | if not x: -236 236 | return 1 -237 237 | raise ValueError - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:240:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -635,16 +350,6 @@ auto_return_type.py:240:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -237 237 | raise ValueError -238 238 | -239 239 | -240 |-def func(x: int): - 240 |+def func(x: int) -> int: -241 241 | if not x: -242 242 | return 1 -243 243 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:248:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -655,16 +360,6 @@ auto_return_type.py:248:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -245 245 | raise ValueError -246 246 | -247 247 | -248 |-def func(): - 248 |+def func() -> int | None: -249 249 | try: -250 250 | raise ValueError -251 251 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:255:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -675,16 +370,6 @@ auto_return_type.py:255:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -252 252 | return 2 -253 253 | -254 254 | -255 |-def func(): - 255 |+def func() -> int | None: -256 256 | try: -257 257 | return 1 -258 258 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:262:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -695,16 +380,6 @@ auto_return_type.py:262:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -259 259 | pass -260 260 | -261 261 | -262 |-def func(x: int): - 262 |+def func(x: int) -> int: -263 263 | for _ in range(3): -264 264 | if x > 0: -265 265 | return 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:269:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -715,16 +390,6 @@ auto_return_type.py:269:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `None` -266 266 | raise ValueError -267 267 | -268 268 | -269 |-def func(x: int): - 269 |+def func(x: int) -> None: -270 270 | if x > 5: -271 271 | raise ValueError -272 272 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:276:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -735,16 +400,6 @@ auto_return_type.py:276:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `None` -273 273 | pass -274 274 | -275 275 | -276 |-def func(x: int): - 276 |+def func(x: int) -> None: -277 277 | if x > 5: -278 278 | raise ValueError -279 279 | elif x > 10: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:283:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -755,16 +410,6 @@ auto_return_type.py:283:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int | None` -280 280 | pass -281 281 | -282 282 | -283 |-def func(x: int): - 283 |+def func(x: int) -> int | None: -284 284 | if x > 5: -285 285 | raise ValueError -286 286 | elif x > 10: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:290:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -775,16 +420,6 @@ auto_return_type.py:290:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -287 287 | return 5 -288 288 | -289 289 | -290 |-def func(): - 290 |+def func() -> int: -291 291 | try: -292 292 | return 5 -293 293 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -794,14 +429,3 @@ auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public 301 | case [1, 2, 3]: | = help: Add return type annotation: `str | int` - -296 296 | raise ValueError -297 297 | -298 298 | -299 |-def func(x: int): - 299 |+def func(x: int) -> str | int: -300 300 | match x: -301 301 | case [1, 2, 3]: -302 302 | return 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type_py38.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type_py38.snap index e615e2c3a3998..a21fad875b9d3 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type_py38.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__auto_return_type_py38.snap @@ -9,13 +9,6 @@ auto_return_type.py:1:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `int` -1 |-def func(): - 1 |+def func() -> int: -2 2 | return 1 -3 3 | -4 4 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:5:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -25,16 +18,6 @@ auto_return_type.py:5:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `float` -2 2 | return 1 -3 3 | -4 4 | -5 |-def func(): - 5 |+def func() -> float: -6 6 | return 1.5 -7 7 | -8 8 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:9:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -45,16 +28,6 @@ auto_return_type.py:9:5: ANN201 [*] Missing return type annotation for public fu | = help: Add return type annotation: `float` -6 6 | return 1.5 -7 7 | -8 8 | -9 |-def func(x: int): - 9 |+def func(x: int) -> float: -10 10 | if x > 0: -11 11 | return 1 -12 12 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:16:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -64,16 +37,6 @@ auto_return_type.py:16:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `bool` -13 13 | return 1.5 -14 14 | -15 15 | -16 |-def func(): - 16 |+def func() -> bool: -17 17 | return True -18 18 | -19 19 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:20:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -84,16 +47,6 @@ auto_return_type.py:20:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `None` -17 17 | return True -18 18 | -19 19 | -20 |-def func(x: int): - 20 |+def func(x: int) -> None: -21 21 | if x > 0: -22 22 | return None -23 23 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:27:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -103,21 +56,6 @@ auto_return_type.py:27:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Union[str | float]` - 1 |+from typing import Union -1 2 | def func(): -2 3 | return 1 -3 4 | --------------------------------------------------------------------------------- -24 25 | return -25 26 | -26 27 | -27 |-def func(x: int): - 28 |+def func(x: int) -> Union[str | float]: -28 29 | return 1 or 2.5 if x > 0 else 1.5 or "str" -29 30 | -30 31 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:31:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -127,21 +65,6 @@ auto_return_type.py:31:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Union[str | float]` - 1 |+from typing import Union -1 2 | def func(): -2 3 | return 1 -3 4 | --------------------------------------------------------------------------------- -28 29 | return 1 or 2.5 if x > 0 else 1.5 or "str" -29 30 | -30 31 | -31 |-def func(x: int): - 32 |+def func(x: int) -> Union[str | float]: -32 33 | return 1 + 2.5 if x > 0 else 1.5 or "str" -33 34 | -34 35 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:35:5: ANN201 Missing return type annotation for public function `func` | @@ -169,16 +92,6 @@ auto_return_type.py:45:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int` -42 42 | return {"foo": 1} -43 43 | -44 44 | -45 |-def func(x: int): - 45 |+def func(x: int) -> int: -46 46 | if not x: -47 47 | return 1 -48 48 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:52:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -189,21 +102,6 @@ auto_return_type.py:52:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Optional[int]` - 1 |+from typing import Optional -1 2 | def func(): -2 3 | return 1 -3 4 | --------------------------------------------------------------------------------- -49 50 | return True -50 51 | -51 52 | -52 |-def func(x: int): - 53 |+def func(x: int) -> Optional[int]: -53 54 | if not x: -54 55 | return 1 -55 56 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:59:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -214,21 +112,6 @@ auto_return_type.py:59:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Union[str | int | None]` - 1 |+from typing import Union -1 2 | def func(): -2 3 | return 1 -3 4 | --------------------------------------------------------------------------------- -56 57 | return None -57 58 | -58 59 | -59 |-def func(x: int): - 60 |+def func(x: int) -> Union[str | int | None]: -60 61 | if not x: -61 62 | return 1 -62 63 | elif x > 5: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:68:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -239,21 +122,6 @@ auto_return_type.py:68:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Optional[int]` - 1 |+from typing import Optional -1 2 | def func(): -2 3 | return 1 -3 4 | --------------------------------------------------------------------------------- -65 66 | return None -66 67 | -67 68 | -68 |-def func(x: int): - 69 |+def func(x: int) -> Optional[int]: -69 70 | if x: -70 71 | return 1 -71 72 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:73:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -263,16 +131,6 @@ auto_return_type.py:73:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `None` -70 70 | return 1 -71 71 | -72 72 | -73 |-def func(): - 73 |+def func() -> None: -74 74 | x = 1 -75 75 | -76 76 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:77:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -283,21 +141,6 @@ auto_return_type.py:77:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Optional[int]` - 1 |+from typing import Optional -1 2 | def func(): -2 3 | return 1 -3 4 | --------------------------------------------------------------------------------- -74 75 | x = 1 -75 76 | -76 77 | -77 |-def func(x: int): - 78 |+def func(x: int) -> Optional[int]: -78 79 | if x > 0: -79 80 | return 1 -80 81 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:82:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -308,21 +151,6 @@ auto_return_type.py:82:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Union[str | int | None]` - 1 |+from typing import Union -1 2 | def func(): -2 3 | return 1 -3 4 | --------------------------------------------------------------------------------- -79 80 | return 1 -80 81 | -81 82 | -82 |-def func(x: int): - 83 |+def func(x: int) -> Union[str | int | None]: -83 84 | match x: -84 85 | case [1, 2, 3]: -85 86 | return 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:90:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -333,21 +161,6 @@ auto_return_type.py:90:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `Optional[int]` - 1 |+from typing import Optional -1 2 | def func(): -2 3 | return 1 -3 4 | --------------------------------------------------------------------------------- -87 88 | return "foo" -88 89 | -89 90 | -90 |-def func(x: int): - 91 |+def func(x: int) -> Optional[int]: -91 92 | for i in range(5): -92 93 | if i > 0: -93 94 | return 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:96:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -358,16 +171,6 @@ auto_return_type.py:96:5: ANN201 [*] Missing return type annotation for public f | = help: Add return type annotation: `int` -93 93 | return 1 -94 94 | -95 95 | -96 |-def func(x: int): - 96 |+def func(x: int) -> int: -97 97 | for i in range(5): -98 98 | if i > 0: -99 99 | return 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:104:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -378,21 +181,6 @@ auto_return_type.py:104:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` - 1 |+from typing import Optional -1 2 | def func(): -2 3 | return 1 -3 4 | --------------------------------------------------------------------------------- -101 102 | return 4 -102 103 | -103 104 | -104 |-def func(x: int): - 105 |+def func(x: int) -> Optional[int]: -105 106 | for i in range(5): -106 107 | if i > 0: -107 108 | break - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:112:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -403,21 +191,6 @@ auto_return_type.py:112:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` - 1 |+from typing import Optional -1 2 | def func(): -2 3 | return 1 -3 4 | --------------------------------------------------------------------------------- -109 110 | return 4 -110 111 | -111 112 | -112 |-def func(x: int): - 113 |+def func(x: int) -> Optional[int]: -113 114 | try: -114 115 | pass -115 116 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:119:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -428,16 +201,6 @@ auto_return_type.py:119:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -116 116 | return 1 -117 117 | -118 118 | -119 |-def func(x: int): - 119 |+def func(x: int) -> int: -120 120 | try: -121 121 | pass -122 122 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:128:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -448,16 +211,6 @@ auto_return_type.py:128:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -125 125 | return 2 -126 126 | -127 127 | -128 |-def func(x: int): - 128 |+def func(x: int) -> int: -129 129 | try: -130 130 | pass -131 131 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:137:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -468,21 +221,6 @@ auto_return_type.py:137:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` - 1 |+from typing import Optional -1 2 | def func(): -2 3 | return 1 -3 4 | --------------------------------------------------------------------------------- -134 135 | return 2 -135 136 | -136 137 | -137 |-def func(x: int): - 138 |+def func(x: int) -> Optional[int]: -138 139 | try: -139 140 | return 1 -140 141 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:146:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -493,21 +231,6 @@ auto_return_type.py:146:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` - 1 |+from typing import Optional -1 2 | def func(): -2 3 | return 1 -3 4 | --------------------------------------------------------------------------------- -143 144 | pass -144 145 | -145 146 | -146 |-def func(x: int): - 147 |+def func(x: int) -> Optional[int]: -147 148 | while x > 0: -148 149 | break -149 150 | return 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:158:9: ANN201 Missing return type annotation for public function `method` | @@ -567,16 +290,6 @@ auto_return_type.py:180:9: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `float` -177 177 | pass -178 178 | -179 179 | @abstractmethod -180 |- def method(self): - 180 |+ def method(self) -> float: -181 181 | if self.x > 0: -182 182 | return 1 -183 183 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:187:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -587,24 +300,6 @@ auto_return_type.py:187:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -151 151 | -152 152 | import abc -153 153 | from abc import abstractmethod - 154 |+from typing import Optional -154 155 | -155 156 | -156 157 | class Foo(abc.ABC): --------------------------------------------------------------------------------- -184 185 | return 1.5 -185 186 | -186 187 | -187 |-def func(x: int): - 188 |+def func(x: int) -> Optional[int]: -188 189 | try: -189 190 | pass -190 191 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:194:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -615,16 +310,6 @@ auto_return_type.py:194:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -191 191 | return 2 -192 192 | -193 193 | -194 |-def func(x: int): - 194 |+def func(x: int) -> int: -195 195 | try: -196 196 | pass -197 197 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:203:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -635,24 +320,6 @@ auto_return_type.py:203:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `NoReturn` -151 151 | -152 152 | import abc -153 153 | from abc import abstractmethod - 154 |+from typing import NoReturn -154 155 | -155 156 | -156 157 | class Foo(abc.ABC): --------------------------------------------------------------------------------- -200 201 | return 3 -201 202 | -202 203 | -203 |-def func(x: int): - 204 |+def func(x: int) -> NoReturn: -204 205 | if not x: -205 206 | raise ValueError -206 207 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:210:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -663,16 +330,6 @@ auto_return_type.py:210:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -207 207 | raise TypeError -208 208 | -209 209 | -210 |-def func(x: int): - 210 |+def func(x: int) -> int: -211 211 | if not x: -212 212 | raise ValueError -213 213 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:234:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -683,16 +340,6 @@ auto_return_type.py:234:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -231 231 | return i -232 232 | -233 233 | -234 |-def func(x: int): - 234 |+def func(x: int) -> int: -235 235 | if not x: -236 236 | return 1 -237 237 | raise ValueError - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:240:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -703,16 +350,6 @@ auto_return_type.py:240:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -237 237 | raise ValueError -238 238 | -239 239 | -240 |-def func(x: int): - 240 |+def func(x: int) -> int: -241 241 | if not x: -242 242 | return 1 -243 243 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:248:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -723,25 +360,6 @@ auto_return_type.py:248:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -214 214 | return 1 -215 215 | -216 216 | -217 |-from typing import overload - 217 |+from typing import overload, Optional -218 218 | -219 219 | -220 220 | @overload --------------------------------------------------------------------------------- -245 245 | raise ValueError -246 246 | -247 247 | -248 |-def func(): - 248 |+def func() -> Optional[int]: -249 249 | try: -250 250 | raise ValueError -251 251 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:255:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -752,25 +370,6 @@ auto_return_type.py:255:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -214 214 | return 1 -215 215 | -216 216 | -217 |-from typing import overload - 217 |+from typing import overload, Optional -218 218 | -219 219 | -220 220 | @overload --------------------------------------------------------------------------------- -252 252 | return 2 -253 253 | -254 254 | -255 |-def func(): - 255 |+def func() -> Optional[int]: -256 256 | try: -257 257 | return 1 -258 258 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:262:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -781,16 +380,6 @@ auto_return_type.py:262:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -259 259 | pass -260 260 | -261 261 | -262 |-def func(x: int): - 262 |+def func(x: int) -> int: -263 263 | for _ in range(3): -264 264 | if x > 0: -265 265 | return 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:269:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -801,16 +390,6 @@ auto_return_type.py:269:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `None` -266 266 | raise ValueError -267 267 | -268 268 | -269 |-def func(x: int): - 269 |+def func(x: int) -> None: -270 270 | if x > 5: -271 271 | raise ValueError -272 272 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:276:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -821,16 +400,6 @@ auto_return_type.py:276:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `None` -273 273 | pass -274 274 | -275 275 | -276 |-def func(x: int): - 276 |+def func(x: int) -> None: -277 277 | if x > 5: -278 278 | raise ValueError -279 279 | elif x > 10: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:283:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -841,25 +410,6 @@ auto_return_type.py:283:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `Optional[int]` -214 214 | return 1 -215 215 | -216 216 | -217 |-from typing import overload - 217 |+from typing import overload, Optional -218 218 | -219 219 | -220 220 | @overload --------------------------------------------------------------------------------- -280 280 | pass -281 281 | -282 282 | -283 |-def func(x: int): - 283 |+def func(x: int) -> Optional[int]: -284 284 | if x > 5: -285 285 | raise ValueError -286 286 | elif x > 10: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:290:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -870,16 +420,6 @@ auto_return_type.py:290:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `int` -287 287 | return 5 -288 288 | -289 289 | -290 |-def func(): - 290 |+def func() -> int: -291 291 | try: -292 292 | return 5 -293 293 | except: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public function `func` | @@ -889,23 +429,3 @@ auto_return_type.py:299:5: ANN201 [*] Missing return type annotation for public 301 | case [1, 2, 3]: | = help: Add return type annotation: `Union[str | int]` - -214 214 | return 1 -215 215 | -216 216 | -217 |-from typing import overload - 217 |+from typing import overload, Union -218 218 | -219 219 | -220 220 | @overload --------------------------------------------------------------------------------- -296 296 | raise ValueError -297 297 | -298 298 | -299 |-def func(x: int): - 299 |+def func(x: int) -> Union[str | int]: -300 300 | match x: -301 301 | case [1, 2, 3]: -302 302 | return 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap index 40b828000acaa..2b38d11ca830d 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap @@ -10,16 +10,6 @@ annotation_presence.py:5:5: ANN201 [*] Missing return type annotation for public | = help: Add return type annotation: `None` -2 2 | from typing_extensions import override -3 3 | -4 4 | # Error -5 |-def foo(a, b): - 5 |+def foo(a, b) -> None: -6 6 | pass -7 7 | -8 8 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. annotation_presence.py:5:9: ANN001 Missing type annotation for function argument `a` | @@ -46,16 +36,6 @@ annotation_presence.py:10:5: ANN201 [*] Missing return type annotation for publi | = help: Add return type annotation: `None` -7 7 | -8 8 | -9 9 | # Error -10 |-def foo(a: int, b): - 10 |+def foo(a: int, b) -> None: -11 11 | pass -12 12 | -13 13 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. annotation_presence.py:10:17: ANN001 Missing type annotation for function argument `b` | @@ -82,16 +62,6 @@ annotation_presence.py:20:5: ANN201 [*] Missing return type annotation for publi | = help: Add return type annotation: `None` -17 17 | -18 18 | -19 19 | # Error -20 |-def foo(a: int, b: int): - 20 |+def foo(a: int, b: int) -> None: -21 21 | pass -22 22 | -23 23 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. annotation_presence.py:25:5: ANN201 [*] Missing return type annotation for public function `foo` | @@ -102,16 +72,6 @@ annotation_presence.py:25:5: ANN201 [*] Missing return type annotation for publi | = help: Add return type annotation: `None` -22 22 | -23 23 | -24 24 | # Error -25 |-def foo(): - 25 |+def foo() -> None: -26 26 | pass -27 27 | -28 28 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. annotation_presence.py:45:12: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `a` | @@ -300,16 +260,6 @@ annotation_presence.py:159:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `None` -156 156 | -157 157 | class Foo: -158 158 | @decorator() -159 |- def __init__(self: "Foo", foo: int): - 159 |+ def __init__(self: "Foo", foo: int) -> None: -160 160 | ... -161 161 | -162 162 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. annotation_presence.py:165:9: ANN204 [*] Missing return type annotation for special method `__init__` | @@ -321,14 +271,6 @@ annotation_presence.py:165:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `None` -162 162 | -163 163 | # Regression test for: https://github.com/astral-sh/ruff/issues/7711 -164 164 | class Class: -165 |- def __init__(self): - 165 |+ def __init__(self) -> None: -166 166 | print(f"{self.attr=}") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. annotation_presence.py:165:18: ANN101 Missing type annotation for `self` in method | diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap index 7a4116381f2fc..cdbde7a18e225 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__ignore_fully_untyped.snap @@ -9,16 +9,6 @@ ignore_fully_untyped.py:24:5: ANN201 [*] Missing return type annotation for publ | = help: Add return type annotation: `None` -21 21 | pass -22 22 | -23 23 | -24 |-def error_partially_typed_1(a: int, b): - 24 |+def error_partially_typed_1(a: int, b) -> None: -25 25 | pass -26 26 | -27 27 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ignore_fully_untyped.py:24:37: ANN001 Missing type annotation for function argument `b` | @@ -42,16 +32,6 @@ ignore_fully_untyped.py:32:5: ANN201 [*] Missing return type annotation for publ | = help: Add return type annotation: `None` -29 29 | pass -30 30 | -31 31 | -32 |-def error_partially_typed_3(a: int, b: int): - 32 |+def error_partially_typed_3(a: int, b: int) -> None: -33 33 | pass -34 34 | -35 35 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ignore_fully_untyped.py:43:9: ANN201 [*] Missing return type annotation for public function `error_typed_self` | @@ -62,12 +42,3 @@ ignore_fully_untyped.py:43:9: ANN201 [*] Missing return type annotation for publ 44 | pass | = help: Add return type annotation: `None` - -40 40 | def ok_untyped_method(self): -41 41 | pass -42 42 | -43 |- def error_typed_self(self: X): - 43 |+ def error_typed_self(self: X) -> None: -44 44 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap index bdd4c0957c4a9..c7206cc46fe3c 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap @@ -11,16 +11,6 @@ mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special m | = help: Add return type annotation: `None` -2 2 | -3 3 | # Error -4 4 | class Foo: -5 |- def __init__(self): - 5 |+ def __init__(self) -> None: -6 6 | ... -7 7 | -8 8 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special method `__init__` | @@ -32,16 +22,6 @@ mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special | = help: Add return type annotation: `None` -8 8 | -9 9 | # Error -10 10 | class Foo: -11 |- def __init__(self, foo): - 11 |+ def __init__(self, foo) -> None: -12 12 | ... -13 13 | -14 14 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. mypy_init_return.py:40:5: ANN202 [*] Missing return type annotation for private function `__init__` | @@ -52,16 +32,6 @@ mypy_init_return.py:40:5: ANN202 [*] Missing return type annotation for private | = help: Add return type annotation: `None` -37 37 | -38 38 | -39 39 | # Error -40 |-def __init__(self, foo: int): - 40 |+def __init__(self, foo: int) -> None: -41 41 | ... -42 42 | -43 43 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. mypy_init_return.py:47:9: ANN204 [*] Missing return type annotation for special method `__init__` | @@ -72,12 +42,3 @@ mypy_init_return.py:47:9: ANN204 [*] Missing return type annotation for special 48 | ... | = help: Add return type annotation: `None` - -44 44 | # Error – used to be ok for a moment since the mere presence -45 45 | # of a vararg falsely indicated that the function has a typed argument. -46 46 | class Foo: -47 |- def __init__(self, *arg): - 47 |+ def __init__(self, *arg) -> None: -48 48 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap index 94d20c6f2e1f8..eaeceed86279b 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap @@ -10,14 +10,6 @@ simple_magic_methods.py:2:9: ANN204 [*] Missing return type annotation for speci | = help: Add return type annotation: `str` -1 1 | class Foo: -2 |- def __str__(self): - 2 |+ def __str__(self) -> str: -3 3 | ... -4 4 | -5 5 | def __repr__(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for special method `__repr__` | @@ -29,16 +21,6 @@ simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for speci | = help: Add return type annotation: `str` -2 2 | def __str__(self): -3 3 | ... -4 4 | -5 |- def __repr__(self): - 5 |+ def __repr__(self) -> str: -6 6 | ... -7 7 | -8 8 | def __len__(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for special method `__len__` | @@ -50,16 +32,6 @@ simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for speci | = help: Add return type annotation: `int` -5 5 | def __repr__(self): -6 6 | ... -7 7 | -8 |- def __len__(self): - 8 |+ def __len__(self) -> int: -9 9 | ... -10 10 | -11 11 | def __length_hint__(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for special method `__length_hint__` | @@ -71,16 +43,6 @@ simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `int` -8 8 | def __len__(self): -9 9 | ... -10 10 | -11 |- def __length_hint__(self): - 11 |+ def __length_hint__(self) -> int: -12 12 | ... -13 13 | -14 14 | def __init__(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for special method `__init__` | @@ -92,16 +54,6 @@ simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `None` -11 11 | def __length_hint__(self): -12 12 | ... -13 13 | -14 |- def __init__(self): - 14 |+ def __init__(self) -> None: -15 15 | ... -16 16 | -17 17 | def __del__(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for special method `__del__` | @@ -113,16 +65,6 @@ simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `None` -14 14 | def __init__(self): -15 15 | ... -16 16 | -17 |- def __del__(self): - 17 |+ def __del__(self) -> None: -18 18 | ... -19 19 | -20 20 | def __bool__(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for special method `__bool__` | @@ -134,16 +76,6 @@ simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `bool` -17 17 | def __del__(self): -18 18 | ... -19 19 | -20 |- def __bool__(self): - 20 |+ def __bool__(self) -> bool: -21 21 | ... -22 22 | -23 23 | def __bytes__(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for special method `__bytes__` | @@ -155,16 +87,6 @@ simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `bytes` -20 20 | def __bool__(self): -21 21 | ... -22 22 | -23 |- def __bytes__(self): - 23 |+ def __bytes__(self) -> bytes: -24 24 | ... -25 25 | -26 26 | def __format__(self, format_spec): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for special method `__format__` | @@ -176,16 +98,6 @@ simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `str` -23 23 | def __bytes__(self): -24 24 | ... -25 25 | -26 |- def __format__(self, format_spec): - 26 |+ def __format__(self, format_spec) -> str: -27 27 | ... -28 28 | -29 29 | def __contains__(self, item): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for special method `__contains__` | @@ -197,16 +109,6 @@ simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `bool` -26 26 | def __format__(self, format_spec): -27 27 | ... -28 28 | -29 |- def __contains__(self, item): - 29 |+ def __contains__(self, item) -> bool: -30 30 | ... -31 31 | -32 32 | def __complex__(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for special method `__complex__` | @@ -218,16 +120,6 @@ simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `complex` -29 29 | def __contains__(self, item): -30 30 | ... -31 31 | -32 |- def __complex__(self): - 32 |+ def __complex__(self) -> complex: -33 33 | ... -34 34 | -35 35 | def __int__(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for special method `__int__` | @@ -239,16 +131,6 @@ simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `int` -32 32 | def __complex__(self): -33 33 | ... -34 34 | -35 |- def __int__(self): - 35 |+ def __int__(self) -> int: -36 36 | ... -37 37 | -38 38 | def __float__(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for special method `__float__` | @@ -260,16 +142,6 @@ simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for spec | = help: Add return type annotation: `float` -35 35 | def __int__(self): -36 36 | ... -37 37 | -38 |- def __float__(self): - 38 |+ def __float__(self) -> float: -39 39 | ... -40 40 | -41 41 | def __index__(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. simple_magic_methods.py:41:9: ANN204 [*] Missing return type annotation for special method `__index__` | @@ -280,12 +152,3 @@ simple_magic_methods.py:41:9: ANN204 [*] Missing return type annotation for spec 42 | ... | = help: Add return type annotation: `int` - -38 38 | def __float__(self): -39 39 | ... -40 40 | -41 |- def __index__(self): - 41 |+ def __index__(self) -> int: -42 42 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__suppress_none_returning.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__suppress_none_returning.snap index 3a924a9e40bbf..1245be261340a 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__suppress_none_returning.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__suppress_none_returning.snap @@ -10,16 +10,6 @@ suppress_none_returning.py:45:5: ANN201 [*] Missing return type annotation for p | = help: Add return type annotation: `bool` -42 42 | -43 43 | -44 44 | # Error -45 |-def foo(): - 45 |+def foo() -> bool: -46 46 | return True -47 47 | -48 48 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. suppress_none_returning.py:50:5: ANN201 [*] Missing return type annotation for public function `foo` | @@ -31,16 +21,6 @@ suppress_none_returning.py:50:5: ANN201 [*] Missing return type annotation for p | = help: Add return type annotation: `bool | None` -47 47 | -48 48 | -49 49 | # Error -50 |-def foo(): - 50 |+def foo() -> bool | None: -51 51 | a = 2 + 2 -52 52 | if a == 4: -53 53 | return True - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. suppress_none_returning.py:59:9: ANN001 Missing type annotation for function argument `a` | diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap index 0664555b1f633..2006488826278 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC105_ASYNC105.py.snap @@ -11,16 +11,6 @@ ASYNC105.py:30:5: ASYNC105 [*] Call to `trio.aclose_forcefully` is not immediate | = help: Add `await` -27 27 | await trio.lowlevel.wait_writable(foo) -28 28 | -29 29 | # ASYNC105 -30 |- trio.aclose_forcefully(foo) - 30 |+ await trio.aclose_forcefully(foo) -31 31 | trio.open_file(foo) -32 32 | trio.open_ssl_over_tcp_listeners(foo, foo) -33 33 | trio.open_ssl_over_tcp_stream(foo, foo) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:31:5: ASYNC105 [*] Call to `trio.open_file` is not immediately awaited | @@ -33,16 +23,6 @@ ASYNC105.py:31:5: ASYNC105 [*] Call to `trio.open_file` is not immediately await | = help: Add `await` -28 28 | -29 29 | # ASYNC105 -30 30 | trio.aclose_forcefully(foo) -31 |- trio.open_file(foo) - 31 |+ await trio.open_file(foo) -32 32 | trio.open_ssl_over_tcp_listeners(foo, foo) -33 33 | trio.open_ssl_over_tcp_stream(foo, foo) -34 34 | trio.open_tcp_listeners(foo) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:32:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_listeners` is not immediately awaited | @@ -55,16 +35,6 @@ ASYNC105.py:32:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_listeners` is not | = help: Add `await` -29 29 | # ASYNC105 -30 30 | trio.aclose_forcefully(foo) -31 31 | trio.open_file(foo) -32 |- trio.open_ssl_over_tcp_listeners(foo, foo) - 32 |+ await trio.open_ssl_over_tcp_listeners(foo, foo) -33 33 | trio.open_ssl_over_tcp_stream(foo, foo) -34 34 | trio.open_tcp_listeners(foo) -35 35 | trio.open_tcp_stream(foo, foo) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:33:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_stream` is not immediately awaited | @@ -77,16 +47,6 @@ ASYNC105.py:33:5: ASYNC105 [*] Call to `trio.open_ssl_over_tcp_stream` is not im | = help: Add `await` -30 30 | trio.aclose_forcefully(foo) -31 31 | trio.open_file(foo) -32 32 | trio.open_ssl_over_tcp_listeners(foo, foo) -33 |- trio.open_ssl_over_tcp_stream(foo, foo) - 33 |+ await trio.open_ssl_over_tcp_stream(foo, foo) -34 34 | trio.open_tcp_listeners(foo) -35 35 | trio.open_tcp_stream(foo, foo) -36 36 | trio.open_unix_socket(foo) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:34:5: ASYNC105 [*] Call to `trio.open_tcp_listeners` is not immediately awaited | @@ -99,16 +59,6 @@ ASYNC105.py:34:5: ASYNC105 [*] Call to `trio.open_tcp_listeners` is not immediat | = help: Add `await` -31 31 | trio.open_file(foo) -32 32 | trio.open_ssl_over_tcp_listeners(foo, foo) -33 33 | trio.open_ssl_over_tcp_stream(foo, foo) -34 |- trio.open_tcp_listeners(foo) - 34 |+ await trio.open_tcp_listeners(foo) -35 35 | trio.open_tcp_stream(foo, foo) -36 36 | trio.open_unix_socket(foo) -37 37 | trio.run_process(foo) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:35:5: ASYNC105 [*] Call to `trio.open_tcp_stream` is not immediately awaited | @@ -121,16 +71,6 @@ ASYNC105.py:35:5: ASYNC105 [*] Call to `trio.open_tcp_stream` is not immediately | = help: Add `await` -32 32 | trio.open_ssl_over_tcp_listeners(foo, foo) -33 33 | trio.open_ssl_over_tcp_stream(foo, foo) -34 34 | trio.open_tcp_listeners(foo) -35 |- trio.open_tcp_stream(foo, foo) - 35 |+ await trio.open_tcp_stream(foo, foo) -36 36 | trio.open_unix_socket(foo) -37 37 | trio.run_process(foo) -38 38 | trio.serve_listeners(foo, foo) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:36:5: ASYNC105 [*] Call to `trio.open_unix_socket` is not immediately awaited | @@ -143,16 +83,6 @@ ASYNC105.py:36:5: ASYNC105 [*] Call to `trio.open_unix_socket` is not immediatel | = help: Add `await` -33 33 | trio.open_ssl_over_tcp_stream(foo, foo) -34 34 | trio.open_tcp_listeners(foo) -35 35 | trio.open_tcp_stream(foo, foo) -36 |- trio.open_unix_socket(foo) - 36 |+ await trio.open_unix_socket(foo) -37 37 | trio.run_process(foo) -38 38 | trio.serve_listeners(foo, foo) -39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:37:5: ASYNC105 [*] Call to `trio.run_process` is not immediately awaited | @@ -165,16 +95,6 @@ ASYNC105.py:37:5: ASYNC105 [*] Call to `trio.run_process` is not immediately awa | = help: Add `await` -34 34 | trio.open_tcp_listeners(foo) -35 35 | trio.open_tcp_stream(foo, foo) -36 36 | trio.open_unix_socket(foo) -37 |- trio.run_process(foo) - 37 |+ await trio.run_process(foo) -38 38 | trio.serve_listeners(foo, foo) -39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) -40 40 | trio.serve_tcp(foo, foo) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:38:5: ASYNC105 [*] Call to `trio.serve_listeners` is not immediately awaited | @@ -187,16 +107,6 @@ ASYNC105.py:38:5: ASYNC105 [*] Call to `trio.serve_listeners` is not immediately | = help: Add `await` -35 35 | trio.open_tcp_stream(foo, foo) -36 36 | trio.open_unix_socket(foo) -37 37 | trio.run_process(foo) -38 |- trio.serve_listeners(foo, foo) - 38 |+ await trio.serve_listeners(foo, foo) -39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) -40 40 | trio.serve_tcp(foo, foo) -41 41 | trio.sleep(foo) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:39:5: ASYNC105 [*] Call to `trio.serve_ssl_over_tcp` is not immediately awaited | @@ -209,16 +119,6 @@ ASYNC105.py:39:5: ASYNC105 [*] Call to `trio.serve_ssl_over_tcp` is not immediat | = help: Add `await` -36 36 | trio.open_unix_socket(foo) -37 37 | trio.run_process(foo) -38 38 | trio.serve_listeners(foo, foo) -39 |- trio.serve_ssl_over_tcp(foo, foo, foo) - 39 |+ await trio.serve_ssl_over_tcp(foo, foo, foo) -40 40 | trio.serve_tcp(foo, foo) -41 41 | trio.sleep(foo) -42 42 | trio.sleep_forever() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:40:5: ASYNC105 [*] Call to `trio.serve_tcp` is not immediately awaited | @@ -231,16 +131,6 @@ ASYNC105.py:40:5: ASYNC105 [*] Call to `trio.serve_tcp` is not immediately await | = help: Add `await` -37 37 | trio.run_process(foo) -38 38 | trio.serve_listeners(foo, foo) -39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) -40 |- trio.serve_tcp(foo, foo) - 40 |+ await trio.serve_tcp(foo, foo) -41 41 | trio.sleep(foo) -42 42 | trio.sleep_forever() -43 43 | trio.sleep_until(foo) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:41:5: ASYNC105 [*] Call to `trio.sleep` is not immediately awaited | @@ -253,16 +143,6 @@ ASYNC105.py:41:5: ASYNC105 [*] Call to `trio.sleep` is not immediately awaited | = help: Add `await` -38 38 | trio.serve_listeners(foo, foo) -39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) -40 40 | trio.serve_tcp(foo, foo) -41 |- trio.sleep(foo) - 41 |+ await trio.sleep(foo) -42 42 | trio.sleep_forever() -43 43 | trio.sleep_until(foo) -44 44 | trio.lowlevel.cancel_shielded_checkpoint() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:42:5: ASYNC105 [*] Call to `trio.sleep_forever` is not immediately awaited | @@ -275,16 +155,6 @@ ASYNC105.py:42:5: ASYNC105 [*] Call to `trio.sleep_forever` is not immediately a | = help: Add `await` -39 39 | trio.serve_ssl_over_tcp(foo, foo, foo) -40 40 | trio.serve_tcp(foo, foo) -41 41 | trio.sleep(foo) -42 |- trio.sleep_forever() - 42 |+ await trio.sleep_forever() -43 43 | trio.sleep_until(foo) -44 44 | trio.lowlevel.cancel_shielded_checkpoint() -45 45 | trio.lowlevel.checkpoint() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:44:5: ASYNC105 [*] Call to `trio.lowlevel.cancel_shielded_checkpoint` is not immediately awaited | @@ -297,16 +167,6 @@ ASYNC105.py:44:5: ASYNC105 [*] Call to `trio.lowlevel.cancel_shielded_checkpoint | = help: Add `await` -41 41 | trio.sleep(foo) -42 42 | trio.sleep_forever() -43 43 | trio.sleep_until(foo) -44 |- trio.lowlevel.cancel_shielded_checkpoint() - 44 |+ await trio.lowlevel.cancel_shielded_checkpoint() -45 45 | trio.lowlevel.checkpoint() -46 46 | trio.lowlevel.checkpoint_if_cancelled() -47 47 | trio.lowlevel.open_process() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:45:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint` is not immediately awaited | @@ -319,16 +179,6 @@ ASYNC105.py:45:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint` is not immedia | = help: Add `await` -42 42 | trio.sleep_forever() -43 43 | trio.sleep_until(foo) -44 44 | trio.lowlevel.cancel_shielded_checkpoint() -45 |- trio.lowlevel.checkpoint() - 45 |+ await trio.lowlevel.checkpoint() -46 46 | trio.lowlevel.checkpoint_if_cancelled() -47 47 | trio.lowlevel.open_process() -48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:46:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint_if_cancelled` is not immediately awaited | @@ -341,16 +191,6 @@ ASYNC105.py:46:5: ASYNC105 [*] Call to `trio.lowlevel.checkpoint_if_cancelled` i | = help: Add `await` -43 43 | trio.sleep_until(foo) -44 44 | trio.lowlevel.cancel_shielded_checkpoint() -45 45 | trio.lowlevel.checkpoint() -46 |- trio.lowlevel.checkpoint_if_cancelled() - 46 |+ await trio.lowlevel.checkpoint_if_cancelled() -47 47 | trio.lowlevel.open_process() -48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) -49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:47:5: ASYNC105 [*] Call to `trio.lowlevel.open_process` is not immediately awaited | @@ -363,16 +203,6 @@ ASYNC105.py:47:5: ASYNC105 [*] Call to `trio.lowlevel.open_process` is not immed | = help: Add `await` -44 44 | trio.lowlevel.cancel_shielded_checkpoint() -45 45 | trio.lowlevel.checkpoint() -46 46 | trio.lowlevel.checkpoint_if_cancelled() -47 |- trio.lowlevel.open_process() - 47 |+ await trio.lowlevel.open_process() -48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) -49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) -50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:48:5: ASYNC105 [*] Call to `trio.lowlevel.permanently_detach_coroutine_object` is not immediately awaited | @@ -385,16 +215,6 @@ ASYNC105.py:48:5: ASYNC105 [*] Call to `trio.lowlevel.permanently_detach_corouti | = help: Add `await` -45 45 | trio.lowlevel.checkpoint() -46 46 | trio.lowlevel.checkpoint_if_cancelled() -47 47 | trio.lowlevel.open_process() -48 |- trio.lowlevel.permanently_detach_coroutine_object(foo) - 48 |+ await trio.lowlevel.permanently_detach_coroutine_object(foo) -49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) -50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) -51 51 | trio.lowlevel.wait_readable(foo) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:49:5: ASYNC105 [*] Call to `trio.lowlevel.reattach_detached_coroutine_object` is not immediately awaited | @@ -407,16 +227,6 @@ ASYNC105.py:49:5: ASYNC105 [*] Call to `trio.lowlevel.reattach_detached_coroutin | = help: Add `await` -46 46 | trio.lowlevel.checkpoint_if_cancelled() -47 47 | trio.lowlevel.open_process() -48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) -49 |- trio.lowlevel.reattach_detached_coroutine_object(foo, foo) - 49 |+ await trio.lowlevel.reattach_detached_coroutine_object(foo, foo) -50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) -51 51 | trio.lowlevel.wait_readable(foo) -52 52 | trio.lowlevel.wait_task_rescheduled(foo) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:50:5: ASYNC105 [*] Call to `trio.lowlevel.temporarily_detach_coroutine_object` is not immediately awaited | @@ -429,16 +239,6 @@ ASYNC105.py:50:5: ASYNC105 [*] Call to `trio.lowlevel.temporarily_detach_corouti | = help: Add `await` -47 47 | trio.lowlevel.open_process() -48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) -49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) -50 |- trio.lowlevel.temporarily_detach_coroutine_object(foo) - 50 |+ await trio.lowlevel.temporarily_detach_coroutine_object(foo) -51 51 | trio.lowlevel.wait_readable(foo) -52 52 | trio.lowlevel.wait_task_rescheduled(foo) -53 53 | trio.lowlevel.wait_writable(foo) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:51:5: ASYNC105 [*] Call to `trio.lowlevel.wait_readable` is not immediately awaited | @@ -451,16 +251,6 @@ ASYNC105.py:51:5: ASYNC105 [*] Call to `trio.lowlevel.wait_readable` is not imme | = help: Add `await` -48 48 | trio.lowlevel.permanently_detach_coroutine_object(foo) -49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) -50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) -51 |- trio.lowlevel.wait_readable(foo) - 51 |+ await trio.lowlevel.wait_readable(foo) -52 52 | trio.lowlevel.wait_task_rescheduled(foo) -53 53 | trio.lowlevel.wait_writable(foo) -54 54 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:52:5: ASYNC105 [*] Call to `trio.lowlevel.wait_task_rescheduled` is not immediately awaited | @@ -472,16 +262,6 @@ ASYNC105.py:52:5: ASYNC105 [*] Call to `trio.lowlevel.wait_task_rescheduled` is | = help: Add `await` -49 49 | trio.lowlevel.reattach_detached_coroutine_object(foo, foo) -50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) -51 51 | trio.lowlevel.wait_readable(foo) -52 |- trio.lowlevel.wait_task_rescheduled(foo) - 52 |+ await trio.lowlevel.wait_task_rescheduled(foo) -53 53 | trio.lowlevel.wait_writable(foo) -54 54 | -55 55 | async with await trio.open_file(foo): # Ok - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:53:5: ASYNC105 [*] Call to `trio.lowlevel.wait_writable` is not immediately awaited | @@ -494,16 +274,6 @@ ASYNC105.py:53:5: ASYNC105 [*] Call to `trio.lowlevel.wait_writable` is not imme | = help: Add `await` -50 50 | trio.lowlevel.temporarily_detach_coroutine_object(foo) -51 51 | trio.lowlevel.wait_readable(foo) -52 52 | trio.lowlevel.wait_task_rescheduled(foo) -53 |- trio.lowlevel.wait_writable(foo) - 53 |+ await trio.lowlevel.wait_writable(foo) -54 54 | -55 55 | async with await trio.open_file(foo): # Ok -56 56 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:58:16: ASYNC105 [*] Call to `trio.open_file` is not immediately awaited | @@ -515,16 +285,6 @@ ASYNC105.py:58:16: ASYNC105 [*] Call to `trio.open_file` is not immediately awai | = help: Add `await` -55 55 | async with await trio.open_file(foo): # Ok -56 56 | pass -57 57 | -58 |- async with trio.open_file(foo): # ASYNC105 - 58 |+ async with await trio.open_file(foo): # ASYNC105 -59 59 | pass -60 60 | -61 61 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC105.py:64:5: ASYNC105 Call to `trio.open_file` is not immediately awaited | diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap index 00b514b6e3b90..cbeadf9386794 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC116_ASYNC116.py.snap @@ -11,16 +11,6 @@ ASYNC116.py:11:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -8 8 | import trio -9 9 | -10 10 | # These examples are probably not meant to ever wake up: -11 |- await trio.sleep(100000) # error: 116, "async" - 11 |+ await trio.sleep_forever() # error: 116, "async" -12 12 | -13 13 | # 'inf literal' overflow trick -14 14 | await trio.sleep(1e999) # error: 116, "async" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:14:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | @@ -32,16 +22,6 @@ ASYNC116.py:14:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -11 11 | await trio.sleep(100000) # error: 116, "async" -12 12 | -13 13 | # 'inf literal' overflow trick -14 |- await trio.sleep(1e999) # error: 116, "async" - 14 |+ await trio.sleep_forever() # error: 116, "async" -15 15 | -16 16 | await trio.sleep(86399) -17 17 | await trio.sleep(86400) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:18:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | @@ -53,16 +33,6 @@ ASYNC116.py:18:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -15 15 | -16 16 | await trio.sleep(86399) -17 17 | await trio.sleep(86400) -18 |- await trio.sleep(86400.01) # error: 116, "async" - 18 |+ await trio.sleep_forever() # error: 116, "async" -19 19 | await trio.sleep(86401) # error: 116, "async" -20 20 | -21 21 | await trio.sleep(-1) # will raise a runtime error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:19:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | @@ -75,16 +45,6 @@ ASYNC116.py:19:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -16 16 | await trio.sleep(86399) -17 17 | await trio.sleep(86400) -18 18 | await trio.sleep(86400.01) # error: 116, "async" -19 |- await trio.sleep(86401) # error: 116, "async" - 19 |+ await trio.sleep_forever() # error: 116, "async" -20 20 | -21 21 | await trio.sleep(-1) # will raise a runtime error -22 22 | await trio.sleep(0) # handled by different check - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:48:5: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | @@ -96,16 +56,6 @@ ASYNC116.py:48:5: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usua | = help: Replace with `trio.sleep_forever()` -45 45 | import trio -46 46 | -47 47 | # does not require the call to be awaited, nor in an async fun -48 |- trio.sleep(86401) # error: 116, "async" - 48 |+ trio.sleep_forever() # error: 116, "async" -49 49 | # also checks that we don't break visit_Call -50 50 | trio.run(trio.sleep(86401)) # error: 116, "async" -51 51 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:50:14: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | @@ -116,16 +66,6 @@ ASYNC116.py:50:14: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -47 47 | # does not require the call to be awaited, nor in an async fun -48 48 | trio.sleep(86401) # error: 116, "async" -49 49 | # also checks that we don't break visit_Call -50 |- trio.run(trio.sleep(86401)) # error: 116, "async" - 50 |+ trio.run(trio.sleep_forever()) # error: 116, "async" -51 51 | -52 52 | -53 53 | async def import_from_trio(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:57:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | @@ -134,22 +74,3 @@ ASYNC116.py:57:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | ^^^^^^^^^^^^ ASYNC116 | = help: Replace with `trio.sleep_forever()` - -2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. -3 3 | import math -4 4 | from math import inf - 5 |+from trio import sleep_forever -5 6 | -6 7 | -7 8 | async def import_trio(): --------------------------------------------------------------------------------- -54 55 | from trio import sleep -55 56 | -56 57 | # catch from import -57 |- await sleep(86401) # error: 116, "async" - 58 |+ await sleep_forever() # error: 116, "async" -58 59 | -59 60 | -60 61 | async def import_anyio(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC116_ASYNC116.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC116_ASYNC116.py.snap index d6fade4d8a9a7..0fcc8aee96f53 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC116_ASYNC116.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC116_ASYNC116.py.snap @@ -11,16 +11,6 @@ ASYNC116.py:11:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -8 8 | import trio -9 9 | -10 10 | # These examples are probably not meant to ever wake up: -11 |- await trio.sleep(100000) # error: 116, "async" - 11 |+ await trio.sleep_forever() # error: 116, "async" -12 12 | -13 13 | # 'inf literal' overflow trick -14 14 | await trio.sleep(1e999) # error: 116, "async" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:14:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | @@ -32,16 +22,6 @@ ASYNC116.py:14:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -11 11 | await trio.sleep(100000) # error: 116, "async" -12 12 | -13 13 | # 'inf literal' overflow trick -14 |- await trio.sleep(1e999) # error: 116, "async" - 14 |+ await trio.sleep_forever() # error: 116, "async" -15 15 | -16 16 | await trio.sleep(86399) -17 17 | await trio.sleep(86400) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:18:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | @@ -53,16 +33,6 @@ ASYNC116.py:18:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -15 15 | -16 16 | await trio.sleep(86399) -17 17 | await trio.sleep(86400) -18 |- await trio.sleep(86400.01) # error: 116, "async" - 18 |+ await trio.sleep_forever() # error: 116, "async" -19 19 | await trio.sleep(86401) # error: 116, "async" -20 20 | -21 21 | await trio.sleep(-1) # will raise a runtime error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:19:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | @@ -75,16 +45,6 @@ ASYNC116.py:19:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -16 16 | await trio.sleep(86399) -17 17 | await trio.sleep(86400) -18 18 | await trio.sleep(86400.01) # error: 116, "async" -19 |- await trio.sleep(86401) # error: 116, "async" - 19 |+ await trio.sleep_forever() # error: 116, "async" -20 20 | -21 21 | await trio.sleep(-1) # will raise a runtime error -22 22 | await trio.sleep(0) # handled by different check - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:48:5: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | @@ -96,16 +56,6 @@ ASYNC116.py:48:5: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usua | = help: Replace with `trio.sleep_forever()` -45 45 | import trio -46 46 | -47 47 | # does not require the call to be awaited, nor in an async fun -48 |- trio.sleep(86401) # error: 116, "async" - 48 |+ trio.sleep_forever() # error: 116, "async" -49 49 | # also checks that we don't break visit_Call -50 50 | trio.run(trio.sleep(86401)) # error: 116, "async" -51 51 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:50:14: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | @@ -116,16 +66,6 @@ ASYNC116.py:50:14: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -47 47 | # does not require the call to be awaited, nor in an async fun -48 48 | trio.sleep(86401) # error: 116, "async" -49 49 | # also checks that we don't break visit_Call -50 |- trio.run(trio.sleep(86401)) # error: 116, "async" - 50 |+ trio.run(trio.sleep_forever()) # error: 116, "async" -51 51 | -52 52 | -53 53 | async def import_from_trio(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:57:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usually be `trio.sleep_forever()` | @@ -135,24 +75,6 @@ ASYNC116.py:57:11: ASYNC116 [*] `trio.sleep()` with >24 hour interval should usu | = help: Replace with `trio.sleep_forever()` -2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. -3 3 | import math -4 4 | from math import inf - 5 |+from trio import sleep_forever -5 6 | -6 7 | -7 8 | async def import_trio(): --------------------------------------------------------------------------------- -54 55 | from trio import sleep -55 56 | -56 57 | # catch from import -57 |- await sleep(86401) # error: 116, "async" - 58 |+ await sleep_forever() # error: 116, "async" -58 59 | -59 60 | -60 61 | async def import_anyio(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:64:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` | @@ -164,24 +86,6 @@ ASYNC116.py:64:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. -3 3 | import math -4 4 | from math import inf - 5 |+from asyncio import sleep_forever -5 6 | -6 7 | -7 8 | async def import_trio(): --------------------------------------------------------------------------------- -61 62 | import anyio -62 63 | -63 64 | # These examples are probably not meant to ever wake up: -64 |- await anyio.sleep(100000) # error: 116, "async" - 65 |+ await sleep_forever() # error: 116, "async" -65 66 | -66 67 | # 'inf literal' overflow trick -67 68 | await anyio.sleep(1e999) # error: 116, "async" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:67:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` | @@ -193,24 +97,6 @@ ASYNC116.py:67:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. -3 3 | import math -4 4 | from math import inf - 5 |+from asyncio import sleep_forever -5 6 | -6 7 | -7 8 | async def import_trio(): --------------------------------------------------------------------------------- -64 65 | await anyio.sleep(100000) # error: 116, "async" -65 66 | -66 67 | # 'inf literal' overflow trick -67 |- await anyio.sleep(1e999) # error: 116, "async" - 68 |+ await sleep_forever() # error: 116, "async" -68 69 | -69 70 | await anyio.sleep(86399) -70 71 | await anyio.sleep(86400) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:71:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` | @@ -222,24 +108,6 @@ ASYNC116.py:71:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. -3 3 | import math -4 4 | from math import inf - 5 |+from asyncio import sleep_forever -5 6 | -6 7 | -7 8 | async def import_trio(): --------------------------------------------------------------------------------- -68 69 | -69 70 | await anyio.sleep(86399) -70 71 | await anyio.sleep(86400) -71 |- await anyio.sleep(86400.01) # error: 116, "async" - 72 |+ await sleep_forever() # error: 116, "async" -72 73 | await anyio.sleep(86401) # error: 116, "async" -73 74 | -74 75 | await anyio.sleep(-1) # will raise a runtime error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:72:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` | @@ -252,24 +120,6 @@ ASYNC116.py:72:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. -3 3 | import math -4 4 | from math import inf - 5 |+from asyncio import sleep_forever -5 6 | -6 7 | -7 8 | async def import_trio(): --------------------------------------------------------------------------------- -69 70 | await anyio.sleep(86399) -70 71 | await anyio.sleep(86400) -71 72 | await anyio.sleep(86400.01) # error: 116, "async" -72 |- await anyio.sleep(86401) # error: 116, "async" - 73 |+ await sleep_forever() # error: 116, "async" -73 74 | -74 75 | await anyio.sleep(-1) # will raise a runtime error -75 76 | await anyio.sleep(0) # handled by different check - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:101:5: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` | @@ -281,24 +131,6 @@ ASYNC116.py:101:5: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. -3 3 | import math -4 4 | from math import inf - 5 |+from asyncio import sleep_forever -5 6 | -6 7 | -7 8 | async def import_trio(): --------------------------------------------------------------------------------- -98 99 | import anyio -99 100 | -100 101 | # does not require the call to be awaited, nor in an async fun -101 |- anyio.sleep(86401) # error: 116, "async" - 102 |+ sleep_forever() # error: 116, "async" -102 103 | # also checks that we don't break visit_Call -103 104 | anyio.run(anyio.sleep(86401)) # error: 116, "async" -104 105 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:103:15: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` | @@ -309,24 +141,6 @@ ASYNC116.py:103:15: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | = help: Replace with `asyncio.sleep_forever()` -2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. -3 3 | import math -4 4 | from math import inf - 5 |+from asyncio import sleep_forever -5 6 | -6 7 | -7 8 | async def import_trio(): --------------------------------------------------------------------------------- -100 101 | # does not require the call to be awaited, nor in an async fun -101 102 | anyio.sleep(86401) # error: 116, "async" -102 103 | # also checks that we don't break visit_Call -103 |- anyio.run(anyio.sleep(86401)) # error: 116, "async" - 104 |+ anyio.run(sleep_forever()) # error: 116, "async" -104 105 | -105 106 | -106 107 | async def import_from_anyio(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. ASYNC116.py:110:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should usually be `asyncio.sleep_forever()` | @@ -335,19 +149,3 @@ ASYNC116.py:110:11: ASYNC116 [*] `asyncio.sleep()` with >24 hour interval should | ^^^^^^^^^^^^ ASYNC116 | = help: Replace with `asyncio.sleep_forever()` - -2 2 | # ASYNCIO_NO_ERROR - no asyncio.sleep_forever, so check intentionally doesn't trigger. -3 3 | import math -4 4 | from math import inf - 5 |+from asyncio import sleep_forever -5 6 | -6 7 | -7 8 | async def import_trio(): --------------------------------------------------------------------------------- -107 108 | from anyio import sleep -108 109 | -109 110 | # catch from import -110 |- await sleep(86401) # error: 116, "async" - 111 |+ await sleep_forever() # error: 116, "async" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap index bddc5b5759874..460c35027560b 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap @@ -11,12 +11,3 @@ B006_1.py:3:22: B006 [*] Do not use mutable data structures for argument default 5 | """ | = help: Replace with `None`; initialize within function - -1 1 | # Docstring followed by a newline -2 2 | -3 |-def foobar(foor, bar={}): - 3 |+def foobar(foor, bar=None): -4 4 | """ -5 5 | """ - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap index dca16c244a89b..26103aa42e38e 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap @@ -11,13 +11,3 @@ B006_2.py:4:22: B006 [*] Do not use mutable data structures for argument default 6 | """ | = help: Replace with `None`; initialize within function - -1 1 | # Docstring followed by whitespace with no newline -2 2 | # Regression test for https://github.com/astral-sh/ruff/issues/7155 -3 3 | -4 |-def foobar(foor, bar={}): - 4 |+def foobar(foor, bar=None): -5 5 | """ -6 6 | """ - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap index cca2c9b7a3870..2fd83184d6f07 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap @@ -9,13 +9,3 @@ B006_3.py:4:22: B006 [*] Do not use mutable data structures for argument default 6 | """ | = help: Replace with `None`; initialize within function - -1 1 | # Docstring with no newline -2 2 | -3 3 | -4 |-def foobar(foor, bar={}): - 4 |+def foobar(foor, bar=None): -5 5 | """ -6 6 | """ - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap index 869f866f1e8c9..ecec719296ef1 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap @@ -9,15 +9,3 @@ B006_4.py:7:26: B006 [*] Do not use mutable data structures for argument default 8 | print(a) | = help: Replace with `None`; initialize within function - -4 4 | -5 5 | -6 6 | class FormFeedIndent: -7 |- def __init__(self, a=[]): - 7 |+ def __init__(self, a=None): - 8 |+ if a is None: - 9 |+ a = [] -8 10 | print(a) -9 11 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap index 95c59c1f81442..a191efa5d825f 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap @@ -9,19 +9,6 @@ B006_5.py:5:49: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -2 2 | # https://github.com/astral-sh/ruff/issues/7616 -3 3 | -4 4 | -5 |-def import_module_wrong(value: dict[str, str] = {}): - 5 |+def import_module_wrong(value: dict[str, str] = None): -6 6 | import os - 7 |+ if value is None: - 8 |+ value = {} -7 9 | -8 10 | -9 11 | def import_module_with_values_wrong(value: dict[str, str] = {}): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_5.py:9:61: B006 [*] Do not use mutable data structures for argument defaults | @@ -31,20 +18,6 @@ B006_5.py:9:61: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -6 6 | import os -7 7 | -8 8 | -9 |-def import_module_with_values_wrong(value: dict[str, str] = {}): - 9 |+def import_module_with_values_wrong(value: dict[str, str] = None): -10 10 | import os -11 11 | - 12 |+ if value is None: - 13 |+ value = {} -12 14 | return 2 -13 15 | -14 16 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_5.py:15:50: B006 [*] Do not use mutable data structures for argument defaults | @@ -55,21 +28,6 @@ B006_5.py:15:50: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -12 12 | return 2 -13 13 | -14 14 | -15 |-def import_modules_wrong(value: dict[str, str] = {}): - 15 |+def import_modules_wrong(value: dict[str, str] = None): -16 16 | import os -17 17 | import sys -18 18 | import itertools - 19 |+ if value is None: - 20 |+ value = {} -19 21 | -20 22 | -21 23 | def from_import_module_wrong(value: dict[str, str] = {}): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_5.py:21:54: B006 [*] Do not use mutable data structures for argument defaults | @@ -79,19 +37,6 @@ B006_5.py:21:54: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -18 18 | import itertools -19 19 | -20 20 | -21 |-def from_import_module_wrong(value: dict[str, str] = {}): - 21 |+def from_import_module_wrong(value: dict[str, str] = None): -22 22 | from os import path - 23 |+ if value is None: - 24 |+ value = {} -23 25 | -24 26 | -25 27 | def from_imports_module_wrong(value: dict[str, str] = {}): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_5.py:25:55: B006 [*] Do not use mutable data structures for argument defaults | @@ -102,20 +47,6 @@ B006_5.py:25:55: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -22 22 | from os import path -23 23 | -24 24 | -25 |-def from_imports_module_wrong(value: dict[str, str] = {}): - 25 |+def from_imports_module_wrong(value: dict[str, str] = None): -26 26 | from os import path -27 27 | from sys import version_info - 28 |+ if value is None: - 29 |+ value = {} -28 30 | -29 31 | -30 32 | def import_and_from_imports_module_wrong(value: dict[str, str] = {}): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_5.py:30:66: B006 [*] Do not use mutable data structures for argument defaults | @@ -126,20 +57,6 @@ B006_5.py:30:66: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -27 27 | from sys import version_info -28 28 | -29 29 | -30 |-def import_and_from_imports_module_wrong(value: dict[str, str] = {}): - 30 |+def import_and_from_imports_module_wrong(value: dict[str, str] = None): -31 31 | import os -32 32 | from sys import version_info - 33 |+ if value is None: - 34 |+ value = {} -33 35 | -34 36 | -35 37 | def import_docstring_module_wrong(value: dict[str, str] = {}): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_5.py:35:59: B006 [*] Do not use mutable data structures for argument defaults | @@ -150,20 +67,6 @@ B006_5.py:35:59: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -32 32 | from sys import version_info -33 33 | -34 34 | -35 |-def import_docstring_module_wrong(value: dict[str, str] = {}): - 35 |+def import_docstring_module_wrong(value: dict[str, str] = None): -36 36 | """Docstring""" -37 37 | import os - 38 |+ if value is None: - 39 |+ value = {} -38 40 | -39 41 | -40 42 | def import_module_wrong(value: dict[str, str] = {}): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_5.py:40:49: B006 [*] Do not use mutable data structures for argument defaults | @@ -174,20 +77,6 @@ B006_5.py:40:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -37 37 | import os -38 38 | -39 39 | -40 |-def import_module_wrong(value: dict[str, str] = {}): - 40 |+def import_module_wrong(value: dict[str, str] = None): -41 41 | """Docstring""" -42 42 | import os; import sys - 43 |+ if value is None: - 44 |+ value = {} -43 45 | -44 46 | -45 47 | def import_module_wrong(value: dict[str, str] = {}): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_5.py:45:49: B006 [*] Do not use mutable data structures for argument defaults | @@ -198,19 +87,6 @@ B006_5.py:45:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -42 42 | import os; import sys -43 43 | -44 44 | -45 |-def import_module_wrong(value: dict[str, str] = {}): - 45 |+def import_module_wrong(value: dict[str, str] = None): -46 46 | """Docstring""" - 47 |+ if value is None: - 48 |+ value = {} -47 49 | import os; import sys; x = 1 -48 50 | -49 51 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_5.py:50:49: B006 [*] Do not use mutable data structures for argument defaults | @@ -221,20 +97,6 @@ B006_5.py:50:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -47 47 | import os; import sys; x = 1 -48 48 | -49 49 | -50 |-def import_module_wrong(value: dict[str, str] = {}): - 50 |+def import_module_wrong(value: dict[str, str] = None): -51 51 | """Docstring""" -52 52 | import os; import sys - 53 |+ if value is None: - 54 |+ value = {} -53 55 | -54 56 | -55 57 | def import_module_wrong(value: dict[str, str] = {}): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_5.py:55:49: B006 [*] Do not use mutable data structures for argument defaults | @@ -244,19 +106,6 @@ B006_5.py:55:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -52 52 | import os; import sys -53 53 | -54 54 | -55 |-def import_module_wrong(value: dict[str, str] = {}): - 55 |+def import_module_wrong(value: dict[str, str] = None): -56 56 | import os; import sys - 57 |+ if value is None: - 58 |+ value = {} -57 59 | -58 60 | -59 61 | def import_module_wrong(value: dict[str, str] = {}): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_5.py:59:49: B006 [*] Do not use mutable data structures for argument defaults | @@ -266,18 +115,6 @@ B006_5.py:59:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -56 56 | import os; import sys -57 57 | -58 58 | -59 |-def import_module_wrong(value: dict[str, str] = {}): - 59 |+def import_module_wrong(value: dict[str, str] = None): - 60 |+ if value is None: - 61 |+ value = {} -60 62 | import os; import sys; x = 1 -61 63 | -62 64 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_5.py:63:49: B006 [*] Do not use mutable data structures for argument defaults | @@ -287,19 +124,6 @@ B006_5.py:63:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -60 60 | import os; import sys; x = 1 -61 61 | -62 62 | -63 |-def import_module_wrong(value: dict[str, str] = {}): - 63 |+def import_module_wrong(value: dict[str, str] = None): -64 64 | import os; import sys - 65 |+ if value is None: - 66 |+ value = {} -65 67 | -66 68 | -67 69 | def import_module_wrong(value: dict[str, str] = {}): import os - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_5.py:67:49: B006 Do not use mutable data structures for argument defaults | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap index 6470227784340..f5d16539b70a5 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap @@ -10,15 +10,3 @@ B006_6.py:4:22: B006 [*] Do not use mutable data structures for argument default 5 | import os | = help: Replace with `None`; initialize within function - -1 1 | # Import followed by whitespace with no newline -2 2 | # Same as B006_2.py, but import instead of docstring -3 3 | -4 |-def foobar(foor, bar={}): -5 |- import os - 4 |+def foobar(foor, bar=None): - 5 |+ import os - 6 |+ if bar is None: - 7 |+ bar = {} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap index 0e62a1580c5e6..474740752b6bd 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap @@ -10,15 +10,3 @@ B006_7.py:4:22: B006 [*] Do not use mutable data structures for argument default 5 | import os | = help: Replace with `None`; initialize within function - -1 1 | # Import with no newline -2 2 | # Same as B006_3.py, but import instead of docstring -3 3 | -4 |-def foobar(foor, bar={}): -5 |- import os - 4 |+def foobar(foor, bar=None): - 5 |+ import os - 6 |+ if bar is None: - 7 |+ bar = {} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_8.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_8.py.snap index 3392fd3140832..b272c4bd30430 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_8.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_8.py.snap @@ -9,13 +9,6 @@ B006_8.py:1:19: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -1 |-def foo(a: list = []): - 1 |+def foo(a: list = None): -2 2 | raise NotImplementedError("") -3 3 | -4 4 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_8.py:5:19: B006 [*] Do not use mutable data structures for argument defaults | @@ -26,16 +19,6 @@ B006_8.py:5:19: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -2 2 | raise NotImplementedError("") -3 3 | -4 4 | -5 |-def bar(a: dict = {}): - 5 |+def bar(a: dict = None): -6 6 | """ This one also has a docstring""" -7 7 | raise NotImplementedError("and has some text in here") -8 8 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_8.py:10:19: B006 [*] Do not use mutable data structures for argument defaults | @@ -46,19 +29,6 @@ B006_8.py:10:19: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -7 7 | raise NotImplementedError("and has some text in here") -8 8 | -9 9 | -10 |-def baz(a: list = []): - 10 |+def baz(a: list = None): -11 11 | """This one raises a different exception""" - 12 |+ if a is None: - 13 |+ a = [] -12 14 | raise IndexError() -13 15 | -14 16 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_8.py:15:19: B006 [*] Do not use mutable data structures for argument defaults | @@ -68,16 +38,6 @@ B006_8.py:15:19: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -12 12 | raise IndexError() -13 13 | -14 14 | -15 |-def qux(a: list = []): - 15 |+def qux(a: list = None): -16 16 | raise NotImplementedError -17 17 | -18 18 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_8.py:19:20: B006 [*] Do not use mutable data structures for argument defaults | @@ -86,12 +46,3 @@ B006_8.py:19:20: B006 [*] Do not use mutable data structures for argument defaul 20 | raise NotImplemented | = help: Replace with `None`; initialize within function - -16 16 | raise NotImplementedError -17 17 | -18 18 | -19 |-def quux(a: list = []): - 19 |+def quux(a: list = None): -20 20 | raise NotImplemented - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap index fa1122a1d6258..472e1f674ad4d 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap @@ -9,16 +9,6 @@ B006_B008.py:63:25: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -60 60 | # Flag mutable literals/comprehensions -61 61 | -62 62 | -63 |-def this_is_wrong(value=[1, 2, 3]): - 63 |+def this_is_wrong(value=None): -64 64 | ... -65 65 | -66 66 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:67:30: B006 [*] Do not use mutable data structures for argument defaults | @@ -28,16 +18,6 @@ B006_B008.py:67:30: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -64 64 | ... -65 65 | -66 66 | -67 |-def this_is_also_wrong(value={}): - 67 |+def this_is_also_wrong(value=None): -68 68 | ... -69 69 | -70 70 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:73:52: B006 [*] Do not use mutable data structures for argument defaults | @@ -49,16 +29,6 @@ B006_B008.py:73:52: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -70 70 | -71 71 | class Foo: -72 72 | @staticmethod -73 |- def this_is_also_wrong_and_more_indented(value={}): - 73 |+ def this_is_also_wrong_and_more_indented(value=None): -74 74 | pass -75 75 | -76 76 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:77:31: B006 [*] Do not use mutable data structures for argument defaults | @@ -71,18 +41,6 @@ B006_B008.py:77:31: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -74 74 | pass -75 75 | -76 76 | -77 |-def multiline_arg_wrong(value={ -78 |- -79 |-}): - 77 |+def multiline_arg_wrong(value=None): -80 78 | ... -81 79 | -82 80 | def single_line_func_wrong(value = {}): ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:82:36: B006 Do not use mutable data structures for argument defaults | @@ -101,16 +59,6 @@ B006_B008.py:85:20: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -82 82 | def single_line_func_wrong(value = {}): ... -83 83 | -84 84 | -85 |-def and_this(value=set()): - 85 |+def and_this(value=None): -86 86 | ... -87 87 | -88 88 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:89:20: B006 [*] Do not use mutable data structures for argument defaults | @@ -120,16 +68,6 @@ B006_B008.py:89:20: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -86 86 | ... -87 87 | -88 88 | -89 |-def this_too(value=collections.OrderedDict()): - 89 |+def this_too(value=None): -90 90 | ... -91 91 | -92 92 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:93:32: B006 [*] Do not use mutable data structures for argument defaults | @@ -139,16 +77,6 @@ B006_B008.py:93:32: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -90 90 | ... -91 91 | -92 92 | -93 |-async def async_this_too(value=collections.defaultdict()): - 93 |+async def async_this_too(value=None): -94 94 | ... -95 95 | -96 96 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:97:26: B006 [*] Do not use mutable data structures for argument defaults | @@ -158,16 +86,6 @@ B006_B008.py:97:26: B006 [*] Do not use mutable data structures for argument def | = help: Replace with `None`; initialize within function -94 94 | ... -95 95 | -96 96 | -97 |-def dont_forget_me(value=collections.deque()): - 97 |+def dont_forget_me(value=None): -98 98 | ... -99 99 | -100 100 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:102:46: B006 [*] Do not use mutable data structures for argument defaults | @@ -178,16 +96,6 @@ B006_B008.py:102:46: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -99 99 | -100 100 | -101 101 | # N.B. we're also flagging the function call in the comprehension -102 |-def list_comprehension_also_not_okay(default=[i**2 for i in range(3)]): - 102 |+def list_comprehension_also_not_okay(default=None): -103 103 | pass -104 104 | -105 105 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:106:46: B006 [*] Do not use mutable data structures for argument defaults | @@ -197,16 +105,6 @@ B006_B008.py:106:46: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -103 103 | pass -104 104 | -105 105 | -106 |-def dict_comprehension_also_not_okay(default={i: i**2 for i in range(3)}): - 106 |+def dict_comprehension_also_not_okay(default=None): -107 107 | pass -108 108 | -109 109 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:110:45: B006 [*] Do not use mutable data structures for argument defaults | @@ -216,16 +114,6 @@ B006_B008.py:110:45: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -107 107 | pass -108 108 | -109 109 | -110 |-def set_comprehension_also_not_okay(default={i**2 for i in range(3)}): - 110 |+def set_comprehension_also_not_okay(default=None): -111 111 | pass -112 112 | -113 113 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:114:33: B006 [*] Do not use mutable data structures for argument defaults | @@ -235,16 +123,6 @@ B006_B008.py:114:33: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -111 111 | pass -112 112 | -113 113 | -114 |-def kwonlyargs_mutable(*, value=[]): - 114 |+def kwonlyargs_mutable(*, value=None): -115 115 | ... -116 116 | -117 117 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:239:20: B006 [*] Do not use mutable data structures for argument defaults | @@ -256,16 +134,6 @@ B006_B008.py:239:20: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -236 236 | -237 237 | # B006 and B008 -238 238 | # We should handle arbitrary nesting of these B008. -239 |-def nested_combo(a=[float(3), dt.datetime.now()]): - 239 |+def nested_combo(a=None): -240 240 | pass -241 241 | -242 242 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:276:27: B006 [*] Do not use mutable data structures for argument defaults | @@ -277,16 +145,6 @@ B006_B008.py:276:27: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -273 273 | -274 274 | -275 275 | def mutable_annotations( -276 |- a: list[int] | None = [], - 276 |+ a: list[int] | None = None, -277 277 | b: Optional[Dict[int, int]] = {}, -278 278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), -279 279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:277:35: B006 [*] Do not use mutable data structures for argument defaults | @@ -299,16 +157,6 @@ B006_B008.py:277:35: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -274 274 | -275 275 | def mutable_annotations( -276 276 | a: list[int] | None = [], -277 |- b: Optional[Dict[int, int]] = {}, - 277 |+ b: Optional[Dict[int, int]] = None, -278 278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), -279 279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), -280 280 | ): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:278:62: B006 [*] Do not use mutable data structures for argument defaults | @@ -321,16 +169,6 @@ B006_B008.py:278:62: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -275 275 | def mutable_annotations( -276 276 | a: list[int] | None = [], -277 277 | b: Optional[Dict[int, int]] = {}, -278 |- c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), - 278 |+ c: Annotated[Union[Set[str], abc.Sized], "annotation"] = None, -279 279 | d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), -280 280 | ): -281 281 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:279:80: B006 [*] Do not use mutable data structures for argument defaults | @@ -343,16 +181,6 @@ B006_B008.py:279:80: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -276 276 | a: list[int] | None = [], -277 277 | b: Optional[Dict[int, int]] = {}, -278 278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), -279 |- d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), - 279 |+ d: typing_extensions.Annotated[Union[Set[str], abc.Sized], "annotation"] = None, -280 280 | ): -281 281 | pass -282 282 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:284:52: B006 [*] Do not use mutable data structures for argument defaults | @@ -362,16 +190,6 @@ B006_B008.py:284:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -281 281 | pass -282 282 | -283 283 | -284 |-def single_line_func_wrong(value: dict[str, str] = {}): - 284 |+def single_line_func_wrong(value: dict[str, str] = None): -285 285 | """Docstring""" -286 286 | -287 287 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:288:52: B006 [*] Do not use mutable data structures for argument defaults | @@ -382,16 +200,6 @@ B006_B008.py:288:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -285 285 | """Docstring""" -286 286 | -287 287 | -288 |-def single_line_func_wrong(value: dict[str, str] = {}): - 288 |+def single_line_func_wrong(value: dict[str, str] = None): -289 289 | """Docstring""" -290 290 | ... -291 291 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:293:52: B006 [*] Do not use mutable data structures for argument defaults | @@ -401,16 +209,6 @@ B006_B008.py:293:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -290 290 | ... -291 291 | -292 292 | -293 |-def single_line_func_wrong(value: dict[str, str] = {}): - 293 |+def single_line_func_wrong(value: dict[str, str] = None): -294 294 | """Docstring"""; ... -295 295 | -296 296 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:297:52: B006 [*] Do not use mutable data structures for argument defaults | @@ -421,16 +219,6 @@ B006_B008.py:297:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -294 294 | """Docstring"""; ... -295 295 | -296 296 | -297 |-def single_line_func_wrong(value: dict[str, str] = {}): - 297 |+def single_line_func_wrong(value: dict[str, str] = None): -298 298 | """Docstring"""; \ -299 299 | ... -300 300 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:302:52: B006 [*] Do not use mutable data structures for argument defaults | @@ -443,18 +231,6 @@ B006_B008.py:302:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -299 299 | ... -300 300 | -301 301 | -302 |-def single_line_func_wrong(value: dict[str, str] = { -303 |- # This is a comment -304 |-}): - 302 |+def single_line_func_wrong(value: dict[str, str] = None): -305 303 | """Docstring""" -306 304 | -307 305 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B006_B008.py:308:52: B006 Do not use mutable data structures for argument defaults | @@ -472,12 +248,3 @@ B006_B008.py:313:52: B006 [*] Do not use mutable data structures for argument de 314 | """Docstring without newline""" | = help: Replace with `None`; initialize within function - -310 310 | """Docstring""" -311 311 | -312 312 | -313 |-def single_line_func_wrong(value: dict[str, str] = {}): - 313 |+def single_line_func_wrong(value: dict[str, str] = None): -314 314 | """Docstring without newline""" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap index 042e32ef61f85..c30babd832ab5 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap @@ -21,16 +21,6 @@ B007.py:18:13: B007 [*] Loop control variable `k` not used within loop body | = help: Rename unused `k` to `_k` -15 15 | -16 16 | for i in range(10): -17 17 | for j in range(10): -18 |- for k in range(10): # k not used, i and j used transitively - 18 |+ for _k in range(10): # k not used, i and j used transitively -19 19 | print(i + j) -20 20 | -21 21 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B007.py:30:5: B007 Loop control variable `i` not used within loop body | @@ -48,16 +38,6 @@ B007.py:30:13: B007 [*] Loop control variable `k` not used within loop body | = help: Rename unused `k` to `_k` -27 27 | yield i, (j, (k, l)) -28 28 | -29 29 | -30 |-for i, (j, (k, l)) in strange_generator(): # i, k not used - 30 |+for i, (j, (_k, l)) in strange_generator(): # i, k not used -31 31 | print(j, l) -32 32 | -33 33 | FMT = "{foo} {bar}" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B007.py:34:10: B007 Loop control variable `bar` may not be used within loop body | @@ -112,16 +92,6 @@ B007.py:52:14: B007 [*] Loop control variable `bar` not used within loop body | = help: Rename unused `bar` to `_bar` -49 49 | -50 50 | def f(): -51 51 | # Fixable. -52 |- for foo, bar, baz in (["1", "2", "3"],): - 52 |+ for foo, _bar, baz in (["1", "2", "3"],): -53 53 | if foo or baz: -54 54 | break -55 55 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B007.py:59:14: B007 Loop control variable `bar` not used within loop body | @@ -145,16 +115,6 @@ B007.py:68:14: B007 [*] Loop control variable `bar` not used within loop body | = help: Rename unused `bar` to `_bar` -65 65 | -66 66 | def f(): -67 67 | # Fixable. -68 |- for foo, bar, baz in (["1", "2", "3"],): - 68 |+ for foo, _bar, baz in (["1", "2", "3"],): -69 69 | if foo or baz: -70 70 | break -71 71 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B007.py:77:14: B007 Loop control variable `bar` not used within loop body | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap index 1b5bd4e01c1c0..51a8dd887b015 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap @@ -11,15 +11,6 @@ B011.py:8:8: B011 [*] Do not `assert False` (`python -O` removes these calls), r | = help: Replace `assert False` -5 5 | """ -6 6 | -7 7 | assert 1 != 2 -8 |-assert False - 8 |+raise AssertionError() -9 9 | assert 1 != 2, "message" -10 10 | assert False, "message" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. B011.py:10:8: B011 [*] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()` | @@ -29,11 +20,3 @@ B011.py:10:8: B011 [*] Do not `assert False` (`python -O` removes these calls), | ^^^^^ B011 | = help: Replace `assert False` - -7 7 | assert 1 != 2 -8 8 | assert False -9 9 | assert 1 != 2, "message" -10 |-assert False, "message" - 10 |+raise AssertionError("message") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap index 64bfc95352a57..16ca3d8f6d558 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap @@ -8,12 +8,3 @@ B006_extended.py:17:55: B006 [*] Do not use mutable data structures for argument 18 | ... | = help: Replace with `None`; initialize within function - -14 14 | ... -15 15 | -16 16 | -17 |-def error_due_to_missing_import(foo: ImmutableTypeA = []): - 17 |+def error_due_to_missing_import(foo: ImmutableTypeA = None): -18 18 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap index e4f87ae1f34c1..599ecd3ecaa0c 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap @@ -11,14 +11,6 @@ C400.py:2:13: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | = help: Rewrite as a `list` comprehension -1 1 | # Cannot combine with C416. Should use list comprehension here. -2 |-even_nums = list(2 * x for x in range(3)) - 2 |+even_nums = [2 * x for x in range(3)] -3 3 | odd_nums = list( -4 4 | 2 * x + 1 for x in range(3) -5 5 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C400.py:3:12: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | @@ -32,18 +24,6 @@ C400.py:3:12: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | = help: Rewrite as a `list` comprehension -1 1 | # Cannot combine with C416. Should use list comprehension here. -2 2 | even_nums = list(2 * x for x in range(3)) -3 |-odd_nums = list( - 3 |+odd_nums = [ -4 4 | 2 * x + 1 for x in range(3) -5 |-) - 5 |+] -6 6 | -7 7 | -8 8 | # Short-circuit case, combine with C416 and should produce x = list(range(3)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C400.py:9:5: C400 [*] Unnecessary generator (rewrite using `list()`) | @@ -55,16 +35,6 @@ C400.py:9:5: C400 [*] Unnecessary generator (rewrite using `list()`) | = help: Rewrite using `list()` -6 6 | -7 7 | -8 8 | # Short-circuit case, combine with C416 and should produce x = list(range(3)) -9 |-x = list(x for x in range(3)) - 9 |+x = list(range(3)) -10 10 | x = list( -11 11 | x for x in range(3) -12 12 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C400.py:10:5: C400 [*] Unnecessary generator (rewrite using `list()`) | @@ -80,18 +50,6 @@ C400.py:10:5: C400 [*] Unnecessary generator (rewrite using `list()`) | = help: Rewrite using `list()` -7 7 | -8 8 | # Short-circuit case, combine with C416 and should produce x = list(range(3)) -9 9 | x = list(x for x in range(3)) -10 |-x = list( -11 |- x for x in range(3) -12 |-) - 10 |+x = list(range(3)) -13 11 | -14 12 | # Strip parentheses from inner generators. -15 13 | list((2 * x for x in range(3))) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C400.py:15:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | @@ -103,16 +61,6 @@ C400.py:15:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | = help: Rewrite as a `list` comprehension -12 12 | ) -13 13 | -14 14 | # Strip parentheses from inner generators. -15 |-list((2 * x for x in range(3))) - 15 |+[2 * x for x in range(3)] -16 16 | list(((2 * x for x in range(3)))) -17 17 | list((((2 * x for x in range(3))))) -18 18 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C400.py:16:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | @@ -124,16 +72,6 @@ C400.py:16:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | = help: Rewrite as a `list` comprehension -13 13 | -14 14 | # Strip parentheses from inner generators. -15 15 | list((2 * x for x in range(3))) -16 |-list(((2 * x for x in range(3)))) - 16 |+[2 * x for x in range(3)] -17 17 | list((((2 * x for x in range(3))))) -18 18 | -19 19 | # Not built-in list. - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C400.py:17:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | @@ -145,14 +83,3 @@ C400.py:17:1: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) 19 | # Not built-in list. | = help: Rewrite as a `list` comprehension - -14 14 | # Strip parentheses from inner generators. -15 15 | list((2 * x for x in range(3))) -16 16 | list(((2 * x for x in range(3)))) -17 |-list((((2 * x for x in range(3))))) - 17 |+[2 * x for x in range(3)] -18 18 | -19 19 | # Not built-in list. -20 20 | def list(*args, **kwargs): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap index 9cd8caeb0168c..4f516e4342046 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap @@ -11,14 +11,6 @@ C401.py:2:13: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -1 1 | # Cannot conbime with C416. Should use set comprehension here. -2 |-even_nums = set(2 * x for x in range(3)) - 2 |+even_nums = {2 * x for x in range(3)} -3 3 | odd_nums = set( -4 4 | 2 * x + 1 for x in range(3) -5 5 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C401.py:3:12: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | @@ -33,18 +25,6 @@ C401.py:3:12: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -1 1 | # Cannot conbime with C416. Should use set comprehension here. -2 2 | even_nums = set(2 * x for x in range(3)) -3 |-odd_nums = set( - 3 |+odd_nums = { -4 4 | 2 * x + 1 for x in range(3) -5 |-) - 5 |+} -6 6 | small_nums = f"{set(a if a < 6 else 0 for a in range(3))}" -7 7 | -8 8 | def f(x): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C401.py:6:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | @@ -57,16 +37,6 @@ C401.py:6:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -3 3 | odd_nums = set( -4 4 | 2 * x + 1 for x in range(3) -5 5 | ) -6 |-small_nums = f"{set(a if a < 6 else 0 for a in range(3))}" - 6 |+small_nums = f"{ {a if a < 6 else 0 for a in range(3)} }" -7 7 | -8 8 | def f(x): -9 9 | return x - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C401.py:11:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | @@ -78,16 +48,6 @@ C401.py:11:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -8 8 | def f(x): -9 9 | return x -10 10 | -11 |-print(f"Hello {set(f(a) for a in 'abc')} World") - 11 |+print(f"Hello { {f(a) for a in 'abc'} } World") -12 12 | print(f"Hello { set(f(a) for a in 'abc') } World") -13 13 | -14 14 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C401.py:12:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | @@ -97,16 +57,6 @@ C401.py:12:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -9 9 | return x -10 10 | -11 11 | print(f"Hello {set(f(a) for a in 'abc')} World") -12 |-print(f"Hello { set(f(a) for a in 'abc') } World") - 12 |+print(f"Hello { {f(a) for a in 'abc'} } World") -13 13 | -14 14 | -15 15 | # Short-circuit case, combine with C416 and should produce x = set(range(3)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C401.py:16:5: C401 [*] Unnecessary generator (rewrite using `set()` | @@ -118,16 +68,6 @@ C401.py:16:5: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -13 13 | -14 14 | -15 15 | # Short-circuit case, combine with C416 and should produce x = set(range(3)) -16 |-x = set(x for x in range(3)) - 16 |+x = set(range(3)) -17 17 | x = set( -18 18 | x for x in range(3) -19 19 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C401.py:17:5: C401 [*] Unnecessary generator (rewrite using `set()` | @@ -143,18 +83,6 @@ C401.py:17:5: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -14 14 | -15 15 | # Short-circuit case, combine with C416 and should produce x = set(range(3)) -16 16 | x = set(x for x in range(3)) -17 |-x = set( -18 |- x for x in range(3) -19 |-) - 17 |+x = set(range(3)) -20 18 | print(f"Hello {set(a for a in range(3))} World") -21 19 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") -22 20 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C401.py:20:16: C401 [*] Unnecessary generator (rewrite using `set()` | @@ -167,16 +95,6 @@ C401.py:20:16: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -17 17 | x = set( -18 18 | x for x in range(3) -19 19 | ) -20 |-print(f"Hello {set(a for a in range(3))} World") - 20 |+print(f"Hello {set(range(3))} World") -21 21 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") -22 22 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }") -23 23 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C401.py:21:10: C401 [*] Unnecessary generator (rewrite using `set()` | @@ -188,16 +106,6 @@ C401.py:21:10: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -18 18 | x for x in range(3) -19 19 | ) -20 20 | print(f"Hello {set(a for a in range(3))} World") -21 |-print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") - 21 |+print(f"{set('abc') - set(a for a in 'ab')}") -22 22 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }") -23 23 | -24 24 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C401.py:21:34: C401 [*] Unnecessary generator (rewrite using `set()` | @@ -209,16 +117,6 @@ C401.py:21:34: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -18 18 | x for x in range(3) -19 19 | ) -20 20 | print(f"Hello {set(a for a in range(3))} World") -21 |-print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") - 21 |+print(f"{set(a for a in 'abc') - set('ab')}") -22 22 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }") -23 23 | -24 24 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C401.py:22:11: C401 [*] Unnecessary generator (rewrite using `set()` | @@ -229,16 +127,6 @@ C401.py:22:11: C401 [*] Unnecessary generator (rewrite using `set()` | = help: Rewrite using `set()` -19 19 | ) -20 20 | print(f"Hello {set(a for a in range(3))} World") -21 21 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") -22 |-print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }") - 22 |+print(f"{ set('abc') - set(a for a in 'ab') }") -23 23 | -24 24 | -25 25 | # Not built-in set. - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C401.py:22:35: C401 [*] Unnecessary generator (rewrite using `set()` | @@ -248,14 +136,3 @@ C401.py:22:35: C401 [*] Unnecessary generator (rewrite using `set()` | ^^^^^^^^^^^^^^^^^^^^ C401 | = help: Rewrite using `set()` - -19 19 | ) -20 20 | print(f"Hello {set(a for a in range(3))} World") -21 21 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") -22 |-print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }") - 22 |+print(f"{ set(a for a in 'abc') - set('ab') }") -23 23 | -24 24 | -25 25 | # Not built-in set. - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap index 2ccb48841de2b..adbc120aaa6c8 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap @@ -10,13 +10,6 @@ C402.py:1:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -1 |-dict((x, x) for x in range(3)) - 1 |+{x: x for x in range(3)} -2 2 | dict( -3 3 | (x, x) for x in range(3) -4 4 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C402.py:2:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | @@ -30,18 +23,6 @@ C402.py:2:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -1 1 | dict((x, x) for x in range(3)) -2 |-dict( -3 |- (x, x) for x in range(3) -4 |-) - 2 |+{ - 3 |+ x: x for x in range(3) - 4 |+} -5 5 | dict(((x, x) for x in range(3)), z=3) -6 6 | y = f'{dict((x, x) for x in range(3))}' -7 7 | print(f'Hello {dict((x, x) for x in range(3))} World') - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C402.py:6:8: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | @@ -54,16 +35,6 @@ C402.py:6:8: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -3 3 | (x, x) for x in range(3) -4 4 | ) -5 5 | dict(((x, x) for x in range(3)), z=3) -6 |-y = f'{dict((x, x) for x in range(3))}' - 6 |+y = f'{ {x: x for x in range(3)} }' -7 7 | print(f'Hello {dict((x, x) for x in range(3))} World') -8 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") -9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C402.py:7:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | @@ -76,16 +47,6 @@ C402.py:7:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -4 4 | ) -5 5 | dict(((x, x) for x in range(3)), z=3) -6 6 | y = f'{dict((x, x) for x in range(3))}' -7 |-print(f'Hello {dict((x, x) for x in range(3))} World') - 7 |+print(f'Hello { {x: x for x in range(3)} } World') -8 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") -9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') -10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C402.py:8:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | @@ -98,16 +59,6 @@ C402.py:8:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -5 5 | dict(((x, x) for x in range(3)), z=3) -6 6 | y = f'{dict((x, x) for x in range(3))}' -7 7 | print(f'Hello {dict((x, x) for x in range(3))} World') -8 |-print(f"Hello {dict((x, x) for x in 'abc')} World") - 8 |+print(f"Hello { {x: x for x in 'abc'} } World") -9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') -10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') -11 11 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C402.py:9:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | @@ -119,16 +70,6 @@ C402.py:9:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -6 6 | y = f'{dict((x, x) for x in range(3))}' -7 7 | print(f'Hello {dict((x, x) for x in range(3))} World') -8 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") -9 |-print(f'Hello {dict((x, x) for x in "abc")} World') - 9 |+print(f'Hello { {x: x for x in "abc"} } World') -10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') -11 11 | -12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C402.py:10:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | @@ -141,16 +82,6 @@ C402.py:10:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension | = help: Rewrite as a `dict` comprehension -7 7 | print(f'Hello {dict((x, x) for x in range(3))} World') -8 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") -9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') -10 |-print(f'Hello {dict((x,x) for x in "abc")} World') - 10 |+print(f'Hello { {x: x for x in "abc"} } World') -11 11 | -12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' -13 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C402.py:12:4: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | @@ -162,16 +93,6 @@ C402.py:12:4: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') -10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') -11 11 | -12 |-f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' - 12 |+f'{ {x: x for x in range(3)} | dict((x, x) for x in range(3))}' -13 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' -14 14 | -15 15 | def f(x): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C402.py:12:37: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | @@ -183,16 +104,6 @@ C402.py:12:37: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension | = help: Rewrite as a `dict` comprehension -9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') -10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') -11 11 | -12 |-f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' - 12 |+f'{dict((x, x) for x in range(3)) | {x: x for x in range(3)} }' -13 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' -14 14 | -15 15 | def f(x): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C402.py:13:5: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | @@ -204,16 +115,6 @@ C402.py:13:5: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') -11 11 | -12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' -13 |-f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' - 13 |+f'{ {x: x for x in range(3)} | dict((x, x) for x in range(3)) }' -14 14 | -15 15 | def f(x): -16 16 | return x - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C402.py:13:38: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | @@ -225,16 +126,6 @@ C402.py:13:38: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension | = help: Rewrite as a `dict` comprehension -10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') -11 11 | -12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' -13 |-f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' - 13 |+f'{ dict((x, x) for x in range(3)) | {x: x for x in range(3)} }' -14 14 | -15 15 | def f(x): -16 16 | return x - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C402.py:18:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | @@ -247,16 +138,6 @@ C402.py:18:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension | = help: Rewrite as a `dict` comprehension -15 15 | def f(x): -16 16 | return x -17 17 | -18 |-print(f'Hello {dict((x,f(x)) for x in "abc")} World') - 18 |+print(f'Hello { {x: f(x) for x in "abc"} } World') -19 19 | -20 20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086 -21 21 | dict((k,v)for k,v in d.iteritems() if k in only_args) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C402.py:21:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | @@ -267,14 +148,3 @@ C402.py:21:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) 23 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458940 | = help: Rewrite as a `dict` comprehension - -18 18 | print(f'Hello {dict((x,f(x)) for x in "abc")} World') -19 19 | -20 20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086 -21 |-dict((k,v)for k,v in d.iteritems() if k in only_args) - 21 |+{k: v for k,v in d.iteritems() if k in only_args} -22 22 | -23 23 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458940 -24 24 | dict((*v, k) for k, v in enumerate(calendar.month_abbr)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap index 278ca19df7ffe..8884aaa82953a 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap @@ -10,13 +10,6 @@ C403.py:1:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr | = help: Rewrite as a `set` comprehension -1 |-s = set([x for x in range(3)]) - 1 |+s = {x for x in range(3)} -2 2 | s = set( -3 3 | [x for x in range(3)] -4 4 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C403.py:2:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | @@ -31,18 +24,6 @@ C403.py:2:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr | = help: Rewrite as a `set` comprehension -1 1 | s = set([x for x in range(3)]) -2 |-s = set( -3 |- [x for x in range(3)] -4 |-) - 2 |+s = { - 3 |+ x for x in range(3) - 4 |+} -5 5 | -6 6 | s = f"{set([x for x in 'ab'])}" -7 7 | s = f'{set([x for x in "ab"])}' - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C403.py:6:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | @@ -54,16 +35,6 @@ C403.py:6:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr | = help: Rewrite as a `set` comprehension -3 3 | [x for x in range(3)] -4 4 | ) -5 5 | -6 |-s = f"{set([x for x in 'ab'])}" - 6 |+s = f"{ {x for x in 'ab'} }" -7 7 | s = f'{set([x for x in "ab"])}' -8 8 | -9 9 | def f(x): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C403.py:7:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | @@ -75,16 +46,6 @@ C403.py:7:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr | = help: Rewrite as a `set` comprehension -4 4 | ) -5 5 | -6 6 | s = f"{set([x for x in 'ab'])}" -7 |-s = f'{set([x for x in "ab"])}' - 7 |+s = f'{ {x for x in "ab"} }' -8 8 | -9 9 | def f(x): -10 10 | return x - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C403.py:12:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | @@ -97,16 +58,6 @@ C403.py:12:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | = help: Rewrite as a `set` comprehension -9 9 | def f(x): -10 10 | return x -11 11 | -12 |-s = f"{set([f(x) for x in 'ab'])}" - 12 |+s = f"{ {f(x) for x in 'ab'} }" -13 13 | -14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" -15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C403.py:14:9: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | @@ -118,16 +69,6 @@ C403.py:14:9: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | = help: Rewrite as a `set` comprehension -11 11 | -12 12 | s = f"{set([f(x) for x in 'ab'])}" -13 13 | -14 |-s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" - 14 |+s = f"{ {x for x in 'ab'} | set([x for x in 'ab']) }" -15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" -16 16 | -17 17 | s = set( # comment - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C403.py:14:34: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | @@ -139,16 +80,6 @@ C403.py:14:34: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` com | = help: Rewrite as a `set` comprehension -11 11 | -12 12 | s = f"{set([f(x) for x in 'ab'])}" -13 13 | -14 |-s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" - 14 |+s = f"{ set([x for x in 'ab']) | {x for x in 'ab'} }" -15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" -16 16 | -17 17 | s = set( # comment - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C403.py:15:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | @@ -160,16 +91,6 @@ C403.py:15:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | = help: Rewrite as a `set` comprehension -12 12 | s = f"{set([f(x) for x in 'ab'])}" -13 13 | -14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" -15 |-s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" - 15 |+s = f"{ {x for x in 'ab'} | set([x for x in 'ab'])}" -16 16 | -17 17 | s = set( # comment -18 18 | [x for x in range(3)] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C403.py:15:33: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | @@ -181,16 +102,6 @@ C403.py:15:33: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` com | = help: Rewrite as a `set` comprehension -12 12 | s = f"{set([f(x) for x in 'ab'])}" -13 13 | -14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" -15 |-s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" - 15 |+s = f"{set([x for x in 'ab']) | {x for x in 'ab'} }" -16 16 | -17 17 | s = set( # comment -18 18 | [x for x in range(3)] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C403.py:17:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | @@ -206,20 +117,6 @@ C403.py:17:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | = help: Rewrite as a `set` comprehension -14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" -15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" -16 16 | -17 |-s = set( # comment -18 |- [x for x in range(3)] -19 |-) - 17 |+s = { # comment - 18 |+ x for x in range(3) - 19 |+} -20 20 | -21 21 | s = set([ # comment -22 22 | x for x in range(3) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C403.py:21:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | @@ -232,14 +129,3 @@ C403.py:21:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | |__^ C403 | = help: Rewrite as a `set` comprehension - -18 18 | [x for x in range(3)] -19 19 | ) -20 20 | -21 |-s = set([ # comment - 21 |+s = { # comment -22 22 | x for x in range(3) -23 |-]) - 23 |+} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap index a724d69479164..1624bbe22f63e 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap @@ -9,13 +9,6 @@ C404.py:1:1: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp | = help: Rewrite as a `dict` comprehension -1 |-dict([(i, i) for i in range(3)]) - 1 |+{i: i for i in range(3)} -2 2 | dict([(i, i) for i in range(3)], z=4) -3 3 | -4 4 | def f(x): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C404.py:7:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | @@ -28,16 +21,6 @@ C404.py:7:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp | = help: Rewrite as a `dict` comprehension -4 4 | def f(x): -5 5 | return x -6 6 | -7 |-f'{dict([(s,s) for s in "ab"])}' - 7 |+f'{ {s: s for s in "ab"} }' -8 8 | f"{dict([(s,s) for s in 'ab'])}" -9 9 | f"{dict([(s, s) for s in 'ab'])}" -10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C404.py:8:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | @@ -49,16 +32,6 @@ C404.py:8:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp | = help: Rewrite as a `dict` comprehension -5 5 | return x -6 6 | -7 7 | f'{dict([(s,s) for s in "ab"])}' -8 |-f"{dict([(s,s) for s in 'ab'])}" - 8 |+f"{ {s: s for s in 'ab'} }" -9 9 | f"{dict([(s, s) for s in 'ab'])}" -10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" -11 11 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C404.py:9:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | @@ -70,16 +43,6 @@ C404.py:9:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp | = help: Rewrite as a `dict` comprehension -6 6 | -7 7 | f'{dict([(s,s) for s in "ab"])}' -8 8 | f"{dict([(s,s) for s in 'ab'])}" -9 |-f"{dict([(s, s) for s in 'ab'])}" - 9 |+f"{ {s: s for s in 'ab'} }" -10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" -11 11 | -12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C404.py:10:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | @@ -92,16 +55,6 @@ C404.py:10:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com | = help: Rewrite as a `dict` comprehension -7 7 | f'{dict([(s,s) for s in "ab"])}' -8 8 | f"{dict([(s,s) for s in 'ab'])}" -9 9 | f"{dict([(s, s) for s in 'ab'])}" -10 |-f"{dict([(s,f(s)) for s in 'ab'])}" - 10 |+f"{ {s: f(s) for s in 'ab'} }" -11 11 | -12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' -13 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C404.py:12:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | @@ -113,16 +66,6 @@ C404.py:12:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com | = help: Rewrite as a `dict` comprehension -9 9 | f"{dict([(s, s) for s in 'ab'])}" -10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" -11 11 | -12 |-f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' - 12 |+f'{ {s: s for s in "ab"} | dict([(s,s) for s in "ab"])}' -13 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' -14 14 | -15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C404.py:12:34: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | @@ -134,16 +77,6 @@ C404.py:12:34: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co | = help: Rewrite as a `dict` comprehension -9 9 | f"{dict([(s, s) for s in 'ab'])}" -10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" -11 11 | -12 |-f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' - 12 |+f'{dict([(s,s) for s in "ab"]) | {s: s for s in "ab"} }' -13 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' -14 14 | -15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C404.py:13:5: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | @@ -155,16 +88,6 @@ C404.py:13:5: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com | = help: Rewrite as a `dict` comprehension -10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" -11 11 | -12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' -13 |-f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' - 13 |+f'{ {s: s for s in "ab"} | dict([(s,s) for s in "ab"]) }' -14 14 | -15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 -16 16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]])) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C404.py:13:35: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | @@ -176,16 +99,6 @@ C404.py:13:35: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co | = help: Rewrite as a `dict` comprehension -10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" -11 11 | -12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' -13 |-f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' - 13 |+f'{ dict([(s,s) for s in "ab"]) | {s: s for s in "ab"} }' -14 14 | -15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 -16 16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]])) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C404.py:16:14: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | @@ -194,11 +107,3 @@ C404.py:16:14: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C404 | = help: Rewrite as a `dict` comprehension - -13 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' -14 14 | -15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 -16 |-saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]])) - 16 |+saved.append({k: v for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]}) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap index 2d04098d2bccd..8a02f1636a5fa 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap @@ -10,13 +10,6 @@ C405.py:1:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -1 |-set([1, 2]) - 1 |+{1, 2} -2 2 | set((1, 2)) -3 3 | set([]) -4 4 | set(()) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:2:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | @@ -28,14 +21,6 @@ C405.py:2:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -1 1 | set([1, 2]) -2 |-set((1, 2)) - 2 |+{1, 2} -3 3 | set([]) -4 4 | set(()) -5 5 | set() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:3:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | @@ -48,15 +33,6 @@ C405.py:3:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -1 1 | set([1, 2]) -2 2 | set((1, 2)) -3 |-set([]) - 3 |+set() -4 4 | set(()) -5 5 | set() -6 6 | set((1,)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:4:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | @@ -69,17 +45,6 @@ C405.py:4:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -1 1 | set([1, 2]) -2 2 | set((1, 2)) -3 3 | set([]) -4 |-set(()) -5 4 | set() - 5 |+set() -6 6 | set((1,)) -7 7 | set(( -8 8 | 1, - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:6:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | @@ -92,16 +57,6 @@ C405.py:6:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -3 3 | set([]) -4 4 | set(()) -5 5 | set() -6 |-set((1,)) - 6 |+{1} -7 7 | set(( -8 8 | 1, -9 9 | )) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:7:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | @@ -116,19 +71,6 @@ C405.py:7:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -4 4 | set(()) -5 5 | set() -6 6 | set((1,)) -7 |-set(( - 7 |+{ -8 8 | 1, -9 |-)) - 9 |+} -10 10 | set([ -11 11 | 1, -12 12 | ]) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:10:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | @@ -143,19 +85,6 @@ C405.py:10:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -7 7 | set(( -8 8 | 1, -9 9 | )) -10 |-set([ - 10 |+{ -11 11 | 1, -12 |-]) - 12 |+} -13 13 | set( -14 14 | (1,) -15 15 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:13:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | @@ -170,18 +99,6 @@ C405.py:13:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -10 10 | set([ -11 11 | 1, -12 12 | ]) -13 |-set( -14 |- (1,) -15 |-) - 13 |+{1} -16 14 | set( -17 15 | [1,] -18 16 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:16:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | @@ -196,18 +113,6 @@ C405.py:16:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -13 13 | set( -14 14 | (1,) -15 15 | ) -16 |-set( -17 |- [1,] -18 |-) - 16 |+{1,} -19 17 | f"{set([1,2,3])}" -20 18 | f"{set(['a', 'b'])}" -21 19 | f'{set(["a", "b"])}' - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:19:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | @@ -220,16 +125,6 @@ C405.py:19:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -16 16 | set( -17 17 | [1,] -18 18 | ) -19 |-f"{set([1,2,3])}" - 19 |+f"{ {1,2,3} }" -20 20 | f"{set(['a', 'b'])}" -21 21 | f'{set(["a", "b"])}' -22 22 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:20:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | @@ -241,16 +136,6 @@ C405.py:20:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -17 17 | [1,] -18 18 | ) -19 19 | f"{set([1,2,3])}" -20 |-f"{set(['a', 'b'])}" - 20 |+f"{ {'a', 'b'} }" -21 21 | f'{set(["a", "b"])}' -22 22 | -23 23 | f"{set(['a', 'b']) - set(['a'])}" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:21:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | @@ -263,16 +148,6 @@ C405.py:21:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -18 18 | ) -19 19 | f"{set([1,2,3])}" -20 20 | f"{set(['a', 'b'])}" -21 |-f'{set(["a", "b"])}' - 21 |+f'{ {"a", "b"} }' -22 22 | -23 23 | f"{set(['a', 'b']) - set(['a'])}" -24 24 | f"{ set(['a', 'b']) - set(['a']) }" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:23:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | @@ -285,16 +160,6 @@ C405.py:23:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -20 20 | f"{set(['a', 'b'])}" -21 21 | f'{set(["a", "b"])}' -22 22 | -23 |-f"{set(['a', 'b']) - set(['a'])}" - 23 |+f"{ {'a', 'b'} - set(['a'])}" -24 24 | f"{ set(['a', 'b']) - set(['a']) }" -25 25 | f"a {set(['a', 'b']) - set(['a'])} b" -26 26 | f"a { set(['a', 'b']) - set(['a']) } b" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:23:22: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | @@ -307,16 +172,6 @@ C405.py:23:22: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -20 20 | f"{set(['a', 'b'])}" -21 21 | f'{set(["a", "b"])}' -22 22 | -23 |-f"{set(['a', 'b']) - set(['a'])}" - 23 |+f"{set(['a', 'b']) - {'a'} }" -24 24 | f"{ set(['a', 'b']) - set(['a']) }" -25 25 | f"a {set(['a', 'b']) - set(['a'])} b" -26 26 | f"a { set(['a', 'b']) - set(['a']) } b" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:24:5: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | @@ -328,15 +183,6 @@ C405.py:24:5: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -21 21 | f'{set(["a", "b"])}' -22 22 | -23 23 | f"{set(['a', 'b']) - set(['a'])}" -24 |-f"{ set(['a', 'b']) - set(['a']) }" - 24 |+f"{ {'a', 'b'} - set(['a']) }" -25 25 | f"a {set(['a', 'b']) - set(['a'])} b" -26 26 | f"a { set(['a', 'b']) - set(['a']) } b" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:24:23: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | @@ -348,15 +194,6 @@ C405.py:24:23: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -21 21 | f'{set(["a", "b"])}' -22 22 | -23 23 | f"{set(['a', 'b']) - set(['a'])}" -24 |-f"{ set(['a', 'b']) - set(['a']) }" - 24 |+f"{ set(['a', 'b']) - {'a'} }" -25 25 | f"a {set(['a', 'b']) - set(['a'])} b" -26 26 | f"a { set(['a', 'b']) - set(['a']) } b" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:25:6: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | @@ -368,14 +205,6 @@ C405.py:25:6: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -22 22 | -23 23 | f"{set(['a', 'b']) - set(['a'])}" -24 24 | f"{ set(['a', 'b']) - set(['a']) }" -25 |-f"a {set(['a', 'b']) - set(['a'])} b" - 25 |+f"a { {'a', 'b'} - set(['a'])} b" -26 26 | f"a { set(['a', 'b']) - set(['a']) } b" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:25:24: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | @@ -387,14 +216,6 @@ C405.py:25:24: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -22 22 | -23 23 | f"{set(['a', 'b']) - set(['a'])}" -24 24 | f"{ set(['a', 'b']) - set(['a']) }" -25 |-f"a {set(['a', 'b']) - set(['a'])} b" - 25 |+f"a {set(['a', 'b']) - {'a'} } b" -26 26 | f"a { set(['a', 'b']) - set(['a']) } b" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:26:7: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | @@ -405,13 +226,6 @@ C405.py:26:7: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -23 23 | f"{set(['a', 'b']) - set(['a'])}" -24 24 | f"{ set(['a', 'b']) - set(['a']) }" -25 25 | f"a {set(['a', 'b']) - set(['a'])} b" -26 |-f"a { set(['a', 'b']) - set(['a']) } b" - 26 |+f"a { {'a', 'b'} - set(['a']) } b" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C405.py:26:25: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | @@ -421,11 +235,3 @@ C405.py:26:25: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | ^^^^^^^^^^ C405 | = help: Rewrite as a `set` literal - -23 23 | f"{set(['a', 'b']) - set(['a'])}" -24 24 | f"{ set(['a', 'b']) - set(['a']) }" -25 25 | f"a {set(['a', 'b']) - set(['a'])} b" -26 |-f"a { set(['a', 'b']) - set(['a']) } b" - 26 |+f"a { set(['a', 'b']) - {'a'} } b" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap index de5a2c649d433..1109d27ffe143 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap @@ -10,13 +10,6 @@ C406.py:1:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal) | = help: Rewrite as a `dict` literal -1 |-d1 = dict([(1, 2)]) - 1 |+d1 = {1: 2} -2 2 | d2 = dict(((1, 2),)) -3 3 | d3 = dict([]) -4 4 | d4 = dict(()) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C406.py:2:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) | @@ -28,14 +21,6 @@ C406.py:2:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) | = help: Rewrite as a `dict` literal -1 1 | d1 = dict([(1, 2)]) -2 |-d2 = dict(((1, 2),)) - 2 |+d2 = {1: 2,} -3 3 | d3 = dict([]) -4 4 | d4 = dict(()) -5 5 | d5 = dict() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C406.py:3:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal) | @@ -48,14 +33,6 @@ C406.py:3:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal) | = help: Rewrite as a `dict` literal -1 1 | d1 = dict([(1, 2)]) -2 2 | d2 = dict(((1, 2),)) -3 |-d3 = dict([]) - 3 |+d3 = {} -4 4 | d4 = dict(()) -5 5 | d5 = dict() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C406.py:4:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) | @@ -66,12 +43,3 @@ C406.py:4:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) 5 | d5 = dict() | = help: Rewrite as a `dict` literal - -1 1 | d1 = dict([(1, 2)]) -2 2 | d2 = dict(((1, 2),)) -3 3 | d3 = dict([]) -4 |-d4 = dict(()) - 4 |+d4 = {} -5 5 | d5 = dict() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap index 5cbb164a89a0e..9a67f24b8424f 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap @@ -10,13 +10,6 @@ C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | = help: Rewrite as a literal -1 |-t = tuple() - 1 |+t = () -2 2 | l = list() -3 3 | d1 = dict() -4 4 | d2 = dict(a=1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) | @@ -28,14 +21,6 @@ C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) | = help: Rewrite as a literal -1 1 | t = tuple() -2 |-l = list() - 2 |+l = [] -3 3 | d1 = dict() -4 4 | d2 = dict(a=1) -5 5 | d3 = dict(**d2) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -48,15 +33,6 @@ C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -1 1 | t = tuple() -2 2 | l = list() -3 |-d1 = dict() - 3 |+d1 = {} -4 4 | d2 = dict(a=1) -5 5 | d3 = dict(**d2) -6 6 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:4:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -68,16 +44,6 @@ C408.py:4:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -1 1 | t = tuple() -2 2 | l = list() -3 3 | d1 = dict() -4 |-d2 = dict(a=1) - 4 |+d2 = {"a": 1} -5 5 | d3 = dict(**d2) -6 6 | -7 7 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:14:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -90,16 +56,6 @@ C408.py:14:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -11 11 | -12 12 | a = list() -13 13 | -14 |-f"{dict(x='y')}" - 14 |+f"{ {'x': 'y'} }" -15 15 | f'{dict(x="y")}' -16 16 | f"{dict()}" -17 17 | f"a {dict()} b" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:15:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -111,16 +67,6 @@ C408.py:15:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -12 12 | a = list() -13 13 | -14 14 | f"{dict(x='y')}" -15 |-f'{dict(x="y")}' - 15 |+f'{ {"x": "y"} }' -16 16 | f"{dict()}" -17 17 | f"a {dict()} b" -18 18 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -132,16 +78,6 @@ C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -13 13 | -14 14 | f"{dict(x='y')}" -15 15 | f'{dict(x="y")}' -16 |-f"{dict()}" - 16 |+f"{ {} }" -17 17 | f"a {dict()} b" -18 18 | -19 19 | f"{dict(x='y') | dict(y='z')}" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -154,16 +90,6 @@ C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -14 14 | f"{dict(x='y')}" -15 15 | f'{dict(x="y")}' -16 16 | f"{dict()}" -17 |-f"a {dict()} b" - 17 |+f"a { {} } b" -18 18 | -19 19 | f"{dict(x='y') | dict(y='z')}" -20 20 | f"{ dict(x='y') | dict(y='z') }" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:19:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -176,16 +102,6 @@ C408.py:19:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -16 16 | f"{dict()}" -17 17 | f"a {dict()} b" -18 18 | -19 |-f"{dict(x='y') | dict(y='z')}" - 19 |+f"{ {'x': 'y'} | dict(y='z')}" -20 20 | f"{ dict(x='y') | dict(y='z') }" -21 21 | f"a {dict(x='y') | dict(y='z')} b" -22 22 | f"a { dict(x='y') | dict(y='z') } b" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:19:18: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -198,16 +114,6 @@ C408.py:19:18: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -16 16 | f"{dict()}" -17 17 | f"a {dict()} b" -18 18 | -19 |-f"{dict(x='y') | dict(y='z')}" - 19 |+f"{dict(x='y') | {'y': 'z'} }" -20 20 | f"{ dict(x='y') | dict(y='z') }" -21 21 | f"a {dict(x='y') | dict(y='z')} b" -22 22 | f"a { dict(x='y') | dict(y='z') } b" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:20:5: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -219,16 +125,6 @@ C408.py:20:5: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -17 17 | f"a {dict()} b" -18 18 | -19 19 | f"{dict(x='y') | dict(y='z')}" -20 |-f"{ dict(x='y') | dict(y='z') }" - 20 |+f"{ {'x': 'y'} | dict(y='z') }" -21 21 | f"a {dict(x='y') | dict(y='z')} b" -22 22 | f"a { dict(x='y') | dict(y='z') } b" -23 23 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:20:19: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -240,16 +136,6 @@ C408.py:20:19: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -17 17 | f"a {dict()} b" -18 18 | -19 19 | f"{dict(x='y') | dict(y='z')}" -20 |-f"{ dict(x='y') | dict(y='z') }" - 20 |+f"{ dict(x='y') | {'y': 'z'} }" -21 21 | f"a {dict(x='y') | dict(y='z')} b" -22 22 | f"a { dict(x='y') | dict(y='z') } b" -23 23 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:21:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -261,16 +147,6 @@ C408.py:21:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -18 18 | -19 19 | f"{dict(x='y') | dict(y='z')}" -20 20 | f"{ dict(x='y') | dict(y='z') }" -21 |-f"a {dict(x='y') | dict(y='z')} b" - 21 |+f"a { {'x': 'y'} | dict(y='z')} b" -22 22 | f"a { dict(x='y') | dict(y='z') } b" -23 23 | -24 24 | dict( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:21:20: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -282,16 +158,6 @@ C408.py:21:20: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -18 18 | -19 19 | f"{dict(x='y') | dict(y='z')}" -20 20 | f"{ dict(x='y') | dict(y='z') }" -21 |-f"a {dict(x='y') | dict(y='z')} b" - 21 |+f"a {dict(x='y') | {'y': 'z'} } b" -22 22 | f"a { dict(x='y') | dict(y='z') } b" -23 23 | -24 24 | dict( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:22:7: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -304,16 +170,6 @@ C408.py:22:7: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -19 19 | f"{dict(x='y') | dict(y='z')}" -20 20 | f"{ dict(x='y') | dict(y='z') }" -21 21 | f"a {dict(x='y') | dict(y='z')} b" -22 |-f"a { dict(x='y') | dict(y='z') } b" - 22 |+f"a { {'x': 'y'} | dict(y='z') } b" -23 23 | -24 24 | dict( -25 25 | # comment - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:22:21: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -326,16 +182,6 @@ C408.py:22:21: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -19 19 | f"{dict(x='y') | dict(y='z')}" -20 20 | f"{ dict(x='y') | dict(y='z') }" -21 21 | f"a {dict(x='y') | dict(y='z')} b" -22 |-f"a { dict(x='y') | dict(y='z') } b" - 22 |+f"a { dict(x='y') | {'y': 'z'} } b" -23 23 | -24 24 | dict( -25 25 | # comment - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:24:1: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -350,19 +196,6 @@ C408.py:24:1: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -21 21 | f"a {dict(x='y') | dict(y='z')} b" -22 22 | f"a { dict(x='y') | dict(y='z') } b" -23 23 | -24 |-dict( - 24 |+{ -25 25 | # comment -26 |-) - 26 |+} -27 27 | -28 28 | tuple( # comment -29 29 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:28:1: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | @@ -373,12 +206,3 @@ C408.py:28:1: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | |_^ C408 | = help: Rewrite as a literal - -25 25 | # comment -26 26 | ) -27 27 | -28 |-tuple( # comment - 28 |+( # comment -29 29 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap index 2e1cf30d4ecdd..fecda9d490fe9 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap @@ -10,13 +10,6 @@ C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | = help: Rewrite as a literal -1 |-t = tuple() - 1 |+t = () -2 2 | l = list() -3 3 | d1 = dict() -4 4 | d2 = dict(a=1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) | @@ -28,14 +21,6 @@ C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) | = help: Rewrite as a literal -1 1 | t = tuple() -2 |-l = list() - 2 |+l = [] -3 3 | d1 = dict() -4 4 | d2 = dict(a=1) -5 5 | d3 = dict(**d2) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -48,15 +33,6 @@ C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -1 1 | t = tuple() -2 2 | l = list() -3 |-d1 = dict() - 3 |+d1 = {} -4 4 | d2 = dict(a=1) -5 5 | d3 = dict(**d2) -6 6 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -68,16 +44,6 @@ C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -13 13 | -14 14 | f"{dict(x='y')}" -15 15 | f'{dict(x="y")}' -16 |-f"{dict()}" - 16 |+f"{ {} }" -17 17 | f"a {dict()} b" -18 18 | -19 19 | f"{dict(x='y') | dict(y='z')}" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -90,16 +56,6 @@ C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -14 14 | f"{dict(x='y')}" -15 15 | f'{dict(x="y")}' -16 16 | f"{dict()}" -17 |-f"a {dict()} b" - 17 |+f"a { {} } b" -18 18 | -19 19 | f"{dict(x='y') | dict(y='z')}" -20 20 | f"{ dict(x='y') | dict(y='z') }" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:24:1: C408 [*] Unnecessary `dict` call (rewrite as a literal) | @@ -114,19 +70,6 @@ C408.py:24:1: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -21 21 | f"a {dict(x='y') | dict(y='z')} b" -22 22 | f"a { dict(x='y') | dict(y='z') } b" -23 23 | -24 |-dict( - 24 |+{ -25 25 | # comment -26 |-) - 26 |+} -27 27 | -28 28 | tuple( # comment -29 29 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C408.py:28:1: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | @@ -137,12 +80,3 @@ C408.py:28:1: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | |_^ C408 | = help: Rewrite as a literal - -25 25 | # comment -26 26 | ) -27 27 | -28 |-tuple( # comment - 28 |+( # comment -29 29 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap index f27d960576ad6..5400d9a1dd2d5 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap @@ -10,13 +10,6 @@ C409.py:1:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as | = help: Rewrite as a `tuple` literal -1 |-t1 = tuple([]) - 1 |+t1 = () -2 2 | t2 = tuple([1, 2]) -3 3 | t3 = tuple((1, 2)) -4 4 | t4 = tuple([ - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C409.py:2:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | @@ -28,14 +21,6 @@ C409.py:2:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as | = help: Rewrite as a `tuple` literal -1 1 | t1 = tuple([]) -2 |-t2 = tuple([1, 2]) - 2 |+t2 = (1, 2) -3 3 | t3 = tuple((1, 2)) -4 4 | t4 = tuple([ -5 5 | 1, - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C409.py:3:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) | @@ -48,15 +33,6 @@ C409.py:3:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th | = help: Remove outer `tuple` call -1 1 | t1 = tuple([]) -2 2 | t2 = tuple([1, 2]) -3 |-t3 = tuple((1, 2)) - 3 |+t3 = (1, 2) -4 4 | t4 = tuple([ -5 5 | 1, -6 6 | 2 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | @@ -73,20 +49,6 @@ C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as | = help: Rewrite as a `tuple` literal -1 1 | t1 = tuple([]) -2 2 | t2 = tuple([1, 2]) -3 3 | t3 = tuple((1, 2)) -4 |-t4 = tuple([ - 4 |+t4 = ( -5 5 | 1, -6 6 | 2 -7 |-]) - 7 |+) -8 8 | t5 = tuple( -9 9 | (1, 2) -10 10 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C409.py:8:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) | @@ -102,18 +64,6 @@ C409.py:8:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th | = help: Remove outer `tuple` call -5 5 | 1, -6 6 | 2 -7 7 | ]) -8 |-t5 = tuple( -9 |- (1, 2) -10 |-) - 8 |+t5 = (1, 2) -11 9 | -12 10 | tuple( # comment -13 11 | [1, 2] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C409.py:12:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | @@ -128,18 +78,6 @@ C409.py:12:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a | = help: Rewrite as a `tuple` literal -9 9 | (1, 2) -10 10 | ) -11 11 | -12 |-tuple( # comment -13 |- [1, 2] -14 |-) - 12 |+(1, 2) -15 13 | -16 14 | tuple([ # comment -17 15 | 1, 2 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C409.py:16:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | @@ -154,19 +92,6 @@ C409.py:16:1: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a | = help: Rewrite as a `tuple` literal -13 13 | [1, 2] -14 14 | ) -15 15 | -16 |-tuple([ # comment - 16 |+( # comment -17 17 | 1, 2 -18 |-]) - 18 |+) -19 19 | -20 20 | tuple(( -21 21 | 1, - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C409.py:20:1: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) | @@ -181,19 +106,6 @@ C409.py:20:1: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove t | = help: Remove outer `tuple` call -17 17 | 1, 2 -18 18 | ]) -19 19 | -20 |-tuple(( - 20 |+( -21 21 | 1, -22 |-)) - 22 |+) -23 23 | -24 24 | t6 = tuple([1]) -25 25 | t7 = tuple((1,)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C409.py:24:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | @@ -206,15 +118,6 @@ C409.py:24:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a | = help: Rewrite as a `tuple` literal -21 21 | 1, -22 22 | )) -23 23 | -24 |-t6 = tuple([1]) - 24 |+t6 = (1,) -25 25 | t7 = tuple((1,)) -26 26 | t8 = tuple([1,]) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C409.py:25:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) | @@ -225,14 +128,6 @@ C409.py:25:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove t | = help: Remove outer `tuple` call -22 22 | )) -23 23 | -24 24 | t6 = tuple([1]) -25 |-t7 = tuple((1,)) - 25 |+t7 = (1,) -26 26 | t8 = tuple([1,]) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C409.py:26:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | @@ -242,11 +137,3 @@ C409.py:26:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite a | ^^^^^^^^^^^ C409 | = help: Rewrite as a `tuple` literal - -23 23 | -24 24 | t6 = tuple([1]) -25 25 | t7 = tuple((1,)) -26 |-t8 = tuple([1,]) - 26 |+t8 = (1,) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap index b8c7486b1f590..739057be350f4 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap @@ -10,13 +10,6 @@ C410.py:1:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the | = help: Remove outer `list` call -1 |-l1 = list([1, 2]) - 1 |+l1 = [1, 2] -2 2 | l2 = list((1, 2)) -3 3 | l3 = list([]) -4 4 | l4 = list(()) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C410.py:2:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal) | @@ -28,14 +21,6 @@ C410.py:2:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as | = help: Rewrite as a `list` literal -1 1 | l1 = list([1, 2]) -2 |-l2 = list((1, 2)) - 2 |+l2 = [1, 2] -3 3 | l3 = list([]) -4 4 | l4 = list(()) -5 5 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C410.py:3:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) | @@ -47,15 +32,6 @@ C410.py:3:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the | = help: Remove outer `list` call -1 1 | l1 = list([1, 2]) -2 2 | l2 = list((1, 2)) -3 |-l3 = list([]) - 3 |+l3 = [] -4 4 | l4 = list(()) -5 5 | -6 6 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C410.py:4:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal) | @@ -66,16 +42,6 @@ C410.py:4:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as | = help: Rewrite as a `list` literal -1 1 | l1 = list([1, 2]) -2 2 | l2 = list((1, 2)) -3 3 | l3 = list([]) -4 |-l4 = list(()) - 4 |+l4 = [] -5 5 | -6 6 | -7 7 | list( # comment - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C410.py:7:1: C410 [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) | @@ -88,18 +54,6 @@ C410.py:7:1: C410 [*] Unnecessary `list` literal passed to `list()` (remove the | = help: Remove outer `list` call -4 4 | l4 = list(()) -5 5 | -6 6 | -7 |-list( # comment -8 |- [1, 2] -9 |-) - 7 |+[1, 2] -10 8 | -11 9 | list([ # comment -12 10 | 1, 2 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C410.py:11:1: C410 [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) | @@ -111,14 +65,3 @@ C410.py:11:1: C410 [*] Unnecessary `list` literal passed to `list()` (remove the | |__^ C410 | = help: Remove outer `list` call - -8 8 | [1, 2] -9 9 | ) -10 10 | -11 |-list([ # comment - 11 |+[ # comment -12 12 | 1, 2 -13 |-]) - 13 |+] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap index 741ac73479fa4..1d5612cec40ce 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap @@ -8,9 +8,3 @@ C411.py:2:1: C411 [*] Unnecessary `list` call (remove the outer call to `list()` | ^^^^^^^^^^^^^^^^^^^^ C411 | = help: Remove outer `list` call - -1 1 | x = [1, 2, 3] -2 |-list([i for i in x]) - 2 |+[i for i in x] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap index 461fc8a7d7f6d..e0c95d3bdc3cb 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap @@ -33,16 +33,6 @@ C413.py:4:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -1 1 | x = [2, 3, 1] -2 2 | list(x) -3 3 | list(sorted(x)) -4 |-reversed(sorted(x)) - 4 |+sorted(x, reverse=True) -5 5 | reversed(sorted(x, key=lambda e: e)) -6 6 | reversed(sorted(x, reverse=True)) -7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C413.py:5:1: C413 [*] Unnecessary `reversed` call around `sorted()` | @@ -55,16 +45,6 @@ C413.py:5:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -2 2 | list(x) -3 3 | list(sorted(x)) -4 4 | reversed(sorted(x)) -5 |-reversed(sorted(x, key=lambda e: e)) - 5 |+sorted(x, key=lambda e: e, reverse=True) -6 6 | reversed(sorted(x, reverse=True)) -7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) -8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C413.py:6:1: C413 [*] Unnecessary `reversed` call around `sorted()` | @@ -77,16 +57,6 @@ C413.py:6:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -3 3 | list(sorted(x)) -4 4 | reversed(sorted(x)) -5 5 | reversed(sorted(x, key=lambda e: e)) -6 |-reversed(sorted(x, reverse=True)) - 6 |+sorted(x, reverse=False) -7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) -8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) -9 9 | reversed(sorted(x, reverse=False)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C413.py:7:1: C413 [*] Unnecessary `reversed` call around `sorted()` | @@ -99,16 +69,6 @@ C413.py:7:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -4 4 | reversed(sorted(x)) -5 5 | reversed(sorted(x, key=lambda e: e)) -6 6 | reversed(sorted(x, reverse=True)) -7 |-reversed(sorted(x, key=lambda e: e, reverse=True)) - 7 |+sorted(x, key=lambda e: e, reverse=False) -8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) -9 9 | reversed(sorted(x, reverse=False)) -10 10 | reversed(sorted(x, reverse=x)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C413.py:8:1: C413 [*] Unnecessary `reversed` call around `sorted()` | @@ -121,16 +81,6 @@ C413.py:8:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -5 5 | reversed(sorted(x, key=lambda e: e)) -6 6 | reversed(sorted(x, reverse=True)) -7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) -8 |-reversed(sorted(x, reverse=True, key=lambda e: e)) - 8 |+sorted(x, reverse=False, key=lambda e: e) -9 9 | reversed(sorted(x, reverse=False)) -10 10 | reversed(sorted(x, reverse=x)) -11 11 | reversed(sorted(x, reverse=not x)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C413.py:9:1: C413 [*] Unnecessary `reversed` call around `sorted()` | @@ -143,16 +93,6 @@ C413.py:9:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -6 6 | reversed(sorted(x, reverse=True)) -7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) -8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) -9 |-reversed(sorted(x, reverse=False)) - 9 |+sorted(x, reverse=True) -10 10 | reversed(sorted(x, reverse=x)) -11 11 | reversed(sorted(x, reverse=not x)) -12 12 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C413.py:10:1: C413 [*] Unnecessary `reversed` call around `sorted()` | @@ -164,16 +104,6 @@ C413.py:10:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) -8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) -9 9 | reversed(sorted(x, reverse=False)) -10 |-reversed(sorted(x, reverse=x)) - 10 |+sorted(x, reverse=not x) -11 11 | reversed(sorted(x, reverse=not x)) -12 12 | -13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C413.py:11:1: C413 [*] Unnecessary `reversed` call around `sorted()` | @@ -186,16 +116,6 @@ C413.py:11:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) -9 9 | reversed(sorted(x, reverse=False)) -10 10 | reversed(sorted(x, reverse=x)) -11 |-reversed(sorted(x, reverse=not x)) - 11 |+sorted(x, reverse=x) -12 12 | -13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 -14 14 | reversed(sorted(i for i in range(42))) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C413.py:14:1: C413 [*] Unnecessary `reversed` call around `sorted()` | @@ -206,16 +126,6 @@ C413.py:14:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -11 11 | reversed(sorted(x, reverse=not x)) -12 12 | -13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 -14 |-reversed(sorted(i for i in range(42))) - 14 |+sorted((i for i in range(42)), reverse=True) -15 15 | reversed(sorted((i for i in range(42)), reverse=True)) -16 16 | -17 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C413.py:15:1: C413 [*] Unnecessary `reversed` call around `sorted()` | @@ -228,16 +138,6 @@ C413.py:15:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -12 12 | -13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 -14 14 | reversed(sorted(i for i in range(42))) -15 |-reversed(sorted((i for i in range(42)), reverse=True)) - 15 |+sorted((i for i in range(42)), reverse=False) -16 16 | -17 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335 -18 18 | reversed(sorted([1, 2, 3], reverse=False or True)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C413.py:18:1: C413 [*] Unnecessary `reversed` call around `sorted()` | @@ -248,14 +148,6 @@ C413.py:18:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -15 15 | reversed(sorted((i for i in range(42)), reverse=True)) -16 16 | -17 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335 -18 |-reversed(sorted([1, 2, 3], reverse=False or True)) - 18 |+sorted([1, 2, 3], reverse=not (False or True)) -19 19 | reversed(sorted([1, 2, 3], reverse=(False or True))) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C413.py:19:1: C413 [*] Unnecessary `reversed` call around `sorted()` | @@ -265,11 +157,3 @@ C413.py:19:1: C413 [*] Unnecessary `reversed` call around `sorted()` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C413 | = help: Remove unnecessary `reversed` call - -16 16 | -17 17 | # Regression test for: https://github.com/astral-sh/ruff/issues/10335 -18 18 | reversed(sorted([1, 2, 3], reverse=False or True)) -19 |-reversed(sorted([1, 2, 3], reverse=(False or True))) - 19 |+sorted([1, 2, 3], reverse=not (False or True)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap index 173e79eaafa3a..d9dd304839e05 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap @@ -11,14 +11,6 @@ C414.py:2:1: C414 [*] Unnecessary `list` call within `list()` | = help: Remove the inner `list` call -1 1 | x = [1, 2, 3] -2 |-list(list(x)) - 2 |+list(x) -3 3 | list(tuple(x)) -4 4 | tuple(list(x)) -5 5 | tuple(tuple(x)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:3:1: C414 [*] Unnecessary `tuple` call within `list()` | @@ -31,15 +23,6 @@ C414.py:3:1: C414 [*] Unnecessary `tuple` call within `list()` | = help: Remove the inner `tuple` call -1 1 | x = [1, 2, 3] -2 2 | list(list(x)) -3 |-list(tuple(x)) - 3 |+list(x) -4 4 | tuple(list(x)) -5 5 | tuple(tuple(x)) -6 6 | set(set(x)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:4:1: C414 [*] Unnecessary `list` call within `tuple()` | @@ -52,16 +35,6 @@ C414.py:4:1: C414 [*] Unnecessary `list` call within `tuple()` | = help: Remove the inner `list` call -1 1 | x = [1, 2, 3] -2 2 | list(list(x)) -3 3 | list(tuple(x)) -4 |-tuple(list(x)) - 4 |+tuple(x) -5 5 | tuple(tuple(x)) -6 6 | set(set(x)) -7 7 | set(list(x)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:5:1: C414 [*] Unnecessary `tuple` call within `tuple()` | @@ -74,16 +47,6 @@ C414.py:5:1: C414 [*] Unnecessary `tuple` call within `tuple()` | = help: Remove the inner `tuple` call -2 2 | list(list(x)) -3 3 | list(tuple(x)) -4 4 | tuple(list(x)) -5 |-tuple(tuple(x)) - 5 |+tuple(x) -6 6 | set(set(x)) -7 7 | set(list(x)) -8 8 | set(tuple(x)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:6:1: C414 [*] Unnecessary `set` call within `set()` | @@ -96,16 +59,6 @@ C414.py:6:1: C414 [*] Unnecessary `set` call within `set()` | = help: Remove the inner `set` call -3 3 | list(tuple(x)) -4 4 | tuple(list(x)) -5 5 | tuple(tuple(x)) -6 |-set(set(x)) - 6 |+set(x) -7 7 | set(list(x)) -8 8 | set(tuple(x)) -9 9 | set(sorted(x)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:7:1: C414 [*] Unnecessary `list` call within `set()` | @@ -118,16 +71,6 @@ C414.py:7:1: C414 [*] Unnecessary `list` call within `set()` | = help: Remove the inner `list` call -4 4 | tuple(list(x)) -5 5 | tuple(tuple(x)) -6 6 | set(set(x)) -7 |-set(list(x)) - 7 |+set(x) -8 8 | set(tuple(x)) -9 9 | set(sorted(x)) -10 10 | set(sorted(x, key=lambda y: y)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:8:1: C414 [*] Unnecessary `tuple` call within `set()` | @@ -140,16 +83,6 @@ C414.py:8:1: C414 [*] Unnecessary `tuple` call within `set()` | = help: Remove the inner `tuple` call -5 5 | tuple(tuple(x)) -6 6 | set(set(x)) -7 7 | set(list(x)) -8 |-set(tuple(x)) - 8 |+set(x) -9 9 | set(sorted(x)) -10 10 | set(sorted(x, key=lambda y: y)) -11 11 | set(reversed(x)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:9:1: C414 [*] Unnecessary `sorted` call within `set()` | @@ -162,16 +95,6 @@ C414.py:9:1: C414 [*] Unnecessary `sorted` call within `set()` | = help: Remove the inner `sorted` call -6 6 | set(set(x)) -7 7 | set(list(x)) -8 8 | set(tuple(x)) -9 |-set(sorted(x)) - 9 |+set(x) -10 10 | set(sorted(x, key=lambda y: y)) -11 11 | set(reversed(x)) -12 12 | sorted(list(x)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:10:1: C414 [*] Unnecessary `sorted` call within `set()` | @@ -184,16 +107,6 @@ C414.py:10:1: C414 [*] Unnecessary `sorted` call within `set()` | = help: Remove the inner `sorted` call -7 7 | set(list(x)) -8 8 | set(tuple(x)) -9 9 | set(sorted(x)) -10 |-set(sorted(x, key=lambda y: y)) - 10 |+set(x) -11 11 | set(reversed(x)) -12 12 | sorted(list(x)) -13 13 | sorted(tuple(x)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:11:1: C414 [*] Unnecessary `reversed` call within `set()` | @@ -206,16 +119,6 @@ C414.py:11:1: C414 [*] Unnecessary `reversed` call within `set()` | = help: Remove the inner `reversed` call -8 8 | set(tuple(x)) -9 9 | set(sorted(x)) -10 10 | set(sorted(x, key=lambda y: y)) -11 |-set(reversed(x)) - 11 |+set(x) -12 12 | sorted(list(x)) -13 13 | sorted(tuple(x)) -14 14 | sorted(sorted(x)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:12:1: C414 [*] Unnecessary `list` call within `sorted()` | @@ -228,16 +131,6 @@ C414.py:12:1: C414 [*] Unnecessary `list` call within `sorted()` | = help: Remove the inner `list` call -9 9 | set(sorted(x)) -10 10 | set(sorted(x, key=lambda y: y)) -11 11 | set(reversed(x)) -12 |-sorted(list(x)) - 12 |+sorted(x) -13 13 | sorted(tuple(x)) -14 14 | sorted(sorted(x)) -15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:13:1: C414 [*] Unnecessary `tuple` call within `sorted()` | @@ -250,16 +143,6 @@ C414.py:13:1: C414 [*] Unnecessary `tuple` call within `sorted()` | = help: Remove the inner `tuple` call -10 10 | set(sorted(x, key=lambda y: y)) -11 11 | set(reversed(x)) -12 12 | sorted(list(x)) -13 |-sorted(tuple(x)) - 13 |+sorted(x) -14 14 | sorted(sorted(x)) -15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) -16 16 | sorted(sorted(x, reverse=True), reverse=True) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:14:1: C414 [*] Unnecessary `sorted` call within `sorted()` | @@ -272,16 +155,6 @@ C414.py:14:1: C414 [*] Unnecessary `sorted` call within `sorted()` | = help: Remove the inner `sorted` call -11 11 | set(reversed(x)) -12 12 | sorted(list(x)) -13 13 | sorted(tuple(x)) -14 |-sorted(sorted(x)) - 14 |+sorted(x) -15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) -16 16 | sorted(sorted(x, reverse=True), reverse=True) -17 17 | sorted(reversed(x)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:15:1: C414 [*] Unnecessary `sorted` call within `sorted()` | @@ -294,16 +167,6 @@ C414.py:15:1: C414 [*] Unnecessary `sorted` call within `sorted()` | = help: Remove the inner `sorted` call -12 12 | sorted(list(x)) -13 13 | sorted(tuple(x)) -14 14 | sorted(sorted(x)) -15 |-sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) - 15 |+sorted(x, reverse=False, key=foo) -16 16 | sorted(sorted(x, reverse=True), reverse=True) -17 17 | sorted(reversed(x)) -18 18 | sorted(list(x), key=lambda y: y) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:16:1: C414 [*] Unnecessary `sorted` call within `sorted()` | @@ -316,16 +179,6 @@ C414.py:16:1: C414 [*] Unnecessary `sorted` call within `sorted()` | = help: Remove the inner `sorted` call -13 13 | sorted(tuple(x)) -14 14 | sorted(sorted(x)) -15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) -16 |-sorted(sorted(x, reverse=True), reverse=True) - 16 |+sorted(x, reverse=True) -17 17 | sorted(reversed(x)) -18 18 | sorted(list(x), key=lambda y: y) -19 19 | tuple( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:17:1: C414 [*] Unnecessary `reversed` call within `sorted()` | @@ -338,16 +191,6 @@ C414.py:17:1: C414 [*] Unnecessary `reversed` call within `sorted()` | = help: Remove the inner `reversed` call -14 14 | sorted(sorted(x)) -15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) -16 16 | sorted(sorted(x, reverse=True), reverse=True) -17 |-sorted(reversed(x)) - 17 |+sorted(x) -18 18 | sorted(list(x), key=lambda y: y) -19 19 | tuple( -20 20 | list( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:18:1: C414 [*] Unnecessary `list` call within `sorted()` | @@ -360,16 +203,6 @@ C414.py:18:1: C414 [*] Unnecessary `list` call within `sorted()` | = help: Remove the inner `list` call -15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) -16 16 | sorted(sorted(x, reverse=True), reverse=True) -17 17 | sorted(reversed(x)) -18 |-sorted(list(x), key=lambda y: y) - 18 |+sorted(x, key=lambda y: y) -19 19 | tuple( -20 20 | list( -21 21 | [x, 3, "hell"\ - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:19:1: C414 [*] Unnecessary `list` call within `tuple()` | @@ -387,19 +220,6 @@ C414.py:19:1: C414 [*] Unnecessary `list` call within `tuple()` | = help: Remove the inner `list` call -17 17 | sorted(reversed(x)) -18 18 | sorted(list(x), key=lambda y: y) -19 19 | tuple( -20 |- list( -21 |- [x, 3, "hell"\ - 20 |+ [x, 3, "hell"\ -22 21 | "o"] -23 |- ) -24 22 | ) -25 23 | set(set()) -26 24 | set(list()) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:25:1: C414 [*] Unnecessary `set` call within `set()` | @@ -412,16 +232,6 @@ C414.py:25:1: C414 [*] Unnecessary `set` call within `set()` | = help: Remove the inner `set` call -22 22 | "o"] -23 23 | ) -24 24 | ) -25 |-set(set()) - 25 |+set() -26 26 | set(list()) -27 27 | set(tuple()) -28 28 | sorted(reversed()) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:26:1: C414 [*] Unnecessary `list` call within `set()` | @@ -434,16 +244,6 @@ C414.py:26:1: C414 [*] Unnecessary `list` call within `set()` | = help: Remove the inner `list` call -23 23 | ) -24 24 | ) -25 25 | set(set()) -26 |-set(list()) - 26 |+set() -27 27 | set(tuple()) -28 28 | sorted(reversed()) -29 29 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:27:1: C414 [*] Unnecessary `tuple` call within `set()` | @@ -455,16 +255,6 @@ C414.py:27:1: C414 [*] Unnecessary `tuple` call within `set()` | = help: Remove the inner `tuple` call -24 24 | ) -25 25 | set(set()) -26 26 | set(list()) -27 |-set(tuple()) - 27 |+set() -28 28 | sorted(reversed()) -29 29 | -30 30 | # Nested sorts with differing keyword arguments. Not flagged. - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:28:1: C414 [*] Unnecessary `reversed` call within `sorted()` | @@ -477,16 +267,6 @@ C414.py:28:1: C414 [*] Unnecessary `reversed` call within `sorted()` | = help: Remove the inner `reversed` call -25 25 | set(set()) -26 26 | set(list()) -27 27 | set(tuple()) -28 |-sorted(reversed()) - 28 |+sorted() -29 29 | -30 30 | # Nested sorts with differing keyword arguments. Not flagged. -31 31 | sorted(sorted(x, key=lambda y: y)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:37:27: C414 [*] Unnecessary `list` call within `sorted()` | @@ -504,16 +284,6 @@ C414.py:37:27: C414 [*] Unnecessary `list` call within `sorted()` | = help: Remove the inner `list` call -35 35 | -36 36 | # Preserve trailing comments. -37 37 | xxxxxxxxxxx_xxxxx_xxxxx = sorted( -38 |- list(x_xxxx_xxxxxxxxxxx_xxxxx.xxxx()), - 38 |+ x_xxxx_xxxxxxxxxxx_xxxxx.xxxx(), -39 39 | # xxxxxxxxxxx xxxxx xxxx xxx xx Nxxx, xxx xxxxxx3 xxxxxxxxx xx -40 40 | # xx xxxx xxxxxxx xxxx xxx xxxxxxxx Nxxx -41 41 | key=lambda xxxxx: xxxxx or "", - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C414.py:44:27: C414 [*] Unnecessary `list` call within `sorted()` | @@ -527,13 +297,3 @@ C414.py:44:27: C414 [*] Unnecessary `list` call within `sorted()` | |_^ C414 | = help: Remove the inner `list` call - -42 42 | ) -43 43 | -44 44 | xxxxxxxxxxx_xxxxx_xxxxx = sorted( -45 |- list(x_xxxx_xxxxxxxxxxx_xxxxx.xxxx()), # xxxxxxxxxxx xxxxx xxxx xxx xx Nxxx - 45 |+ x_xxxx_xxxxxxxxxxx_xxxxx.xxxx(), # xxxxxxxxxxx xxxxx xxxx xxx xx Nxxx -46 46 | key=lambda xxxxx: xxxxx or "", -47 47 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap index bc4dc070e8258..0615a4e345b99 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap @@ -12,16 +12,6 @@ C416.py:6:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) | = help: Rewrite using `list()` -3 3 | z = [(1,), (2,), (3,)] -4 4 | d = {"a": 1, "b": 2, "c": 3} -5 5 | -6 |-[i for i in x] - 6 |+list(x) -7 7 | {i for i in x} -8 8 | {k: v for k, v in y} -9 9 | {k: v for k, v in d.items()} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C416.py:7:1: C416 [*] Unnecessary `set` comprehension (rewrite using `set()`) | @@ -33,16 +23,6 @@ C416.py:7:1: C416 [*] Unnecessary `set` comprehension (rewrite using `set()`) | = help: Rewrite using `set()` -4 4 | d = {"a": 1, "b": 2, "c": 3} -5 5 | -6 6 | [i for i in x] -7 |-{i for i in x} - 7 |+set(x) -8 8 | {k: v for k, v in y} -9 9 | {k: v for k, v in d.items()} -10 10 | [(k, v) for k, v in d.items()] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C416.py:8:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | @@ -55,16 +35,6 @@ C416.py:8:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | = help: Rewrite using `dict()` -5 5 | -6 6 | [i for i in x] -7 7 | {i for i in x} -8 |-{k: v for k, v in y} - 8 |+dict(y) -9 9 | {k: v for k, v in d.items()} -10 10 | [(k, v) for k, v in d.items()] -11 11 | {k: (a, b) for k, (a, b) in d.items()} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C416.py:9:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | @@ -77,16 +47,6 @@ C416.py:9:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | = help: Rewrite using `dict()` -6 6 | [i for i in x] -7 7 | {i for i in x} -8 8 | {k: v for k, v in y} -9 |-{k: v for k, v in d.items()} - 9 |+dict(d.items()) -10 10 | [(k, v) for k, v in d.items()] -11 11 | {k: (a, b) for k, (a, b) in d.items()} -12 12 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C416.py:10:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) | @@ -98,16 +58,6 @@ C416.py:10:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) | = help: Rewrite using `list()` -7 7 | {i for i in x} -8 8 | {k: v for k, v in y} -9 9 | {k: v for k, v in d.items()} -10 |-[(k, v) for k, v in d.items()] - 10 |+list(d.items()) -11 11 | {k: (a, b) for k, (a, b) in d.items()} -12 12 | -13 13 | [i for i, in z] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C416.py:11:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | @@ -120,16 +70,6 @@ C416.py:11:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | = help: Rewrite using `dict()` -8 8 | {k: v for k, v in y} -9 9 | {k: v for k, v in d.items()} -10 10 | [(k, v) for k, v in d.items()] -11 |-{k: (a, b) for k, (a, b) in d.items()} - 11 |+dict(d.items()) -12 12 | -13 13 | [i for i, in z] -14 14 | [i for i, j in y] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C416.py:24:70: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) | @@ -138,11 +78,3 @@ C416.py:24:70: C416 [*] Unnecessary `list` comprehension (rewrite using `list()` | ^^^^^^^^^^^^^^^^^^^^^^^ C416 | = help: Rewrite using `list()` - -21 21 | {k: v if v else None for k, v in y} -22 22 | -23 23 | # Regression test for: https://github.com/astral-sh/ruff/issues/7196 -24 |-any(len(symbol_table.get_by_type(symbol_type)) > 0 for symbol_type in[t for t in SymbolType]) - 24 |+any(len(symbol_table.get_by_type(symbol_type)) > 0 for symbol_type in list(SymbolType)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap index 33c7badf00fff..448d0771b6ad6 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap @@ -12,15 +12,6 @@ C417.py:3:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express | = help: Replace `map` with a generator expression -1 1 | # Errors. -2 2 | nums = [1, 2, 3] -3 |-map(lambda x: x + 1, nums) - 3 |+(x + 1 for x in nums) -4 4 | map(lambda x: str(x), nums) -5 5 | list(map(lambda x: x * 2, nums)) -6 6 | set(map(lambda x: x % 2 == 0, nums)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C417.py:4:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | @@ -33,16 +24,6 @@ C417.py:4:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express | = help: Replace `map` with a generator expression -1 1 | # Errors. -2 2 | nums = [1, 2, 3] -3 3 | map(lambda x: x + 1, nums) -4 |-map(lambda x: str(x), nums) - 4 |+(str(x) for x in nums) -5 5 | list(map(lambda x: x * 2, nums)) -6 6 | set(map(lambda x: x % 2 == 0, nums)) -7 7 | dict(map(lambda v: (v, v**2), nums)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C417.py:5:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehension) | @@ -55,16 +36,6 @@ C417.py:5:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehens | = help: Replace `map` with a `list` comprehension -2 2 | nums = [1, 2, 3] -3 3 | map(lambda x: x + 1, nums) -4 4 | map(lambda x: str(x), nums) -5 |-list(map(lambda x: x * 2, nums)) - 5 |+[x * 2 for x in nums] -6 6 | set(map(lambda x: x % 2 == 0, nums)) -7 7 | dict(map(lambda v: (v, v**2), nums)) -8 8 | dict(map(lambda v: [v, v**2], nums)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C417.py:6:1: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehension) | @@ -77,16 +48,6 @@ C417.py:6:1: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehensi | = help: Replace `map` with a `set` comprehension -3 3 | map(lambda x: x + 1, nums) -4 4 | map(lambda x: str(x), nums) -5 5 | list(map(lambda x: x * 2, nums)) -6 |-set(map(lambda x: x % 2 == 0, nums)) - 6 |+{x % 2 == 0 for x in nums} -7 7 | dict(map(lambda v: (v, v**2), nums)) -8 8 | dict(map(lambda v: [v, v**2], nums)) -9 9 | map(lambda: "const", nums) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C417.py:7:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) | @@ -99,16 +60,6 @@ C417.py:7:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehens | = help: Replace `map` with a `dict` comprehension -4 4 | map(lambda x: str(x), nums) -5 5 | list(map(lambda x: x * 2, nums)) -6 6 | set(map(lambda x: x % 2 == 0, nums)) -7 |-dict(map(lambda v: (v, v**2), nums)) - 7 |+{v: v**2 for v in nums} -8 8 | dict(map(lambda v: [v, v**2], nums)) -9 9 | map(lambda: "const", nums) -10 10 | map(lambda _: 3.0, nums) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C417.py:8:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) | @@ -121,16 +72,6 @@ C417.py:8:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehens | = help: Replace `map` with a `dict` comprehension -5 5 | list(map(lambda x: x * 2, nums)) -6 6 | set(map(lambda x: x % 2 == 0, nums)) -7 7 | dict(map(lambda v: (v, v**2), nums)) -8 |-dict(map(lambda v: [v, v**2], nums)) - 8 |+{v: v**2 for v in nums} -9 9 | map(lambda: "const", nums) -10 10 | map(lambda _: 3.0, nums) -11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C417.py:9:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | @@ -143,16 +84,6 @@ C417.py:9:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express | = help: Replace `map` with a generator expression -6 6 | set(map(lambda x: x % 2 == 0, nums)) -7 7 | dict(map(lambda v: (v, v**2), nums)) -8 8 | dict(map(lambda v: [v, v**2], nums)) -9 |-map(lambda: "const", nums) - 9 |+("const" for _ in nums) -10 10 | map(lambda _: 3.0, nums) -11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) -12 12 | all(map(lambda v: isinstance(v, dict), nums)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C417.py:10:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | @@ -165,16 +96,6 @@ C417.py:10:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -7 7 | dict(map(lambda v: (v, v**2), nums)) -8 8 | dict(map(lambda v: [v, v**2], nums)) -9 9 | map(lambda: "const", nums) -10 |-map(lambda _: 3.0, nums) - 10 |+(3.0 for _ in nums) -11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) -12 12 | all(map(lambda v: isinstance(v, dict), nums)) -13 13 | filter(func, map(lambda v: v, nums)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C417.py:11:13: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | @@ -187,16 +108,6 @@ C417.py:11:13: C417 [*] Unnecessary `map` usage (rewrite using a generator expre | = help: Replace `map` with a generator expression -8 8 | dict(map(lambda v: [v, v**2], nums)) -9 9 | map(lambda: "const", nums) -10 10 | map(lambda _: 3.0, nums) -11 |-_ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) - 11 |+_ = "".join((x in nums and "1" or "0" for x in range(123))) -12 12 | all(map(lambda v: isinstance(v, dict), nums)) -13 13 | filter(func, map(lambda v: v, nums)) -14 14 | list(map(lambda x, y: x * y, nums)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C417.py:12:5: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | @@ -209,16 +120,6 @@ C417.py:12:5: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -9 9 | map(lambda: "const", nums) -10 10 | map(lambda _: 3.0, nums) -11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) -12 |-all(map(lambda v: isinstance(v, dict), nums)) - 12 |+all((isinstance(v, dict) for v in nums)) -13 13 | filter(func, map(lambda v: v, nums)) -14 14 | list(map(lambda x, y: x * y, nums)) -15 15 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C417.py:13:14: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | @@ -230,16 +131,6 @@ C417.py:13:14: C417 [*] Unnecessary `map` usage (rewrite using a generator expre | = help: Replace `map` with a generator expression -10 10 | map(lambda _: 3.0, nums) -11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) -12 12 | all(map(lambda v: isinstance(v, dict), nums)) -13 |-filter(func, map(lambda v: v, nums)) - 13 |+filter(func, (v for v in nums)) -14 14 | list(map(lambda x, y: x * y, nums)) -15 15 | -16 16 | # When inside f-string, then the fix should be surrounded by whitespace - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C417.py:14:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehension) | @@ -252,16 +143,6 @@ C417.py:14:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehen | = help: Replace `map` with a `list` comprehension -11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) -12 12 | all(map(lambda v: isinstance(v, dict), nums)) -13 13 | filter(func, map(lambda v: v, nums)) -14 |-list(map(lambda x, y: x * y, nums)) - 14 |+[x * y for x, y in nums] -15 15 | -16 16 | # When inside f-string, then the fix should be surrounded by whitespace -17 17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C417.py:17:8: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehension) | @@ -272,16 +153,6 @@ C417.py:17:8: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehens | = help: Replace `map` with a `set` comprehension -14 14 | list(map(lambda x, y: x * y, nums)) -15 15 | -16 16 | # When inside f-string, then the fix should be surrounded by whitespace -17 |-_ = f"{set(map(lambda x: x % 2 == 0, nums))}" - 17 |+_ = f"{ {x % 2 == 0 for x in nums} }" -18 18 | _ = f"{dict(map(lambda v: (v, v**2), nums))}" -19 19 | -20 20 | # False negatives. - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C417.py:18:8: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) | @@ -294,16 +165,6 @@ C417.py:18:8: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehen | = help: Replace `map` with a `dict` comprehension -15 15 | -16 16 | # When inside f-string, then the fix should be surrounded by whitespace -17 17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}" -18 |-_ = f"{dict(map(lambda v: (v, v**2), nums))}" - 18 |+_ = f"{ {v: v**2 for v in nums} }" -19 19 | -20 20 | # False negatives. -21 21 | map(lambda x=2, y=1: x + y, nums, nums) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C417.py:36:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | @@ -315,16 +176,6 @@ C417.py:36:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -33 33 | map(lambda x: lambda: x, range(4)) -34 34 | -35 35 | # Error: the `x` is overridden by the inner lambda. -36 |-map(lambda x: lambda x: x, range(4)) - 36 |+(lambda x: x for x in range(4)) -37 37 | -38 38 | # Ok because of the default parameters, and variadic arguments. -39 39 | map(lambda x=1: x, nums) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C417.py:47:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | @@ -336,15 +187,6 @@ C417.py:47:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -44 44 | dict(map(lambda k, v: (k, v), keys, values)) -45 45 | -46 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121 -47 |-map(lambda x: x, y if y else z) - 47 |+(x for x in (y if y else z)) -48 48 | map(lambda x: x, (y if y else z)) -49 49 | map(lambda x: x, (x, y, z)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C417.py:48:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | @@ -356,14 +198,6 @@ C417.py:48:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -45 45 | -46 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121 -47 47 | map(lambda x: x, y if y else z) -48 |-map(lambda x: x, (y if y else z)) - 48 |+(x for x in (y if y else z)) -49 49 | map(lambda x: x, (x, y, z)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C417.py:49:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | @@ -373,11 +207,3 @@ C417.py:49:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ C417 | = help: Replace `map` with a generator expression - -46 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121 -47 47 | map(lambda x: x, y if y else z) -48 48 | map(lambda x: x, (y if y else z)) -49 |-map(lambda x: x, (x, y, z)) - 49 |+(x for x in (x, y, z)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap index e45cbc3bb2816..4929f8962ffa7 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap @@ -10,13 +10,6 @@ C418.py:1:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the | = help: Remove outer `dict` call -1 |-dict({}) - 1 |+{} -2 2 | dict({'a': 1}) -3 3 | dict({'x': 1 for x in range(10)}) -4 4 | dict( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C418.py:2:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`) | @@ -28,14 +21,6 @@ C418.py:2:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the | = help: Remove outer `dict` call -1 1 | dict({}) -2 |-dict({'a': 1}) - 2 |+{'a': 1} -3 3 | dict({'x': 1 for x in range(10)}) -4 4 | dict( -5 5 | {'x': 1 for x in range(10)} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C418.py:3:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`) | @@ -48,15 +33,6 @@ C418.py:3:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remov | = help: Remove outer `dict` call -1 1 | dict({}) -2 2 | dict({'a': 1}) -3 |-dict({'x': 1 for x in range(10)}) - 3 |+{'x': 1 for x in range(10)} -4 4 | dict( -5 5 | {'x': 1 for x in range(10)} -6 6 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C418.py:4:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`) | @@ -70,16 +46,3 @@ C418.py:4:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remov 8 | dict({}, a=1) | = help: Remove outer `dict` call - -1 1 | dict({}) -2 2 | dict({'a': 1}) -3 3 | dict({'x': 1 for x in range(10)}) -4 |-dict( -5 |- {'x': 1 for x in range(10)} -6 |-) - 4 |+{'x': 1 for x in range(10)} -7 5 | -8 6 | dict({}, a=1) -9 7 | dict({x: 1 for x in range(1)}, a=1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap index e20981cbd6c4b..d04eb2647624e 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap @@ -10,13 +10,6 @@ C419.py:1:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -1 |-any([x.id for x in bar]) - 1 |+any(x.id for x in bar) -2 2 | all([x.id for x in bar]) -3 3 | any( # first comment -4 4 | [x.id for x in bar], # second comment - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C419.py:2:5: C419 [*] Unnecessary list comprehension | @@ -28,14 +21,6 @@ C419.py:2:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -1 1 | any([x.id for x in bar]) -2 |-all([x.id for x in bar]) - 2 |+all(x.id for x in bar) -3 3 | any( # first comment -4 4 | [x.id for x in bar], # second comment -5 5 | ) # third comment - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C419.py:4:5: C419 [*] Unnecessary list comprehension | @@ -48,16 +33,6 @@ C419.py:4:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -1 1 | any([x.id for x in bar]) -2 2 | all([x.id for x in bar]) -3 3 | any( # first comment -4 |- [x.id for x in bar], # second comment - 4 |+ x.id for x in bar, # second comment -5 5 | ) # third comment -6 6 | all( # first comment -7 7 | [x.id for x in bar], # second comment - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C419.py:7:5: C419 [*] Unnecessary list comprehension | @@ -70,16 +45,6 @@ C419.py:7:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -4 4 | [x.id for x in bar], # second comment -5 5 | ) # third comment -6 6 | all( # first comment -7 |- [x.id for x in bar], # second comment - 7 |+ x.id for x in bar, # second comment -8 8 | ) # third comment -9 9 | any({x.id for x in bar}) -10 10 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C419.py:9:5: C419 [*] Unnecessary list comprehension | @@ -92,16 +57,6 @@ C419.py:9:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -6 6 | all( # first comment -7 7 | [x.id for x in bar], # second comment -8 8 | ) # third comment -9 |-any({x.id for x in bar}) - 9 |+any(x.id for x in bar) -10 10 | -11 11 | # OK -12 12 | all(x.id for x in bar) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C419.py:28:5: C419 [*] Unnecessary list comprehension | @@ -120,24 +75,6 @@ C419.py:28:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -25 25 | -26 26 | # Special comment handling -27 27 | any( -28 |- [ # lbracket comment -29 |- # second line comment -30 |- i.bit_count() - 28 |+ # lbracket comment - 29 |+ # second line comment - 30 |+ i.bit_count() -31 31 | # random middle comment -32 |- for i in range(5) # rbracket comment -33 |- ] # rpar comment - 32 |+ for i in range(5) # rbracket comment # rpar comment -34 33 | # trailing comment -35 34 | ) -36 35 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C419.py:39:5: C419 [*] Unnecessary list comprehension | @@ -152,18 +89,3 @@ C419.py:39:5: C419 [*] Unnecessary list comprehension 43 | ) | = help: Remove unnecessary list comprehension - -36 36 | -37 37 | # Weird case where the function call, opening bracket, and comment are all -38 38 | # on the same line. -39 |-any([ # lbracket comment -40 |- # second line comment -41 |- i.bit_count() for i in range(5) # rbracket comment -42 |- ] # rpar comment - 39 |+any( - 40 |+# lbracket comment - 41 |+# second line comment - 42 |+i.bit_count() for i in range(5) # rbracket comment # rpar comment -43 43 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C419_C419_1.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C419_C419_1.py.snap index b8111ca753f49..96f293084d558 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C419_C419_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__preview__C419_C419_1.py.snap @@ -10,13 +10,6 @@ C419_1.py:1:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -1 |-sum([x.val for x in bar]) - 1 |+sum(x.val for x in bar) -2 2 | min([x.val for x in bar]) -3 3 | max([x.val for x in bar]) -4 4 | sum([x.val for x in bar], 0) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C419_1.py:2:5: C419 [*] Unnecessary list comprehension | @@ -28,14 +21,6 @@ C419_1.py:2:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -1 1 | sum([x.val for x in bar]) -2 |-min([x.val for x in bar]) - 2 |+min(x.val for x in bar) -3 3 | max([x.val for x in bar]) -4 4 | sum([x.val for x in bar], 0) -5 5 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C419_1.py:3:5: C419 [*] Unnecessary list comprehension | @@ -47,15 +32,6 @@ C419_1.py:3:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -1 1 | sum([x.val for x in bar]) -2 2 | min([x.val for x in bar]) -3 |-max([x.val for x in bar]) - 3 |+max(x.val for x in bar) -4 4 | sum([x.val for x in bar], 0) -5 5 | -6 6 | # OK - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C419_1.py:4:5: C419 [*] Unnecessary list comprehension | @@ -68,16 +44,6 @@ C419_1.py:4:5: C419 [*] Unnecessary list comprehension | = help: Remove unnecessary list comprehension -1 1 | sum([x.val for x in bar]) -2 2 | min([x.val for x in bar]) -3 3 | max([x.val for x in bar]) -4 |-sum([x.val for x in bar], 0) - 4 |+sum((x.val for x in bar), 0) -5 5 | -6 6 | # OK -7 7 | sum(x.val for x in bar) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. C419_1.py:14:5: C419 [*] Unnecessary list comprehension | @@ -94,18 +60,3 @@ C419_1.py:14:5: C419 [*] Unnecessary list comprehension 20 | ) | = help: Remove unnecessary list comprehension - -11 11 | -12 12 | # Multi-line -13 13 | sum( -14 |- [ - 14 |+ ( -15 15 | delta -16 16 | for delta in timedelta_list -17 17 | if delta -18 |- ], - 18 |+ ), -19 19 | dt.timedelta(), -20 20 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap index e3c3e6464bfe0..8bc3ce01ad44d 100644 --- a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap +++ b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap @@ -9,17 +9,6 @@ EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variabl | = help: Assign to variable; remove string literal -2 2 | -3 3 | -4 4 | def f_a(): -5 |- raise RuntimeError("This is an example exception") - 5 |+ msg = "This is an example exception" - 6 |+ raise RuntimeError(msg) -6 7 | -7 8 | -8 9 | def f_a_short(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to variable first | @@ -30,17 +19,6 @@ EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -15 15 | -16 16 | def f_b(): -17 17 | example = "example" -18 |- raise RuntimeError(f"This is an {example} exception") - 18 |+ msg = f"This is an {example} exception" - 19 |+ raise RuntimeError(msg) -19 20 | -20 21 | -21 22 | def f_c(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | @@ -50,17 +28,6 @@ EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, ass | = help: Assign to variable; remove `.format()` string -19 19 | -20 20 | -21 21 | def f_c(): -22 |- raise RuntimeError("This is an {example} exception".format(example="example")) - 22 |+ msg = "This is an {example} exception".format(example="example") - 23 |+ raise RuntimeError(msg) -23 24 | -24 25 | -25 26 | def f_ok(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:32:24: EM101 [*] Exception must not use a string literal, assign to variable first | @@ -71,17 +38,6 @@ EM.py:32:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -29 29 | -30 30 | def f_msg_defined(): -31 31 | msg = "hello" -32 |- raise RuntimeError("This is an example exception") - 32 |+ msg = "This is an example exception" - 33 |+ raise RuntimeError(msg) -33 34 | -34 35 | -35 36 | def f_msg_in_nested_scope(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variable first | @@ -92,17 +48,6 @@ EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -36 36 | def nested(): -37 37 | msg = "hello" -38 38 | -39 |- raise RuntimeError("This is an example exception") - 39 |+ msg = "This is an example exception" - 40 |+ raise RuntimeError(msg) -40 41 | -41 42 | -42 43 | def f_msg_in_parent_scope(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:46:28: EM101 [*] Exception must not use a string literal, assign to variable first | @@ -112,17 +57,6 @@ EM.py:46:28: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -43 43 | msg = "hello" -44 44 | -45 45 | def nested(): -46 |- raise RuntimeError("This is an example exception") - 46 |+ msg = "This is an example exception" - 47 |+ raise RuntimeError(msg) -47 48 | -48 49 | -49 50 | def f_fix_indentation_check(foo): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variable first | @@ -135,17 +69,6 @@ EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -48 48 | -49 49 | def f_fix_indentation_check(foo): -50 50 | if foo: -51 |- raise RuntimeError("This is an example exception") - 51 |+ msg = "This is an example exception" - 52 |+ raise RuntimeError(msg) -52 53 | else: -53 54 | if foo == "foo": -54 55 | raise RuntimeError(f"This is an exception: {foo}") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to variable first | @@ -157,17 +80,6 @@ EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -51 51 | raise RuntimeError("This is an example exception") -52 52 | else: -53 53 | if foo == "foo": -54 |- raise RuntimeError(f"This is an exception: {foo}") - 54 |+ msg = f"This is an exception: {foo}" - 55 |+ raise RuntimeError(msg) -55 56 | raise RuntimeError("This is an exception: {}".format(foo)) -56 57 | -57 58 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | @@ -178,17 +90,6 @@ EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, ass | = help: Assign to variable; remove `.format()` string -52 52 | else: -53 53 | if foo == "foo": -54 54 | raise RuntimeError(f"This is an exception: {foo}") -55 |- raise RuntimeError("This is an exception: {}".format(foo)) - 55 |+ msg = "This is an exception: {}".format(foo) - 56 |+ raise RuntimeError(msg) -56 57 | -57 58 | -58 59 | # Report these, but don't fix them - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:59:28: EM101 Exception must not use a string literal, assign to variable first | @@ -216,17 +117,6 @@ EM.py:64:24: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -61 61 | -62 62 | -63 63 | def f_triple_quoted_string(): -64 |- raise RuntimeError(f"""This is an {"example"} exception""") - 64 |+ msg = f"""This is an {"example"} exception""" - 65 |+ raise RuntimeError(msg) -65 66 | -66 67 | -67 68 | def f_multi_line_string(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:76:9: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | @@ -241,23 +131,6 @@ EM.py:76:9: EM103 [*] Exception must not use a `.format()` string directly, assi | = help: Assign to variable; remove `.format()` string -72 72 | -73 73 | -74 74 | def f_multi_line_string2(): -75 |- raise RuntimeError( - 75 |+ msg = ( -76 76 | "This is an {example} exception".format( -77 77 | example="example" -78 78 | ) -79 79 | ) - 80 |+ raise RuntimeError( - 81 |+ msg - 82 |+ ) -80 83 | -81 84 | -82 85 | def f_multi_line_string2(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:84:9: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | @@ -274,21 +147,3 @@ EM.py:84:9: EM103 [*] Exception must not use a `.format()` string directly, assi 90 | ) | = help: Assign to variable; remove `.format()` string - -80 80 | -81 81 | -82 82 | def f_multi_line_string2(): -83 |- raise RuntimeError( - 83 |+ msg = ( -84 84 | ( -85 85 | "This is an " -86 86 | "{example} exception" --------------------------------------------------------------------------------- -88 88 | example="example" -89 89 | ) -90 90 | ) - 91 |+ raise RuntimeError( - 92 |+ msg - 93 |+ ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap index 1fc7454608f27..ca498b37b93c1 100644 --- a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap @@ -9,17 +9,6 @@ EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variabl | = help: Assign to variable; remove string literal -2 2 | -3 3 | -4 4 | def f_a(): -5 |- raise RuntimeError("This is an example exception") - 5 |+ msg = "This is an example exception" - 6 |+ raise RuntimeError(msg) -6 7 | -7 8 | -8 9 | def f_a_short(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:9:24: EM101 [*] Exception must not use a string literal, assign to variable first | @@ -29,17 +18,6 @@ EM.py:9:24: EM101 [*] Exception must not use a string literal, assign to variabl | = help: Assign to variable; remove string literal -6 6 | -7 7 | -8 8 | def f_a_short(): -9 |- raise RuntimeError("Error") - 9 |+ msg = "Error" - 10 |+ raise RuntimeError(msg) -10 11 | -11 12 | -12 13 | def f_a_empty(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:13:24: EM101 [*] Exception must not use a string literal, assign to variable first | @@ -49,17 +27,6 @@ EM.py:13:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -10 10 | -11 11 | -12 12 | def f_a_empty(): -13 |- raise RuntimeError("") - 13 |+ msg = "" - 14 |+ raise RuntimeError(msg) -14 15 | -15 16 | -16 17 | def f_b(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to variable first | @@ -70,17 +37,6 @@ EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -15 15 | -16 16 | def f_b(): -17 17 | example = "example" -18 |- raise RuntimeError(f"This is an {example} exception") - 18 |+ msg = f"This is an {example} exception" - 19 |+ raise RuntimeError(msg) -19 20 | -20 21 | -21 22 | def f_c(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | @@ -90,17 +46,6 @@ EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, ass | = help: Assign to variable; remove `.format()` string -19 19 | -20 20 | -21 21 | def f_c(): -22 |- raise RuntimeError("This is an {example} exception".format(example="example")) - 22 |+ msg = "This is an {example} exception".format(example="example") - 23 |+ raise RuntimeError(msg) -23 24 | -24 25 | -25 26 | def f_ok(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:32:24: EM101 [*] Exception must not use a string literal, assign to variable first | @@ -111,17 +56,6 @@ EM.py:32:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -29 29 | -30 30 | def f_msg_defined(): -31 31 | msg = "hello" -32 |- raise RuntimeError("This is an example exception") - 32 |+ msg = "This is an example exception" - 33 |+ raise RuntimeError(msg) -33 34 | -34 35 | -35 36 | def f_msg_in_nested_scope(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variable first | @@ -132,17 +66,6 @@ EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -36 36 | def nested(): -37 37 | msg = "hello" -38 38 | -39 |- raise RuntimeError("This is an example exception") - 39 |+ msg = "This is an example exception" - 40 |+ raise RuntimeError(msg) -40 41 | -41 42 | -42 43 | def f_msg_in_parent_scope(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:46:28: EM101 [*] Exception must not use a string literal, assign to variable first | @@ -152,17 +75,6 @@ EM.py:46:28: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -43 43 | msg = "hello" -44 44 | -45 45 | def nested(): -46 |- raise RuntimeError("This is an example exception") - 46 |+ msg = "This is an example exception" - 47 |+ raise RuntimeError(msg) -47 48 | -48 49 | -49 50 | def f_fix_indentation_check(foo): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variable first | @@ -175,17 +87,6 @@ EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -48 48 | -49 49 | def f_fix_indentation_check(foo): -50 50 | if foo: -51 |- raise RuntimeError("This is an example exception") - 51 |+ msg = "This is an example exception" - 52 |+ raise RuntimeError(msg) -52 53 | else: -53 54 | if foo == "foo": -54 55 | raise RuntimeError(f"This is an exception: {foo}") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to variable first | @@ -197,17 +98,6 @@ EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -51 51 | raise RuntimeError("This is an example exception") -52 52 | else: -53 53 | if foo == "foo": -54 |- raise RuntimeError(f"This is an exception: {foo}") - 54 |+ msg = f"This is an exception: {foo}" - 55 |+ raise RuntimeError(msg) -55 56 | raise RuntimeError("This is an exception: {}".format(foo)) -56 57 | -57 58 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | @@ -218,17 +108,6 @@ EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, ass | = help: Assign to variable; remove `.format()` string -52 52 | else: -53 53 | if foo == "foo": -54 54 | raise RuntimeError(f"This is an exception: {foo}") -55 |- raise RuntimeError("This is an exception: {}".format(foo)) - 55 |+ msg = "This is an exception: {}".format(foo) - 56 |+ raise RuntimeError(msg) -56 57 | -57 58 | -58 59 | # Report these, but don't fix them - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:59:28: EM101 Exception must not use a string literal, assign to variable first | @@ -256,17 +135,6 @@ EM.py:64:24: EM102 [*] Exception must not use an f-string literal, assign to var | = help: Assign to variable; remove f-string literal -61 61 | -62 62 | -63 63 | def f_triple_quoted_string(): -64 |- raise RuntimeError(f"""This is an {"example"} exception""") - 64 |+ msg = f"""This is an {"example"} exception""" - 65 |+ raise RuntimeError(msg) -65 66 | -66 67 | -67 68 | def f_multi_line_string(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:69:9: EM101 [*] Exception must not use a string literal, assign to variable first | @@ -280,22 +148,6 @@ EM.py:69:9: EM101 [*] Exception must not use a string literal, assign to variabl | = help: Assign to variable; remove string literal -65 65 | -66 66 | -67 67 | def f_multi_line_string(): -68 |- raise RuntimeError( - 68 |+ msg = ( -69 69 | "first" -70 70 | "second" -71 71 | ) - 72 |+ raise RuntimeError( - 73 |+ msg - 74 |+ ) -72 75 | -73 76 | -74 77 | def f_multi_line_string2(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:76:9: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | @@ -310,23 +162,6 @@ EM.py:76:9: EM103 [*] Exception must not use a `.format()` string directly, assi | = help: Assign to variable; remove `.format()` string -72 72 | -73 73 | -74 74 | def f_multi_line_string2(): -75 |- raise RuntimeError( - 75 |+ msg = ( -76 76 | "This is an {example} exception".format( -77 77 | example="example" -78 78 | ) -79 79 | ) - 80 |+ raise RuntimeError( - 81 |+ msg - 82 |+ ) -80 83 | -81 84 | -82 85 | def f_multi_line_string2(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. EM.py:84:9: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | @@ -343,21 +178,3 @@ EM.py:84:9: EM103 [*] Exception must not use a `.format()` string directly, assi 90 | ) | = help: Assign to variable; remove `.format()` string - -80 80 | -81 81 | -82 82 | def f_multi_line_string2(): -83 |- raise RuntimeError( - 83 |+ msg = ( -84 84 | ( -85 85 | "This is an " -86 86 | "{example} exception" --------------------------------------------------------------------------------- -88 88 | example="example" -89 89 | ) -90 90 | ) - 91 |+ raise RuntimeError( - 92 |+ msg - 93 |+ ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_lowercase.py.snap b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_lowercase.py.snap index 59f2b0613afde..4ddcfa6a4dd21 100644 --- a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_lowercase.py.snap +++ b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_lowercase.py.snap @@ -8,10 +8,3 @@ no_future_import_uses_lowercase.py:6:14: FA102 [*] Missing `from __future__ impo 7 | del y | = help: Add `from __future__ import annotations` - - 1 |+from __future__ import annotations -1 2 | def main() -> None: -2 3 | a_list: list[str] = [] -3 4 | a_list.append("hello") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union.py.snap b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union.py.snap index f400b10c0e7e7..6f7847f79f32c 100644 --- a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union.py.snap +++ b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union.py.snap @@ -9,12 +9,6 @@ no_future_import_uses_union.py:6:14: FA102 [*] Missing `from __future__ import a | = help: Add `from __future__ import annotations` - 1 |+from __future__ import annotations -1 2 | def main() -> None: -2 3 | a_list: list[str] | None = [] -3 4 | a_list.append("hello") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. no_future_import_uses_union.py:6:14: FA102 [*] Missing `from __future__ import annotations`, but uses PEP 604 union | @@ -23,10 +17,3 @@ no_future_import_uses_union.py:6:14: FA102 [*] Missing `from __future__ import a 7 | del y | = help: Add `from __future__ import annotations` - - 1 |+from __future__ import annotations -1 2 | def main() -> None: -2 3 | a_list: list[str] | None = [] -3 4 | a_list.append("hello") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union_inner.py.snap b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union_inner.py.snap index cc897dc713682..8a06aaa33492f 100644 --- a/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union_inner.py.snap +++ b/crates/ruff_linter/src/rules/flake8_future_annotations/snapshots/ruff_linter__rules__flake8_future_annotations__tests__fa102_no_future_import_uses_union_inner.py.snap @@ -10,12 +10,6 @@ no_future_import_uses_union_inner.py:6:14: FA102 [*] Missing `from __future__ im | = help: Add `from __future__ import annotations` - 1 |+from __future__ import annotations -1 2 | def main() -> None: -2 3 | a_list: list[str | None] = [] -3 4 | a_list.append("hello") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. no_future_import_uses_union_inner.py:6:19: FA102 [*] Missing `from __future__ import annotations`, but uses PEP 604 union | @@ -25,10 +19,3 @@ no_future_import_uses_union_inner.py:6:19: FA102 [*] Missing `from __future__ im 8 | del z | = help: Add `from __future__ import annotations` - - 1 |+from __future__ import annotations -1 2 | def main() -> None: -2 3 | a_list: list[str | None] = [] -3 4 | a_list.append("hello") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap index 705cd72db9435..d9dbdf1f00098 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap @@ -11,16 +11,6 @@ defaults.py:6:12: ICN001 [*] `altair` should be imported as `alt` | = help: Alias `altair` to `alt` -3 3 | -4 4 | -5 5 | def unconventional(): -6 |- import altair - 6 |+ import altair as alt -7 7 | import matplotlib.pyplot -8 8 | import numpy -9 9 | import pandas - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. defaults.py:7:12: ICN001 `matplotlib.pyplot` should be imported as `plt` | @@ -44,16 +34,6 @@ defaults.py:8:12: ICN001 [*] `numpy` should be imported as `np` | = help: Alias `numpy` to `np` -5 5 | def unconventional(): -6 6 | import altair -7 7 | import matplotlib.pyplot -8 |- import numpy - 8 |+ import numpy as np -9 9 | import pandas -10 10 | import seaborn -11 11 | import tkinter - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. defaults.py:9:12: ICN001 [*] `pandas` should be imported as `pd` | @@ -66,16 +46,6 @@ defaults.py:9:12: ICN001 [*] `pandas` should be imported as `pd` | = help: Alias `pandas` to `pd` -6 6 | import altair -7 7 | import matplotlib.pyplot -8 8 | import numpy -9 |- import pandas - 9 |+ import pandas as pd -10 10 | import seaborn -11 11 | import tkinter -12 12 | import networkx - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. defaults.py:10:12: ICN001 [*] `seaborn` should be imported as `sns` | @@ -88,16 +58,6 @@ defaults.py:10:12: ICN001 [*] `seaborn` should be imported as `sns` | = help: Alias `seaborn` to `sns` -7 7 | import matplotlib.pyplot -8 8 | import numpy -9 9 | import pandas -10 |- import seaborn - 10 |+ import seaborn as sns -11 11 | import tkinter -12 12 | import networkx -13 13 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. defaults.py:11:12: ICN001 [*] `tkinter` should be imported as `tk` | @@ -109,16 +69,6 @@ defaults.py:11:12: ICN001 [*] `tkinter` should be imported as `tk` | = help: Alias `tkinter` to `tk` -8 8 | import numpy -9 9 | import pandas -10 10 | import seaborn -11 |- import tkinter - 11 |+ import tkinter as tk -12 12 | import networkx -13 13 | -14 14 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. defaults.py:12:12: ICN001 [*] `networkx` should be imported as `nx` | @@ -129,16 +79,6 @@ defaults.py:12:12: ICN001 [*] `networkx` should be imported as `nx` | = help: Alias `networkx` to `nx` -9 9 | import pandas -10 10 | import seaborn -11 11 | import tkinter -12 |- import networkx - 12 |+ import networkx as nx -13 13 | -14 14 | -15 15 | def unconventional_aliases(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. defaults.py:16:22: ICN001 [*] `altair` should be imported as `alt` | @@ -150,16 +90,6 @@ defaults.py:16:22: ICN001 [*] `altair` should be imported as `alt` | = help: Alias `altair` to `alt` -13 13 | -14 14 | -15 15 | def unconventional_aliases(): -16 |- import altair as altr - 16 |+ import altair as alt -17 17 | import matplotlib.pyplot as plot -18 18 | import numpy as nmp -19 19 | import pandas as pdas - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. defaults.py:17:33: ICN001 [*] `matplotlib.pyplot` should be imported as `plt` | @@ -172,16 +102,6 @@ defaults.py:17:33: ICN001 [*] `matplotlib.pyplot` should be imported as `plt` | = help: Alias `matplotlib.pyplot` to `plt` -14 14 | -15 15 | def unconventional_aliases(): -16 16 | import altair as altr -17 |- import matplotlib.pyplot as plot - 17 |+ import matplotlib.pyplot as plt -18 18 | import numpy as nmp -19 19 | import pandas as pdas -20 20 | import seaborn as sbrn - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. defaults.py:18:21: ICN001 [*] `numpy` should be imported as `np` | @@ -194,16 +114,6 @@ defaults.py:18:21: ICN001 [*] `numpy` should be imported as `np` | = help: Alias `numpy` to `np` -15 15 | def unconventional_aliases(): -16 16 | import altair as altr -17 17 | import matplotlib.pyplot as plot -18 |- import numpy as nmp - 18 |+ import numpy as np -19 19 | import pandas as pdas -20 20 | import seaborn as sbrn -21 21 | import tkinter as tkr - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. defaults.py:19:22: ICN001 [*] `pandas` should be imported as `pd` | @@ -216,16 +126,6 @@ defaults.py:19:22: ICN001 [*] `pandas` should be imported as `pd` | = help: Alias `pandas` to `pd` -16 16 | import altair as altr -17 17 | import matplotlib.pyplot as plot -18 18 | import numpy as nmp -19 |- import pandas as pdas - 19 |+ import pandas as pd -20 20 | import seaborn as sbrn -21 21 | import tkinter as tkr -22 22 | import networkx as nxy - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. defaults.py:20:23: ICN001 [*] `seaborn` should be imported as `sns` | @@ -238,16 +138,6 @@ defaults.py:20:23: ICN001 [*] `seaborn` should be imported as `sns` | = help: Alias `seaborn` to `sns` -17 17 | import matplotlib.pyplot as plot -18 18 | import numpy as nmp -19 19 | import pandas as pdas -20 |- import seaborn as sbrn - 20 |+ import seaborn as sns -21 21 | import tkinter as tkr -22 22 | import networkx as nxy -23 23 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. defaults.py:21:23: ICN001 [*] `tkinter` should be imported as `tk` | @@ -259,16 +149,6 @@ defaults.py:21:23: ICN001 [*] `tkinter` should be imported as `tk` | = help: Alias `tkinter` to `tk` -18 18 | import numpy as nmp -19 19 | import pandas as pdas -20 20 | import seaborn as sbrn -21 |- import tkinter as tkr - 21 |+ import tkinter as tk -22 22 | import networkx as nxy -23 23 | -24 24 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. defaults.py:22:24: ICN001 [*] `networkx` should be imported as `nx` | @@ -278,14 +158,3 @@ defaults.py:22:24: ICN001 [*] `networkx` should be imported as `nx` | ^^^ ICN001 | = help: Alias `networkx` to `nx` - -19 19 | import pandas as pdas -20 20 | import seaborn as sbrn -21 21 | import tkinter as tkr -22 |- import networkx as nxy - 22 |+ import networkx as nx -23 23 | -24 24 | -25 25 | def conventional_aliases(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__same_name.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__same_name.snap index ebed3f82b501c..3e8042bfa409e 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__same_name.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__same_name.snap @@ -8,11 +8,3 @@ same_name.py:10:41: ICN001 [*] `django.conf.settings` should be imported as `set | ^ ICN001 | = help: Alias `django.conf.settings` to `settings` - -7 7 | -8 8 | -9 9 | def unconventional_alias(): -10 |- from django.conf import settings as s - 10 |+ from django.conf import settings as settings - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap index 14c2fdd0d4292..990c06525183d 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap @@ -11,15 +11,3 @@ tricky.py:7:16: ICN001 [*] `pandas` should be imported as `pd` 9 | return False | = help: Alias `pandas` to `pd` - -3 3 | -4 4 | def rename_global(): -5 5 | try: -6 |- global pandas -7 |- import pandas - 6 |+ global pd - 7 |+ import pandas as pd -8 8 | except ImportError: -9 9 | return False - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap index e89fe2d4d4232..3aa6319fe89bd 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap @@ -12,14 +12,6 @@ LOG001.py:3:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers | = help: Replace with `logging.getLogger()` -1 1 | import logging -2 2 | -3 |-logging.Logger(__name__) - 3 |+logging.getLogger(__name__) -4 4 | logging.Logger() -5 5 | logging.getLogger(__name__) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. LOG001.py:4:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers | @@ -29,12 +21,3 @@ LOG001.py:4:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers 5 | logging.getLogger(__name__) | = help: Replace with `logging.getLogger()` - -1 1 | import logging -2 2 | -3 3 | logging.Logger(__name__) -4 |-logging.Logger() - 4 |+logging.getLogger() -5 5 | logging.getLogger(__name__) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap index e6b44674522f0..ca25db02fa87b 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap @@ -10,16 +10,6 @@ LOG002.py:11:11: LOG002 [*] Use `__name__` with `logging.getLogger()` | = help: Replace with `__name__` -8 8 | logging.getLogger(name="custom") -9 9 | -10 10 | # LOG002 -11 |-getLogger(__file__) - 11 |+getLogger(__name__) -12 12 | logging.getLogger(name=__file__) -13 13 | -14 14 | logging.getLogger(__cached__) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. LOG002.py:12:24: LOG002 [*] Use `__name__` with `logging.getLogger()` | @@ -32,16 +22,6 @@ LOG002.py:12:24: LOG002 [*] Use `__name__` with `logging.getLogger()` | = help: Replace with `__name__` -9 9 | -10 10 | # LOG002 -11 11 | getLogger(__file__) -12 |-logging.getLogger(name=__file__) - 12 |+logging.getLogger(name=__name__) -13 13 | -14 14 | logging.getLogger(__cached__) -15 15 | getLogger(name=__cached__) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. LOG002.py:14:19: LOG002 [*] Use `__name__` with `logging.getLogger()` | @@ -53,16 +33,6 @@ LOG002.py:14:19: LOG002 [*] Use `__name__` with `logging.getLogger()` | = help: Replace with `__name__` -11 11 | getLogger(__file__) -12 12 | logging.getLogger(name=__file__) -13 13 | -14 |-logging.getLogger(__cached__) - 14 |+logging.getLogger(__name__) -15 15 | getLogger(name=__cached__) -16 16 | -17 17 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. LOG002.py:15:16: LOG002 [*] Use `__name__` with `logging.getLogger()` | @@ -71,14 +41,3 @@ LOG002.py:15:16: LOG002 [*] Use `__name__` with `logging.getLogger()` | ^^^^^^^^^^ LOG002 | = help: Replace with `__name__` - -12 12 | logging.getLogger(name=__file__) -13 13 | -14 14 | logging.getLogger(__cached__) -15 |-getLogger(name=__cached__) - 15 |+getLogger(name=__name__) -16 16 | -17 17 | -18 18 | # Override `logging.getLogger` - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap index 2bb2f76079eb9..12464bcf56e6f 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap @@ -12,15 +12,6 @@ PIE794.py:4:5: PIE794 [*] Class field `name` is defined multiple times | = help: Remove duplicate field definition for `name` -1 1 | class Foo(BaseModel): -2 2 | name = StringField() -3 3 | # .... -4 |- name = StringField() # PIE794 -5 4 | -6 5 | def remove(self) -> None: -7 6 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PIE794.py:13:5: PIE794 [*] Class field `name` is defined multiple times | @@ -33,15 +24,6 @@ PIE794.py:13:5: PIE794 [*] Class field `name` is defined multiple times | = help: Remove duplicate field definition for `name` -10 10 | class Foo(BaseModel): -11 11 | name: str = StringField() -12 12 | # .... -13 |- name = StringField() # PIE794 -14 13 | -15 14 | def foo(self) -> None: -16 15 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PIE794.py:23:5: PIE794 [*] Class field `bar` is defined multiple times | @@ -52,15 +34,6 @@ PIE794.py:23:5: PIE794 [*] Class field `bar` is defined multiple times | = help: Remove duplicate field definition for `bar` -20 20 | bar: str = StringField() -21 21 | foo: bool = BooleanField() -22 22 | # ... -23 |- bar = StringField() # PIE794 -24 23 | -25 24 | -26 25 | class User(BaseModel): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PIE794.py:40:5: PIE794 [*] Class field `bar` is defined multiple times | @@ -71,15 +44,6 @@ PIE794.py:40:5: PIE794 [*] Class field `bar` is defined multiple times | = help: Remove duplicate field definition for `bar` -37 37 | bar: str = StringField() -38 38 | foo: bool = BooleanField() -39 39 | # ... -40 |- bar = StringField() # PIE794 -41 40 | -42 41 | -43 42 | class Person: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PIE794.py:46:5: PIE794 [*] Class field `name` is defined multiple times | @@ -90,15 +54,6 @@ PIE794.py:46:5: PIE794 [*] Class field `name` is defined multiple times | = help: Remove duplicate field definition for `name` -43 43 | class Person: -44 44 | name = "Foo" -45 45 | name = name + " Bar" -46 |- name = "Bar" # PIE794 -47 46 | -48 47 | -49 48 | class Person: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PIE794.py:52:5: PIE794 [*] Class field `name` is defined multiple times | @@ -108,10 +63,3 @@ PIE794.py:52:5: PIE794 [*] Class field `name` is defined multiple times | ^^^^^^^^^^^^^^^^^ PIE794 | = help: Remove duplicate field definition for `name` - -49 49 | class Person: -50 50 | name: str = "Foo" -51 51 | name: str = name + " Bar" -52 |- name: str = "Bar" # PIE794 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap index 9103ab91fdbe1..525fc0af242a8 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap @@ -11,14 +11,6 @@ PIE810.py:2:1: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -1 1 | # error -2 |-obj.startswith("foo") or obj.startswith("bar") - 2 |+obj.startswith(("foo", "bar")) -3 3 | # error -4 4 | obj.endswith("foo") or obj.endswith("bar") -5 5 | # error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PIE810.py:4:1: PIE810 [*] Call `endswith` once with a `tuple` | @@ -31,16 +23,6 @@ PIE810.py:4:1: PIE810 [*] Call `endswith` once with a `tuple` | = help: Merge into a single `endswith` call -1 1 | # error -2 2 | obj.startswith("foo") or obj.startswith("bar") -3 3 | # error -4 |-obj.endswith("foo") or obj.endswith("bar") - 4 |+obj.endswith(("foo", "bar")) -5 5 | # error -6 6 | obj.startswith(foo) or obj.startswith(bar) -7 7 | # error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PIE810.py:6:1: PIE810 [*] Call `startswith` once with a `tuple` | @@ -53,16 +35,6 @@ PIE810.py:6:1: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -3 3 | # error -4 4 | obj.endswith("foo") or obj.endswith("bar") -5 5 | # error -6 |-obj.startswith(foo) or obj.startswith(bar) - 6 |+obj.startswith((foo, bar)) -7 7 | # error -8 8 | obj.startswith(foo) or obj.startswith("foo") -9 9 | # error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PIE810.py:8:1: PIE810 [*] Call `startswith` once with a `tuple` | @@ -75,16 +47,6 @@ PIE810.py:8:1: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -5 5 | # error -6 6 | obj.startswith(foo) or obj.startswith(bar) -7 7 | # error -8 |-obj.startswith(foo) or obj.startswith("foo") - 8 |+obj.startswith((foo, "foo")) -9 9 | # error -10 10 | obj.endswith(foo) or obj.startswith(foo) or obj.startswith("foo") -11 11 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PIE810.py:10:1: PIE810 [*] Call `startswith` once with a `tuple` | @@ -97,16 +59,6 @@ PIE810.py:10:1: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -7 7 | # error -8 8 | obj.startswith(foo) or obj.startswith("foo") -9 9 | # error -10 |-obj.endswith(foo) or obj.startswith(foo) or obj.startswith("foo") - 10 |+obj.endswith(foo) or obj.startswith((foo, "foo")) -11 11 | -12 12 | def func(): -13 13 | msg = "hello world" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PIE810.py:19:8: PIE810 [*] Call `startswith` once with a `tuple` | @@ -118,16 +70,6 @@ PIE810.py:19:8: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -16 16 | y = ("h", "e", "l", "l", "o") -17 17 | z = "w" -18 18 | -19 |- if msg.startswith(x) or msg.startswith(y) or msg.startswith(z): # Error - 19 |+ if msg.startswith((x, z)) or msg.startswith(y): # Error -20 20 | print("yes") -21 21 | -22 22 | def func(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PIE810.py:25:8: PIE810 [*] Call `startswith` once with a `tuple` | @@ -138,14 +80,3 @@ PIE810.py:25:8: PIE810 [*] Call `startswith` once with a `tuple` 26 | print("yes") | = help: Merge into a single `startswith` call - -22 22 | def func(): -23 23 | msg = "hello world" -24 24 | -25 |- if msg.startswith(("h", "e", "l", "l", "o")) or msg.startswith("h") or msg.startswith("w"): # Error - 25 |+ if msg.startswith(("h", "e", "l", "l", "o", "h", "w")): # Error -26 26 | print("yes") -27 27 | -28 28 | # ok - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap index 3c5c228a36f63..4ca88a08185fd 100644 --- a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap +++ b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T201_T201.py.snap @@ -12,15 +12,6 @@ T201.py:4:1: T201 [*] `print` found | = help: Remove `print` -1 1 | import sys -2 2 | import tempfile -3 3 | -4 |-print("Hello, world!") # T201 -5 4 | print("Hello, world!", file=None) # T201 -6 5 | print("Hello, world!", file=sys.stdout) # T201 -7 6 | print("Hello, world!", file=sys.stderr) # T201 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. T201.py:5:1: T201 [*] `print` found | @@ -32,15 +23,6 @@ T201.py:5:1: T201 [*] `print` found | = help: Remove `print` -2 2 | import tempfile -3 3 | -4 4 | print("Hello, world!") # T201 -5 |-print("Hello, world!", file=None) # T201 -6 5 | print("Hello, world!", file=sys.stdout) # T201 -7 6 | print("Hello, world!", file=sys.stderr) # T201 -8 7 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. T201.py:6:1: T201 [*] `print` found | @@ -52,15 +34,6 @@ T201.py:6:1: T201 [*] `print` found | = help: Remove `print` -3 3 | -4 4 | print("Hello, world!") # T201 -5 5 | print("Hello, world!", file=None) # T201 -6 |-print("Hello, world!", file=sys.stdout) # T201 -7 6 | print("Hello, world!", file=sys.stderr) # T201 -8 7 | -9 8 | with tempfile.NamedTemporaryFile() as fp: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. T201.py:7:1: T201 [*] `print` found | @@ -72,13 +45,3 @@ T201.py:7:1: T201 [*] `print` found 9 | with tempfile.NamedTemporaryFile() as fp: | = help: Remove `print` - -4 4 | print("Hello, world!") # T201 -5 5 | print("Hello, world!", file=None) # T201 -6 6 | print("Hello, world!", file=sys.stdout) # T201 -7 |-print("Hello, world!", file=sys.stderr) # T201 -8 7 | -9 8 | with tempfile.NamedTemporaryFile() as fp: -10 9 | print("Hello, world!", file=fp) # OK - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap index 1a67512ddedb5..019a1043075d0 100644 --- a/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap +++ b/crates/ruff_linter/src/rules/flake8_print/snapshots/ruff_linter__rules__flake8_print__tests__T203_T203.py.snap @@ -12,14 +12,6 @@ T203.py:3:1: T203 [*] `pprint` found | = help: Remove `pprint` -1 1 | from pprint import pprint -2 2 | -3 |-pprint("Hello, world!") # T203 -4 3 | -5 4 | import pprint -6 5 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. T203.py:7:1: T203 [*] `pprint` found | @@ -31,12 +23,3 @@ T203.py:7:1: T203 [*] `pprint` found 9 | pprint.pformat("Hello, world!") | = help: Remove `pprint` - -4 4 | -5 5 | import pprint -6 6 | -7 |-pprint.pprint("Hello, world!") # T203 -8 7 | -9 8 | pprint.pformat("Hello, world!") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap index 4fc9b8b3ac89c..4c4fe8a98ac80 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.py.snap @@ -11,25 +11,3 @@ PYI025_2.py:3:29: PYI025 [*] Use `from collections.abc import Set as AbstractSet 5 | __all__ = ["Set"] | = help: Alias `Set` to `AbstractSet` - -1 1 | """Tests to ensure we correctly rename references inside `__all__`""" -2 2 | -3 |-from collections.abc import Set - 3 |+from collections.abc import Set as AbstractSet -4 4 | -5 |-__all__ = ["Set"] - 5 |+__all__ = ["AbstractSet"] -6 6 | -7 7 | if True: -8 |- __all__ += [r'''Set'''] - 8 |+ __all__ += ["AbstractSet"] -9 9 | -10 10 | if 1: -11 |- __all__ += ["S" "e" "t"] - 11 |+ __all__ += ["AbstractSet"] -12 12 | -13 13 | if not False: -14 |- __all__ += ["Se" 't'] - 14 |+ __all__ += ["AbstractSet"] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap index 651209aacb975..df115ef950559 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_2.pyi.snap @@ -11,25 +11,3 @@ PYI025_2.pyi:3:29: PYI025 [*] Use `from collections.abc import Set as AbstractSe 5 | __all__ = ["Set"] | = help: Alias `Set` to `AbstractSet` - -1 1 | """Tests to ensure we correctly rename references inside `__all__`""" -2 2 | -3 |-from collections.abc import Set - 3 |+from collections.abc import Set as AbstractSet -4 4 | -5 |-__all__ = ["Set"] - 5 |+__all__ = ["AbstractSet"] -6 6 | -7 7 | if True: -8 |- __all__ += [r'''Set'''] - 8 |+ __all__ += ["AbstractSet"] -9 9 | -10 10 | if 1: -11 |- __all__ += ["S" "e" "t"] - 11 |+ __all__ += ["AbstractSet"] -12 12 | -13 13 | if not False: -14 |- __all__ += ["Se" 't'] - 14 |+ __all__ += ["AbstractSet"] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap index 9171845dee44b..ac1f3499d93f9 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.py.snap @@ -9,11 +9,3 @@ PYI025_3.py:6:36: PYI025 [*] Use `from collections.abc import Set as AbstractSet | ^^^ PYI025 | = help: Alias `Set` to `AbstractSet` - -3 3 | through usage of a "redundant" `import Set as Set` alias -4 4 | """ -5 5 | -6 |-from collections.abc import Set as Set # PYI025 triggered but fix is not marked as safe - 6 |+from collections.abc import Set as AbstractSet # PYI025 triggered but fix is not marked as safe - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap index 7e0cd0c7f6b8f..02978bef495b9 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_3.pyi.snap @@ -9,11 +9,3 @@ PYI025_3.pyi:6:36: PYI025 [*] Use `from collections.abc import Set as AbstractSe | ^^^ PYI025 | = help: Alias `Set` to `AbstractSet` - -3 3 | through usage of a "redundant" `import Set as Set` alias -4 4 | """ -5 5 | -6 |-from collections.abc import Set as Set # PYI025 triggered but fix is not marked as safe - 6 |+from collections.abc import Set as AbstractSet # PYI025 triggered but fix is not marked as safe - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap index b27f08d42c354..8f26915479d2f 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap @@ -10,16 +10,6 @@ PT003.py:14:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -11 11 | ... -12 12 | -13 13 | -14 |-@pytest.fixture(scope="function") - 14 |+@pytest.fixture() -15 15 | def error(): -16 16 | ... -17 17 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT003.py:19:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | @@ -30,16 +20,6 @@ PT003.py:19:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -16 16 | ... -17 17 | -18 18 | -19 |-@pytest.fixture(scope="function", name="my_fixture") - 19 |+@pytest.fixture(name="my_fixture") -20 20 | def error_multiple_args(): -21 21 | ... -22 22 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT003.py:24:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | @@ -50,16 +30,6 @@ PT003.py:24:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -21 21 | ... -22 22 | -23 23 | -24 |-@pytest.fixture(name="my_fixture", scope="function") - 24 |+@pytest.fixture(name="my_fixture") -25 25 | def error_multiple_args(): -26 26 | ... -27 27 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT003.py:29:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | @@ -70,16 +40,6 @@ PT003.py:29:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -26 26 | ... -27 27 | -28 28 | -29 |-@pytest.fixture(name="my_fixture", scope="function", **kwargs) - 29 |+@pytest.fixture(name="my_fixture", **kwargs) -30 30 | def error_second_arg(): -31 31 | ... -32 32 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT003.py:37:31: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | @@ -92,16 +52,6 @@ PT003.py:37:31: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -34 34 | # pytest.fixture does not take positional arguments, however this -35 35 | # tests the general case as we use a helper function that should -36 36 | # work for all cases. -37 |-@pytest.fixture("my_fixture", scope="function") - 37 |+@pytest.fixture("my_fixture") -38 38 | def error_arg(): -39 39 | ... -40 40 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT003.py:43:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | @@ -113,15 +63,6 @@ PT003.py:43:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -40 40 | -41 41 | -42 42 | @pytest.fixture( -43 |- scope="function", -44 43 | name="my_fixture", -45 44 | ) -46 45 | def error_multiple_args(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT003.py:52:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | @@ -134,15 +75,6 @@ PT003.py:52:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -49 49 | -50 50 | @pytest.fixture( -51 51 | name="my_fixture", -52 |- scope="function", -53 52 | ) -54 53 | def error_multiple_args(): -55 54 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT003.py:66:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | @@ -155,16 +87,3 @@ PT003.py:66:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` 68 | , | = help: Remove implied `scope` argument - -63 63 | -64 64 | # another comment ,) -65 65 | -66 |- scope=\ -67 |- "function" # some comment ), -68 |- , -69 |- -70 66 | name2=name, name3="my_fixture", **kwargs -71 67 | ) -72 68 | def error_multiple_args(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap index 1df658037c41a..fd3a1dbc055ee 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap @@ -10,16 +10,6 @@ PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string of comma-separated values for the first argument -21 21 | ... -22 22 | -23 23 | -24 |-@pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)]) - 24 |+@pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) -25 25 | def test_tuple(param1, param2): -26 26 | ... -27 27 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` | @@ -50,16 +40,6 @@ PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a string of comma-separated values for the first argument -31 31 | ... -32 32 | -33 33 | -34 |-@pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) - 34 |+@pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) -35 35 | def test_list(param1, param2): -36 36 | ... -37 37 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap index 220f99de16140..81c3b9d67749b 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap @@ -10,16 +10,6 @@ PT006.py:9:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.pa | = help: Use a `tuple` for the first argument -6 6 | ... -7 7 | -8 8 | -9 |-@pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) - 9 |+@pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)]) -10 10 | def test_csv(param1, param2): -11 11 | ... -12 12 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | @@ -30,16 +20,6 @@ PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -11 11 | ... -12 12 | -13 13 | -14 |-@pytest.mark.parametrize(" param1, , param2 , ", [(1, 2), (3, 4)]) - 14 |+@pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)]) -15 15 | def test_csv_with_whitespace(param1, param2): -16 16 | ... -17 17 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | @@ -50,16 +30,6 @@ PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -16 16 | ... -17 17 | -18 18 | -19 |-@pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) - 19 |+@pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)]) -20 20 | def test_csv_bad_quotes(param1, param2): -21 21 | ... -22 22 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` | @@ -90,16 +60,6 @@ PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -31 31 | ... -32 32 | -33 33 | -34 |-@pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) - 34 |+@pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)]) -35 35 | def test_list(param1, param2): -36 36 | ... -37 37 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` | @@ -130,16 +90,6 @@ PT006.py:44:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -41 41 | ... -42 42 | -43 43 | -44 |-@pytest.mark.parametrize([some_expr, another_expr], [1, 2, 3]) - 44 |+@pytest.mark.parametrize((some_expr, another_expr), [1, 2, 3]) -45 45 | def test_list_expressions(param1, param2): -46 46 | ... -47 47 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:49:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | @@ -150,16 +100,6 @@ PT006.py:49:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -46 46 | ... -47 47 | -48 48 | -49 |-@pytest.mark.parametrize([some_expr, "param2"], [1, 2, 3]) - 49 |+@pytest.mark.parametrize((some_expr, "param2"), [1, 2, 3]) -50 50 | def test_list_mixed_expr_literal(param1, param2): -51 51 | ... -52 52 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | @@ -170,16 +110,6 @@ PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -51 51 | ... -52 52 | -53 53 | -54 |-@pytest.mark.parametrize(("param1, " "param2, " "param3"), [(1, 2, 3), (4, 5, 6)]) - 54 |+@pytest.mark.parametrize(("param1", "param2", "param3"), [(1, 2, 3), (4, 5, 6)]) -55 55 | def test_implicit_str_concat_with_parens(param1, param2, param3): -56 56 | ... -57 57 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | @@ -190,16 +120,6 @@ PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -56 56 | ... -57 57 | -58 58 | -59 |-@pytest.mark.parametrize("param1, " "param2, " "param3", [(1, 2, 3), (4, 5, 6)]) - 59 |+@pytest.mark.parametrize(("param1", "param2", "param3"), [(1, 2, 3), (4, 5, 6)]) -60 60 | def test_implicit_str_concat_no_parens(param1, param2, param3): -61 61 | ... -62 62 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | @@ -210,16 +130,6 @@ PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `tuple` for the first argument -61 61 | ... -62 62 | -63 63 | -64 |-@pytest.mark.parametrize((("param1, " "param2, " "param3")), [(1, 2, 3), (4, 5, 6)]) - 64 |+@pytest.mark.parametrize(("param1", "param2", "param3"), [(1, 2, 3), (4, 5, 6)]) -65 65 | def test_implicit_str_concat_with_multi_parens(param1, param2, param3): -66 66 | ... -67 67 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:69:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | @@ -229,13 +139,3 @@ PT006.py:69:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 71 | ... | = help: Use a `tuple` for the first argument - -66 66 | ... -67 67 | -68 68 | -69 |-@pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)]) - 69 |+@pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)]) -70 70 | def test_csv_with_parens(param1, param2): -71 71 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap index 9ce223af2cc01..ab38f140219e4 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap @@ -10,16 +10,6 @@ PT006.py:9:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.pa | = help: Use a `list` for the first argument -6 6 | ... -7 7 | -8 8 | -9 |-@pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) - 9 |+@pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) -10 10 | def test_csv(param1, param2): -11 11 | ... -12 12 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` | @@ -30,16 +20,6 @@ PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -11 11 | ... -12 12 | -13 13 | -14 |-@pytest.mark.parametrize(" param1, , param2 , ", [(1, 2), (3, 4)]) - 14 |+@pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) -15 15 | def test_csv_with_whitespace(param1, param2): -16 16 | ... -17 17 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` | @@ -50,16 +30,6 @@ PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -16 16 | ... -17 17 | -18 18 | -19 |-@pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) - 19 |+@pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) -20 20 | def test_csv_bad_quotes(param1, param2): -21 21 | ... -22 22 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` | @@ -70,16 +40,6 @@ PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -21 21 | ... -22 22 | -23 23 | -24 |-@pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)]) - 24 |+@pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) -25 25 | def test_tuple(param1, param2): -26 26 | ... -27 27 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` | @@ -130,16 +90,6 @@ PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -51 51 | ... -52 52 | -53 53 | -54 |-@pytest.mark.parametrize(("param1, " "param2, " "param3"), [(1, 2, 3), (4, 5, 6)]) - 54 |+@pytest.mark.parametrize(["param1", "param2", "param3"], [(1, 2, 3), (4, 5, 6)]) -55 55 | def test_implicit_str_concat_with_parens(param1, param2, param3): -56 56 | ... -57 57 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` | @@ -150,16 +100,6 @@ PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -56 56 | ... -57 57 | -58 58 | -59 |-@pytest.mark.parametrize("param1, " "param2, " "param3", [(1, 2, 3), (4, 5, 6)]) - 59 |+@pytest.mark.parametrize(["param1", "param2", "param3"], [(1, 2, 3), (4, 5, 6)]) -60 60 | def test_implicit_str_concat_no_parens(param1, param2, param3): -61 61 | ... -62 62 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` | @@ -170,16 +110,6 @@ PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p | = help: Use a `list` for the first argument -61 61 | ... -62 62 | -63 63 | -64 |-@pytest.mark.parametrize((("param1, " "param2, " "param3")), [(1, 2, 3), (4, 5, 6)]) - 64 |+@pytest.mark.parametrize(["param1", "param2", "param3"], [(1, 2, 3), (4, 5, 6)]) -65 65 | def test_implicit_str_concat_with_multi_parens(param1, param2, param3): -66 66 | ... -67 67 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT006.py:69:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` | @@ -189,13 +119,3 @@ PT006.py:69:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 71 | ... | = help: Use a `list` for the first argument - -66 66 | ... -67 67 | -68 68 | -69 |-@pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)]) - 69 |+@pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) -70 70 | def test_csv_with_parens(param1, param2): -71 71 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_lists.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_lists.snap index b9369c1101875..09ddb219d9ec3 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_lists.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_lists.snap @@ -10,16 +10,6 @@ PT007.py:4:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -1 1 | import pytest -2 2 | -3 3 | -4 |-@pytest.mark.parametrize("param", (1, 2)) - 4 |+@pytest.mark.parametrize("param", [1, 2]) -5 5 | def test_tuple(param): -6 6 | ... -7 7 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:11:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | @@ -36,20 +26,6 @@ PT007.py:11:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -8 8 | -9 9 | @pytest.mark.parametrize( -10 10 | ("param1", "param2"), -11 |- ( - 11 |+ [ -12 12 | (1, 2), -13 13 | (3, 4), -14 |- ), - 14 |+ ], -15 15 | ) -16 16 | def test_tuple_of_tuples(param1, param2): -17 17 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:12:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | @@ -62,16 +38,6 @@ PT007.py:12:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -9 9 | @pytest.mark.parametrize( -10 10 | ("param1", "param2"), -11 11 | ( -12 |- (1, 2), - 12 |+ [1, 2], -13 13 | (3, 4), -14 14 | ), -15 15 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:13:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | @@ -84,16 +50,6 @@ PT007.py:13:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -10 10 | ("param1", "param2"), -11 11 | ( -12 12 | (1, 2), -13 |- (3, 4), - 13 |+ [3, 4], -14 14 | ), -15 15 | ) -16 16 | def test_tuple_of_tuples(param1, param2): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:22:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | @@ -110,20 +66,6 @@ PT007.py:22:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -19 19 | -20 20 | @pytest.mark.parametrize( -21 21 | ("param1", "param2"), -22 |- ( - 22 |+ [ -23 23 | [1, 2], -24 24 | [3, 4], -25 |- ), - 25 |+ ], -26 26 | ) -27 27 | def test_tuple_of_lists(param1, param2): -28 28 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:39:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | @@ -136,16 +78,6 @@ PT007.py:39:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -36 36 | @pytest.mark.parametrize( -37 37 | ("param1", "param2"), -38 38 | [ -39 |- (1, 2), - 39 |+ [1, 2], -40 40 | (3, 4), -41 41 | ], -42 42 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:40:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | @@ -158,16 +90,6 @@ PT007.py:40:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `list` for parameter values -37 37 | ("param1", "param2"), -38 38 | [ -39 39 | (1, 2), -40 |- (3, 4), - 40 |+ [3, 4], -41 41 | ], -42 42 | ) -43 43 | def test_list_of_tuples(param1, param2): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:81:38: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | @@ -179,16 +101,6 @@ PT007.py:81:38: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `list` of `list` for parameter values -78 78 | -79 79 | -80 80 | @pytest.mark.parametrize("a", [1, 2]) -81 |-@pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) - 81 |+@pytest.mark.parametrize(("b", "c"), [(3, 4), (5, 6)]) -82 82 | @pytest.mark.parametrize("d", [3,]) -83 83 | @pytest.mark.parametrize( -84 84 | "d", - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:81:39: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | @@ -200,16 +112,6 @@ PT007.py:81:39: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `list` of `list` for parameter values -78 78 | -79 79 | -80 80 | @pytest.mark.parametrize("a", [1, 2]) -81 |-@pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) - 81 |+@pytest.mark.parametrize(("b", "c"), ([3, 4], (5, 6))) -82 82 | @pytest.mark.parametrize("d", [3,]) -83 83 | @pytest.mark.parametrize( -84 84 | "d", - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:81:47: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | @@ -220,14 +122,3 @@ PT007.py:81:47: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect 83 | @pytest.mark.parametrize( | = help: Use `list` of `list` for parameter values - -78 78 | -79 79 | -80 80 | @pytest.mark.parametrize("a", [1, 2]) -81 |-@pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) - 81 |+@pytest.mark.parametrize(("b", "c"), ((3, 4), [5, 6])) -82 82 | @pytest.mark.parametrize("d", [3,]) -83 83 | @pytest.mark.parametrize( -84 84 | "d", - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_tuples.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_tuples.snap index 21214fd3d0606..8ad1982c5e787 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_tuples.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_tuples.snap @@ -10,16 +10,6 @@ PT007.py:4:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -1 1 | import pytest -2 2 | -3 3 | -4 |-@pytest.mark.parametrize("param", (1, 2)) - 4 |+@pytest.mark.parametrize("param", [1, 2]) -5 5 | def test_tuple(param): -6 6 | ... -7 7 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:11:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | @@ -36,20 +26,6 @@ PT007.py:11:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -8 8 | -9 9 | @pytest.mark.parametrize( -10 10 | ("param1", "param2"), -11 |- ( - 11 |+ [ -12 12 | (1, 2), -13 13 | (3, 4), -14 |- ), - 14 |+ ], -15 15 | ) -16 16 | def test_tuple_of_tuples(param1, param2): -17 17 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:22:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | @@ -66,20 +42,6 @@ PT007.py:22:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -19 19 | -20 20 | @pytest.mark.parametrize( -21 21 | ("param1", "param2"), -22 |- ( - 22 |+ [ -23 23 | [1, 2], -24 24 | [3, 4], -25 |- ), - 25 |+ ], -26 26 | ) -27 27 | def test_tuple_of_lists(param1, param2): -28 28 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:23:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | @@ -92,16 +54,6 @@ PT007.py:23:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -20 20 | @pytest.mark.parametrize( -21 21 | ("param1", "param2"), -22 22 | ( -23 |- [1, 2], - 23 |+ (1, 2), -24 24 | [3, 4], -25 25 | ), -26 26 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:24:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | @@ -114,16 +66,6 @@ PT007.py:24:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -21 21 | ("param1", "param2"), -22 22 | ( -23 23 | [1, 2], -24 |- [3, 4], - 24 |+ (3, 4), -25 25 | ), -26 26 | ) -27 27 | def test_tuple_of_lists(param1, param2): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:50:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | @@ -136,16 +78,6 @@ PT007.py:50:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -47 47 | @pytest.mark.parametrize( -48 48 | ("param1", "param2"), -49 49 | [ -50 |- [1, 2], - 50 |+ (1, 2), -51 51 | [3, 4], -52 52 | ], -53 53 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:51:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | @@ -158,16 +90,6 @@ PT007.py:51:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -48 48 | ("param1", "param2"), -49 49 | [ -50 50 | [1, 2], -51 |- [3, 4], - 51 |+ (3, 4), -52 52 | ], -53 53 | ) -54 54 | def test_list_of_lists(param1, param2): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:61:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | @@ -180,16 +102,6 @@ PT007.py:61:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -58 58 | @pytest.mark.parametrize( -59 59 | "param1,param2", -60 60 | [ -61 |- [1, 2], - 61 |+ (1, 2), -62 62 | [3, 4], -63 63 | ], -64 64 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:62:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | @@ -202,16 +114,6 @@ PT007.py:62:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `list` of `tuple` for parameter values -59 59 | "param1,param2", -60 60 | [ -61 61 | [1, 2], -62 |- [3, 4], - 62 |+ (3, 4), -63 63 | ], -64 64 | ) -65 65 | def test_csv_name_list_of_lists(param1, param2): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:81:38: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `tuple` | @@ -222,14 +124,3 @@ PT007.py:81:38: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect 83 | @pytest.mark.parametrize( | = help: Use `list` of `tuple` for parameter values - -78 78 | -79 79 | -80 80 | @pytest.mark.parametrize("a", [1, 2]) -81 |-@pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) - 81 |+@pytest.mark.parametrize(("b", "c"), [(3, 4), (5, 6)]) -82 82 | @pytest.mark.parametrize("d", [3,]) -83 83 | @pytest.mark.parametrize( -84 84 | "d", - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_lists.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_lists.snap index 73e8a15ccdeb2..310110ac84562 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_lists.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_lists.snap @@ -12,16 +12,6 @@ PT007.py:12:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -9 9 | @pytest.mark.parametrize( -10 10 | ("param1", "param2"), -11 11 | ( -12 |- (1, 2), - 12 |+ [1, 2], -13 13 | (3, 4), -14 14 | ), -15 15 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:13:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | @@ -34,16 +24,6 @@ PT007.py:13:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -10 10 | ("param1", "param2"), -11 11 | ( -12 12 | (1, 2), -13 |- (3, 4), - 13 |+ [3, 4], -14 14 | ), -15 15 | ) -16 16 | def test_tuple_of_tuples(param1, param2): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:31:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | @@ -54,16 +34,6 @@ PT007.py:31:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `list` for parameter values -28 28 | ... -29 29 | -30 30 | -31 |-@pytest.mark.parametrize("param", [1, 2]) - 31 |+@pytest.mark.parametrize("param", (1, 2)) -32 32 | def test_list(param): -33 33 | ... -34 34 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:38:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | @@ -80,20 +50,6 @@ PT007.py:38:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -35 35 | -36 36 | @pytest.mark.parametrize( -37 37 | ("param1", "param2"), -38 |- [ - 38 |+ ( -39 39 | (1, 2), -40 40 | (3, 4), -41 |- ], - 41 |+ ), -42 42 | ) -43 43 | def test_list_of_tuples(param1, param2): -44 44 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:39:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | @@ -106,16 +62,6 @@ PT007.py:39:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -36 36 | @pytest.mark.parametrize( -37 37 | ("param1", "param2"), -38 38 | [ -39 |- (1, 2), - 39 |+ [1, 2], -40 40 | (3, 4), -41 41 | ], -42 42 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:40:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | @@ -128,16 +74,6 @@ PT007.py:40:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -37 37 | ("param1", "param2"), -38 38 | [ -39 39 | (1, 2), -40 |- (3, 4), - 40 |+ [3, 4], -41 41 | ], -42 42 | ) -43 43 | def test_list_of_tuples(param1, param2): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:49:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | @@ -154,20 +90,6 @@ PT007.py:49:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -46 46 | -47 47 | @pytest.mark.parametrize( -48 48 | ("param1", "param2"), -49 |- [ - 49 |+ ( -50 50 | [1, 2], -51 51 | [3, 4], -52 |- ], - 52 |+ ), -53 53 | ) -54 54 | def test_list_of_lists(param1, param2): -55 55 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:60:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | @@ -184,20 +106,6 @@ PT007.py:60:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -57 57 | -58 58 | @pytest.mark.parametrize( -59 59 | "param1,param2", -60 |- [ - 60 |+ ( -61 61 | [1, 2], -62 62 | [3, 4], -63 |- ], - 63 |+ ), -64 64 | ) -65 65 | def test_csv_name_list_of_lists(param1, param2): -66 66 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:71:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | @@ -214,20 +122,6 @@ PT007.py:71:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -68 68 | -69 69 | @pytest.mark.parametrize( -70 70 | "param", -71 |- [ - 71 |+ ( -72 72 | [1, 2], -73 73 | [3, 4], -74 |- ], - 74 |+ ), -75 75 | ) -76 76 | def test_single_list_of_lists(param): -77 77 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:80:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | @@ -238,16 +132,6 @@ PT007.py:80:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `list` for parameter values -77 77 | ... -78 78 | -79 79 | -80 |-@pytest.mark.parametrize("a", [1, 2]) - 80 |+@pytest.mark.parametrize("a", (1, 2)) -81 81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) -82 82 | @pytest.mark.parametrize("d", [3,]) -83 83 | @pytest.mark.parametrize( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:81:39: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | @@ -259,16 +143,6 @@ PT007.py:81:39: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `list` for parameter values -78 78 | -79 79 | -80 80 | @pytest.mark.parametrize("a", [1, 2]) -81 |-@pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) - 81 |+@pytest.mark.parametrize(("b", "c"), ([3, 4], (5, 6))) -82 82 | @pytest.mark.parametrize("d", [3,]) -83 83 | @pytest.mark.parametrize( -84 84 | "d", - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:81:47: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | @@ -280,16 +154,6 @@ PT007.py:81:47: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `list` for parameter values -78 78 | -79 79 | -80 80 | @pytest.mark.parametrize("a", [1, 2]) -81 |-@pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) - 81 |+@pytest.mark.parametrize(("b", "c"), ((3, 4), [5, 6])) -82 82 | @pytest.mark.parametrize("d", [3,]) -83 83 | @pytest.mark.parametrize( -84 84 | "d", - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:82:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | @@ -302,16 +166,6 @@ PT007.py:82:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `list` for parameter values -79 79 | -80 80 | @pytest.mark.parametrize("a", [1, 2]) -81 81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) -82 |-@pytest.mark.parametrize("d", [3,]) - 82 |+@pytest.mark.parametrize("d", (3,)) -83 83 | @pytest.mark.parametrize( -84 84 | "d", -85 85 | [("3", "4")], - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:85:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | @@ -324,16 +178,6 @@ PT007.py:85:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `list` for parameter values -82 82 | @pytest.mark.parametrize("d", [3,]) -83 83 | @pytest.mark.parametrize( -84 84 | "d", -85 |- [("3", "4")], - 85 |+ (("3", "4"),), -86 86 | ) -87 87 | @pytest.mark.parametrize( -88 88 | "e", - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:89:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `list` | @@ -345,14 +189,3 @@ PT007.py:89:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 91 | def test_multiple_decorators(a, b, c, d, e): | = help: Use `tuple` of `list` for parameter values - -86 86 | ) -87 87 | @pytest.mark.parametrize( -88 88 | "e", -89 |- [("3", "4"),], - 89 |+ (("3", "4"),), -90 90 | ) -91 91 | def test_multiple_decorators(a, b, c, d, e): -92 92 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_tuples.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_tuples.snap index 35d3b4433e444..c3d573f0db376 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_tuples.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_tuple_of_tuples.snap @@ -12,16 +12,6 @@ PT007.py:23:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -20 20 | @pytest.mark.parametrize( -21 21 | ("param1", "param2"), -22 22 | ( -23 |- [1, 2], - 23 |+ (1, 2), -24 24 | [3, 4], -25 25 | ), -26 26 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:24:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | @@ -34,16 +24,6 @@ PT007.py:24:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -21 21 | ("param1", "param2"), -22 22 | ( -23 23 | [1, 2], -24 |- [3, 4], - 24 |+ (3, 4), -25 25 | ), -26 26 | ) -27 27 | def test_tuple_of_lists(param1, param2): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:31:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | @@ -54,16 +34,6 @@ PT007.py:31:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `tuple` for parameter values -28 28 | ... -29 29 | -30 30 | -31 |-@pytest.mark.parametrize("param", [1, 2]) - 31 |+@pytest.mark.parametrize("param", (1, 2)) -32 32 | def test_list(param): -33 33 | ... -34 34 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:38:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | @@ -80,20 +50,6 @@ PT007.py:38:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -35 35 | -36 36 | @pytest.mark.parametrize( -37 37 | ("param1", "param2"), -38 |- [ - 38 |+ ( -39 39 | (1, 2), -40 40 | (3, 4), -41 |- ], - 41 |+ ), -42 42 | ) -43 43 | def test_list_of_tuples(param1, param2): -44 44 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:49:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | @@ -110,20 +66,6 @@ PT007.py:49:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -46 46 | -47 47 | @pytest.mark.parametrize( -48 48 | ("param1", "param2"), -49 |- [ - 49 |+ ( -50 50 | [1, 2], -51 51 | [3, 4], -52 |- ], - 52 |+ ), -53 53 | ) -54 54 | def test_list_of_lists(param1, param2): -55 55 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:50:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | @@ -136,16 +78,6 @@ PT007.py:50:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -47 47 | @pytest.mark.parametrize( -48 48 | ("param1", "param2"), -49 49 | [ -50 |- [1, 2], - 50 |+ (1, 2), -51 51 | [3, 4], -52 52 | ], -53 53 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:51:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | @@ -158,16 +90,6 @@ PT007.py:51:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -48 48 | ("param1", "param2"), -49 49 | [ -50 50 | [1, 2], -51 |- [3, 4], - 51 |+ (3, 4), -52 52 | ], -53 53 | ) -54 54 | def test_list_of_lists(param1, param2): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:60:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | @@ -184,20 +106,6 @@ PT007.py:60:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -57 57 | -58 58 | @pytest.mark.parametrize( -59 59 | "param1,param2", -60 |- [ - 60 |+ ( -61 61 | [1, 2], -62 62 | [3, 4], -63 |- ], - 63 |+ ), -64 64 | ) -65 65 | def test_csv_name_list_of_lists(param1, param2): -66 66 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:61:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | @@ -210,16 +118,6 @@ PT007.py:61:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -58 58 | @pytest.mark.parametrize( -59 59 | "param1,param2", -60 60 | [ -61 |- [1, 2], - 61 |+ (1, 2), -62 62 | [3, 4], -63 63 | ], -64 64 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:62:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | @@ -232,16 +130,6 @@ PT007.py:62:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -59 59 | "param1,param2", -60 60 | [ -61 61 | [1, 2], -62 |- [3, 4], - 62 |+ (3, 4), -63 63 | ], -64 64 | ) -65 65 | def test_csv_name_list_of_lists(param1, param2): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:71:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | @@ -258,20 +146,6 @@ PT007.py:71:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -68 68 | -69 69 | @pytest.mark.parametrize( -70 70 | "param", -71 |- [ - 71 |+ ( -72 72 | [1, 2], -73 73 | [3, 4], -74 |- ], - 74 |+ ), -75 75 | ) -76 76 | def test_single_list_of_lists(param): -77 77 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:80:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | @@ -282,16 +156,6 @@ PT007.py:80:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `tuple` for parameter values -77 77 | ... -78 78 | -79 79 | -80 |-@pytest.mark.parametrize("a", [1, 2]) - 80 |+@pytest.mark.parametrize("a", (1, 2)) -81 81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) -82 82 | @pytest.mark.parametrize("d", [3,]) -83 83 | @pytest.mark.parametrize( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:82:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | @@ -304,16 +168,6 @@ PT007.py:82:31: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect | = help: Use `tuple` of `tuple` for parameter values -79 79 | -80 80 | @pytest.mark.parametrize("a", [1, 2]) -81 81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) -82 |-@pytest.mark.parametrize("d", [3,]) - 82 |+@pytest.mark.parametrize("d", (3,)) -83 83 | @pytest.mark.parametrize( -84 84 | "d", -85 85 | [("3", "4")], - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:85:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | @@ -326,16 +180,6 @@ PT007.py:85:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte | = help: Use `tuple` of `tuple` for parameter values -82 82 | @pytest.mark.parametrize("d", [3,]) -83 83 | @pytest.mark.parametrize( -84 84 | "d", -85 |- [("3", "4")], - 85 |+ (("3", "4"),), -86 86 | ) -87 87 | @pytest.mark.parametrize( -88 88 | "e", - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT007.py:89:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `tuple` of `tuple` | @@ -347,14 +191,3 @@ PT007.py:89:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte 91 | def test_multiple_decorators(a, b, c, d, e): | = help: Use `tuple` of `tuple` for parameter values - -86 86 | ) -87 87 | @pytest.mark.parametrize( -88 88 | "e", -89 |- [("3", "4"),], - 89 |+ (("3", "4"),), -90 90 | ) -91 91 | def test_multiple_decorators(a, b, c, d, e): -92 92 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap index 199a00dbf775b..b231775a53b6e 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap @@ -12,16 +12,6 @@ PT009.py:11:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -8 8 | def test_assert_true(self): -9 9 | expr = 1 -10 10 | msg = "Must be True" -11 |- self.assertTrue(expr) # Error - 11 |+ assert expr # Error -12 12 | self.assertTrue(expr=expr) # Error -13 13 | self.assertTrue(expr, msg) # Error -14 14 | self.assertTrue(expr=expr, msg=msg) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:12:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` | @@ -34,16 +24,6 @@ PT009.py:12:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -9 9 | expr = 1 -10 10 | msg = "Must be True" -11 11 | self.assertTrue(expr) # Error -12 |- self.assertTrue(expr=expr) # Error - 12 |+ assert expr # Error -13 13 | self.assertTrue(expr, msg) # Error -14 14 | self.assertTrue(expr=expr, msg=msg) # Error -15 15 | self.assertTrue(msg=msg, expr=expr) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:13:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` | @@ -56,16 +36,6 @@ PT009.py:13:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -10 10 | msg = "Must be True" -11 11 | self.assertTrue(expr) # Error -12 12 | self.assertTrue(expr=expr) # Error -13 |- self.assertTrue(expr, msg) # Error - 13 |+ assert expr, msg # Error -14 14 | self.assertTrue(expr=expr, msg=msg) # Error -15 15 | self.assertTrue(msg=msg, expr=expr) # Error -16 16 | self.assertTrue(*(expr, msg)) # Error, unfixable - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:14:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` | @@ -78,16 +48,6 @@ PT009.py:14:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -11 11 | self.assertTrue(expr) # Error -12 12 | self.assertTrue(expr=expr) # Error -13 13 | self.assertTrue(expr, msg) # Error -14 |- self.assertTrue(expr=expr, msg=msg) # Error - 14 |+ assert expr, msg # Error -15 15 | self.assertTrue(msg=msg, expr=expr) # Error -16 16 | self.assertTrue(*(expr, msg)) # Error, unfixable -17 17 | self.assertTrue(**{"expr": expr, "msg": msg}) # Error, unfixable - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:15:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` | @@ -100,16 +60,6 @@ PT009.py:15:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -12 12 | self.assertTrue(expr=expr) # Error -13 13 | self.assertTrue(expr, msg) # Error -14 14 | self.assertTrue(expr=expr, msg=msg) # Error -15 |- self.assertTrue(msg=msg, expr=expr) # Error - 15 |+ assert expr, msg # Error -16 16 | self.assertTrue(*(expr, msg)) # Error, unfixable -17 17 | self.assertTrue(**{"expr": expr, "msg": msg}) # Error, unfixable -18 18 | self.assertTrue(msg=msg, expr=expr, unexpected_arg=False) # Error, unfixable - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:16:9: PT009 Use a regular `assert` instead of unittest-style `assertTrue` | @@ -198,16 +148,6 @@ PT009.py:28:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertFalse(...)` with `assert ...` -25 25 | return self.assertEqual(True, False) # Error, unfixable -26 26 | -27 27 | def test_assert_false(self): -28 |- self.assertFalse(True) # Error - 28 |+ assert not True # Error -29 29 | -30 30 | def test_assert_equal(self): -31 31 | self.assertEqual(1, 2) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:31:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertEqual` | @@ -219,16 +159,6 @@ PT009.py:31:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertEqual(...)` with `assert ...` -28 28 | self.assertFalse(True) # Error -29 29 | -30 30 | def test_assert_equal(self): -31 |- self.assertEqual(1, 2) # Error - 31 |+ assert 1 == 2 # Error -32 32 | -33 33 | def test_assert_not_equal(self): -34 34 | self.assertNotEqual(1, 1) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:34:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotEqual` | @@ -240,16 +170,6 @@ PT009.py:34:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotEqual(...)` with `assert ...` -31 31 | self.assertEqual(1, 2) # Error -32 32 | -33 33 | def test_assert_not_equal(self): -34 |- self.assertNotEqual(1, 1) # Error - 34 |+ assert 1 != 1 # Error -35 35 | -36 36 | def test_assert_greater(self): -37 37 | self.assertGreater(1, 2) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:37:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertGreater` | @@ -261,16 +181,6 @@ PT009.py:37:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertGreater(...)` with `assert ...` -34 34 | self.assertNotEqual(1, 1) # Error -35 35 | -36 36 | def test_assert_greater(self): -37 |- self.assertGreater(1, 2) # Error - 37 |+ assert 1 > 2 # Error -38 38 | -39 39 | def test_assert_greater_equal(self): -40 40 | self.assertGreaterEqual(1, 2) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:40:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertGreaterEqual` | @@ -282,16 +192,6 @@ PT009.py:40:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertGreaterEqual(...)` with `assert ...` -37 37 | self.assertGreater(1, 2) # Error -38 38 | -39 39 | def test_assert_greater_equal(self): -40 |- self.assertGreaterEqual(1, 2) # Error - 40 |+ assert 1 >= 2 # Error -41 41 | -42 42 | def test_assert_less(self): -43 43 | self.assertLess(2, 1) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:43:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertLess` | @@ -303,16 +203,6 @@ PT009.py:43:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertLess(...)` with `assert ...` -40 40 | self.assertGreaterEqual(1, 2) # Error -41 41 | -42 42 | def test_assert_less(self): -43 |- self.assertLess(2, 1) # Error - 43 |+ assert 2 < 1 # Error -44 44 | -45 45 | def test_assert_less_equal(self): -46 46 | self.assertLessEqual(1, 2) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:46:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertLessEqual` | @@ -324,16 +214,6 @@ PT009.py:46:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertLessEqual(...)` with `assert ...` -43 43 | self.assertLess(2, 1) # Error -44 44 | -45 45 | def test_assert_less_equal(self): -46 |- self.assertLessEqual(1, 2) # Error - 46 |+ assert 1 <= 2 # Error -47 47 | -48 48 | def test_assert_in(self): -49 49 | self.assertIn(1, [2, 3]) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:49:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIn` | @@ -345,16 +225,6 @@ PT009.py:49:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIn(...)` with `assert ...` -46 46 | self.assertLessEqual(1, 2) # Error -47 47 | -48 48 | def test_assert_in(self): -49 |- self.assertIn(1, [2, 3]) # Error - 49 |+ assert 1 in [2, 3] # Error -50 50 | -51 51 | def test_assert_not_in(self): -52 52 | self.assertNotIn(2, [2, 3]) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:52:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotIn` | @@ -366,16 +236,6 @@ PT009.py:52:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotIn(...)` with `assert ...` -49 49 | self.assertIn(1, [2, 3]) # Error -50 50 | -51 51 | def test_assert_not_in(self): -52 |- self.assertNotIn(2, [2, 3]) # Error - 52 |+ assert 2 not in [2, 3] # Error -53 53 | -54 54 | def test_assert_is_none(self): -55 55 | self.assertIsNone(0) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:55:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsNone` | @@ -387,16 +247,6 @@ PT009.py:55:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIsNone(...)` with `assert ...` -52 52 | self.assertNotIn(2, [2, 3]) # Error -53 53 | -54 54 | def test_assert_is_none(self): -55 |- self.assertIsNone(0) # Error - 55 |+ assert 0 is None # Error -56 56 | -57 57 | def test_assert_is_not_none(self): -58 58 | self.assertIsNotNone(0) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:58:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsNotNone` | @@ -408,16 +258,6 @@ PT009.py:58:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIsNotNone(...)` with `assert ...` -55 55 | self.assertIsNone(0) # Error -56 56 | -57 57 | def test_assert_is_not_none(self): -58 |- self.assertIsNotNone(0) # Error - 58 |+ assert 0 is not None # Error -59 59 | -60 60 | def test_assert_is(self): -61 61 | self.assertIs([], []) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:61:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIs` | @@ -429,16 +269,6 @@ PT009.py:61:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIs(...)` with `assert ...` -58 58 | self.assertIsNotNone(0) # Error -59 59 | -60 60 | def test_assert_is(self): -61 |- self.assertIs([], []) # Error - 61 |+ assert [] is [] # Error -62 62 | -63 63 | def test_assert_is_not(self): -64 64 | self.assertIsNot(1, 1) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:64:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsNot` | @@ -450,16 +280,6 @@ PT009.py:64:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIsNot(...)` with `assert ...` -61 61 | self.assertIs([], []) # Error -62 62 | -63 63 | def test_assert_is_not(self): -64 |- self.assertIsNot(1, 1) # Error - 64 |+ assert 1 is not 1 # Error -65 65 | -66 66 | def test_assert_is_instance(self): -67 67 | self.assertIsInstance(1, str) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:67:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsInstance` | @@ -471,16 +291,6 @@ PT009.py:67:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIsInstance(...)` with `assert ...` -64 64 | self.assertIsNot(1, 1) # Error -65 65 | -66 66 | def test_assert_is_instance(self): -67 |- self.assertIsInstance(1, str) # Error - 67 |+ assert isinstance(1, str) # Error -68 68 | -69 69 | def test_assert_is_not_instance(self): -70 70 | self.assertNotIsInstance(1, int) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:70:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotIsInstance` | @@ -492,16 +302,6 @@ PT009.py:70:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotIsInstance(...)` with `assert ...` -67 67 | self.assertIsInstance(1, str) # Error -68 68 | -69 69 | def test_assert_is_not_instance(self): -70 |- self.assertNotIsInstance(1, int) # Error - 70 |+ assert not isinstance(1, int) # Error -71 71 | -72 72 | def test_assert_regex(self): -73 73 | self.assertRegex("abc", r"def") # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:73:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertRegex` | @@ -513,16 +313,6 @@ PT009.py:73:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertRegex(...)` with `assert ...` -70 70 | self.assertNotIsInstance(1, int) # Error -71 71 | -72 72 | def test_assert_regex(self): -73 |- self.assertRegex("abc", r"def") # Error - 73 |+ assert re.search("def", "abc") # Error -74 74 | -75 75 | def test_assert_not_regex(self): -76 76 | self.assertNotRegex("abc", r"abc") # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:76:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotRegex` | @@ -534,16 +324,6 @@ PT009.py:76:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotRegex(...)` with `assert ...` -73 73 | self.assertRegex("abc", r"def") # Error -74 74 | -75 75 | def test_assert_not_regex(self): -76 |- self.assertNotRegex("abc", r"abc") # Error - 76 |+ assert not re.search("abc", "abc") # Error -77 77 | -78 78 | def test_assert_regexp_matches(self): -79 79 | self.assertRegexpMatches("abc", r"def") # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:79:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertRegexpMatches` | @@ -555,16 +335,6 @@ PT009.py:79:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertRegexpMatches(...)` with `assert ...` -76 76 | self.assertNotRegex("abc", r"abc") # Error -77 77 | -78 78 | def test_assert_regexp_matches(self): -79 |- self.assertRegexpMatches("abc", r"def") # Error - 79 |+ assert re.search("def", "abc") # Error -80 80 | -81 81 | def test_assert_not_regexp_matches(self): -82 82 | self.assertNotRegex("abc", r"abc") # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:82:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotRegex` | @@ -576,16 +346,6 @@ PT009.py:82:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotRegex(...)` with `assert ...` -79 79 | self.assertRegexpMatches("abc", r"def") # Error -80 80 | -81 81 | def test_assert_not_regexp_matches(self): -82 |- self.assertNotRegex("abc", r"abc") # Error - 82 |+ assert not re.search("abc", "abc") # Error -83 83 | -84 84 | def test_fail_if(self): -85 85 | self.failIf("abc") # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:85:9: PT009 [*] Use a regular `assert` instead of unittest-style `failIf` | @@ -597,16 +357,6 @@ PT009.py:85:9: PT009 [*] Use a regular `assert` instead of unittest-style `failI | = help: Replace `failIf(...)` with `assert ...` -82 82 | self.assertNotRegex("abc", r"abc") # Error -83 83 | -84 84 | def test_fail_if(self): -85 |- self.failIf("abc") # Error - 85 |+ assert not "abc" # Error -86 86 | -87 87 | def test_fail_unless(self): -88 88 | self.failUnless("abc") # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:88:9: PT009 [*] Use a regular `assert` instead of unittest-style `failUnless` | @@ -618,16 +368,6 @@ PT009.py:88:9: PT009 [*] Use a regular `assert` instead of unittest-style `failU | = help: Replace `failUnless(...)` with `assert ...` -85 85 | self.failIf("abc") # Error -86 86 | -87 87 | def test_fail_unless(self): -88 |- self.failUnless("abc") # Error - 88 |+ assert "abc" # Error -89 89 | -90 90 | def test_fail_unless_equal(self): -91 91 | self.failUnlessEqual(1, 2) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:91:9: PT009 [*] Use a regular `assert` instead of unittest-style `failUnlessEqual` | @@ -639,16 +379,6 @@ PT009.py:91:9: PT009 [*] Use a regular `assert` instead of unittest-style `failU | = help: Replace `failUnlessEqual(...)` with `assert ...` -88 88 | self.failUnless("abc") # Error -89 89 | -90 90 | def test_fail_unless_equal(self): -91 |- self.failUnlessEqual(1, 2) # Error - 91 |+ assert 1 == 2 # Error -92 92 | -93 93 | def test_fail_if_equal(self): -94 94 | self.failIfEqual(1, 2) # Error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:94:9: PT009 [*] Use a regular `assert` instead of unittest-style `failIfEqual` | @@ -658,16 +388,6 @@ PT009.py:94:9: PT009 [*] Use a regular `assert` instead of unittest-style `failI | = help: Replace `failIfEqual(...)` with `assert ...` -91 91 | self.failUnlessEqual(1, 2) # Error -92 92 | -93 93 | def test_fail_if_equal(self): -94 |- self.failIfEqual(1, 2) # Error - 94 |+ assert 1 != 2 # Error -95 95 | -96 96 | -97 97 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459517 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT009.py:98:2: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` | @@ -678,13 +398,3 @@ PT009.py:98:2: PT009 [*] Use a regular `assert` instead of unittest-style `asser 100 | self.model.piAx_piAy_beta[r][x][y]))) | = help: Replace `assertTrue(...)` with `assert ...` - -95 95 | -96 96 | -97 97 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459517 -98 |-(self.assertTrue( -99 |- "piAx_piAy_beta[r][x][y] = {17}".format( -100 |- self.model.piAx_piAy_beta[r][x][y]))) - 98 |+assert "piAx_piAy_beta[r][x][y] = {17}".format(self.model.piAx_piAy_beta[r][x][y]) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap index 8e45b6b9772a6..842031377f56c 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap @@ -10,16 +10,6 @@ PT014.py:4:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.para | = help: Remove duplicate test case -1 1 | import pytest -2 2 | -3 3 | -4 |-@pytest.mark.parametrize("x", [1, 1, 2]) - 4 |+@pytest.mark.parametrize("x", [1, 2]) -5 5 | def test_error_literal(x): -6 6 | ... -7 7 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT014.py:14:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | @@ -30,16 +20,6 @@ PT014.py:14:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -11 11 | c = 3 -12 12 | -13 13 | -14 |-@pytest.mark.parametrize("x", [a, a, b, b, b, c]) - 14 |+@pytest.mark.parametrize("x", [a, b, b, b, c]) -15 15 | def test_error_expr_simple(x): -16 16 | ... -17 17 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT014.py:14:41: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.parametrize` | @@ -50,16 +30,6 @@ PT014.py:14:41: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.par | = help: Remove duplicate test case -11 11 | c = 3 -12 12 | -13 13 | -14 |-@pytest.mark.parametrize("x", [a, a, b, b, b, c]) - 14 |+@pytest.mark.parametrize("x", [a, a, b, b, c]) -15 15 | def test_error_expr_simple(x): -16 16 | ... -17 17 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT014.py:14:44: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.parametrize` | @@ -70,16 +40,6 @@ PT014.py:14:44: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.par | = help: Remove duplicate test case -11 11 | c = 3 -12 12 | -13 13 | -14 |-@pytest.mark.parametrize("x", [a, a, b, b, b, c]) - 14 |+@pytest.mark.parametrize("x", [a, a, b, b, c]) -15 15 | def test_error_expr_simple(x): -16 16 | ... -17 17 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT014.py:24:9: PT014 Duplicate of test case at index 0 in `@pytest_mark.parametrize` | @@ -101,16 +61,6 @@ PT014.py:32:39: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -29 29 | ... -30 30 | -31 31 | -32 |-@pytest.mark.parametrize("x", [a, b, (a), c, ((a))]) - 32 |+@pytest.mark.parametrize("x", [a, b, c, ((a))]) -33 33 | def test_error_parentheses(x): -34 34 | ... -35 35 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT014.py:32:48: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | @@ -121,16 +71,6 @@ PT014.py:32:48: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -29 29 | ... -30 30 | -31 31 | -32 |-@pytest.mark.parametrize("x", [a, b, (a), c, ((a))]) - 32 |+@pytest.mark.parametrize("x", [a, b, (a), c]) -33 33 | def test_error_parentheses(x): -34 34 | ... -35 35 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT014.py:42:10: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | @@ -143,15 +83,6 @@ PT014.py:42:10: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -39 39 | [ -40 40 | a, -41 41 | b, -42 |- (a), -43 42 | c, -44 43 | ((a)), -45 44 | ], - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT014.py:44:11: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | @@ -164,15 +95,6 @@ PT014.py:44:11: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -41 41 | b, -42 42 | (a), -43 43 | c, -44 |- ((a)), -45 44 | ], -46 45 | ) -47 46 | def test_error_parentheses_trailing_comma(x): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT014.py:56:53: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | @@ -182,13 +104,3 @@ PT014.py:56:53: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par 58 | ... | = help: Remove duplicate test case - -53 53 | ... -54 54 | -55 55 | -56 |-@pytest.mark.parametrize('data, spec', [(1.0, 1.0), (1.0, 1.0)]) - 56 |+@pytest.mark.parametrize('data, spec', [(1.0, 1.0)]) -57 57 | def test_numbers(data, spec): -58 58 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap index fe5e1519bb038..287d3825b51a2 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap @@ -11,17 +11,6 @@ PT018.py:14:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -11 11 | -12 12 | -13 13 | def test_error(): -14 |- assert something and something_else - 14 |+ assert something - 15 |+ assert something_else -15 16 | assert something and something_else and something_third -16 17 | assert something and not something_else -17 18 | assert something and (something_else or something_third) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT018.py:15:5: PT018 [*] Assertion should be broken down into multiple parts | @@ -34,17 +23,6 @@ PT018.py:15:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -12 12 | -13 13 | def test_error(): -14 14 | assert something and something_else -15 |- assert something and something_else and something_third - 15 |+ assert something and something_else - 16 |+ assert something_third -16 17 | assert something and not something_else -17 18 | assert something and (something_else or something_third) -18 19 | assert not something and something_else - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT018.py:16:5: PT018 [*] Assertion should be broken down into multiple parts | @@ -57,17 +35,6 @@ PT018.py:16:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -13 13 | def test_error(): -14 14 | assert something and something_else -15 15 | assert something and something_else and something_third -16 |- assert something and not something_else - 16 |+ assert something - 17 |+ assert not something_else -17 18 | assert something and (something_else or something_third) -18 19 | assert not something and something_else -19 20 | assert not (something or something_else) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT018.py:17:5: PT018 [*] Assertion should be broken down into multiple parts | @@ -80,17 +47,6 @@ PT018.py:17:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -14 14 | assert something and something_else -15 15 | assert something and something_else and something_third -16 16 | assert something and not something_else -17 |- assert something and (something_else or something_third) - 17 |+ assert something - 18 |+ assert (something_else or something_third) -18 19 | assert not something and something_else -19 20 | assert not (something or something_else) -20 21 | assert not (something or something_else or something_third) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT018.py:18:5: PT018 [*] Assertion should be broken down into multiple parts | @@ -103,17 +59,6 @@ PT018.py:18:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -15 15 | assert something and something_else and something_third -16 16 | assert something and not something_else -17 17 | assert something and (something_else or something_third) -18 |- assert not something and something_else - 18 |+ assert not something - 19 |+ assert something_else -19 20 | assert not (something or something_else) -20 21 | assert not (something or something_else or something_third) -21 22 | assert something and something_else == """error - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT018.py:19:5: PT018 [*] Assertion should be broken down into multiple parts | @@ -126,17 +71,6 @@ PT018.py:19:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -16 16 | assert something and not something_else -17 17 | assert something and (something_else or something_third) -18 18 | assert not something and something_else -19 |- assert not (something or something_else) - 19 |+ assert not something - 20 |+ assert not something_else -20 21 | assert not (something or something_else or something_third) -21 22 | assert something and something_else == """error -22 23 | message - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT018.py:20:5: PT018 [*] Assertion should be broken down into multiple parts | @@ -149,17 +83,6 @@ PT018.py:20:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -17 17 | assert something and (something_else or something_third) -18 18 | assert not something and something_else -19 19 | assert not (something or something_else) -20 |- assert not (something or something_else or something_third) - 20 |+ assert not (something or something_else) - 21 |+ assert not something_third -21 22 | assert something and something_else == """error -22 23 | message -23 24 | """ - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT018.py:21:5: PT018 [*] Assertion should be broken down into multiple parts | @@ -175,17 +98,6 @@ PT018.py:21:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -18 18 | assert not something and something_else -19 19 | assert not (something or something_else) -20 20 | assert not (something or something_else or something_third) -21 |- assert something and something_else == """error - 21 |+ assert something - 22 |+ assert something_else == """error -22 23 | message -23 24 | """ -24 25 | assert ( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT018.py:24:5: PT018 [*] Assertion should be broken down into multiple parts | @@ -205,19 +117,6 @@ PT018.py:24:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -21 21 | assert something and something_else == """error -22 22 | message -23 23 | """ - 24 |+ assert something -24 25 | assert ( -25 |- something -26 |- and something_else - 26 |+ something_else -27 27 | == """error -28 28 | message -29 29 | """ - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT018.py:33:5: PT018 [*] Assertion should be broken down into multiple parts | @@ -228,17 +127,6 @@ PT018.py:33:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -30 30 | ) -31 31 | -32 32 | # recursive case -33 |- assert not (a or not (b or c)) - 33 |+ assert not a - 34 |+ assert (b or c) -34 35 | assert not (a or not (b and c)) -35 36 | -36 37 | # detected, but no fix for messages - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT018.py:34:5: PT018 [*] Assertion should be broken down into multiple parts | @@ -251,17 +139,6 @@ PT018.py:34:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -31 31 | -32 32 | # recursive case -33 33 | assert not (a or not (b or c)) -34 |- assert not (a or not (b and c)) - 34 |+ assert not a - 35 |+ assert (b and c) -35 36 | -36 37 | # detected, but no fix for messages -37 38 | assert something and something_else, "error message" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT018.py:37:5: PT018 Assertion should be broken down into multiple parts | @@ -302,17 +179,6 @@ PT018.py:44:1: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -41 41 | -42 42 | -43 43 | assert something # OK -44 |-assert something and something_else # Error - 44 |+assert something - 45 |+assert something_else -45 46 | assert something and something_else and something_third # Error -46 47 | -47 48 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT018.py:45:1: PT018 [*] Assertion should be broken down into multiple parts | @@ -323,17 +189,6 @@ PT018.py:45:1: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -42 42 | -43 43 | assert something # OK -44 44 | assert something and something_else # Error -45 |-assert something and something_else and something_third # Error - 45 |+assert something and something_else - 46 |+assert something_third -46 47 | -47 48 | -48 49 | def test_multiline(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT018.py:49:5: PT018 Assertion should be broken down into multiple parts | @@ -380,19 +235,6 @@ PT018.py:59:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -59 59 | assert not ( -60 60 | self.find_graph_output(node.output[0]) -61 61 | or self.find_graph_input(node.input[0]) -62 |- or self.find_graph_output(node.input[0]) -63 62 | ) - 63 |+ assert not ( - 64 |+ self.find_graph_output(node.input[0]) - 65 |+ ) -64 66 | -65 67 | assert (not ( -66 68 | self.find_graph_output(node.output[0]) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT018.py:65:5: PT018 [*] Assertion should be broken down into multiple parts | @@ -409,22 +251,3 @@ PT018.py:65:5: PT018 [*] Assertion should be broken down into multiple parts 71 | assert (not self.find_graph_output(node.output[0]) or | = help: Break down assertion into multiple parts - -62 62 | or self.find_graph_output(node.input[0]) -63 63 | ) -64 64 | -65 |- assert (not ( - 65 |+ assert not ( -66 66 | self.find_graph_output(node.output[0]) -67 67 | or self.find_graph_input(node.input[0]) -68 |- or self.find_graph_output(node.input[0]) -69 |- )) - 68 |+ ) - 69 |+ assert not ( - 70 |+ self.find_graph_output(node.input[0]) - 71 |+ ) -70 72 | -71 73 | assert (not self.find_graph_output(node.output[0]) or -72 74 | self.find_graph_input(node.input[0])) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap index afe0d2c3239f8..f53eb9a98210e 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap @@ -10,16 +10,6 @@ PT026.py:19:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters | = help: Remove `usefixtures` decorator or pass parameters -16 16 | pass -17 17 | -18 18 | -19 |-@pytest.mark.usefixtures() - 19 |+ -20 20 | def test_error_with_parens(): -21 21 | pass -22 22 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT026.py:24:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters | @@ -29,13 +19,3 @@ PT026.py:24:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters 26 | pass | = help: Remove `usefixtures` decorator or pass parameters - -21 21 | pass -22 22 | -23 23 | -24 |-@pytest.mark.usefixtures - 24 |+ -25 25 | def test_error_no_parens(): -26 26 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap index 3d8ab412b591b..0923669e2ea7b 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap @@ -12,19 +12,6 @@ PT027_0.py:6:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assert | = help: Replace `assertRaises` with `pytest.raises` -1 1 | import unittest - 2 |+import pytest -2 3 | -3 4 | -4 5 | class Test(unittest.TestCase): -5 6 | def test_errors(self): -6 |- with self.assertRaises(ValueError): - 7 |+ with pytest.raises(ValueError): -7 8 | raise ValueError -8 9 | with self.assertRaises(expected_exception=ValueError): -9 10 | raise ValueError - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT027_0.py:8:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaises` | @@ -36,21 +23,6 @@ PT027_0.py:8:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assert | = help: Replace `assertRaises` with `pytest.raises` -1 1 | import unittest - 2 |+import pytest -2 3 | -3 4 | -4 5 | class Test(unittest.TestCase): -5 6 | def test_errors(self): -6 7 | with self.assertRaises(ValueError): -7 8 | raise ValueError -8 |- with self.assertRaises(expected_exception=ValueError): - 9 |+ with pytest.raises(ValueError): -9 10 | raise ValueError -10 11 | -11 12 | with self.failUnlessRaises(ValueError): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT027_0.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `failUnlessRaises` | @@ -62,22 +34,6 @@ PT027_0.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `failU | = help: Replace `failUnlessRaises` with `pytest.raises` -1 1 | import unittest - 2 |+import pytest -2 3 | -3 4 | -4 5 | class Test(unittest.TestCase): --------------------------------------------------------------------------------- -8 9 | with self.assertRaises(expected_exception=ValueError): -9 10 | raise ValueError -10 11 | -11 |- with self.failUnlessRaises(ValueError): - 12 |+ with pytest.raises(ValueError): -12 13 | raise ValueError -13 14 | -14 15 | with self.assertRaisesRegex(ValueError, "test"): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT027_0.py:14:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` | @@ -89,22 +45,6 @@ PT027_0.py:14:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegex` with `pytest.raises` -1 1 | import unittest - 2 |+import pytest -2 3 | -3 4 | -4 5 | class Test(unittest.TestCase): --------------------------------------------------------------------------------- -11 12 | with self.failUnlessRaises(ValueError): -12 13 | raise ValueError -13 14 | -14 |- with self.assertRaisesRegex(ValueError, "test"): - 15 |+ with pytest.raises(ValueError, match="test"): -15 16 | raise ValueError("test") -16 17 | -17 18 | with self.assertRaisesRegex(ValueError, expected_regex="test"): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT027_0.py:17:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` | @@ -116,22 +56,6 @@ PT027_0.py:17:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegex` with `pytest.raises` -1 1 | import unittest - 2 |+import pytest -2 3 | -3 4 | -4 5 | class Test(unittest.TestCase): --------------------------------------------------------------------------------- -14 15 | with self.assertRaisesRegex(ValueError, "test"): -15 16 | raise ValueError("test") -16 17 | -17 |- with self.assertRaisesRegex(ValueError, expected_regex="test"): - 18 |+ with pytest.raises(ValueError, match="test"): -18 19 | raise ValueError("test") -19 20 | -20 21 | with self.assertRaisesRegex( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT027_0.py:20:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` | @@ -144,24 +68,6 @@ PT027_0.py:20:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegex` with `pytest.raises` -1 1 | import unittest - 2 |+import pytest -2 3 | -3 4 | -4 5 | class Test(unittest.TestCase): --------------------------------------------------------------------------------- -17 18 | with self.assertRaisesRegex(ValueError, expected_regex="test"): -18 19 | raise ValueError("test") -19 20 | -20 |- with self.assertRaisesRegex( -21 |- expected_exception=ValueError, expected_regex="test" -22 |- ): - 21 |+ with pytest.raises(ValueError, match="test"): -23 22 | raise ValueError("test") -24 23 | -25 24 | with self.assertRaisesRegex( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT027_0.py:25:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` | @@ -174,24 +80,6 @@ PT027_0.py:25:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegex` with `pytest.raises` -1 1 | import unittest - 2 |+import pytest -2 3 | -3 4 | -4 5 | class Test(unittest.TestCase): --------------------------------------------------------------------------------- -22 23 | ): -23 24 | raise ValueError("test") -24 25 | -25 |- with self.assertRaisesRegex( -26 |- expected_regex="test", expected_exception=ValueError -27 |- ): - 26 |+ with pytest.raises(ValueError, match="test"): -28 27 | raise ValueError("test") -29 28 | -30 29 | with self.assertRaisesRegexp(ValueError, "test"): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT027_0.py:30:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegexp` | @@ -203,22 +91,6 @@ PT027_0.py:30:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegexp` with `pytest.raises` -1 1 | import unittest - 2 |+import pytest -2 3 | -3 4 | -4 5 | class Test(unittest.TestCase): --------------------------------------------------------------------------------- -27 28 | ): -28 29 | raise ValueError("test") -29 30 | -30 |- with self.assertRaisesRegexp(ValueError, "test"): - 31 |+ with pytest.raises(ValueError, match="test"): -31 32 | raise ValueError("test") -32 33 | -33 34 | def test_unfixable_errors(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PT027_0.py:34:14: PT027 Use `pytest.raises` instead of unittest-style `assertRaises` | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap index c5d8c9f96712a..8387a9d122f3f 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap @@ -9,12 +9,3 @@ PT027_1.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser 12 | raise ValueError | = help: Replace `assertRaises` with `pytest.raises` - -8 8 | raise ValueError -9 9 | -10 10 | def test_errors(self): -11 |- with self.assertRaises(ValueError): - 11 |+ with pytest.raises(ValueError): -12 12 | raise ValueError - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap b/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap index dbcf1ef0167a3..faf0727c38af9 100644 --- a/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap +++ b/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap @@ -283,16 +283,6 @@ RSE102.py:84:10: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -81 81 | raise IndexError(); -82 82 | -83 83 | # RSE102 -84 |-raise Foo() - 84 |+raise Foo -85 85 | -86 86 | # OK -87 87 | raise ctypes.WinError() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RSE102.py:107:27: RSE102 [*] Unnecessary parentheses on raised exception | @@ -302,11 +292,3 @@ RSE102.py:107:27: RSE102 [*] Unnecessary parentheses on raised exception | ^^ RSE102 | = help: Remove unnecessary parentheses - -104 104 | # RSE102 -105 105 | future = executor.submit(float, "a") -106 106 | if future.exception(): -107 |- raise future.Exception() - 107 |+ raise future.Exception - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap index 6a9711074312a..13d52d14c41b8 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap @@ -13,15 +13,6 @@ RET503.py:21:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -20 20 | def x(y): -21 21 | if not y: -22 22 | return 1 - 23 |+ return None -23 24 | # error -24 25 | -25 26 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:28:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -34,15 +25,6 @@ RET503.py:28:9: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -26 26 | def x(y): -27 27 | if not y: -28 28 | print() # error - 29 |+ return None -29 30 | else: -30 31 | return 2 -31 32 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:37:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -53,15 +35,6 @@ RET503.py:37:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -35 35 | return 1 -36 36 | -37 37 | print() # error - 38 |+ return None -38 39 | -39 40 | -40 41 | # for - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:42:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -76,15 +49,6 @@ RET503.py:42:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -42 42 | for i in range(10): -43 43 | if i > 10: -44 44 | return i - 45 |+ return None -45 46 | # error -46 47 | -47 48 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:53:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -95,15 +59,6 @@ RET503.py:53:9: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -51 51 | return i -52 52 | else: -53 53 | print() # error - 54 |+ return None -54 55 | -55 56 | -56 57 | # A nonexistent function - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:60:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -114,15 +69,6 @@ RET503.py:60:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -58 58 | if x > 0: -59 59 | return False -60 60 | no_such_function() # error - 61 |+ return None -61 62 | -62 63 | -63 64 | # A function that does return the control - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:67:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -133,15 +79,6 @@ RET503.py:67:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -65 65 | if x > 0: -66 66 | return False -67 67 | print("", end="") # error - 68 |+ return None -68 69 | -69 70 | -70 71 | ### - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:83:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -156,15 +93,6 @@ RET503.py:83:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -84 84 | if y > 0: -85 85 | return 1 -86 86 | y += 1 - 87 |+ return None -87 88 | -88 89 | -89 90 | # exclude empty functions - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:114:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -179,15 +107,6 @@ RET503.py:114:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -115 115 | if i > y: -116 116 | break -117 117 | return z - 118 |+ return None -118 119 | -119 120 | -120 121 | def bar3(x, y, z): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:121:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -204,15 +123,6 @@ RET503.py:121:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -125 125 | else: -126 126 | return z -127 127 | return None - 128 |+ return None -128 129 | -129 130 | -130 131 | def bar1(x, y, z): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:131:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -226,15 +136,6 @@ RET503.py:131:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -132 132 | if i < y: -133 133 | continue -134 134 | return z - 135 |+ return None -135 136 | -136 137 | -137 138 | def bar3(x, y, z): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:138:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -251,15 +152,6 @@ RET503.py:138:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -142 142 | else: -143 143 | return z -144 144 | return None - 145 |+ return None -145 146 | -146 147 | -147 148 | def prompts(self, foo): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:275:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -272,15 +164,6 @@ RET503.py:275:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -274 274 | -275 275 | for value in values: -276 276 | print(value) - 277 |+ return None -277 278 | -278 279 | -279 280 | def while_true(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:292:13: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -291,15 +174,6 @@ RET503.py:292:13: RET503 [*] Missing explicit `return` at the end of function ab | = help: Add explicit `return` statement -290 290 | return 1 -291 291 | case 1: -292 292 | print() # error - 293 |+ return None -293 294 | -294 295 | -295 296 | def foo(baz: str) -> str: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:301:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -312,15 +186,6 @@ RET503.py:301:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -300 300 | def example(): -301 301 | if True: -302 302 | return "" - 303 |+ return None -303 304 | -304 305 | -305 306 | def example(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:306:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -332,15 +197,6 @@ RET503.py:306:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -305 305 | def example(): -306 306 | if True: -307 307 | return "" - 308 |+ return None -308 309 | -309 310 | -310 311 | def example(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:311:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -352,15 +208,6 @@ RET503.py:311:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -310 310 | def example(): -311 311 | if True: -312 312 | return "" # type: ignore - 313 |+ return None -313 314 | -314 315 | -315 316 | def example(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:316:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -372,15 +219,6 @@ RET503.py:316:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -315 315 | def example(): -316 316 | if True: -317 317 | return "" ; - 318 |+ return None -318 319 | -319 320 | -320 321 | def example(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:321:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -393,15 +231,6 @@ RET503.py:321:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -321 321 | if True: -322 322 | return "" \ -323 323 | ; # type: ignore - 324 |+ return None -324 325 | -325 326 | -326 327 | def end_of_file(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:329:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -412,15 +241,6 @@ RET503.py:329:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -328 328 | return 1 -329 329 | x = 2 \ -330 330 | - 331 |+ return None -331 332 | -332 333 | -333 334 | # function return type annotation NoReturn - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:339:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -431,15 +251,6 @@ RET503.py:339:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -337 337 | if x == 5: -338 338 | return 5 -339 339 | bar() - 340 |+ return None -340 341 | -341 342 | -342 343 | def foo(string: str) -> str: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:354:13: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -450,15 +261,6 @@ RET503.py:354:13: RET503 [*] Missing explicit `return` at the end of function ab | = help: Add explicit `return` statement -352 352 | return "third" -353 353 | case _: -354 354 | raises(string) - 355 |+ return None -355 356 | -356 357 | -357 358 | def foo() -> int: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET503.py:370:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | @@ -468,10 +270,3 @@ RET503.py:370:5: RET503 [*] Missing explicit `return` at the end of function abl | ^^^^^ RET503 | = help: Add explicit `return` statement - -368 368 | if baz() > 3: -369 369 | return 1 -370 370 | bar() - 371 |+ return None - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap index 74c8dedbefa6a..e3196b1753b29 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap @@ -10,17 +10,6 @@ RET504.py:6:12: RET504 [*] Unnecessary assignment to `a` before `return` stateme | = help: Remove unnecessary assignment -2 2 | # Errors -3 3 | ### -4 4 | def x(): -5 |- a = 1 -6 |- return a # RET504 - 5 |+ return 1 -7 6 | -8 7 | -9 8 | # Can be refactored false positives - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET504.py:23:12: RET504 [*] Unnecessary assignment to `formatted` before `return` statement | @@ -31,17 +20,6 @@ RET504.py:23:12: RET504 [*] Unnecessary assignment to `formatted` before `return | = help: Remove unnecessary assignment -19 19 | def x(): -20 20 | formatted = _USER_AGENT_FORMATTER.format(format_string, **values) -21 21 | # clean up after any blank components -22 |- formatted = formatted.replace("()", "").replace(" ", " ").strip() -23 |- return formatted - 22 |+ return formatted.replace("()", "").replace(" ", " ").strip() -24 23 | -25 24 | -26 25 | # https://github.com/afonasev/flake8-return/issues/47#issue-641117366 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET504.py:246:12: RET504 [*] Unnecessary assignment to `queryset` before `return` statement | @@ -52,17 +30,6 @@ RET504.py:246:12: RET504 [*] Unnecessary assignment to `queryset` before `return | = help: Remove unnecessary assignment -242 242 | -243 243 | def get_queryset(): -244 244 | queryset = Model.filter(a=1) -245 |- queryset = queryset.filter(c=3) -246 |- return queryset - 245 |+ return queryset.filter(c=3) -247 246 | -248 247 | -249 248 | def get_queryset(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET504.py:251:12: RET504 [*] Unnecessary assignment to `queryset` before `return` statement | @@ -73,17 +40,6 @@ RET504.py:251:12: RET504 [*] Unnecessary assignment to `queryset` before `return | = help: Remove unnecessary assignment -247 247 | -248 248 | -249 249 | def get_queryset(): -250 |- queryset = Model.filter(a=1) -251 |- return queryset # RET504 - 250 |+ return Model.filter(a=1) -252 251 | -253 252 | -254 253 | # Function arguments - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET504.py:269:12: RET504 [*] Unnecessary assignment to `val` before `return` statement | @@ -94,17 +50,6 @@ RET504.py:269:12: RET504 [*] Unnecessary assignment to `val` before `return` sta | = help: Remove unnecessary assignment -265 265 | def str_to_bool(val): -266 266 | if isinstance(val, bool): -267 267 | return val -268 |- val = 1 -269 |- return val # RET504 - 268 |+ return 1 -270 269 | -271 270 | -272 271 | def str_to_bool(val): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET504.py:321:12: RET504 [*] Unnecessary assignment to `x` before `return` statement | @@ -115,17 +60,6 @@ RET504.py:321:12: RET504 [*] Unnecessary assignment to `x` before `return` state | = help: Remove unnecessary assignment -317 317 | # `with` statements -318 318 | def foo(): -319 319 | with open("foo.txt", "r") as f: -320 |- x = f.read() -321 |- return x # RET504 - 320 |+ return f.read() -322 321 | -323 322 | -324 323 | def foo(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET504.py:342:12: RET504 [*] Unnecessary assignment to `b` before `return` statement | @@ -136,17 +70,6 @@ RET504.py:342:12: RET504 [*] Unnecessary assignment to `b` before `return` state | = help: Remove unnecessary assignment -338 338 | # Fix cases -339 339 | def foo(): -340 340 | a = 1 -341 |- b=a -342 |- return b # RET504 - 341 |+ return a -343 342 | -344 343 | -345 344 | def foo(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET504.py:348:12: RET504 [*] Unnecessary assignment to `b` before `return` statement | @@ -157,17 +80,6 @@ RET504.py:348:12: RET504 [*] Unnecessary assignment to `b` before `return` state | = help: Remove unnecessary assignment -344 344 | -345 345 | def foo(): -346 346 | a = 1 -347 |- b =a -348 |- return b # RET504 - 347 |+ return a -349 348 | -350 349 | -351 350 | def foo(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET504.py:354:12: RET504 [*] Unnecessary assignment to `b` before `return` statement | @@ -178,17 +90,6 @@ RET504.py:354:12: RET504 [*] Unnecessary assignment to `b` before `return` state | = help: Remove unnecessary assignment -350 350 | -351 351 | def foo(): -352 352 | a = 1 -353 |- b= a -354 |- return b # RET504 - 353 |+ return a -355 354 | -356 355 | -357 356 | def foo(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET504.py:359:12: RET504 [*] Unnecessary assignment to `a` before `return` statement | @@ -199,17 +100,6 @@ RET504.py:359:12: RET504 [*] Unnecessary assignment to `a` before `return` state | = help: Remove unnecessary assignment -355 355 | -356 356 | -357 357 | def foo(): -358 |- a = 1 # Comment -359 |- return a - 358 |+ return 1 # Comment -360 359 | -361 360 | -362 361 | # Regression test for: https://github.com/astral-sh/ruff/issues/7098 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET504.py:365:12: RET504 [*] Unnecessary assignment to `D` before `return` statement | @@ -220,17 +110,6 @@ RET504.py:365:12: RET504 [*] Unnecessary assignment to `D` before `return` state | = help: Remove unnecessary assignment -361 361 | -362 362 | # Regression test for: https://github.com/astral-sh/ruff/issues/7098 -363 363 | def mavko_debari(P_kbar): -364 |- D=0.4853881 + 3.6006116*P - 0.0117368*(P-1.3822)**2 -365 |- return D - 364 |+ return 0.4853881 + 3.6006116*P - 0.0117368*(P-1.3822)**2 -366 365 | -367 366 | -368 367 | # contextlib suppress in with statement - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET504.py:400:12: RET504 [*] Unnecessary assignment to `y` before `return` statement | @@ -241,17 +120,6 @@ RET504.py:400:12: RET504 [*] Unnecessary assignment to `y` before `return` state | = help: Remove unnecessary assignment -396 396 | x = 2 -397 397 | with contextlib.suppress(Exception): -398 398 | x = 1 -399 |- y = y + 2 -400 |- return y # RET504 - 399 |+ return y + 2 -401 400 | -402 401 | -403 402 | def foo(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RET504.py:423:16: RET504 [*] Unnecessary assignment to `services` before `return` statement | @@ -261,12 +129,3 @@ RET504.py:423:16: RET504 [*] Unnecessary assignment to `services` before `return | ^^^^^^^^ RET504 | = help: Remove unnecessary assignment - -419 419 | # See: https://github.com/astral-sh/ruff/issues/10732 -420 420 | def func(a: dict[str, int]) -> list[dict[str, int]]: -421 421 | if "services" in a: -422 |- services = a["services"] -423 |- return services - 422 |+ return a["services"] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap index d1ef589847cd1..855928910d903 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap @@ -9,13 +9,6 @@ SIM101.py:1:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing | = help: Merge `isinstance` calls for `a` -1 |-if isinstance(a, int) or isinstance(a, float): # SIM101 - 1 |+if isinstance(a, (int, float)): # SIM101 -2 2 | pass -3 3 | -4 4 | if isinstance(a, (int, float)) or isinstance(a, bool): # SIM101 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM101.py:4:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | @@ -27,16 +20,6 @@ SIM101.py:4:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing | = help: Merge `isinstance` calls for `a` -1 1 | if isinstance(a, int) or isinstance(a, float): # SIM101 -2 2 | pass -3 3 | -4 |-if isinstance(a, (int, float)) or isinstance(a, bool): # SIM101 - 4 |+if isinstance(a, (int, float, bool)): # SIM101 -5 5 | pass -6 6 | -7 7 | if isinstance(a, int) or isinstance(a, float) or isinstance(b, bool): # SIM101 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM101.py:7:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | @@ -48,16 +31,6 @@ SIM101.py:7:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing | = help: Merge `isinstance` calls for `a` -4 4 | if isinstance(a, (int, float)) or isinstance(a, bool): # SIM101 -5 5 | pass -6 6 | -7 |-if isinstance(a, int) or isinstance(a, float) or isinstance(b, bool): # SIM101 - 7 |+if isinstance(a, (int, float)) or isinstance(b, bool): # SIM101 -8 8 | pass -9 9 | -10 10 | if isinstance(b, bool) or isinstance(a, int) or isinstance(a, float): # SIM101 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM101.py:10:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | @@ -69,16 +42,6 @@ SIM101.py:10:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -7 7 | if isinstance(a, int) or isinstance(a, float) or isinstance(b, bool): # SIM101 -8 8 | pass -9 9 | -10 |-if isinstance(b, bool) or isinstance(a, int) or isinstance(a, float): # SIM101 - 10 |+if isinstance(b, bool) or isinstance(a, (int, float)): # SIM101 -11 11 | pass -12 12 | -13 13 | if isinstance(a, int) or isinstance(b, bool) or isinstance(a, float): # SIM101 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM101.py:16:5: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | @@ -90,16 +53,6 @@ SIM101.py:16:5: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -13 13 | if isinstance(a, int) or isinstance(b, bool) or isinstance(a, float): # SIM101 -14 14 | pass -15 15 | -16 |-if (isinstance(a, int) or isinstance(a, float)) and isinstance(b, bool): # SIM101 - 16 |+if (isinstance(a, (int, float))) and isinstance(b, bool): # SIM101 -17 17 | pass -18 18 | -19 19 | if isinstance(a.b, int) or isinstance(a.b, float): # SIM101 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM101.py:19:4: SIM101 [*] Multiple `isinstance` calls for expression, merge into a single call | @@ -111,16 +64,6 @@ SIM101.py:19:4: SIM101 [*] Multiple `isinstance` calls for expression, merge int | = help: Merge `isinstance` calls -16 16 | if (isinstance(a, int) or isinstance(a, float)) and isinstance(b, bool): # SIM101 -17 17 | pass -18 18 | -19 |-if isinstance(a.b, int) or isinstance(a.b, float): # SIM101 - 19 |+if isinstance(a.b, (int, float)): # SIM101 -20 20 | pass -21 21 | -22 22 | if isinstance(a(), int) or isinstance(a(), float): # SIM101 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM101.py:22:4: SIM101 Multiple `isinstance` calls for expression, merge into a single call | @@ -142,16 +85,6 @@ SIM101.py:38:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -35 35 | if isinstance(a, int) or unrelated_condition or isinstance(a, float): -36 36 | pass -37 37 | -38 |-if x or isinstance(a, int) or isinstance(a, float): - 38 |+if x or isinstance(a, (int, float)): -39 39 | pass -40 40 | -41 41 | if x or y or isinstance(a, int) or isinstance(a, float) or z: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM101.py:41:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | @@ -163,16 +96,6 @@ SIM101.py:41:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -38 38 | if x or isinstance(a, int) or isinstance(a, float): -39 39 | pass -40 40 | -41 |-if x or y or isinstance(a, int) or isinstance(a, float) or z: - 41 |+if x or y or isinstance(a, (int, float)) or z: -42 42 | pass -43 43 | -44 44 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM101.py:53:3: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | @@ -182,12 +105,3 @@ SIM101.py:53:3: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin 54 | pass | = help: Merge `isinstance` calls for `a` - -50 50 | pass -51 51 | -52 52 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722460483 -53 |-if(isinstance(a, int)) or (isinstance(a, float)): - 53 |+if isinstance(a, (int, float)): -54 54 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap index 5732ade9df827..f1ea338bdf3c1 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap @@ -11,17 +11,6 @@ SIM102.py:2:1: SIM102 [*] Use a single `if` statement instead of nested `if` sta | = help: Combine `if` statements using `and` -1 1 | # SIM102 -2 |-if a: -3 |- if b: -4 |- c - 2 |+if a and b: - 3 |+ c -5 4 | -6 5 | # SIM102 -7 6 | if a: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM102.py:7:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements | @@ -34,21 +23,6 @@ SIM102.py:7:1: SIM102 [*] Use a single `if` statement instead of nested `if` sta | = help: Combine `if` statements using `and` -4 4 | c -5 5 | -6 6 | # SIM102 -7 |-if a: -8 |- if b: -9 |- if c: -10 |- d - 7 |+if a and b: - 8 |+ if c: - 9 |+ d -11 10 | -12 11 | # SIM102 -13 12 | if a: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM102.py:8:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements | @@ -62,19 +36,6 @@ SIM102.py:8:5: SIM102 [*] Use a single `if` statement instead of nested `if` sta | = help: Combine `if` statements using `and` -5 5 | -6 6 | # SIM102 -7 7 | if a: -8 |- if b: -9 |- if c: -10 |- d - 8 |+ if b and c: - 9 |+ d -11 10 | -12 11 | # SIM102 -13 12 | if a: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM102.py:15:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements | @@ -87,19 +48,6 @@ SIM102.py:15:1: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -12 12 | # SIM102 -13 13 | if a: -14 14 | pass -15 |-elif b: -16 |- if c: -17 |- d - 15 |+elif b and c: - 16 |+ d -18 17 | -19 18 | # SIM102 -20 19 | if a: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM102.py:20:1: SIM102 Use a single `if` statement instead of nested `if` statements | @@ -123,21 +71,6 @@ SIM102.py:26:1: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -23 23 | c -24 24 | -25 25 | # SIM102 -26 |-if a: -27 |- if b: -28 |- # Fixable due to placement of this comment. -29 |- c - 26 |+if a and b: - 27 |+ # Fixable due to placement of this comment. - 28 |+ c -30 29 | -31 30 | # OK -32 31 | if a: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM102.py:51:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements | @@ -152,31 +85,6 @@ SIM102.py:51:5: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -48 48 | -49 49 | while x > 0: -50 50 | # SIM102 -51 |- if y > 0: -52 |- if z > 0: -53 |- """this - 51 |+ if y > 0 and z > 0: - 52 |+ """this -54 53 | is valid""" -55 54 | -56 |- """the indentation on - 55 |+ """the indentation on -57 56 | this line is significant""" -58 57 | -59 |- "this is" \ - 58 |+ "this is" \ -60 59 | "allowed too" -61 60 | -62 |- ("so is" - 61 |+ ("so is" -63 62 | "this for some reason") -64 63 | -65 64 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM102.py:67:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements | @@ -189,31 +97,6 @@ SIM102.py:67:1: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -64 64 | -65 65 | -66 66 | # SIM102 -67 |-if x > 0: -68 |- if y > 0: -69 |- """this - 67 |+if x > 0 and y > 0: - 68 |+ """this -70 69 | is valid""" -71 70 | -72 |- """the indentation on - 71 |+ """the indentation on -73 72 | this line is significant""" -74 73 | -75 |- "this is" \ - 74 |+ "this is" \ -76 75 | "allowed too" -77 76 | -78 |- ("so is" - 77 |+ ("so is" -79 78 | "this for some reason") -80 79 | -81 80 | while x > 0: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM102.py:83:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements | @@ -229,23 +112,6 @@ SIM102.py:83:5: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -80 80 | -81 81 | while x > 0: -82 82 | # SIM102 -83 |- if node.module: -84 |- if node.module == "multiprocessing" or node.module.startswith( -85 |- "multiprocessing." -86 |- ): -87 |- print("Bad module!") - 83 |+ if node.module and (node.module == "multiprocessing" or node.module.startswith( - 84 |+ "multiprocessing." - 85 |+ )): - 86 |+ print("Bad module!") -88 87 | -89 88 | # SIM102 (auto-fixable) -90 89 | if node.module012345678: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM102.py:90:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements | @@ -259,23 +125,6 @@ SIM102.py:90:1: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -87 87 | print("Bad module!") -88 88 | -89 89 | # SIM102 (auto-fixable) -90 |-if node.module012345678: -91 |- if node.module == "multiprocß9💣2ℝ" or node.module.startswith( -92 |- "multiprocessing." -93 |- ): -94 |- print("Bad module!") - 90 |+if node.module012345678 and (node.module == "multiprocß9💣2ℝ" or node.module.startswith( - 91 |+ "multiprocessing." - 92 |+)): - 93 |+ print("Bad module!") -95 94 | -96 95 | # SIM102 (not auto-fixable) -97 96 | if node.module0123456789: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM102.py:97:1: SIM102 Use a single `if` statement instead of nested `if` statements | @@ -302,19 +151,6 @@ SIM102.py:106:5: SIM102 [*] Use a single `if` statement instead of nested `if` s | = help: Combine `if` statements using `and` -103 103 | # SIM102 -104 104 | # Regression test for https://github.com/apache/airflow/blob/145b16caaa43f0c42bffd97344df916c602cddde/airflow/configuration.py#L1161 -105 105 | if a: -106 |- if b: -107 |- if c: -108 |- print("if") - 106 |+ if b and c: - 107 |+ print("if") -109 108 | elif d: -110 109 | print("elif") -111 110 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM102.py:132:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements | @@ -329,19 +165,6 @@ SIM102.py:132:5: SIM102 [*] Use a single `if` statement instead of nested `if` s | = help: Combine `if` statements using `and` -129 129 | # OK -130 130 | if a: -131 131 | # SIM 102 -132 |- if b: -133 |- if c: -134 |- print("foo") - 132 |+ if b and c: - 133 |+ print("foo") -135 134 | else: -136 135 | print("bar") -137 136 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM102.py:165:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements | @@ -354,14 +177,3 @@ SIM102.py:165:5: SIM102 [*] Use a single `if` statement instead of nested `if` s 167 | d | = help: Combine `if` statements using `and` - -162 162 | def f(): -163 163 | if a: -164 164 | pass -165 |- elif b: -166 |- if c: -167 |- d - 165 |+ elif b and c: - 166 |+ d - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap index ca06668cb1b32..d1dd4d8dbd63c 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap @@ -14,18 +14,6 @@ SIM103.py:3:5: SIM103 [*] Return the condition `bool(a)` directly | = help: Replace with `return bool(a)` -1 1 | def f(): -2 2 | # SIM103 -3 |- if a: -4 |- return True -5 |- else: -6 |- return False - 3 |+ return bool(a) -7 4 | -8 5 | -9 6 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM103.py:11:5: SIM103 [*] Return the condition `a == b` directly | @@ -40,19 +28,6 @@ SIM103.py:11:5: SIM103 [*] Return the condition `a == b` directly | = help: Replace with `return a == b` -8 8 | -9 9 | def f(): -10 10 | # SIM103 -11 |- if a == b: -12 |- return True -13 |- else: -14 |- return False - 11 |+ return a == b -15 12 | -16 13 | -17 14 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM103.py:21:5: SIM103 [*] Return the condition `bool(b)` directly | @@ -67,19 +42,6 @@ SIM103.py:21:5: SIM103 [*] Return the condition `bool(b)` directly | = help: Replace with `return bool(b)` -18 18 | # SIM103 -19 19 | if a: -20 20 | return 1 -21 |- elif b: -22 |- return True -23 |- else: -24 |- return False - 21 |+ return bool(b) -25 22 | -26 23 | -27 24 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM103.py:32:9: SIM103 [*] Return the condition `bool(b)` directly | @@ -94,19 +56,6 @@ SIM103.py:32:9: SIM103 [*] Return the condition `bool(b)` directly | = help: Replace with `return bool(b)` -29 29 | if a: -30 30 | return 1 -31 31 | else: -32 |- if b: -33 |- return True -34 |- else: -35 |- return False - 32 |+ return bool(b) -36 33 | -37 34 | -38 35 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM103.py:57:5: SIM103 [*] Return the condition `not a` directly | @@ -121,19 +70,6 @@ SIM103.py:57:5: SIM103 [*] Return the condition `not a` directly | = help: Replace with `return not a` -54 54 | -55 55 | def f(): -56 56 | # SIM103 -57 |- if a: -58 |- return False -59 |- else: -60 |- return True - 57 |+ return not a -61 58 | -62 59 | -63 60 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM103.py:83:5: SIM103 Return the condition directly | @@ -161,19 +97,6 @@ SIM103.py:91:5: SIM103 [*] Return the condition `not (keys is not None and notic | = help: Replace with `return not (keys is not None and notice.key not in keys)` -88 88 | -89 89 | def f(): -90 90 | # SIM103 -91 |- if keys is not None and notice.key not in keys: -92 |- return False -93 |- else: -94 |- return True - 91 |+ return not (keys is not None and notice.key not in keys) -95 92 | -96 93 | -97 94 | ### - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM103.py:104:5: SIM103 [*] Return the condition `bool(a)` directly | @@ -187,18 +110,6 @@ SIM103.py:104:5: SIM103 [*] Return the condition `bool(a)` directly | = help: Replace with `return bool(a)` -101 101 | -102 102 | def f(): -103 103 | # SIM103 -104 |- if a: -105 |- return True -106 |- return False - 104 |+ return bool(a) -107 105 | -108 106 | -109 107 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM103.py:111:5: SIM103 [*] Return the condition `not a` directly | @@ -212,18 +123,6 @@ SIM103.py:111:5: SIM103 [*] Return the condition `not a` directly | = help: Replace with `return not a` -108 108 | -109 109 | def f(): -110 110 | # SIM103 -111 |- if a: -112 |- return False -113 |- return True - 111 |+ return not a -114 112 | -115 113 | -116 114 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM103.py:117:5: SIM103 [*] Return the condition `10 < a` directly | @@ -236,18 +135,6 @@ SIM103.py:117:5: SIM103 [*] Return the condition `10 < a` directly | = help: Replace with `return 10 < a` -114 114 | -115 115 | -116 116 | def f(): -117 |- if not 10 < a: -118 |- return False -119 |- return True - 117 |+ return 10 < a -120 118 | -121 119 | -122 120 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM103.py:123:5: SIM103 [*] Return the condition `not 10 < a` directly | @@ -259,13 +146,3 @@ SIM103.py:123:5: SIM103 [*] Return the condition `not 10 < a` directly | |_______________^ SIM103 | = help: Replace with `return not 10 < a` - -120 120 | -121 121 | -122 122 | def f(): -123 |- if 10 < a: -124 |- return False -125 |- return True - 123 |+ return not 10 < a - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap index 36f17d26185fe..5e54c31651859 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap @@ -12,22 +12,6 @@ SIM105_0.py:6:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `tr | = help: Replace with `contextlib.suppress(ValueError)` - 1 |+import contextlib -1 2 | def foo(): -2 3 | pass -3 4 | -4 5 | -5 6 | # SIM105 -6 |-try: - 7 |+with contextlib.suppress(ValueError): -7 8 | foo() -8 |-except ValueError: -9 |- pass -10 9 | -11 10 | -12 11 | # SIM105 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM105_0.py:13:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` | @@ -42,24 +26,6 @@ SIM105_0.py:13:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` inst | = help: Replace with `contextlib.suppress(ValueError, OSError)` - 1 |+import contextlib -1 2 | def foo(): -2 3 | pass -3 4 | --------------------------------------------------------------------------------- -10 11 | -11 12 | -12 13 | # SIM105 -13 |-try: - 14 |+with contextlib.suppress(ValueError, OSError): -14 15 | foo() -15 |-except (ValueError, OSError): -16 |- pass -17 16 | -18 17 | # SIM105 -19 18 | try: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM105_0.py:19:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` | @@ -74,24 +40,6 @@ SIM105_0.py:19:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` inst | = help: Replace with `contextlib.suppress(ValueError, OSError)` - 1 |+import contextlib -1 2 | def foo(): -2 3 | pass -3 4 | --------------------------------------------------------------------------------- -16 17 | pass -17 18 | -18 19 | # SIM105 -19 |-try: - 20 |+with contextlib.suppress(ValueError, OSError): -20 21 | foo() -21 |-except (ValueError, OSError) as e: -22 |- pass -23 22 | -24 23 | # SIM105 -25 24 | try: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM105_0.py:25:1: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass` | @@ -106,24 +54,6 @@ SIM105_0.py:25:1: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `tr | = help: Replace with `contextlib.suppress(Exception)` - 1 |+import contextlib -1 2 | def foo(): -2 3 | pass -3 4 | --------------------------------------------------------------------------------- -22 23 | pass -23 24 | -24 25 | # SIM105 -25 |-try: - 26 |+with contextlib.suppress(Exception): -26 27 | foo() -27 |-except: -28 |- pass -29 28 | -30 29 | # SIM105 -31 30 | try: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM105_0.py:31:1: SIM105 [*] Use `contextlib.suppress(a.Error, b.Error)` instead of `try`-`except`-`pass` | @@ -138,24 +68,6 @@ SIM105_0.py:31:1: SIM105 [*] Use `contextlib.suppress(a.Error, b.Error)` instead | = help: Replace with `contextlib.suppress(a.Error, b.Error)` - 1 |+import contextlib -1 2 | def foo(): -2 3 | pass -3 4 | --------------------------------------------------------------------------------- -28 29 | pass -29 30 | -30 31 | # SIM105 -31 |-try: - 32 |+with contextlib.suppress(a.Error, b.Error): -32 33 | foo() -33 |-except (a.Error, b.Error): -34 |- pass -35 34 | -36 35 | # OK -37 36 | try: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM105_0.py:85:5: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` | @@ -170,24 +82,6 @@ SIM105_0.py:85:5: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `t | = help: Replace with `contextlib.suppress(ValueError)` - 1 |+import contextlib -1 2 | def foo(): -2 3 | pass -3 4 | --------------------------------------------------------------------------------- -82 83 | -83 84 | def with_ellipsis(): -84 85 | # OK -85 |- try: - 86 |+ with contextlib.suppress(ValueError): -86 87 | foo() -87 |- except ValueError: -88 |- ... -89 88 | -90 89 | -91 90 | def with_ellipsis_and_return(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM105_0.py:100:5: SIM105 Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` | @@ -218,24 +112,6 @@ SIM105_0.py:117:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try | = help: Replace with `contextlib.suppress(OSError)` - 1 |+import contextlib -1 2 | def foo(): -2 3 | pass -3 4 | --------------------------------------------------------------------------------- -114 115 | -115 116 | # Regression test for: https://github.com/astral-sh/ruff/issues/7123 -116 117 | def write_models(directory, Models): -117 |- try: - 118 |+ with contextlib.suppress(OSError): -118 119 | os.makedirs(model_dir); -119 |- except OSError: -120 |- pass; -121 120 | -122 121 | try: os.makedirs(model_dir); -123 122 | except OSError: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM105_0.py:122:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` | @@ -251,23 +127,6 @@ SIM105_0.py:122:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try | = help: Replace with `contextlib.suppress(OSError)` - 1 |+import contextlib -1 2 | def foo(): -2 3 | pass -3 4 | --------------------------------------------------------------------------------- -119 120 | except OSError: -120 121 | pass; -121 122 | -122 |- try: os.makedirs(model_dir); -123 |- except OSError: -124 |- pass; - 123 |+ with contextlib.suppress(OSError): os.makedirs(model_dir); -125 124 | -126 125 | try: os.makedirs(model_dir); -127 126 | except OSError: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM105_0.py:126:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` | @@ -282,20 +141,3 @@ SIM105_0.py:126:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try 130 | # | = help: Replace with `contextlib.suppress(OSError)` - - 1 |+import contextlib -1 2 | def foo(): -2 3 | pass -3 4 | --------------------------------------------------------------------------------- -123 124 | except OSError: -124 125 | pass; -125 126 | -126 |- try: os.makedirs(model_dir); -127 |- except OSError: -128 |- pass; \ - 127 |+ with contextlib.suppress(OSError): os.makedirs(model_dir); -129 128 | \ -130 129 | # - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap index 84761e419652e..7c33fa3a21ed6 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap @@ -11,16 +11,3 @@ SIM105_1.py:5:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `tr | |________^ SIM105 | = help: Replace with `contextlib.suppress(ValueError)` - -1 1 | """Case: There's a random import, so it should add `contextlib` after it.""" -2 2 | import math - 3 |+import contextlib -3 4 | -4 5 | # SIM105 -5 |-try: - 6 |+with contextlib.suppress(ValueError): -6 7 | math.sqrt(-1) -7 |-except ValueError: -8 |- pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap index 1cb19addae311..7a9e1604d1fee 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap @@ -11,14 +11,3 @@ SIM105_2.py:10:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `t | |________^ SIM105 | = help: Replace with `contextlib.suppress(ValueError)` - -7 7 | -8 8 | -9 9 | # SIM105 -10 |-try: - 10 |+with contextlib.suppress(ValueError): -11 11 | foo() -12 |-except ValueError: -13 |- pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap index 11a20ff3fb39e..9f05de1188be1 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap @@ -10,12 +10,3 @@ SIM105_4.py:2:1: SIM105 [*] Use `contextlib.suppress(ImportError)` instead of `t | |___________________________^ SIM105 | = help: Replace with `contextlib.suppress(ImportError)` - -1 1 | #!/usr/bin/env python -2 |-try: - 2 |+import contextlib - 3 |+with contextlib.suppress(ImportError): -3 4 | from __builtin__ import bytes, str, open, super, range, zip, round, int, pow, object, input -4 |-except ImportError: pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap index 251196206e6e7..5eb801f924702 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap @@ -14,17 +14,6 @@ SIM108.py:2:1: SIM108 [*] Use ternary operator `b = c if a else d` instead of `i | = help: Replace `if`-`else`-block with `b = c if a else d` -1 1 | # SIM108 -2 |-if a: -3 |- b = c -4 |-else: -5 |- b = d - 2 |+b = c if a else d -6 3 | -7 4 | # OK -8 5 | b = c if a else d - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM108.py:30:5: SIM108 [*] Use ternary operator `b = 1 if a else 2` instead of `if`-`else`-block | @@ -39,19 +28,6 @@ SIM108.py:30:5: SIM108 [*] Use ternary operator `b = 1 if a else 2` instead of ` | = help: Replace `if`-`else`-block with `b = 1 if a else 2` -27 27 | if True: -28 28 | pass -29 29 | else: -30 |- if a: -31 |- b = 1 -32 |- else: -33 |- b = 2 - 30 |+ b = 1 if a else 2 -34 31 | -35 32 | -36 33 | import sys - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM108.py:58:1: SIM108 Use ternary operator `abc = x if x > 0 else -x` instead of `if`-`else`-block | @@ -77,19 +53,6 @@ SIM108.py:82:1: SIM108 [*] Use ternary operator `b = "cccccccccccccccccccccccccc | = help: Replace `if`-`else`-block with `b = "cccccccccccccccccccccccccccccccccß" if a else "ddddddddddddddddddddddddddddddddd💣"` -79 79 | -80 80 | -81 81 | # SIM108 -82 |-if a: -83 |- b = "cccccccccccccccccccccccccccccccccß" -84 |-else: -85 |- b = "ddddddddddddddddddddddddddddddddd💣" - 82 |+b = "cccccccccccccccccccccccccccccccccß" if a else "ddddddddddddddddddddddddddddddddd💣" -86 83 | -87 84 | -88 85 | # OK (too long) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM108.py:105:1: SIM108 Use ternary operator `exitcode = 0 if True else 1` instead of `if`-`else`-block | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap index d8bd3fffa72cd..aa234174d3172 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap @@ -10,14 +10,6 @@ SIM109.py:2:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compari | = help: Replace with `a in (b, c)` -1 1 | # SIM109 -2 |-if a == b or a == c: - 2 |+if a in (b, c): -3 3 | d -4 4 | -5 5 | # SIM109 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM109.py:6:5: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons | @@ -28,16 +20,6 @@ SIM109.py:6:5: SIM109 [*] Use `a in (b, c)` instead of multiple equality compari | = help: Replace with `a in (b, c)` -3 3 | d -4 4 | -5 5 | # SIM109 -6 |-if (a == b or a == c) and None: - 6 |+if (a in (b, c)) and None: -7 7 | d -8 8 | -9 9 | # SIM109 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM109.py:10:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons | @@ -48,16 +30,6 @@ SIM109.py:10:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compar | = help: Replace with `a in (b, c)` -7 7 | d -8 8 | -9 9 | # SIM109 -10 |-if a == b or a == c or None: - 10 |+if a in (b, c) or None: -11 11 | d -12 12 | -13 13 | # SIM109 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM109.py:14:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons | @@ -67,14 +39,3 @@ SIM109.py:14:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compar 15 | d | = help: Replace with `a in (b, c)` - -11 11 | d -12 12 | -13 13 | # SIM109 -14 |-if a == b or None or a == c: - 14 |+if a in (b, c) or None: -15 15 | d -16 16 | -17 17 | # OK - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap index 671c977478cd5..a626d2e09d28b 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap @@ -14,18 +14,6 @@ SIM110.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead o | = help: Replace with `return any(check(x) for x in iterable)` -1 1 | def f(): -2 2 | # SIM110 -3 |- for x in iterable: -4 |- if check(x): -5 |- return True -6 |- return False - 3 |+ return any(check(x) for x in iterable) -7 4 | -8 5 | -9 6 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM110.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | @@ -40,19 +28,6 @@ SIM110.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -22 22 | -23 23 | def f(): -24 24 | # SIM111 -25 |- for x in iterable: -26 |- if check(x): -27 |- return False -28 |- return True - 25 |+ return all(not check(x) for x in iterable) -29 26 | -30 27 | -31 28 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM110.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop | @@ -67,19 +42,6 @@ SIM110.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` inst | = help: Replace with `return all(x.is_empty() for x in iterable)` -30 30 | -31 31 | def f(): -32 32 | # SIM111 -33 |- for x in iterable: -34 |- if not x.is_empty(): -35 |- return False -36 |- return True - 33 |+ return all(x.is_empty() for x in iterable) -37 34 | -38 35 | -39 36 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM110.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | @@ -95,20 +57,6 @@ SIM110.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -52 52 | -53 53 | def f(): -54 54 | # SIM110 -55 |- for x in iterable: -56 |- if check(x): -57 |- return True -58 |- else: -59 |- return False - 55 |+ return any(check(x) for x in iterable) -60 56 | -61 57 | -62 58 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM110.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | @@ -124,20 +72,6 @@ SIM110.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -61 61 | -62 62 | def f(): -63 63 | # SIM111 -64 |- for x in iterable: -65 |- if check(x): -66 |- return False -67 |- else: -68 |- return True - 64 |+ return all(not check(x) for x in iterable) -69 65 | -70 66 | -71 67 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM110.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | @@ -154,20 +88,6 @@ SIM110.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -70 70 | -71 71 | def f(): -72 72 | # SIM110 -73 |- for x in iterable: -74 |- if check(x): -75 |- return True -76 |- else: -77 |- return False - 73 |+ return any(check(x) for x in iterable) -78 74 | return True -79 75 | -80 76 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM110.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | @@ -184,20 +104,6 @@ SIM110.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -80 80 | -81 81 | def f(): -82 82 | # SIM111 -83 |- for x in iterable: -84 |- if check(x): -85 |- return False -86 |- else: -87 |- return True - 83 |+ return all(not check(x) for x in iterable) -88 84 | return False -89 85 | -90 86 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM110.py:124:5: SIM110 Use `return any(check(x) for x in iterable)` instead of `for` loop | @@ -237,19 +143,6 @@ SIM110.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -141 141 | x = 1 -142 142 | -143 143 | # SIM110 -144 |- for x in iterable: -145 |- if check(x): -146 |- return True -147 |- return False - 144 |+ return any(check(x) for x in iterable) -148 145 | -149 146 | -150 147 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM110.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | @@ -263,19 +156,6 @@ SIM110.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` ins | = help: Replace with `return all(not check(x) for x in iterable)` -151 151 | x = 1 -152 152 | -153 153 | # SIM111 -154 |- for x in iterable: -155 |- if check(x): -156 |- return False -157 |- return True - 154 |+ return all(not check(x) for x in iterable) -158 155 | -159 156 | -160 157 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM110.py:162:5: SIM110 [*] Use `return any(x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ")` instead of `for` loop | @@ -290,19 +170,6 @@ SIM110.py:162:5: SIM110 [*] Use `return any(x.isdigit() for x in "012ß9💣2ℝ | = help: Replace with `return any(x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ")` -159 159 | -160 160 | def f(): -161 161 | # SIM110 -162 |- for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ": -163 |- if x.isdigit(): -164 |- return True -165 |- return False - 162 |+ return any(x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ") -166 163 | -167 164 | -168 165 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM110.py:184:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | @@ -319,19 +186,6 @@ SIM110.py:184:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -181 181 | -182 182 | async def f(): -183 183 | # SIM110 -184 |- for x in iterable: -185 |- if check(x): -186 |- return True -187 |- return False - 184 |+ return any(check(x) for x in iterable) -188 185 | -189 186 | async def f(): -190 187 | # SIM110 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM110.py:191:5: SIM110 [*] Use `return any(check(x) for x in await iterable)` instead of `for` loop | @@ -347,17 +201,3 @@ SIM110.py:191:5: SIM110 [*] Use `return any(check(x) for x in await iterable)` i 196 | def f(): | = help: Replace with `return any(check(x) for x in await iterable)` - -188 188 | -189 189 | async def f(): -190 190 | # SIM110 -191 |- for x in await iterable: -192 |- if check(x): -193 |- return True -194 |- return False - 191 |+ return any(check(x) for x in await iterable) -195 192 | -196 193 | def f(): -197 194 | # OK (can't turn this into any() because the yield would end up inside a genexp) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap index e5edcc3018ac6..aa40b964a1c97 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap @@ -14,18 +14,6 @@ SIM111.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead o | = help: Replace with `return any(check(x) for x in iterable)` -1 1 | def f(): -2 2 | # SIM110 -3 |- for x in iterable: -4 |- if check(x): -5 |- return True -6 |- return False - 3 |+ return any(check(x) for x in iterable) -7 4 | -8 5 | -9 6 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM111.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | @@ -40,19 +28,6 @@ SIM111.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -22 22 | -23 23 | def f(): -24 24 | # SIM111 -25 |- for x in iterable: -26 |- if check(x): -27 |- return False -28 |- return True - 25 |+ return all(not check(x) for x in iterable) -29 26 | -30 27 | -31 28 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM111.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop | @@ -67,19 +42,6 @@ SIM111.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` inst | = help: Replace with `return all(x.is_empty() for x in iterable)` -30 30 | -31 31 | def f(): -32 32 | # SIM111 -33 |- for x in iterable: -34 |- if not x.is_empty(): -35 |- return False -36 |- return True - 33 |+ return all(x.is_empty() for x in iterable) -37 34 | -38 35 | -39 36 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM111.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | @@ -95,20 +57,6 @@ SIM111.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -52 52 | -53 53 | def f(): -54 54 | # SIM110 -55 |- for x in iterable: -56 |- if check(x): -57 |- return True -58 |- else: -59 |- return False - 55 |+ return any(check(x) for x in iterable) -60 56 | -61 57 | -62 58 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM111.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | @@ -124,20 +72,6 @@ SIM111.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -61 61 | -62 62 | def f(): -63 63 | # SIM111 -64 |- for x in iterable: -65 |- if check(x): -66 |- return False -67 |- else: -68 |- return True - 64 |+ return all(not check(x) for x in iterable) -69 65 | -70 66 | -71 67 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM111.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | @@ -154,20 +88,6 @@ SIM111.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -70 70 | -71 71 | def f(): -72 72 | # SIM110 -73 |- for x in iterable: -74 |- if check(x): -75 |- return True -76 |- else: -77 |- return False - 73 |+ return any(check(x) for x in iterable) -78 74 | return True -79 75 | -80 76 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM111.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | @@ -184,20 +104,6 @@ SIM111.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst | = help: Replace with `return all(not check(x) for x in iterable)` -80 80 | -81 81 | def f(): -82 82 | # SIM111 -83 |- for x in iterable: -84 |- if check(x): -85 |- return False -86 |- else: -87 |- return True - 83 |+ return all(not check(x) for x in iterable) -88 84 | return False -89 85 | -90 86 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM111.py:124:5: SIM110 Use `return any(check(x) for x in iterable)` instead of `for` loop | @@ -237,19 +143,6 @@ SIM111.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead | = help: Replace with `return any(check(x) for x in iterable)` -141 141 | x = 1 -142 142 | -143 143 | # SIM110 -144 |- for x in iterable: -145 |- if check(x): -146 |- return True -147 |- return False - 144 |+ return any(check(x) for x in iterable) -148 145 | -149 146 | -150 147 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM111.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | @@ -263,19 +156,6 @@ SIM111.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` ins | = help: Replace with `return all(not check(x) for x in iterable)` -151 151 | x = 1 -152 152 | -153 153 | # SIM111 -154 |- for x in iterable: -155 |- if check(x): -156 |- return False -157 |- return True - 154 |+ return all(not check(x) for x in iterable) -158 155 | -159 156 | -160 157 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM111.py:162:5: SIM110 [*] Use `return all(x in y for x in iterable)` instead of `for` loop | @@ -290,19 +170,6 @@ SIM111.py:162:5: SIM110 [*] Use `return all(x in y for x in iterable)` instead o | = help: Replace with `return all(x in y for x in iterable)` -159 159 | -160 160 | def f(): -161 161 | # SIM111 -162 |- for x in iterable: -163 |- if x not in y: -164 |- return False -165 |- return True - 162 |+ return all(x in y for x in iterable) -166 163 | -167 164 | -168 165 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM111.py:170:5: SIM110 [*] Use `return all(x <= y for x in iterable)` instead of `for` loop | @@ -317,19 +184,6 @@ SIM111.py:170:5: SIM110 [*] Use `return all(x <= y for x in iterable)` instead o | = help: Replace with `return all(x <= y for x in iterable)` -167 167 | -168 168 | def f(): -169 169 | # SIM111 -170 |- for x in iterable: -171 |- if x > y: -172 |- return False -173 |- return True - 170 |+ return all(x <= y for x in iterable) -174 171 | -175 172 | -176 173 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM111.py:178:5: SIM110 [*] Use `return all(not x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9")` instead of `for` loop | @@ -343,17 +197,3 @@ SIM111.py:178:5: SIM110 [*] Use `return all(not x.isdigit() for x in "012ß9💣 | |_______________^ SIM110 | = help: Replace with `return all(not x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9")` - -175 175 | -176 176 | def f(): -177 177 | # SIM111 -178 |- for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9": -179 |- if x.isdigit(): -180 |- return False -181 |- return True - 178 |+ return all(not x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9") -182 179 | -183 180 | -184 181 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap index 8ee9d5386aef8..8ca5f6f7b09c9 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap @@ -11,16 +11,6 @@ SIM112.py:4:12: SIM112 [*] Use capitalized environment variable `FOO` instead of | = help: Replace `foo` with `FOO` -1 1 | import os -2 2 | -3 3 | # Bad -4 |-os.environ['foo'] - 4 |+os.environ['FOO'] -5 5 | -6 6 | os.environ.get('foo') -7 7 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM112.py:6:16: SIM112 Use capitalized environment variable `FOO` instead of `foo` | @@ -77,16 +67,6 @@ SIM112.py:14:18: SIM112 [*] Use capitalized environment variable `FOO` instead o | = help: Replace `foo` with `FOO` -11 11 | -12 12 | env = os.environ.get('foo') -13 13 | -14 |-env = os.environ['foo'] - 14 |+env = os.environ['FOO'] -15 15 | -16 16 | if env := os.environ.get('foo'): -17 17 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM112.py:16:26: SIM112 Use capitalized environment variable `FOO` instead of `foo` | @@ -107,14 +87,3 @@ SIM112.py:19:22: SIM112 [*] Use capitalized environment variable `FOO` instead o 20 | pass | = help: Replace `foo` with `FOO` - -16 16 | if env := os.environ.get('foo'): -17 17 | pass -18 18 | -19 |-if env := os.environ['foo']: - 19 |+if env := os.environ['FOO']: -20 20 | pass -21 21 | -22 22 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap index 7f247e76537cc..073172ec5276b 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap @@ -11,17 +11,6 @@ SIM117.py:2:1: SIM117 [*] Use a single `with` statement with multiple contexts i | = help: Combine `with` statements -1 1 | # SIM117 -2 |-with A() as a: -3 |- with B() as b: -4 |- print("hello") - 2 |+with A() as a, B() as b: - 3 |+ print("hello") -5 4 | -6 5 | # SIM117 -7 6 | with A(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM117.py:7:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | @@ -34,21 +23,6 @@ SIM117.py:7:1: SIM117 [*] Use a single `with` statement with multiple contexts i | = help: Combine `with` statements -4 4 | print("hello") -5 5 | -6 6 | # SIM117 -7 |-with A(): -8 |- with B(): -9 |- with C(): -10 |- print("hello") - 7 |+with A(), B(): - 8 |+ with C(): - 9 |+ print("hello") -11 10 | -12 11 | # SIM117 -13 12 | with A() as a: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM117.py:13:1: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements | @@ -72,21 +46,6 @@ SIM117.py:19:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -16 16 | print("hello") -17 17 | -18 18 | # SIM117 -19 |-with A() as a: -20 |- with B() as b: -21 |- # Fixable due to placement of this comment. -22 |- print("hello") - 19 |+with A() as a, B() as b: - 20 |+ # Fixable due to placement of this comment. - 21 |+ print("hello") -23 22 | -24 23 | # OK -25 24 | with A() as a: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM117.py:47:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | @@ -98,19 +57,6 @@ SIM117.py:47:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -44 44 | print("hello") -45 45 | -46 46 | # SIM117 -47 |-async with A() as a: -48 |- async with B() as b: -49 |- print("hello") - 47 |+async with A() as a, B() as b: - 48 |+ print("hello") -50 49 | -51 50 | while True: -52 51 | # SIM117 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM117.py:53:5: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | @@ -125,31 +71,6 @@ SIM117.py:53:5: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -50 50 | -51 51 | while True: -52 52 | # SIM117 -53 |- with A() as a: -54 |- with B() as b: -55 |- """this - 53 |+ with A() as a, B() as b: - 54 |+ """this -56 55 | is valid""" -57 56 | -58 |- """the indentation on - 57 |+ """the indentation on -59 58 | this line is significant""" -60 59 | -61 |- "this is" \ - 60 |+ "this is" \ -62 61 | "allowed too" -63 62 | -64 |- ("so is" - 63 |+ ("so is" -65 64 | "this for some reason") -66 65 | -67 66 | # SIM117 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM117.py:68:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | @@ -164,20 +85,6 @@ SIM117.py:68:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -67 67 | # SIM117 -68 68 | with ( -69 69 | A() as a, -70 |- B() as b, - 70 |+ B() as b,C() as c -71 71 | ): -72 |- with C() as c: -73 |- print("hello") - 72 |+ print("hello") -74 73 | -75 74 | # SIM117 -76 75 | with A() as a: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM117.py:76:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | @@ -192,25 +99,6 @@ SIM117.py:76:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -73 73 | print("hello") -74 74 | -75 75 | # SIM117 -76 |-with A() as a: -77 |- with ( -78 |- B() as b, -79 |- C() as c, -80 |- ): -81 |- print("hello") - 76 |+with ( - 77 |+ A() as a, B() as b, - 78 |+ C() as c, - 79 |+): - 80 |+ print("hello") -82 81 | -83 82 | # SIM117 -84 83 | with ( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM117.py:84:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | @@ -228,24 +116,6 @@ SIM117.py:84:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -83 83 | # SIM117 -84 84 | with ( -85 85 | A() as a, -86 |- B() as b, - 86 |+ B() as b,C() as c, - 87 |+ D() as d, -87 88 | ): -88 |- with ( -89 |- C() as c, -90 |- D() as d, -91 |- ): -92 |- print("hello") - 89 |+ print("hello") -93 90 | -94 91 | # SIM117 (auto-fixable) -95 92 | with A("01ß9💣2ℝ8901ß9💣2ℝ8901ß9💣2ℝ89") as a: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM117.py:95:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | @@ -257,19 +127,6 @@ SIM117.py:95:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -92 92 | print("hello") -93 93 | -94 94 | # SIM117 (auto-fixable) -95 |-with A("01ß9💣2ℝ8901ß9💣2ℝ8901ß9💣2ℝ89") as a: -96 |- with B("01ß9💣2ℝ8901ß9💣2ℝ8901ß9💣2ℝ89") as b: -97 |- print("hello") - 95 |+with A("01ß9💣2ℝ8901ß9💣2ℝ8901ß9💣2ℝ89") as a, B("01ß9💣2ℝ8901ß9💣2ℝ8901ß9💣2ℝ89") as b: - 96 |+ print("hello") -98 97 | -99 98 | # SIM117 (not auto-fixable too long) -100 99 | with A("01ß9💣2ℝ8901ß9💣2ℝ8901ß9💣2ℝ890") as a: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM117.py:100:1: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements | @@ -303,32 +160,6 @@ SIM117.py:126:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -123 123 | f(b2, c2, d2) -124 124 | -125 125 | # SIM117 -126 |-with A() as a: -127 |- with B() as b: -128 |- type ListOrSet[T] = list[T] | set[T] - 126 |+with A() as a, B() as b: - 127 |+ type ListOrSet[T] = list[T] | set[T] -129 128 | -130 |- class ClassA[T: str]: -131 |- def method1(self) -> T: -132 |- ... - 129 |+ class ClassA[T: str]: - 130 |+ def method1(self) -> T: - 131 |+ ... -133 132 | -134 |- f" something { my_dict["key"] } something else " - 133 |+ f" something { my_dict["key"] } something else " -135 134 | -136 |- f"foo {f"bar {x}"} baz" - 135 |+ f"foo {f"bar {x}"} baz" -137 136 | -138 137 | # Allow cascading for some statements. -139 138 | import anyio - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM117.py:163:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | @@ -339,14 +170,3 @@ SIM117.py:163:1: SIM117 [*] Use a single `with` statement with multiple contexts 165 | pass | = help: Combine `with` statements - -160 160 | pass -161 161 | -162 162 | # Do not suppress combination, if a context manager is already combined with another. -163 |-async with asyncio.timeout(1), A(): -164 |- async with B(): -165 |- pass - 163 |+async with asyncio.timeout(1), A(), B(): - 164 |+ pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap index 8a6b968027ae5..f162920fc664b 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap @@ -296,16 +296,6 @@ SIM118.py:34:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -31 31 | -32 32 | (k for k in obj.keys()) # SIM118 -33 33 | -34 |-key in (obj or {}).keys() # SIM118 - 34 |+key in (obj or {}) # SIM118 -35 35 | -36 36 | (key) in (obj or {}).keys() # SIM118 -37 37 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM118.py:36:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | @@ -318,16 +308,6 @@ SIM118.py:36:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -33 33 | -34 34 | key in (obj or {}).keys() # SIM118 -35 35 | -36 |-(key) in (obj or {}).keys() # SIM118 - 36 |+(key) in (obj or {}) # SIM118 -37 37 | -38 38 | from typing import KeysView -39 39 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM118.py:50:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | @@ -407,16 +387,6 @@ SIM118.py:55:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -55 55 | for key in ( -56 56 | self.experiment.surveys[0] -57 57 | .stations[0] -58 |- .keys() - 58 |+ -59 59 | ): -60 60 | continue -61 61 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM118.py:65:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap index b81ce52379de8..30ca3453494b9 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap @@ -10,13 +10,6 @@ SIM210.py:1:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` | = help: Replace with `bool(...) -1 |-a = True if b else False # SIM210 - 1 |+a = bool(b) # SIM210 -2 2 | -3 3 | a = True if b != c else False # SIM210 -4 4 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM210.py:3:5: SIM210 [*] Remove unnecessary `True if ... else False` | @@ -29,15 +22,6 @@ SIM210.py:3:5: SIM210 [*] Remove unnecessary `True if ... else False` | = help: Remove unnecessary `True if ... else False` -1 1 | a = True if b else False # SIM210 -2 2 | -3 |-a = True if b != c else False # SIM210 - 3 |+a = b != c # SIM210 -4 4 | -5 5 | a = True if b + c else False # SIM210 -6 6 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM210.py:5:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` | @@ -50,16 +34,6 @@ SIM210.py:5:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` | = help: Replace with `bool(...) -2 2 | -3 3 | a = True if b != c else False # SIM210 -4 4 | -5 |-a = True if b + c else False # SIM210 - 5 |+a = bool(b + c) # SIM210 -6 6 | -7 7 | a = False if b else True # OK -8 8 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM210.py:15:9: SIM210 Use `bool(...)` instead of `True if ... else False` | @@ -79,13 +53,3 @@ SIM210.py:19:11: SIM210 [*] Remove unnecessary `True if ... else False` | |____________________________________________________________________________^ SIM210 | = help: Remove unnecessary `True if ... else False` - -16 16 | -17 17 | -18 18 | # Regression test for: https://github.com/astral-sh/ruff/issues/7076 -19 |-samesld = True if (psl.privatesuffix(urlparse(response.url).netloc) == -20 |- psl.privatesuffix(src.netloc)) else False - 19 |+samesld = (psl.privatesuffix(urlparse(response.url).netloc) == - 20 |+ psl.privatesuffix(src.netloc)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap index f60f9edd37826..e0a749c7289bd 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap @@ -10,13 +10,6 @@ SIM211.py:1:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | = help: Replace with `not ...` -1 |-a = False if b else True # SIM211 - 1 |+a = not b # SIM211 -2 2 | -3 3 | a = False if b != c else True # SIM211 -4 4 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM211.py:3:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | @@ -29,15 +22,6 @@ SIM211.py:3:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | = help: Replace with `not ...` -1 1 | a = False if b else True # SIM211 -2 2 | -3 |-a = False if b != c else True # SIM211 - 3 |+a = not b != c # SIM211 -4 4 | -5 5 | a = False if b + c else True # SIM211 -6 6 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM211.py:5:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | @@ -49,13 +33,3 @@ SIM211.py:5:5: SIM211 [*] Use `not ...` instead of `False if ... else True` 7 | a = True if b else False # OK | = help: Replace with `not ...` - -2 2 | -3 3 | a = False if b != c else True # SIM211 -4 4 | -5 |-a = False if b + c else True # SIM211 - 5 |+a = not b + c # SIM211 -6 6 | -7 7 | a = True if b else False # OK - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap index 14a10705bf47e..0778d7b612524 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap @@ -10,13 +10,6 @@ SIM212.py:1:5: SIM212 [*] Use `a if a else b` instead of `b if not a else a` | = help: Replace with `a if a else b` -1 |-c = b if not a else a # SIM212 - 1 |+c = a if a else b # SIM212 -2 2 | -3 3 | c = b + c if not a else a # SIM212 -4 4 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM212.py:3:5: SIM212 [*] Use `a if a else b + c` instead of `b + c if not a else a` | @@ -28,13 +21,3 @@ SIM212.py:3:5: SIM212 [*] Use `a if a else b + c` instead of `b + c if not a els 5 | c = b if not x else a # OK | = help: Replace with `a if a else b + c` - -1 1 | c = b if not a else a # SIM212 -2 2 | -3 |-c = b + c if not a else a # SIM212 - 3 |+c = a if a else b + c # SIM212 -4 4 | -5 5 | c = b if not x else a # OK -6 6 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap index dd145389de7db..c4d65920b12e0 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap @@ -9,13 +9,6 @@ SIM220.py:1:4: SIM220 [*] Use `False` instead of `a and not a` | = help: Replace with `False` -1 |-if a and not a: - 1 |+if False: -2 2 | pass -3 3 | -4 4 | if (a and not a) and b: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM220.py:4:5: SIM220 [*] Use `False` instead of `a and not a` | @@ -27,16 +20,6 @@ SIM220.py:4:5: SIM220 [*] Use `False` instead of `a and not a` | = help: Replace with `False` -1 1 | if a and not a: -2 2 | pass -3 3 | -4 |-if (a and not a) and b: - 4 |+if (False) and b: -5 5 | pass -6 6 | -7 7 | if (a and not a) or b: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM220.py:7:5: SIM220 [*] Use `False` instead of `a and not a` | @@ -47,14 +30,3 @@ SIM220.py:7:5: SIM220 [*] Use `False` instead of `a and not a` 8 | pass | = help: Replace with `False` - -4 4 | if (a and not a) and b: -5 5 | pass -6 6 | -7 |-if (a and not a) or b: - 7 |+if (False) or b: -8 8 | pass -9 9 | -10 10 | if a: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap index fc06a05f1b5ca..2e32453e6fd10 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap @@ -9,13 +9,6 @@ SIM221.py:1:4: SIM221 [*] Use `True` instead of `a or not a` | = help: Replace with `True` -1 |-if a or not a: - 1 |+if True: -2 2 | pass -3 3 | -4 4 | if (a or not a) or b: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM221.py:4:5: SIM221 [*] Use `True` instead of `a or not a` | @@ -27,16 +20,6 @@ SIM221.py:4:5: SIM221 [*] Use `True` instead of `a or not a` | = help: Replace with `True` -1 1 | if a or not a: -2 2 | pass -3 3 | -4 |-if (a or not a) or b: - 4 |+if (True) or b: -5 5 | pass -6 6 | -7 7 | if (a or not a) and b: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM221.py:7:5: SIM221 [*] Use `True` instead of `a or not a` | @@ -47,14 +30,3 @@ SIM221.py:7:5: SIM221 [*] Use `True` instead of `a or not a` 8 | pass | = help: Replace with `True` - -4 4 | if (a or not a) or b: -5 5 | pass -6 6 | -7 |-if (a or not a) and b: - 7 |+if (True) and b: -8 8 | pass -9 9 | -10 10 | if a: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap index bdb3b9dc9ddcf..bd452aa42df99 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap @@ -9,13 +9,6 @@ SIM222.py:1:4: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -1 |-if a or True: # SIM222 - 1 |+if True: # SIM222 -2 2 | pass -3 3 | -4 4 | if (a or b) or True: # SIM222 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:4:4: SIM222 [*] Use `True` instead of `... or True` | @@ -27,16 +20,6 @@ SIM222.py:4:4: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -1 1 | if a or True: # SIM222 -2 2 | pass -3 3 | -4 |-if (a or b) or True: # SIM222 - 4 |+if True: # SIM222 -5 5 | pass -6 6 | -7 7 | if a or (b or True): # SIM222 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:7:10: SIM222 [*] Use `True` instead of `... or True` | @@ -48,16 +31,6 @@ SIM222.py:7:10: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -4 4 | if (a or b) or True: # SIM222 -5 5 | pass -6 6 | -7 |-if a or (b or True): # SIM222 - 7 |+if a or (True): # SIM222 -8 8 | pass -9 9 | -10 10 | if a and True: # OK - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:24:16: SIM222 [*] Use `True` instead of `True or ...` | @@ -69,16 +42,6 @@ SIM222.py:24:16: SIM222 [*] Use `True` instead of `True or ...` | = help: Replace with `True` -21 21 | if a or f() or b or g() or True: # OK -22 22 | pass -23 23 | -24 |-if a or f() or True or g() or b: # SIM222 - 24 |+if a or f() or True: # SIM222 -25 25 | pass -26 26 | -27 27 | if True or f() or a or g() or b: # SIM222 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:27:4: SIM222 [*] Use `True` instead of `True or ...` | @@ -90,16 +53,6 @@ SIM222.py:27:4: SIM222 [*] Use `True` instead of `True or ...` | = help: Replace with `True` -24 24 | if a or f() or True or g() or b: # SIM222 -25 25 | pass -26 26 | -27 |-if True or f() or a or g() or b: # SIM222 - 27 |+if True: # SIM222 -28 28 | pass -29 29 | -30 30 | if a or True or f() or b or g(): # SIM222 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:30:4: SIM222 [*] Use `True` instead of `... or True or ...` | @@ -111,16 +64,6 @@ SIM222.py:30:4: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -27 27 | if True or f() or a or g() or b: # SIM222 -28 28 | pass -29 29 | -30 |-if a or True or f() or b or g(): # SIM222 - 30 |+if True: # SIM222 -31 31 | pass -32 32 | -33 33 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:47:6: SIM222 [*] Use `True` instead of `... or True` | @@ -131,16 +74,6 @@ SIM222.py:47:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -44 44 | pass -45 45 | -46 46 | -47 |-a or "" or True # SIM222 - 47 |+a or True # SIM222 -48 48 | -49 49 | a or "foo" or True or "bar" # SIM222 -50 50 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:49:6: SIM222 [*] Use `"foo"` instead of `"foo" or ...` | @@ -153,16 +86,6 @@ SIM222.py:49:6: SIM222 [*] Use `"foo"` instead of `"foo" or ...` | = help: Replace with `"foo"` -46 46 | -47 47 | a or "" or True # SIM222 -48 48 | -49 |-a or "foo" or True or "bar" # SIM222 - 49 |+a or "foo" # SIM222 -50 50 | -51 51 | a or 0 or True # SIM222 -52 52 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:51:6: SIM222 [*] Use `True` instead of `... or True` | @@ -175,16 +98,6 @@ SIM222.py:51:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -48 48 | -49 49 | a or "foo" or True or "bar" # SIM222 -50 50 | -51 |-a or 0 or True # SIM222 - 51 |+a or True # SIM222 -52 52 | -53 53 | a or 1 or True or 2 # SIM222 -54 54 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:53:6: SIM222 [*] Use `1` instead of `1 or ...` | @@ -197,16 +110,6 @@ SIM222.py:53:6: SIM222 [*] Use `1` instead of `1 or ...` | = help: Replace with `1` -50 50 | -51 51 | a or 0 or True # SIM222 -52 52 | -53 |-a or 1 or True or 2 # SIM222 - 53 |+a or 1 # SIM222 -54 54 | -55 55 | a or 0.0 or True # SIM222 -56 56 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:55:6: SIM222 [*] Use `True` instead of `... or True` | @@ -219,16 +122,6 @@ SIM222.py:55:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -52 52 | -53 53 | a or 1 or True or 2 # SIM222 -54 54 | -55 |-a or 0.0 or True # SIM222 - 55 |+a or True # SIM222 -56 56 | -57 57 | a or 0.1 or True or 0.2 # SIM222 -58 58 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:57:6: SIM222 [*] Use `0.1` instead of `0.1 or ...` | @@ -241,16 +134,6 @@ SIM222.py:57:6: SIM222 [*] Use `0.1` instead of `0.1 or ...` | = help: Replace with `0.1` -54 54 | -55 55 | a or 0.0 or True # SIM222 -56 56 | -57 |-a or 0.1 or True or 0.2 # SIM222 - 57 |+a or 0.1 # SIM222 -58 58 | -59 59 | a or [] or True # SIM222 -60 60 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:59:6: SIM222 [*] Use `True` instead of `... or True` | @@ -263,16 +146,6 @@ SIM222.py:59:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -56 56 | -57 57 | a or 0.1 or True or 0.2 # SIM222 -58 58 | -59 |-a or [] or True # SIM222 - 59 |+a or True # SIM222 -60 60 | -61 61 | a or list([]) or True # SIM222 -62 62 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:61:6: SIM222 [*] Use `True` instead of `... or True` | @@ -285,16 +158,6 @@ SIM222.py:61:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -58 58 | -59 59 | a or [] or True # SIM222 -60 60 | -61 |-a or list([]) or True # SIM222 - 61 |+a or True # SIM222 -62 62 | -63 63 | a or [1] or True or [2] # SIM222 -64 64 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:63:6: SIM222 [*] Use `[1]` instead of `[1] or ...` | @@ -307,16 +170,6 @@ SIM222.py:63:6: SIM222 [*] Use `[1]` instead of `[1] or ...` | = help: Replace with `[1]` -60 60 | -61 61 | a or list([]) or True # SIM222 -62 62 | -63 |-a or [1] or True or [2] # SIM222 - 63 |+a or [1] # SIM222 -64 64 | -65 65 | a or list([1]) or True or list([2]) # SIM222 -66 66 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:65:6: SIM222 [*] Use `list([1])` instead of `list([1]) or ...` | @@ -329,16 +182,6 @@ SIM222.py:65:6: SIM222 [*] Use `list([1])` instead of `list([1]) or ...` | = help: Replace with `list([1])` -62 62 | -63 63 | a or [1] or True or [2] # SIM222 -64 64 | -65 |-a or list([1]) or True or list([2]) # SIM222 - 65 |+a or list([1]) # SIM222 -66 66 | -67 67 | a or {} or True # SIM222 -68 68 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:67:6: SIM222 [*] Use `True` instead of `... or True` | @@ -351,16 +194,6 @@ SIM222.py:67:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -64 64 | -65 65 | a or list([1]) or True or list([2]) # SIM222 -66 66 | -67 |-a or {} or True # SIM222 - 67 |+a or True # SIM222 -68 68 | -69 69 | a or dict() or True # SIM222 -70 70 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:69:6: SIM222 [*] Use `True` instead of `... or True` | @@ -373,16 +206,6 @@ SIM222.py:69:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -66 66 | -67 67 | a or {} or True # SIM222 -68 68 | -69 |-a or dict() or True # SIM222 - 69 |+a or True # SIM222 -70 70 | -71 71 | a or {1: 1} or True or {2: 2} # SIM222 -72 72 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:71:6: SIM222 [*] Use `{1: 1}` instead of `{1: 1} or ...` | @@ -395,16 +218,6 @@ SIM222.py:71:6: SIM222 [*] Use `{1: 1}` instead of `{1: 1} or ...` | = help: Replace with `{1: 1}` -68 68 | -69 69 | a or dict() or True # SIM222 -70 70 | -71 |-a or {1: 1} or True or {2: 2} # SIM222 - 71 |+a or {1: 1} # SIM222 -72 72 | -73 73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222 -74 74 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:73:6: SIM222 [*] Use `dict({1: 1})` instead of `dict({1: 1}) or ...` | @@ -417,16 +230,6 @@ SIM222.py:73:6: SIM222 [*] Use `dict({1: 1})` instead of `dict({1: 1}) or ...` | = help: Replace with `dict({1: 1})` -70 70 | -71 71 | a or {1: 1} or True or {2: 2} # SIM222 -72 72 | -73 |-a or dict({1: 1}) or True or dict({2: 2}) # SIM222 - 73 |+a or dict({1: 1}) # SIM222 -74 74 | -75 75 | a or set() or True # SIM222 -76 76 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:75:6: SIM222 [*] Use `True` instead of `... or True` | @@ -439,16 +242,6 @@ SIM222.py:75:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -72 72 | -73 73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222 -74 74 | -75 |-a or set() or True # SIM222 - 75 |+a or True # SIM222 -76 76 | -77 77 | a or set(set()) or True # SIM222 -78 78 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:77:6: SIM222 [*] Use `True` instead of `... or True` | @@ -461,16 +254,6 @@ SIM222.py:77:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -74 74 | -75 75 | a or set() or True # SIM222 -76 76 | -77 |-a or set(set()) or True # SIM222 - 77 |+a or True # SIM222 -78 78 | -79 79 | a or {1} or True or {2} # SIM222 -80 80 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:79:6: SIM222 [*] Use `{1}` instead of `{1} or ...` | @@ -483,16 +266,6 @@ SIM222.py:79:6: SIM222 [*] Use `{1}` instead of `{1} or ...` | = help: Replace with `{1}` -76 76 | -77 77 | a or set(set()) or True # SIM222 -78 78 | -79 |-a or {1} or True or {2} # SIM222 - 79 |+a or {1} # SIM222 -80 80 | -81 81 | a or set({1}) or True or set({2}) # SIM222 -82 82 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:81:6: SIM222 [*] Use `set({1})` instead of `set({1}) or ...` | @@ -505,16 +278,6 @@ SIM222.py:81:6: SIM222 [*] Use `set({1})` instead of `set({1}) or ...` | = help: Replace with `set({1})` -78 78 | -79 79 | a or {1} or True or {2} # SIM222 -80 80 | -81 |-a or set({1}) or True or set({2}) # SIM222 - 81 |+a or set({1}) # SIM222 -82 82 | -83 83 | a or () or True # SIM222 -84 84 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:83:6: SIM222 [*] Use `True` instead of `... or True` | @@ -527,16 +290,6 @@ SIM222.py:83:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -80 80 | -81 81 | a or set({1}) or True or set({2}) # SIM222 -82 82 | -83 |-a or () or True # SIM222 - 83 |+a or True # SIM222 -84 84 | -85 85 | a or tuple(()) or True # SIM222 -86 86 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:85:6: SIM222 [*] Use `True` instead of `... or True` | @@ -549,16 +302,6 @@ SIM222.py:85:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -82 82 | -83 83 | a or () or True # SIM222 -84 84 | -85 |-a or tuple(()) or True # SIM222 - 85 |+a or True # SIM222 -86 86 | -87 87 | a or (1,) or True or (2,) # SIM222 -88 88 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:87:6: SIM222 [*] Use `(1,)` instead of `(1,) or ...` | @@ -571,16 +314,6 @@ SIM222.py:87:6: SIM222 [*] Use `(1,)` instead of `(1,) or ...` | = help: Replace with `(1,)` -84 84 | -85 85 | a or tuple(()) or True # SIM222 -86 86 | -87 |-a or (1,) or True or (2,) # SIM222 - 87 |+a or (1,) # SIM222 -88 88 | -89 89 | a or tuple((1,)) or True or tuple((2,)) # SIM222 -90 90 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:89:6: SIM222 [*] Use `tuple((1,))` instead of `tuple((1,)) or ...` | @@ -593,16 +326,6 @@ SIM222.py:89:6: SIM222 [*] Use `tuple((1,))` instead of `tuple((1,)) or ...` | = help: Replace with `tuple((1,))` -86 86 | -87 87 | a or (1,) or True or (2,) # SIM222 -88 88 | -89 |-a or tuple((1,)) or True or tuple((2,)) # SIM222 - 89 |+a or tuple((1,)) # SIM222 -90 90 | -91 91 | a or frozenset() or True # SIM222 -92 92 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:91:6: SIM222 [*] Use `True` instead of `... or True` | @@ -615,16 +338,6 @@ SIM222.py:91:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -88 88 | -89 89 | a or tuple((1,)) or True or tuple((2,)) # SIM222 -90 90 | -91 |-a or frozenset() or True # SIM222 - 91 |+a or True # SIM222 -92 92 | -93 93 | a or frozenset(frozenset()) or True # SIM222 -94 94 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:93:6: SIM222 [*] Use `True` instead of `... or True` | @@ -637,16 +350,6 @@ SIM222.py:93:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -90 90 | -91 91 | a or frozenset() or True # SIM222 -92 92 | -93 |-a or frozenset(frozenset()) or True # SIM222 - 93 |+a or True # SIM222 -94 94 | -95 95 | a or frozenset({1}) or True or frozenset({2}) # SIM222 -96 96 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:95:6: SIM222 [*] Use `frozenset({1})` instead of `frozenset({1}) or ...` | @@ -659,16 +362,6 @@ SIM222.py:95:6: SIM222 [*] Use `frozenset({1})` instead of `frozenset({1}) or .. | = help: Replace with `frozenset({1})` -92 92 | -93 93 | a or frozenset(frozenset()) or True # SIM222 -94 94 | -95 |-a or frozenset({1}) or True or frozenset({2}) # SIM222 - 95 |+a or frozenset({1}) # SIM222 -96 96 | -97 97 | a or frozenset(frozenset({1})) or True or frozenset(frozenset({2})) # SIM222 -98 98 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:97:6: SIM222 [*] Use `frozenset(frozenset({1}))` instead of `frozenset(frozenset({1})) or ...` | @@ -679,16 +372,6 @@ SIM222.py:97:6: SIM222 [*] Use `frozenset(frozenset({1}))` instead of `frozenset | = help: Replace with `frozenset(frozenset({1}))` -94 94 | -95 95 | a or frozenset({1}) or True or frozenset({2}) # SIM222 -96 96 | -97 |-a or frozenset(frozenset({1})) or True or frozenset(frozenset({2})) # SIM222 - 97 |+a or frozenset(frozenset({1})) # SIM222 -98 98 | -99 99 | -100 100 | # Inside test `a` is simplified. - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:102:6: SIM222 [*] Use `True` instead of `... or True or ...` | @@ -701,16 +384,6 @@ SIM222.py:102:6: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -99 99 | -100 100 | # Inside test `a` is simplified. -101 101 | -102 |-bool(a or [1] or True or [2]) # SIM222 - 102 |+bool(True) # SIM222 -103 103 | -104 104 | assert a or [1] or True or [2] # SIM222 -105 105 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:104:8: SIM222 [*] Use `True` instead of `... or True or ...` | @@ -723,16 +396,6 @@ SIM222.py:104:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -101 101 | -102 102 | bool(a or [1] or True or [2]) # SIM222 -103 103 | -104 |-assert a or [1] or True or [2] # SIM222 - 104 |+assert True # SIM222 -105 105 | -106 106 | if (a or [1] or True or [2]) and (a or [1] or True or [2]): # SIM222 -107 107 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:106:5: SIM222 [*] Use `True` instead of `... or True or ...` | @@ -744,16 +407,6 @@ SIM222.py:106:5: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -103 103 | -104 104 | assert a or [1] or True or [2] # SIM222 -105 105 | -106 |-if (a or [1] or True or [2]) and (a or [1] or True or [2]): # SIM222 - 106 |+if (True) and (a or [1] or True or [2]): # SIM222 -107 107 | pass -108 108 | -109 109 | 0 if a or [1] or True or [2] else 1 # SIM222 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:106:35: SIM222 [*] Use `True` instead of `... or True or ...` | @@ -765,16 +418,6 @@ SIM222.py:106:35: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -103 103 | -104 104 | assert a or [1] or True or [2] # SIM222 -105 105 | -106 |-if (a or [1] or True or [2]) and (a or [1] or True or [2]): # SIM222 - 106 |+if (a or [1] or True or [2]) and (True): # SIM222 -107 107 | pass -108 108 | -109 109 | 0 if a or [1] or True or [2] else 1 # SIM222 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:109:6: SIM222 [*] Use `True` instead of `... or True or ...` | @@ -787,16 +430,6 @@ SIM222.py:109:6: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -106 106 | if (a or [1] or True or [2]) and (a or [1] or True or [2]): # SIM222 -107 107 | pass -108 108 | -109 |-0 if a or [1] or True or [2] else 1 # SIM222 - 109 |+0 if True else 1 # SIM222 -110 110 | -111 111 | while a or [1] or True or [2]: # SIM222 -112 112 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:111:7: SIM222 [*] Use `True` instead of `... or True or ...` | @@ -808,16 +441,6 @@ SIM222.py:111:7: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -108 108 | -109 109 | 0 if a or [1] or True or [2] else 1 # SIM222 -110 110 | -111 |-while a or [1] or True or [2]: # SIM222 - 111 |+while True: # SIM222 -112 112 | pass -113 113 | -114 114 | [ - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:118:8: SIM222 [*] Use `True` instead of `... or True or ...` | @@ -830,16 +453,6 @@ SIM222.py:118:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -115 115 | 0 -116 116 | for a in range(10) -117 117 | for b in range(10) -118 |- if a or [1] or True or [2] # SIM222 - 118 |+ if True # SIM222 -119 119 | if b or [1] or True or [2] # SIM222 -120 120 | ] -121 121 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:119:8: SIM222 [*] Use `True` instead of `... or True or ...` | @@ -851,16 +464,6 @@ SIM222.py:119:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -116 116 | for a in range(10) -117 117 | for b in range(10) -118 118 | if a or [1] or True or [2] # SIM222 -119 |- if b or [1] or True or [2] # SIM222 - 119 |+ if True # SIM222 -120 120 | ] -121 121 | -122 122 | { - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:126:8: SIM222 [*] Use `True` instead of `... or True or ...` | @@ -873,16 +476,6 @@ SIM222.py:126:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -123 123 | 0 -124 124 | for a in range(10) -125 125 | for b in range(10) -126 |- if a or [1] or True or [2] # SIM222 - 126 |+ if True # SIM222 -127 127 | if b or [1] or True or [2] # SIM222 -128 128 | } -129 129 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:127:8: SIM222 [*] Use `True` instead of `... or True or ...` | @@ -894,16 +487,6 @@ SIM222.py:127:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -124 124 | for a in range(10) -125 125 | for b in range(10) -126 126 | if a or [1] or True or [2] # SIM222 -127 |- if b or [1] or True or [2] # SIM222 - 127 |+ if True # SIM222 -128 128 | } -129 129 | -130 130 | { - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:134:8: SIM222 [*] Use `True` instead of `... or True or ...` | @@ -916,16 +499,6 @@ SIM222.py:134:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -131 131 | 0: 0 -132 132 | for a in range(10) -133 133 | for b in range(10) -134 |- if a or [1] or True or [2] # SIM222 - 134 |+ if True # SIM222 -135 135 | if b or [1] or True or [2] # SIM222 -136 136 | } -137 137 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:135:8: SIM222 [*] Use `True` instead of `... or True or ...` | @@ -937,16 +510,6 @@ SIM222.py:135:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -132 132 | for a in range(10) -133 133 | for b in range(10) -134 134 | if a or [1] or True or [2] # SIM222 -135 |- if b or [1] or True or [2] # SIM222 - 135 |+ if True # SIM222 -136 136 | } -137 137 | -138 138 | ( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:142:8: SIM222 [*] Use `True` instead of `... or True or ...` | @@ -959,16 +522,6 @@ SIM222.py:142:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -139 139 | 0 -140 140 | for a in range(10) -141 141 | for b in range(10) -142 |- if a or [1] or True or [2] # SIM222 - 142 |+ if True # SIM222 -143 143 | if b or [1] or True or [2] # SIM222 -144 144 | ) -145 145 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:143:8: SIM222 [*] Use `True` instead of `... or True or ...` | @@ -980,16 +533,6 @@ SIM222.py:143:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -140 140 | for a in range(10) -141 141 | for b in range(10) -142 142 | if a or [1] or True or [2] # SIM222 -143 |- if b or [1] or True or [2] # SIM222 - 143 |+ if True # SIM222 -144 144 | ) -145 145 | -146 146 | # Outside test `a` is not simplified. - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:148:6: SIM222 [*] Use `[1]` instead of `[1] or ...` | @@ -1002,16 +545,6 @@ SIM222.py:148:6: SIM222 [*] Use `[1]` instead of `[1] or ...` | = help: Replace with `[1]` -145 145 | -146 146 | # Outside test `a` is not simplified. -147 147 | -148 |-a or [1] or True or [2] # SIM222 - 148 |+a or [1] # SIM222 -149 149 | -150 150 | if (a or [1] or True or [2]) == (a or [1]): # SIM222 -151 151 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:150:10: SIM222 [*] Use `[1]` instead of `[1] or ...` | @@ -1023,16 +556,6 @@ SIM222.py:150:10: SIM222 [*] Use `[1]` instead of `[1] or ...` | = help: Replace with `[1]` -147 147 | -148 148 | a or [1] or True or [2] # SIM222 -149 149 | -150 |-if (a or [1] or True or [2]) == (a or [1]): # SIM222 - 150 |+if (a or [1]) == (a or [1]): # SIM222 -151 151 | pass -152 152 | -153 153 | if f(a or [1] or True or [2]): # SIM222 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:153:11: SIM222 [*] Use `[1]` instead of `[1] or ...` | @@ -1044,16 +567,6 @@ SIM222.py:153:11: SIM222 [*] Use `[1]` instead of `[1] or ...` | = help: Replace with `[1]` -150 150 | if (a or [1] or True or [2]) == (a or [1]): # SIM222 -151 151 | pass -152 152 | -153 |-if f(a or [1] or True or [2]): # SIM222 - 153 |+if f(a or [1]): # SIM222 -154 154 | pass -155 155 | -156 156 | # Regression test for: https://github.com/astral-sh/ruff/issues/7099 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:157:30: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) or ...` | @@ -1064,16 +577,6 @@ SIM222.py:157:30: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) o | = help: Replace with `(int, int, int)` -154 154 | pass -155 155 | -156 156 | # Regression test for: https://github.com/astral-sh/ruff/issues/7099 -157 |-def secondToTime(s0: int) -> (int, int, int) or str: - 157 |+def secondToTime(s0: int) -> (int, int, int): -158 158 | m, s = divmod(s0, 60) -159 159 | -160 160 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:161:31: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) or ...` | @@ -1083,16 +586,6 @@ SIM222.py:161:31: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) o | = help: Replace with `(int, int, int)` -158 158 | m, s = divmod(s0, 60) -159 159 | -160 160 | -161 |-def secondToTime(s0: int) -> ((int, int, int) or str): - 161 |+def secondToTime(s0: int) -> ((int, int, int)): -162 162 | m, s = divmod(s0, 60) -163 163 | -164 164 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM222.py:168:7: SIM222 [*] Use `"bar"` instead of `... or "bar"` | @@ -1103,12 +596,3 @@ SIM222.py:168:7: SIM222 [*] Use `"bar"` instead of `... or "bar"` 169 | print(f"{1}{''}" or "bar") | = help: Replace with `"bar"` - -165 165 | # Regression test for: https://github.com/astral-sh/ruff/issues/9479 -166 166 | print(f"{a}{b}" or "bar") -167 167 | print(f"{a}{''}" or "bar") -168 |-print(f"{''}{''}" or "bar") - 168 |+print("bar") -169 169 | print(f"{1}{''}" or "bar") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap index d1ddb9f6e5dbd..17969b1850550 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap @@ -9,13 +9,6 @@ SIM223.py:1:4: SIM223 [*] Use `False` instead of `... and False` | = help: Replace with `False` -1 |-if a and False: # SIM223 - 1 |+if False: # SIM223 -2 2 | pass -3 3 | -4 4 | if (a or b) and False: # SIM223 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:4:4: SIM223 [*] Use `False` instead of `... and False` | @@ -27,16 +20,6 @@ SIM223.py:4:4: SIM223 [*] Use `False` instead of `... and False` | = help: Replace with `False` -1 1 | if a and False: # SIM223 -2 2 | pass -3 3 | -4 |-if (a or b) and False: # SIM223 - 4 |+if False: # SIM223 -5 5 | pass -6 6 | -7 7 | if a or (b and False): # SIM223 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:7:10: SIM223 [*] Use `False` instead of `... and False` | @@ -48,16 +31,6 @@ SIM223.py:7:10: SIM223 [*] Use `False` instead of `... and False` | = help: Replace with `False` -4 4 | if (a or b) and False: # SIM223 -5 5 | pass -6 6 | -7 |-if a or (b and False): # SIM223 - 7 |+if a or (False): # SIM223 -8 8 | pass -9 9 | -10 10 | if a or False: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:19:18: SIM223 [*] Use `False` instead of `False and ...` | @@ -69,16 +42,6 @@ SIM223.py:19:18: SIM223 [*] Use `False` instead of `False and ...` | = help: Replace with `False` -16 16 | if a and f() and b and g() and False: # OK -17 17 | pass -18 18 | -19 |-if a and f() and False and g() and b: # SIM223 - 19 |+if a and f() and False: # SIM223 -20 20 | pass -21 21 | -22 22 | if False and f() and a and g() and b: # SIM223 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:22:4: SIM223 [*] Use `False` instead of `False and ...` | @@ -90,16 +53,6 @@ SIM223.py:22:4: SIM223 [*] Use `False` instead of `False and ...` | = help: Replace with `False` -19 19 | if a and f() and False and g() and b: # SIM223 -20 20 | pass -21 21 | -22 |-if False and f() and a and g() and b: # SIM223 - 22 |+if False: # SIM223 -23 23 | pass -24 24 | -25 25 | if a and False and f() and b and g(): # SIM223 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:25:4: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -111,16 +64,6 @@ SIM223.py:25:4: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -22 22 | if False and f() and a and g() and b: # SIM223 -23 23 | pass -24 24 | -25 |-if a and False and f() and b and g(): # SIM223 - 25 |+if False: # SIM223 -26 26 | pass -27 27 | -28 28 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:42:7: SIM223 [*] Use `""` instead of `"" and ...` | @@ -131,16 +74,6 @@ SIM223.py:42:7: SIM223 [*] Use `""` instead of `"" and ...` | = help: Replace with `""` -39 39 | pass -40 40 | -41 41 | -42 |-a and "" and False # SIM223 - 42 |+a and "" # SIM223 -43 43 | -44 44 | a and "foo" and False and "bar" # SIM223 -45 45 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:44:7: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -153,16 +86,6 @@ SIM223.py:44:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -41 41 | -42 42 | a and "" and False # SIM223 -43 43 | -44 |-a and "foo" and False and "bar" # SIM223 - 44 |+a and False # SIM223 -45 45 | -46 46 | a and 0 and False # SIM223 -47 47 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:46:7: SIM223 [*] Use `0` instead of `0 and ...` | @@ -175,16 +98,6 @@ SIM223.py:46:7: SIM223 [*] Use `0` instead of `0 and ...` | = help: Replace with `0` -43 43 | -44 44 | a and "foo" and False and "bar" # SIM223 -45 45 | -46 |-a and 0 and False # SIM223 - 46 |+a and 0 # SIM223 -47 47 | -48 48 | a and 1 and False and 2 # SIM223 -49 49 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:48:7: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -197,16 +110,6 @@ SIM223.py:48:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -45 45 | -46 46 | a and 0 and False # SIM223 -47 47 | -48 |-a and 1 and False and 2 # SIM223 - 48 |+a and False # SIM223 -49 49 | -50 50 | a and 0.0 and False # SIM223 -51 51 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:50:7: SIM223 [*] Use `0.0` instead of `0.0 and ...` | @@ -219,16 +122,6 @@ SIM223.py:50:7: SIM223 [*] Use `0.0` instead of `0.0 and ...` | = help: Replace with `0.0` -47 47 | -48 48 | a and 1 and False and 2 # SIM223 -49 49 | -50 |-a and 0.0 and False # SIM223 - 50 |+a and 0.0 # SIM223 -51 51 | -52 52 | a and 0.1 and False and 0.2 # SIM223 -53 53 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:52:7: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -241,16 +134,6 @@ SIM223.py:52:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -49 49 | -50 50 | a and 0.0 and False # SIM223 -51 51 | -52 |-a and 0.1 and False and 0.2 # SIM223 - 52 |+a and False # SIM223 -53 53 | -54 54 | a and [] and False # SIM223 -55 55 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:54:7: SIM223 [*] Use `[]` instead of `[] and ...` | @@ -263,16 +146,6 @@ SIM223.py:54:7: SIM223 [*] Use `[]` instead of `[] and ...` | = help: Replace with `[]` -51 51 | -52 52 | a and 0.1 and False and 0.2 # SIM223 -53 53 | -54 |-a and [] and False # SIM223 - 54 |+a and [] # SIM223 -55 55 | -56 56 | a and list([]) and False # SIM223 -57 57 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:56:7: SIM223 [*] Use `list([])` instead of `list([]) and ...` | @@ -285,16 +158,6 @@ SIM223.py:56:7: SIM223 [*] Use `list([])` instead of `list([]) and ...` | = help: Replace with `list([])` -53 53 | -54 54 | a and [] and False # SIM223 -55 55 | -56 |-a and list([]) and False # SIM223 - 56 |+a and list([]) # SIM223 -57 57 | -58 58 | a and [1] and False and [2] # SIM223 -59 59 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:58:7: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -307,16 +170,6 @@ SIM223.py:58:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -55 55 | -56 56 | a and list([]) and False # SIM223 -57 57 | -58 |-a and [1] and False and [2] # SIM223 - 58 |+a and False # SIM223 -59 59 | -60 60 | a and list([1]) and False and list([2]) # SIM223 -61 61 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:60:7: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -329,16 +182,6 @@ SIM223.py:60:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -57 57 | -58 58 | a and [1] and False and [2] # SIM223 -59 59 | -60 |-a and list([1]) and False and list([2]) # SIM223 - 60 |+a and False # SIM223 -61 61 | -62 62 | a and {} and False # SIM223 -63 63 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:62:7: SIM223 [*] Use `{}` instead of `{} and ...` | @@ -351,16 +194,6 @@ SIM223.py:62:7: SIM223 [*] Use `{}` instead of `{} and ...` | = help: Replace with `{}` -59 59 | -60 60 | a and list([1]) and False and list([2]) # SIM223 -61 61 | -62 |-a and {} and False # SIM223 - 62 |+a and {} # SIM223 -63 63 | -64 64 | a and dict() and False # SIM223 -65 65 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:64:7: SIM223 [*] Use `dict()` instead of `dict() and ...` | @@ -373,16 +206,6 @@ SIM223.py:64:7: SIM223 [*] Use `dict()` instead of `dict() and ...` | = help: Replace with `dict()` -61 61 | -62 62 | a and {} and False # SIM223 -63 63 | -64 |-a and dict() and False # SIM223 - 64 |+a and dict() # SIM223 -65 65 | -66 66 | a and {1: 1} and False and {2: 2} # SIM223 -67 67 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:66:7: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -395,16 +218,6 @@ SIM223.py:66:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -63 63 | -64 64 | a and dict() and False # SIM223 -65 65 | -66 |-a and {1: 1} and False and {2: 2} # SIM223 - 66 |+a and False # SIM223 -67 67 | -68 68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223 -69 69 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:68:7: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -417,16 +230,6 @@ SIM223.py:68:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -65 65 | -66 66 | a and {1: 1} and False and {2: 2} # SIM223 -67 67 | -68 |-a and dict({1: 1}) and False and dict({2: 2}) # SIM223 - 68 |+a and False # SIM223 -69 69 | -70 70 | a and set() and False # SIM223 -71 71 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:70:7: SIM223 [*] Use `set()` instead of `set() and ...` | @@ -439,16 +242,6 @@ SIM223.py:70:7: SIM223 [*] Use `set()` instead of `set() and ...` | = help: Replace with `set()` -67 67 | -68 68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223 -69 69 | -70 |-a and set() and False # SIM223 - 70 |+a and set() # SIM223 -71 71 | -72 72 | a and set(set()) and False # SIM223 -73 73 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:72:7: SIM223 [*] Use `set(set())` instead of `set(set()) and ...` | @@ -461,16 +254,6 @@ SIM223.py:72:7: SIM223 [*] Use `set(set())` instead of `set(set()) and ...` | = help: Replace with `set(set())` -69 69 | -70 70 | a and set() and False # SIM223 -71 71 | -72 |-a and set(set()) and False # SIM223 - 72 |+a and set(set()) # SIM223 -73 73 | -74 74 | a and {1} and False and {2} # SIM223 -75 75 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:74:7: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -483,16 +266,6 @@ SIM223.py:74:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -71 71 | -72 72 | a and set(set()) and False # SIM223 -73 73 | -74 |-a and {1} and False and {2} # SIM223 - 74 |+a and False # SIM223 -75 75 | -76 76 | a and set({1}) and False and set({2}) # SIM223 -77 77 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:76:7: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -505,16 +278,6 @@ SIM223.py:76:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -73 73 | -74 74 | a and {1} and False and {2} # SIM223 -75 75 | -76 |-a and set({1}) and False and set({2}) # SIM223 - 76 |+a and False # SIM223 -77 77 | -78 78 | a and () and False # SIM222 -79 79 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:78:7: SIM223 [*] Use `()` instead of `() and ...` | @@ -527,16 +290,6 @@ SIM223.py:78:7: SIM223 [*] Use `()` instead of `() and ...` | = help: Replace with `()` -75 75 | -76 76 | a and set({1}) and False and set({2}) # SIM223 -77 77 | -78 |-a and () and False # SIM222 - 78 |+a and () # SIM222 -79 79 | -80 80 | a and tuple(()) and False # SIM222 -81 81 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:80:7: SIM223 [*] Use `tuple(())` instead of `tuple(()) and ...` | @@ -549,16 +302,6 @@ SIM223.py:80:7: SIM223 [*] Use `tuple(())` instead of `tuple(()) and ...` | = help: Replace with `tuple(())` -77 77 | -78 78 | a and () and False # SIM222 -79 79 | -80 |-a and tuple(()) and False # SIM222 - 80 |+a and tuple(()) # SIM222 -81 81 | -82 82 | a and (1,) and False and (2,) # SIM222 -83 83 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:82:7: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -571,16 +314,6 @@ SIM223.py:82:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -79 79 | -80 80 | a and tuple(()) and False # SIM222 -81 81 | -82 |-a and (1,) and False and (2,) # SIM222 - 82 |+a and False # SIM222 -83 83 | -84 84 | a and tuple((1,)) and False and tuple((2,)) # SIM222 -85 85 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:84:7: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -593,16 +326,6 @@ SIM223.py:84:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -81 81 | -82 82 | a and (1,) and False and (2,) # SIM222 -83 83 | -84 |-a and tuple((1,)) and False and tuple((2,)) # SIM222 - 84 |+a and False # SIM222 -85 85 | -86 86 | a and frozenset() and False # SIM222 -87 87 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:86:7: SIM223 [*] Use `frozenset()` instead of `frozenset() and ...` | @@ -615,16 +338,6 @@ SIM223.py:86:7: SIM223 [*] Use `frozenset()` instead of `frozenset() and ...` | = help: Replace with `frozenset()` -83 83 | -84 84 | a and tuple((1,)) and False and tuple((2,)) # SIM222 -85 85 | -86 |-a and frozenset() and False # SIM222 - 86 |+a and frozenset() # SIM222 -87 87 | -88 88 | a and frozenset(frozenset()) and False # SIM222 -89 89 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:88:7: SIM223 [*] Use `frozenset(frozenset())` instead of `frozenset(frozenset()) and ...` | @@ -637,16 +350,6 @@ SIM223.py:88:7: SIM223 [*] Use `frozenset(frozenset())` instead of `frozenset(fr | = help: Replace with `frozenset(frozenset())` -85 85 | -86 86 | a and frozenset() and False # SIM222 -87 87 | -88 |-a and frozenset(frozenset()) and False # SIM222 - 88 |+a and frozenset(frozenset()) # SIM222 -89 89 | -90 90 | a and frozenset({1}) and False and frozenset({2}) # SIM222 -91 91 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:90:7: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -659,16 +362,6 @@ SIM223.py:90:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -87 87 | -88 88 | a and frozenset(frozenset()) and False # SIM222 -89 89 | -90 |-a and frozenset({1}) and False and frozenset({2}) # SIM222 - 90 |+a and False # SIM222 -91 91 | -92 92 | a and frozenset(frozenset({1})) and False and frozenset(frozenset({2})) # SIM222 -93 93 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:92:7: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -679,16 +372,6 @@ SIM223.py:92:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -89 89 | -90 90 | a and frozenset({1}) and False and frozenset({2}) # SIM222 -91 91 | -92 |-a and frozenset(frozenset({1})) and False and frozenset(frozenset({2})) # SIM222 - 92 |+a and False # SIM222 -93 93 | -94 94 | -95 95 | # Inside test `a` is simplified. - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:97:6: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -701,16 +384,6 @@ SIM223.py:97:6: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -94 94 | -95 95 | # Inside test `a` is simplified. -96 96 | -97 |-bool(a and [] and False and []) # SIM223 - 97 |+bool(False) # SIM223 -98 98 | -99 99 | assert a and [] and False and [] # SIM223 -100 100 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:99:8: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -723,16 +396,6 @@ SIM223.py:99:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -96 96 | -97 97 | bool(a and [] and False and []) # SIM223 -98 98 | -99 |-assert a and [] and False and [] # SIM223 - 99 |+assert False # SIM223 -100 100 | -101 101 | if (a and [] and False and []) or (a and [] and False and []): # SIM223 -102 102 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:101:5: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -744,16 +407,6 @@ SIM223.py:101:5: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -98 98 | -99 99 | assert a and [] and False and [] # SIM223 -100 100 | -101 |-if (a and [] and False and []) or (a and [] and False and []): # SIM223 - 101 |+if (False) or (a and [] and False and []): # SIM223 -102 102 | pass -103 103 | -104 104 | 0 if a and [] and False and [] else 1 # SIM222 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:101:36: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -765,16 +418,6 @@ SIM223.py:101:36: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -98 98 | -99 99 | assert a and [] and False and [] # SIM223 -100 100 | -101 |-if (a and [] and False and []) or (a and [] and False and []): # SIM223 - 101 |+if (a and [] and False and []) or (False): # SIM223 -102 102 | pass -103 103 | -104 104 | 0 if a and [] and False and [] else 1 # SIM222 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:104:6: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -787,16 +430,6 @@ SIM223.py:104:6: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -101 101 | if (a and [] and False and []) or (a and [] and False and []): # SIM223 -102 102 | pass -103 103 | -104 |-0 if a and [] and False and [] else 1 # SIM222 - 104 |+0 if False else 1 # SIM222 -105 105 | -106 106 | while a and [] and False and []: # SIM223 -107 107 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:106:7: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -808,16 +441,6 @@ SIM223.py:106:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -103 103 | -104 104 | 0 if a and [] and False and [] else 1 # SIM222 -105 105 | -106 |-while a and [] and False and []: # SIM223 - 106 |+while False: # SIM223 -107 107 | pass -108 108 | -109 109 | [ - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:113:8: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -830,16 +453,6 @@ SIM223.py:113:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -110 110 | 0 -111 111 | for a in range(10) -112 112 | for b in range(10) -113 |- if a and [] and False and [] # SIM223 - 113 |+ if False # SIM223 -114 114 | if b and [] and False and [] # SIM223 -115 115 | ] -116 116 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:114:8: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -851,16 +464,6 @@ SIM223.py:114:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -111 111 | for a in range(10) -112 112 | for b in range(10) -113 113 | if a and [] and False and [] # SIM223 -114 |- if b and [] and False and [] # SIM223 - 114 |+ if False # SIM223 -115 115 | ] -116 116 | -117 117 | { - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:121:8: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -873,16 +476,6 @@ SIM223.py:121:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -118 118 | 0 -119 119 | for a in range(10) -120 120 | for b in range(10) -121 |- if a and [] and False and [] # SIM223 - 121 |+ if False # SIM223 -122 122 | if b and [] and False and [] # SIM223 -123 123 | } -124 124 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:122:8: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -894,16 +487,6 @@ SIM223.py:122:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -119 119 | for a in range(10) -120 120 | for b in range(10) -121 121 | if a and [] and False and [] # SIM223 -122 |- if b and [] and False and [] # SIM223 - 122 |+ if False # SIM223 -123 123 | } -124 124 | -125 125 | { - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:129:8: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -916,16 +499,6 @@ SIM223.py:129:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -126 126 | 0: 0 -127 127 | for a in range(10) -128 128 | for b in range(10) -129 |- if a and [] and False and [] # SIM223 - 129 |+ if False # SIM223 -130 130 | if b and [] and False and [] # SIM223 -131 131 | } -132 132 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:130:8: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -937,16 +510,6 @@ SIM223.py:130:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -127 127 | for a in range(10) -128 128 | for b in range(10) -129 129 | if a and [] and False and [] # SIM223 -130 |- if b and [] and False and [] # SIM223 - 130 |+ if False # SIM223 -131 131 | } -132 132 | -133 133 | ( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:137:8: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -959,16 +522,6 @@ SIM223.py:137:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -134 134 | 0 -135 135 | for a in range(10) -136 136 | for b in range(10) -137 |- if a and [] and False and [] # SIM223 - 137 |+ if False # SIM223 -138 138 | if b and [] and False and [] # SIM223 -139 139 | ) -140 140 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:138:8: SIM223 [*] Use `False` instead of `... and False and ...` | @@ -980,16 +533,6 @@ SIM223.py:138:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -135 135 | for a in range(10) -136 136 | for b in range(10) -137 137 | if a and [] and False and [] # SIM223 -138 |- if b and [] and False and [] # SIM223 - 138 |+ if False # SIM223 -139 139 | ) -140 140 | -141 141 | # Outside test `a` is not simplified. - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:143:7: SIM223 [*] Use `[]` instead of `[] and ...` | @@ -1002,16 +545,6 @@ SIM223.py:143:7: SIM223 [*] Use `[]` instead of `[] and ...` | = help: Replace with `[]` -140 140 | -141 141 | # Outside test `a` is not simplified. -142 142 | -143 |-a and [] and False and [] # SIM223 - 143 |+a and [] # SIM223 -144 144 | -145 145 | if (a and [] and False and []) == (a and []): # SIM223 -146 146 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:145:11: SIM223 [*] Use `[]` instead of `[] and ...` | @@ -1023,16 +556,6 @@ SIM223.py:145:11: SIM223 [*] Use `[]` instead of `[] and ...` | = help: Replace with `[]` -142 142 | -143 143 | a and [] and False and [] # SIM223 -144 144 | -145 |-if (a and [] and False and []) == (a and []): # SIM223 - 145 |+if (a and []) == (a and []): # SIM223 -146 146 | pass -147 147 | -148 148 | if f(a and [] and False and []): # SIM223 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:148:12: SIM223 [*] Use `[]` instead of `[] and ...` | @@ -1044,16 +567,6 @@ SIM223.py:148:12: SIM223 [*] Use `[]` instead of `[] and ...` | = help: Replace with `[]` -145 145 | if (a and [] and False and []) == (a and []): # SIM223 -146 146 | pass -147 147 | -148 |-if f(a and [] and False and []): # SIM223 - 148 |+if f(a and []): # SIM223 -149 149 | pass -150 150 | -151 151 | # Regression test for: https://github.com/astral-sh/ruff/issues/9479 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM223.py:154:7: SIM223 [*] Use `f"{''}{''}"` instead of `f"{''}{''}" and ...` | @@ -1064,12 +577,3 @@ SIM223.py:154:7: SIM223 [*] Use `f"{''}{''}"` instead of `f"{''}{''}" and ...` 155 | print(f"{1}{''}" and "bar") | = help: Replace with `f"{''}{''}"` - -151 151 | # Regression test for: https://github.com/astral-sh/ruff/issues/9479 -152 152 | print(f"{a}{b}" and "bar") -153 153 | print(f"{a}{''}" and "bar") -154 |-print(f"{''}{''}" and "bar") - 154 |+print(f"{''}{''}") -155 155 | print(f"{1}{''}" and "bar") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM401_SIM401.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM401_SIM401.py.snap index 9801c252dfbe9..3d7493723a974 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM401_SIM401.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM401_SIM401.py.snap @@ -14,19 +14,6 @@ SIM401.py:6:1: SIM401 [*] Use `var = a_dict.get(key, "default1")` instead of an | = help: Replace with `var = a_dict.get(key, "default1")` -3 3 | ### -4 4 | -5 5 | # SIM401 (pattern-1) -6 |-if key in a_dict: -7 |- var = a_dict[key] -8 |-else: -9 |- var = "default1" - 6 |+var = a_dict.get(key, "default1") -10 7 | -11 8 | # SIM401 (pattern-2) -12 9 | if key not in a_dict: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM401.py:12:1: SIM401 [*] Use `var = a_dict.get(key, "default2")` instead of an `if` block | @@ -41,19 +28,6 @@ SIM401.py:12:1: SIM401 [*] Use `var = a_dict.get(key, "default2")` instead of an | = help: Replace with `var = a_dict.get(key, "default2")` -9 9 | var = "default1" -10 10 | -11 11 | # SIM401 (pattern-2) -12 |-if key not in a_dict: -13 |- var = "default2" -14 |-else: -15 |- var = a_dict[key] - 12 |+var = a_dict.get(key, "default2") -16 13 | -17 14 | # OK (default contains effect) -18 15 | if key in a_dict: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM401.py:24:1: SIM401 [*] Use `var = a_dict.get(keys[idx], "default")` instead of an `if` block | @@ -68,19 +42,6 @@ SIM401.py:24:1: SIM401 [*] Use `var = a_dict.get(keys[idx], "default")` instead | = help: Replace with `var = a_dict.get(keys[idx], "default")` -21 21 | var = val1 + val2 -22 22 | -23 23 | # SIM401 (complex expression in key) -24 |-if keys[idx] in a_dict: -25 |- var = a_dict[keys[idx]] -26 |-else: -27 |- var = "default" - 24 |+var = a_dict.get(keys[idx], "default") -28 25 | -29 26 | # SIM401 (complex expression in dict) -30 27 | if key in dicts[idx]: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM401.py:30:1: SIM401 [*] Use `var = dicts[idx].get(key, "default")` instead of an `if` block | @@ -95,19 +56,6 @@ SIM401.py:30:1: SIM401 [*] Use `var = dicts[idx].get(key, "default")` instead of | = help: Replace with `var = dicts[idx].get(key, "default")` -27 27 | var = "default" -28 28 | -29 29 | # SIM401 (complex expression in dict) -30 |-if key in dicts[idx]: -31 |- var = dicts[idx][key] -32 |-else: -33 |- var = "default" - 30 |+var = dicts[idx].get(key, "default") -34 31 | -35 32 | # SIM401 (complex expression in var) -36 33 | if key in a_dict: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM401.py:36:1: SIM401 [*] Use `vars[idx] = a_dict.get(key, "defaultß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789")` instead of an `if` block | @@ -122,19 +70,6 @@ SIM401.py:36:1: SIM401 [*] Use `vars[idx] = a_dict.get(key, "defaultß9💣2ℝ6 | = help: Replace with `vars[idx] = a_dict.get(key, "defaultß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789")` -33 33 | var = "default" -34 34 | -35 35 | # SIM401 (complex expression in var) -36 |-if key in a_dict: -37 |- vars[idx] = a_dict[key] -38 |-else: -39 |- vars[idx] = "defaultß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789" - 36 |+vars[idx] = a_dict.get(key, "defaultß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789") -40 37 | -41 38 | # SIM401 -42 39 | if foo(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM401.py:45:5: SIM401 [*] Use `vars[idx] = a_dict.get(key, "default")` instead of an `if` block | @@ -151,19 +86,6 @@ SIM401.py:45:5: SIM401 [*] Use `vars[idx] = a_dict.get(key, "default")` instead | = help: Replace with `vars[idx] = a_dict.get(key, "default")` -42 42 | if foo(): -43 43 | pass -44 44 | else: -45 |- if key in a_dict: -46 |- vars[idx] = a_dict[key] -47 |- else: -48 |- vars[idx] = "default" - 45 |+ vars[idx] = a_dict.get(key, "default") -49 46 | -50 47 | ### -51 48 | # Negative cases - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM401.py:123:7: SIM401 [*] Use `a_dict.get(key, "default3")` instead of an `if` block | @@ -175,16 +97,6 @@ SIM401.py:123:7: SIM401 [*] Use `a_dict.get(key, "default3")` instead of an `if` | = help: Replace with `a_dict.get(key, "default3")` -120 120 | ### -121 121 | -122 122 | # SIM401 -123 |-var = a_dict[key] if key in a_dict else "default3" - 123 |+var = a_dict.get(key, "default3") -124 124 | -125 125 | # SIM401 -126 126 | var = "default-1" if key not in a_dict else a_dict[key] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. SIM401.py:126:7: SIM401 [*] Use `a_dict.get(key, "default-1")` instead of an `if` block | @@ -195,14 +107,3 @@ SIM401.py:126:7: SIM401 [*] Use `a_dict.get(key, "default-1")` instead of an `if 128 | # OK (default contains effect) | = help: Replace with `a_dict.get(key, "default-1")` - -123 123 | var = a_dict[key] if key in a_dict else "default3" -124 124 | -125 125 | # SIM401 -126 |-var = "default-1" if key not in a_dict else a_dict[key] - 126 |+var = a_dict.get(key, "default-1") -127 127 | -128 128 | # OK (default contains effect) -129 129 | var = a_dict[key] if key in a_dict else val1 + val2 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap index 364b154d4426f..ff208a61b545a 100644 --- a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap +++ b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap @@ -22,16 +22,6 @@ application.py:6:1: TID252 [*] Prefer absolute imports over relative imports fro | = help: Replace relative imports from parent modules with absolute imports -3 3 | import attrs -4 4 | -5 5 | from ....import unknown -6 |-from ..protocol import commands, definitions, responses - 6 |+from my_package.sublib.protocol import commands, definitions, responses -7 7 | from ..server import example -8 8 | from .. import server -9 9 | from . import logger, models - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. application.py:6:1: TID252 [*] Prefer absolute imports over relative imports from parent modules | @@ -43,16 +33,6 @@ application.py:6:1: TID252 [*] Prefer absolute imports over relative imports fro | = help: Replace relative imports from parent modules with absolute imports -3 3 | import attrs -4 4 | -5 5 | from ....import unknown -6 |-from ..protocol import commands, definitions, responses - 6 |+from my_package.sublib.protocol import commands, definitions, responses -7 7 | from ..server import example -8 8 | from .. import server -9 9 | from . import logger, models - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. application.py:6:1: TID252 [*] Prefer absolute imports over relative imports from parent modules | @@ -64,16 +44,6 @@ application.py:6:1: TID252 [*] Prefer absolute imports over relative imports fro | = help: Replace relative imports from parent modules with absolute imports -3 3 | import attrs -4 4 | -5 5 | from ....import unknown -6 |-from ..protocol import commands, definitions, responses - 6 |+from my_package.sublib.protocol import commands, definitions, responses -7 7 | from ..server import example -8 8 | from .. import server -9 9 | from . import logger, models - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. application.py:7:1: TID252 [*] Prefer absolute imports over relative imports from parent modules | @@ -86,16 +56,6 @@ application.py:7:1: TID252 [*] Prefer absolute imports over relative imports fro | = help: Replace relative imports from parent modules with absolute imports -4 4 | -5 5 | from ....import unknown -6 6 | from ..protocol import commands, definitions, responses -7 |-from ..server import example - 7 |+from my_package.sublib.server import example -8 8 | from .. import server -9 9 | from . import logger, models -10 10 | from ..protocol.UpperCaseModule import some_function - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. application.py:8:1: TID252 [*] Prefer absolute imports over relative imports from parent modules | @@ -108,15 +68,6 @@ application.py:8:1: TID252 [*] Prefer absolute imports over relative imports fro | = help: Replace relative imports from parent modules with absolute imports -5 5 | from ....import unknown -6 6 | from ..protocol import commands, definitions, responses -7 7 | from ..server import example -8 |-from .. import server - 8 |+from my_package.sublib import server -9 9 | from . import logger, models -10 10 | from ..protocol.UpperCaseModule import some_function - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. application.py:10:1: TID252 [*] Prefer absolute imports over relative imports from parent modules | @@ -126,11 +77,3 @@ application.py:10:1: TID252 [*] Prefer absolute imports over relative imports fr | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TID252 | = help: Replace relative imports from parent modules with absolute imports - -7 7 | from ..server import example -8 8 | from .. import server -9 9 | from . import logger, models -10 |-from ..protocol.UpperCaseModule import some_function - 10 |+from my_package.sublib.protocol.UpperCaseModule import some_function - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 7637fb39e62d2..677777ba5436d 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 @@ -10,20 +10,3 @@ exempt_modules.py:14:12: TCH002 [*] Move third-party import `flask` into a type- 16 | x: flask | = help: Move into type-checking block - - 1 |+from typing import TYPE_CHECKING - 2 |+ - 3 |+if TYPE_CHECKING: - 4 |+ import flask -1 5 | def f(): -2 6 | import pandas as pd -3 7 | --------------------------------------------------------------------------------- -11 15 | -12 16 | -13 17 | def f(): -14 |- import flask -15 18 | -16 19 | x: flask - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 cc3acc7a528cf..283c26351d631 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 @@ -10,21 +10,3 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 7 | ) | = help: Move into type-checking block - -2 2 | from __future__ import annotations -3 3 | -4 4 | from pandas import ( -5 |- DataFrame, # DataFrame -6 5 | Series, # Series -7 6 | ) - 7 |+from typing import TYPE_CHECKING - 8 |+ - 9 |+if TYPE_CHECKING: - 10 |+ from pandas import ( - 11 |+ DataFrame, # DataFrame - 12 |+ ) -8 13 | -9 14 | def f(x: DataFrame): -10 15 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 51e20fd659dd6..225208ecab4e0 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 @@ -10,20 +10,3 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 9 | ) | = help: Move into type-checking block - -4 4 | from typing import TYPE_CHECKING -5 5 | -6 6 | from pandas import ( -7 |- DataFrame, # DataFrame -8 7 | Series, # Series -9 8 | ) -10 9 | -11 10 | if TYPE_CHECKING: - 11 |+ from pandas import ( - 12 |+ DataFrame, # DataFrame - 13 |+ ) -12 14 | import os -13 15 | -14 16 | def f(x: DataFrame): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 0c410be21da8d..cbc409840fcb6 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 @@ -11,24 +11,6 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs | = help: Move into type-checking block -3 3 | -4 4 | from typing import TYPE_CHECKING -5 5 | -6 |-from pandas import ( -7 |- DataFrame, # DataFrame -8 |- Series, # Series -9 |-) -10 6 | - 7 |+if TYPE_CHECKING: - 8 |+ from pandas import ( - 9 |+ DataFrame, # DataFrame - 10 |+ Series, # Series - 11 |+ ) - 12 |+ -11 13 | def f(x: DataFrame, y: Series): -12 14 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. :8:5: TCH002 [*] Move third-party import `pandas.Series` into a type-checking block | @@ -39,22 +21,3 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 9 | ) | = help: Move into type-checking block - -3 3 | -4 4 | from typing import TYPE_CHECKING -5 5 | -6 |-from pandas import ( -7 |- DataFrame, # DataFrame -8 |- Series, # Series -9 |-) -10 6 | - 7 |+if TYPE_CHECKING: - 8 |+ from pandas import ( - 9 |+ DataFrame, # DataFrame - 10 |+ Series, # Series - 11 |+ ) - 12 |+ -11 13 | def f(x: DataFrame, y: Series): -12 14 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 26ce103b8d3ca..64a7244c84aff 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 @@ -12,19 +12,6 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs | = help: Move into type-checking block -3 3 | -4 4 | from typing import TYPE_CHECKING -5 5 | -6 |-import os, pandas - 6 |+import pandas - 7 |+ - 8 |+if TYPE_CHECKING: - 9 |+ import os -7 10 | -8 11 | def f(x: os, y: pandas): -9 12 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. :6:12: TCH002 [*] Move third-party import `pandas` into a type-checking block | @@ -36,17 +23,3 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 8 | def f(x: os, y: pandas): | = help: Move into type-checking block - -3 3 | -4 4 | from typing import TYPE_CHECKING -5 5 | -6 |-import os, pandas - 6 |+import os - 7 |+ - 8 |+if TYPE_CHECKING: - 9 |+ import pandas -7 10 | -8 11 | def f(x: os, y: pandas): -9 12 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 0491c19d42ac3..65744f4157e2b 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 @@ -12,18 +12,6 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs | = help: Move into type-checking block -3 3 | -4 4 | from typing import TYPE_CHECKING -5 5 | -6 |-import os, sys -7 6 | - 7 |+if TYPE_CHECKING: - 8 |+ import os, sys - 9 |+ -8 10 | def f(x: os, y: sys): -9 11 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. :6:12: TCH003 [*] Move standard library import `sys` into a type-checking block | @@ -35,16 +23,3 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 8 | def f(x: os, y: sys): | = help: Move into type-checking block - -3 3 | -4 4 | from typing import TYPE_CHECKING -5 5 | -6 |-import os, sys -7 6 | - 7 |+if TYPE_CHECKING: - 8 |+ import os, sys - 9 |+ -8 10 | def f(x: os, y: sys): -9 11 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 a56f0f6746757..5c8b66e2457d5 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 @@ -11,17 +11,3 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 6 | def f(x: pd.DataFrame): | = help: Move into type-checking block - -1 1 | -2 2 | from __future__ import annotations -3 3 | -4 |-import pandas as pd - 4 |+from typing import TYPE_CHECKING - 5 |+ - 6 |+if TYPE_CHECKING: - 7 |+ import pandas as pd -5 8 | -6 9 | def f(x: pd.DataFrame): -7 10 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 c6be2dc4ab86f..ea08d5bd9548d 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 @@ -10,14 +10,3 @@ quote.py:64:28: TCH004 [*] Quote references to `pandas.DataFrame`. Import is in 66 | def func(value: DataFrame): | = help: Quote references - -63 63 | if TYPE_CHECKING: -64 64 | from pandas import DataFrame -65 65 | -66 |- def func(value: DataFrame): - 66 |+ def func(value: "DataFrame"): -67 67 | ... -68 68 | -69 69 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 9991fbf4ccb82..55c685aa034f9 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 @@ -11,20 +11,6 @@ quote.py:2:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type | = help: Move into type-checking block -1 |-def f(): - 1 |+from typing import TYPE_CHECKING - 2 |+ - 3 |+if TYPE_CHECKING: -2 4 | from pandas import DataFrame - 5 |+def f(): -3 6 | -4 |- def baz() -> DataFrame: - 7 |+ def baz() -> "DataFrame": -5 8 | ... -6 9 | -7 10 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. quote.py:9:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | @@ -36,26 +22,6 @@ quote.py:9:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type | = help: Move into type-checking block - 1 |+from typing import TYPE_CHECKING - 2 |+ - 3 |+if TYPE_CHECKING: - 4 |+ from pandas import DataFrame -1 5 | def f(): -2 6 | from pandas import DataFrame -3 7 | --------------------------------------------------------------------------------- -6 10 | -7 11 | -8 12 | def f(): -9 |- from pandas import DataFrame -10 13 | -11 |- def baz() -> DataFrame[int]: - 14 |+ def baz() -> "DataFrame[int]": -12 15 | ... -13 16 | -14 17 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. quote.py:16:24: TCH002 Move third-party import `pandas.DataFrame` into a type-checking block | @@ -77,26 +43,6 @@ quote.py:23:22: TCH002 [*] Move third-party import `pandas` into a type-checking | = help: Move into type-checking block - 1 |+from typing import TYPE_CHECKING - 2 |+ - 3 |+if TYPE_CHECKING: - 4 |+ import pandas as pd -1 5 | def f(): -2 6 | from pandas import DataFrame -3 7 | --------------------------------------------------------------------------------- -20 24 | -21 25 | -22 26 | def f(): -23 |- import pandas as pd -24 27 | -25 |- def baz() -> pd.DataFrame: - 28 |+ def baz() -> "pd.DataFrame": -26 29 | ... -27 30 | -28 31 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. quote.py:30:22: TCH002 [*] Move third-party import `pandas` into a type-checking block | @@ -108,26 +54,6 @@ quote.py:30:22: TCH002 [*] Move third-party import `pandas` into a type-checking | = help: Move into type-checking block - 1 |+from typing import TYPE_CHECKING - 2 |+ - 3 |+if TYPE_CHECKING: - 4 |+ import pandas as pd -1 5 | def f(): -2 6 | from pandas import DataFrame -3 7 | --------------------------------------------------------------------------------- -27 31 | -28 32 | -29 33 | def f(): -30 |- import pandas as pd -31 34 | -32 |- def baz() -> pd.DataFrame.Extra: - 35 |+ def baz() -> "pd.DataFrame.Extra": -33 36 | ... -34 37 | -35 38 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. quote.py:37:22: TCH002 [*] Move third-party import `pandas` into a type-checking block | @@ -139,26 +65,6 @@ quote.py:37:22: TCH002 [*] Move third-party import `pandas` into a type-checking | = help: Move into type-checking block - 1 |+from typing import TYPE_CHECKING - 2 |+ - 3 |+if TYPE_CHECKING: - 4 |+ import pandas as pd -1 5 | def f(): -2 6 | from pandas import DataFrame -3 7 | --------------------------------------------------------------------------------- -34 38 | -35 39 | -36 40 | def f(): -37 |- import pandas as pd -38 41 | -39 |- def baz() -> pd.DataFrame | int: - 42 |+ def baz() -> "pd.DataFrame | int": -40 43 | ... -41 44 | -42 45 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. quote.py:45:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | @@ -170,26 +76,6 @@ quote.py:45:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a typ | = help: Move into type-checking block - 1 |+from typing import TYPE_CHECKING - 2 |+ - 3 |+if TYPE_CHECKING: - 4 |+ from pandas import DataFrame -1 5 | def f(): -2 6 | from pandas import DataFrame -3 7 | --------------------------------------------------------------------------------- -42 46 | -43 47 | -44 48 | def f(): -45 |- from pandas import DataFrame -46 49 | -47 |- def baz() -> DataFrame(): - 50 |+ def baz() -> "DataFrame()": -48 51 | ... -49 52 | -50 53 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. quote.py:54:24: TCH002 Move third-party import `pandas.DataFrame` into a type-checking block | @@ -212,26 +98,6 @@ quote.py:71:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a typ | = help: Move into type-checking block - 1 |+from typing import TYPE_CHECKING - 2 |+ - 3 |+if TYPE_CHECKING: - 4 |+ from pandas import DataFrame, Series -1 5 | def f(): -2 6 | from pandas import DataFrame -3 7 | --------------------------------------------------------------------------------- -68 72 | -69 73 | -70 74 | def f(): -71 |- from pandas import DataFrame, Series -72 75 | -73 |- def baz() -> DataFrame | Series: - 76 |+ def baz() -> "DataFrame | Series": -74 77 | ... -75 78 | -76 79 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. quote.py:71:35: TCH002 [*] Move third-party import `pandas.Series` into a type-checking block | @@ -243,26 +109,6 @@ quote.py:71:35: TCH002 [*] Move third-party import `pandas.Series` into a type-c | = help: Move into type-checking block - 1 |+from typing import TYPE_CHECKING - 2 |+ - 3 |+if TYPE_CHECKING: - 4 |+ from pandas import DataFrame, Series -1 5 | def f(): -2 6 | from pandas import DataFrame -3 7 | --------------------------------------------------------------------------------- -68 72 | -69 73 | -70 74 | def f(): -71 |- from pandas import DataFrame, Series -72 75 | -73 |- def baz() -> DataFrame | Series: - 76 |+ def baz() -> "DataFrame | Series": -74 77 | ... -75 78 | -76 79 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. quote.py:78:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | @@ -274,39 +120,6 @@ quote.py:78:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a typ | = help: Move into type-checking block - 1 |+from typing import TYPE_CHECKING - 2 |+ - 3 |+if TYPE_CHECKING: - 4 |+ from pandas import DataFrame, Series -1 5 | def f(): -2 6 | from pandas import DataFrame -3 7 | --------------------------------------------------------------------------------- -75 79 | -76 80 | -77 81 | def f(): -78 |- from pandas import DataFrame, Series -79 82 | -80 83 | def baz() -> ( -81 |- DataFrame | -82 |- Series - 84 |+ "DataFrame | Series" -83 85 | ): -84 86 | ... -85 87 | -86 88 | class C: -87 |- x: DataFrame[ -88 |- int -89 |- ] = 1 - 89 |+ x: "DataFrame[int]" = 1 -90 90 | -91 |- def func() -> DataFrame[[DataFrame[_P, _R]], DataFrame[_P, _R]]: - 91 |+ def func() -> "DataFrame[[DataFrame[_P, _R]], DataFrame[_P, _R]]": -92 92 | ... -93 93 | -94 94 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. quote.py:78:35: TCH002 [*] Move third-party import `pandas.Series` into a type-checking block | @@ -318,39 +131,6 @@ quote.py:78:35: TCH002 [*] Move third-party import `pandas.Series` into a type-c | = help: Move into type-checking block - 1 |+from typing import TYPE_CHECKING - 2 |+ - 3 |+if TYPE_CHECKING: - 4 |+ from pandas import DataFrame, Series -1 5 | def f(): -2 6 | from pandas import DataFrame -3 7 | --------------------------------------------------------------------------------- -75 79 | -76 80 | -77 81 | def f(): -78 |- from pandas import DataFrame, Series -79 82 | -80 83 | def baz() -> ( -81 |- DataFrame | -82 |- Series - 84 |+ "DataFrame | Series" -83 85 | ): -84 86 | ... -85 87 | -86 88 | class C: -87 |- x: DataFrame[ -88 |- int -89 |- ] = 1 - 89 |+ x: "DataFrame[int]" = 1 -90 90 | -91 |- def func() -> DataFrame[[DataFrame[_P, _R]], DataFrame[_P, _R]]: - 91 |+ def func() -> "DataFrame[[DataFrame[_P, _R]], DataFrame[_P, _R]]": -92 92 | ... -93 93 | -94 94 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. quote.py:96:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | @@ -362,24 +142,6 @@ quote.py:96:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a typ | = help: Move into type-checking block - 1 |+from typing import TYPE_CHECKING - 2 |+ - 3 |+if TYPE_CHECKING: - 4 |+ from pandas import DataFrame, Series -1 5 | def f(): -2 6 | from pandas import DataFrame -3 7 | --------------------------------------------------------------------------------- -93 97 | -94 98 | -95 99 | def f(): -96 |- from pandas import DataFrame, Series -97 100 | -98 |- def func(self) -> DataFrame | list[Series]: - 101 |+ def func(self) -> "DataFrame | list[Series]": -99 102 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. quote.py:96:35: TCH002 [*] Move third-party import `pandas.Series` into a type-checking block | @@ -390,22 +152,3 @@ quote.py:96:35: TCH002 [*] Move third-party import `pandas.Series` into a type-c 98 | def func(self) -> DataFrame | list[Series]: | = help: Move into type-checking block - - 1 |+from typing import TYPE_CHECKING - 2 |+ - 3 |+if TYPE_CHECKING: - 4 |+ from pandas import DataFrame, Series -1 5 | def f(): -2 6 | from pandas import DataFrame -3 7 | --------------------------------------------------------------------------------- -93 97 | -94 98 | -95 99 | def f(): -96 |- from pandas import DataFrame, Series -97 100 | -98 |- def func(self) -> DataFrame | list[Series]: - 101 |+ def func(self) -> "DataFrame | list[Series]": -99 102 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH004_1.py.snap index 3306d9bb0b9c6..22bc63a314f95 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_TCH004_1.py.snap @@ -9,13 +9,3 @@ TCH004_1.py:4:26: TCH004 [*] Move import `datetime.datetime` out of type-checkin 5 | x = datetime | = help: Move out of type-checking block - -1 1 | from typing import TYPE_CHECKING - 2 |+from datetime import datetime -2 3 | -3 4 | if TYPE_CHECKING: -4 |- from datetime import datetime - 5 |+ pass -5 6 | x = datetime - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH004_11.py.snap index 203b1f4e9bd8e..ba2fb649acad5 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_TCH004_11.py.snap @@ -10,14 +10,3 @@ TCH004_11.py:4:24: TCH004 [*] Move import `typing.List` out of type-checking blo 6 | __all__ = ("List",) | = help: Move out of type-checking block - -1 1 | from typing import TYPE_CHECKING - 2 |+from typing import List -2 3 | -3 4 | if TYPE_CHECKING: -4 |- from typing import List - 5 |+ pass -5 6 | -6 7 | __all__ = ("List",) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH004_12.py.snap index 28c3c0faba9a2..a649579e5c602 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_TCH004_12.py.snap @@ -10,16 +10,3 @@ TCH004_12.py:6:33: TCH004 [*] Move import `collections.abc.Callable` out of type 8 | AnyCallable: TypeAlias = Callable[..., Any] | = help: Move out of type-checking block - -1 1 | from __future__ import annotations -2 2 | -3 3 | from typing import Any, TYPE_CHECKING, TypeAlias - 4 |+from collections.abc import Callable -4 5 | -5 6 | if TYPE_CHECKING: -6 |- from collections.abc import Callable - 7 |+ pass -7 8 | -8 9 | AnyCallable: TypeAlias = Callable[..., Any] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH004_17.py.snap index 1ee45ec37da4d..0b416a9abe182 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_TCH004_17.py.snap @@ -8,17 +8,3 @@ TCH004_17.py:6:24: TCH004 [*] Move import `pandas.DataFrame` out of type-checkin | ^^^^^^^^^ TCH004 | = help: Move out of type-checking block - -1 1 | from __future__ import annotations -2 2 | -3 3 | from typing_extensions import TYPE_CHECKING - 4 |+from pandas import DataFrame -4 5 | -5 6 | if TYPE_CHECKING: -6 |- from pandas import DataFrame - 7 |+ pass -7 8 | -8 9 | -9 10 | def example() -> DataFrame: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH004_2.py.snap index 986b3301fc38c..6f38ed9a85068 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_TCH004_2.py.snap @@ -8,15 +8,3 @@ TCH004_2.py:4:26: TCH004 [*] Move import `datetime.date` out of type-checking bl | ^^^^ TCH004 | = help: Move out of type-checking block - -1 1 | from typing import TYPE_CHECKING - 2 |+from datetime import date -2 3 | -3 4 | if TYPE_CHECKING: -4 |- from datetime import date - 5 |+ pass -5 6 | -6 7 | -7 8 | def example(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH004_4.py.snap index 54ffcf2cb00ed..fd1e2a77a7780 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_TCH004_4.py.snap @@ -8,15 +8,3 @@ TCH004_4.py:4:24: TCH004 [*] Move import `typing.Any` out of type-checking block | ^^^ TCH004 | = help: Move out of type-checking block - -1 1 | from typing import TYPE_CHECKING, Type - 2 |+from typing import Any -2 3 | -3 4 | if TYPE_CHECKING: -4 |- from typing import Any - 5 |+ pass -5 6 | -6 7 | -7 8 | def example(*args: Any, **kwargs: Any): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH004_5.py.snap index 39fe175f95366..c166caaed42e1 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_TCH004_5.py.snap @@ -9,17 +9,6 @@ TCH004_5.py:4:24: TCH004 [*] Move import `typing.List` out of type-checking bloc | = help: Move out of type-checking block -1 1 | from typing import TYPE_CHECKING - 2 |+from typing import List, Sequence, Set -2 3 | -3 4 | if TYPE_CHECKING: -4 |- from typing import List, Sequence, Set - 5 |+ pass -5 6 | -6 7 | -7 8 | def example(a: List[int], /, b: Sequence[int], *, c: Set[int]): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TCH004_5.py:4:30: TCH004 [*] Move import `typing.Sequence` out of type-checking block. Import is used for more than type hinting. | @@ -29,17 +18,6 @@ TCH004_5.py:4:30: TCH004 [*] Move import `typing.Sequence` out of type-checking | = help: Move out of type-checking block -1 1 | from typing import TYPE_CHECKING - 2 |+from typing import List, Sequence, Set -2 3 | -3 4 | if TYPE_CHECKING: -4 |- from typing import List, Sequence, Set - 5 |+ pass -5 6 | -6 7 | -7 8 | def example(a: List[int], /, b: Sequence[int], *, c: Set[int]): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TCH004_5.py:4:40: TCH004 [*] Move import `typing.Set` out of type-checking block. Import is used for more than type hinting. | @@ -48,15 +26,3 @@ TCH004_5.py:4:40: TCH004 [*] Move import `typing.Set` out of type-checking block | ^^^ TCH004 | = help: Move out of type-checking block - -1 1 | from typing import TYPE_CHECKING - 2 |+from typing import List, Sequence, Set -2 3 | -3 4 | if TYPE_CHECKING: -4 |- from typing import List, Sequence, Set - 5 |+ pass -5 6 | -6 7 | -7 8 | def example(a: List[int], /, b: Sequence[int], *, c: Set[int]): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH004_9.py.snap index b729ee5076d68..d512a0a7d9062 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_TCH004_9.py.snap @@ -11,17 +11,6 @@ TCH004_9.py:4:24: TCH004 [*] Move import `typing.Tuple` out of type-checking blo | = help: Move out of type-checking block -1 1 | from typing import TYPE_CHECKING - 2 |+from typing import Tuple, List -2 3 | -3 4 | if TYPE_CHECKING: -4 |- from typing import Tuple, List, Dict - 5 |+ from typing import Dict -5 6 | -6 7 | x: Tuple -7 8 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TCH004_9.py:4:31: TCH004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. | @@ -32,15 +21,3 @@ TCH004_9.py:4:31: TCH004 [*] Move import `typing.List` out of type-checking bloc 6 | x: Tuple | = help: Move out of type-checking block - -1 1 | from typing import TYPE_CHECKING - 2 |+from typing import Tuple, List -2 3 | -3 4 | if TYPE_CHECKING: -4 |- from typing import Tuple, List, Dict - 5 |+ from typing import Dict -5 6 | -6 7 | x: Tuple -7 8 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 3378960fafdf7..35f7f380284fd 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 @@ -10,19 +10,3 @@ quote.py:64:28: TCH004 [*] Move import `pandas.DataFrame` out of type-checking b 66 | def func(value: DataFrame): | = help: Move out of type-checking block - - 1 |+from pandas import DataFrame -1 2 | def f(): -2 3 | from pandas import DataFrame -3 4 | --------------------------------------------------------------------------------- -61 62 | from typing import TYPE_CHECKING -62 63 | -63 64 | if TYPE_CHECKING: -64 |- from pandas import DataFrame - 65 |+ pass -65 66 | -66 67 | def func(value: DataFrame): -67 68 | ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 d8379e524118e..af88bce1ba9b6 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 @@ -10,18 +10,6 @@ runtime_evaluated_base_classes_1.py:10:12: TCH004 [*] Move import `datetime` out | = help: Move out of type-checking block -5 5 | -6 6 | import pydantic -7 7 | from pydantic import BaseModel - 8 |+import datetime -8 9 | -9 10 | if TYPE_CHECKING: -10 |- import datetime # TCH004 -11 11 | from array import array # TCH004 -12 12 | -13 13 | import pandas # TCH004 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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. | @@ -34,19 +22,6 @@ runtime_evaluated_base_classes_1.py:11:23: TCH004 [*] Move import `array.array` | = help: Move out of type-checking block -5 5 | -6 6 | import pydantic -7 7 | from pydantic import BaseModel - 8 |+from array import array -8 9 | -9 10 | if TYPE_CHECKING: -10 11 | import datetime # TCH004 -11 |- from array import array # TCH004 -12 12 | -13 13 | import pandas # TCH004 -14 14 | import pyproj - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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. | @@ -57,19 +32,3 @@ runtime_evaluated_base_classes_1.py:13:12: TCH004 [*] Move import `pandas` out o 14 | import pyproj | = help: Move out of type-checking block - -5 5 | -6 6 | import pydantic -7 7 | from pydantic import BaseModel - 8 |+import pandas -8 9 | -9 10 | if TYPE_CHECKING: -10 11 | import datetime # TCH004 -11 12 | from array import array # TCH004 -12 13 | -13 |- import pandas # TCH004 -14 14 | import pyproj -15 15 | -16 16 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 5cc242a38b90c..e7f33bf116cdf 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 @@ -10,18 +10,6 @@ runtime_evaluated_decorators_1.py:12:12: TCH004 [*] Move import `datetime` out o | = help: Move out of type-checking block -7 7 | from attrs import frozen -8 8 | -9 9 | import numpy - 10 |+import datetime -10 11 | -11 12 | if TYPE_CHECKING: -12 |- import datetime # TCH004 -13 13 | from array import array # TCH004 -14 14 | -15 15 | import pandas # TCH004 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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. | @@ -34,19 +22,6 @@ runtime_evaluated_decorators_1.py:13:23: TCH004 [*] Move import `array.array` ou | = help: Move out of type-checking block -7 7 | from attrs import frozen -8 8 | -9 9 | import numpy - 10 |+from array import array -10 11 | -11 12 | if TYPE_CHECKING: -12 13 | import datetime # TCH004 -13 |- from array import array # TCH004 -14 14 | -15 15 | import pandas # TCH004 -16 16 | import pyproj - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. runtime_evaluated_decorators_1.py:15:12: TCH004 [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting. | @@ -57,19 +32,3 @@ runtime_evaluated_decorators_1.py:15:12: TCH004 [*] Move import `pandas` out of 16 | import pyproj | = help: Move out of type-checking block - -7 7 | from attrs import frozen -8 8 | -9 9 | import numpy - 10 |+import pandas -10 11 | -11 12 | if TYPE_CHECKING: -12 13 | import datetime # TCH004 -13 14 | from array import array # TCH004 -14 15 | -15 |- import pandas # TCH004 -16 16 | import pyproj -17 17 | -18 18 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 b41848d9b5855..51398a2193da5 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 @@ -11,21 +11,6 @@ init_var.py:5:25: TCH003 [*] Move standard library import `dataclasses.FrozenIns | = help: Move into type-checking block -2 2 | -3 3 | from __future__ import annotations -4 4 | -5 |-from dataclasses import FrozenInstanceError, InitVar, dataclass - 5 |+from dataclasses import InitVar, dataclass -6 6 | from pathlib import Path - 7 |+from typing import TYPE_CHECKING - 8 |+ - 9 |+if TYPE_CHECKING: - 10 |+ from dataclasses import FrozenInstanceError -7 11 | -8 12 | -9 13 | @dataclass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. init_var.py:6:21: TCH003 [*] Move standard library import `pathlib.Path` into a type-checking block | @@ -34,17 +19,3 @@ init_var.py:6:21: TCH003 [*] Move standard library import `pathlib.Path` into a | ^^^^ TCH003 | = help: Move into type-checking block - -3 3 | from __future__ import annotations -4 4 | -5 5 | from dataclasses import FrozenInstanceError, InitVar, dataclass -6 |-from pathlib import Path - 6 |+from typing import TYPE_CHECKING - 7 |+ - 8 |+if TYPE_CHECKING: - 9 |+ from pathlib import Path -7 10 | -8 11 | -9 12 | @dataclass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 eb778b75f1f36..f7db2da0fc04b 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 @@ -12,24 +12,6 @@ strict.py:27:21: TCH002 [*] Move third-party import `pkg.A` into a type-checking | = help: Move into type-checking block -1 1 | from __future__ import annotations - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ from pkg import A -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -24 28 | def f(): -25 29 | # In un-strict mode, this shouldn't raise an error, since `pkg` is used at runtime. -26 30 | import pkg -27 |- from pkg import A -28 31 | -29 32 | def test(value: A): -30 33 | return pkg.B() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. strict.py:35:21: TCH002 [*] Move third-party import `pkg.A` into a type-checking block | @@ -42,25 +24,6 @@ strict.py:35:21: TCH002 [*] Move third-party import `pkg.A` into a type-checking | = help: Move into type-checking block -1 1 | from __future__ import annotations - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ from pkg import A -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -32 36 | -33 37 | def f(): -34 38 | # In un-strict mode, this shouldn't raise an error, since `pkg` is used at runtime. -35 |- from pkg import A, B - 39 |+ from pkg import B -36 40 | -37 41 | def test(value: A): -38 42 | return B() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. strict.py:54:25: TCH002 [*] Move third-party import `pkg.bar.A` into a type-checking block | @@ -73,24 +36,6 @@ strict.py:54:25: TCH002 [*] Move third-party import `pkg.bar.A` into a type-chec | = help: Move into type-checking block -1 1 | from __future__ import annotations - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ from pkg.bar import A -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -51 55 | def f(): -52 56 | # In un-strict mode, this _should_ raise an error, since `pkg.bar` isn't used at runtime -53 57 | import pkg -54 |- from pkg.bar import A -55 58 | -56 59 | def test(value: A): -57 60 | return pkg.B() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. strict.py:62:12: TCH002 [*] Move third-party import `pkg` into a type-checking block | @@ -102,24 +47,6 @@ strict.py:62:12: TCH002 [*] Move third-party import `pkg` into a type-checking b | = help: Move into type-checking block -1 1 | from __future__ import annotations - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ import pkg -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -59 63 | -60 64 | def f(): -61 65 | # In un-strict mode, this shouldn't raise an error, since `pkg.bar` is used at runtime. -62 |- import pkg -63 66 | import pkg.bar as B -64 67 | -65 68 | def test(value: pkg.A): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. strict.py:71:23: TCH002 [*] Move third-party import `pkg.foo` into a type-checking block | @@ -131,24 +58,6 @@ strict.py:71:23: TCH002 [*] Move third-party import `pkg.foo` into a type-checki | = help: Move into type-checking block -1 1 | from __future__ import annotations - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ import pkg.foo as F -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -68 72 | -69 73 | def f(): -70 74 | # In un-strict mode, this shouldn't raise an error, since `pkg.foo.bar` is used at runtime. -71 |- import pkg.foo as F -72 75 | import pkg.foo.bar as B -73 76 | -74 77 | def test(value: F.Foo): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. strict.py:80:12: TCH002 [*] Move third-party import `pkg` into a type-checking block | @@ -160,24 +69,6 @@ strict.py:80:12: TCH002 [*] Move third-party import `pkg` into a type-checking b | = help: Move into type-checking block -1 1 | from __future__ import annotations - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ import pkg -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -77 81 | -78 82 | def f(): -79 83 | # In un-strict mode, this shouldn't raise an error, since `pkg.foo.bar` is used at runtime. -80 |- import pkg -81 84 | import pkg.foo.bar as B -82 85 | -83 86 | def test(value: pkg.A): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. strict.py:91:12: TCH002 [*] Move third-party import `pkg` into a type-checking block | @@ -189,24 +80,6 @@ strict.py:91:12: TCH002 [*] Move third-party import `pkg` into a type-checking b | = help: Move into type-checking block -1 1 | from __future__ import annotations - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ import pkg -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -88 92 | # In un-strict mode, this _should_ raise an error, since `pkg` isn't used at runtime. -89 93 | # Note that `pkg` is a prefix of `pkgfoo` which are both different modules. This is -90 94 | # testing the implementation. -91 |- import pkg -92 95 | import pkgfoo.bar as B -93 96 | -94 97 | def test(value: pkg.A): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. strict.py:101:23: TCH002 [*] Move third-party import `pkg.foo` into a type-checking block | @@ -218,22 +91,3 @@ strict.py:101:23: TCH002 [*] Move third-party import `pkg.foo` into a type-check 103 | def test(value: F.Foo): | = help: Move into type-checking block - -1 1 | from __future__ import annotations - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ import pkg.foo as F -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -98 102 | def f(): -99 103 | # In un-strict mode, this shouldn't raise an error, since `pkg` is used at runtime. -100 104 | import pkg.bar as B -101 |- import pkg.foo as F -102 105 | -103 106 | def test(value: F.Foo): -104 107 | return B.Bar() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 14b7392ab713a..f603068e9b4eb 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 @@ -11,17 +11,3 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 8 | def f(x: pd.DataFrame): | = help: Move into type-checking block - -3 3 | -4 4 | from typing import TYPE_CHECKING -5 5 | -6 |-import pandas as pd -7 6 | - 7 |+if TYPE_CHECKING: - 8 |+ import pandas as pd - 9 |+ -8 10 | def f(x: pd.DataFrame): -9 11 | pass -10 12 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 c73bf462b409a..2748312e25b1a 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 @@ -11,17 +11,3 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 8 | if TYPE_CHECKING: | = help: Move into type-checking block - -3 3 | -4 4 | from typing import TYPE_CHECKING -5 5 | -6 |-import pandas as pd -7 6 | -8 7 | if TYPE_CHECKING: -9 8 | # This is a comment. - 9 |+ import pandas as pd -10 10 | import os -11 11 | -12 12 | def f(x: pd.DataFrame): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 da0610f967ec9..7a59ef7ca8cea 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 @@ -11,16 +11,3 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 8 | if TYPE_CHECKING: import os | = help: Move into type-checking block - -3 3 | -4 4 | from typing import TYPE_CHECKING -5 5 | -6 |-import pandas as pd -7 6 | -8 |-if TYPE_CHECKING: import os - 7 |+if TYPE_CHECKING: import pandas as pd; import os -9 8 | -10 9 | def f(x: pd.DataFrame): -11 10 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 6fb8d77ea6636..2748312e25b1a 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 @@ -11,16 +11,3 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 8 | if TYPE_CHECKING: | = help: Move into type-checking block - -3 3 | -4 4 | from typing import TYPE_CHECKING -5 5 | -6 |-import pandas as pd -7 6 | -8 7 | if TYPE_CHECKING: - 8 |+ import pandas as pd -9 9 | import os -10 10 | -11 11 | def f(x: pd.DataFrame): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH001.py.snap index f07206df23084..96cb9ef4c23d8 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_TCH001.py.snap @@ -10,24 +10,3 @@ TCH001.py:20:19: TCH001 [*] Move application import `.TYP001` into a type-checki 22 | x: TYP001 | = help: Move into type-checking block - -2 2 | -3 3 | For typing-only import detection tests, see `TCH002.py`. -4 4 | """ - 5 |+from typing import TYPE_CHECKING - 6 |+ - 7 |+if TYPE_CHECKING: - 8 |+ from . import TYP001 -5 9 | -6 10 | -7 11 | def f(): --------------------------------------------------------------------------------- -17 21 | -18 22 | -19 23 | def f(): -20 |- from . import TYP001 -21 24 | -22 25 | x: TYP001 -23 26 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH003.py.snap index 5b85dbc29f3ee..347c44cfd0127 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_TCH003.py.snap @@ -10,20 +10,3 @@ TCH003.py:8:12: TCH003 [*] Move standard library import `os` into a type-checkin 10 | x: os | = help: Move into type-checking block - -2 2 | -3 3 | For typing-only import detection tests, see `TCH002.py`. -4 4 | """ - 5 |+from typing import TYPE_CHECKING - 6 |+ - 7 |+if TYPE_CHECKING: - 8 |+ import os -5 9 | -6 10 | -7 11 | def f(): -8 |- import os -9 12 | -10 13 | x: os -11 14 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 1481b717b1b27..c0118b247f9e7 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 @@ -11,16 +11,3 @@ exempt_type_checking_1.py:5:20: TCH003 [*] Move standard library import `typing. 7 | Const: Final[dict] = {} | = help: Move into type-checking block - -2 2 | -3 3 | from __future__ import annotations -4 4 | -5 |-from typing import Final - 5 |+from typing import TYPE_CHECKING - 6 |+ - 7 |+if TYPE_CHECKING: - 8 |+ from typing import Final -6 9 | -7 10 | Const: Final[dict] = {} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 d0f1b2061bc81..11ff8aa52afbe 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 @@ -11,16 +11,3 @@ exempt_type_checking_2.py:5:20: TCH003 [*] Move standard library import `typing. 7 | Const: Final[dict] = {} | = help: Move into type-checking block - -2 2 | -3 3 | from __future__ import annotations -4 4 | -5 |-from typing import Final, TYPE_CHECKING - 5 |+from typing import TYPE_CHECKING - 6 |+ - 7 |+if TYPE_CHECKING: - 8 |+ from typing import Final -6 9 | -7 10 | Const: Final[dict] = {} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 0129175b357eb..6ba25afff7a8b 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 @@ -11,17 +11,3 @@ exempt_type_checking_3.py:5:20: TCH003 [*] Move standard library import `typing. 7 | Const: Final[dict] = {} | = help: Move into type-checking block - -2 2 | -3 3 | from __future__ import annotations -4 4 | -5 |-from typing import Final, Mapping - 5 |+from typing import Mapping - 6 |+from typing import TYPE_CHECKING - 7 |+ - 8 |+if TYPE_CHECKING: - 9 |+ from typing import Final -6 10 | -7 11 | Const: Final[dict] = {} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 6c96f2d69bcb0..11096eb575c59 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 @@ -8,17 +8,3 @@ init_var.py:6:21: TCH003 [*] Move standard library import `pathlib.Path` into a | ^^^^ TCH003 | = help: Move into type-checking block - -3 3 | from __future__ import annotations -4 4 | -5 5 | from dataclasses import FrozenInstanceError, InitVar, dataclass -6 |-from pathlib import Path - 6 |+from typing import TYPE_CHECKING - 7 |+ - 8 |+if TYPE_CHECKING: - 9 |+ from pathlib import Path -7 10 | -8 11 | -9 12 | @dataclass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 f22002b9c1cda..d4998f2b269e7 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 @@ -9,16 +9,3 @@ undefined.py:3:29: TCH003 [*] Move standard library import `collections.abc.Sequ | ^^^^^^^^ TCH003 | = help: Move into type-checking block - -1 1 | from __future__ import annotations -2 2 | -3 |-from collections.abc import Sequence - 3 |+from typing import TYPE_CHECKING - 4 |+ - 5 |+if TYPE_CHECKING: - 6 |+ from collections.abc import Sequence -4 7 | -5 8 | -6 9 | class Foo(MyBaseClass): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 3069ae4336ccf..af5246c83c46a 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 @@ -11,20 +11,3 @@ runtime_evaluated_base_classes_3.py:5:18: TCH003 [*] Move standard library impor 7 | import pydantic | = help: Move into type-checking block - -2 2 | -3 3 | import datetime -4 4 | import pathlib -5 |-from uuid import UUID # TCH003 -6 5 | -7 6 | import pydantic -8 7 | from pydantic import BaseModel - 8 |+from typing import TYPE_CHECKING - 9 |+ - 10 |+if TYPE_CHECKING: - 11 |+ from uuid import UUID -9 12 | -10 13 | -11 14 | class A(pydantic.BaseModel): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 d12160e56050d..546a709a077b6 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 @@ -11,22 +11,3 @@ runtime_evaluated_decorators_3.py:6:18: TCH003 [*] Move standard library import 8 | from pydantic import validate_call | = help: Move into type-checking block - -3 3 | import datetime -4 4 | from array import array -5 5 | from dataclasses import dataclass -6 |-from uuid import UUID # TCH003 -7 6 | from collections.abc import Sequence -8 7 | from pydantic import validate_call -9 8 | -10 9 | import attrs -11 10 | from attrs import frozen - 11 |+from typing import TYPE_CHECKING - 12 |+ - 13 |+if TYPE_CHECKING: - 14 |+ from uuid import UUID -12 15 | -13 16 | -14 17 | @attrs.define(auto_attribs=True) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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_TCH002.py.snap index 05cf85f54ab5a..bf6a12fff5984 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_TCH002.py.snap @@ -11,20 +11,6 @@ TCH002.py:5:22: TCH002 [*] Move third-party import `pandas` into a type-checking | = help: Move into type-checking block -1 1 | """Tests to determine accurate detection of typing-only imports.""" - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ import pandas as pd -2 6 | -3 7 | -4 8 | def f(): -5 |- import pandas as pd # TCH002 -6 9 | -7 10 | x: pd.DataFrame -8 11 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TCH002.py:11:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | @@ -36,24 +22,6 @@ TCH002.py:11:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty | = help: Move into type-checking block -1 1 | """Tests to determine accurate detection of typing-only imports.""" - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ from pandas import DataFrame -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -8 12 | -9 13 | -10 14 | def f(): -11 |- from pandas import DataFrame # TCH002 -12 15 | -13 16 | x: DataFrame -14 17 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TCH002.py:17:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | @@ -65,24 +33,6 @@ TCH002.py:17:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty | = help: Move into type-checking block -1 1 | """Tests to determine accurate detection of typing-only imports.""" - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ from pandas import DataFrame as df -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -14 18 | -15 19 | -16 20 | def f(): -17 |- from pandas import DataFrame as df # TCH002 -18 21 | -19 22 | x: df -20 23 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TCH002.py:23:22: TCH002 [*] Move third-party import `pandas` into a type-checking block | @@ -94,24 +44,6 @@ TCH002.py:23:22: TCH002 [*] Move third-party import `pandas` into a type-checkin | = help: Move into type-checking block -1 1 | """Tests to determine accurate detection of typing-only imports.""" - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ import pandas as pd -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -20 24 | -21 25 | -22 26 | def f(): -23 |- import pandas as pd # TCH002 -24 27 | -25 28 | x: pd.DataFrame = 1 -26 29 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TCH002.py:29:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | @@ -123,24 +55,6 @@ TCH002.py:29:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty | = help: Move into type-checking block -1 1 | """Tests to determine accurate detection of typing-only imports.""" - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ from pandas import DataFrame -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -26 30 | -27 31 | -28 32 | def f(): -29 |- from pandas import DataFrame # TCH002 -30 33 | -31 34 | x: DataFrame = 2 -32 35 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TCH002.py:35:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | @@ -152,24 +66,6 @@ TCH002.py:35:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty | = help: Move into type-checking block -1 1 | """Tests to determine accurate detection of typing-only imports.""" - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ from pandas import DataFrame as df -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -32 36 | -33 37 | -34 38 | def f(): -35 |- from pandas import DataFrame as df # TCH002 -36 39 | -37 40 | x: df = 3 -38 41 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TCH002.py:41:22: TCH002 [*] Move third-party import `pandas` into a type-checking block | @@ -181,24 +77,6 @@ TCH002.py:41:22: TCH002 [*] Move third-party import `pandas` into a type-checkin | = help: Move into type-checking block -1 1 | """Tests to determine accurate detection of typing-only imports.""" - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ import pandas as pd -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -38 42 | -39 43 | -40 44 | def f(): -41 |- import pandas as pd # TCH002 -42 45 | -43 46 | x: "pd.DataFrame" = 1 -44 47 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TCH002.py:47:22: TCH002 [*] Move third-party import `pandas` into a type-checking block | @@ -210,24 +88,6 @@ TCH002.py:47:22: TCH002 [*] Move third-party import `pandas` into a type-checkin | = help: Move into type-checking block -1 1 | """Tests to determine accurate detection of typing-only imports.""" - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ import pandas as pd -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -44 48 | -45 49 | -46 50 | def f(): -47 |- import pandas as pd # TCH002 -48 51 | -49 52 | x = dict["pd.DataFrame", "pd.DataFrame"] -50 53 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TCH002.py:172:24: TCH002 [*] Move third-party import `module.Member` into a type-checking block | @@ -239,22 +99,3 @@ TCH002.py:172:24: TCH002 [*] Move third-party import `module.Member` into a type 174 | x: Member = 1 | = help: Move into type-checking block - -1 1 | """Tests to determine accurate detection of typing-only imports.""" - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ from module import Member -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -169 173 | def f(): -170 174 | global Member -171 175 | -172 |- from module import Member -173 176 | -174 177 | x: Member = 1 -175 178 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 3239308c18f34..361ef31c01b4b 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 @@ -12,23 +12,6 @@ runtime_evaluated_base_classes_2.py:3:21: TCH002 [*] Move third-party import `ge | = help: Move into type-checking block -1 1 | from __future__ import annotations -2 2 | -3 |-import geopandas as gpd # TCH002 -4 3 | import pydantic -5 4 | import pyproj # TCH002 -6 5 | from pydantic import BaseModel -7 6 | -8 7 | import numpy - 8 |+from typing import TYPE_CHECKING - 9 |+ - 10 |+if TYPE_CHECKING: - 11 |+ import geopandas as gpd -9 12 | -10 13 | -11 14 | class A(BaseModel): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. runtime_evaluated_base_classes_2.py:5:8: TCH002 [*] Move third-party import `pyproj` into a type-checking block | @@ -39,20 +22,3 @@ runtime_evaluated_base_classes_2.py:5:8: TCH002 [*] Move third-party import `pyp 6 | from pydantic import BaseModel | = help: Move into type-checking block - -2 2 | -3 3 | import geopandas as gpd # TCH002 -4 4 | import pydantic -5 |-import pyproj # TCH002 -6 5 | from pydantic import BaseModel -7 6 | -8 7 | import numpy - 8 |+from typing import TYPE_CHECKING - 9 |+ - 10 |+if TYPE_CHECKING: - 11 |+ import pyproj -9 12 | -10 13 | -11 14 | class A(BaseModel): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 80422fb47bc04..4b4c71f364469 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 @@ -9,17 +9,3 @@ runtime_evaluated_decorators_2.py:10:8: TCH002 [*] Move third-party import `nump | ^^^^^ TCH002 | = help: Move into type-checking block - -7 7 | import pyproj -8 8 | from attrs import frozen -9 9 | -10 |-import numpy # TCH002 - 10 |+from typing import TYPE_CHECKING - 11 |+ - 12 |+if TYPE_CHECKING: - 13 |+ import numpy -11 14 | -12 15 | -13 16 | @attrs.define(auto_attribs=True) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 5327240517e3e..0162fe04cb7e5 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 @@ -11,16 +11,3 @@ singledispatch.py:11:20: TCH002 [*] Move third-party import `pandas.DataFrame` i 13 | if TYPE_CHECKING: | = help: Move into type-checking block - -8 8 | from numpy import asarray -9 9 | from numpy.typing import ArrayLike -10 10 | from scipy.sparse import spmatrix -11 |-from pandas import DataFrame -12 11 | -13 12 | if TYPE_CHECKING: - 13 |+ from pandas import DataFrame -14 14 | from numpy import ndarray -15 15 | -16 16 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 46af7946cb3af..df9ff203bcd5f 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 @@ -12,24 +12,6 @@ strict.py:54:25: TCH002 [*] Move third-party import `pkg.bar.A` into a type-chec | = help: Move into type-checking block -1 1 | from __future__ import annotations - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ from pkg.bar import A -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -51 55 | def f(): -52 56 | # In un-strict mode, this _should_ raise an error, since `pkg.bar` isn't used at runtime -53 57 | import pkg -54 |- from pkg.bar import A -55 58 | -56 59 | def test(value: A): -57 60 | return pkg.B() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. strict.py:91:12: TCH002 [*] Move third-party import `pkg` into a type-checking block | @@ -40,22 +22,3 @@ strict.py:91:12: TCH002 [*] Move third-party import `pkg` into a type-checking b 92 | import pkgfoo.bar as B | = help: Move into type-checking block - -1 1 | from __future__ import annotations - 2 |+from typing import TYPE_CHECKING - 3 |+ - 4 |+if TYPE_CHECKING: - 5 |+ import pkg -2 6 | -3 7 | -4 8 | def f(): --------------------------------------------------------------------------------- -88 92 | # In un-strict mode, this _should_ raise an error, since `pkg` isn't used at runtime. -89 93 | # Note that `pkg` is a prefix of `pkgfoo` which are both different modules. This is -90 94 | # testing the implementation. -91 |- import pkg -92 95 | import pkgfoo.bar as B -93 96 | -94 97 | def test(value: pkg.A): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 2f6807c3ea7c5..ead3a6af005b9 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 @@ -10,19 +10,3 @@ typing_modules_1.py:7:24: TCH002 [*] Move third-party import `pandas.DataFrame` 9 | df: DataFrame | = help: Move into type-checking block - -1 1 | from __future__ import annotations -2 2 | -3 3 | from typing_extensions import Self - 4 |+from typing import TYPE_CHECKING - 5 |+ - 6 |+if TYPE_CHECKING: - 7 |+ from pandas import DataFrame -4 8 | -5 9 | -6 10 | def func(): -7 |- from pandas import DataFrame -8 11 | -9 12 | df: DataFrame - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 e9fc3b985f390..4448213c48a29 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 @@ -10,17 +10,3 @@ typing_modules_2.py:7:24: TCH002 [*] Move third-party import `pandas.DataFrame` 9 | df: DataFrame | = help: Move into type-checking block - -2 2 | -3 3 | import typing_extensions -4 4 | - 5 |+if typing_extensions.TYPE_CHECKING: - 6 |+ from pandas import DataFrame - 7 |+ -5 8 | -6 9 | def func(): -7 |- from pandas import DataFrame -8 10 | -9 11 | df: DataFrame - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 b89eccbcf747d..c455bd863299e 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 @@ -11,18 +11,3 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 6 | from typing import TYPE_CHECKING | = help: Move into type-checking block - -1 1 | -2 2 | from __future__ import annotations -3 3 | -4 |-import pandas as pd -5 4 | -6 5 | from typing import TYPE_CHECKING -7 6 | - 7 |+if TYPE_CHECKING: - 8 |+ import pandas as pd - 9 |+ -8 10 | def f(x: pd.DataFrame): -9 11 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. 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 8c9f8f53b98eb..f603068e9b4eb 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 @@ -11,16 +11,3 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 8 | def f(x: pd.DataFrame): | = help: Move into type-checking block - -3 3 | -4 4 | from typing import TYPE_CHECKING -5 5 | -6 |-import pandas as pd -7 6 | - 7 |+if TYPE_CHECKING: - 8 |+ import pandas as pd - 9 |+ -8 10 | def f(x: pd.DataFrame): -9 11 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap b/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap index 17a960917ae88..ac8ff57e56a15 100644 --- a/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap +++ b/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap @@ -11,16 +11,6 @@ FLY002.py:5:7: FLY002 [*] Consider `f"{a} World"` instead of string join | = help: Replace with `f"{a} World"` -2 2 | from random import random, choice -3 3 | -4 4 | a = "Hello" -5 |-ok1 = " ".join([a, " World"]) # OK - 5 |+ok1 = f"{a} World" # OK -6 6 | ok2 = "".join(["Finally, ", a, " World"]) # OK -7 7 | ok3 = "x".join(("1", "2", "3")) # OK -8 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FLY002.py:6:7: FLY002 [*] Consider `f"Finally, {a} World"` instead of string join | @@ -33,16 +23,6 @@ FLY002.py:6:7: FLY002 [*] Consider `f"Finally, {a} World"` instead of string joi | = help: Replace with `f"Finally, {a} World"` -3 3 | -4 4 | a = "Hello" -5 5 | ok1 = " ".join([a, " World"]) # OK -6 |-ok2 = "".join(["Finally, ", a, " World"]) # OK - 6 |+ok2 = f"Finally, {a} World" # OK -7 7 | ok3 = "x".join(("1", "2", "3")) # OK -8 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally -9 9 | ok5 = "a".join([random(), random()]) # OK (simple calls) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FLY002.py:7:7: FLY002 [*] Consider `"1x2x3"` instead of string join | @@ -55,16 +35,6 @@ FLY002.py:7:7: FLY002 [*] Consider `"1x2x3"` instead of string join | = help: Replace with `"1x2x3"` -4 4 | a = "Hello" -5 5 | ok1 = " ".join([a, " World"]) # OK -6 6 | ok2 = "".join(["Finally, ", a, " World"]) # OK -7 |-ok3 = "x".join(("1", "2", "3")) # OK - 7 |+ok3 = "1x2x3" # OK -8 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally -9 9 | ok5 = "a".join([random(), random()]) # OK (simple calls) -10 10 | ok6 = "a".join([secrets.token_urlsafe(), secrets.token_hex()]) # OK (attr calls) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FLY002.py:8:7: FLY002 [*] Consider `f"{1}y{2}y{3}"` instead of string join | @@ -77,16 +47,6 @@ FLY002.py:8:7: FLY002 [*] Consider `f"{1}y{2}y{3}"` instead of string join | = help: Replace with `f"{1}y{2}y{3}"` -5 5 | ok1 = " ".join([a, " World"]) # OK -6 6 | ok2 = "".join(["Finally, ", a, " World"]) # OK -7 7 | ok3 = "x".join(("1", "2", "3")) # OK -8 |-ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally - 8 |+ok4 = f"{1}y{2}y{3}" # Technically OK, though would've been an error originally -9 9 | ok5 = "a".join([random(), random()]) # OK (simple calls) -10 10 | ok6 = "a".join([secrets.token_urlsafe(), secrets.token_hex()]) # OK (attr calls) -11 11 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FLY002.py:9:7: FLY002 [*] Consider `f"{random()}a{random()}"` instead of string join | @@ -98,16 +58,6 @@ FLY002.py:9:7: FLY002 [*] Consider `f"{random()}a{random()}"` instead of string | = help: Replace with `f"{random()}a{random()}"` -6 6 | ok2 = "".join(["Finally, ", a, " World"]) # OK -7 7 | ok3 = "x".join(("1", "2", "3")) # OK -8 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally -9 |-ok5 = "a".join([random(), random()]) # OK (simple calls) - 9 |+ok5 = f"{random()}a{random()}" # OK (simple calls) -10 10 | ok6 = "a".join([secrets.token_urlsafe(), secrets.token_hex()]) # OK (attr calls) -11 11 | -12 12 | nok1 = "x".join({"4", "5", "yee"}) # Not OK (set) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FLY002.py:10:7: FLY002 [*] Consider `f"{secrets.token_urlsafe()}a{secrets.token_hex()}"` instead of string join | @@ -120,16 +70,6 @@ FLY002.py:10:7: FLY002 [*] Consider `f"{secrets.token_urlsafe()}a{secrets.token_ | = help: Replace with `f"{secrets.token_urlsafe()}a{secrets.token_hex()}"` -7 7 | ok3 = "x".join(("1", "2", "3")) # OK -8 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally -9 9 | ok5 = "a".join([random(), random()]) # OK (simple calls) -10 |-ok6 = "a".join([secrets.token_urlsafe(), secrets.token_hex()]) # OK (attr calls) - 10 |+ok6 = f"{secrets.token_urlsafe()}a{secrets.token_hex()}" # OK (attr calls) -11 11 | -12 12 | nok1 = "x".join({"4", "5", "yee"}) # Not OK (set) -13 13 | nok2 = a.join(["1", "2", "3"]) # Not OK (not a static joiner) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FLY002.py:23:11: FLY002 [*] Consider `f"{url}{filename}"` instead of string join | @@ -139,11 +79,3 @@ FLY002.py:23:11: FLY002 [*] Consider `f"{url}{filename}"` instead of string join | ^^^^^^^^^^^^^^^^^^^^^^^^ FLY002 | = help: Replace with `f"{url}{filename}"` - -20 20 | -21 21 | # Regression test for: https://github.com/astral-sh/ruff/issues/7197 -22 22 | def create_file_public_url(url, filename): -23 |- return''.join([url, filename]) - 23 |+ return f"{url}{filename}" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201.py.snap index 9caea05355e3e..59e9add281c14 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201.py.snap @@ -80,21 +80,6 @@ NPY201.py:12:5: NPY201 [*] `np.byte_bounds` will be removed in NumPy 2.0. Use `n | = help: Replace with `numpy.lib.array_utils.byte_bounds` (requires NumPy 2.0 or greater) - 1 |+from numpy.lib.array_utils import byte_bounds -1 2 | def func(): -2 3 | import numpy as np -3 4 | --------------------------------------------------------------------------------- -9 10 | -10 11 | np.asfarray([1,2,3]) -11 12 | -12 |- np.byte_bounds(np.array([1,2,3])) - 13 |+ byte_bounds(np.array([1,2,3])) -13 14 | -14 15 | np.cast -15 16 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. NPY201.py:14:5: NPY201 `np.cast` will be removed in NumPy 2.0. Use `np.asarray(arr, dtype=dtype)` instead. | diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap index b5ee497fba66f..c7764254e5930 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap @@ -415,16 +415,6 @@ NPY201_2.py:50:5: NPY201 [*] `np.trapz` will be removed in NumPy 2.0. Use `numpy | = help: Replace with `numpy.trapezoid` (requires NumPy 2.0 or greater) -47 47 | -48 48 | np.product([1, 2, 3]) -49 49 | -50 |- np.trapz([1, 2, 3]) - 50 |+ np.trapezoid([1, 2, 3]) -51 51 | -52 52 | np.in1d([1, 2], [1, 3, 5]) -53 53 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. NPY201_2.py:52:5: NPY201 [*] `np.in1d` will be removed in NumPy 2.0. Use `numpy.isin` instead. | diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap index c6a63f4a70135..fdc16d0f7a721 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap @@ -60,21 +60,6 @@ NPY201_3.py:8:5: NPY201 [*] `np.RankWarning` will be removed in NumPy 2.0. Use ` | = help: Replace with `numpy.exceptions.RankWarning` (requires NumPy 2.0 or greater) - 1 |+from numpy.exceptions import RankWarning -1 2 | def func(): -2 3 | import numpy as np -3 4 | --------------------------------------------------------------------------------- -5 6 | -6 7 | np.ModuleDeprecationWarning -7 8 | -8 |- np.RankWarning - 9 |+ RankWarning -9 10 | -10 11 | np.TooHardError -11 12 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. NPY201_3.py:10:5: NPY201 [*] `np.TooHardError` will be removed in NumPy 2.0. Use `numpy.exceptions.TooHardError` instead. | diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap index 0530b12b4ad36..0d870e3d97df2 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap @@ -12,16 +12,6 @@ PD002.py:5:23: PD002 [*] `inplace=True` should be avoided; it has inconsistent b | = help: Assign to variable; remove `inplace` arg -2 2 | -3 3 | x = pd.DataFrame() -4 4 | -5 |-x.drop(["a"], axis=1, inplace=True) - 5 |+x = x.drop(["a"], axis=1) -6 6 | -7 7 | x.y.drop(["a"], axis=1, inplace=True) -8 8 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PD002.py:7:25: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | @@ -34,16 +24,6 @@ PD002.py:7:25: PD002 [*] `inplace=True` should be avoided; it has inconsistent b | = help: Assign to variable; remove `inplace` arg -4 4 | -5 5 | x.drop(["a"], axis=1, inplace=True) -6 6 | -7 |-x.y.drop(["a"], axis=1, inplace=True) - 7 |+x.y = x.y.drop(["a"], axis=1) -8 8 | -9 9 | x["y"].drop(["a"], axis=1, inplace=True) -10 10 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PD002.py:9:28: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | @@ -56,16 +36,6 @@ PD002.py:9:28: PD002 [*] `inplace=True` should be avoided; it has inconsistent b | = help: Assign to variable; remove `inplace` arg -6 6 | -7 7 | x.y.drop(["a"], axis=1, inplace=True) -8 8 | -9 |-x["y"].drop(["a"], axis=1, inplace=True) - 9 |+x["y"] = x["y"].drop(["a"], axis=1) -10 10 | -11 11 | x.drop( -12 12 | inplace=True, - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PD002.py:12:5: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | @@ -77,17 +47,6 @@ PD002.py:12:5: PD002 [*] `inplace=True` should be avoided; it has inconsistent b | = help: Assign to variable; remove `inplace` arg -8 8 | -9 9 | x["y"].drop(["a"], axis=1, inplace=True) -10 10 | -11 |-x.drop( -12 |- inplace=True, - 11 |+x = x.drop( -13 12 | columns=["a"], -14 13 | axis=1, -15 14 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PD002.py:19:9: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | @@ -100,17 +59,6 @@ PD002.py:19:9: PD002 [*] `inplace=True` should be avoided; it has inconsistent b | = help: Assign to variable; remove `inplace` arg -15 15 | ) -16 16 | -17 17 | if True: -18 |- x.drop( -19 |- inplace=True, - 18 |+ x = x.drop( -20 19 | columns=["a"], -21 20 | axis=1, -22 21 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PD002.py:24:33: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | @@ -123,16 +71,6 @@ PD002.py:24:33: PD002 [*] `inplace=True` should be avoided; it has inconsistent | = help: Assign to variable; remove `inplace` arg -21 21 | axis=1, -22 22 | ) -23 23 | -24 |-x.drop(["a"], axis=1, **kwargs, inplace=True) - 24 |+x = x.drop(["a"], axis=1, **kwargs) -25 25 | x.drop(["a"], axis=1, inplace=True, **kwargs) -26 26 | f(x.drop(["a"], axis=1, inplace=True)) -27 27 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PD002.py:25:23: PD002 `inplace=True` should be avoided; it has inconsistent behavior | @@ -174,14 +112,3 @@ PD002.py:33:24: PD002 [*] `inplace=True` should be avoided; it has inconsistent 35 | # This method doesn't take exist in Pandas, so ignore it. | = help: Assign to variable; remove `inplace` arg - -30 30 | -31 31 | torch.m.ReLU(inplace=True) # safe because this isn't a pandas call -32 32 | -33 |-(x.drop(["a"], axis=1, inplace=True)) - 33 |+x = (x.drop(["a"], axis=1)) -34 34 | -35 35 | # This method doesn't take exist in Pandas, so ignore it. -36 36 | x.rotate_z(45, inplace=True) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap index 6512673300b87..b0c143c7282bc 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap @@ -9,11 +9,3 @@ source: crates/ruff_linter/src/rules/pandas_vet/mod.rs | ^^^^^^^^^^^^ PD002 | = help: Assign to variable; remove `inplace` arg - -1 1 | -2 2 | import pandas as pd -3 3 | x = pd.DataFrame() -4 |-x.drop(["a"], axis=1, inplace=True) - 4 |+x = x.drop(["a"], axis=1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N804_N804.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N804_N804.py.snap index 0b9e3e23fbe54..77934a65ee9e4 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N804_N804.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N804_N804.py.snap @@ -11,16 +11,6 @@ N804.py:30:27: N804 [*] First argument of a class method should be named `cls` | = help: Rename `self` to `cls` -27 27 | def __new__(cls, *args, **kwargs): -28 28 | ... -29 29 | -30 |- def __init_subclass__(self, default_name, **kwargs): - 30 |+ def __init_subclass__(cls, default_name, **kwargs): -31 31 | ... -32 32 | -33 33 | @classmethod - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N804.py:38:56: N804 [*] First argument of a class method should be named `cls` | @@ -31,16 +21,6 @@ N804.py:38:56: N804 [*] First argument of a class method should be named `cls` | = help: Rename `self` to `cls` -35 35 | ... -36 36 | -37 37 | @classmethod -38 |- def bad_class_method_with_positional_only_argument(self, x, /, other): - 38 |+ def bad_class_method_with_positional_only_argument(cls, x, /, other): -39 39 | ... -40 40 | -41 41 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N804.py:43:20: N804 [*] First argument of a class method should be named `cls` | @@ -51,16 +31,6 @@ N804.py:43:20: N804 [*] First argument of a class method should be named `cls` | = help: Rename `self` to `cls` -40 40 | -41 41 | -42 42 | class MetaClass(ABCMeta): -43 |- def bad_method(self): - 43 |+ def bad_method(cls): -44 44 | pass -45 45 | -46 46 | def good_method(cls): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N804.py:54:25: N804 First argument of a class method should be named `cls` | @@ -121,20 +91,6 @@ N804.py:70:20: N804 [*] First argument of a class method should be named `cls` | = help: Rename `this` to `cls` -67 67 | pass -68 68 | -69 69 | class RenamingInMethodBodyClass(ABCMeta): -70 |- def bad_method(this): -71 |- this = this -72 |- this - 70 |+ def bad_method(cls): - 71 |+ cls = cls - 72 |+ cls -73 73 | -74 74 | def bad_method(this): -75 75 | self = this - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N804.py:74:20: N804 [*] First argument of a class method should be named `cls` | @@ -145,16 +101,3 @@ N804.py:74:20: N804 [*] First argument of a class method should be named `cls` 75 | self = this | = help: Rename `this` to `cls` - -71 71 | this = this -72 72 | this -73 73 | -74 |- def bad_method(this): -75 |- self = this - 74 |+ def bad_method(cls): - 75 |+ self = cls -76 76 | -77 77 | def func(x): -78 78 | return x - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N805_N805.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N805_N805.py.snap index 59bcadb3643ff..68a7d3f1f2ebc 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N805_N805.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__N805_N805.py.snap @@ -10,16 +10,6 @@ N805.py:7:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -4 4 | -5 5 | -6 6 | class Class: -7 |- def bad_method(this): - 7 |+ def bad_method(self): -8 8 | pass -9 9 | -10 10 | if False: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:11:30: N805 [*] First argument of a method should be named `self` | @@ -30,16 +20,6 @@ N805.py:11:30: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -8 8 | pass -9 9 | -10 10 | if False: -11 |- def extra_bad_method(this): - 11 |+ def extra_bad_method(self): -12 12 | pass -13 13 | -14 14 | def good_method(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:30:15: N805 [*] First argument of a method should be named `self` | @@ -50,16 +30,6 @@ N805.py:30:15: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -27 27 | return x -28 28 | -29 29 | @pydantic.validator -30 |- def lower(cls, my_field: str) -> str: - 30 |+ def lower(self, my_field: str) -> str: -31 31 | pass -32 32 | -33 33 | @pydantic.validator("my_field") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:34:15: N805 [*] First argument of a method should be named `self` | @@ -70,16 +40,6 @@ N805.py:34:15: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -31 31 | pass -32 32 | -33 33 | @pydantic.validator("my_field") -34 |- def lower(cls, my_field: str) -> str: - 34 |+ def lower(self, my_field: str) -> str: -35 35 | pass -36 36 | -37 37 | def __init__(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:63:29: N805 [*] First argument of a method should be named `self` | @@ -91,16 +51,6 @@ N805.py:63:29: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -60 60 | def good_method_pos_only(self, blah, /, something: str): -61 61 | pass -62 62 | -63 |- def bad_method_pos_only(this, blah, /, something: str): - 63 |+ def bad_method_pos_only(self, blah, /, something: str): -64 64 | pass -65 65 | -66 66 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:69:13: N805 [*] First argument of a method should be named `self` | @@ -112,16 +62,6 @@ N805.py:69:13: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -66 66 | -67 67 | class ModelClass: -68 68 | @hybrid_property -69 |- def bad(cls): - 69 |+ def bad(self): -70 70 | pass -71 71 | -72 72 | @bad.expression - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:77:13: N805 [*] First argument of a method should be named `self` | @@ -132,16 +72,6 @@ N805.py:77:13: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -74 74 | pass -75 75 | -76 76 | @bad.wtf -77 |- def bad(cls): - 77 |+ def bad(self): -78 78 | pass -79 79 | -80 80 | @hybrid_property - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:85:14: N805 [*] First argument of a method should be named `self` | @@ -152,16 +82,6 @@ N805.py:85:14: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -82 82 | pass -83 83 | -84 84 | @good.expression -85 |- def good(cls): - 85 |+ def good(self): -86 86 | pass -87 87 | -88 88 | @good.wtf - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:93:19: N805 [*] First argument of a method should be named `self` | @@ -172,16 +92,6 @@ N805.py:93:19: N805 [*] First argument of a method should be named `self` | = help: Rename `foo` to `self` -90 90 | pass -91 91 | -92 92 | @foobar.thisisstatic -93 |- def badstatic(foo): - 93 |+ def badstatic(self): -94 94 | pass -95 95 | -96 96 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:98:26: N805 First argument of a method should be named `self` | @@ -242,20 +152,6 @@ N805.py:115:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -112 112 | -113 113 | -114 114 | class RenamingInMethodBodyClass: -115 |- def bad_method(this): -116 |- this = this -117 |- this - 115 |+ def bad_method(self): - 116 |+ self = self - 117 |+ self -118 118 | -119 119 | def bad_method(this): -120 120 | self = this - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:119:20: N805 [*] First argument of a method should be named `self` | @@ -267,18 +163,6 @@ N805.py:119:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -116 116 | this = this -117 117 | this -118 118 | -119 |- def bad_method(this): -120 |- self = this - 119 |+ def bad_method(self): - 120 |+ self = self -121 121 | -122 122 | -123 123 | class RenamingWithNFKC: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:124:17: N805 [*] First argument of a method should be named `self` | @@ -288,13 +172,3 @@ N805.py:124:17: N805 [*] First argument of a method should be named `self` 125 | hºusehold(1) | = help: Rename `household` to `self` - -121 121 | -122 122 | -123 123 | class RenamingWithNFKC: -124 |- def formula(household): -125 |- hºusehold(1) - 124 |+ def formula(self): - 125 |+ self(1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__classmethod_decorators.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__classmethod_decorators.snap index 461efa785330b..56471b288bf78 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__classmethod_decorators.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__classmethod_decorators.snap @@ -10,16 +10,6 @@ N805.py:7:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -4 4 | -5 5 | -6 6 | class Class: -7 |- def bad_method(this): - 7 |+ def bad_method(self): -8 8 | pass -9 9 | -10 10 | if False: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:11:30: N805 [*] First argument of a method should be named `self` | @@ -30,16 +20,6 @@ N805.py:11:30: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -8 8 | pass -9 9 | -10 10 | if False: -11 |- def extra_bad_method(this): - 11 |+ def extra_bad_method(self): -12 12 | pass -13 13 | -14 14 | def good_method(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:63:29: N805 [*] First argument of a method should be named `self` | @@ -51,16 +31,6 @@ N805.py:63:29: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -60 60 | def good_method_pos_only(self, blah, /, something: str): -61 61 | pass -62 62 | -63 |- def bad_method_pos_only(this, blah, /, something: str): - 63 |+ def bad_method_pos_only(self, blah, /, something: str): -64 64 | pass -65 65 | -66 66 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:69:13: N805 [*] First argument of a method should be named `self` | @@ -72,16 +42,6 @@ N805.py:69:13: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -66 66 | -67 67 | class ModelClass: -68 68 | @hybrid_property -69 |- def bad(cls): - 69 |+ def bad(self): -70 70 | pass -71 71 | -72 72 | @bad.expression - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:77:13: N805 [*] First argument of a method should be named `self` | @@ -92,16 +52,6 @@ N805.py:77:13: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -74 74 | pass -75 75 | -76 76 | @bad.wtf -77 |- def bad(cls): - 77 |+ def bad(self): -78 78 | pass -79 79 | -80 80 | @hybrid_property - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:93:19: N805 [*] First argument of a method should be named `self` | @@ -112,16 +62,6 @@ N805.py:93:19: N805 [*] First argument of a method should be named `self` | = help: Rename `foo` to `self` -90 90 | pass -91 91 | -92 92 | @foobar.thisisstatic -93 |- def badstatic(foo): - 93 |+ def badstatic(self): -94 94 | pass -95 95 | -96 96 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:98:26: N805 First argument of a method should be named `self` | @@ -182,20 +122,6 @@ N805.py:115:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -112 112 | -113 113 | -114 114 | class RenamingInMethodBodyClass: -115 |- def bad_method(this): -116 |- this = this -117 |- this - 115 |+ def bad_method(self): - 116 |+ self = self - 117 |+ self -118 118 | -119 119 | def bad_method(this): -120 120 | self = this - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:119:20: N805 [*] First argument of a method should be named `self` | @@ -207,18 +133,6 @@ N805.py:119:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -116 116 | this = this -117 117 | this -118 118 | -119 |- def bad_method(this): -120 |- self = this - 119 |+ def bad_method(self): - 120 |+ self = self -121 121 | -122 122 | -123 123 | class RenamingWithNFKC: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:124:17: N805 [*] First argument of a method should be named `self` | @@ -228,13 +142,3 @@ N805.py:124:17: N805 [*] First argument of a method should be named `self` 125 | hºusehold(1) | = help: Rename `household` to `self` - -121 121 | -122 122 | -123 123 | class RenamingWithNFKC: -124 |- def formula(household): -125 |- hºusehold(1) - 124 |+ def formula(self): - 125 |+ self(1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N804_N804.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N804_N804.py.snap index a546752f39c0f..f3eb234d5687e 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N804_N804.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N804_N804.py.snap @@ -10,16 +10,6 @@ N804.py:5:27: N804 [*] First argument of a class method should be named `cls` | = help: Rename `self` to `cls` -2 2 | -3 3 | -4 4 | class Class: -5 |- def __init_subclass__(self, default_name, **kwargs): - 5 |+ def __init_subclass__(cls, default_name, **kwargs): -6 6 | ... -7 7 | -8 8 | @classmethod - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N804.py:9:20: N804 [*] First argument of a class method should be named `cls` | @@ -30,16 +20,6 @@ N804.py:9:20: N804 [*] First argument of a class method should be named `cls` | = help: Rename `self` to `cls` -6 6 | ... -7 7 | -8 8 | @classmethod -9 |- def badAllowed(self, x, /, other): - 9 |+ def badAllowed(cls, x, /, other): -10 10 | ... -11 11 | -12 12 | @classmethod - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N804.py:13:18: N804 [*] First argument of a class method should be named `cls` | @@ -50,16 +30,6 @@ N804.py:13:18: N804 [*] First argument of a class method should be named `cls` | = help: Rename `self` to `cls` -10 10 | ... -11 11 | -12 12 | @classmethod -13 |- def stillBad(self, x, /, other): - 13 |+ def stillBad(cls, x, /, other): -14 14 | ... -15 15 | -16 16 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N804.py:18:20: N804 [*] First argument of a class method should be named `cls` | @@ -70,16 +40,6 @@ N804.py:18:20: N804 [*] First argument of a class method should be named `cls` | = help: Rename `self` to `cls` -15 15 | -16 16 | -17 17 | class MetaClass(ABCMeta): -18 |- def badAllowed(self): - 18 |+ def badAllowed(cls): -19 19 | pass -20 20 | -21 21 | def stillBad(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N804.py:21:18: N804 [*] First argument of a class method should be named `cls` | @@ -90,12 +50,3 @@ N804.py:21:18: N804 [*] First argument of a class method should be named `cls` 22 | pass | = help: Rename `self` to `cls` - -18 18 | def badAllowed(self): -19 19 | pass -20 20 | -21 |- def stillBad(self): - 21 |+ def stillBad(cls): -22 22 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N805_N805.py.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N805_N805.py.snap index 2ecef1b7f22b4..373381cb56898 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N805_N805.py.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__ignore_names_N805_N805.py.snap @@ -10,16 +10,6 @@ N805.py:7:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -4 4 | -5 5 | -6 6 | class Class: -7 |- def badAllowed(this): - 7 |+ def badAllowed(self): -8 8 | pass -9 9 | -10 10 | def stillBad(this): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:10:18: N805 [*] First argument of a method should be named `self` | @@ -31,16 +21,6 @@ N805.py:10:18: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -7 7 | def badAllowed(this): -8 8 | pass -9 9 | -10 |- def stillBad(this): - 10 |+ def stillBad(self): -11 11 | pass -12 12 | -13 13 | if False: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:15:24: N805 [*] First argument of a method should be named `self` | @@ -52,16 +32,6 @@ N805.py:15:24: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -12 12 | -13 13 | if False: -14 14 | -15 |- def badAllowed(this): - 15 |+ def badAllowed(self): -16 16 | pass -17 17 | -18 18 | def stillBad(this): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:18:22: N805 [*] First argument of a method should be named `self` | @@ -73,16 +43,6 @@ N805.py:18:22: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -15 15 | def badAllowed(this): -16 16 | pass -17 17 | -18 |- def stillBad(this): - 18 |+ def stillBad(self): -19 19 | pass -20 20 | -21 21 | @pydantic.validator - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:22:20: N805 [*] First argument of a method should be named `self` | @@ -93,16 +53,6 @@ N805.py:22:20: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -19 19 | pass -20 20 | -21 21 | @pydantic.validator -22 |- def badAllowed(cls, my_field: str) -> str: - 22 |+ def badAllowed(self, my_field: str) -> str: -23 23 | pass -24 24 | -25 25 | @pydantic.validator - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:26:18: N805 [*] First argument of a method should be named `self` | @@ -113,16 +63,6 @@ N805.py:26:18: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -23 23 | pass -24 24 | -25 25 | @pydantic.validator -26 |- def stillBad(cls, my_field: str) -> str: - 26 |+ def stillBad(self, my_field: str) -> str: -27 27 | pass -28 28 | -29 29 | @pydantic.validator("my_field") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:30:20: N805 [*] First argument of a method should be named `self` | @@ -133,16 +73,6 @@ N805.py:30:20: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -27 27 | pass -28 28 | -29 29 | @pydantic.validator("my_field") -30 |- def badAllowed(cls, my_field: str) -> str: - 30 |+ def badAllowed(self, my_field: str) -> str: -31 31 | pass -32 32 | -33 33 | @pydantic.validator("my_field") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:34:18: N805 [*] First argument of a method should be named `self` | @@ -153,16 +83,6 @@ N805.py:34:18: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -31 31 | pass -32 32 | -33 33 | @pydantic.validator("my_field") -34 |- def stillBad(cls, my_field: str) -> str: - 34 |+ def stillBad(self, my_field: str) -> str: -35 35 | pass -36 36 | -37 37 | @classmethod - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:55:20: N805 First argument of a method should be named `self` | diff --git a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__staticmethod_decorators.snap b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__staticmethod_decorators.snap index 373a550bce295..3be135c82984c 100644 --- a/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__staticmethod_decorators.snap +++ b/crates/ruff_linter/src/rules/pep8_naming/snapshots/ruff_linter__rules__pep8_naming__tests__staticmethod_decorators.snap @@ -10,16 +10,6 @@ N805.py:7:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -4 4 | -5 5 | -6 6 | class Class: -7 |- def bad_method(this): - 7 |+ def bad_method(self): -8 8 | pass -9 9 | -10 10 | if False: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:11:30: N805 [*] First argument of a method should be named `self` | @@ -30,16 +20,6 @@ N805.py:11:30: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -8 8 | pass -9 9 | -10 10 | if False: -11 |- def extra_bad_method(this): - 11 |+ def extra_bad_method(self): -12 12 | pass -13 13 | -14 14 | def good_method(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:30:15: N805 [*] First argument of a method should be named `self` | @@ -50,16 +30,6 @@ N805.py:30:15: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -27 27 | return x -28 28 | -29 29 | @pydantic.validator -30 |- def lower(cls, my_field: str) -> str: - 30 |+ def lower(self, my_field: str) -> str: -31 31 | pass -32 32 | -33 33 | @pydantic.validator("my_field") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:34:15: N805 [*] First argument of a method should be named `self` | @@ -70,16 +40,6 @@ N805.py:34:15: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -31 31 | pass -32 32 | -33 33 | @pydantic.validator("my_field") -34 |- def lower(cls, my_field: str) -> str: - 34 |+ def lower(self, my_field: str) -> str: -35 35 | pass -36 36 | -37 37 | def __init__(self): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:63:29: N805 [*] First argument of a method should be named `self` | @@ -91,16 +51,6 @@ N805.py:63:29: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -60 60 | def good_method_pos_only(self, blah, /, something: str): -61 61 | pass -62 62 | -63 |- def bad_method_pos_only(this, blah, /, something: str): - 63 |+ def bad_method_pos_only(self, blah, /, something: str): -64 64 | pass -65 65 | -66 66 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:69:13: N805 [*] First argument of a method should be named `self` | @@ -112,16 +62,6 @@ N805.py:69:13: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -66 66 | -67 67 | class ModelClass: -68 68 | @hybrid_property -69 |- def bad(cls): - 69 |+ def bad(self): -70 70 | pass -71 71 | -72 72 | @bad.expression - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:77:13: N805 [*] First argument of a method should be named `self` | @@ -132,16 +72,6 @@ N805.py:77:13: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -74 74 | pass -75 75 | -76 76 | @bad.wtf -77 |- def bad(cls): - 77 |+ def bad(self): -78 78 | pass -79 79 | -80 80 | @hybrid_property - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:85:14: N805 [*] First argument of a method should be named `self` | @@ -152,16 +82,6 @@ N805.py:85:14: N805 [*] First argument of a method should be named `self` | = help: Rename `cls` to `self` -82 82 | pass -83 83 | -84 84 | @good.expression -85 |- def good(cls): - 85 |+ def good(self): -86 86 | pass -87 87 | -88 88 | @good.wtf - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:98:26: N805 First argument of a method should be named `self` | @@ -222,20 +142,6 @@ N805.py:115:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -112 112 | -113 113 | -114 114 | class RenamingInMethodBodyClass: -115 |- def bad_method(this): -116 |- this = this -117 |- this - 115 |+ def bad_method(self): - 116 |+ self = self - 117 |+ self -118 118 | -119 119 | def bad_method(this): -120 120 | self = this - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:119:20: N805 [*] First argument of a method should be named `self` | @@ -247,18 +153,6 @@ N805.py:119:20: N805 [*] First argument of a method should be named `self` | = help: Rename `this` to `self` -116 116 | this = this -117 117 | this -118 118 | -119 |- def bad_method(this): -120 |- self = this - 119 |+ def bad_method(self): - 120 |+ self = self -121 121 | -122 122 | -123 123 | class RenamingWithNFKC: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. N805.py:124:17: N805 [*] First argument of a method should be named `self` | @@ -268,13 +162,3 @@ N805.py:124:17: N805 [*] First argument of a method should be named `self` 125 | hºusehold(1) | = help: Rename `household` to `self` - -121 121 | -122 122 | -123 123 | class RenamingWithNFKC: -124 |- def formula(household): -125 |- hºusehold(1) - 124 |+ def formula(self): - 125 |+ self(1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap index ddb35d331ae63..95a75793474ff 100644 --- a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap +++ b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap @@ -10,16 +10,6 @@ PERF102.py:5:21: PERF102 [*] When using only the values of a dict use the `value | = help: Replace `.items()` with `.values()` -2 2 | -3 3 | -4 4 | def f(): -5 |- for _, value in some_dict.items(): # PERF102 - 5 |+ for value in some_dict.values(): # PERF102 -6 6 | print(value) -7 7 | -8 8 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PERF102.py:10:19: PERF102 [*] When using only the keys of a dict use the `keys()` method | @@ -30,16 +20,6 @@ PERF102.py:10:19: PERF102 [*] When using only the keys of a dict use the `keys() | = help: Replace `.items()` with `.keys()` -7 7 | -8 8 | -9 9 | def f(): -10 |- for key, _ in some_dict.items(): # PERF102 - 10 |+ for key in some_dict.keys(): # PERF102 -11 11 | print(key) -12 12 | -13 13 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PERF102.py:15:30: PERF102 [*] When using only the keys of a dict use the `keys()` method | @@ -50,16 +30,6 @@ PERF102.py:15:30: PERF102 [*] When using only the keys of a dict use the `keys() | = help: Replace `.items()` with `.keys()` -12 12 | -13 13 | -14 14 | def f(): -15 |- for weird_arg_name, _ in some_dict.items(): # PERF102 - 15 |+ for weird_arg_name in some_dict.keys(): # PERF102 -16 16 | print(weird_arg_name) -17 17 | -18 18 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PERF102.py:20:25: PERF102 [*] When using only the keys of a dict use the `keys()` method | @@ -70,16 +40,6 @@ PERF102.py:20:25: PERF102 [*] When using only the keys of a dict use the `keys() | = help: Replace `.items()` with `.keys()` -17 17 | -18 18 | -19 19 | def f(): -20 |- for name, (_, _) in some_dict.items(): # PERF102 - 20 |+ for name in some_dict.keys(): # PERF102 -21 21 | print(name) -22 22 | -23 23 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PERF102.py:30:30: PERF102 [*] When using only the keys of a dict use the `keys()` method | @@ -90,16 +50,6 @@ PERF102.py:30:30: PERF102 [*] When using only the keys of a dict use the `keys() | = help: Replace `.items()` with `.keys()` -27 27 | -28 28 | -29 29 | def f(): -30 |- for (key1, _), (_, _) in some_dict.items(): # PERF102 - 30 |+ for (key1, _) in some_dict.keys(): # PERF102 -31 31 | print(key1) -32 32 | -33 33 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PERF102.py:35:36: PERF102 [*] When using only the values of a dict use the `values()` method | @@ -110,16 +60,6 @@ PERF102.py:35:36: PERF102 [*] When using only the values of a dict use the `valu | = help: Replace `.items()` with `.values()` -32 32 | -33 33 | -34 34 | def f(): -35 |- for (_, (_, _)), (value, _) in some_dict.items(): # PERF102 - 35 |+ for (value, _) in some_dict.values(): # PERF102 -36 36 | print(value) -37 37 | -38 38 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PERF102.py:50:32: PERF102 [*] When using only the keys of a dict use the `keys()` method | @@ -130,16 +70,6 @@ PERF102.py:50:32: PERF102 [*] When using only the keys of a dict use the `keys() | = help: Replace `.items()` with `.keys()` -47 47 | -48 48 | -49 49 | def f(): -50 |- for ((_, key2), (_, _)) in some_dict.items(): # PERF102 - 50 |+ for (_, key2) in some_dict.keys(): # PERF102 -51 51 | print(key2) -52 52 | -53 53 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PERF102.py:85:25: PERF102 [*] When using only the keys of a dict use the `keys()` method | @@ -150,16 +80,6 @@ PERF102.py:85:25: PERF102 [*] When using only the keys of a dict use the `keys() | = help: Replace `.items()` with `.keys()` -82 82 | -83 83 | -84 84 | def f(): -85 |- for name, (_, _) in (some_function()).items(): # PERF102 - 85 |+ for name in (some_function()).keys(): # PERF102 -86 86 | print(name) -87 87 | -88 88 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PERF102.py:90:25: PERF102 [*] When using only the keys of a dict use the `keys()` method | @@ -170,16 +90,6 @@ PERF102.py:90:25: PERF102 [*] When using only the keys of a dict use the `keys() | = help: Replace `.items()` with `.keys()` -87 87 | -88 88 | -89 89 | def f(): -90 |- for name, (_, _) in (some_function().some_attribute).items(): # PERF102 - 90 |+ for name in (some_function().some_attribute).keys(): # PERF102 -91 91 | print(name) -92 92 | -93 93 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PERF102.py:95:31: PERF102 [*] When using only the keys of a dict use the `keys()` method | @@ -190,16 +100,6 @@ PERF102.py:95:31: PERF102 [*] When using only the keys of a dict use the `keys() | = help: Replace `.items()` with `.keys()` -92 92 | -93 93 | -94 94 | def f(): -95 |- for name, unused_value in some_dict.items(): # PERF102 - 95 |+ for name in some_dict.keys(): # PERF102 -96 96 | print(name) -97 97 | -98 98 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PERF102.py:100:31: PERF102 [*] When using only the values of a dict use the `values()` method | @@ -210,16 +110,6 @@ PERF102.py:100:31: PERF102 [*] When using only the values of a dict use the `val | = help: Replace `.items()` with `.values()` -97 97 | -98 98 | -99 99 | def f(): -100 |- for unused_name, value in some_dict.items(): # PERF102 - 100 |+ for value in some_dict.values(): # PERF102 -101 101 | print(value) -102 102 | -103 103 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PERF102.py:106:16: PERF102 [*] When using only the keys of a dict use the `keys()` method | @@ -230,12 +120,3 @@ PERF102.py:106:16: PERF102 [*] When using only the keys of a dict use the `keys( 107 | if(C:=name_to_value.get(B.name)):A.run(B.set,C) | = help: Replace `.items()` with `.keys()` - -103 103 | -104 104 | # Regression test for: https://github.com/astral-sh/ruff/issues/7097 -105 105 | def _create_context(name_to_value): -106 |- for(B,D)in A.items(): - 106 |+ for B in A.keys(): -107 107 | if(C:=name_to_value.get(B.name)):A.run(B.set,C) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap index 7bb0dfdfc066f..941ede566ebd9 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap @@ -11,14 +11,6 @@ E711.py:2:11: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -1 1 | #: E711 -2 |-if res == None: - 2 |+if res is None: -3 3 | pass -4 4 | #: E711 -5 5 | if res != None: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E711.py:5:11: E711 [*] Comparison to `None` should be `cond is not None` | @@ -31,16 +23,6 @@ E711.py:5:11: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -2 2 | if res == None: -3 3 | pass -4 4 | #: E711 -5 |-if res != None: - 5 |+if res is not None: -6 6 | pass -7 7 | #: E711 -8 8 | if None == res: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E711.py:8:4: E711 [*] Comparison to `None` should be `cond is None` | @@ -53,16 +35,6 @@ E711.py:8:4: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -5 5 | if res != None: -6 6 | pass -7 7 | #: E711 -8 |-if None == res: - 8 |+if None is res: -9 9 | pass -10 10 | #: E711 -11 11 | if None != res: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E711.py:11:4: E711 [*] Comparison to `None` should be `cond is not None` | @@ -75,16 +47,6 @@ E711.py:11:4: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -8 8 | if None == res: -9 9 | pass -10 10 | #: E711 -11 |-if None != res: - 11 |+if None is not res: -12 12 | pass -13 13 | #: E711 -14 14 | if res[1] == None: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E711.py:14:14: E711 [*] Comparison to `None` should be `cond is None` | @@ -97,16 +59,6 @@ E711.py:14:14: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -11 11 | if None != res: -12 12 | pass -13 13 | #: E711 -14 |-if res[1] == None: - 14 |+if res[1] is None: -15 15 | pass -16 16 | #: E711 -17 17 | if res[1] != None: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E711.py:17:14: E711 [*] Comparison to `None` should be `cond is not None` | @@ -119,16 +71,6 @@ E711.py:17:14: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -14 14 | if res[1] == None: -15 15 | pass -16 16 | #: E711 -17 |-if res[1] != None: - 17 |+if res[1] is not None: -18 18 | pass -19 19 | #: E711 -20 20 | if None != res[1]: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E711.py:20:4: E711 [*] Comparison to `None` should be `cond is not None` | @@ -141,16 +83,6 @@ E711.py:20:4: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -17 17 | if res[1] != None: -18 18 | pass -19 19 | #: E711 -20 |-if None != res[1]: - 20 |+if None is not res[1]: -21 21 | pass -22 22 | #: E711 -23 23 | if None == res[1]: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E711.py:23:4: E711 [*] Comparison to `None` should be `cond is None` | @@ -162,16 +94,6 @@ E711.py:23:4: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -20 20 | if None != res[1]: -21 21 | pass -22 22 | #: E711 -23 |-if None == res[1]: - 23 |+if None is res[1]: -24 24 | pass -25 25 | -26 26 | if x == None != None: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E711.py:26:9: E711 [*] Comparison to `None` should be `cond is None` | @@ -183,16 +105,6 @@ E711.py:26:9: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -23 23 | if None == res[1]: -24 24 | pass -25 25 | -26 |-if x == None != None: - 26 |+if x is None is not None: -27 27 | pass -28 28 | -29 29 | #: Okay - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E711.py:26:17: E711 [*] Comparison to `None` should be `cond is not None` | @@ -203,14 +115,3 @@ E711.py:26:17: E711 [*] Comparison to `None` should be `cond is not None` 27 | pass | = help: Replace with `cond is not None` - -23 23 | if None == res[1]: -24 24 | pass -25 25 | -26 |-if x == None != None: - 26 |+if x is None is not None: -27 27 | pass -28 28 | -29 29 | #: Okay - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap index 0401928623ae4..714b838b069f9 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap @@ -11,14 +11,6 @@ E712.py:2:4: E712 [*] Avoid equality comparisons to `True`; use `if res:` for tr | = help: Replace with `res` -1 1 | #: E712 -2 |-if res == True: - 2 |+if res is True: -3 3 | pass -4 4 | #: E712 -5 5 | if res != False: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E712.py:5:4: E712 [*] Avoid inequality comparisons to `False`; use `if res:` for truth checks | @@ -31,16 +23,6 @@ E712.py:5:4: E712 [*] Avoid inequality comparisons to `False`; use `if res:` for | = help: Replace with `res` -2 2 | if res == True: -3 3 | pass -4 4 | #: E712 -5 |-if res != False: - 5 |+if res is not False: -6 6 | pass -7 7 | #: E712 -8 8 | if True != res: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E712.py:8:4: E712 [*] Avoid inequality comparisons to `True`; use `if not res:` for false checks | @@ -53,16 +35,6 @@ E712.py:8:4: E712 [*] Avoid inequality comparisons to `True`; use `if not res:` | = help: Replace with `not res` -5 5 | if res != False: -6 6 | pass -7 7 | #: E712 -8 |-if True != res: - 8 |+if True is not res: -9 9 | pass -10 10 | #: E712 -11 11 | if False == res: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E712.py:11:4: E712 [*] Avoid equality comparisons to `False`; use `if not res:` for false checks | @@ -75,16 +47,6 @@ E712.py:11:4: E712 [*] Avoid equality comparisons to `False`; use `if not res:` | = help: Replace with `not res` -8 8 | if True != res: -9 9 | pass -10 10 | #: E712 -11 |-if False == res: - 11 |+if False is res: -12 12 | pass -13 13 | #: E712 -14 14 | if res[1] == True: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E712.py:14:4: E712 [*] Avoid equality comparisons to `True`; use `if res[1]:` for truth checks | @@ -97,16 +59,6 @@ E712.py:14:4: E712 [*] Avoid equality comparisons to `True`; use `if res[1]:` fo | = help: Replace with `res[1]` -11 11 | if False == res: -12 12 | pass -13 13 | #: E712 -14 |-if res[1] == True: - 14 |+if res[1] is True: -15 15 | pass -16 16 | #: E712 -17 17 | if res[1] != False: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E712.py:17:4: E712 [*] Avoid inequality comparisons to `False`; use `if res[1]:` for truth checks | @@ -119,16 +71,6 @@ E712.py:17:4: E712 [*] Avoid inequality comparisons to `False`; use `if res[1]:` | = help: Replace with `res[1]` -14 14 | if res[1] == True: -15 15 | pass -16 16 | #: E712 -17 |-if res[1] != False: - 17 |+if res[1] is not False: -18 18 | pass -19 19 | #: E712 -20 20 | var = 1 if cond == True else -1 if cond == False else cond - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E712.py:20:12: E712 [*] Avoid equality comparisons to `True`; use `if cond:` for truth checks | @@ -141,16 +83,6 @@ E712.py:20:12: E712 [*] Avoid equality comparisons to `True`; use `if cond:` for | = help: Replace with `cond` -17 17 | if res[1] != False: -18 18 | pass -19 19 | #: E712 -20 |-var = 1 if cond == True else -1 if cond == False else cond - 20 |+var = 1 if cond is True else -1 if cond == False else cond -21 21 | #: E712 -22 22 | if (True) == TrueElement or x == TrueElement: -23 23 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E712.py:20:36: E712 [*] Avoid equality comparisons to `False`; use `if not cond:` for false checks | @@ -163,16 +95,6 @@ E712.py:20:36: E712 [*] Avoid equality comparisons to `False`; use `if not cond: | = help: Replace with `not cond` -17 17 | if res[1] != False: -18 18 | pass -19 19 | #: E712 -20 |-var = 1 if cond == True else -1 if cond == False else cond - 20 |+var = 1 if cond == True else -1 if cond is False else cond -21 21 | #: E712 -22 22 | if (True) == TrueElement or x == TrueElement: -23 23 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E712.py:22:4: E712 [*] Avoid equality comparisons to `True`; use `if TrueElement:` for truth checks | @@ -184,16 +106,6 @@ E712.py:22:4: E712 [*] Avoid equality comparisons to `True`; use `if TrueElement | = help: Replace with `TrueElement` -19 19 | #: E712 -20 20 | var = 1 if cond == True else -1 if cond == False else cond -21 21 | #: E712 -22 |-if (True) == TrueElement or x == TrueElement: - 22 |+if (True) is TrueElement or x == TrueElement: -23 23 | pass -24 24 | -25 25 | if res == True != False: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E712.py:25:4: E712 [*] Avoid equality comparisons to `True` or `False` | @@ -205,16 +117,6 @@ E712.py:25:4: E712 [*] Avoid equality comparisons to `True` or `False` | = help: Replace comparison -22 22 | if (True) == TrueElement or x == TrueElement: -23 23 | pass -24 24 | -25 |-if res == True != False: - 25 |+if res is True is not False: -26 26 | pass -27 27 | -28 28 | if(True) == TrueElement or x == TrueElement: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E712.py:25:4: E712 [*] Avoid equality comparisons to `True` or `False` | @@ -226,16 +128,6 @@ E712.py:25:4: E712 [*] Avoid equality comparisons to `True` or `False` | = help: Replace comparison -22 22 | if (True) == TrueElement or x == TrueElement: -23 23 | pass -24 24 | -25 |-if res == True != False: - 25 |+if res is True is not False: -26 26 | pass -27 27 | -28 28 | if(True) == TrueElement or x == TrueElement: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E712.py:28:3: E712 [*] Avoid equality comparisons to `True`; use `if TrueElement:` for truth checks | @@ -247,16 +139,6 @@ E712.py:28:3: E712 [*] Avoid equality comparisons to `True`; use `if TrueElement | = help: Replace with `TrueElement` -25 25 | if res == True != False: -26 26 | pass -27 27 | -28 |-if(True) == TrueElement or x == TrueElement: - 28 |+if(True) is TrueElement or x == TrueElement: -29 29 | pass -30 30 | -31 31 | if (yield i) == True: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E712.py:31:4: E712 [*] Avoid equality comparisons to `True`; use `if yield i:` for truth checks | @@ -267,14 +149,3 @@ E712.py:31:4: E712 [*] Avoid equality comparisons to `True`; use `if yield i:` f 32 | print("even") | = help: Replace with `yield i` - -28 28 | if(True) == TrueElement or x == TrueElement: -29 29 | pass -30 30 | -31 |-if (yield i) == True: - 31 |+if (yield i) is True: -32 32 | print("even") -33 33 | -34 34 | #: Okay - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap index 95f9310189a1b..b2cbb66f2c9a7 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap @@ -10,16 +10,6 @@ E731.py:3:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -1 1 | def scope(): -2 2 | # E731 -3 |- f = lambda x: 2 * x - 3 |+ def f(x): - 4 |+ return 2 * x -4 5 | -5 6 | -6 7 | def scope(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E731.py:8:5: E731 [*] Do not assign a `lambda` expression, use a `def` | @@ -30,17 +20,6 @@ E731.py:8:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -5 5 | -6 6 | def scope(): -7 7 | # E731 -8 |- f = lambda x: 2 * x - 8 |+ def f(x): - 9 |+ return 2 * x -9 10 | -10 11 | -11 12 | def scope(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E731.py:14:9: E731 [*] Do not assign a `lambda` expression, use a `def` | @@ -51,17 +30,6 @@ E731.py:14:9: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `this` as a `def` -11 11 | def scope(): -12 12 | # E731 -13 13 | while False: -14 |- this = lambda y, z: 2 * x - 14 |+ def this(y, z): - 15 |+ return 2 * x -15 16 | -16 17 | -17 18 | def scope(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E731.py:19:5: E731 [*] Do not assign a `lambda` expression, use a `def` | @@ -72,17 +40,6 @@ E731.py:19:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -16 16 | -17 17 | def scope(): -18 18 | # E731 -19 |- f = lambda: (yield 1) - 19 |+ def f(): - 20 |+ return (yield 1) -20 21 | -21 22 | -22 23 | def scope(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E731.py:24:5: E731 [*] Do not assign a `lambda` expression, use a `def` | @@ -93,17 +50,6 @@ E731.py:24:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -21 21 | -22 22 | def scope(): -23 23 | # E731 -24 |- f = lambda: (yield from g()) - 24 |+ def f(): - 25 |+ return (yield from g()) -25 26 | -26 27 | -27 28 | def scope(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E731.py:57:5: E731 Do not assign a `lambda` expression, use a `def` | @@ -114,17 +60,6 @@ E731.py:57:5: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -54 54 | -55 55 | class Scope: -56 56 | # E731 -57 |- f = lambda x: 2 * x - 57 |+ def f(x): - 58 |+ return 2 * x -58 59 | -59 60 | -60 61 | class Scope: - - Ruff cannot safely apply this fix. E731.py:73:9: E731 Do not assign a `lambda` expression, use a `def` | @@ -137,17 +72,6 @@ E731.py:73:9: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `x` as a `def` -70 70 | -71 71 | x: Callable[[int], int] -72 72 | if True: -73 |- x = lambda: 1 - 73 |+ def x(): - 74 |+ return 1 -74 75 | else: -75 76 | x = lambda: 2 -76 77 | return x - - Ruff cannot safely apply this fix. E731.py:75:9: E731 Do not assign a `lambda` expression, use a `def` | @@ -159,17 +83,6 @@ E731.py:75:9: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `x` as a `def` -72 72 | if True: -73 73 | x = lambda: 1 -74 74 | else: -75 |- x = lambda: 2 - 75 |+ def x(): - 76 |+ return 2 -76 77 | return x -77 78 | -78 79 | - - Ruff cannot safely apply this fix. E731.py:86:5: E731 [*] Do not assign a `lambda` expression, use a `def` | @@ -180,17 +93,6 @@ E731.py:86:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -83 83 | -84 84 | # ParamSpec cannot be used in this context, so do not preserve the annotation. -85 85 | P = ParamSpec("P") -86 |- f: Callable[P, int] = lambda *args: len(args) - 86 |+ def f(*args): - 87 |+ return len(args) -87 88 | -88 89 | -89 90 | def scope(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E731.py:94:5: E731 [*] Do not assign a `lambda` expression, use a `def` | @@ -201,17 +103,6 @@ E731.py:94:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -91 91 | -92 92 | from typing import Callable -93 93 | -94 |- f: Callable[[], None] = lambda: None - 94 |+ def f() -> None: - 95 |+ return None -95 96 | -96 97 | -97 98 | def scope(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E731.py:102:5: E731 [*] Do not assign a `lambda` expression, use a `def` | @@ -222,17 +113,6 @@ E731.py:102:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -99 99 | -100 100 | from typing import Callable -101 101 | -102 |- f: Callable[..., None] = lambda a, b: None - 102 |+ def f(a, b) -> None: - 103 |+ return None -103 104 | -104 105 | -105 106 | def scope(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E731.py:110:5: E731 [*] Do not assign a `lambda` expression, use a `def` | @@ -243,17 +123,6 @@ E731.py:110:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -107 107 | -108 108 | from typing import Callable -109 109 | -110 |- f: Callable[[int], int] = lambda x: 2 * x - 110 |+ def f(x: int) -> int: - 111 |+ return 2 * x -111 112 | -112 113 | -113 114 | # Let's use the `Callable` type from `collections.abc` instead. - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E731.py:119:5: E731 [*] Do not assign a `lambda` expression, use a `def` | @@ -264,17 +133,6 @@ E731.py:119:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -116 116 | -117 117 | from collections.abc import Callable -118 118 | -119 |- f: Callable[[str, int], str] = lambda a, b: a * b - 119 |+ def f(a: str, b: int) -> str: - 120 |+ return a * b -120 121 | -121 122 | -122 123 | def scope(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E731.py:127:5: E731 [*] Do not assign a `lambda` expression, use a `def` | @@ -285,17 +143,6 @@ E731.py:127:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -124 124 | -125 125 | from collections.abc import Callable -126 126 | -127 |- f: Callable[[str, int], tuple[str, int]] = lambda a, b: (a, b) - 127 |+ def f(a: str, b: int) -> tuple[str, int]: - 128 |+ return a, b -128 129 | -129 130 | -130 131 | def scope(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E731.py:135:5: E731 [*] Do not assign a `lambda` expression, use a `def` | @@ -306,17 +153,6 @@ E731.py:135:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -132 132 | -133 133 | from collections.abc import Callable -134 134 | -135 |- f: Callable[[str, int, list[str]], list[str]] = lambda a, b, /, c: [*c, a * b] - 135 |+ def f(a: str, b: int, /, c: list[str]) -> list[str]: - 136 |+ return [*c, a * b] -136 137 | -137 138 | -138 139 | class TemperatureScales(Enum): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. E731.py:139:5: E731 Do not assign a `lambda` expression, use a `def` | @@ -327,17 +163,6 @@ E731.py:139:5: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `CELSIUS` as a `def` -136 136 | -137 137 | -138 138 | class TemperatureScales(Enum): -139 |- CELSIUS = (lambda deg_c: deg_c) - 139 |+ def CELSIUS(deg_c): - 140 |+ return deg_c -140 141 | FAHRENHEIT = (lambda deg_c: deg_c * 9 / 5 + 32) -141 142 | -142 143 | - - Ruff cannot safely apply this fix. E731.py:140:5: E731 Do not assign a `lambda` expression, use a `def` | @@ -348,17 +173,6 @@ E731.py:140:5: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `FAHRENHEIT` as a `def` -137 137 | -138 138 | class TemperatureScales(Enum): -139 139 | CELSIUS = (lambda deg_c: deg_c) -140 |- FAHRENHEIT = (lambda deg_c: deg_c * 9 / 5 + 32) - 140 |+ def FAHRENHEIT(deg_c): - 141 |+ return deg_c * 9 / 5 + 32 -141 142 | -142 143 | -143 144 | # Regression test for: https://github.com/astral-sh/ruff/issues/7141 - - Ruff cannot safely apply this fix. E731.py:147:5: E731 [*] Do not assign a `lambda` expression, use a `def` | @@ -371,17 +185,3 @@ E731.py:147:5: E731 [*] Do not assign a `lambda` expression, use a `def` | |_____^ E731 | = help: Rewrite `f` as a `def` - -144 144 | def scope(): -145 145 | # E731 -146 146 | -147 |- f = lambda: ( -148 |- i := 1, -149 |- ) - 147 |+ def f(): - 148 |+ return (i := 1), -150 149 | -151 150 | -152 151 | from dataclasses import dataclass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap index a50fc89a1a6fa..179295e621ef4 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap @@ -9,13 +9,6 @@ W291.py:1:23: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -1 |-'''trailing whitespace - 1 |+'''trailing whitespace -2 2 | inside a multiline string''' -3 3 | -4 4 | f'''trailing whitespace - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. W291.py:4:24: W291 [*] Trailing whitespace | @@ -27,16 +20,6 @@ W291.py:4:24: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -1 1 | '''trailing whitespace -2 2 | inside a multiline string''' -3 3 | -4 |-f'''trailing whitespace - 4 |+f'''trailing whitespace -5 5 | inside a multiline f-string''' -6 6 | -7 7 | # Trailing whitespace after `{` - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. W291.py:8:8: W291 [*] Trailing whitespace | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap index 1ca6eafd70215..48a12b1fbde37 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap @@ -11,16 +11,6 @@ W293.py:4:1: W293 [*] Blank line contains whitespace | = help: Remove whitespace from blank line -1 1 | # See: https://github.com/astral-sh/ruff/issues/9323 -2 2 | class Chassis(RobotModuleTemplate): -3 3 | """底盘信息推送控制 -4 |- - 4 |+ -5 5 | """\ -6 6 | -7 7 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. W293.py:10:1: W293 [*] Blank line contains whitespace | @@ -75,12 +65,3 @@ W293.py:18:1: W293 [*] Blank line contains whitespace 19 | inside a multiline string''' | = help: Remove whitespace from blank line - -15 15 | \ -16 16 | -17 17 | '''blank line with whitespace -18 |- - 18 |+ -19 19 | inside a multiline string''' - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap index 74c2821c72e86..26bb7653bf4f8 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap @@ -122,16 +122,6 @@ constant_literals.py:14:4: E712 [*] Avoid equality comparisons to `False`; use ` | = help: Replace with `not None` -11 11 | pass -12 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) -13 13 | pass -14 |-if False == None: # E711, E712 (fix) - 14 |+if False is None: # E711, E712 (fix) -15 15 | pass -16 16 | if None == False: # E711, E712 (fix) -17 17 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. constant_literals.py:14:13: E711 [*] Comparison to `None` should be `cond is None` | @@ -144,16 +134,6 @@ constant_literals.py:14:13: E711 [*] Comparison to `None` should be `cond is Non | = help: Replace with `cond is None` -11 11 | pass -12 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) -13 13 | pass -14 |-if False == None: # E711, E712 (fix) - 14 |+if False is None: # E711, E712 (fix) -15 15 | pass -16 16 | if None == False: # E711, E712 (fix) -17 17 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. constant_literals.py:16:4: E711 [*] Comparison to `None` should be `cond is None` | @@ -165,16 +145,6 @@ constant_literals.py:16:4: E711 [*] Comparison to `None` should be `cond is None | = help: Replace with `cond is None` -13 13 | pass -14 14 | if False == None: # E711, E712 (fix) -15 15 | pass -16 |-if None == False: # E711, E712 (fix) - 16 |+if None is False: # E711, E712 (fix) -17 17 | pass -18 18 | -19 19 | named_var = [] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. constant_literals.py:16:4: E712 [*] Avoid equality comparisons to `False`; use `if not None:` for false checks | @@ -186,16 +156,6 @@ constant_literals.py:16:4: E712 [*] Avoid equality comparisons to `False`; use ` | = help: Replace with `not None` -13 13 | pass -14 14 | if False == None: # E711, E712 (fix) -15 15 | pass -16 |-if None == False: # E711, E712 (fix) - 16 |+if None is False: # E711, E712 (fix) -17 17 | pass -18 18 | -19 19 | named_var = [] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. constant_literals.py:20:4: F632 [*] Use `==` to compare constant literals | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap index 97543fb450048..9fa448f6cb742 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap @@ -13,18 +13,6 @@ D.py:129:5: D200 [*] One-line docstring should fit on one line | = help: Reformat to one line -126 126 | '(found 3)') -127 127 | @expect('D212: Multi-line docstring summary should start at the first line') -128 128 | def asdlkfasd(): -129 |- """ -130 |- Wrong. -131 |- """ - 129 |+ """Wrong.""" -132 130 | -133 131 | -134 132 | @expect('D201: No blank lines allowed before function docstring (found 1)') - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:597:5: D200 [*] One-line docstring should fit on one line | @@ -38,18 +26,6 @@ D.py:597:5: D200 [*] One-line docstring should fit on one line | = help: Reformat to one line -594 594 | '(found 3)') -595 595 | @expect('D212: Multi-line docstring summary should start at the first line') -596 596 | def one_liner(): -597 |- """ -598 |- -599 |- Wrong.""" - 597 |+ """Wrong.""" -600 598 | -601 599 | -602 600 | @expect('D200: One-line docstring should fit on one line with quotes ' - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:606:5: D200 [*] One-line docstring should fit on one line | @@ -63,18 +39,6 @@ D.py:606:5: D200 [*] One-line docstring should fit on one line | = help: Reformat to one line -603 603 | '(found 3)') -604 604 | @expect('D212: Multi-line docstring summary should start at the first line') -605 605 | def one_liner(): -606 |- r"""Wrong. -607 |- -608 |- """ - 606 |+ r"""Wrong.""" -609 607 | -610 608 | -611 609 | @expect('D200: One-line docstring should fit on one line with quotes ' - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:615:5: D200 One-line docstring should fit on one line | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap index 9c8dcb8c30531..0f60583652ce3 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap @@ -21,17 +21,6 @@ D200.py:7:5: D200 [*] One-line docstring should fit on one line | = help: Reformat to one line -4 4 | -5 5 | -6 6 | def func(): -7 |- """\\ -8 |- """ - 7 |+ """\\""" -9 8 | -10 9 | -11 10 | def func(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D200.py:12:5: D200 One-line docstring should fit on one line | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.py.snap index b19cb6282972c..dd141a8348d46 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.py.snap @@ -9,14 +9,3 @@ D.py:333:5: D301 [*] Use `r"""` if any backslashes in a docstring | ^^^^^^^^^^^^^^^^ D301 | = help: Add `r` prefix - -330 330 | -331 331 | @expect('D301: Use r""" if any backslashes in a docstring') -332 332 | def double_quotes_backslash(): -333 |- """Sum\\mary.""" - 333 |+ r"""Sum\\mary.""" -334 334 | -335 335 | -336 336 | @expect('D301: Use r""" if any backslashes in a docstring') - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D301.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D301.py.snap index 436e78a3b7f3e..06274a28f3c2a 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D301.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D301.py.snap @@ -9,14 +9,6 @@ D301.py:2:5: D301 [*] Use `r"""` if any backslashes in a docstring | = help: Add `r` prefix -1 1 | def double_quotes_backslash(): -2 |- """Sum\\mary.""" - 2 |+ r"""Sum\\mary.""" -3 3 | -4 4 | -5 5 | def double_quotes_backslash_raw(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D301.py:37:5: D301 Use `r"""` if any backslashes in a docstring | @@ -37,16 +29,6 @@ D301.py:93:5: D301 [*] Use `r"""` if any backslashes in a docstring | = help: Add `r` prefix -90 90 | -91 91 | -92 92 | def should_add_raw_for_single_double_quote_escape(): -93 |- """ - 93 |+ r""" -94 94 | This is single quote escape \". -95 95 | """ -96 96 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D301.py:99:5: D301 [*] Use `r"""` if any backslashes in a docstring | @@ -58,13 +40,3 @@ D301.py:99:5: D301 [*] Use `r"""` if any backslashes in a docstring | |_______^ D301 | = help: Add `r` prefix - -96 96 | -97 97 | -98 98 | def should_add_raw_for_single_single_quote_escape(): -99 |- ''' - 99 |+ r''' -100 100 | This is single quote escape \'. -101 101 | ''' - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap index 123e14e416a7a..1c370c1405ca1 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap @@ -10,16 +10,6 @@ D.py:355:5: D400 [*] First line should end with a period | = help: Add period -352 352 | @expect("D415: First line should end with a period, question mark, " -353 353 | "or exclamation point (not 'y')") -354 354 | def lwnlkjl(): -355 |- """Summary""" - 355 |+ """Summary.""" -356 356 | -357 357 | -358 358 | @expect("D401: First line should be in imperative mood " - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:406:25: D400 [*] First line should end with a period | @@ -30,16 +20,6 @@ D.py:406:25: D400 [*] First line should end with a period | = help: Add period -403 403 | @expect("D400: First line should end with a period (not 'r')") -404 404 | @expect("D415: First line should end with a period, question mark," -405 405 | " or exclamation point (not 'r')") -406 |-def oneliner_withdoc(): """One liner""" - 406 |+def oneliner_withdoc(): """One liner.""" -407 407 | -408 408 | -409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:410:5: D400 [*] First line should end with a period | @@ -51,16 +31,6 @@ D.py:410:5: D400 [*] First line should end with a period | = help: Add period -407 407 | -408 408 | -409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 -410 |- """Runs something""" - 410 |+ """Runs something.""" -411 411 | func() -412 412 | pass -413 413 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:416:5: D400 [*] First line should end with a period | @@ -72,16 +42,6 @@ D.py:416:5: D400 [*] First line should end with a period | = help: Add period -413 413 | -414 414 | -415 415 | def decorator_for_test(func): # noqa: D400,D401,D415 -416 |- """Runs something""" - 416 |+ """Runs something.""" -417 417 | func() -418 418 | pass -419 419 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:422:35: D400 [*] First line should end with a period | @@ -91,16 +51,6 @@ D.py:422:35: D400 [*] First line should end with a period | = help: Add period -419 419 | -420 420 | -421 421 | @ignored_decorator -422 |-def oneliner_ignored_decorator(): """One liner""" - 422 |+def oneliner_ignored_decorator(): """One liner.""" -423 423 | -424 424 | -425 425 | @decorator_for_test - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:429:49: D400 [*] First line should end with a period | @@ -111,16 +61,6 @@ D.py:429:49: D400 [*] First line should end with a period | = help: Add period -426 426 | @expect("D400: First line should end with a period (not 'r')") -427 427 | @expect("D415: First line should end with a period, question mark," -428 428 | " or exclamation point (not 'r')") -429 |-def oneliner_with_decorator_expecting_errors(): """One liner""" - 429 |+def oneliner_with_decorator_expecting_errors(): """One liner.""" -430 430 | -431 431 | -432 432 | @decorator_for_test - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:470:5: D400 [*] First line should end with a period | @@ -132,16 +72,6 @@ D.py:470:5: D400 [*] First line should end with a period | = help: Add period -467 467 | @expect("D415: First line should end with a period, question mark, " -468 468 | "or exclamation point (not 'g')") -469 469 | def docstring_bad(): -470 |- """Runs something""" - 470 |+ """Runs something.""" -471 471 | pass -472 472 | -473 473 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:475:5: D400 [*] First line should end with a period | @@ -152,16 +82,6 @@ D.py:475:5: D400 [*] First line should end with a period | = help: Add period -472 472 | -473 473 | -474 474 | def docstring_bad_ignore_all(): # noqa -475 |- """Runs something""" - 475 |+ """Runs something.""" -476 476 | pass -477 477 | -478 478 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:480:5: D400 [*] First line should end with a period | @@ -172,16 +92,6 @@ D.py:480:5: D400 [*] First line should end with a period | = help: Add period -477 477 | -478 478 | -479 479 | def docstring_bad_ignore_one(): # noqa: D400,D401,D415 -480 |- """Runs something""" - 480 |+ """Runs something.""" -481 481 | pass -482 482 | -483 483 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:487:5: D400 [*] First line should end with a period | @@ -193,16 +103,6 @@ D.py:487:5: D400 [*] First line should end with a period | = help: Add period -484 484 | @expect("D401: First line should be in imperative mood " -485 485 | "(perhaps 'Run', not 'Runs')") -486 486 | def docstring_ignore_some_violations_but_catch_D401(): # noqa: E501,D400,D415 -487 |- """Runs something""" - 487 |+ """Runs something.""" -488 488 | pass -489 489 | -490 490 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:514:5: D400 [*] First line should end with a period | @@ -212,16 +112,6 @@ D.py:514:5: D400 [*] First line should end with a period | = help: Add period -511 511 | -512 512 | -513 513 | def valid_google_string(): # noqa: D400 -514 |- """Test a valid something!""" - 514 |+ """Test a valid something!.""" -515 515 | -516 516 | -517 517 | @expect("D415: First line should end with a period, question mark, " - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:520:5: D400 [*] First line should end with a period | @@ -232,16 +122,6 @@ D.py:520:5: D400 [*] First line should end with a period | = help: Add period -517 517 | @expect("D415: First line should end with a period, question mark, " -518 518 | "or exclamation point (not 'g')") -519 519 | def bad_google_string(): # noqa: D400 -520 |- """Test a valid something""" - 520 |+ """Test a valid something.""" -521 521 | -522 522 | -523 523 | # This is reproducing a bug where AttributeError is raised when parsing class - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:581:5: D400 [*] First line should end with a period | @@ -252,16 +132,6 @@ D.py:581:5: D400 [*] First line should end with a period | = help: Add period -578 578 | @expect("D415: First line should end with a period, question mark, " -579 579 | "or exclamation point (not '\"')") -580 580 | def endswith_quote(): -581 |- """Whitespace at the end, but also a quote" """ - 581 |+ """Whitespace at the end, but also a quote". """ -582 582 | -583 583 | -584 584 | @expect('D209: Multi-line docstring closing quotes should be on a separate ' - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:615:5: D400 [*] First line should end with a period | @@ -275,16 +145,6 @@ D.py:615:5: D400 [*] First line should end with a period | = help: Add period -612 612 | '(found 3)') -613 613 | @expect('D212: Multi-line docstring summary should start at the first line') -614 614 | def one_liner(): -615 |- """Wrong." - 615 |+ """Wrong.". -616 616 | -617 617 | """ -618 618 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:639:17: D400 [*] First line should end with a period | @@ -295,16 +155,6 @@ D.py:639:17: D400 [*] First line should end with a period | = help: Add period -636 636 | """ This is a docstring that starts with a space.""" # noqa: D210 -637 637 | -638 638 | -639 |-class SameLine: """This is a docstring on the same line""" - 639 |+class SameLine: """This is a docstring on the same line.""" -640 640 | -641 641 | def same_line(): """This is a docstring on the same line""" -642 642 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:641:18: D400 [*] First line should end with a period | @@ -315,16 +165,6 @@ D.py:641:18: D400 [*] First line should end with a period | = help: Add period -638 638 | -639 639 | class SameLine: """This is a docstring on the same line""" -640 640 | -641 |-def same_line(): """This is a docstring on the same line""" - 641 |+def same_line(): """This is a docstring on the same line.""" -642 642 | -643 643 | -644 644 | def single_line_docstring_with_an_escaped_backslash(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:664:5: D400 [*] First line should end with a period | @@ -335,14 +175,3 @@ D.py:664:5: D400 [*] First line should end with a period | |_________________________________________________________^ D400 | = help: Add period - -662 662 | -663 663 | def newline_after_closing_quote(self): -664 664 | "We enforce a newline after the closing quote for a multi-line docstring \ -665 |- but continuations shouldn't be considered multi-line" - 665 |+ but continuations shouldn't be considered multi-line." -666 666 | -667 667 | -668 668 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap index aae6363caaead..944d2215eedfd 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap @@ -10,14 +10,6 @@ D400.py:2:5: D400 [*] First line should end with a period | = help: Add period -1 1 | def f(): -2 |- "Here's a line without a period" - 2 |+ "Here's a line without a period." -3 3 | ... -4 4 | -5 5 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D400.py:7:5: D400 [*] First line should end with a period | @@ -28,16 +20,6 @@ D400.py:7:5: D400 [*] First line should end with a period | = help: Add period -4 4 | -5 5 | -6 6 | def f(): -7 |- """Here's a line without a period""" - 7 |+ """Here's a line without a period.""" -8 8 | ... -9 9 | -10 10 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D400.py:12:5: D400 [*] First line should end with a period | @@ -52,16 +34,6 @@ D400.py:12:5: D400 [*] First line should end with a period | = help: Add period -11 11 | def f(): -12 12 | """ -13 13 | Here's a line without a period, -14 |- but here's the next line - 14 |+ but here's the next line. -15 15 | """ -16 16 | ... -17 17 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D400.py:20:5: D400 [*] First line should end with a period | @@ -72,16 +44,6 @@ D400.py:20:5: D400 [*] First line should end with a period | = help: Add period -17 17 | -18 18 | -19 19 | def f(): -20 |- """Here's a line without a period""" - 20 |+ """Here's a line without a period.""" -21 21 | ... -22 22 | -23 23 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D400.py:25:5: D400 [*] First line should end with a period | @@ -95,16 +57,6 @@ D400.py:25:5: D400 [*] First line should end with a period | = help: Add period -24 24 | def f(): -25 25 | """ -26 26 | Here's a line without a period, -27 |- but here's the next line""" - 27 |+ but here's the next line.""" -28 28 | ... -29 29 | -30 30 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D400.py:32:5: D400 [*] First line should end with a period | @@ -118,16 +70,6 @@ D400.py:32:5: D400 [*] First line should end with a period | = help: Add period -31 31 | def f(): -32 32 | """ -33 33 | Here's a line without a period, -34 |- but here's the next line with trailing space """ - 34 |+ but here's the next line with trailing space. """ -35 35 | ... -36 36 | -37 37 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D400.py:39:5: D400 [*] First line should end with a period | @@ -138,16 +80,6 @@ D400.py:39:5: D400 [*] First line should end with a period | = help: Add period -36 36 | -37 37 | -38 38 | def f(): -39 |- r"Here's a line without a period" - 39 |+ r"Here's a line without a period." -40 40 | ... -41 41 | -42 42 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D400.py:44:5: D400 [*] First line should end with a period | @@ -158,16 +90,6 @@ D400.py:44:5: D400 [*] First line should end with a period | = help: Add period -41 41 | -42 42 | -43 43 | def f(): -44 |- r"""Here's a line without a period""" - 44 |+ r"""Here's a line without a period.""" -45 45 | ... -46 46 | -47 47 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D400.py:49:5: D400 [*] First line should end with a period | @@ -182,16 +104,6 @@ D400.py:49:5: D400 [*] First line should end with a period | = help: Add period -48 48 | def f(): -49 49 | r""" -50 50 | Here's a line without a period, -51 |- but here's the next line - 51 |+ but here's the next line. -52 52 | """ -53 53 | ... -54 54 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D400.py:57:5: D400 [*] First line should end with a period | @@ -202,16 +114,6 @@ D400.py:57:5: D400 [*] First line should end with a period | = help: Add period -54 54 | -55 55 | -56 56 | def f(): -57 |- r"""Here's a line without a period""" - 57 |+ r"""Here's a line without a period.""" -58 58 | ... -59 59 | -60 60 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D400.py:62:5: D400 [*] First line should end with a period | @@ -225,16 +127,6 @@ D400.py:62:5: D400 [*] First line should end with a period | = help: Add period -61 61 | def f(): -62 62 | r""" -63 63 | Here's a line without a period, -64 |- but here's the next line""" - 64 |+ but here's the next line.""" -65 65 | ... -66 66 | -67 67 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D400.py:69:5: D400 [*] First line should end with a period | @@ -248,16 +140,6 @@ D400.py:69:5: D400 [*] First line should end with a period | = help: Add period -68 68 | def f(): -69 69 | r""" -70 70 | Here's a line without a period, -71 |- but here's the next line with trailing space """ - 71 |+ but here's the next line with trailing space. """ -72 72 | ... -73 73 | -74 74 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D400.py:97:5: D400 [*] First line should end with a period | @@ -272,14 +154,3 @@ D400.py:97:5: D400 [*] First line should end with a period | |_______^ D400 | = help: Add period - -95 95 | -96 96 | def f(): -97 97 | """ -98 |- My example - 98 |+ My example. -99 99 | ========== -100 100 | -101 101 | My example explanation - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap index 3c3628eda59ff..e374d5165c868 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap @@ -10,16 +10,6 @@ D.py:355:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -352 352 | @expect("D415: First line should end with a period, question mark, " -353 353 | "or exclamation point (not 'y')") -354 354 | def lwnlkjl(): -355 |- """Summary""" - 355 |+ """Summary.""" -356 356 | -357 357 | -358 358 | @expect("D401: First line should be in imperative mood " - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:406:25: D415 [*] First line should end with a period, question mark, or exclamation point | @@ -30,16 +20,6 @@ D.py:406:25: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -403 403 | @expect("D400: First line should end with a period (not 'r')") -404 404 | @expect("D415: First line should end with a period, question mark," -405 405 | " or exclamation point (not 'r')") -406 |-def oneliner_withdoc(): """One liner""" - 406 |+def oneliner_withdoc(): """One liner.""" -407 407 | -408 408 | -409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:410:5: D415 [*] First line should end with a period, question mark, or exclamation point | @@ -51,16 +31,6 @@ D.py:410:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -407 407 | -408 408 | -409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 -410 |- """Runs something""" - 410 |+ """Runs something.""" -411 411 | func() -412 412 | pass -413 413 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:416:5: D415 [*] First line should end with a period, question mark, or exclamation point | @@ -72,16 +42,6 @@ D.py:416:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -413 413 | -414 414 | -415 415 | def decorator_for_test(func): # noqa: D400,D401,D415 -416 |- """Runs something""" - 416 |+ """Runs something.""" -417 417 | func() -418 418 | pass -419 419 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:422:35: D415 [*] First line should end with a period, question mark, or exclamation point | @@ -91,16 +51,6 @@ D.py:422:35: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -419 419 | -420 420 | -421 421 | @ignored_decorator -422 |-def oneliner_ignored_decorator(): """One liner""" - 422 |+def oneliner_ignored_decorator(): """One liner.""" -423 423 | -424 424 | -425 425 | @decorator_for_test - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:429:49: D415 [*] First line should end with a period, question mark, or exclamation point | @@ -111,16 +61,6 @@ D.py:429:49: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -426 426 | @expect("D400: First line should end with a period (not 'r')") -427 427 | @expect("D415: First line should end with a period, question mark," -428 428 | " or exclamation point (not 'r')") -429 |-def oneliner_with_decorator_expecting_errors(): """One liner""" - 429 |+def oneliner_with_decorator_expecting_errors(): """One liner.""" -430 430 | -431 431 | -432 432 | @decorator_for_test - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:470:5: D415 [*] First line should end with a period, question mark, or exclamation point | @@ -132,16 +72,6 @@ D.py:470:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -467 467 | @expect("D415: First line should end with a period, question mark, " -468 468 | "or exclamation point (not 'g')") -469 469 | def docstring_bad(): -470 |- """Runs something""" - 470 |+ """Runs something.""" -471 471 | pass -472 472 | -473 473 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:475:5: D415 [*] First line should end with a period, question mark, or exclamation point | @@ -152,16 +82,6 @@ D.py:475:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -472 472 | -473 473 | -474 474 | def docstring_bad_ignore_all(): # noqa -475 |- """Runs something""" - 475 |+ """Runs something.""" -476 476 | pass -477 477 | -478 478 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:480:5: D415 [*] First line should end with a period, question mark, or exclamation point | @@ -172,16 +92,6 @@ D.py:480:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -477 477 | -478 478 | -479 479 | def docstring_bad_ignore_one(): # noqa: D400,D401,D415 -480 |- """Runs something""" - 480 |+ """Runs something.""" -481 481 | pass -482 482 | -483 483 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:487:5: D415 [*] First line should end with a period, question mark, or exclamation point | @@ -193,16 +103,6 @@ D.py:487:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -484 484 | @expect("D401: First line should be in imperative mood " -485 485 | "(perhaps 'Run', not 'Runs')") -486 486 | def docstring_ignore_some_violations_but_catch_D401(): # noqa: E501,D400,D415 -487 |- """Runs something""" - 487 |+ """Runs something.""" -488 488 | pass -489 489 | -490 490 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:520:5: D415 [*] First line should end with a period, question mark, or exclamation point | @@ -213,16 +113,6 @@ D.py:520:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -517 517 | @expect("D415: First line should end with a period, question mark, " -518 518 | "or exclamation point (not 'g')") -519 519 | def bad_google_string(): # noqa: D400 -520 |- """Test a valid something""" - 520 |+ """Test a valid something.""" -521 521 | -522 522 | -523 523 | # This is reproducing a bug where AttributeError is raised when parsing class - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:581:5: D415 [*] First line should end with a period, question mark, or exclamation point | @@ -233,16 +123,6 @@ D.py:581:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -578 578 | @expect("D415: First line should end with a period, question mark, " -579 579 | "or exclamation point (not '\"')") -580 580 | def endswith_quote(): -581 |- """Whitespace at the end, but also a quote" """ - 581 |+ """Whitespace at the end, but also a quote". """ -582 582 | -583 583 | -584 584 | @expect('D209: Multi-line docstring closing quotes should be on a separate ' - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:615:5: D415 [*] First line should end with a period, question mark, or exclamation point | @@ -256,16 +136,6 @@ D.py:615:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -612 612 | '(found 3)') -613 613 | @expect('D212: Multi-line docstring summary should start at the first line') -614 614 | def one_liner(): -615 |- """Wrong." - 615 |+ """Wrong.". -616 616 | -617 617 | """ -618 618 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:639:17: D415 [*] First line should end with a period, question mark, or exclamation point | @@ -276,16 +146,6 @@ D.py:639:17: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -636 636 | """ This is a docstring that starts with a space.""" # noqa: D210 -637 637 | -638 638 | -639 |-class SameLine: """This is a docstring on the same line""" - 639 |+class SameLine: """This is a docstring on the same line.""" -640 640 | -641 641 | def same_line(): """This is a docstring on the same line""" -642 642 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:641:18: D415 [*] First line should end with a period, question mark, or exclamation point | @@ -296,16 +156,6 @@ D.py:641:18: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -638 638 | -639 639 | class SameLine: """This is a docstring on the same line""" -640 640 | -641 |-def same_line(): """This is a docstring on the same line""" - 641 |+def same_line(): """This is a docstring on the same line.""" -642 642 | -643 643 | -644 644 | def single_line_docstring_with_an_escaped_backslash(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. D.py:664:5: D415 [*] First line should end with a period, question mark, or exclamation point | @@ -316,14 +166,3 @@ D.py:664:5: D415 [*] First line should end with a period, question mark, or excl | |_________________________________________________________^ D415 | = help: Add closing punctuation - -662 662 | -663 663 | def newline_after_closing_quote(self): -664 664 | "We enforce a newline after the closing quote for a multi-line docstring \ -665 |- but continuations shouldn't be considered multi-line" - 665 |+ but continuations shouldn't be considered multi-line." -666 666 | -667 667 | -668 668 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap index 138946ad3f758..40f5539a4e419 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap @@ -28,10 +28,3 @@ D209_D400.py:2:5: D400 [*] First line should end with a period | |________________________________________________________________________^ D400 | = help: Add period - -1 1 | def lorem(): -2 2 | """lorem ipsum dolor sit amet consectetur adipiscing elit -3 |- sed do eiusmod tempor incididunt ut labore et dolore magna aliqua""" - 3 |+ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.""" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_24____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_24____init__.py.snap index 6c70f9b9c98ea..9b1c11269efb8 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_24____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_24____init__.py.snap @@ -8,15 +8,6 @@ __init__.py:19:8: F401 [*] `sys` imported but unused | = help: Remove unused import: `sys` -16 16 | import argparse as argparse # Ok: is redundant alias -17 17 | -18 18 | -19 |-import sys # F401: remove unused -20 19 | -21 20 | -22 21 | # first-party - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. __init__.py:33:15: F401 [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | @@ -25,15 +16,6 @@ __init__.py:33:15: F401 [*] `.unused` imported but unused; consider removing, ad | = help: Remove unused import: `.unused` -30 30 | from . import aliased as aliased # Ok: is redundant alias -31 31 | -32 32 | -33 |-from . import unused # F401: change to redundant alias -34 33 | -35 34 | -36 35 | from . import renamed as bees # F401: no fix - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. __init__.py:36:26: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | @@ -41,10 +23,3 @@ __init__.py:36:26: F401 [*] `.renamed` imported but unused; consider removing, a | ^^^^ F401 | = help: Remove unused import: `.renamed` - -33 33 | from . import unused # F401: change to redundant alias -34 34 | -35 35 | -36 |-from . import renamed as bees # F401: no fix - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_25__all_nonempty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_25__all_nonempty____init__.py.snap index fed30706878aa..2d5889e44bbfd 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_25__all_nonempty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_25__all_nonempty____init__.py.snap @@ -8,15 +8,6 @@ __init__.py:19:8: F401 [*] `sys` imported but unused | = help: Remove unused import: `sys` -16 16 | import argparse # Ok: is exported in __all__ -17 17 | -18 18 | -19 |-import sys # F401: remove unused -20 19 | -21 20 | -22 21 | # first-party - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. __init__.py:36:15: F401 [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | @@ -25,15 +16,6 @@ __init__.py:36:15: F401 [*] `.unused` imported but unused; consider removing, ad | = help: Remove unused import: `.unused` -33 33 | from . import exported # Ok: is exported in __all__ -34 34 | -35 35 | -36 |-from . import unused # F401: add to __all__ -37 36 | -38 37 | -39 38 | from . import renamed as bees # F401: add to __all__ - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. __init__.py:39:26: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | @@ -41,13 +23,3 @@ __init__.py:39:26: F401 [*] `.renamed` imported but unused; consider removing, a | ^^^^ F401 | = help: Remove unused import: `.renamed` - -36 36 | from . import unused # F401: add to __all__ -37 37 | -38 38 | -39 |-from . import renamed as bees # F401: add to __all__ -40 39 | -41 40 | -42 41 | __all__ = ["argparse", "exported"] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_26__all_empty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_26__all_empty____init__.py.snap index bb880dc2b2cc2..7bb1897fd5475 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_26__all_empty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_26__all_empty____init__.py.snap @@ -8,15 +8,6 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add | = help: Remove unused import: `.unused` -2 2 | """ -3 3 | -4 4 | -5 |-from . import unused # F401: add to __all__ -6 5 | -7 6 | -8 7 | from . import renamed as bees # F401: add to __all__ - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. __init__.py:8:26: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | @@ -24,13 +15,3 @@ __init__.py:8:26: F401 [*] `.renamed` imported but unused; consider removing, ad | ^^^^ F401 | = help: Remove unused import: `.renamed` - -5 5 | from . import unused # F401: add to __all__ -6 6 | -7 7 | -8 |-from . import renamed as bees # F401: add to __all__ -9 8 | -10 9 | -11 10 | __all__ = [] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_27__all_mistyped____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_27__all_mistyped____init__.py.snap index 06c0900b6e310..56e2e913ac180 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_27__all_mistyped____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_27__all_mistyped____init__.py.snap @@ -8,15 +8,6 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add | = help: Remove unused import: `.unused` -2 2 | """ -3 3 | -4 4 | -5 |-from . import unused # F401: recommend add to all w/o fix -6 5 | -7 6 | -8 7 | from . import renamed as bees # F401: recommend add to all w/o fix - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. __init__.py:8:26: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | @@ -24,13 +15,3 @@ __init__.py:8:26: F401 [*] `.renamed` imported but unused; consider removing, ad | ^^^^ F401 | = help: Remove unused import: `.renamed` - -5 5 | from . import unused # F401: recommend add to all w/o fix -6 6 | -7 7 | -8 |-from . import renamed as bees # F401: recommend add to all w/o fix -9 8 | -10 9 | -11 10 | __all__ = None - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_28__all_multiple____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_28__all_multiple____init__.py.snap index ac9a2d4e23082..7aa09cf69f0d2 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_28__all_multiple____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_28__all_multiple____init__.py.snap @@ -8,15 +8,6 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add | = help: Remove unused import -2 2 | """ -3 3 | -4 4 | -5 |-from . import unused, renamed as bees # F401: add to __all__ -6 5 | -7 6 | -8 7 | __all__ = []; - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. __init__.py:5:34: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | @@ -24,13 +15,3 @@ __init__.py:5:34: F401 [*] `.renamed` imported but unused; consider removing, ad | ^^^^ F401 | = help: Remove unused import - -2 2 | """ -3 3 | -4 4 | -5 |-from . import unused, renamed as bees # F401: add to __all__ -6 5 | -7 6 | -8 7 | __all__ = []; - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap index 512b4c8b24156..63c15f7c5b52a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_29__all_conditional____init__.py.snap @@ -12,16 +12,6 @@ __init__.py:8:15: F401 [*] `.unused` imported but unused; consider removing, add | = help: Remove unused import -5 5 | -6 6 | import sys -7 7 | -8 |-from . import unused, exported, renamed as bees - 8 |+from . import exported -9 9 | -10 10 | if sys.version_info > (3, 9): -11 11 | from . import also_exported - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. __init__.py:8:44: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | @@ -33,14 +23,3 @@ __init__.py:8:44: F401 [*] `.renamed` imported but unused; consider removing, ad 10 | if sys.version_info > (3, 9): | = help: Remove unused import - -5 5 | -6 6 | import sys -7 7 | -8 |-from . import unused, exported, renamed as bees - 8 |+from . import exported -9 9 | -10 10 | if sys.version_info > (3, 9): -11 11 | from . import also_exported - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap index d267993acb4dc..8753443a6c432 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap @@ -76,15 +76,6 @@ F601.py:18:5: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -15 15 | "a": 1, -16 16 | "a": 2, -17 17 | "a": 3, -18 |- "a": 3, -19 18 | } -20 19 | -21 20 | x = { - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F601.py:23:5: F601 Dictionary key literal `"a"` repeated | @@ -119,15 +110,6 @@ F601.py:25:5: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -22 22 | "a": 1, -23 23 | "a": 2, -24 24 | "a": 3, -25 |- "a": 3, -26 25 | "a": 4, -27 26 | } -28 27 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F601.py:26:5: F601 Dictionary key literal `"a"` repeated | @@ -150,15 +132,6 @@ F601.py:31:5: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -28 28 | -29 29 | x = { -30 30 | "a": 1, -31 |- "a": 1, -32 31 | "a": 2, -33 32 | "a": 3, -34 33 | "a": 4, - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F601.py:32:5: F601 Dictionary key literal `"a"` repeated | @@ -225,15 +198,6 @@ F601.py:45:5: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -42 42 | a: 2, -43 43 | "a": 3, -44 44 | a: 3, -45 |- "a": 3, -46 45 | a: 4, -47 46 | } -48 47 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F601.py:49:14: F601 [*] Dictionary key literal `"a"` repeated | @@ -245,16 +209,6 @@ F601.py:49:14: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -46 46 | a: 4, -47 47 | } -48 48 | -49 |-x = {"a": 1, "a": 1} - 49 |+x = {"a": 1} -50 50 | x = {"a": 1, "b": 2, "a": 1} -51 51 | -52 52 | x = { - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F601.py:50:22: F601 [*] Dictionary key literal `"a"` repeated | @@ -266,16 +220,6 @@ F601.py:50:22: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -47 47 | } -48 48 | -49 49 | x = {"a": 1, "a": 1} -50 |-x = {"a": 1, "b": 2, "a": 1} - 50 |+x = {"a": 1, "b": 2} -51 51 | -52 52 | x = { -53 53 | ('a', 'b'): 'asdf', - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F601.py:54:5: F601 Dictionary key literal `('a', 'b')` repeated | @@ -297,15 +241,6 @@ F601.py:58:19: F601 [*] Dictionary key literal `"x"` repeated | = help: Remove repeated key literal `"x"` -55 55 | } -56 56 | -57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/4897 -58 |-t={"x":"test123", "x":("test123")} - 58 |+t={"x":"test123"} -59 59 | -60 60 | t={"x":("test123"), "x":"test123"} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F601.py:60:21: F601 [*] Dictionary key literal `"x"` repeated | @@ -315,11 +250,3 @@ F601.py:60:21: F601 [*] Dictionary key literal `"x"` repeated | ^^^ F601 | = help: Remove repeated key literal `"x"` - -57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/4897 -58 58 | t={"x":"test123", "x":("test123")} -59 59 | -60 |-t={"x":("test123"), "x":"test123"} - 60 |+t={"x":("test123")} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap index 9a2106b0fbaee..11b9b09e5ee01 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap @@ -44,15 +44,6 @@ F602.py:13:5: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -10 10 | a: 1, -11 11 | a: 2, -12 12 | a: 3, -13 |- a: 3, -14 13 | } -15 14 | -16 15 | x = { - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F602.py:18:5: F602 Dictionary key `a` repeated | @@ -87,15 +78,6 @@ F602.py:20:5: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -17 17 | a: 1, -18 18 | a: 2, -19 19 | a: 3, -20 |- a: 3, -21 20 | a: 4, -22 21 | } -23 22 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F602.py:21:5: F602 Dictionary key `a` repeated | @@ -118,15 +100,6 @@ F602.py:26:5: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -23 23 | -24 24 | x = { -25 25 | a: 1, -26 |- a: 1, -27 26 | a: 2, -28 27 | a: 3, -29 28 | a: 4, - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F602.py:27:5: F602 Dictionary key `a` repeated | @@ -171,15 +144,6 @@ F602.py:35:5: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -32 32 | x = { -33 33 | a: 1, -34 34 | "a": 1, -35 |- a: 1, -36 35 | "a": 2, -37 36 | a: 2, -38 37 | "a": 3, - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F602.py:37:5: F602 Dictionary key `a` repeated | @@ -223,14 +187,6 @@ F602.py:44:12: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -41 41 | a: 4, -42 42 | } -43 43 | -44 |-x = {a: 1, a: 1} - 44 |+x = {a: 1} -45 45 | x = {a: 1, b: 2, a: 1} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F602.py:45:18: F602 [*] Dictionary key `a` repeated | @@ -239,11 +195,3 @@ F602.py:45:18: F602 [*] Dictionary key `a` repeated | ^ F602 | = help: Remove repeated key `a` - -42 42 | } -43 43 | -44 44 | x = {a: 1, a: 1} -45 |-x = {a: 1, b: 2, a: 1} - 45 |+x = {a: 1, b: 2} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap index 910448f67bd5a..fc2ab324ace41 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap @@ -30,16 +30,6 @@ F841_0.py:16:5: F841 [*] Local variable `z` is assigned to but never used | = help: Remove assignment to unused variable `z` -13 13 | def f(): -14 14 | x = 1 -15 15 | y = 2 -16 |- z = x + y - 16 |+ x + y -17 17 | -18 18 | -19 19 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used | @@ -50,15 +40,6 @@ F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used | = help: Remove assignment to unused variable `foo` -17 17 | -18 18 | -19 19 | def f(): -20 |- foo = (1, 2) -21 20 | (a, b) = (1, 2) -22 21 | -23 22 | bar = (1, 2) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:21:6: F841 [*] Local variable `a` is assigned to but never used | @@ -71,16 +52,6 @@ F841_0.py:21:6: F841 [*] Local variable `a` is assigned to but never used | = help: Remove assignment to unused variable `a` -18 18 | -19 19 | def f(): -20 20 | foo = (1, 2) -21 |- (a, b) = (1, 2) - 21 |+ (_a, b) = (1, 2) -22 22 | -23 23 | bar = (1, 2) -24 24 | (c, d) = bar - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:21:9: F841 [*] Local variable `b` is assigned to but never used | @@ -93,16 +64,6 @@ F841_0.py:21:9: F841 [*] Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -18 18 | -19 19 | def f(): -20 20 | foo = (1, 2) -21 |- (a, b) = (1, 2) - 21 |+ (a, _b) = (1, 2) -22 22 | -23 23 | bar = (1, 2) -24 24 | (c, d) = bar - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used | @@ -113,16 +74,6 @@ F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used | = help: Remove assignment to unused variable `baz` -23 23 | bar = (1, 2) -24 24 | (c, d) = bar -25 25 | -26 |- (x, y) = baz = bar - 26 |+ (x, y) = bar -27 27 | -28 28 | -29 29 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used | @@ -135,16 +86,6 @@ F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -48 48 | -49 49 | def c(): -50 50 | # F841 -51 |- b = 1 - 51 |+ pass -52 52 | -53 53 | def d(): -54 54 | nonlocal b - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used | @@ -155,16 +96,6 @@ F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used | = help: Remove assignment to unused variable `my_file` -76 76 | -77 77 | -78 78 | def f(): -79 |- with open("file") as my_file, open("") as ((this, that)): - 79 |+ with open("file"), open("") as ((this, that)): -80 80 | print("hello") -81 81 | -82 82 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used | @@ -177,16 +108,6 @@ F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used | = help: Remove assignment to unused variable `my_file` -82 82 | -83 83 | def f(): -84 84 | with ( -85 |- open("file") as my_file, - 85 |+ open("file"), -86 86 | open("") as ((this, that)), -87 87 | ): -88 88 | print("hello") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used | @@ -199,15 +120,6 @@ F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used | = help: Remove assignment to unused variable `msg3` -99 99 | def f(x: int): -100 100 | msg1 = "Hello, world!" -101 101 | msg2 = "Hello, world!" -102 |- msg3 = "Hello, world!" -103 102 | match x: -104 103 | case 1: -105 104 | print(msg1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used | @@ -220,16 +132,6 @@ F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used | = help: Remove assignment to unused variable `Baz` -112 112 | -113 113 | Foo = enum.Enum("Foo", "A B") -114 114 | Bar = enum.Enum("Bar", "A B") -115 |- Baz = enum.Enum("Baz", "A B") - 115 |+ enum.Enum("Baz", "A B") -116 116 | -117 117 | match x: -118 118 | case (Foo.A): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:122:14: F841 Local variable `y` is assigned to but never used | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap index 3305f378e0027..794cb9362322b 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap @@ -9,16 +9,6 @@ F841_1.py:6:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -3 3 | -4 4 | -5 5 | def f(): -6 |- x, y = 1, 2 # this triggers F841 as it's just a simple assignment where unpacking isn't needed - 6 |+ _x, y = 1, 2 # this triggers F841 as it's just a simple assignment where unpacking isn't needed -7 7 | -8 8 | -9 9 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_1.py:6:8: F841 [*] Local variable `y` is assigned to but never used | @@ -28,16 +18,6 @@ F841_1.py:6:8: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -3 3 | -4 4 | -5 5 | def f(): -6 |- x, y = 1, 2 # this triggers F841 as it's just a simple assignment where unpacking isn't needed - 6 |+ x, _y = 1, 2 # this triggers F841 as it's just a simple assignment where unpacking isn't needed -7 7 | -8 8 | -9 9 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_1.py:16:14: F841 [*] Local variable `coords` is assigned to but never used | @@ -47,16 +27,6 @@ F841_1.py:16:14: F841 [*] Local variable `coords` is assigned to but never used | = help: Remove assignment to unused variable `coords` -13 13 | -14 14 | -15 15 | def f(): -16 |- (x, y) = coords = 1, 2 - 16 |+ (x, y) = 1, 2 -17 17 | -18 18 | -19 19 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_1.py:20:5: F841 [*] Local variable `coords` is assigned to but never used | @@ -66,16 +36,6 @@ F841_1.py:20:5: F841 [*] Local variable `coords` is assigned to but never used | = help: Remove assignment to unused variable `coords` -17 17 | -18 18 | -19 19 | def f(): -20 |- coords = (x, y) = 1, 2 - 20 |+ (x, y) = 1, 2 -21 21 | -22 22 | -23 23 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_1.py:24:6: F841 [*] Local variable `a` is assigned to but never used | @@ -85,13 +45,6 @@ F841_1.py:24:6: F841 [*] Local variable `a` is assigned to but never used | = help: Remove assignment to unused variable `a` -21 21 | -22 22 | -23 23 | def f(): -24 |- (a, b) = (x, y) = 1, 2 # this triggers F841 on everything - 24 |+ (_a, b) = (x, y) = 1, 2 # this triggers F841 on everything - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_1.py:24:9: F841 [*] Local variable `b` is assigned to but never used | @@ -101,13 +54,6 @@ F841_1.py:24:9: F841 [*] Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -21 21 | -22 22 | -23 23 | def f(): -24 |- (a, b) = (x, y) = 1, 2 # this triggers F841 on everything - 24 |+ (a, _b) = (x, y) = 1, 2 # this triggers F841 on everything - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_1.py:24:15: F841 [*] Local variable `x` is assigned to but never used | @@ -117,13 +63,6 @@ F841_1.py:24:15: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -21 21 | -22 22 | -23 23 | def f(): -24 |- (a, b) = (x, y) = 1, 2 # this triggers F841 on everything - 24 |+ (a, b) = (_x, y) = 1, 2 # this triggers F841 on everything - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_1.py:24:18: F841 [*] Local variable `y` is assigned to but never used | @@ -132,11 +71,3 @@ F841_1.py:24:18: F841 [*] Local variable `y` is assigned to but never used | ^ F841 | = help: Remove assignment to unused variable `y` - -21 21 | -22 22 | -23 23 | def f(): -24 |- (a, b) = (x, y) = 1, 2 # this triggers F841 on everything - 24 |+ (a, b) = (x, _y) = 1, 2 # this triggers F841 on everything - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap index 7303a4da8772d..5b97b8265db6a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap @@ -10,15 +10,6 @@ F841_3.py:5:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -2 2 | -3 3 | -4 4 | def f(): -5 |- x = 1 -6 5 | y = 2 -7 6 | -8 7 | z = 3 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:6:5: F841 [*] Local variable `y` is assigned to but never used | @@ -31,15 +22,6 @@ F841_3.py:6:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -3 3 | -4 4 | def f(): -5 5 | x = 1 -6 |- y = 2 -7 6 | -8 7 | z = 3 -9 8 | print(z) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:13:5: F841 [*] Local variable `x` is assigned to but never used | @@ -50,15 +32,6 @@ F841_3.py:13:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -10 10 | -11 11 | -12 12 | def f(): -13 |- x: int = 1 -14 13 | y: int = 2 -15 14 | -16 15 | z: int = 3 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:14:5: F841 [*] Local variable `y` is assigned to but never used | @@ -71,15 +44,6 @@ F841_3.py:14:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -11 11 | -12 12 | def f(): -13 13 | x: int = 1 -14 |- y: int = 2 -15 14 | -16 15 | z: int = 3 -17 16 | print(z) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:21:19: F841 [*] Local variable `x1` is assigned to but never used | @@ -90,16 +54,6 @@ F841_3.py:21:19: F841 [*] Local variable `x1` is assigned to but never used | = help: Remove assignment to unused variable `x1` -18 18 | -19 19 | -20 20 | def f(): -21 |- with foo() as x1: - 21 |+ with foo(): -22 22 | pass -23 23 | -24 24 | with foo() as (x2, y2): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:27:20: F841 [*] Local variable `x3` is assigned to but never used | @@ -111,16 +65,6 @@ F841_3.py:27:20: F841 [*] Local variable `x3` is assigned to but never used | = help: Remove assignment to unused variable `x3` -24 24 | with foo() as (x2, y2): -25 25 | pass -26 26 | -27 |- with (foo() as x3, foo() as y3, foo() as z3): - 27 |+ with (foo(), foo() as y3, foo() as z3): -28 28 | pass -29 29 | -30 30 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:27:33: F841 [*] Local variable `y3` is assigned to but never used | @@ -132,16 +76,6 @@ F841_3.py:27:33: F841 [*] Local variable `y3` is assigned to but never used | = help: Remove assignment to unused variable `y3` -24 24 | with foo() as (x2, y2): -25 25 | pass -26 26 | -27 |- with (foo() as x3, foo() as y3, foo() as z3): - 27 |+ with (foo() as x3, foo(), foo() as z3): -28 28 | pass -29 29 | -30 30 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:27:46: F841 [*] Local variable `z3` is assigned to but never used | @@ -153,16 +87,6 @@ F841_3.py:27:46: F841 [*] Local variable `z3` is assigned to but never used | = help: Remove assignment to unused variable `z3` -24 24 | with foo() as (x2, y2): -25 25 | pass -26 26 | -27 |- with (foo() as x3, foo() as y3, foo() as z3): - 27 |+ with (foo() as x3, foo() as y3, foo()): -28 28 | pass -29 29 | -30 30 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:32:6: F841 [*] Local variable `x1` is assigned to but never used | @@ -174,16 +98,6 @@ F841_3.py:32:6: F841 [*] Local variable `x1` is assigned to but never used | = help: Remove assignment to unused variable `x1` -29 29 | -30 30 | -31 31 | def f(): -32 |- (x1, y1) = (1, 2) - 32 |+ (_x1, y1) = (1, 2) -33 33 | (x2, y2) = coords2 = (1, 2) -34 34 | coords3 = (x3, y3) = (1, 2) -35 35 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:32:10: F841 [*] Local variable `y1` is assigned to but never used | @@ -195,16 +109,6 @@ F841_3.py:32:10: F841 [*] Local variable `y1` is assigned to but never used | = help: Remove assignment to unused variable `y1` -29 29 | -30 30 | -31 31 | def f(): -32 |- (x1, y1) = (1, 2) - 32 |+ (x1, _y1) = (1, 2) -33 33 | (x2, y2) = coords2 = (1, 2) -34 34 | coords3 = (x3, y3) = (1, 2) -35 35 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:33:16: F841 [*] Local variable `coords2` is assigned to but never used | @@ -216,16 +120,6 @@ F841_3.py:33:16: F841 [*] Local variable `coords2` is assigned to but never used | = help: Remove assignment to unused variable `coords2` -30 30 | -31 31 | def f(): -32 32 | (x1, y1) = (1, 2) -33 |- (x2, y2) = coords2 = (1, 2) - 33 |+ (x2, y2) = (1, 2) -34 34 | coords3 = (x3, y3) = (1, 2) -35 35 | -36 36 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:34:5: F841 [*] Local variable `coords3` is assigned to but never used | @@ -236,16 +130,6 @@ F841_3.py:34:5: F841 [*] Local variable `coords3` is assigned to but never used | = help: Remove assignment to unused variable `coords3` -31 31 | def f(): -32 32 | (x1, y1) = (1, 2) -33 33 | (x2, y2) = coords2 = (1, 2) -34 |- coords3 = (x3, y3) = (1, 2) - 34 |+ (x3, y3) = (1, 2) -35 35 | -36 36 | -37 37 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:40:26: F841 [*] Local variable `x1` is assigned to but never used | @@ -299,16 +183,6 @@ F841_3.py:50:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -47 47 | -48 48 | -49 49 | def f(a, b): -50 |- x = ( - 50 |+ ( -51 51 | a() -52 52 | if a is not None -53 53 | else b - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:56:5: F841 [*] Local variable `y` is assigned to but never used | @@ -320,17 +194,6 @@ F841_3.py:56:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -53 53 | else b -54 54 | ) -55 55 | -56 |- y = \ -57 |- a() if a is not None else b - 56 |+ a() if a is not None else b -58 57 | -59 58 | -60 59 | def f(a, b): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:61:5: F841 [*] Local variable `x` is assigned to but never used | @@ -342,19 +205,6 @@ F841_3.py:61:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -58 58 | -59 59 | -60 60 | def f(a, b): -61 |- x = ( -62 |- a -63 |- if a is not None -64 |- else b -65 |- ) -66 61 | -67 62 | y = \ -68 63 | a if a is not None else b - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:67:5: F841 [*] Local variable `y` is assigned to but never used | @@ -366,16 +216,6 @@ F841_3.py:67:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -64 64 | else b -65 65 | ) -66 66 | -67 |- y = \ -68 |- a if a is not None else b -69 67 | -70 68 | -71 69 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:72:24: F841 [*] Local variable `cm` is assigned to but never used | @@ -386,16 +226,6 @@ F841_3.py:72:24: F841 [*] Local variable `cm` is assigned to but never used | = help: Remove assignment to unused variable `cm` -69 69 | -70 70 | -71 71 | def f(): -72 |- with Nested(m) as (cm): - 72 |+ with Nested(m): -73 73 | pass -74 74 | -75 75 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:77:25: F841 [*] Local variable `cm` is assigned to but never used | @@ -406,16 +236,6 @@ F841_3.py:77:25: F841 [*] Local variable `cm` is assigned to but never used | = help: Remove assignment to unused variable `cm` -74 74 | -75 75 | -76 76 | def f(): -77 |- with (Nested(m) as (cm),): - 77 |+ with (Nested(m),): -78 78 | pass -79 79 | -80 80 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:87:26: F841 [*] Local variable `cm` is assigned to but never used | @@ -426,16 +246,6 @@ F841_3.py:87:26: F841 [*] Local variable `cm` is assigned to but never used | = help: Remove assignment to unused variable `cm` -84 84 | -85 85 | -86 86 | def f(): -87 |- with (Nested(m)) as (cm): - 87 |+ with (Nested(m)): -88 88 | pass -89 89 | -90 90 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:92:5: F841 [*] Local variable `toplevel` is assigned to but never used | @@ -447,16 +257,6 @@ F841_3.py:92:5: F841 [*] Local variable `toplevel` is assigned to but never used | = help: Remove assignment to unused variable `toplevel` -89 89 | -90 90 | -91 91 | def f(): -92 |- toplevel = tt = lexer.get_token() - 92 |+ tt = lexer.get_token() -93 93 | if not tt: -94 94 | break -95 95 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:98:5: F841 [*] Local variable `toplevel` is assigned to but never used | @@ -466,16 +266,6 @@ F841_3.py:98:5: F841 [*] Local variable `toplevel` is assigned to but never used | = help: Remove assignment to unused variable `toplevel` -95 95 | -96 96 | -97 97 | def f(): -98 |- toplevel = tt = lexer.get_token() - 98 |+ tt = lexer.get_token() -99 99 | -100 100 | -101 101 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:98:16: F841 [*] Local variable `tt` is assigned to but never used | @@ -485,16 +275,6 @@ F841_3.py:98:16: F841 [*] Local variable `tt` is assigned to but never used | = help: Remove assignment to unused variable `tt` -95 95 | -96 96 | -97 97 | def f(): -98 |- toplevel = tt = lexer.get_token() - 98 |+ toplevel = lexer.get_token() -99 99 | -100 100 | -101 101 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:102:5: F841 [*] Local variable `toplevel` is assigned to but never used | @@ -504,16 +284,6 @@ F841_3.py:102:5: F841 [*] Local variable `toplevel` is assigned to but never use | = help: Remove assignment to unused variable `toplevel` -99 99 | -100 100 | -101 101 | def f(): -102 |- toplevel = (a, b) = lexer.get_token() - 102 |+ (a, b) = lexer.get_token() -103 103 | -104 104 | -105 105 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:106:14: F841 [*] Local variable `toplevel` is assigned to but never used | @@ -523,16 +293,6 @@ F841_3.py:106:14: F841 [*] Local variable `toplevel` is assigned to but never us | = help: Remove assignment to unused variable `toplevel` -103 103 | -104 104 | -105 105 | def f(): -106 |- (a, b) = toplevel = lexer.get_token() - 106 |+ (a, b) = lexer.get_token() -107 107 | -108 108 | -109 109 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:110:5: F841 [*] Local variable `toplevel` is assigned to but never used | @@ -542,16 +302,6 @@ F841_3.py:110:5: F841 [*] Local variable `toplevel` is assigned to but never use | = help: Remove assignment to unused variable `toplevel` -107 107 | -108 108 | -109 109 | def f(): -110 |- toplevel = tt = 1 - 110 |+ tt = 1 -111 111 | -112 112 | -113 113 | def f(provided: int) -> int: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:110:16: F841 [*] Local variable `tt` is assigned to but never used | @@ -561,16 +311,6 @@ F841_3.py:110:16: F841 [*] Local variable `tt` is assigned to but never used | = help: Remove assignment to unused variable `tt` -107 107 | -108 108 | -109 109 | def f(): -110 |- toplevel = tt = 1 - 110 |+ toplevel = 1 -111 111 | -112 112 | -113 113 | def f(provided: int) -> int: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:115:19: F841 Local variable `x` is assigned to but never used | @@ -662,15 +402,6 @@ F841_3.py:160:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -157 157 | -158 158 | -159 159 | def f(): -160 |- x = 1 -161 160 | y = 2 -162 161 | -163 162 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:161:5: F841 [*] Local variable `y` is assigned to but never used | @@ -681,15 +412,6 @@ F841_3.py:161:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -158 158 | -159 159 | def f(): -160 160 | x = 1 -161 |- y = 2 -162 161 | -163 162 | -164 163 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:165:5: F841 [*] Local variable `x` is assigned to but never used | @@ -701,15 +423,6 @@ F841_3.py:165:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -162 162 | -163 163 | -164 164 | def f(): -165 |- x = 1 -166 165 | -167 166 | y = 2 -168 167 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:167:5: F841 [*] Local variable `y` is assigned to but never used | @@ -720,15 +433,6 @@ F841_3.py:167:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -164 164 | def f(): -165 165 | x = 1 -166 166 | -167 |- y = 2 -168 167 | -169 168 | -170 169 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_3.py:173:6: F841 [*] Local variable `x` is assigned to but never used | @@ -738,11 +442,3 @@ F841_3.py:173:6: F841 [*] Local variable `x` is assigned to but never used | ^ F841 | = help: Remove assignment to unused variable `x` - -170 170 | def f(): -171 171 | (x) = foo() -172 172 | ((x)) = foo() -173 |- (x) = (y.z) = foo() - 173 |+ (y.z) = foo() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_4.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_4.py.snap index 6b5fec942c19b..e6a1740cc8f93 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_4.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_4.py.snap @@ -9,14 +9,3 @@ F841_4.py:12:5: F841 [*] Local variable `a` is assigned to but never used 13 | b, c = foo() | = help: Remove assignment to unused variable `a` - -9 9 | -10 10 | -11 11 | def bar(): -12 |- a = foo() - 12 |+ foo() -13 13 | b, c = foo() -14 14 | -15 15 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap index a43e9903f68ee..32cbf13f77bf2 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap @@ -30,15 +30,6 @@ F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used | = help: Remove assignment to unused variable `foo` -17 17 | -18 18 | -19 19 | def f(): -20 |- foo = (1, 2) -21 20 | (a, b) = (1, 2) -22 21 | -23 22 | bar = (1, 2) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:21:6: F841 Local variable `a` is assigned to but never used | @@ -71,16 +62,6 @@ F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used | = help: Remove assignment to unused variable `baz` -23 23 | bar = (1, 2) -24 24 | (c, d) = bar -25 25 | -26 |- (x, y) = baz = bar - 26 |+ (x, y) = bar -27 27 | -28 28 | -29 29 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:35:5: F841 [*] Local variable `_` is assigned to but never used | @@ -92,15 +73,6 @@ F841_0.py:35:5: F841 [*] Local variable `_` is assigned to but never used | = help: Remove assignment to unused variable `_` -32 32 | -33 33 | -34 34 | def f(): -35 |- _ = 1 -36 35 | __ = 1 -37 36 | _discarded = 1 -38 37 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:36:5: F841 [*] Local variable `__` is assigned to but never used | @@ -112,15 +84,6 @@ F841_0.py:36:5: F841 [*] Local variable `__` is assigned to but never used | = help: Remove assignment to unused variable `__` -33 33 | -34 34 | def f(): -35 35 | _ = 1 -36 |- __ = 1 -37 36 | _discarded = 1 -38 37 | -39 38 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:37:5: F841 [*] Local variable `_discarded` is assigned to but never used | @@ -131,15 +94,6 @@ F841_0.py:37:5: F841 [*] Local variable `_discarded` is assigned to but never us | = help: Remove assignment to unused variable `_discarded` -34 34 | def f(): -35 35 | _ = 1 -36 36 | __ = 1 -37 |- _discarded = 1 -38 37 | -39 38 | -40 39 | a = 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used | @@ -152,16 +106,6 @@ F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -48 48 | -49 49 | def c(): -50 50 | # F841 -51 |- b = 1 - 51 |+ pass -52 52 | -53 53 | def d(): -54 54 | nonlocal b - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used | @@ -172,16 +116,6 @@ F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used | = help: Remove assignment to unused variable `my_file` -76 76 | -77 77 | -78 78 | def f(): -79 |- with open("file") as my_file, open("") as ((this, that)): - 79 |+ with open("file"), open("") as ((this, that)): -80 80 | print("hello") -81 81 | -82 82 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used | @@ -194,16 +128,6 @@ F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used | = help: Remove assignment to unused variable `my_file` -82 82 | -83 83 | def f(): -84 84 | with ( -85 |- open("file") as my_file, - 85 |+ open("file"), -86 86 | open("") as ((this, that)), -87 87 | ): -88 88 | print("hello") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used | @@ -216,15 +140,6 @@ F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used | = help: Remove assignment to unused variable `msg3` -99 99 | def f(x: int): -100 100 | msg1 = "Hello, world!" -101 101 | msg2 = "Hello, world!" -102 |- msg3 = "Hello, world!" -103 102 | match x: -104 103 | case 1: -105 104 | print(msg1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used | @@ -237,16 +152,6 @@ F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used | = help: Remove assignment to unused variable `Baz` -112 112 | -113 113 | Foo = enum.Enum("Foo", "A B") -114 114 | Bar = enum.Enum("Bar", "A B") -115 |- Baz = enum.Enum("Baz", "A B") - 115 |+ enum.Enum("Baz", "A B") -116 116 | -117 117 | match x: -118 118 | case (Foo.A): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_0.py:122:14: F841 Local variable `y` is assigned to but never used | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap index 7fd26d08d0014..7db672fa365f9 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap @@ -8,15 +8,6 @@ __init__.py:19:8: F401 [*] `sys` imported but unused | = help: Remove unused import: `sys` -16 16 | import argparse as argparse # Ok: is redundant alias -17 17 | -18 18 | -19 |-import sys # F401: remove unused -20 19 | -21 20 | -22 21 | # first-party - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. __init__.py:33:15: F401 [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap index fe6739b2b8ab1..469df4739b5a6 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap @@ -8,15 +8,6 @@ __init__.py:19:8: F401 [*] `sys` imported but unused | = help: Remove unused import: `sys` -16 16 | import argparse # Ok: is exported in __all__ -17 17 | -18 18 | -19 |-import sys # F401: remove unused -20 19 | -21 20 | -22 21 | # first-party - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. __init__.py:36:15: F401 [*] `.unused` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap index e681c520ee19e..31a2481f70d0d 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401___init__.py.snap @@ -9,10 +9,3 @@ __init__.py:1:8: F401 [*] `os` imported but unused 3 | print(__path__) | = help: Remove unused import: `os` - -1 |-import os -2 1 | -3 2 | print(__path__) -4 3 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F841_F841_4.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F841_F841_4.py.snap index 3721c0f11197a..370937670942c 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F841_F841_4.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F841_F841_4.py.snap @@ -10,16 +10,6 @@ F841_4.py:12:5: F841 [*] Local variable `a` is assigned to but never used | = help: Remove assignment to unused variable `a` -9 9 | -10 10 | -11 11 | def bar(): -12 |- a = foo() - 12 |+ foo() -13 13 | b, c = foo() -14 14 | -15 15 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_4.py:13:5: F841 [*] Local variable `b` is assigned to but never used | @@ -30,16 +20,6 @@ F841_4.py:13:5: F841 [*] Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -10 10 | -11 11 | def bar(): -12 12 | a = foo() -13 |- b, c = foo() - 13 |+ _b, c = foo() -14 14 | -15 15 | -16 16 | def baz(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. F841_4.py:13:8: F841 [*] Local variable `c` is assigned to but never used | @@ -49,14 +29,3 @@ F841_4.py:13:8: F841 [*] Local variable `c` is assigned to but never used | ^ F841 | = help: Remove assignment to unused variable `c` - -10 10 | -11 11 | def bar(): -12 12 | a = foo() -13 |- b, c = foo() - 13 |+ b, _c = foo() -14 14 | -15 15 | -16 16 | def baz(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap index dbc0738a24f3c..a823ff66b50e2 100644 --- a/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap +++ b/crates/ruff_linter/src/rules/pygrep_hooks/snapshots/ruff_linter__rules__pygrep_hooks__tests__PGH004_PGH004_0.py.snap @@ -39,16 +39,6 @@ PGH004_0.py:18:8: PGH004 [*] Use a colon when specifying `noqa` rule codes | = help: Add missing colon -15 15 | x = 2 # noqa:X100 -16 16 | -17 17 | # PGH004 -18 |-x = 2 # noqa X100 - 18 |+x = 2 # noqa: X100 -19 19 | -20 20 | # PGH004 -21 21 | x = 2 # noqa X100, X200 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PGH004_0.py:21:8: PGH004 [*] Use a colon when specifying `noqa` rule codes | @@ -60,16 +50,6 @@ PGH004_0.py:21:8: PGH004 [*] Use a colon when specifying `noqa` rule codes | = help: Add missing colon -18 18 | x = 2 # noqa X100 -19 19 | -20 20 | # PGH004 -21 |-x = 2 # noqa X100, X200 - 21 |+x = 2 # noqa: X100, X200 -22 22 | -23 23 | # PGH004 -24 24 | x = 2 # noqa : X300 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PGH004_0.py:24:8: PGH004 [*] Do not add spaces between `noqa` and its colon | @@ -81,16 +61,6 @@ PGH004_0.py:24:8: PGH004 [*] Do not add spaces between `noqa` and its colon | = help: Remove space(s) before colon -21 21 | x = 2 # noqa X100, X200 -22 22 | -23 23 | # PGH004 -24 |-x = 2 # noqa : X300 - 24 |+x = 2 # noqa: X300 -25 25 | -26 26 | # PGH004 -27 27 | x = 2 # noqa : X400 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PGH004_0.py:27:8: PGH004 [*] Do not add spaces between `noqa` and its colon | @@ -102,16 +72,6 @@ PGH004_0.py:27:8: PGH004 [*] Do not add spaces between `noqa` and its colon | = help: Remove space(s) before colon -24 24 | x = 2 # noqa : X300 -25 25 | -26 26 | # PGH004 -27 |-x = 2 # noqa : X400 - 27 |+x = 2 # noqa: X400 -28 28 | -29 29 | # PGH004 -30 30 | x = 2 # noqa :X500 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. PGH004_0.py:30:8: PGH004 [*] Do not add spaces between `noqa` and its colon | @@ -120,11 +80,3 @@ PGH004_0.py:30:8: PGH004 [*] Do not add spaces between `noqa` and its colon | ^^^^^^^ PGH004 | = help: Remove space(s) before colon - -27 27 | x = 2 # noqa : X400 -28 28 | -29 29 | # PGH004 -30 |-x = 2 # noqa :X500 - 30 |+x = 2 # noqa:X500 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap index f6a51062ea01e..c010c9579a54a 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap @@ -12,16 +12,6 @@ import_aliasing.py:6:8: PLC0414 [*] Import alias does not rename original packag | = help: Remove import alias -3 3 | # 1. useless-import-alias -4 4 | # 2. consider-using-from-import -5 5 | -6 |-import collections as collections # [useless-import-alias] - 6 |+import collections # [useless-import-alias] -7 7 | from collections import OrderedDict as OrderedDict # [useless-import-alias] -8 8 | from collections import OrderedDict as o_dict -9 9 | import os.path as path # [consider-using-from-import] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. import_aliasing.py:7:25: PLC0414 [*] Import alias does not rename original package | @@ -33,16 +23,6 @@ import_aliasing.py:7:25: PLC0414 [*] Import alias does not rename original packa | = help: Remove import alias -4 4 | # 2. consider-using-from-import -5 5 | -6 6 | import collections as collections # [useless-import-alias] -7 |-from collections import OrderedDict as OrderedDict # [useless-import-alias] - 7 |+from collections import OrderedDict # [useless-import-alias] -8 8 | from collections import OrderedDict as o_dict -9 9 | import os.path as path # [consider-using-from-import] -10 10 | import os.path as p - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. import_aliasing.py:16:15: PLC0414 [*] Import alias does not rename original package | @@ -55,16 +35,6 @@ import_aliasing.py:16:15: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -13 13 | import os -14 14 | import os as OS -15 15 | from sys import version -16 |-from . import bar as bar # [useless-import-alias] - 16 |+from . import bar # [useless-import-alias] -17 17 | from . import bar as Bar -18 18 | from . import bar -19 19 | from ..foo import bar as bar # [useless-import-alias] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. import_aliasing.py:19:19: PLC0414 [*] Import alias does not rename original package | @@ -77,16 +47,6 @@ import_aliasing.py:19:19: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -16 16 | from . import bar as bar # [useless-import-alias] -17 17 | from . import bar as Bar -18 18 | from . import bar -19 |-from ..foo import bar as bar # [useless-import-alias] - 19 |+from ..foo import bar # [useless-import-alias] -20 20 | from ..foo.bar import foobar as foobar # [useless-import-alias] -21 21 | from ..foo.bar import foobar as anotherfoobar -22 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. import_aliasing.py:20:23: PLC0414 [*] Import alias does not rename original package | @@ -99,16 +59,6 @@ import_aliasing.py:20:23: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -17 17 | from . import bar as Bar -18 18 | from . import bar -19 19 | from ..foo import bar as bar # [useless-import-alias] -20 |-from ..foo.bar import foobar as foobar # [useless-import-alias] - 20 |+from ..foo.bar import foobar # [useless-import-alias] -21 21 | from ..foo.bar import foobar as anotherfoobar -22 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] -23 23 | from . import foo as bar, foo2 as foo2 # [useless-import-alias] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. import_aliasing.py:22:15: PLC0414 [*] Import alias does not rename original package | @@ -121,16 +71,6 @@ import_aliasing.py:22:15: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -19 19 | from ..foo import bar as bar # [useless-import-alias] -20 20 | from ..foo.bar import foobar as foobar # [useless-import-alias] -21 21 | from ..foo.bar import foobar as anotherfoobar -22 |-from . import foo as foo, foo2 as bar2 # [useless-import-alias] - 22 |+from . import foo, foo2 as bar2 # [useless-import-alias] -23 23 | from . import foo as bar, foo2 as foo2 # [useless-import-alias] -24 24 | from . import foo as bar, foo2 as bar2 -25 25 | from foo.bar import foobar as foobar # [useless-import-alias] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. import_aliasing.py:23:27: PLC0414 [*] Import alias does not rename original package | @@ -143,16 +83,6 @@ import_aliasing.py:23:27: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -20 20 | from ..foo.bar import foobar as foobar # [useless-import-alias] -21 21 | from ..foo.bar import foobar as anotherfoobar -22 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] -23 |-from . import foo as bar, foo2 as foo2 # [useless-import-alias] - 23 |+from . import foo as bar, foo2 # [useless-import-alias] -24 24 | from . import foo as bar, foo2 as bar2 -25 25 | from foo.bar import foobar as foobar # [useless-import-alias] -26 26 | from foo.bar import foobar as foo - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. import_aliasing.py:25:21: PLC0414 [*] Import alias does not rename original package | @@ -164,14 +94,3 @@ import_aliasing.py:25:21: PLC0414 [*] Import alias does not rename original pack 27 | from .foo.bar import f as foobar | = help: Remove import alias - -22 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] -23 23 | from . import foo as bar, foo2 as foo2 # [useless-import-alias] -24 24 | from . import foo as bar, foo2 as bar2 -25 |-from foo.bar import foobar as foobar # [useless-import-alias] - 25 |+from foo.bar import foobar # [useless-import-alias] -26 26 | from foo.bar import foobar as foo -27 27 | from .foo.bar import f as foobar -28 28 | from ............a import b # [relative-beyond-top-level] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap index d3cefc880aa37..c435bc221e442 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC2801_unnecessary_dunder_call.py.snap @@ -11,16 +11,6 @@ unnecessary_dunder_call.py:4:7: PLC2801 [*] Unnecessary dunder call to `__add__` | = help: Use `+` operator -1 1 | from typing import Any -2 2 | -3 3 | a = 2 -4 |-print((3.0).__add__(4.0)) # PLC2801 - 4 |+print(3.0 + 4.0) # PLC2801 -5 5 | print((3.0).__sub__(4.0)) # PLC2801 -6 6 | print((3.0).__mul__(4.0)) # PLC2801 -7 7 | print((3.0).__truediv__(4.0)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:5:7: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | @@ -33,16 +23,6 @@ unnecessary_dunder_call.py:5:7: PLC2801 [*] Unnecessary dunder call to `__sub__` | = help: Use `-` operator -2 2 | -3 3 | a = 2 -4 4 | print((3.0).__add__(4.0)) # PLC2801 -5 |-print((3.0).__sub__(4.0)) # PLC2801 - 5 |+print(3.0 - 4.0) # PLC2801 -6 6 | print((3.0).__mul__(4.0)) # PLC2801 -7 7 | print((3.0).__truediv__(4.0)) # PLC2801 -8 8 | print((3.0).__floordiv__(4.0)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:6:7: PLC2801 [*] Unnecessary dunder call to `__mul__`. Use `*` operator. | @@ -55,16 +35,6 @@ unnecessary_dunder_call.py:6:7: PLC2801 [*] Unnecessary dunder call to `__mul__` | = help: Use `*` operator -3 3 | a = 2 -4 4 | print((3.0).__add__(4.0)) # PLC2801 -5 5 | print((3.0).__sub__(4.0)) # PLC2801 -6 |-print((3.0).__mul__(4.0)) # PLC2801 - 6 |+print(3.0 * 4.0) # PLC2801 -7 7 | print((3.0).__truediv__(4.0)) # PLC2801 -8 8 | print((3.0).__floordiv__(4.0)) # PLC2801 -9 9 | print((3.0).__mod__(4.0)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:7:7: PLC2801 [*] Unnecessary dunder call to `__truediv__`. Use `/` operator. | @@ -77,16 +47,6 @@ unnecessary_dunder_call.py:7:7: PLC2801 [*] Unnecessary dunder call to `__truedi | = help: Use `/` operator -4 4 | print((3.0).__add__(4.0)) # PLC2801 -5 5 | print((3.0).__sub__(4.0)) # PLC2801 -6 6 | print((3.0).__mul__(4.0)) # PLC2801 -7 |-print((3.0).__truediv__(4.0)) # PLC2801 - 7 |+print(3.0 / 4.0) # PLC2801 -8 8 | print((3.0).__floordiv__(4.0)) # PLC2801 -9 9 | print((3.0).__mod__(4.0)) # PLC2801 -10 10 | print((3.0).__eq__(4.0)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:8:7: PLC2801 [*] Unnecessary dunder call to `__floordiv__`. Use `//` operator. | @@ -99,16 +59,6 @@ unnecessary_dunder_call.py:8:7: PLC2801 [*] Unnecessary dunder call to `__floord | = help: Use `//` operator -5 5 | print((3.0).__sub__(4.0)) # PLC2801 -6 6 | print((3.0).__mul__(4.0)) # PLC2801 -7 7 | print((3.0).__truediv__(4.0)) # PLC2801 -8 |-print((3.0).__floordiv__(4.0)) # PLC2801 - 8 |+print(3.0 // 4.0) # PLC2801 -9 9 | print((3.0).__mod__(4.0)) # PLC2801 -10 10 | print((3.0).__eq__(4.0)) # PLC2801 -11 11 | print((3.0).__ne__(4.0)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:9:7: PLC2801 [*] Unnecessary dunder call to `__mod__`. Use `%` operator. | @@ -121,16 +71,6 @@ unnecessary_dunder_call.py:9:7: PLC2801 [*] Unnecessary dunder call to `__mod__` | = help: Use `%` operator -6 6 | print((3.0).__mul__(4.0)) # PLC2801 -7 7 | print((3.0).__truediv__(4.0)) # PLC2801 -8 8 | print((3.0).__floordiv__(4.0)) # PLC2801 -9 |-print((3.0).__mod__(4.0)) # PLC2801 - 9 |+print(3.0 % 4.0) # PLC2801 -10 10 | print((3.0).__eq__(4.0)) # PLC2801 -11 11 | print((3.0).__ne__(4.0)) # PLC2801 -12 12 | print((3.0).__lt__(4.0)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:10:7: PLC2801 [*] Unnecessary dunder call to `__eq__`. Use `==` operator. | @@ -143,16 +83,6 @@ unnecessary_dunder_call.py:10:7: PLC2801 [*] Unnecessary dunder call to `__eq__` | = help: Use `==` operator -7 7 | print((3.0).__truediv__(4.0)) # PLC2801 -8 8 | print((3.0).__floordiv__(4.0)) # PLC2801 -9 9 | print((3.0).__mod__(4.0)) # PLC2801 -10 |-print((3.0).__eq__(4.0)) # PLC2801 - 10 |+print(3.0 == 4.0) # PLC2801 -11 11 | print((3.0).__ne__(4.0)) # PLC2801 -12 12 | print((3.0).__lt__(4.0)) # PLC2801 -13 13 | print((3.0).__le__(4.0)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:11:7: PLC2801 [*] Unnecessary dunder call to `__ne__`. Use `!=` operator. | @@ -165,16 +95,6 @@ unnecessary_dunder_call.py:11:7: PLC2801 [*] Unnecessary dunder call to `__ne__` | = help: Use `!=` operator -8 8 | print((3.0).__floordiv__(4.0)) # PLC2801 -9 9 | print((3.0).__mod__(4.0)) # PLC2801 -10 10 | print((3.0).__eq__(4.0)) # PLC2801 -11 |-print((3.0).__ne__(4.0)) # PLC2801 - 11 |+print(3.0 != 4.0) # PLC2801 -12 12 | print((3.0).__lt__(4.0)) # PLC2801 -13 13 | print((3.0).__le__(4.0)) # PLC2801 -14 14 | print((3.0).__gt__(4.0)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:12:7: PLC2801 [*] Unnecessary dunder call to `__lt__`. Use `<` operator. | @@ -187,16 +107,6 @@ unnecessary_dunder_call.py:12:7: PLC2801 [*] Unnecessary dunder call to `__lt__` | = help: Use `<` operator -9 9 | print((3.0).__mod__(4.0)) # PLC2801 -10 10 | print((3.0).__eq__(4.0)) # PLC2801 -11 11 | print((3.0).__ne__(4.0)) # PLC2801 -12 |-print((3.0).__lt__(4.0)) # PLC2801 - 12 |+print(3.0 < 4.0) # PLC2801 -13 13 | print((3.0).__le__(4.0)) # PLC2801 -14 14 | print((3.0).__gt__(4.0)) # PLC2801 -15 15 | print((3.0).__ge__(4.0)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:13:7: PLC2801 [*] Unnecessary dunder call to `__le__`. Use `<=` operator. | @@ -209,16 +119,6 @@ unnecessary_dunder_call.py:13:7: PLC2801 [*] Unnecessary dunder call to `__le__` | = help: Use `<=` operator -10 10 | print((3.0).__eq__(4.0)) # PLC2801 -11 11 | print((3.0).__ne__(4.0)) # PLC2801 -12 12 | print((3.0).__lt__(4.0)) # PLC2801 -13 |-print((3.0).__le__(4.0)) # PLC2801 - 13 |+print(3.0 <= 4.0) # PLC2801 -14 14 | print((3.0).__gt__(4.0)) # PLC2801 -15 15 | print((3.0).__ge__(4.0)) # PLC2801 -16 16 | print((3.0).__str__()) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:14:7: PLC2801 [*] Unnecessary dunder call to `__gt__`. Use `>` operator. | @@ -231,16 +131,6 @@ unnecessary_dunder_call.py:14:7: PLC2801 [*] Unnecessary dunder call to `__gt__` | = help: Use `>` operator -11 11 | print((3.0).__ne__(4.0)) # PLC2801 -12 12 | print((3.0).__lt__(4.0)) # PLC2801 -13 13 | print((3.0).__le__(4.0)) # PLC2801 -14 |-print((3.0).__gt__(4.0)) # PLC2801 - 14 |+print(3.0 > 4.0) # PLC2801 -15 15 | print((3.0).__ge__(4.0)) # PLC2801 -16 16 | print((3.0).__str__()) # PLC2801 -17 17 | print((3.0).__repr__()) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:15:7: PLC2801 [*] Unnecessary dunder call to `__ge__`. Use `>=` operator. | @@ -253,16 +143,6 @@ unnecessary_dunder_call.py:15:7: PLC2801 [*] Unnecessary dunder call to `__ge__` | = help: Use `>=` operator -12 12 | print((3.0).__lt__(4.0)) # PLC2801 -13 13 | print((3.0).__le__(4.0)) # PLC2801 -14 14 | print((3.0).__gt__(4.0)) # PLC2801 -15 |-print((3.0).__ge__(4.0)) # PLC2801 - 15 |+print(3.0 >= 4.0) # PLC2801 -16 16 | print((3.0).__str__()) # PLC2801 -17 17 | print((3.0).__repr__()) # PLC2801 -18 18 | print([1, 2, 3].__len__()) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:16:7: PLC2801 [*] Unnecessary dunder call to `__str__`. Use `str()` builtin. | @@ -275,16 +155,6 @@ unnecessary_dunder_call.py:16:7: PLC2801 [*] Unnecessary dunder call to `__str__ | = help: Use `str()` builtin -13 13 | print((3.0).__le__(4.0)) # PLC2801 -14 14 | print((3.0).__gt__(4.0)) # PLC2801 -15 15 | print((3.0).__ge__(4.0)) # PLC2801 -16 |-print((3.0).__str__()) # PLC2801 - 16 |+print(str(3.0)) # PLC2801 -17 17 | print((3.0).__repr__()) # PLC2801 -18 18 | print([1, 2, 3].__len__()) # PLC2801 -19 19 | print((1).__neg__()) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:17:7: PLC2801 [*] Unnecessary dunder call to `__repr__`. Use `repr()` builtin. | @@ -297,16 +167,6 @@ unnecessary_dunder_call.py:17:7: PLC2801 [*] Unnecessary dunder call to `__repr_ | = help: Use `repr()` builtin -14 14 | print((3.0).__gt__(4.0)) # PLC2801 -15 15 | print((3.0).__ge__(4.0)) # PLC2801 -16 16 | print((3.0).__str__()) # PLC2801 -17 |-print((3.0).__repr__()) # PLC2801 - 17 |+print(repr(3.0)) # PLC2801 -18 18 | print([1, 2, 3].__len__()) # PLC2801 -19 19 | print((1).__neg__()) # PLC2801 -20 20 | print(-a.__sub__(1)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:18:7: PLC2801 [*] Unnecessary dunder call to `__len__`. Use `len()` builtin. | @@ -319,16 +179,6 @@ unnecessary_dunder_call.py:18:7: PLC2801 [*] Unnecessary dunder call to `__len__ | = help: Use `len()` builtin -15 15 | print((3.0).__ge__(4.0)) # PLC2801 -16 16 | print((3.0).__str__()) # PLC2801 -17 17 | print((3.0).__repr__()) # PLC2801 -18 |-print([1, 2, 3].__len__()) # PLC2801 - 18 |+print(len([1, 2, 3])) # PLC2801 -19 19 | print((1).__neg__()) # PLC2801 -20 20 | print(-a.__sub__(1)) # PLC2801 -21 21 | print(-(a).__sub__(1)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:19:7: PLC2801 Unnecessary dunder call to `__neg__`. Multiply by -1 instead. | @@ -352,16 +202,6 @@ unnecessary_dunder_call.py:20:8: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -17 17 | print((3.0).__repr__()) # PLC2801 -18 18 | print([1, 2, 3].__len__()) # PLC2801 -19 19 | print((1).__neg__()) # PLC2801 -20 |-print(-a.__sub__(1)) # PLC2801 - 20 |+print(-(a - 1)) # PLC2801 -21 21 | print(-(a).__sub__(1)) # PLC2801 -22 22 | print(-(-a.__sub__(1))) # PLC2801 -23 23 | print((5 - a).__sub__(1)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:21:8: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | @@ -374,16 +214,6 @@ unnecessary_dunder_call.py:21:8: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -18 18 | print([1, 2, 3].__len__()) # PLC2801 -19 19 | print((1).__neg__()) # PLC2801 -20 20 | print(-a.__sub__(1)) # PLC2801 -21 |-print(-(a).__sub__(1)) # PLC2801 - 21 |+print(-(a - 1)) # PLC2801 -22 22 | print(-(-a.__sub__(1))) # PLC2801 -23 23 | print((5 - a).__sub__(1)) # PLC2801 -24 24 | print(-(5 - a).__sub__(1)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:22:10: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | @@ -396,16 +226,6 @@ unnecessary_dunder_call.py:22:10: PLC2801 [*] Unnecessary dunder call to `__sub_ | = help: Use `-` operator -19 19 | print((1).__neg__()) # PLC2801 -20 20 | print(-a.__sub__(1)) # PLC2801 -21 21 | print(-(a).__sub__(1)) # PLC2801 -22 |-print(-(-a.__sub__(1))) # PLC2801 - 22 |+print(-(-(a - 1))) # PLC2801 -23 23 | print((5 - a).__sub__(1)) # PLC2801 -24 24 | print(-(5 - a).__sub__(1)) # PLC2801 -25 25 | print(-(-5 - a).__sub__(1)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:23:7: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | @@ -418,16 +238,6 @@ unnecessary_dunder_call.py:23:7: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -20 20 | print(-a.__sub__(1)) # PLC2801 -21 21 | print(-(a).__sub__(1)) # PLC2801 -22 22 | print(-(-a.__sub__(1))) # PLC2801 -23 |-print((5 - a).__sub__(1)) # PLC2801 - 23 |+print(5 - a - 1) # PLC2801 -24 24 | print(-(5 - a).__sub__(1)) # PLC2801 -25 25 | print(-(-5 - a).__sub__(1)) # PLC2801 -26 26 | print(+-+-+-a.__sub__(1)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:24:8: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | @@ -440,16 +250,6 @@ unnecessary_dunder_call.py:24:8: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -21 21 | print(-(a).__sub__(1)) # PLC2801 -22 22 | print(-(-a.__sub__(1))) # PLC2801 -23 23 | print((5 - a).__sub__(1)) # PLC2801 -24 |-print(-(5 - a).__sub__(1)) # PLC2801 - 24 |+print(-(5 - a - 1)) # PLC2801 -25 25 | print(-(-5 - a).__sub__(1)) # PLC2801 -26 26 | print(+-+-+-a.__sub__(1)) # PLC2801 -27 27 | print(a.__rsub__(2 - 1)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:25:8: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | @@ -462,16 +262,6 @@ unnecessary_dunder_call.py:25:8: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -22 22 | print(-(-a.__sub__(1))) # PLC2801 -23 23 | print((5 - a).__sub__(1)) # PLC2801 -24 24 | print(-(5 - a).__sub__(1)) # PLC2801 -25 |-print(-(-5 - a).__sub__(1)) # PLC2801 - 25 |+print(-(-5 - a - 1)) # PLC2801 -26 26 | print(+-+-+-a.__sub__(1)) # PLC2801 -27 27 | print(a.__rsub__(2 - 1)) # PLC2801 -28 28 | print(a.__sub__(((((1)))))) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:26:13: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | @@ -484,16 +274,6 @@ unnecessary_dunder_call.py:26:13: PLC2801 [*] Unnecessary dunder call to `__sub_ | = help: Use `-` operator -23 23 | print((5 - a).__sub__(1)) # PLC2801 -24 24 | print(-(5 - a).__sub__(1)) # PLC2801 -25 25 | print(-(-5 - a).__sub__(1)) # PLC2801 -26 |-print(+-+-+-a.__sub__(1)) # PLC2801 - 26 |+print(+-+-+-(a - 1)) # PLC2801 -27 27 | print(a.__rsub__(2 - 1)) # PLC2801 -28 28 | print(a.__sub__(((((1)))))) # PLC2801 -29 29 | print(a.__sub__(((((2 - 1)))))) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:27:7: PLC2801 [*] Unnecessary dunder call to `__rsub__`. Use `-` operator. | @@ -506,16 +286,6 @@ unnecessary_dunder_call.py:27:7: PLC2801 [*] Unnecessary dunder call to `__rsub_ | = help: Use `-` operator -24 24 | print(-(5 - a).__sub__(1)) # PLC2801 -25 25 | print(-(-5 - a).__sub__(1)) # PLC2801 -26 26 | print(+-+-+-a.__sub__(1)) # PLC2801 -27 |-print(a.__rsub__(2 - 1)) # PLC2801 - 27 |+print((2 - 1) - a) # PLC2801 -28 28 | print(a.__sub__(((((1)))))) # PLC2801 -29 29 | print(a.__sub__(((((2 - 1)))))) # PLC2801 -30 30 | print(a.__sub__( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:28:7: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | @@ -528,16 +298,6 @@ unnecessary_dunder_call.py:28:7: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -25 25 | print(-(-5 - a).__sub__(1)) # PLC2801 -26 26 | print(+-+-+-a.__sub__(1)) # PLC2801 -27 27 | print(a.__rsub__(2 - 1)) # PLC2801 -28 |-print(a.__sub__(((((1)))))) # PLC2801 - 28 |+print(a - 1) # PLC2801 -29 29 | print(a.__sub__(((((2 - 1)))))) # PLC2801 -30 30 | print(a.__sub__( -31 31 | 3 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:29:7: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | @@ -550,16 +310,6 @@ unnecessary_dunder_call.py:29:7: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -26 26 | print(+-+-+-a.__sub__(1)) # PLC2801 -27 27 | print(a.__rsub__(2 - 1)) # PLC2801 -28 28 | print(a.__sub__(((((1)))))) # PLC2801 -29 |-print(a.__sub__(((((2 - 1)))))) # PLC2801 - 29 |+print(a - (2 - 1)) # PLC2801 -30 30 | print(a.__sub__( -31 31 | 3 -32 32 | + - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:30:7: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | @@ -577,21 +327,6 @@ unnecessary_dunder_call.py:30:7: PLC2801 [*] Unnecessary dunder call to `__sub__ | = help: Use `-` operator -27 27 | print(a.__rsub__(2 - 1)) # PLC2801 -28 28 | print(a.__sub__(((((1)))))) # PLC2801 -29 29 | print(a.__sub__(((((2 - 1)))))) # PLC2801 -30 |-print(a.__sub__( -31 |- 3 - 30 |+print(a - (3 -32 31 | + -33 |- 4 -34 |-)) - 32 |+ 4)) -35 33 | print(a.__rsub__( -36 34 | 3 -37 35 | + - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:35:7: PLC2801 [*] Unnecessary dunder call to `__rsub__`. Use `-` operator. | @@ -609,21 +344,6 @@ unnecessary_dunder_call.py:35:7: PLC2801 [*] Unnecessary dunder call to `__rsub_ | = help: Use `-` operator -32 32 | + -33 33 | 4 -34 34 | )) -35 |-print(a.__rsub__( -36 |- 3 - 35 |+print((3 -37 36 | + -38 |- 4 -39 |-)) - 37 |+ 4) - a) -40 38 | print(2 * a.__add__(3)) # PLC2801 -41 39 | x = 2 * a.__add__(3) # PLC2801 -42 40 | x = 2 * -a.__add__(3) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:40:11: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -636,16 +356,6 @@ unnecessary_dunder_call.py:40:11: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -37 37 | + -38 38 | 4 -39 39 | )) -40 |-print(2 * a.__add__(3)) # PLC2801 - 40 |+print(2 * (a + 3)) # PLC2801 -41 41 | x = 2 * a.__add__(3) # PLC2801 -42 42 | x = 2 * -a.__add__(3) # PLC2801 -43 43 | x = a.__add__(3) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:41:9: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -658,16 +368,6 @@ unnecessary_dunder_call.py:41:9: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -38 38 | 4 -39 39 | )) -40 40 | print(2 * a.__add__(3)) # PLC2801 -41 |-x = 2 * a.__add__(3) # PLC2801 - 41 |+x = 2 * (a + 3) # PLC2801 -42 42 | x = 2 * -a.__add__(3) # PLC2801 -43 43 | x = a.__add__(3) # PLC2801 -44 44 | x = -a.__add__(3) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:42:10: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -680,16 +380,6 @@ unnecessary_dunder_call.py:42:10: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -39 39 | )) -40 40 | print(2 * a.__add__(3)) # PLC2801 -41 41 | x = 2 * a.__add__(3) # PLC2801 -42 |-x = 2 * -a.__add__(3) # PLC2801 - 42 |+x = 2 * -(a + 3) # PLC2801 -43 43 | x = a.__add__(3) # PLC2801 -44 44 | x = -a.__add__(3) # PLC2801 -45 45 | x = (-a).__add__(3) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:43:5: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -702,16 +392,6 @@ unnecessary_dunder_call.py:43:5: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -40 40 | print(2 * a.__add__(3)) # PLC2801 -41 41 | x = 2 * a.__add__(3) # PLC2801 -42 42 | x = 2 * -a.__add__(3) # PLC2801 -43 |-x = a.__add__(3) # PLC2801 - 43 |+x = a + 3 # PLC2801 -44 44 | x = -a.__add__(3) # PLC2801 -45 45 | x = (-a).__add__(3) # PLC2801 -46 46 | x = -(-a).__add__(3) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:44:6: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -724,16 +404,6 @@ unnecessary_dunder_call.py:44:6: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -41 41 | x = 2 * a.__add__(3) # PLC2801 -42 42 | x = 2 * -a.__add__(3) # PLC2801 -43 43 | x = a.__add__(3) # PLC2801 -44 |-x = -a.__add__(3) # PLC2801 - 44 |+x = -(a + 3) # PLC2801 -45 45 | x = (-a).__add__(3) # PLC2801 -46 46 | x = -(-a).__add__(3) # PLC2801 -47 47 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:45:5: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -745,16 +415,6 @@ unnecessary_dunder_call.py:45:5: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -42 42 | x = 2 * -a.__add__(3) # PLC2801 -43 43 | x = a.__add__(3) # PLC2801 -44 44 | x = -a.__add__(3) # PLC2801 -45 |-x = (-a).__add__(3) # PLC2801 - 45 |+x = -a + 3 # PLC2801 -46 46 | x = -(-a).__add__(3) # PLC2801 -47 47 | -48 48 | # Calls - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:46:6: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -767,16 +427,6 @@ unnecessary_dunder_call.py:46:6: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -43 43 | x = a.__add__(3) # PLC2801 -44 44 | x = -a.__add__(3) # PLC2801 -45 45 | x = (-a).__add__(3) # PLC2801 -46 |-x = -(-a).__add__(3) # PLC2801 - 46 |+x = -(-a + 3) # PLC2801 -47 47 | -48 48 | # Calls -49 49 | print(a.__call__()) # PLC2801 (no fix, intentional) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:49:7: PLC2801 Unnecessary dunder call to `__call__` | @@ -797,16 +447,6 @@ unnecessary_dunder_call.py:52:16: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -49 49 | print(a.__call__()) # PLC2801 (no fix, intentional) -50 50 | -51 51 | # Lambda expressions -52 |-blah = lambda: a.__add__(1) # PLC2801 - 52 |+blah = lambda: a + 1 # PLC2801 -53 53 | -54 54 | # If expressions -55 55 | print(a.__add__(1) if a > 0 else a.__sub__(1)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:55:7: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -818,16 +458,6 @@ unnecessary_dunder_call.py:55:7: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -52 52 | blah = lambda: a.__add__(1) # PLC2801 -53 53 | -54 54 | # If expressions -55 |-print(a.__add__(1) if a > 0 else a.__sub__(1)) # PLC2801 - 55 |+print(a + 1 if a > 0 else a.__sub__(1)) # PLC2801 -56 56 | -57 57 | # Dict/Set/List/Tuple -58 58 | print({"a": a.__add__(1)}) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:55:34: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | @@ -839,16 +469,6 @@ unnecessary_dunder_call.py:55:34: PLC2801 [*] Unnecessary dunder call to `__sub_ | = help: Use `-` operator -52 52 | blah = lambda: a.__add__(1) # PLC2801 -53 53 | -54 54 | # If expressions -55 |-print(a.__add__(1) if a > 0 else a.__sub__(1)) # PLC2801 - 55 |+print(a.__add__(1) if a > 0 else a - 1) # PLC2801 -56 56 | -57 57 | # Dict/Set/List/Tuple -58 58 | print({"a": a.__add__(1)}) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:58:13: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -860,16 +480,6 @@ unnecessary_dunder_call.py:58:13: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -55 55 | print(a.__add__(1) if a > 0 else a.__sub__(1)) # PLC2801 -56 56 | -57 57 | # Dict/Set/List/Tuple -58 |-print({"a": a.__add__(1)}) # PLC2801 - 58 |+print({"a": a + 1}) # PLC2801 -59 59 | print({a.__add__(1)}) # PLC2801 -60 60 | print([a.__add__(1)]) # PLC2801 -61 61 | print((a.__add__(1),)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:59:8: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -882,16 +492,6 @@ unnecessary_dunder_call.py:59:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -56 56 | -57 57 | # Dict/Set/List/Tuple -58 58 | print({"a": a.__add__(1)}) # PLC2801 -59 |-print({a.__add__(1)}) # PLC2801 - 59 |+print({a + 1}) # PLC2801 -60 60 | print([a.__add__(1)]) # PLC2801 -61 61 | print((a.__add__(1),)) # PLC2801 -62 62 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:60:8: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -903,16 +503,6 @@ unnecessary_dunder_call.py:60:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -57 57 | # Dict/Set/List/Tuple -58 58 | print({"a": a.__add__(1)}) # PLC2801 -59 59 | print({a.__add__(1)}) # PLC2801 -60 |-print([a.__add__(1)]) # PLC2801 - 60 |+print([a + 1]) # PLC2801 -61 61 | print((a.__add__(1),)) # PLC2801 -62 62 | -63 63 | # Comprehension variants - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:61:8: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -925,16 +515,6 @@ unnecessary_dunder_call.py:61:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -58 58 | print({"a": a.__add__(1)}) # PLC2801 -59 59 | print({a.__add__(1)}) # PLC2801 -60 60 | print([a.__add__(1)]) # PLC2801 -61 |-print((a.__add__(1),)) # PLC2801 - 61 |+print((a + 1,)) # PLC2801 -62 62 | -63 63 | # Comprehension variants -64 64 | print({i: i.__add__(1) for i in range(5)}) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:64:11: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -946,16 +526,6 @@ unnecessary_dunder_call.py:64:11: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -61 61 | print((a.__add__(1),)) # PLC2801 -62 62 | -63 63 | # Comprehension variants -64 |-print({i: i.__add__(1) for i in range(5)}) # PLC2801 - 64 |+print({i: i + 1 for i in range(5)}) # PLC2801 -65 65 | print({i.__add__(1) for i in range(5)}) # PLC2801 -66 66 | print([i.__add__(1) for i in range(5)]) # PLC2801 -67 67 | print((i.__add__(1) for i in range(5))) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:65:8: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -968,16 +538,6 @@ unnecessary_dunder_call.py:65:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -62 62 | -63 63 | # Comprehension variants -64 64 | print({i: i.__add__(1) for i in range(5)}) # PLC2801 -65 |-print({i.__add__(1) for i in range(5)}) # PLC2801 - 65 |+print({i + 1 for i in range(5)}) # PLC2801 -66 66 | print([i.__add__(1) for i in range(5)]) # PLC2801 -67 67 | print((i.__add__(1) for i in range(5))) # PLC2801 -68 68 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:66:8: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -989,16 +549,6 @@ unnecessary_dunder_call.py:66:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -63 63 | # Comprehension variants -64 64 | print({i: i.__add__(1) for i in range(5)}) # PLC2801 -65 65 | print({i.__add__(1) for i in range(5)}) # PLC2801 -66 |-print([i.__add__(1) for i in range(5)]) # PLC2801 - 66 |+print([i + 1 for i in range(5)]) # PLC2801 -67 67 | print((i.__add__(1) for i in range(5))) # PLC2801 -68 68 | -69 69 | # Generators - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:67:8: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -1011,16 +561,6 @@ unnecessary_dunder_call.py:67:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -64 64 | print({i: i.__add__(1) for i in range(5)}) # PLC2801 -65 65 | print({i.__add__(1) for i in range(5)}) # PLC2801 -66 66 | print([i.__add__(1) for i in range(5)]) # PLC2801 -67 |-print((i.__add__(1) for i in range(5))) # PLC2801 - 67 |+print((i + 1 for i in range(5))) # PLC2801 -68 68 | -69 69 | # Generators -70 70 | gen = (i.__add__(1) for i in range(5)) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:70:8: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -1031,16 +571,6 @@ unnecessary_dunder_call.py:70:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -67 67 | print((i.__add__(1) for i in range(5))) # PLC2801 -68 68 | -69 69 | # Generators -70 |-gen = (i.__add__(1) for i in range(5)) # PLC2801 - 70 |+gen = (i + 1 for i in range(5)) # PLC2801 -71 71 | print(next(gen)) -72 72 | -73 73 | # Subscripts - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:74:13: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -1052,16 +582,6 @@ unnecessary_dunder_call.py:74:13: PLC2801 [*] Unnecessary dunder call to `__add_ | = help: Use `+` operator -71 71 | print(next(gen)) -72 72 | -73 73 | # Subscripts -74 |-print({"a": a.__add__(1)}["a"]) # PLC2801 - 74 |+print({"a": a + 1}["a"]) # PLC2801 -75 75 | -76 76 | # Starred -77 77 | print(*[a.__add__(1)]) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:77:9: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -1073,16 +593,6 @@ unnecessary_dunder_call.py:77:9: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -74 74 | print({"a": a.__add__(1)}["a"]) # PLC2801 -75 75 | -76 76 | # Starred -77 |-print(*[a.__add__(1)]) # PLC2801 - 77 |+print(*[a + 1]) # PLC2801 -78 78 | -79 79 | # Slices -80 80 | print([a.__add__(1), a.__sub__(1)][0:1]) # PLC2801 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:80:8: PLC2801 [*] Unnecessary dunder call to `__add__`. Use `+` operator. | @@ -1092,16 +602,6 @@ unnecessary_dunder_call.py:80:8: PLC2801 [*] Unnecessary dunder call to `__add__ | = help: Use `+` operator -77 77 | print(*[a.__add__(1)]) # PLC2801 -78 78 | -79 79 | # Slices -80 |-print([a.__add__(1), a.__sub__(1)][0:1]) # PLC2801 - 80 |+print([a + 1, a.__sub__(1)][0:1]) # PLC2801 -81 81 | -82 82 | -83 83 | class Thing: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:80:22: PLC2801 [*] Unnecessary dunder call to `__sub__`. Use `-` operator. | @@ -1111,16 +611,6 @@ unnecessary_dunder_call.py:80:22: PLC2801 [*] Unnecessary dunder call to `__sub_ | = help: Use `-` operator -77 77 | print(*[a.__add__(1)]) # PLC2801 -78 78 | -79 79 | # Slices -80 |-print([a.__add__(1), a.__sub__(1)][0:1]) # PLC2801 - 80 |+print([a.__add__(1), a - 1][0:1]) # PLC2801 -81 81 | -82 82 | -83 83 | class Thing: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_dunder_call.py:92:16: PLC2801 Unnecessary dunder call to `__getattribute__`. Access attribute directly or use getattr built-in function. | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap index eab840df6c25e..5618eba730265 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1519_singledispatch_method.py.snap @@ -11,16 +11,6 @@ singledispatch_method.py:10:5: PLE1519 [*] `@singledispatch` decorator should no | = help: Replace with `@singledispatchmethod` -7 7 | -8 8 | -9 9 | class Board: -10 |- @singledispatch # [singledispatch-method] - 10 |+ @singledispatchmethod # [singledispatch-method] -11 11 | @classmethod -12 12 | def convert_position(cls, position): -13 13 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. singledispatch_method.py:15:5: PLE1519 [*] `@singledispatch` decorator should not be used on methods | @@ -33,16 +23,6 @@ singledispatch_method.py:15:5: PLE1519 [*] `@singledispatch` decorator should no | = help: Replace with `@singledispatchmethod` -12 12 | def convert_position(cls, position): -13 13 | pass -14 14 | -15 |- @singledispatch # [singledispatch-method] - 15 |+ @singledispatchmethod # [singledispatch-method] -16 16 | def move(self, position): -17 17 | pass -18 18 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. singledispatch_method.py:23:5: PLE1519 [*] `@singledispatch` decorator should not be used on methods | @@ -54,14 +34,3 @@ singledispatch_method.py:23:5: PLE1519 [*] `@singledispatch` decorator should no 25 | def do(position): | = help: Replace with `@singledispatchmethod` - -20 20 | def place(self, position): -21 21 | pass -22 22 | -23 |- @singledispatch # [singledispatch-method] - 23 |+ @singledispatchmethod # [singledispatch-method] -24 24 | @staticmethod -25 25 | def do(position): -26 26 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1520_singledispatchmethod_function.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1520_singledispatchmethod_function.py.snap index d1a8e6426dd57..abf02071c2fbc 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1520_singledispatchmethod_function.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1520_singledispatchmethod_function.py.snap @@ -9,15 +9,3 @@ singledispatchmethod_function.py:4:1: PLE1520 [*] `@singledispatchmethod` decora 6 | pass | = help: Replace with `@singledispatch` - -1 |-from functools import singledispatchmethod - 1 |+from functools import singledispatchmethod, singledispatch -2 2 | -3 3 | -4 |-@singledispatchmethod # [singledispatchmethod-function] - 4 |+@singledispatch # [singledispatchmethod-function] -5 5 | def convert_position(position): -6 6 | pass -7 7 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap index a8f052d3bee85..3d62d6a8d0c51 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE4703_modified_iterating_set.py.snap @@ -12,16 +12,6 @@ modified_iterating_set.py:4:1: PLE4703 [*] Iterated set `nums` is modified withi | = help: Iterate over a copy of `nums` -1 1 | # Errors -2 2 | -3 3 | nums = {1, 2, 3} -4 |-for num in nums: - 4 |+for num in nums.copy(): -5 5 | nums.add(num + 1) -6 6 | -7 7 | animals = {"dog", "cat", "cow"} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. modified_iterating_set.py:8:1: PLE4703 [*] Iterated set `animals` is modified within the `for` loop | @@ -34,16 +24,6 @@ modified_iterating_set.py:8:1: PLE4703 [*] Iterated set `animals` is modified wi | = help: Iterate over a copy of `animals` -5 5 | nums.add(num + 1) -6 6 | -7 7 | animals = {"dog", "cat", "cow"} -8 |-for animal in animals: - 8 |+for animal in animals.copy(): -9 9 | animals.pop("cow") -10 10 | -11 11 | fruits = {"apple", "orange", "grape"} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. modified_iterating_set.py:12:1: PLE4703 [*] Iterated set `fruits` is modified within the `for` loop | @@ -56,16 +36,6 @@ modified_iterating_set.py:12:1: PLE4703 [*] Iterated set `fruits` is modified wi | = help: Iterate over a copy of `fruits` -9 9 | animals.pop("cow") -10 10 | -11 11 | fruits = {"apple", "orange", "grape"} -12 |-for fruit in fruits: - 12 |+for fruit in fruits.copy(): -13 13 | fruits.clear() -14 14 | -15 15 | planets = {"mercury", "venus", "earth"} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. modified_iterating_set.py:16:1: PLE4703 [*] Iterated set `planets` is modified within the `for` loop | @@ -78,16 +48,6 @@ modified_iterating_set.py:16:1: PLE4703 [*] Iterated set `planets` is modified w | = help: Iterate over a copy of `planets` -13 13 | fruits.clear() -14 14 | -15 15 | planets = {"mercury", "venus", "earth"} -16 |-for planet in planets: - 16 |+for planet in planets.copy(): -17 17 | planets.discard("mercury") -18 18 | -19 19 | colors = {"red", "green", "blue"} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. modified_iterating_set.py:20:1: PLE4703 [*] Iterated set `colors` is modified within the `for` loop | @@ -100,16 +60,6 @@ modified_iterating_set.py:20:1: PLE4703 [*] Iterated set `colors` is modified wi | = help: Iterate over a copy of `colors` -17 17 | planets.discard("mercury") -18 18 | -19 19 | colors = {"red", "green", "blue"} -20 |-for color in colors: - 20 |+for color in colors.copy(): -21 21 | colors.remove("red") -22 22 | -23 23 | odds = {1, 3, 5} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. modified_iterating_set.py:24:1: PLE4703 [*] Iterated set `odds` is modified within the `for` loop | @@ -122,14 +72,3 @@ modified_iterating_set.py:24:1: PLE4703 [*] Iterated set `odds` is modified with 28 | # OK | = help: Iterate over a copy of `odds` - -21 21 | colors.remove("red") -22 22 | -23 23 | odds = {1, 3, 5} -24 |-for num in odds: - 24 |+for num in odds.copy(): -25 25 | if num > 1: -26 26 | odds.add(num + 1) -27 27 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1714_repeated_equality_comparison.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1714_repeated_equality_comparison.py.snap index 6186f3d7ca963..5d67471505f8f 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1714_repeated_equality_comparison.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1714_repeated_equality_comparison.py.snap @@ -11,14 +11,6 @@ repeated_equality_comparison.py:2:1: PLR1714 [*] Consider merging multiple compa | = help: Merge multiple comparisons -1 1 | # Errors. -2 |-foo == "a" or foo == "b" - 2 |+foo in ("a", "b") -3 3 | -4 4 | foo != "a" and foo != "b" -5 5 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. repeated_equality_comparison.py:4:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in ("a", "b")`. Use a `set` if the elements are hashable. | @@ -31,16 +23,6 @@ repeated_equality_comparison.py:4:1: PLR1714 [*] Consider merging multiple compa | = help: Merge multiple comparisons -1 1 | # Errors. -2 2 | foo == "a" or foo == "b" -3 3 | -4 |-foo != "a" and foo != "b" - 4 |+foo not in ("a", "b") -5 5 | -6 6 | foo == "a" or foo == "b" or foo == "c" -7 7 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. repeated_equality_comparison.py:6:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. | @@ -53,16 +35,6 @@ repeated_equality_comparison.py:6:1: PLR1714 [*] Consider merging multiple compa | = help: Merge multiple comparisons -3 3 | -4 4 | foo != "a" and foo != "b" -5 5 | -6 |-foo == "a" or foo == "b" or foo == "c" - 6 |+foo in ("a", "b", "c") -7 7 | -8 8 | foo != "a" and foo != "b" and foo != "c" -9 9 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. repeated_equality_comparison.py:8:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in ("a", "b", "c")`. Use a `set` if the elements are hashable. | @@ -75,16 +47,6 @@ repeated_equality_comparison.py:8:1: PLR1714 [*] Consider merging multiple compa | = help: Merge multiple comparisons -5 5 | -6 6 | foo == "a" or foo == "b" or foo == "c" -7 7 | -8 |-foo != "a" and foo != "b" and foo != "c" - 8 |+foo not in ("a", "b", "c") -9 9 | -10 10 | foo == a or foo == "b" or foo == 3 # Mixed types. -11 11 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. repeated_equality_comparison.py:10:1: PLR1714 [*] Consider merging multiple comparisons: `foo in (a, "b", 3)`. Use a `set` if the elements are hashable. | @@ -97,16 +59,6 @@ repeated_equality_comparison.py:10:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -7 7 | -8 8 | foo != "a" and foo != "b" and foo != "c" -9 9 | -10 |-foo == a or foo == "b" or foo == 3 # Mixed types. - 10 |+foo in (a, "b", 3) # Mixed types. -11 11 | -12 12 | "a" == foo or "b" == foo or "c" == foo -13 13 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. repeated_equality_comparison.py:12:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. | @@ -119,16 +71,6 @@ repeated_equality_comparison.py:12:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -9 9 | -10 10 | foo == a or foo == "b" or foo == 3 # Mixed types. -11 11 | -12 |-"a" == foo or "b" == foo or "c" == foo - 12 |+foo in ("a", "b", "c") -13 13 | -14 14 | "a" != foo and "b" != foo and "c" != foo -15 15 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. repeated_equality_comparison.py:14:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in ("a", "b", "c")`. Use a `set` if the elements are hashable. | @@ -141,16 +83,6 @@ repeated_equality_comparison.py:14:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -11 11 | -12 12 | "a" == foo or "b" == foo or "c" == foo -13 13 | -14 |-"a" != foo and "b" != foo and "c" != foo - 14 |+foo not in ("a", "b", "c") -15 15 | -16 16 | "a" == foo or foo == "b" or "c" == foo -17 17 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. repeated_equality_comparison.py:16:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. | @@ -163,16 +95,6 @@ repeated_equality_comparison.py:16:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -13 13 | -14 14 | "a" != foo and "b" != foo and "c" != foo -15 15 | -16 |-"a" == foo or foo == "b" or "c" == foo - 16 |+foo in ("a", "b", "c") -17 17 | -18 18 | foo == bar or baz == foo or qux == foo -19 19 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. repeated_equality_comparison.py:18:1: PLR1714 [*] Consider merging multiple comparisons: `foo in (bar, baz, qux)`. Use a `set` if the elements are hashable. | @@ -185,16 +107,6 @@ repeated_equality_comparison.py:18:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -15 15 | -16 16 | "a" == foo or foo == "b" or "c" == foo -17 17 | -18 |-foo == bar or baz == foo or qux == foo - 18 |+foo in (bar, baz, qux) -19 19 | -20 20 | foo == "a" or "b" == foo or foo == "c" -21 21 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. repeated_equality_comparison.py:20:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b", "c")`. Use a `set` if the elements are hashable. | @@ -207,16 +119,6 @@ repeated_equality_comparison.py:20:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -17 17 | -18 18 | foo == bar or baz == foo or qux == foo -19 19 | -20 |-foo == "a" or "b" == foo or foo == "c" - 20 |+foo in ("a", "b", "c") -21 21 | -22 22 | foo != "a" and "b" != foo and foo != "c" -23 23 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. repeated_equality_comparison.py:22:1: PLR1714 [*] Consider merging multiple comparisons: `foo not in ("a", "b", "c")`. Use a `set` if the elements are hashable. | @@ -229,16 +131,6 @@ repeated_equality_comparison.py:22:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -19 19 | -20 20 | foo == "a" or "b" == foo or foo == "c" -21 21 | -22 |-foo != "a" and "b" != foo and foo != "c" - 22 |+foo not in ("a", "b", "c") -23 23 | -24 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets -25 25 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b")`. Use a `set` if the elements are hashable. | @@ -251,16 +143,6 @@ repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -21 21 | -22 22 | foo != "a" and "b" != foo and foo != "c" -23 23 | -24 |-foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets - 24 |+foo in ("a", "b") or "c" == bar or "d" == bar # Multiple targets -25 25 | -26 26 | foo.bar == "a" or foo.bar == "b" # Attributes. -27 27 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comparisons: `bar in ("c", "d")`. Use a `set` if the elements are hashable. | @@ -273,16 +155,6 @@ repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -21 21 | -22 22 | foo != "a" and "b" != foo and foo != "c" -23 23 | -24 |-foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets - 24 |+foo == "a" or foo == "b" or bar in ("c", "d") # Multiple targets -25 25 | -26 26 | foo.bar == "a" or foo.bar == "b" # Attributes. -27 27 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. repeated_equality_comparison.py:26:1: PLR1714 [*] Consider merging multiple comparisons: `foo.bar in ("a", "b")`. Use a `set` if the elements are hashable. | @@ -295,16 +167,6 @@ repeated_equality_comparison.py:26:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -23 23 | -24 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets -25 25 | -26 |-foo.bar == "a" or foo.bar == "b" # Attributes. - 26 |+foo.bar in ("a", "b") # Attributes. -27 27 | -28 28 | # OK -29 29 | foo == "a" and foo == "b" and foo == "c" # `and` mixed with `==`. - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. repeated_equality_comparison.py:61:16: PLR1714 [*] Consider merging multiple comparisons: `bar in ("c", "d")`. Use a `set` if the elements are hashable. | @@ -317,16 +179,6 @@ repeated_equality_comparison.py:61:16: PLR1714 [*] Consider merging multiple com | = help: Merge multiple comparisons -58 58 | -59 59 | foo == "a" or "c" == bar or foo == "b" or "d" == bar # Multiple targets -60 60 | -61 |-foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets - 61 |+foo == "a" or (bar in ("c", "d")) or foo == "b" # Multiple targets -62 62 | -63 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets -64 64 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. repeated_equality_comparison.py:63:1: PLR1714 [*] Consider merging multiple comparisons: `foo in ("a", "b")`. Use a `set` if the elements are hashable. | @@ -339,16 +191,6 @@ repeated_equality_comparison.py:63:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -60 60 | -61 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets -62 62 | -63 |-foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets - 63 |+foo in ("a", "b") or "c" != bar and "d" != bar # Multiple targets -64 64 | -65 65 | foo == "a" or ("c" != bar and "d" != bar) or foo == "b" # Multiple targets -66 66 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. repeated_equality_comparison.py:63:29: PLR1714 [*] Consider merging multiple comparisons: `bar not in ("c", "d")`. Use a `set` if the elements are hashable. | @@ -361,16 +203,6 @@ repeated_equality_comparison.py:63:29: PLR1714 [*] Consider merging multiple com | = help: Merge multiple comparisons -60 60 | -61 61 | foo == "a" or ("c" == bar or "d" == bar) or foo == "b" # Multiple targets -62 62 | -63 |-foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets - 63 |+foo == "a" or foo == "b" or bar not in ("c", "d") # Multiple targets -64 64 | -65 65 | foo == "a" or ("c" != bar and "d" != bar) or foo == "b" # Multiple targets -66 66 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. repeated_equality_comparison.py:65:16: PLR1714 [*] Consider merging multiple comparisons: `bar not in ("c", "d")`. Use a `set` if the elements are hashable. | @@ -382,13 +214,3 @@ repeated_equality_comparison.py:65:16: PLR1714 [*] Consider merging multiple com 67 | foo == "a" and "c" != bar or foo == "b" and "d" != bar # Multiple targets | = help: Merge multiple comparisons - -62 62 | -63 63 | foo == "a" or foo == "b" or "c" != bar and "d" != bar # Multiple targets -64 64 | -65 |-foo == "a" or ("c" != bar and "d" != bar) or foo == "b" # Multiple targets - 65 |+foo == "a" or (bar not in ("c", "d")) or foo == "b" # Multiple targets -66 66 | -67 67 | foo == "a" and "c" != bar or foo == "b" and "d" != bar # Multiple targets - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap index 49281ef831d5c..7f557186093cc 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap @@ -9,14 +9,6 @@ sys_exit_alias_0.py:1:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -1 |-exit(0) - 1 |+import sys - 2 |+sys.exit(0) -2 3 | quit(0) -3 4 | -4 5 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_0.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | @@ -26,15 +18,6 @@ sys_exit_alias_0.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` - 1 |+import sys -1 2 | exit(0) -2 |-quit(0) - 3 |+sys.exit(0) -3 4 | -4 5 | -5 6 | def main(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_0.py:6:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | @@ -45,17 +28,6 @@ sys_exit_alias_0.py:6:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` - 1 |+import sys -1 2 | exit(0) -2 3 | quit(0) -3 4 | -4 5 | -5 6 | def main(): -6 |- exit(2) - 7 |+ sys.exit(2) -7 8 | quit(2) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_0.py:7:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | @@ -65,15 +37,3 @@ sys_exit_alias_0.py:7:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | ^^^^ PLR1722 | = help: Replace `quit` with `sys.exit()` - - 1 |+import sys -1 2 | exit(0) -2 3 | quit(0) -3 4 | -4 5 | -5 6 | def main(): -6 7 | exit(2) -7 |- quit(2) - 8 |+ sys.exit(2) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap index 260905cc97b94..d187dce7b2ade 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap @@ -11,15 +11,6 @@ sys_exit_alias_1.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -1 1 | import sys -2 2 | -3 |-exit(0) - 3 |+sys.exit(0) -4 4 | quit(0) -5 5 | -6 6 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_1.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | @@ -29,16 +20,6 @@ sys_exit_alias_1.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -1 1 | import sys -2 2 | -3 3 | exit(0) -4 |-quit(0) - 4 |+sys.exit(0) -5 5 | -6 6 | -7 7 | def main(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_1.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | @@ -49,16 +30,6 @@ sys_exit_alias_1.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -5 5 | -6 6 | -7 7 | def main(): -8 |- exit(1) - 8 |+ sys.exit(1) -9 9 | quit(1) -10 10 | -11 11 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_1.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | @@ -69,16 +40,6 @@ sys_exit_alias_1.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -6 6 | -7 7 | def main(): -8 8 | exit(1) -9 |- quit(1) - 9 |+ sys.exit(1) -10 10 | -11 11 | -12 12 | def main(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_1.py:15:5: PLR1722 Use `sys.exit()` instead of `exit` | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap index 599f22e62d146..6df22e134d458 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap @@ -9,11 +9,3 @@ sys_exit_alias_11.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | ^^^^ PLR1722 | = help: Replace `exit` with `sys.exit()` - -1 1 | from sys import * - 2 |+import sys -2 3 | -3 |-exit(0) - 4 |+sys.exit(0) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap index 9fe3547e83fc8..f844030dd86c5 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap @@ -9,11 +9,3 @@ sys_exit_alias_12.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | ^^^^ PLR1722 | = help: Replace `exit` with `sys.exit()` - -1 |-import os \ - 1 |+import os; import sys \ -2 2 | -3 |-exit(0) - 3 |+sys.exit(0) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap index 064d2c1dcbccc..ef0ee7ba6cb3f 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap @@ -11,15 +11,6 @@ sys_exit_alias_2.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -1 1 | import sys as sys2 -2 2 | -3 |-exit(0) - 3 |+sys2.exit(0) -4 4 | quit(0) -5 5 | -6 6 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_2.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | @@ -29,16 +20,6 @@ sys_exit_alias_2.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -1 1 | import sys as sys2 -2 2 | -3 3 | exit(0) -4 |-quit(0) - 4 |+sys2.exit(0) -5 5 | -6 6 | -7 7 | def main(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_2.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | @@ -49,14 +30,6 @@ sys_exit_alias_2.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -5 5 | -6 6 | -7 7 | def main(): -8 |- exit(1) - 8 |+ sys2.exit(1) -9 9 | quit(1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_2.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | @@ -66,11 +39,3 @@ sys_exit_alias_2.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | ^^^^ PLR1722 | = help: Replace `quit` with `sys.exit()` - -6 6 | -7 7 | def main(): -8 8 | exit(1) -9 |- quit(1) - 9 |+ sys2.exit(1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap index 5710cb7ad9648..528f0394f9969 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap @@ -9,16 +9,6 @@ sys_exit_alias_3.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -1 1 | from sys import exit -2 2 | -3 3 | exit(0) -4 |-quit(0) - 4 |+exit(0) -5 5 | -6 6 | -7 7 | def main(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_3.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | @@ -29,16 +19,6 @@ sys_exit_alias_3.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -6 6 | -7 7 | def main(): -8 8 | exit(1) -9 |- quit(1) - 9 |+ exit(1) -10 10 | -11 11 | -12 12 | def main(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_3.py:16:5: PLR1722 Use `sys.exit()` instead of `quit` | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap index e835ddefb16f1..6d38aa252642c 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap @@ -11,15 +11,6 @@ sys_exit_alias_4.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -1 1 | from sys import exit as exit2 -2 2 | -3 |-exit(0) - 3 |+exit2(0) -4 4 | quit(0) -5 5 | -6 6 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_4.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | @@ -29,16 +20,6 @@ sys_exit_alias_4.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -1 1 | from sys import exit as exit2 -2 2 | -3 3 | exit(0) -4 |-quit(0) - 4 |+exit2(0) -5 5 | -6 6 | -7 7 | def main(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_4.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | @@ -49,14 +30,6 @@ sys_exit_alias_4.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -5 5 | -6 6 | -7 7 | def main(): -8 |- exit(1) - 8 |+ exit2(1) -9 9 | quit(1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_4.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | @@ -66,11 +39,3 @@ sys_exit_alias_4.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | ^^^^ PLR1722 | = help: Replace `quit` with `sys.exit()` - -6 6 | -7 7 | def main(): -8 8 | exit(1) -9 |- quit(1) - 9 |+ exit2(1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap index c80c4346f8bf6..e06a824d5e7d1 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap @@ -11,16 +11,6 @@ sys_exit_alias_5.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -1 1 | from sys import * - 2 |+import sys -2 3 | -3 |-exit(0) - 4 |+sys.exit(0) -4 5 | quit(0) -5 6 | -6 7 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_5.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | @@ -30,17 +20,6 @@ sys_exit_alias_5.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -1 1 | from sys import * - 2 |+import sys -2 3 | -3 4 | exit(0) -4 |-quit(0) - 5 |+sys.exit(0) -5 6 | -6 7 | -7 8 | def main(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_5.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | @@ -51,19 +30,6 @@ sys_exit_alias_5.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -1 1 | from sys import * - 2 |+import sys -2 3 | -3 4 | exit(0) -4 5 | quit(0) -5 6 | -6 7 | -7 8 | def main(): -8 |- exit(1) - 9 |+ sys.exit(1) -9 10 | quit(1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_5.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | @@ -73,17 +39,3 @@ sys_exit_alias_5.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | ^^^^ PLR1722 | = help: Replace `quit` with `sys.exit()` - -1 1 | from sys import * - 2 |+import sys -2 3 | -3 4 | exit(0) -4 5 | quit(0) --------------------------------------------------------------------------------- -6 7 | -7 8 | def main(): -8 9 | exit(1) -9 |- quit(1) - 10 |+ sys.exit(1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap index e22439d67e0f8..0445fe5d1cdcf 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap @@ -9,14 +9,6 @@ sys_exit_alias_6.py:1:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -1 |-exit(0) - 1 |+import sys - 2 |+sys.exit(0) -2 3 | quit(0) -3 4 | -4 5 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. sys_exit_alias_6.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | @@ -25,13 +17,3 @@ sys_exit_alias_6.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | ^^^^ PLR1722 | = help: Replace `quit` with `sys.exit()` - - 1 |+import sys -1 2 | exit(0) -2 |-quit(0) - 3 |+sys.exit(0) -3 4 | -4 5 | -5 6 | def exit(e): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap index 6c62a98f66315..4b641154936f6 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap @@ -8,13 +8,3 @@ sys_exit_alias_7.py:2:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | ^^^^ PLR1722 | = help: Replace `exit` with `sys.exit()` - - 1 |+import sys -1 2 | def main(): -2 |- exit(0) - 3 |+ sys.exit(0) -3 4 | -4 5 | -5 6 | import functools - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap index 3a50f62c2c56c..78989894f649c 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap @@ -8,11 +8,3 @@ sys_exit_alias_8.py:5:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | ^^^^ PLR1722 | = help: Replace `exit` with `sys.exit()` - -1 |-from sys import argv - 1 |+from sys import argv, exit -2 2 | -3 3 | -4 4 | def main(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap index f08ee7439ae18..fafd6967976d0 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap @@ -8,13 +8,3 @@ sys_exit_alias_9.py:2:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | ^^^^ PLR1722 | = help: Replace `exit` with `sys.exit()` - - 1 |+import sys -1 2 | def main(): -2 |- exit(0) - 3 |+ sys.exit(0) -3 4 | -4 5 | -5 6 | from sys import argv - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap index 74a5c92b04c92..ef2a96c577256 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6104_non_augmented_assignment.py.snap @@ -12,16 +12,6 @@ non_augmented_assignment.py:16:1: PLR6104 [*] Use `+=` to perform an augmented a | = help: Replace with augmented assignment -13 13 | some_set = {"elem"} -14 14 | mat1, mat2 = None, None -15 15 | -16 |-some_string = some_string + "a very long end of string" - 16 |+some_string += "a very long end of string" -17 17 | index = index - 1 -18 18 | a_list = a_list + ["to concat"] -19 19 | some_set = some_set | {"to concat"} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:17:1: PLR6104 [*] Use `-=` to perform an augmented assignment directly | @@ -33,16 +23,6 @@ non_augmented_assignment.py:17:1: PLR6104 [*] Use `-=` to perform an augmented a | = help: Replace with augmented assignment -14 14 | mat1, mat2 = None, None -15 15 | -16 16 | some_string = some_string + "a very long end of string" -17 |-index = index - 1 - 17 |+index -= 1 -18 18 | a_list = a_list + ["to concat"] -19 19 | some_set = some_set | {"to concat"} -20 20 | to_multiply = to_multiply * 5 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:18:1: PLR6104 [*] Use `+=` to perform an augmented assignment directly | @@ -55,16 +35,6 @@ non_augmented_assignment.py:18:1: PLR6104 [*] Use `+=` to perform an augmented a | = help: Replace with augmented assignment -15 15 | -16 16 | some_string = some_string + "a very long end of string" -17 17 | index = index - 1 -18 |-a_list = a_list + ["to concat"] - 18 |+a_list += ["to concat"] -19 19 | some_set = some_set | {"to concat"} -20 20 | to_multiply = to_multiply * 5 -21 21 | to_multiply = 5 * to_multiply - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:19:1: PLR6104 [*] Use `|=` to perform an augmented assignment directly | @@ -77,16 +47,6 @@ non_augmented_assignment.py:19:1: PLR6104 [*] Use `|=` to perform an augmented a | = help: Replace with augmented assignment -16 16 | some_string = some_string + "a very long end of string" -17 17 | index = index - 1 -18 18 | a_list = a_list + ["to concat"] -19 |-some_set = some_set | {"to concat"} - 19 |+some_set |= {"to concat"} -20 20 | to_multiply = to_multiply * 5 -21 21 | to_multiply = 5 * to_multiply -22 22 | to_multiply = to_multiply * to_multiply - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:20:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | @@ -99,16 +59,6 @@ non_augmented_assignment.py:20:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -17 17 | index = index - 1 -18 18 | a_list = a_list + ["to concat"] -19 19 | some_set = some_set | {"to concat"} -20 |-to_multiply = to_multiply * 5 - 20 |+to_multiply *= 5 -21 21 | to_multiply = 5 * to_multiply -22 22 | to_multiply = to_multiply * to_multiply -23 23 | to_divide = to_divide / 5 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:21:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | @@ -121,16 +71,6 @@ non_augmented_assignment.py:21:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -18 18 | a_list = a_list + ["to concat"] -19 19 | some_set = some_set | {"to concat"} -20 20 | to_multiply = to_multiply * 5 -21 |-to_multiply = 5 * to_multiply - 21 |+to_multiply *= 5 -22 22 | to_multiply = to_multiply * to_multiply -23 23 | to_divide = to_divide / 5 -24 24 | to_divide = to_divide // 5 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:22:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | @@ -143,16 +83,6 @@ non_augmented_assignment.py:22:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -19 19 | some_set = some_set | {"to concat"} -20 20 | to_multiply = to_multiply * 5 -21 21 | to_multiply = 5 * to_multiply -22 |-to_multiply = to_multiply * to_multiply - 22 |+to_multiply *= to_multiply -23 23 | to_divide = to_divide / 5 -24 24 | to_divide = to_divide // 5 -25 25 | to_cube = to_cube**3 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:23:1: PLR6104 [*] Use `/=` to perform an augmented assignment directly | @@ -165,16 +95,6 @@ non_augmented_assignment.py:23:1: PLR6104 [*] Use `/=` to perform an augmented a | = help: Replace with augmented assignment -20 20 | to_multiply = to_multiply * 5 -21 21 | to_multiply = 5 * to_multiply -22 22 | to_multiply = to_multiply * to_multiply -23 |-to_divide = to_divide / 5 - 23 |+to_divide /= 5 -24 24 | to_divide = to_divide // 5 -25 25 | to_cube = to_cube**3 -26 26 | to_cube = 3**to_cube - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:24:1: PLR6104 [*] Use `//=` to perform an augmented assignment directly | @@ -187,16 +107,6 @@ non_augmented_assignment.py:24:1: PLR6104 [*] Use `//=` to perform an augmented | = help: Replace with augmented assignment -21 21 | to_multiply = 5 * to_multiply -22 22 | to_multiply = to_multiply * to_multiply -23 23 | to_divide = to_divide / 5 -24 |-to_divide = to_divide // 5 - 24 |+to_divide //= 5 -25 25 | to_cube = to_cube**3 -26 26 | to_cube = 3**to_cube -27 27 | to_cube = to_cube**to_cube - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:25:1: PLR6104 [*] Use `**=` to perform an augmented assignment directly | @@ -209,16 +119,6 @@ non_augmented_assignment.py:25:1: PLR6104 [*] Use `**=` to perform an augmented | = help: Replace with augmented assignment -22 22 | to_multiply = to_multiply * to_multiply -23 23 | to_divide = to_divide / 5 -24 24 | to_divide = to_divide // 5 -25 |-to_cube = to_cube**3 - 25 |+to_cube **= 3 -26 26 | to_cube = 3**to_cube -27 27 | to_cube = to_cube**to_cube -28 28 | timeDiffSeconds = timeDiffSeconds % 60 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:27:1: PLR6104 [*] Use `**=` to perform an augmented assignment directly | @@ -231,16 +131,6 @@ non_augmented_assignment.py:27:1: PLR6104 [*] Use `**=` to perform an augmented | = help: Replace with augmented assignment -24 24 | to_divide = to_divide // 5 -25 25 | to_cube = to_cube**3 -26 26 | to_cube = 3**to_cube -27 |-to_cube = to_cube**to_cube - 27 |+to_cube **= to_cube -28 28 | timeDiffSeconds = timeDiffSeconds % 60 -29 29 | flags = flags & 0x1 -30 30 | flags = flags | 0x1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:28:1: PLR6104 [*] Use `%=` to perform an augmented assignment directly | @@ -253,16 +143,6 @@ non_augmented_assignment.py:28:1: PLR6104 [*] Use `%=` to perform an augmented a | = help: Replace with augmented assignment -25 25 | to_cube = to_cube**3 -26 26 | to_cube = 3**to_cube -27 27 | to_cube = to_cube**to_cube -28 |-timeDiffSeconds = timeDiffSeconds % 60 - 28 |+timeDiffSeconds %= 60 -29 29 | flags = flags & 0x1 -30 30 | flags = flags | 0x1 -31 31 | flags = flags ^ 0x1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:29:1: PLR6104 [*] Use `&=` to perform an augmented assignment directly | @@ -275,16 +155,6 @@ non_augmented_assignment.py:29:1: PLR6104 [*] Use `&=` to perform an augmented a | = help: Replace with augmented assignment -26 26 | to_cube = 3**to_cube -27 27 | to_cube = to_cube**to_cube -28 28 | timeDiffSeconds = timeDiffSeconds % 60 -29 |-flags = flags & 0x1 - 29 |+flags &= 1 -30 30 | flags = flags | 0x1 -31 31 | flags = flags ^ 0x1 -32 32 | flags = flags << 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:30:1: PLR6104 [*] Use `|=` to perform an augmented assignment directly | @@ -297,16 +167,6 @@ non_augmented_assignment.py:30:1: PLR6104 [*] Use `|=` to perform an augmented a | = help: Replace with augmented assignment -27 27 | to_cube = to_cube**to_cube -28 28 | timeDiffSeconds = timeDiffSeconds % 60 -29 29 | flags = flags & 0x1 -30 |-flags = flags | 0x1 - 30 |+flags |= 1 -31 31 | flags = flags ^ 0x1 -32 32 | flags = flags << 1 -33 33 | flags = flags >> 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:31:1: PLR6104 [*] Use `^=` to perform an augmented assignment directly | @@ -319,16 +179,6 @@ non_augmented_assignment.py:31:1: PLR6104 [*] Use `^=` to perform an augmented a | = help: Replace with augmented assignment -28 28 | timeDiffSeconds = timeDiffSeconds % 60 -29 29 | flags = flags & 0x1 -30 30 | flags = flags | 0x1 -31 |-flags = flags ^ 0x1 - 31 |+flags ^= 1 -32 32 | flags = flags << 1 -33 33 | flags = flags >> 1 -34 34 | mat1 = mat1 @ mat2 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:32:1: PLR6104 [*] Use `<<=` to perform an augmented assignment directly | @@ -341,16 +191,6 @@ non_augmented_assignment.py:32:1: PLR6104 [*] Use `<<=` to perform an augmented | = help: Replace with augmented assignment -29 29 | flags = flags & 0x1 -30 30 | flags = flags | 0x1 -31 31 | flags = flags ^ 0x1 -32 |-flags = flags << 1 - 32 |+flags <<= 1 -33 33 | flags = flags >> 1 -34 34 | mat1 = mat1 @ mat2 -35 35 | a_list[1] = a_list[1] + 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:33:1: PLR6104 [*] Use `>>=` to perform an augmented assignment directly | @@ -363,16 +203,6 @@ non_augmented_assignment.py:33:1: PLR6104 [*] Use `>>=` to perform an augmented | = help: Replace with augmented assignment -30 30 | flags = flags | 0x1 -31 31 | flags = flags ^ 0x1 -32 32 | flags = flags << 1 -33 |-flags = flags >> 1 - 33 |+flags >>= 1 -34 34 | mat1 = mat1 @ mat2 -35 35 | a_list[1] = a_list[1] + 1 -36 36 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:34:1: PLR6104 [*] Use `@=` to perform an augmented assignment directly | @@ -384,16 +214,6 @@ non_augmented_assignment.py:34:1: PLR6104 [*] Use `@=` to perform an augmented a | = help: Replace with augmented assignment -31 31 | flags = flags ^ 0x1 -32 32 | flags = flags << 1 -33 33 | flags = flags >> 1 -34 |-mat1 = mat1 @ mat2 - 34 |+mat1 @= mat2 -35 35 | a_list[1] = a_list[1] + 1 -36 36 | -37 37 | a_list[0:2] = a_list[0:2] * 3 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:35:1: PLR6104 [*] Use `+=` to perform an augmented assignment directly | @@ -406,16 +226,6 @@ non_augmented_assignment.py:35:1: PLR6104 [*] Use `+=` to perform an augmented a | = help: Replace with augmented assignment -32 32 | flags = flags << 1 -33 33 | flags = flags >> 1 -34 34 | mat1 = mat1 @ mat2 -35 |-a_list[1] = a_list[1] + 1 - 35 |+a_list[1] += 1 -36 36 | -37 37 | a_list[0:2] = a_list[0:2] * 3 -38 38 | a_list[:2] = a_list[:2] * 3 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:37:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | @@ -428,16 +238,6 @@ non_augmented_assignment.py:37:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -34 34 | mat1 = mat1 @ mat2 -35 35 | a_list[1] = a_list[1] + 1 -36 36 | -37 |-a_list[0:2] = a_list[0:2] * 3 - 37 |+a_list[0:2] *= 3 -38 38 | a_list[:2] = a_list[:2] * 3 -39 39 | a_list[1:] = a_list[1:] * 3 -40 40 | a_list[:] = a_list[:] * 3 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:38:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | @@ -449,16 +249,6 @@ non_augmented_assignment.py:38:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -35 35 | a_list[1] = a_list[1] + 1 -36 36 | -37 37 | a_list[0:2] = a_list[0:2] * 3 -38 |-a_list[:2] = a_list[:2] * 3 - 38 |+a_list[:2] *= 3 -39 39 | a_list[1:] = a_list[1:] * 3 -40 40 | a_list[:] = a_list[:] * 3 -41 41 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:39:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | @@ -470,16 +260,6 @@ non_augmented_assignment.py:39:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -36 36 | -37 37 | a_list[0:2] = a_list[0:2] * 3 -38 38 | a_list[:2] = a_list[:2] * 3 -39 |-a_list[1:] = a_list[1:] * 3 - 39 |+a_list[1:] *= 3 -40 40 | a_list[:] = a_list[:] * 3 -41 41 | -42 42 | index = index * (index + 10) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:40:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | @@ -492,16 +272,6 @@ non_augmented_assignment.py:40:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -37 37 | a_list[0:2] = a_list[0:2] * 3 -38 38 | a_list[:2] = a_list[:2] * 3 -39 39 | a_list[1:] = a_list[1:] * 3 -40 |-a_list[:] = a_list[:] * 3 - 40 |+a_list[:] *= 3 -41 41 | -42 42 | index = index * (index + 10) -43 43 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:42:1: PLR6104 [*] Use `*=` to perform an augmented assignment directly | @@ -512,16 +282,6 @@ non_augmented_assignment.py:42:1: PLR6104 [*] Use `*=` to perform an augmented a | = help: Replace with augmented assignment -39 39 | a_list[1:] = a_list[1:] * 3 -40 40 | a_list[:] = a_list[:] * 3 -41 41 | -42 |-index = index * (index + 10) - 42 |+index *= index + 10 -43 43 | -44 44 | -45 45 | class T: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:47:9: PLR6104 [*] Use `+=` to perform an augmented assignment directly | @@ -532,16 +292,6 @@ non_augmented_assignment.py:47:9: PLR6104 [*] Use `+=` to perform an augmented a | = help: Replace with augmented assignment -44 44 | -45 45 | class T: -46 46 | def t(self): -47 |- self.a = self.a + 1 - 47 |+ self.a += 1 -48 48 | -49 49 | -50 50 | obj = T() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. non_augmented_assignment.py:51:1: PLR6104 [*] Use `+=` to perform an augmented assignment directly | @@ -552,14 +302,3 @@ non_augmented_assignment.py:51:1: PLR6104 [*] Use `+=` to perform an augmented a 53 | # OK | = help: Replace with augmented assignment - -48 48 | -49 49 | -50 50 | obj = T() -51 |-obj.a = obj.a + 1 - 51 |+obj.a += 1 -52 52 | -53 53 | # OK -54 54 | a_list[0] = a_list[:] * 3 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6201_literal_membership.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6201_literal_membership.py.snap index 375040b494656..476a323e4078e 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6201_literal_membership.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6201_literal_membership.py.snap @@ -11,14 +11,6 @@ literal_membership.py:2:6: PLR6201 [*] Use a set literal when testing for member | = help: Convert to `set` -1 1 | # Errors -2 |-1 in [1, 2, 3] - 2 |+1 in {1, 2, 3} -3 3 | 1 in (1, 2, 3) -4 4 | 1 in ( -5 5 | 1, 2, 3 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. literal_membership.py:3:6: PLR6201 [*] Use a set literal when testing for membership | @@ -31,15 +23,6 @@ literal_membership.py:3:6: PLR6201 [*] Use a set literal when testing for member | = help: Convert to `set` -1 1 | # Errors -2 2 | 1 in [1, 2, 3] -3 |-1 in (1, 2, 3) - 3 |+1 in {1, 2, 3} -4 4 | 1 in ( -5 5 | 1, 2, 3 -6 6 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. literal_membership.py:4:6: PLR6201 [*] Use a set literal when testing for membership | @@ -55,19 +38,6 @@ literal_membership.py:4:6: PLR6201 [*] Use a set literal when testing for member | = help: Convert to `set` -1 1 | # Errors -2 2 | 1 in [1, 2, 3] -3 3 | 1 in (1, 2, 3) -4 |-1 in ( - 4 |+1 in { -5 5 | 1, 2, 3 -6 |-) - 6 |+} -7 7 | fruits = ["cherry", "grapes"] -8 8 | "cherry" in fruits -9 9 | _ = {key: value for key, value in {"a": 1, "b": 2}.items() if key in ("a", "b")} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. literal_membership.py:9:70: PLR6201 [*] Use a set literal when testing for membership | @@ -79,14 +49,3 @@ literal_membership.py:9:70: PLR6201 [*] Use a set literal when testing for membe 11 | # OK | = help: Convert to `set` - -6 6 | ) -7 7 | fruits = ["cherry", "grapes"] -8 8 | "cherry" in fruits -9 |-_ = {key: value for key, value in {"a": 1, "b": 2}.items() if key in ("a", "b")} - 9 |+_ = {key: value for key, value in {"a": 1, "b": 2}.items() if key in {"a", "b"}} -10 10 | -11 11 | # OK -12 12 | fruits in [[1, 2, 3], [4, 5, 6]] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap index b2673a2f450a9..e9f6154e0e8ba 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0108_unnecessary_lambda.py.snap @@ -9,13 +9,6 @@ unnecessary_lambda.py:1:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -1 |-_ = lambda: print() # [unnecessary-lambda] - 1 |+_ = print # [unnecessary-lambda] -2 2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda] -3 3 | -4 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_lambda.py:2:5: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function | @@ -27,14 +20,6 @@ unnecessary_lambda.py:2:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -1 1 | _ = lambda: print() # [unnecessary-lambda] -2 |-_ = lambda x, y: min(x, y) # [unnecessary-lambda] - 2 |+_ = min # [unnecessary-lambda] -3 3 | -4 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] -5 5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_lambda.py:4:5: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function | @@ -47,16 +32,6 @@ unnecessary_lambda.py:4:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -1 1 | _ = lambda: print() # [unnecessary-lambda] -2 2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda] -3 3 | -4 |-_ = lambda *args: f(*args) # [unnecessary-lambda] - 4 |+_ = f # [unnecessary-lambda] -5 5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda] -6 6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda] -7 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_lambda.py:5:5: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function | @@ -68,16 +43,6 @@ unnecessary_lambda.py:5:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -2 2 | _ = lambda x, y: min(x, y) # [unnecessary-lambda] -3 3 | -4 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] -5 |-_ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda] - 5 |+_ = f # [unnecessary-lambda] -6 6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda] -7 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] -8 8 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_lambda.py:6:5: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function | @@ -89,16 +54,6 @@ unnecessary_lambda.py:6:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -3 3 | -4 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] -5 5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda] -6 |-_ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda] - 6 |+_ = f # [unnecessary-lambda] -7 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] -8 8 | -9 9 | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_lambda.py:7:5: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function | @@ -111,16 +66,6 @@ unnecessary_lambda.py:7:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -4 4 | _ = lambda *args: f(*args) # [unnecessary-lambda] -5 5 | _ = lambda **kwargs: f(**kwargs) # [unnecessary-lambda] -6 6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda] -7 |-_ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] - 7 |+_ = f # [unnecessary-lambda] -8 8 | -9 9 | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda] -10 10 | _ = lambda x, y: f(lambda x, y: x + y)(x, y) # [unnecessary-lambda] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_lambda.py:9:5: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function | @@ -132,16 +77,6 @@ unnecessary_lambda.py:9:5: PLW0108 [*] Lambda may be unnecessary; consider inlin | = help: Inline function call -6 6 | _ = lambda *args, **kwargs: f(*args, **kwargs) # [unnecessary-lambda] -7 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] -8 8 | -9 |-_ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda] - 9 |+_ = f(lambda x: x) # [unnecessary-lambda] -10 10 | _ = lambda x, y: f(lambda x, y: x + y)(x, y) # [unnecessary-lambda] -11 11 | -12 12 | # default value in lambda parameters - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unnecessary_lambda.py:10:5: PLW0108 [*] Lambda may be unnecessary; consider inlining inner function | @@ -152,14 +87,3 @@ unnecessary_lambda.py:10:5: PLW0108 [*] Lambda may be unnecessary; consider inli 12 | # default value in lambda parameters | = help: Inline function call - -7 7 | _ = lambda x, y, z, *args, **kwargs: f(x, y, z, *args, **kwargs) # [unnecessary-lambda] -8 8 | -9 9 | _ = lambda x: f(lambda x: x)(x) # [unnecessary-lambda] -10 |-_ = lambda x, y: f(lambda x, y: x + y)(x, y) # [unnecessary-lambda] - 10 |+_ = f(lambda x, y: x + y) # [unnecessary-lambda] -11 11 | -12 12 | # default value in lambda parameters -13 13 | _ = lambda x=42: print(x) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap index ea0c5caa9be7d..45515d952558c 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0133_useless_exception_statement.py.snap @@ -10,16 +10,6 @@ useless_exception_statement.py:7:5: PLW0133 [*] Missing `raise` statement on exc | = help: Add `raise` keyword -4 4 | -5 5 | # Test case 1: Useless exception statement -6 6 | def func(): -7 |- AssertionError("This is an assertion error") # PLW0133 - 7 |+ raise AssertionError("This is an assertion error") # PLW0133 -8 8 | -9 9 | -10 10 | # Test case 2: Useless exception statement in try-except block - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. useless_exception_statement.py:13:9: PLW0133 [*] Missing `raise` statement on exception | @@ -32,16 +22,6 @@ useless_exception_statement.py:13:9: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -10 10 | # Test case 2: Useless exception statement in try-except block -11 11 | def func(): -12 12 | try: -13 |- Exception("This is an exception") # PLW0133 - 13 |+ raise Exception("This is an exception") # PLW0133 -14 14 | except Exception as err: -15 15 | pass -16 16 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. useless_exception_statement.py:21:9: PLW0133 [*] Missing `raise` statement on exception | @@ -52,16 +32,6 @@ useless_exception_statement.py:21:9: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -18 18 | # Test case 3: Useless exception statement in if statement -19 19 | def func(): -20 20 | if True: -21 |- RuntimeError("This is an exception") # PLW0133 - 21 |+ raise RuntimeError("This is an exception") # PLW0133 -22 22 | -23 23 | -24 24 | # Test case 4: Useless exception statement in class - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. useless_exception_statement.py:28:13: PLW0133 [*] Missing `raise` statement on exception | @@ -72,16 +42,6 @@ useless_exception_statement.py:28:13: PLW0133 [*] Missing `raise` statement on e | = help: Add `raise` keyword -25 25 | def func(): -26 26 | class Class: -27 27 | def __init__(self): -28 |- TypeError("This is an exception") # PLW0133 - 28 |+ raise TypeError("This is an exception") # PLW0133 -29 29 | -30 30 | -31 31 | # Test case 5: Useless exception statement in function - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. useless_exception_statement.py:34:9: PLW0133 [*] Missing `raise` statement on exception | @@ -94,16 +54,6 @@ useless_exception_statement.py:34:9: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -31 31 | # Test case 5: Useless exception statement in function -32 32 | def func(): -33 33 | def inner(): -34 |- IndexError("This is an exception") # PLW0133 - 34 |+ raise IndexError("This is an exception") # PLW0133 -35 35 | -36 36 | inner() -37 37 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. useless_exception_statement.py:42:9: PLW0133 [*] Missing `raise` statement on exception | @@ -114,16 +64,6 @@ useless_exception_statement.py:42:9: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -39 39 | # Test case 6: Useless exception statement in while loop -40 40 | def func(): -41 41 | while True: -42 |- KeyError("This is an exception") # PLW0133 - 42 |+ raise KeyError("This is an exception") # PLW0133 -43 43 | -44 44 | -45 45 | # Test case 7: Useless exception statement in abstract class - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. useless_exception_statement.py:50:13: PLW0133 [*] Missing `raise` statement on exception | @@ -134,16 +74,6 @@ useless_exception_statement.py:50:13: PLW0133 [*] Missing `raise` statement on e | = help: Add `raise` keyword -47 47 | class Class(ABC): -48 48 | @abstractmethod -49 49 | def method(self): -50 |- NotImplementedError("This is an exception") # PLW0133 - 50 |+ raise NotImplementedError("This is an exception") # PLW0133 -51 51 | -52 52 | -53 53 | # Test case 8: Useless exception statement inside context manager - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. useless_exception_statement.py:56:9: PLW0133 [*] Missing `raise` statement on exception | @@ -154,16 +84,6 @@ useless_exception_statement.py:56:9: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -53 53 | # Test case 8: Useless exception statement inside context manager -54 54 | def func(): -55 55 | with suppress(AttributeError): -56 |- AttributeError("This is an exception") # PLW0133 - 56 |+ raise AttributeError("This is an exception") # PLW0133 -57 57 | -58 58 | -59 59 | # Test case 9: Useless exception statement in parentheses - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. useless_exception_statement.py:61:5: PLW0133 [*] Missing `raise` statement on exception | @@ -174,16 +94,6 @@ useless_exception_statement.py:61:5: PLW0133 [*] Missing `raise` statement on ex | = help: Add `raise` keyword -58 58 | -59 59 | # Test case 9: Useless exception statement in parentheses -60 60 | def func(): -61 |- (RuntimeError("This is an exception")) # PLW0133 - 61 |+ raise (RuntimeError("This is an exception")) # PLW0133 -62 62 | -63 63 | -64 64 | # Test case 10: Useless exception statement in continuation - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. useless_exception_statement.py:66:12: PLW0133 [*] Missing `raise` statement on exception | @@ -194,16 +104,6 @@ useless_exception_statement.py:66:12: PLW0133 [*] Missing `raise` statement on e | = help: Add `raise` keyword -63 63 | -64 64 | # Test case 10: Useless exception statement in continuation -65 65 | def func(): -66 |- x = 1; (RuntimeError("This is an exception")); y = 2 # PLW0133 - 66 |+ x = 1; raise (RuntimeError("This is an exception")); y = 2 # PLW0133 -67 67 | -68 68 | -69 69 | # Test case 11: Useless warning statement - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. useless_exception_statement.py:71:5: PLW0133 [*] Missing `raise` statement on exception | @@ -213,14 +113,3 @@ useless_exception_statement.py:71:5: PLW0133 [*] Missing `raise` statement on ex | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLW0133 | = help: Add `raise` keyword - -68 68 | -69 69 | # Test case 11: Useless warning statement -70 70 | def func(): -71 |- UserWarning("This is an assertion error") # PLW0133 - 71 |+ raise UserWarning("This is an assertion error") # PLW0133 -72 72 | -73 73 | -74 74 | # Non-violation test cases: PLW0133 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap index a85eab5ca8d09..af9f929220be9 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap @@ -76,14 +76,3 @@ subprocess_run_without_check.py:10:1: PLW1510 [*] `subprocess.run` without expli 12 | # Non-errors. | = help: Add explicit `check=False` - -7 7 | ["ls"], -8 8 | shell=False, -9 9 | ) -10 |-subprocess.run(["ls"], **kwargs) - 10 |+subprocess.run(["ls"], **kwargs, check=False) -11 11 | -12 12 | # Non-errors. -13 13 | subprocess.run("ls", check=True) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap index 2774a92a8ea18..849dc344eed0b 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1514_unspecified_encoding.py.snap @@ -11,16 +11,6 @@ unspecified_encoding.py:8:1: PLW1514 [*] `open` in text mode without explicit `e | = help: Add explicit `encoding` argument -5 5 | import codecs -6 6 | -7 7 | # Errors. -8 |-open("test.txt") - 8 |+open("test.txt", encoding="utf-8") -9 9 | io.TextIOWrapper(io.FileIO("test.txt")) -10 10 | hugo.TextIOWrapper(hugo.FileIO("test.txt")) -11 11 | tempfile.NamedTemporaryFile("w") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:9:1: PLW1514 [*] `io.TextIOWrapper` without explicit `encoding` argument | @@ -33,16 +23,6 @@ unspecified_encoding.py:9:1: PLW1514 [*] `io.TextIOWrapper` without explicit `en | = help: Add explicit `encoding` argument -6 6 | -7 7 | # Errors. -8 8 | open("test.txt") -9 |-io.TextIOWrapper(io.FileIO("test.txt")) - 9 |+io.TextIOWrapper(io.FileIO("test.txt"), encoding="utf-8") -10 10 | hugo.TextIOWrapper(hugo.FileIO("test.txt")) -11 11 | tempfile.NamedTemporaryFile("w") -12 12 | tempfile.TemporaryFile("w") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:10:1: PLW1514 [*] `io.TextIOWrapper` without explicit `encoding` argument | @@ -55,16 +35,6 @@ unspecified_encoding.py:10:1: PLW1514 [*] `io.TextIOWrapper` without explicit `e | = help: Add explicit `encoding` argument -7 7 | # Errors. -8 8 | open("test.txt") -9 9 | io.TextIOWrapper(io.FileIO("test.txt")) -10 |-hugo.TextIOWrapper(hugo.FileIO("test.txt")) - 10 |+hugo.TextIOWrapper(hugo.FileIO("test.txt"), encoding="utf-8") -11 11 | tempfile.NamedTemporaryFile("w") -12 12 | tempfile.TemporaryFile("w") -13 13 | codecs.open("test.txt") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:11:1: PLW1514 [*] `tempfile.NamedTemporaryFile` in text mode without explicit `encoding` argument | @@ -77,16 +47,6 @@ unspecified_encoding.py:11:1: PLW1514 [*] `tempfile.NamedTemporaryFile` in text | = help: Add explicit `encoding` argument -8 8 | open("test.txt") -9 9 | io.TextIOWrapper(io.FileIO("test.txt")) -10 10 | hugo.TextIOWrapper(hugo.FileIO("test.txt")) -11 |-tempfile.NamedTemporaryFile("w") - 11 |+tempfile.NamedTemporaryFile("w", encoding="utf-8") -12 12 | tempfile.TemporaryFile("w") -13 13 | codecs.open("test.txt") -14 14 | tempfile.SpooledTemporaryFile(0, "w") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:12:1: PLW1514 [*] `tempfile.TemporaryFile` in text mode without explicit `encoding` argument | @@ -99,16 +59,6 @@ unspecified_encoding.py:12:1: PLW1514 [*] `tempfile.TemporaryFile` in text mode | = help: Add explicit `encoding` argument -9 9 | io.TextIOWrapper(io.FileIO("test.txt")) -10 10 | hugo.TextIOWrapper(hugo.FileIO("test.txt")) -11 11 | tempfile.NamedTemporaryFile("w") -12 |-tempfile.TemporaryFile("w") - 12 |+tempfile.TemporaryFile("w", encoding="utf-8") -13 13 | codecs.open("test.txt") -14 14 | tempfile.SpooledTemporaryFile(0, "w") -15 15 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:13:1: PLW1514 [*] `codecs.open` in text mode without explicit `encoding` argument | @@ -120,16 +70,6 @@ unspecified_encoding.py:13:1: PLW1514 [*] `codecs.open` in text mode without exp | = help: Add explicit `encoding` argument -10 10 | hugo.TextIOWrapper(hugo.FileIO("test.txt")) -11 11 | tempfile.NamedTemporaryFile("w") -12 12 | tempfile.TemporaryFile("w") -13 |-codecs.open("test.txt") - 13 |+codecs.open("test.txt", encoding="utf-8") -14 14 | tempfile.SpooledTemporaryFile(0, "w") -15 15 | -16 16 | # Non-errors. - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:14:1: PLW1514 [*] `tempfile.SpooledTemporaryFile` in text mode without explicit `encoding` argument | @@ -142,16 +82,6 @@ unspecified_encoding.py:14:1: PLW1514 [*] `tempfile.SpooledTemporaryFile` in tex | = help: Add explicit `encoding` argument -11 11 | tempfile.NamedTemporaryFile("w") -12 12 | tempfile.TemporaryFile("w") -13 13 | codecs.open("test.txt") -14 |-tempfile.SpooledTemporaryFile(0, "w") - 14 |+tempfile.SpooledTemporaryFile(0, "w", encoding="utf-8") -15 15 | -16 16 | # Non-errors. -17 17 | open("test.txt", encoding="utf-8") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:46:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | @@ -164,16 +94,6 @@ unspecified_encoding.py:46:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -43 43 | tempfile.SpooledTemporaryFile(0, "wb") -44 44 | tempfile.SpooledTemporaryFile(0, ) -45 45 | -46 |-open("test.txt",) - 46 |+open("test.txt", encoding="utf-8",) -47 47 | open() -48 48 | open( -49 49 | "test.txt", # comment - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:47:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | @@ -185,16 +105,6 @@ unspecified_encoding.py:47:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -44 44 | tempfile.SpooledTemporaryFile(0, ) -45 45 | -46 46 | open("test.txt",) -47 |-open() - 47 |+open(encoding="utf-8") -48 48 | open( -49 49 | "test.txt", # comment -50 50 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:48:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | @@ -207,16 +117,6 @@ unspecified_encoding.py:48:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -46 46 | open("test.txt",) -47 47 | open() -48 48 | open( -49 |- "test.txt", # comment - 49 |+ "test.txt", encoding="utf-8", # comment -50 50 | ) -51 51 | open( -52 52 | "test.txt", - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:51:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | @@ -229,16 +129,6 @@ unspecified_encoding.py:51:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -49 49 | "test.txt", # comment -50 50 | ) -51 51 | open( -52 |- "test.txt", - 52 |+ "test.txt", encoding="utf-8", -53 53 | # comment -54 54 | ) -55 55 | open(("test.txt"),) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:55:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | @@ -251,16 +141,6 @@ unspecified_encoding.py:55:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -52 52 | "test.txt", -53 53 | # comment -54 54 | ) -55 |-open(("test.txt"),) - 55 |+open(("test.txt"), encoding="utf-8",) -56 56 | open( -57 57 | ("test.txt"), # comment -58 58 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:56:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | @@ -273,16 +153,6 @@ unspecified_encoding.py:56:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -54 54 | ) -55 55 | open(("test.txt"),) -56 56 | open( -57 |- ("test.txt"), # comment - 57 |+ ("test.txt"), encoding="utf-8", # comment -58 58 | ) -59 59 | open( -60 60 | ("test.txt"), - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:59:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | @@ -295,16 +165,6 @@ unspecified_encoding.py:59:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -57 57 | ("test.txt"), # comment -58 58 | ) -59 59 | open( -60 |- ("test.txt"), - 60 |+ ("test.txt"), encoding="utf-8", -61 61 | # comment -62 62 | ) -63 63 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:64:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | @@ -317,16 +177,6 @@ unspecified_encoding.py:64:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -61 61 | # comment -62 62 | ) -63 63 | -64 |-open((("test.txt")),) - 64 |+open((("test.txt")), encoding="utf-8",) -65 65 | open( -66 66 | (("test.txt")), # comment -67 67 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:65:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | @@ -338,16 +188,6 @@ unspecified_encoding.py:65:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -63 63 | -64 64 | open((("test.txt")),) -65 65 | open( -66 |- (("test.txt")), # comment - 66 |+ (("test.txt")), encoding="utf-8", # comment -67 67 | ) -68 68 | open( -69 69 | (("test.txt")), - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:68:1: PLW1514 [*] `open` in text mode without explicit `encoding` argument | @@ -360,16 +200,6 @@ unspecified_encoding.py:68:1: PLW1514 [*] `open` in text mode without explicit ` | = help: Add explicit `encoding` argument -66 66 | (("test.txt")), # comment -67 67 | ) -68 68 | open( -69 |- (("test.txt")), - 69 |+ (("test.txt")), encoding="utf-8", -70 70 | # comment -71 71 | ) -72 72 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:77:1: PLW1514 [*] `pathlib.Path(...).open` in text mode without explicit `encoding` argument | @@ -381,16 +211,6 @@ unspecified_encoding.py:77:1: PLW1514 [*] `pathlib.Path(...).open` in text mode | = help: Add explicit `encoding` argument -74 74 | from pathlib import Path -75 75 | -76 76 | # Errors. -77 |-Path("foo.txt").open() - 77 |+Path("foo.txt").open(encoding="utf-8") -78 78 | Path("foo.txt").open("w") -79 79 | text = Path("foo.txt").read_text() -80 80 | Path("foo.txt").write_text(text) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:78:1: PLW1514 [*] `pathlib.Path(...).open` in text mode without explicit `encoding` argument | @@ -403,16 +223,6 @@ unspecified_encoding.py:78:1: PLW1514 [*] `pathlib.Path(...).open` in text mode | = help: Add explicit `encoding` argument -75 75 | -76 76 | # Errors. -77 77 | Path("foo.txt").open() -78 |-Path("foo.txt").open("w") - 78 |+Path("foo.txt").open("w", encoding="utf-8") -79 79 | text = Path("foo.txt").read_text() -80 80 | Path("foo.txt").write_text(text) -81 81 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:79:8: PLW1514 [*] `pathlib.Path(...).read_text` without explicit `encoding` argument | @@ -424,16 +234,6 @@ unspecified_encoding.py:79:8: PLW1514 [*] `pathlib.Path(...).read_text` without | = help: Add explicit `encoding` argument -76 76 | # Errors. -77 77 | Path("foo.txt").open() -78 78 | Path("foo.txt").open("w") -79 |-text = Path("foo.txt").read_text() - 79 |+text = Path("foo.txt").read_text(encoding="utf-8") -80 80 | Path("foo.txt").write_text(text) -81 81 | -82 82 | # Non-errors. - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unspecified_encoding.py:80:1: PLW1514 [*] `pathlib.Path(...).write_text` without explicit `encoding` argument | @@ -445,14 +245,3 @@ unspecified_encoding.py:80:1: PLW1514 [*] `pathlib.Path(...).write_text` without 82 | # Non-errors. | = help: Add explicit `encoding` argument - -77 77 | Path("foo.txt").open() -78 78 | Path("foo.txt").open("w") -79 79 | text = Path("foo.txt").read_text() -80 |-Path("foo.txt").write_text(text) - 80 |+Path("foo.txt").write_text(text, encoding="utf-8") -81 81 | -82 82 | # Non-errors. -83 83 | Path("foo.txt").open(encoding="utf-8") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap index c658e3be9e17f..4532469f4172b 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap @@ -11,14 +11,6 @@ nested_min_max.py:2:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -1 1 | min(1, 2, 3) -2 |-min(1, min(2, 3)) - 2 |+min(1, 2, 3) -3 3 | min(1, min(2, min(3, 4))) -4 4 | min(1, foo("a", "b"), min(3, 4)) -5 5 | min(1, max(2, 3)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. nested_min_max.py:3:1: PLW3301 [*] Nested `min` calls can be flattened | @@ -31,15 +23,6 @@ nested_min_max.py:3:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -1 1 | min(1, 2, 3) -2 2 | min(1, min(2, 3)) -3 |-min(1, min(2, min(3, 4))) - 3 |+min(1, 2, 3, 4) -4 4 | min(1, foo("a", "b"), min(3, 4)) -5 5 | min(1, max(2, 3)) -6 6 | max(1, 2, 3) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. nested_min_max.py:3:8: PLW3301 [*] Nested `min` calls can be flattened | @@ -52,15 +35,6 @@ nested_min_max.py:3:8: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -1 1 | min(1, 2, 3) -2 2 | min(1, min(2, 3)) -3 |-min(1, min(2, min(3, 4))) - 3 |+min(1, min(2, 3, 4)) -4 4 | min(1, foo("a", "b"), min(3, 4)) -5 5 | min(1, max(2, 3)) -6 6 | max(1, 2, 3) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. nested_min_max.py:4:1: PLW3301 [*] Nested `min` calls can be flattened | @@ -73,16 +47,6 @@ nested_min_max.py:4:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -1 1 | min(1, 2, 3) -2 2 | min(1, min(2, 3)) -3 3 | min(1, min(2, min(3, 4))) -4 |-min(1, foo("a", "b"), min(3, 4)) - 4 |+min(1, foo("a", "b"), 3, 4) -5 5 | min(1, max(2, 3)) -6 6 | max(1, 2, 3) -7 7 | max(1, max(2, 3)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. nested_min_max.py:7:1: PLW3301 [*] Nested `max` calls can be flattened | @@ -95,16 +59,6 @@ nested_min_max.py:7:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -4 4 | min(1, foo("a", "b"), min(3, 4)) -5 5 | min(1, max(2, 3)) -6 6 | max(1, 2, 3) -7 |-max(1, max(2, 3)) - 7 |+max(1, 2, 3) -8 8 | max(1, max(2, max(3, 4))) -9 9 | max(1, foo("a", "b"), max(3, 4)) -10 10 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. nested_min_max.py:8:1: PLW3301 [*] Nested `max` calls can be flattened | @@ -116,16 +70,6 @@ nested_min_max.py:8:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -5 5 | min(1, max(2, 3)) -6 6 | max(1, 2, 3) -7 7 | max(1, max(2, 3)) -8 |-max(1, max(2, max(3, 4))) - 8 |+max(1, 2, 3, 4) -9 9 | max(1, foo("a", "b"), max(3, 4)) -10 10 | -11 11 | # These should not trigger; we do not flag cases with keyword args. - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. nested_min_max.py:8:8: PLW3301 [*] Nested `max` calls can be flattened | @@ -137,16 +81,6 @@ nested_min_max.py:8:8: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -5 5 | min(1, max(2, 3)) -6 6 | max(1, 2, 3) -7 7 | max(1, max(2, 3)) -8 |-max(1, max(2, max(3, 4))) - 8 |+max(1, max(2, 3, 4)) -9 9 | max(1, foo("a", "b"), max(3, 4)) -10 10 | -11 11 | # These should not trigger; we do not flag cases with keyword args. - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. nested_min_max.py:9:1: PLW3301 [*] Nested `max` calls can be flattened | @@ -159,16 +93,6 @@ nested_min_max.py:9:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -6 6 | max(1, 2, 3) -7 7 | max(1, max(2, 3)) -8 8 | max(1, max(2, max(3, 4))) -9 |-max(1, foo("a", "b"), max(3, 4)) - 9 |+max(1, foo("a", "b"), 3, 4) -10 10 | -11 11 | # These should not trigger; we do not flag cases with keyword args. -12 12 | min(1, min(2, 3), key=test) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. nested_min_max.py:15:1: PLW3301 [*] Nested `min` calls can be flattened | @@ -181,16 +105,6 @@ nested_min_max.py:15:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -12 12 | min(1, min(2, 3), key=test) -13 13 | min(1, min(2, 3, key=test)) -14 14 | # This will still trigger, to merge the calls without keyword args. -15 |-min(1, min(2, 3, key=test), min(4, 5)) - 15 |+min(1, min(2, 3, key=test), 4, 5) -16 16 | -17 17 | # Don't provide a fix if there are comments within the call. -18 18 | min( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. nested_min_max.py:18:1: PLW3301 Nested `min` calls can be flattened | @@ -215,16 +129,6 @@ nested_min_max.py:24:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -21 21 | ) -22 22 | -23 23 | # Handle iterable expressions. -24 |-min(1, min(a)) - 24 |+min(1, *a) -25 25 | min(1, min(i for i in range(10))) -26 26 | max(1, max(a)) -27 27 | max(1, max(i for i in range(10))) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. nested_min_max.py:25:1: PLW3301 [*] Nested `min` calls can be flattened | @@ -237,16 +141,6 @@ nested_min_max.py:25:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -22 22 | -23 23 | # Handle iterable expressions. -24 24 | min(1, min(a)) -25 |-min(1, min(i for i in range(10))) - 25 |+min(1, *(i for i in range(10))) -26 26 | max(1, max(a)) -27 27 | max(1, max(i for i in range(10))) -28 28 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. nested_min_max.py:26:1: PLW3301 [*] Nested `max` calls can be flattened | @@ -258,16 +152,6 @@ nested_min_max.py:26:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -23 23 | # Handle iterable expressions. -24 24 | min(1, min(a)) -25 25 | min(1, min(i for i in range(10))) -26 |-max(1, max(a)) - 26 |+max(1, *a) -27 27 | max(1, max(i for i in range(10))) -28 28 | -29 29 | tuples_list = [ - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. nested_min_max.py:27:1: PLW3301 [*] Nested `max` calls can be flattened | @@ -280,16 +164,6 @@ nested_min_max.py:27:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -24 24 | min(1, min(a)) -25 25 | min(1, min(i for i in range(10))) -26 26 | max(1, max(a)) -27 |-max(1, max(i for i in range(10))) - 27 |+max(1, *(i for i in range(10))) -28 28 | -29 29 | tuples_list = [ -30 30 | (1, 2), - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. nested_min_max.py:41:1: PLW3301 [*] Nested `max` calls can be flattened | @@ -301,16 +175,6 @@ nested_min_max.py:41:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -38 38 | max(max(tuples_list)) -39 39 | -40 40 | # Starred argument should be copied as it is. -41 |-max(1, max(*a)) - 41 |+max(1, *a) -42 42 | -43 43 | import builtins -44 44 | builtins.min(1, min(2, 3)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. nested_min_max.py:44:1: PLW3301 [*] Nested `min` calls can be flattened | @@ -319,11 +183,3 @@ nested_min_max.py:44:1: PLW3301 [*] Nested `min` calls can be flattened | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PLW3301 | = help: Flatten nested `min` calls - -41 41 | max(1, max(*a)) -42 42 | -43 43 | import builtins -44 |-builtins.min(1, min(2, 3)) - 44 |+builtins.min(1, 2, 3) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap index 6e5020ea41d8c..5414388c27bf7 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap @@ -11,16 +11,6 @@ UP008.py:17:23: UP008 [*] Use `super()` instead of `super(__class__, self)` | = help: Remove `__super__` parameters -14 14 | Parent.super(1, 2) # ok -15 15 | -16 16 | def wrong(self): -17 |- parent = super(Child, self) # wrong - 17 |+ parent = super() # wrong -18 18 | super(Child, self).method # wrong -19 19 | super( -20 20 | Child, - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP008.py:18:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | @@ -33,16 +23,6 @@ UP008.py:18:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | = help: Remove `__super__` parameters -15 15 | -16 16 | def wrong(self): -17 17 | parent = super(Child, self) # wrong -18 |- super(Child, self).method # wrong - 18 |+ super().method # wrong -19 19 | super( -20 20 | Child, -21 21 | self, - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP008.py:19:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | @@ -57,19 +37,6 @@ UP008.py:19:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | = help: Remove `__super__` parameters -16 16 | def wrong(self): -17 17 | parent = super(Child, self) # wrong -18 18 | super(Child, self).method # wrong -19 |- super( -20 |- Child, -21 |- self, -22 |- ).method() # wrong - 19 |+ super().method() # wrong -23 20 | -24 21 | -25 22 | class BaseClass: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP008.py:36:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | @@ -81,16 +48,6 @@ UP008.py:36:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | = help: Remove `__super__` parameters -33 33 | -34 34 | class MyClass(BaseClass): -35 35 | def normal(self): -36 |- super(MyClass, self).f() # can use super() - 36 |+ super().f() # can use super() -37 37 | super().f() -38 38 | -39 39 | def different_argument(self, other): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP008.py:50:18: UP008 [*] Use `super()` instead of `super(__class__, self)` | @@ -101,16 +58,6 @@ UP008.py:50:18: UP008 [*] Use `super()` instead of `super(__class__, self)` | = help: Remove `__super__` parameters -47 47 | super(MyClass, self).f() # CANNOT use super() -48 48 | -49 49 | def inner_argument(self): -50 |- super(MyClass, self).f() # can use super() - 50 |+ super().f() # can use super() -51 51 | super().f() -52 52 | -53 53 | outer_argument() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP008.py:74:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | @@ -121,14 +68,3 @@ UP008.py:74:14: UP008 [*] Use `super()` instead of `super(__class__, self)` 75 | super().f() # OK | = help: Remove `__super__` parameters - -71 71 | @dataclass -72 72 | class DataClass: -73 73 | def normal(self): -74 |- super(DataClass, self).f() # Error - 74 |+ super().f() # Error -75 75 | super().f() # OK -76 76 | -77 77 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap index 68ac48a9a44c1..81816108c2a91 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap @@ -12,16 +12,6 @@ UP022.py:4:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stde | = help: Replace with `capture_output` keyword argument -1 1 | from subprocess import run -2 2 | import subprocess -3 3 | -4 |-output = run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - 4 |+output = run(["foo"], capture_output=True) -5 5 | -6 6 | output = subprocess.run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) -7 7 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP022.py:6:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | @@ -34,16 +24,6 @@ UP022.py:6:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stde | = help: Replace with `capture_output` keyword argument -3 3 | -4 4 | output = run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) -5 5 | -6 |-output = subprocess.run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - 6 |+output = subprocess.run(["foo"], capture_output=True) -7 7 | -8 8 | output = subprocess.run(stdout=subprocess.PIPE, args=["foo"], stderr=subprocess.PIPE) -9 9 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP022.py:8:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | @@ -56,16 +36,6 @@ UP022.py:8:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stde | = help: Replace with `capture_output` keyword argument -5 5 | -6 6 | output = subprocess.run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) -7 7 | -8 |-output = subprocess.run(stdout=subprocess.PIPE, args=["foo"], stderr=subprocess.PIPE) - 8 |+output = subprocess.run(capture_output=True, args=["foo"]) -9 9 | -10 10 | output = subprocess.run( -11 11 | ["foo"], stdout=subprocess.PIPE, check=True, stderr=subprocess.PIPE - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP022.py:10:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | @@ -81,16 +51,6 @@ UP022.py:10:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `std | = help: Replace with `capture_output` keyword argument -8 8 | output = subprocess.run(stdout=subprocess.PIPE, args=["foo"], stderr=subprocess.PIPE) -9 9 | -10 10 | output = subprocess.run( -11 |- ["foo"], stdout=subprocess.PIPE, check=True, stderr=subprocess.PIPE - 11 |+ ["foo"], capture_output=True, check=True -12 12 | ) -13 13 | -14 14 | output = subprocess.run( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP022.py:14:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | @@ -106,16 +66,6 @@ UP022.py:14:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `std | = help: Replace with `capture_output` keyword argument -12 12 | ) -13 13 | -14 14 | output = subprocess.run( -15 |- ["foo"], stderr=subprocess.PIPE, check=True, stdout=subprocess.PIPE - 15 |+ ["foo"], capture_output=True, check=True -16 16 | ) -17 17 | -18 18 | output = subprocess.run( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP022.py:18:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | @@ -137,18 +87,6 @@ UP022.py:18:10: UP022 [*] Prefer `capture_output` over sending `stdout` and `std | = help: Replace with `capture_output` keyword argument -17 17 | -18 18 | output = subprocess.run( -19 19 | ["foo"], -20 |- stdout=subprocess.PIPE, - 20 |+ capture_output=True, -21 21 | check=True, -22 |- stderr=subprocess.PIPE, -23 22 | text=True, -24 23 | encoding="utf-8", -25 24 | close_fds=True, - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP022.py:29:14: UP022 [*] Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | @@ -168,18 +106,6 @@ UP022.py:29:14: UP022 [*] Prefer `capture_output` over sending `stdout` and `std | = help: Replace with `capture_output` keyword argument -28 28 | if output: -29 29 | output = subprocess.run( -30 30 | ["foo"], -31 |- stdout=subprocess.PIPE, - 31 |+ capture_output=True, -32 32 | check=True, -33 |- stderr=subprocess.PIPE, -34 33 | text=True, -35 34 | encoding="utf-8", -36 35 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP022.py:38:10: UP022 Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap index d62cb55153e92..badb54487f685 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap @@ -11,15 +11,6 @@ UP028_0.py:2:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -1 1 | def f(): -2 |- for x in y: -3 |- yield x - 2 |+ yield from y -4 3 | -5 4 | -6 5 | def g(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP028_0.py:7:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | @@ -31,17 +22,6 @@ UP028_0.py:7:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -4 4 | -5 5 | -6 6 | def g(): -7 |- for x, y in z: -8 |- yield (x, y) - 7 |+ yield from z -9 8 | -10 9 | -11 10 | def h(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP028_0.py:12:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | @@ -53,17 +33,6 @@ UP028_0.py:12:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -9 9 | -10 10 | -11 11 | def h(): -12 |- for x in [1, 2, 3]: -13 |- yield x - 12 |+ yield from [1, 2, 3] -14 13 | -15 14 | -16 15 | def i(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP028_0.py:17:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | @@ -75,17 +44,6 @@ UP028_0.py:17:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -14 14 | -15 15 | -16 16 | def i(): -17 |- for x in {x for x in y}: -18 |- yield x - 17 |+ yield from {x for x in y} -19 18 | -20 19 | -21 20 | def j(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP028_0.py:22:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | @@ -97,17 +55,6 @@ UP028_0.py:22:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -19 19 | -20 20 | -21 21 | def j(): -22 |- for x in (1, 2, 3): -23 |- yield x - 22 |+ yield from (1, 2, 3) -24 23 | -25 24 | -26 25 | def k(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP028_0.py:27:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | @@ -119,17 +66,6 @@ UP028_0.py:27:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -24 24 | -25 25 | -26 26 | def k(): -27 |- for x, y in {3: "x", 6: "y"}: -28 |- yield x, y - 27 |+ yield from {3: "x", 6: "y"} -29 28 | -30 29 | -31 30 | def f(): # Comment one\n' - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP028_0.py:33:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | @@ -148,23 +84,6 @@ UP028_0.py:33:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -30 30 | -31 31 | def f(): # Comment one\n' -32 32 | # Comment two\n' -33 |- for x, y in { # Comment three\n' - 33 |+ yield from { # Comment three\n' -34 34 | 3: "x", # Comment four\n' -35 35 | # Comment five\n' -36 36 | 6: "y", # Comment six\n' -37 |- }: # Comment seven\n' -38 |- # Comment eight\n' -39 |- yield x, y # Comment nine\n' - 37 |+ } # Comment nine\n' -40 38 | # Comment ten', -41 39 | -42 40 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP028_0.py:44:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | @@ -176,17 +95,6 @@ UP028_0.py:44:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -41 41 | -42 42 | -43 43 | def f(): -44 |- for x, y in [{3: (3, [44, "long ss"]), 6: "y"}]: -45 |- yield x, y - 44 |+ yield from [{3: (3, [44, "long ss"]), 6: "y"}] -46 45 | -47 46 | -48 47 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP028_0.py:49:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | @@ -200,17 +108,6 @@ UP028_0.py:49:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -46 46 | -47 47 | -48 48 | def f(): -49 |- for x, y in z(): -50 |- yield x, y - 49 |+ yield from z() -51 50 | -52 51 | def f(): -53 52 | def func(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP028_0.py:55:9: UP028 [*] Replace `yield` over `for` loop with `yield from` | @@ -226,18 +123,6 @@ UP028_0.py:55:9: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -52 52 | def f(): -53 53 | def func(): -54 54 | # This comment is preserved\n' -55 |- for x, y in z(): # Comment one\n' -56 |- # Comment two\n' -57 |- yield x, y # Comment three\n' - 55 |+ yield from z() # Comment three\n' -58 56 | # Comment four\n' -59 57 | # Comment\n' -60 58 | def g(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP028_0.py:67:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | @@ -250,17 +135,6 @@ UP028_0.py:67:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -64 64 | def f(): -65 65 | for x in y: -66 66 | yield x -67 |- for z in x: -68 |- yield z - 67 |+ yield from x -69 68 | -70 69 | -71 70 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP028_0.py:72:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | @@ -273,17 +147,6 @@ UP028_0.py:72:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -69 69 | -70 70 | -71 71 | def f(): -72 |- for x, y in z(): -73 |- yield x, y - 72 |+ yield from z() -74 73 | x = 1 -75 74 | -76 75 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP028_0.py:79:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | @@ -298,16 +161,3 @@ UP028_0.py:79:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | |_______________^ UP028 | = help: Replace with `yield from` - -76 76 | -77 77 | # Regression test for: https://github.com/astral-sh/ruff/issues/7103 -78 78 | def _serve_method(fn): -79 |- for h in ( - 79 |+ yield from ( -80 80 | TaggedText.from_file(args.input) -81 81 | .markup(highlight=args.region) -82 |- ): -83 |- yield h - 82 |+ ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap index 5484106a8927a..1bcdf2c9e63ea 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap @@ -10,12 +10,6 @@ UP029.py:1:1: UP029 [*] Unnecessary builtin import: `*` | = help: Remove unnecessary builtin import -1 |-from builtins import * -2 1 | from builtins import ascii, bytes, compile -3 2 | from builtins import str as _str -4 3 | from six.moves import filter, zip, zip_longest - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP029.py:2:1: UP029 [*] Unnecessary builtin imports: `ascii`, `bytes` | @@ -27,14 +21,6 @@ UP029.py:2:1: UP029 [*] Unnecessary builtin imports: `ascii`, `bytes` | = help: Remove unnecessary builtin import -1 1 | from builtins import * -2 |-from builtins import ascii, bytes, compile - 2 |+from builtins import compile -3 3 | from builtins import str as _str -4 4 | from six.moves import filter, zip, zip_longest -5 5 | from io import open - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP029.py:4:1: UP029 [*] Unnecessary builtin imports: `filter`, `zip` | @@ -47,16 +33,6 @@ UP029.py:4:1: UP029 [*] Unnecessary builtin imports: `filter`, `zip` | = help: Remove unnecessary builtin import -1 1 | from builtins import * -2 2 | from builtins import ascii, bytes, compile -3 3 | from builtins import str as _str -4 |-from six.moves import filter, zip, zip_longest - 4 |+from six.moves import zip_longest -5 5 | from io import open -6 6 | import io -7 7 | import six - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP029.py:5:1: UP029 [*] Unnecessary builtin import: `open` | @@ -68,13 +44,3 @@ UP029.py:5:1: UP029 [*] Unnecessary builtin import: `open` 7 | import six | = help: Remove unnecessary builtin import - -2 2 | from builtins import ascii, bytes, compile -3 3 | from builtins import str as _str -4 4 | from six.moves import filter, zip, zip_longest -5 |-from io import open -6 5 | import io -7 6 | import six -8 7 | import six.moves - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap index 17769a0a81460..f22eab4dad322 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap @@ -12,15 +12,6 @@ UP030_0.py:3:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -1 1 | # Invalid calls; errors expected. -2 2 | -3 |-"{0}" "{1}" "{2}".format(1, 2, 3) - 3 |+"{}" "{}" "{}".format(1, 2, 3) -4 4 | -5 5 | "a {3} complicated {1} string with {0} {2}".format( -6 6 | "first", "second", "third", "fourth" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:5:1: UP030 [*] Use implicit references for positional format fields | @@ -35,18 +26,6 @@ UP030_0.py:5:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -2 2 | -3 3 | "{0}" "{1}" "{2}".format(1, 2, 3) -4 4 | -5 |-"a {3} complicated {1} string with {0} {2}".format( -6 |- "first", "second", "third", "fourth" - 5 |+"a {} complicated {} string with {} {}".format( - 6 |+ "fourth", "second", "first", "third" -7 7 | ) -8 8 | -9 9 | '{0}'.format(1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:9:1: UP030 [*] Use implicit references for positional format fields | @@ -59,16 +38,6 @@ UP030_0.py:9:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -6 6 | "first", "second", "third", "fourth" -7 7 | ) -8 8 | -9 |-'{0}'.format(1) - 9 |+'{}'.format(1) -10 10 | -11 11 | '{0:x}'.format(30) -12 12 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:11:1: UP030 [*] Use implicit references for positional format fields | @@ -81,16 +50,6 @@ UP030_0.py:11:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -8 8 | -9 9 | '{0}'.format(1) -10 10 | -11 |-'{0:x}'.format(30) - 11 |+'{:x}'.format(30) -12 12 | -13 13 | x = '{0}'.format(1) -14 14 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:13:5: UP030 [*] Use implicit references for positional format fields | @@ -103,16 +62,6 @@ UP030_0.py:13:5: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -10 10 | -11 11 | '{0:x}'.format(30) -12 12 | -13 |-x = '{0}'.format(1) - 13 |+x = '{}'.format(1) -14 14 | -15 15 | '''{0}\n{1}\n'''.format(1, 2) -16 16 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:15:1: UP030 [*] Use implicit references for positional format fields | @@ -125,16 +74,6 @@ UP030_0.py:15:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -12 12 | -13 13 | x = '{0}'.format(1) -14 14 | -15 |-'''{0}\n{1}\n'''.format(1, 2) - 15 |+'''{}\n{}\n'''.format(1, 2) -16 16 | -17 17 | x = "foo {0}" \ -18 18 | "bar {1}".format(1, 2) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:17:5: UP030 [*] Use implicit references for positional format fields | @@ -149,18 +88,6 @@ UP030_0.py:17:5: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -14 14 | -15 15 | '''{0}\n{1}\n'''.format(1, 2) -16 16 | -17 |-x = "foo {0}" \ -18 |- "bar {1}".format(1, 2) - 17 |+x = "foo {}" \ - 18 |+ "bar {}".format(1, 2) -19 19 | -20 20 | ("{0}").format(1) -21 21 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:20:1: UP030 [*] Use implicit references for positional format fields | @@ -173,16 +100,6 @@ UP030_0.py:20:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -17 17 | x = "foo {0}" \ -18 18 | "bar {1}".format(1, 2) -19 19 | -20 |-("{0}").format(1) - 20 |+("{}").format(1) -21 21 | -22 22 | "\N{snowman} {0}".format(1) -23 23 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:22:1: UP030 [*] Use implicit references for positional format fields | @@ -195,16 +112,6 @@ UP030_0.py:22:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -19 19 | -20 20 | ("{0}").format(1) -21 21 | -22 |-"\N{snowman} {0}".format(1) - 22 |+"\N{snowman} {}".format(1) -23 23 | -24 24 | print( -25 25 | 'foo{0}' - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:25:5: UP030 [*] Use implicit references for positional format fields | @@ -217,18 +124,6 @@ UP030_0.py:25:5: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -22 22 | "\N{snowman} {0}".format(1) -23 23 | -24 24 | print( -25 |- 'foo{0}' -26 |- 'bar{1}'.format(1, 2) - 25 |+ 'foo{}' - 26 |+ 'bar{}'.format(1, 2) -27 27 | ) -28 28 | -29 29 | print( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:30:5: UP030 [*] Use implicit references for positional format fields | @@ -241,18 +136,6 @@ UP030_0.py:30:5: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -27 27 | ) -28 28 | -29 29 | print( -30 |- 'foo{0}' # ohai\n" -31 |- 'bar{1}'.format(1, 2) - 30 |+ 'foo{}' # ohai\n" - 31 |+ 'bar{}'.format(1, 2) -32 32 | ) -33 33 | -34 34 | '{' '0}'.format(1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:34:1: UP030 Use implicit references for positional format fields | @@ -276,16 +159,6 @@ UP030_0.py:39:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -36 36 | args = list(range(10)) -37 37 | kwargs = {x: x for x in range(10)} -38 38 | -39 |-"{0}".format(*args) - 39 |+"{}".format(*args) -40 40 | -41 41 | "{0}".format(**kwargs) -42 42 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:41:1: UP030 [*] Use implicit references for positional format fields | @@ -298,16 +171,6 @@ UP030_0.py:41:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -38 38 | -39 39 | "{0}".format(*args) -40 40 | -41 |-"{0}".format(**kwargs) - 41 |+"{}".format(**kwargs) -42 42 | -43 43 | "{0}_{1}".format(*args) -44 44 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:43:1: UP030 [*] Use implicit references for positional format fields | @@ -320,16 +183,6 @@ UP030_0.py:43:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -40 40 | -41 41 | "{0}".format(**kwargs) -42 42 | -43 |-"{0}_{1}".format(*args) - 43 |+"{}_{}".format(*args) -44 44 | -45 45 | "{0}_{1}".format(1, *args) -46 46 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:45:1: UP030 [*] Use implicit references for positional format fields | @@ -342,16 +195,6 @@ UP030_0.py:45:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -42 42 | -43 43 | "{0}_{1}".format(*args) -44 44 | -45 |-"{0}_{1}".format(1, *args) - 45 |+"{}_{}".format(1, *args) -46 46 | -47 47 | "{0}_{1}".format(1, 2, *args) -48 48 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:47:1: UP030 [*] Use implicit references for positional format fields | @@ -364,16 +207,6 @@ UP030_0.py:47:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -44 44 | -45 45 | "{0}_{1}".format(1, *args) -46 46 | -47 |-"{0}_{1}".format(1, 2, *args) - 47 |+"{}_{}".format(1, 2, *args) -48 48 | -49 49 | "{0}_{1}".format(*args, 1, 2) -50 50 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:49:1: UP030 [*] Use implicit references for positional format fields | @@ -386,16 +219,6 @@ UP030_0.py:49:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -46 46 | -47 47 | "{0}_{1}".format(1, 2, *args) -48 48 | -49 |-"{0}_{1}".format(*args, 1, 2) - 49 |+"{}_{}".format(*args, 1, 2) -50 50 | -51 51 | "{0}_{1}_{2}".format(1, **kwargs) -52 52 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:51:1: UP030 [*] Use implicit references for positional format fields | @@ -408,16 +231,6 @@ UP030_0.py:51:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -48 48 | -49 49 | "{0}_{1}".format(*args, 1, 2) -50 50 | -51 |-"{0}_{1}_{2}".format(1, **kwargs) - 51 |+"{}_{}_{}".format(1, **kwargs) -52 52 | -53 53 | "{0}_{1}_{2}".format(1, 2, **kwargs) -54 54 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:53:1: UP030 [*] Use implicit references for positional format fields | @@ -430,16 +243,6 @@ UP030_0.py:53:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -50 50 | -51 51 | "{0}_{1}_{2}".format(1, **kwargs) -52 52 | -53 |-"{0}_{1}_{2}".format(1, 2, **kwargs) - 53 |+"{}_{}_{}".format(1, 2, **kwargs) -54 54 | -55 55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs) -56 56 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:55:1: UP030 [*] Use implicit references for positional format fields | @@ -452,16 +255,6 @@ UP030_0.py:55:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -52 52 | -53 53 | "{0}_{1}_{2}".format(1, 2, **kwargs) -54 54 | -55 |-"{0}_{1}_{2}".format(1, 2, 3, **kwargs) - 55 |+"{}_{}_{}".format(1, 2, 3, **kwargs) -56 56 | -57 57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs) -58 58 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:57:1: UP030 [*] Use implicit references for positional format fields | @@ -474,16 +267,6 @@ UP030_0.py:57:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -54 54 | -55 55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs) -56 56 | -57 |-"{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs) - 57 |+"{}_{}_{}".format(1, 2, 3, *args, **kwargs) -58 58 | -59 59 | "{1}_{0}".format(1, 2, *args) -60 60 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:59:1: UP030 [*] Use implicit references for positional format fields | @@ -496,15 +279,6 @@ UP030_0.py:59:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -56 56 | -57 57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs) -58 58 | -59 |-"{1}_{0}".format(1, 2, *args) - 59 |+"{}_{}".format(2, 1, ) -60 60 | -61 61 | "{1}_{0}".format(1, 2) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP030_0.py:61:1: UP030 [*] Use implicit references for positional format fields | @@ -514,11 +288,3 @@ UP030_0.py:61:1: UP030 [*] Use implicit references for positional format fields | ^^^^^^^^^^^^^^^^^^^^^^ UP030 | = help: Remove explicit positional indices - -58 58 | -59 59 | "{1}_{0}".format(1, 2, *args) -60 60 | -61 |-"{1}_{0}".format(1, 2) - 61 |+"{}_{}".format(2, 1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap index cc833ae94977d..27597295e70f3 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap @@ -11,16 +11,6 @@ UP031_0.py:4:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -1 1 | a, b, x, y = 1, 2, 3, 4 -2 2 | -3 3 | # UP031 -4 |-print('%s %s' % (a, b)) - 4 |+print('{} {}'.format(a, b)) -5 5 | -6 6 | print('%s%s' % (a, b)) -7 7 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:6:7: UP031 [*] Use format specifiers instead of percent format | @@ -33,16 +23,6 @@ UP031_0.py:6:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -3 3 | # UP031 -4 4 | print('%s %s' % (a, b)) -5 5 | -6 |-print('%s%s' % (a, b)) - 6 |+print('{}{}'.format(a, b)) -7 7 | -8 8 | print("trivial" % ()) -9 9 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:8:7: UP031 [*] Use format specifiers instead of percent format | @@ -55,16 +35,6 @@ UP031_0.py:8:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -5 5 | -6 6 | print('%s%s' % (a, b)) -7 7 | -8 |-print("trivial" % ()) - 8 |+print("trivial".format()) -9 9 | -10 10 | print("%s" % ("simple",)) -11 11 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:10:7: UP031 [*] Use format specifiers instead of percent format | @@ -77,16 +47,6 @@ UP031_0.py:10:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -7 7 | -8 8 | print("trivial" % ()) -9 9 | -10 |-print("%s" % ("simple",)) - 10 |+print("{}".format("simple")) -11 11 | -12 12 | print("%s" % ("%s" % ("nested",),)) -13 13 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:12:7: UP031 [*] Use format specifiers instead of percent format | @@ -99,16 +59,6 @@ UP031_0.py:12:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -9 9 | -10 10 | print("%s" % ("simple",)) -11 11 | -12 |-print("%s" % ("%s" % ("nested",),)) - 12 |+print("{}".format("%s" % ("nested",))) -13 13 | -14 14 | print("%s%% percent" % (15,)) -15 15 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:12:15: UP031 [*] Use format specifiers instead of percent format | @@ -121,16 +71,6 @@ UP031_0.py:12:15: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -9 9 | -10 10 | print("%s" % ("simple",)) -11 11 | -12 |-print("%s" % ("%s" % ("nested",),)) - 12 |+print("%s" % ("{}".format("nested"),)) -13 13 | -14 14 | print("%s%% percent" % (15,)) -15 15 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:14:7: UP031 [*] Use format specifiers instead of percent format | @@ -143,16 +83,6 @@ UP031_0.py:14:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -11 11 | -12 12 | print("%s" % ("%s" % ("nested",),)) -13 13 | -14 |-print("%s%% percent" % (15,)) - 14 |+print("{}% percent".format(15)) -15 15 | -16 16 | print("%f" % (15,)) -17 17 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:16:7: UP031 [*] Use format specifiers instead of percent format | @@ -165,16 +95,6 @@ UP031_0.py:16:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -13 13 | -14 14 | print("%s%% percent" % (15,)) -15 15 | -16 |-print("%f" % (15,)) - 16 |+print("{:f}".format(15)) -17 17 | -18 18 | print("%.f" % (15,)) -19 19 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:18:7: UP031 [*] Use format specifiers instead of percent format | @@ -187,16 +107,6 @@ UP031_0.py:18:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -15 15 | -16 16 | print("%f" % (15,)) -17 17 | -18 |-print("%.f" % (15,)) - 18 |+print("{:.0f}".format(15)) -19 19 | -20 20 | print("%.3f" % (15,)) -21 21 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:20:7: UP031 [*] Use format specifiers instead of percent format | @@ -209,16 +119,6 @@ UP031_0.py:20:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -17 17 | -18 18 | print("%.f" % (15,)) -19 19 | -20 |-print("%.3f" % (15,)) - 20 |+print("{:.3f}".format(15)) -21 21 | -22 22 | print("%3f" % (15,)) -23 23 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:22:7: UP031 [*] Use format specifiers instead of percent format | @@ -231,16 +131,6 @@ UP031_0.py:22:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -19 19 | -20 20 | print("%.3f" % (15,)) -21 21 | -22 |-print("%3f" % (15,)) - 22 |+print("{:3f}".format(15)) -23 23 | -24 24 | print("%-5f" % (5,)) -25 25 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:24:7: UP031 [*] Use format specifiers instead of percent format | @@ -253,16 +143,6 @@ UP031_0.py:24:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -21 21 | -22 22 | print("%3f" % (15,)) -23 23 | -24 |-print("%-5f" % (5,)) - 24 |+print("{:<5f}".format(5)) -25 25 | -26 26 | print("%9f" % (5,)) -27 27 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:26:7: UP031 [*] Use format specifiers instead of percent format | @@ -275,16 +155,6 @@ UP031_0.py:26:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -23 23 | -24 24 | print("%-5f" % (5,)) -25 25 | -26 |-print("%9f" % (5,)) - 26 |+print("{:9f}".format(5)) -27 27 | -28 28 | print("%#o" % (123,)) -29 29 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:28:7: UP031 [*] Use format specifiers instead of percent format | @@ -297,16 +167,6 @@ UP031_0.py:28:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -25 25 | -26 26 | print("%9f" % (5,)) -27 27 | -28 |-print("%#o" % (123,)) - 28 |+print("{:#o}".format(123)) -29 29 | -30 30 | print("brace {} %s" % (1,)) -31 31 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:30:7: UP031 [*] Use format specifiers instead of percent format | @@ -319,16 +179,6 @@ UP031_0.py:30:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -27 27 | -28 28 | print("%#o" % (123,)) -29 29 | -30 |-print("brace {} %s" % (1,)) - 30 |+print("brace {{}} {}".format(1)) -31 31 | -32 32 | print(( -33 33 | "foo %s " - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:33:5: UP031 [*] Use format specifiers instead of percent format | @@ -341,18 +191,6 @@ UP031_0.py:33:5: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -30 30 | print("brace {} %s" % (1,)) -31 31 | -32 32 | print(( -33 |- "foo %s " -34 |- "bar %s" % (x, y) - 33 |+ "foo {} " - 34 |+ "bar {}".format(x, y) -35 35 | )) -36 36 | -37 37 | print( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:38:3: UP031 [*] Use format specifiers instead of percent format | @@ -366,16 +204,6 @@ UP031_0.py:38:3: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -35 35 | )) -36 36 | -37 37 | print( -38 |- "%s" % ( - 38 |+ "{}".format( -39 39 | "trailing comma", -40 40 | ) -41 41 | ) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:43:7: UP031 [*] Use format specifiers instead of percent format | @@ -388,16 +216,6 @@ UP031_0.py:43:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -40 40 | ) -41 41 | ) -42 42 | -43 |-print("foo %s " % (x,)) - 43 |+print("foo {} ".format(x)) -44 44 | -45 45 | print("%(k)s" % {"k": "v"}) -46 46 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:45:7: UP031 [*] Use format specifiers instead of percent format | @@ -410,16 +228,6 @@ UP031_0.py:45:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -42 42 | -43 43 | print("foo %s " % (x,)) -44 44 | -45 |-print("%(k)s" % {"k": "v"}) - 45 |+print("{k}".format(k="v")) -46 46 | -47 47 | print("%(k)s" % { -48 48 | "k": "v", - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format | @@ -436,22 +244,6 @@ UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -44 44 | -45 45 | print("%(k)s" % {"k": "v"}) -46 46 | -47 |-print("%(k)s" % { -48 |- "k": "v", -49 |- "i": "j" -50 |-}) - 47 |+print("{k}".format( - 48 |+ k="v", - 49 |+ i="j", - 50 |+)) -51 51 | -52 52 | print("%(to_list)s" % {"to_list": []}) -53 53 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:52:7: UP031 [*] Use format specifiers instead of percent format | @@ -464,16 +256,6 @@ UP031_0.py:52:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -49 49 | "i": "j" -50 50 | }) -51 51 | -52 |-print("%(to_list)s" % {"to_list": []}) - 52 |+print("{to_list}".format(to_list=[])) -53 53 | -54 54 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) -55 55 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:54:7: UP031 [*] Use format specifiers instead of percent format | @@ -486,16 +268,6 @@ UP031_0.py:54:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -51 51 | -52 52 | print("%(to_list)s" % {"to_list": []}) -53 53 | -54 |-print("%(k)s" % {"k": "v", "i": 1, "j": []}) - 54 |+print("{k}".format(k="v", i=1, j=[])) -55 55 | -56 56 | print("%(ab)s" % {"a" "b": 1}) -57 57 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:56:7: UP031 [*] Use format specifiers instead of percent format | @@ -508,16 +280,6 @@ UP031_0.py:56:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -53 53 | -54 54 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) -55 55 | -56 |-print("%(ab)s" % {"a" "b": 1}) - 56 |+print("{ab}".format(ab=1)) -57 57 | -58 58 | print("%(a)s" % {"a" : 1}) -59 59 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:58:7: UP031 [*] Use format specifiers instead of percent format | @@ -528,16 +290,6 @@ UP031_0.py:58:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -55 55 | -56 56 | print("%(ab)s" % {"a" "b": 1}) -57 57 | -58 |-print("%(a)s" % {"a" : 1}) - 58 |+print("{a}".format(a=1)) -59 59 | -60 60 | -61 61 | print( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:62:5: UP031 [*] Use format specifiers instead of percent format | @@ -550,18 +302,6 @@ UP031_0.py:62:5: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -59 59 | -60 60 | -61 61 | print( -62 |- "foo %(foo)s " -63 |- "bar %(bar)s" % {"foo": x, "bar": y} - 62 |+ "foo {foo} " - 63 |+ "bar {bar}".format(foo=x, bar=y) -64 64 | ) -65 65 | -66 66 | bar = {"bar": y} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:68:5: UP031 [*] Use format specifiers instead of percent format | @@ -575,18 +315,6 @@ UP031_0.py:68:5: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -65 65 | -66 66 | bar = {"bar": y} -67 67 | print( -68 |- "foo %(foo)s " -69 |- "bar %(bar)s" % {"foo": x, **bar} - 68 |+ "foo {foo} " - 69 |+ "bar {bar}".format(foo=x, **bar) -70 70 | ) -71 71 | -72 72 | print("%s \N{snowman}" % (a,)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:72:7: UP031 [*] Use format specifiers instead of percent format | @@ -599,16 +327,6 @@ UP031_0.py:72:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -69 69 | "bar %(bar)s" % {"foo": x, **bar} -70 70 | ) -71 71 | -72 |-print("%s \N{snowman}" % (a,)) - 72 |+print("{} \N{snowman}".format(a)) -73 73 | -74 74 | print("%(foo)s \N{snowman}" % {"foo": 1}) -75 75 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:74:7: UP031 [*] Use format specifiers instead of percent format | @@ -621,16 +339,6 @@ UP031_0.py:74:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -71 71 | -72 72 | print("%s \N{snowman}" % (a,)) -73 73 | -74 |-print("%(foo)s \N{snowman}" % {"foo": 1}) - 74 |+print("{foo} \N{snowman}".format(foo=1)) -75 75 | -76 76 | print(("foo %s " "bar %s") % (x, y)) -77 77 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:76:7: UP031 [*] Use format specifiers instead of percent format | @@ -643,16 +351,6 @@ UP031_0.py:76:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -73 73 | -74 74 | print("%(foo)s \N{snowman}" % {"foo": 1}) -75 75 | -76 |-print(("foo %s " "bar %s") % (x, y)) - 76 |+print(("foo {} " "bar {}").format(x, y)) -77 77 | -78 78 | # Single-value expressions -79 79 | print('Hello %s' % "World") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:79:7: UP031 [*] Use format specifiers instead of percent format | @@ -664,16 +362,6 @@ UP031_0.py:79:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -76 76 | print(("foo %s " "bar %s") % (x, y)) -77 77 | -78 78 | # Single-value expressions -79 |-print('Hello %s' % "World") - 79 |+print('Hello {}'.format("World")) -80 80 | print('Hello %s' % f"World") -81 81 | print('Hello %s (%s)' % bar) -82 82 | print('Hello %s (%s)' % bar.baz) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:80:7: UP031 [*] Use format specifiers instead of percent format | @@ -686,16 +374,6 @@ UP031_0.py:80:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -77 77 | -78 78 | # Single-value expressions -79 79 | print('Hello %s' % "World") -80 |-print('Hello %s' % f"World") - 80 |+print('Hello {}'.format(f"World")) -81 81 | print('Hello %s (%s)' % bar) -82 82 | print('Hello %s (%s)' % bar.baz) -83 83 | print('Hello %s (%s)' % bar['bop']) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:81:7: UP031 [*] Use format specifiers instead of percent format | @@ -708,16 +386,6 @@ UP031_0.py:81:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -78 78 | # Single-value expressions -79 79 | print('Hello %s' % "World") -80 80 | print('Hello %s' % f"World") -81 |-print('Hello %s (%s)' % bar) - 81 |+print('Hello {} ({})'.format(*bar)) -82 82 | print('Hello %s (%s)' % bar.baz) -83 83 | print('Hello %s (%s)' % bar['bop']) -84 84 | print('Hello %(arg)s' % bar) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:82:7: UP031 [*] Use format specifiers instead of percent format | @@ -730,16 +398,6 @@ UP031_0.py:82:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -79 79 | print('Hello %s' % "World") -80 80 | print('Hello %s' % f"World") -81 81 | print('Hello %s (%s)' % bar) -82 |-print('Hello %s (%s)' % bar.baz) - 82 |+print('Hello {} ({})'.format(*bar.baz)) -83 83 | print('Hello %s (%s)' % bar['bop']) -84 84 | print('Hello %(arg)s' % bar) -85 85 | print('Hello %(arg)s' % bar.baz) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:83:7: UP031 [*] Use format specifiers instead of percent format | @@ -752,16 +410,6 @@ UP031_0.py:83:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -80 80 | print('Hello %s' % f"World") -81 81 | print('Hello %s (%s)' % bar) -82 82 | print('Hello %s (%s)' % bar.baz) -83 |-print('Hello %s (%s)' % bar['bop']) - 83 |+print('Hello {} ({})'.format(*bar['bop'])) -84 84 | print('Hello %(arg)s' % bar) -85 85 | print('Hello %(arg)s' % bar.baz) -86 86 | print('Hello %(arg)s' % bar['bop']) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:84:7: UP031 [*] Use format specifiers instead of percent format | @@ -774,16 +422,6 @@ UP031_0.py:84:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -81 81 | print('Hello %s (%s)' % bar) -82 82 | print('Hello %s (%s)' % bar.baz) -83 83 | print('Hello %s (%s)' % bar['bop']) -84 |-print('Hello %(arg)s' % bar) - 84 |+print('Hello {arg}'.format(**bar)) -85 85 | print('Hello %(arg)s' % bar.baz) -86 86 | print('Hello %(arg)s' % bar['bop']) -87 87 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:85:7: UP031 [*] Use format specifiers instead of percent format | @@ -795,16 +433,6 @@ UP031_0.py:85:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -82 82 | print('Hello %s (%s)' % bar.baz) -83 83 | print('Hello %s (%s)' % bar['bop']) -84 84 | print('Hello %(arg)s' % bar) -85 |-print('Hello %(arg)s' % bar.baz) - 85 |+print('Hello {arg}'.format(**bar.baz)) -86 86 | print('Hello %(arg)s' % bar['bop']) -87 87 | -88 88 | # Hanging modulos - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:86:7: UP031 [*] Use format specifiers instead of percent format | @@ -817,16 +445,6 @@ UP031_0.py:86:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -83 83 | print('Hello %s (%s)' % bar['bop']) -84 84 | print('Hello %(arg)s' % bar) -85 85 | print('Hello %(arg)s' % bar.baz) -86 |-print('Hello %(arg)s' % bar['bop']) - 86 |+print('Hello {arg}'.format(**bar['bop'])) -87 87 | -88 88 | # Hanging modulos -89 89 | ( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:89:1: UP031 [*] Use format specifiers instead of percent format | @@ -841,20 +459,6 @@ UP031_0.py:89:1: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -87 87 | -88 88 | # Hanging modulos -89 89 | ( -90 |- "foo %s " -91 |- "bar %s" -92 |-) % (x, y) - 90 |+ "foo {} " - 91 |+ "bar {}" - 92 |+).format(x, y) -93 93 | -94 94 | ( -95 95 | "foo %(foo)s " - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:94:1: UP031 [*] Use format specifiers instead of percent format | @@ -870,20 +474,6 @@ UP031_0.py:94:1: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -92 92 | ) % (x, y) -93 93 | -94 94 | ( -95 |- "foo %(foo)s " -96 |- "bar %(bar)s" -97 |-) % {"foo": x, "bar": y} - 95 |+ "foo {foo} " - 96 |+ "bar {bar}" - 97 |+).format(foo=x, bar=y) -98 98 | -99 99 | ( -100 100 | """foo %s""" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:100:5: UP031 [*] Use format specifiers instead of percent format | @@ -896,17 +486,6 @@ UP031_0.py:100:5: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -97 97 | ) % {"foo": x, "bar": y} -98 98 | -99 99 | ( -100 |- """foo %s""" -101 |- % (x,) - 100 |+ """foo {}""".format(x) -102 101 | ) -103 102 | -104 103 | ( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:105:5: UP031 [*] Use format specifiers instead of percent format | @@ -921,19 +500,6 @@ UP031_0.py:105:5: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -103 103 | -104 104 | ( -105 105 | """ -106 |- foo %s -107 |- """ -108 |- % (x,) - 106 |+ foo {} - 107 |+ """.format(x) -109 108 | ) -110 109 | -111 110 | "%s" % ( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:111:1: UP031 [*] Use format specifiers instead of percent format | @@ -946,16 +512,6 @@ UP031_0.py:111:1: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -108 108 | % (x,) -109 109 | ) -110 110 | -111 |-"%s" % ( - 111 |+"{}".format( -112 112 | x, # comment -113 113 | ) -114 114 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:116:8: UP031 [*] Use format specifiers instead of percent format | @@ -971,16 +527,6 @@ UP031_0.py:116:8: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -113 113 | ) -114 114 | -115 115 | -116 |-path = "%s-%s-%s.pem" % ( - 116 |+path = "{}-{}-{}.pem".format( -117 117 | safe_domain_name(cn), # common name, which should be filename safe because it is IDNA-encoded, but in case of a malformed cert make sure it's ok to use as a filename -118 118 | cert.not_valid_after.date().isoformat().replace("-", ""), # expiration date -119 119 | hexlify(cert.fingerprint(hashes.SHA256())).decode("ascii")[0:8], # fingerprint prefix - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:123:1: UP031 [*] Use format specifiers instead of percent format | @@ -992,16 +538,6 @@ UP031_0.py:123:1: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -120 120 | ) -121 121 | -122 122 | # UP031 (no longer false negatives; now offer potentially unsafe fixes) -123 |-'Hello %s' % bar - 123 |+'Hello {}'.format(bar) -124 124 | -125 125 | 'Hello %s' % bar.baz -126 126 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:125:1: UP031 [*] Use format specifiers instead of percent format | @@ -1014,16 +550,6 @@ UP031_0.py:125:1: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -122 122 | # UP031 (no longer false negatives; now offer potentially unsafe fixes) -123 123 | 'Hello %s' % bar -124 124 | -125 |-'Hello %s' % bar.baz - 125 |+'Hello {}'.format(bar.baz) -126 126 | -127 127 | 'Hello %s' % bar['bop'] -128 128 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:127:1: UP031 [*] Use format specifiers instead of percent format | @@ -1036,16 +562,6 @@ UP031_0.py:127:1: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -124 124 | -125 125 | 'Hello %s' % bar.baz -126 126 | -127 |-'Hello %s' % bar['bop'] - 127 |+'Hello {}'.format(bar['bop']) -128 128 | -129 129 | # Not a valid type annotation but this test shouldn't result in a panic. -130 130 | # Refer: https://github.com/astral-sh/ruff/issues/11736 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:131:5: UP031 [*] Use format specifiers instead of percent format | @@ -1058,16 +574,6 @@ UP031_0.py:131:5: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -128 128 | -129 129 | # Not a valid type annotation but this test shouldn't result in a panic. -130 130 | # Refer: https://github.com/astral-sh/ruff/issues/11736 -131 |-x: "'%s + %s' % (1, 2)" - 131 |+x: "'{} + {}'.format(1, 2)" -132 132 | -133 133 | # See: https://github.com/astral-sh/ruff/issues/12421 -134 134 | print("%.2X" % 1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:134:7: UP031 [*] Use format specifiers instead of percent format | @@ -1079,16 +585,6 @@ UP031_0.py:134:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -131 131 | x: "'%s + %s' % (1, 2)" -132 132 | -133 133 | # See: https://github.com/astral-sh/ruff/issues/12421 -134 |-print("%.2X" % 1) - 134 |+print("{:02X}".format(1)) -135 135 | print("%.02X" % 1) -136 136 | print("%02X" % 1) -137 137 | print("%.00002X" % 1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:135:7: UP031 [*] Use format specifiers instead of percent format | @@ -1101,16 +597,6 @@ UP031_0.py:135:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -132 132 | -133 133 | # See: https://github.com/astral-sh/ruff/issues/12421 -134 134 | print("%.2X" % 1) -135 |-print("%.02X" % 1) - 135 |+print("{:02X}".format(1)) -136 136 | print("%02X" % 1) -137 137 | print("%.00002X" % 1) -138 138 | print("%.20X" % 1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:136:7: UP031 [*] Use format specifiers instead of percent format | @@ -1123,16 +609,6 @@ UP031_0.py:136:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -133 133 | # See: https://github.com/astral-sh/ruff/issues/12421 -134 134 | print("%.2X" % 1) -135 135 | print("%.02X" % 1) -136 |-print("%02X" % 1) - 136 |+print("{:02X}".format(1)) -137 137 | print("%.00002X" % 1) -138 138 | print("%.20X" % 1) -139 139 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:137:7: UP031 [*] Use format specifiers instead of percent format | @@ -1144,16 +620,6 @@ UP031_0.py:137:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -134 134 | print("%.2X" % 1) -135 135 | print("%.02X" % 1) -136 136 | print("%02X" % 1) -137 |-print("%.00002X" % 1) - 137 |+print("{:02X}".format(1)) -138 138 | print("%.20X" % 1) -139 139 | -140 140 | print("%2X" % 1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:138:7: UP031 [*] Use format specifiers instead of percent format | @@ -1166,16 +632,6 @@ UP031_0.py:138:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -135 135 | print("%.02X" % 1) -136 136 | print("%02X" % 1) -137 137 | print("%.00002X" % 1) -138 |-print("%.20X" % 1) - 138 |+print("{:020X}".format(1)) -139 139 | -140 140 | print("%2X" % 1) -141 141 | print("%02X" % 1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:140:7: UP031 [*] Use format specifiers instead of percent format | @@ -1187,14 +643,6 @@ UP031_0.py:140:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -137 137 | print("%.00002X" % 1) -138 138 | print("%.20X" % 1) -139 139 | -140 |-print("%2X" % 1) - 140 |+print("{:2X}".format(1)) -141 141 | print("%02X" % 1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP031_0.py:141:7: UP031 [*] Use format specifiers instead of percent format | @@ -1203,11 +651,3 @@ UP031_0.py:141:7: UP031 [*] Use format specifiers instead of percent format | ^^^^^^^^^^ UP031 | = help: Replace with format specifiers - -138 138 | print("%.20X" % 1) -139 139 | -140 140 | print("%2X" % 1) -141 |-print("%02X" % 1) - 141 |+print("{:02X}".format(1)) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap index 8d0b3c8af4b23..0db00341585ee 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap @@ -12,18 +12,6 @@ UP036_0.py:3:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -1 1 | import sys -2 2 | -3 |-if sys.version_info < (3,0): -4 |- print("py2") -5 |-else: -6 |- print("py3") - 3 |+print("py3") -7 4 | -8 5 | if sys.version_info < (3,0): -9 6 | if True: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:8:4: UP036 [*] Version block is outdated for minimum Python version | @@ -36,22 +24,6 @@ UP036_0.py:8:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -5 5 | else: -6 6 | print("py3") -7 7 | -8 |-if sys.version_info < (3,0): -9 |- if True: -10 |- print("py2!") -11 |- else: -12 |- print("???") -13 |-else: -14 |- print("py3") - 8 |+print("py3") -15 9 | -16 10 | if sys.version_info < (3,0): print("PY2!") -17 11 | else: print("PY3!") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:16:4: UP036 [*] Version block is outdated for minimum Python version | @@ -63,17 +35,6 @@ UP036_0.py:16:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -13 13 | else: -14 14 | print("py3") -15 15 | -16 |-if sys.version_info < (3,0): print("PY2!") -17 |-else: print("PY3!") - 16 |+print("PY3!") -18 17 | -19 18 | if True: -20 19 | if sys.version_info < (3,0): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:20:8: UP036 [*] Version block is outdated for minimum Python version | @@ -85,19 +46,6 @@ UP036_0.py:20:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -17 17 | else: print("PY3!") -18 18 | -19 19 | if True: -20 |- if sys.version_info < (3,0): -21 |- print("PY2") -22 |- else: -23 |- print("PY3") - 20 |+ print("PY3") -24 21 | -25 22 | if sys.version_info < (3,0): print(1 if True else 3) -26 23 | else: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:25:4: UP036 [*] Version block is outdated for minimum Python version | @@ -110,18 +58,6 @@ UP036_0.py:25:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -22 22 | else: -23 23 | print("PY3") -24 24 | -25 |-if sys.version_info < (3,0): print(1 if True else 3) -26 |-else: -27 |- print("py3") - 25 |+print("py3") -28 26 | -29 27 | if sys.version_info < (3,0): -30 28 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:29:4: UP036 [*] Version block is outdated for minimum Python version | @@ -134,24 +70,6 @@ UP036_0.py:29:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -26 26 | else: -27 27 | print("py3") -28 28 | -29 |-if sys.version_info < (3,0): -30 |- def f(): -31 |- print("py2") -32 |-else: -33 |- def f(): -34 |- print("py3") -35 |- print("This the next") - 29 |+def f(): - 30 |+ print("py3") - 31 |+ print("This the next") -36 32 | -37 33 | if sys.version_info > (3,0): -38 34 | print("py3") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:37:4: UP036 [*] Version block is outdated for minimum Python version | @@ -164,19 +82,6 @@ UP036_0.py:37:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -34 34 | print("py3") -35 35 | print("This the next") -36 36 | -37 |-if sys.version_info > (3,0): -38 |- print("py3") -39 |-else: -40 |- print("py2") - 37 |+print("py3") -41 38 | -42 39 | -43 40 | x = 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:45:4: UP036 [*] Version block is outdated for minimum Python version | @@ -189,19 +94,6 @@ UP036_0.py:45:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -42 42 | -43 43 | x = 1 -44 44 | -45 |-if sys.version_info > (3,0): -46 |- print("py3") -47 |-else: -48 |- print("py2") - 45 |+print("py3") -49 46 | # ohai -50 47 | -51 48 | x = 1 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:53:4: UP036 [*] Version block is outdated for minimum Python version | @@ -213,17 +105,6 @@ UP036_0.py:53:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -50 50 | -51 51 | x = 1 -52 52 | -53 |-if sys.version_info > (3,0): print("py3") -54 |-else: print("py2") - 53 |+print("py3") -55 54 | -56 55 | if sys.version_info > (3,): -57 56 | print("py3") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:56:4: UP036 [*] Version block is outdated for minimum Python version | @@ -236,19 +117,6 @@ UP036_0.py:56:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -53 53 | if sys.version_info > (3,0): print("py3") -54 54 | else: print("py2") -55 55 | -56 |-if sys.version_info > (3,): -57 |- print("py3") -58 |-else: -59 |- print("py2") - 56 |+print("py3") -60 57 | -61 58 | if True: -62 59 | if sys.version_info > (3,): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:62:8: UP036 [*] Version block is outdated for minimum Python version | @@ -260,19 +128,6 @@ UP036_0.py:62:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -59 59 | print("py2") -60 60 | -61 61 | if True: -62 |- if sys.version_info > (3,): -63 |- print("py3") -64 |- else: -65 |- print("py2") - 62 |+ print("py3") -66 63 | -67 64 | if sys.version_info < (3,): -68 65 | print("py2") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:67:4: UP036 [*] Version block is outdated for minimum Python version | @@ -285,19 +140,6 @@ UP036_0.py:67:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -64 64 | else: -65 65 | print("py2") -66 66 | -67 |-if sys.version_info < (3,): -68 |- print("py2") -69 |-else: -70 |- print("py3") - 67 |+print("py3") -71 68 | -72 69 | def f(): -73 70 | if sys.version_info < (3,0): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:73:8: UP036 [*] Version block is outdated for minimum Python version | @@ -309,22 +151,6 @@ UP036_0.py:73:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -70 70 | print("py3") -71 71 | -72 72 | def f(): -73 |- if sys.version_info < (3,0): -74 |- try: -75 |- yield -76 |- finally: -77 |- pass -78 |- else: -79 |- yield - 73 |+ yield -80 74 | -81 75 | -82 76 | class C: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:86:8: UP036 [*] Version block is outdated for minimum Python version | @@ -337,22 +163,6 @@ UP036_0.py:86:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -83 83 | def g(): -84 84 | pass -85 85 | -86 |- if sys.version_info < (3,0): -87 |- def f(py2): -88 |- pass -89 |- else: -90 |- def f(py3): -91 |- pass - 86 |+ def f(py3): - 87 |+ pass -92 88 | -93 89 | def h(): -94 90 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:97:8: UP036 [*] Version block is outdated for minimum Python version | @@ -364,19 +174,6 @@ UP036_0.py:97:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -94 94 | pass -95 95 | -96 96 | if True: -97 |- if sys.version_info < (3,0): -98 |- 2 -99 |- else: -100 |- 3 - 97 |+ 3 -101 98 | -102 99 | # comment -103 100 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:104:4: UP036 [*] Version block is outdated for minimum Python version | @@ -389,28 +186,6 @@ UP036_0.py:104:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -101 101 | -102 102 | # comment -103 103 | -104 |-if sys.version_info < (3,0): -105 |- def f(): -106 |- print("py2") -107 |- def g(): -108 |- print("py2") -109 |-else: -110 |- def f(): -111 |- print("py3") -112 |- def g(): -113 |- print("py3") - 104 |+def f(): - 105 |+ print("py3") - 106 |+def g(): - 107 |+ print("py3") -114 108 | -115 109 | if True: -116 110 | if sys.version_info > (3,): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:116:8: UP036 [*] Version block is outdated for minimum Python version | @@ -422,17 +197,6 @@ UP036_0.py:116:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -113 113 | print("py3") -114 114 | -115 115 | if True: -116 |- if sys.version_info > (3,): -117 |- print(3) - 116 |+ print(3) -118 117 | # comment -119 118 | print(2+3) -120 119 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:122:8: UP036 [*] Version block is outdated for minimum Python version | @@ -444,16 +208,6 @@ UP036_0.py:122:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -119 119 | print(2+3) -120 120 | -121 121 | if True: -122 |- if sys.version_info > (3,): print(3) - 122 |+ print(3) -123 123 | -124 124 | if True: -125 125 | if sys.version_info > (3,): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:125:8: UP036 [*] Version block is outdated for minimum Python version | @@ -464,17 +218,6 @@ UP036_0.py:125:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -122 122 | if sys.version_info > (3,): print(3) -123 123 | -124 124 | if True: -125 |- if sys.version_info > (3,): -126 |- print(3) - 125 |+ print(3) -127 126 | -128 127 | -129 128 | if True: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:130:8: UP036 [*] Version block is outdated for minimum Python version | @@ -486,24 +229,6 @@ UP036_0.py:130:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -127 127 | -128 128 | -129 129 | if True: -130 |- if sys.version_info <= (3, 0): -131 |- expected_error = [] -132 |- else: -133 |- expected_error = [ - 130 |+ expected_error = [ -134 131 | ":1:5: Generator expression must be parenthesized", -135 132 | "max(1 for i in range(10), key=lambda x: x+1)", -136 133 | " ^", -137 |- ] - 134 |+ ] -138 135 | -139 136 | -140 137 | if sys.version_info <= (3, 0): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:140:4: UP036 [*] Version block is outdated for minimum Python version | @@ -514,24 +239,6 @@ UP036_0.py:140:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -137 137 | ] -138 138 | -139 139 | -140 |-if sys.version_info <= (3, 0): -141 |- expected_error = [] -142 |-else: -143 |- expected_error = [ - 140 |+expected_error = [ -144 141 | ":1:5: Generator expression must be parenthesized", -145 142 | "max(1 for i in range(10), key=lambda x: x+1)", -146 143 | " ^", -147 |- ] - 144 |+] -148 145 | -149 146 | -150 147 | if sys.version_info > (3,0): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:150:4: UP036 [*] Version block is outdated for minimum Python version | @@ -542,31 +249,6 @@ UP036_0.py:150:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -147 147 | ] -148 148 | -149 149 | -150 |-if sys.version_info > (3,0): -151 |- """this - 150 |+"""this -152 151 | is valid""" -153 152 | -154 |- """the indentation on - 153 |+"""the indentation on -155 154 | this line is significant""" -156 155 | -157 |- "this is" \ - 156 |+"this is" \ -158 157 | "allowed too" -159 158 | -160 |- ("so is" -161 |- "this for some reason") - 159 |+("so is" - 160 |+ "this for some reason") -162 161 | -163 162 | if sys.version_info > (3, 0): expected_error = \ -164 163 | [] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:163:4: UP036 [*] Version block is outdated for minimum Python version | @@ -578,16 +260,6 @@ UP036_0.py:163:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -160 160 | ("so is" -161 161 | "this for some reason") -162 162 | -163 |-if sys.version_info > (3, 0): expected_error = \ - 163 |+expected_error = \ -164 164 | [] -165 165 | -166 166 | if sys.version_info > (3, 0): expected_error = [] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:166:4: UP036 [*] Version block is outdated for minimum Python version | @@ -600,16 +272,6 @@ UP036_0.py:166:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -163 163 | if sys.version_info > (3, 0): expected_error = \ -164 164 | [] -165 165 | -166 |-if sys.version_info > (3, 0): expected_error = [] - 166 |+expected_error = [] -167 167 | -168 168 | if sys.version_info > (3, 0): \ -169 169 | expected_error = [] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:168:4: UP036 [*] Version block is outdated for minimum Python version | @@ -621,17 +283,6 @@ UP036_0.py:168:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -165 165 | -166 166 | if sys.version_info > (3, 0): expected_error = [] -167 167 | -168 |-if sys.version_info > (3, 0): \ -169 |- expected_error = [] - 168 |+expected_error = [] -170 169 | -171 170 | if True: -172 171 | if sys.version_info > (3, 0): expected_error = \ - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:172:8: UP036 [*] Version block is outdated for minimum Python version | @@ -642,16 +293,6 @@ UP036_0.py:172:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -169 169 | expected_error = [] -170 170 | -171 171 | if True: -172 |- if sys.version_info > (3, 0): expected_error = \ - 172 |+ expected_error = \ -173 173 | [] -174 174 | -175 175 | if True: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:176:8: UP036 [*] Version block is outdated for minimum Python version | @@ -663,16 +304,6 @@ UP036_0.py:176:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -173 173 | [] -174 174 | -175 175 | if True: -176 |- if sys.version_info > (3, 0): expected_error = [] - 176 |+ expected_error = [] -177 177 | -178 178 | if True: -179 179 | if sys.version_info > (3, 0): \ - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:179:8: UP036 [*] Version block is outdated for minimum Python version | @@ -683,15 +314,6 @@ UP036_0.py:179:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -176 176 | if sys.version_info > (3, 0): expected_error = [] -177 177 | -178 178 | if True: -179 |- if sys.version_info > (3, 0): \ -180 179 | expected_error = [] -181 180 | -182 181 | if sys.version_info < (3,13): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:182:4: UP036 [*] Version block is outdated for minimum Python version | @@ -703,16 +325,6 @@ UP036_0.py:182:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -179 179 | if sys.version_info > (3, 0): \ -180 180 | expected_error = [] -181 181 | -182 |-if sys.version_info < (3,13): -183 |- print("py3") -184 182 | -185 183 | if sys.version_info <= (3,13): -186 184 | print("py3") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:191:24: UP036 Version specifier is invalid | @@ -751,17 +363,6 @@ UP036_0.py:203:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -200 200 | if sys.version_info > (3,13): -201 201 | print("py3") -202 202 | -203 |-if sys.version_info >= (3,13): -204 |- print("py3") - 203 |+print("py3") -205 204 | -206 205 | # Slices on `sys.version_info` should be treated equivalently. -207 206 | if sys.version_info[:2] >= (3,0): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:207:4: UP036 [*] Version block is outdated for minimum Python version | @@ -772,17 +373,6 @@ UP036_0.py:207:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -204 204 | print("py3") -205 205 | -206 206 | # Slices on `sys.version_info` should be treated equivalently. -207 |-if sys.version_info[:2] >= (3,0): -208 |- print("py3") - 207 |+print("py3") -209 208 | -210 209 | if sys.version_info[:3] >= (3,0): -211 210 | print("py3") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:210:4: UP036 [*] Version block is outdated for minimum Python version | @@ -794,17 +384,6 @@ UP036_0.py:210:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -207 207 | if sys.version_info[:2] >= (3,0): -208 208 | print("py3") -209 209 | -210 |-if sys.version_info[:3] >= (3,0): -211 |- print("py3") - 210 |+print("py3") -212 211 | -213 212 | if sys.version_info[:2] > (3,14): -214 213 | print("py3") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_0.py:219:4: UP036 [*] Version block is outdated for minimum Python version | @@ -816,21 +395,3 @@ UP036_0.py:219:4: UP036 [*] Version block is outdated for minimum Python version 221 | allowed too" | = help: Remove outdated version block - -216 216 | if sys.version_info[:3] > (3,14): -217 217 | print("py3") -218 218 | -219 |-if sys.version_info > (3,0): -220 |- f"this is\ - 219 |+f"this is\ -221 220 | allowed too" -222 221 | -223 |- f"""the indentation on - 222 |+f"""the indentation on -224 223 | this line is significant""" -225 224 | -226 |- "this is\ - 225 |+"this is\ -227 226 | allowed too" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap index 13cbc27b757d3..50c4631901aa9 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap @@ -12,18 +12,6 @@ UP036_1.py:3:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -1 1 | import sys -2 2 | -3 |-if sys.version_info == 2: -4 |- 2 -5 |-else: -6 |- 3 - 3 |+3 -7 4 | -8 5 | if sys.version_info < (3,): -9 6 | 2 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_1.py:8:4: UP036 [*] Version block is outdated for minimum Python version | @@ -36,19 +24,6 @@ UP036_1.py:8:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -5 5 | else: -6 6 | 3 -7 7 | -8 |-if sys.version_info < (3,): -9 |- 2 -10 |-else: -11 |- 3 - 8 |+3 -12 9 | -13 10 | if sys.version_info < (3,0): -14 11 | 2 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_1.py:13:4: UP036 [*] Version block is outdated for minimum Python version | @@ -61,19 +36,6 @@ UP036_1.py:13:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -10 10 | else: -11 11 | 3 -12 12 | -13 |-if sys.version_info < (3,0): -14 |- 2 -15 |-else: -16 |- 3 - 13 |+3 -17 14 | -18 15 | if sys.version_info == 3: -19 16 | 3 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_1.py:18:4: UP036 [*] Version block is outdated for minimum Python version | @@ -86,19 +48,6 @@ UP036_1.py:18:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -15 15 | else: -16 16 | 3 -17 17 | -18 |-if sys.version_info == 3: -19 |- 3 -20 |-else: -21 |- 2 - 18 |+3 -22 19 | -23 20 | if sys.version_info > (3,): -24 21 | 3 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_1.py:23:4: UP036 [*] Version block is outdated for minimum Python version | @@ -111,19 +60,6 @@ UP036_1.py:23:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -20 20 | else: -21 21 | 2 -22 22 | -23 |-if sys.version_info > (3,): -24 |- 3 -25 |-else: -26 |- 2 - 23 |+3 -27 24 | -28 25 | if sys.version_info >= (3,): -29 26 | 3 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_1.py:28:4: UP036 [*] Version block is outdated for minimum Python version | @@ -136,19 +72,6 @@ UP036_1.py:28:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -25 25 | else: -26 26 | 2 -27 27 | -28 |-if sys.version_info >= (3,): -29 |- 3 -30 |-else: -31 |- 2 - 28 |+3 -32 29 | -33 30 | from sys import version_info -34 31 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_1.py:35:4: UP036 [*] Version block is outdated for minimum Python version | @@ -161,19 +84,6 @@ UP036_1.py:35:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -32 32 | -33 33 | from sys import version_info -34 34 | -35 |-if version_info > (3,): -36 |- 3 -37 |-else: -38 |- 2 - 35 |+3 -39 36 | -40 37 | if True: -41 38 | print(1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_1.py:42:6: UP036 [*] Version block is outdated for minimum Python version | @@ -186,16 +96,6 @@ UP036_1.py:42:6: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -39 39 | -40 40 | if True: -41 41 | print(1) -42 |-elif sys.version_info < (3,0): -43 |- print(2) -44 42 | else: -45 43 | print(3) -46 44 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_1.py:49:6: UP036 [*] Version block is outdated for minimum Python version | @@ -208,19 +108,6 @@ UP036_1.py:49:6: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -46 46 | -47 47 | if True: -48 48 | print(1) -49 |-elif sys.version_info > (3,): - 49 |+else: -50 50 | print(3) -51 |-else: -52 |- print(2) -53 51 | -54 52 | if True: -55 53 | print(1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_1.py:56:6: UP036 [*] Version block is outdated for minimum Python version | @@ -232,16 +119,6 @@ UP036_1.py:56:6: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -53 53 | -54 54 | if True: -55 55 | print(1) -56 |-elif sys.version_info > (3,): - 56 |+else: -57 57 | print(3) -58 58 | -59 59 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_1.py:62:10: UP036 [*] Version block is outdated for minimum Python version | @@ -253,16 +130,6 @@ UP036_1.py:62:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -59 59 | def f(): -60 60 | if True: -61 61 | print(1) -62 |- elif sys.version_info > (3,): - 62 |+ else: -63 63 | print(3) -64 64 | -65 65 | if True: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_1.py:67:6: UP036 [*] Version block is outdated for minimum Python version | @@ -275,16 +142,6 @@ UP036_1.py:67:6: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -64 64 | -65 65 | if True: -66 66 | print(1) -67 |-elif sys.version_info < (3,0): -68 |- print(2) -69 67 | else: -70 68 | print(3) -71 69 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_1.py:75:10: UP036 [*] Version block is outdated for minimum Python version | @@ -295,12 +152,3 @@ UP036_1.py:75:10: UP036 [*] Version block is outdated for minimum Python version 76 | print(3) | = help: Remove outdated version block - -72 72 | def f(): -73 73 | if True: -74 74 | print(1) -75 |- elif sys.version_info > (3,): - 75 |+ else: -76 76 | print(3) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap index bb3def085b1ae..56ff5eb22ca5a 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap @@ -12,19 +12,6 @@ UP036_2.py:4:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -1 1 | import sys -2 2 | from sys import version_info -3 3 | -4 |-if sys.version_info > (3, 5): -5 |- 3+6 -6 |-else: -7 |- 3-5 - 4 |+3+6 -8 5 | -9 6 | if version_info > (3, 5): -10 7 | 3+6 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_2.py:9:4: UP036 [*] Version block is outdated for minimum Python version | @@ -37,19 +24,6 @@ UP036_2.py:9:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -6 6 | else: -7 7 | 3-5 -8 8 | -9 |-if version_info > (3, 5): -10 |- 3+6 -11 |-else: -12 |- 3-5 - 9 |+3+6 -13 10 | -14 11 | if sys.version_info >= (3,6): -15 12 | 3+6 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_2.py:14:4: UP036 [*] Version block is outdated for minimum Python version | @@ -62,19 +36,6 @@ UP036_2.py:14:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -11 11 | else: -12 12 | 3-5 -13 13 | -14 |-if sys.version_info >= (3,6): -15 |- 3+6 -16 |-else: -17 |- 3-5 - 14 |+3+6 -18 15 | -19 16 | if version_info >= (3,6): -20 17 | 3+6 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_2.py:19:4: UP036 [*] Version block is outdated for minimum Python version | @@ -87,19 +48,6 @@ UP036_2.py:19:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -16 16 | else: -17 17 | 3-5 -18 18 | -19 |-if version_info >= (3,6): -20 |- 3+6 -21 |-else: -22 |- 3-5 - 19 |+3+6 -23 20 | -24 21 | if sys.version_info < (3,6): -25 22 | 3-5 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_2.py:24:4: UP036 [*] Version block is outdated for minimum Python version | @@ -112,19 +60,6 @@ UP036_2.py:24:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -21 21 | else: -22 22 | 3-5 -23 23 | -24 |-if sys.version_info < (3,6): -25 |- 3-5 -26 |-else: -27 |- 3+6 - 24 |+3+6 -28 25 | -29 26 | if sys.version_info <= (3,5): -30 27 | 3-5 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_2.py:29:4: UP036 [*] Version block is outdated for minimum Python version | @@ -137,19 +72,6 @@ UP036_2.py:29:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -26 26 | else: -27 27 | 3+6 -28 28 | -29 |-if sys.version_info <= (3,5): -30 |- 3-5 -31 |-else: -32 |- 3+6 - 29 |+3+6 -33 30 | -34 31 | if sys.version_info <= (3, 5): -35 32 | 3-5 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_2.py:34:4: UP036 [*] Version block is outdated for minimum Python version | @@ -162,19 +84,6 @@ UP036_2.py:34:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -31 31 | else: -32 32 | 3+6 -33 33 | -34 |-if sys.version_info <= (3, 5): -35 |- 3-5 -36 |-else: -37 |- 3+6 - 34 |+3+6 -38 35 | -39 36 | if sys.version_info >= (3, 5): -40 37 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_2.py:39:4: UP036 [*] Version block is outdated for minimum Python version | @@ -186,17 +95,6 @@ UP036_2.py:39:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -36 36 | else: -37 37 | 3+6 -38 38 | -39 |-if sys.version_info >= (3, 5): -40 |- pass - 39 |+pass -41 40 | -42 41 | if sys.version_info < (3,0): -43 42 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_2.py:42:4: UP036 [*] Version block is outdated for minimum Python version | @@ -208,16 +106,6 @@ UP036_2.py:42:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -39 39 | if sys.version_info >= (3, 5): -40 40 | pass -41 41 | -42 |-if sys.version_info < (3,0): -43 |- pass -44 42 | -45 43 | if True: -46 44 | if sys.version_info < (3,0): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_2.py:46:8: UP036 [*] Version block is outdated for minimum Python version | @@ -228,17 +116,6 @@ UP036_2.py:46:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -43 43 | pass -44 44 | -45 45 | if True: -46 |- if sys.version_info < (3,0): -47 |- pass - 46 |+ pass -48 47 | -49 48 | if sys.version_info < (3,0): -50 49 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_2.py:49:4: UP036 [*] Version block is outdated for minimum Python version | @@ -251,18 +128,6 @@ UP036_2.py:49:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -46 46 | if sys.version_info < (3,0): -47 47 | pass -48 48 | -49 |-if sys.version_info < (3,0): -50 |- pass -51 |-elif False: - 49 |+if False: -52 50 | pass -53 51 | -54 52 | if sys.version_info > (3,): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_2.py:54:4: UP036 [*] Version block is outdated for minimum Python version | @@ -274,17 +139,3 @@ UP036_2.py:54:4: UP036 [*] Version block is outdated for minimum Python version 56 | elif False: | = help: Remove outdated version block - -51 51 | elif False: -52 52 | pass -53 53 | -54 |-if sys.version_info > (3,): -55 |- pass -56 |-elif False: -57 |- pass - 54 |+pass -58 55 | -59 56 | if sys.version_info[0] > "2": -60 57 | 3 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap index b102e2a197e13..36c552c7bb4e3 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap @@ -12,24 +12,6 @@ UP036_3.py:3:15: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -1 1 | import sys -2 2 | -3 |-if sys.version_info < (3,0): -4 |- print("py2") -5 |- for item in range(10): -6 |- print(f"PY2-{item}") -7 |-else : -8 |- print("py3") -9 |- for item in range(10): -10 |- print(f"PY3-{item}") - 3 |+print("py3") - 4 |+for item in range(10): - 5 |+ print(f"PY3-{item}") -11 6 | -12 7 | if False: -13 8 | if sys.version_info < (3,0): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_3.py:13:19: UP036 [*] Version block is outdated for minimum Python version | @@ -41,25 +23,6 @@ UP036_3.py:13:19: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -10 10 | print(f"PY3-{item}") -11 11 | -12 12 | if False: -13 |- if sys.version_info < (3,0): -14 |- print("py2") -15 |- for item in range(10): -16 |- print(f"PY2-{item}") -17 |- else : -18 |- print("py3") -19 |- for item in range(10): -20 |- print(f"PY3-{item}") - 13 |+ print("py3") - 14 |+ for item in range(10): - 15 |+ print(f"PY3-{item}") -21 16 | -22 17 | -23 18 | if sys.version_info < (3,0): print("PY2!") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_3.py:23:15: UP036 [*] Version block is outdated for minimum Python version | @@ -68,12 +31,3 @@ UP036_3.py:23:15: UP036 [*] Version block is outdated for minimum Python version 24 | else : print("PY3!") | = help: Remove outdated version block - -20 20 | print(f"PY3-{item}") -21 21 | -22 22 | -23 |-if sys.version_info < (3,0): print("PY2!") -24 |-else : print("PY3!") - 23 |+print("PY3!") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap index aa7f68bb9d913..c8a1cd3d0e382 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap @@ -10,17 +10,6 @@ UP036_4.py:4:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -1 1 | import sys -2 2 | -3 3 | if True: -4 |- if sys.version_info < (3, 3): -5 |- cmd = [sys.executable, "-m", "test.regrtest"] - 4 |+ pass -6 5 | -7 6 | -8 7 | if True: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_4.py:11:10: UP036 [*] Version block is outdated for minimum Python version | @@ -32,17 +21,6 @@ UP036_4.py:11:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -8 8 | if True: -9 9 | if foo: -10 10 | print() -11 |- elif sys.version_info < (3, 3): -12 |- cmd = [sys.executable, "-m", "test.regrtest"] - 11 |+ -13 12 | -14 13 | if True: -15 14 | if foo: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_4.py:17:10: UP036 [*] Version block is outdated for minimum Python version | @@ -55,16 +33,6 @@ UP036_4.py:17:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -14 14 | if True: -15 15 | if foo: -16 16 | print() -17 |- elif sys.version_info < (3, 3): -18 |- cmd = [sys.executable, "-m", "test.regrtest"] -19 17 | elif foo: -20 18 | cmd = [sys.executable, "-m", "test", "-j0"] -21 19 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_4.py:24:10: UP036 [*] Version block is outdated for minimum Python version | @@ -76,17 +44,6 @@ UP036_4.py:24:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -21 21 | -22 22 | if foo: -23 23 | print() -24 |- elif sys.version_info < (3, 3): -25 |- cmd = [sys.executable, "-m", "test.regrtest"] - 24 |+ -26 25 | -27 26 | if sys.version_info < (3, 3): -28 27 | cmd = [sys.executable, "-m", "test.regrtest"] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_4.py:27:8: UP036 [*] Version block is outdated for minimum Python version | @@ -98,16 +55,6 @@ UP036_4.py:27:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -24 24 | elif sys.version_info < (3, 3): -25 25 | cmd = [sys.executable, "-m", "test.regrtest"] -26 26 | -27 |- if sys.version_info < (3, 3): -28 |- cmd = [sys.executable, "-m", "test.regrtest"] -29 27 | -30 28 | if foo: -31 29 | print() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_4.py:32:10: UP036 [*] Version block is outdated for minimum Python version | @@ -120,16 +67,6 @@ UP036_4.py:32:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -29 29 | -30 30 | if foo: -31 31 | print() -32 |- elif sys.version_info < (3, 3): -33 |- cmd = [sys.executable, "-m", "test.regrtest"] -34 32 | else: -35 33 | cmd = [sys.executable, "-m", "test", "-j0"] -36 34 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_4.py:37:8: UP036 [*] Version block is outdated for minimum Python version | @@ -142,19 +79,6 @@ UP036_4.py:37:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -34 34 | else: -35 35 | cmd = [sys.executable, "-m", "test", "-j0"] -36 36 | -37 |- if sys.version_info < (3, 3): -38 |- cmd = [sys.executable, "-m", "test.regrtest"] -39 |- else: -40 |- cmd = [sys.executable, "-m", "test", "-j0"] - 37 |+ cmd = [sys.executable, "-m", "test", "-j0"] -41 38 | -42 39 | if sys.version_info < (3, 3): -43 40 | cmd = [sys.executable, "-m", "test.regrtest"] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_4.py:42:8: UP036 [*] Version block is outdated for minimum Python version | @@ -166,14 +90,3 @@ UP036_4.py:42:8: UP036 [*] Version block is outdated for minimum Python version 44 | elif foo: | = help: Remove outdated version block - -39 39 | else: -40 40 | cmd = [sys.executable, "-m", "test", "-j0"] -41 41 | -42 |- if sys.version_info < (3, 3): -43 |- cmd = [sys.executable, "-m", "test.regrtest"] -44 |- elif foo: - 42 |+ if foo: -45 43 | cmd = [sys.executable, "-m", "test", "-j0"] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap index 24bdc548f2c57..4984039ff4b03 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap @@ -12,25 +12,6 @@ UP036_5.py:3:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -1 1 | import sys -2 2 | -3 |-if sys.version_info < (3, 8): -4 |- -5 |- def a(): -6 |- if b: -7 |- print(1) -8 |- elif c: -9 |- print(2) -10 |- return None -11 |- -12 |-else: -13 |- pass - 3 |+pass -14 4 | -15 5 | -16 6 | import sys - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP036_5.py:18:4: UP036 [*] Version block is outdated for minimum Python version | @@ -41,30 +22,3 @@ UP036_5.py:18:4: UP036 [*] Version block is outdated for minimum Python version 19 | pass | = help: Remove outdated version block - -15 15 | -16 16 | import sys -17 17 | -18 |-if sys.version_info < (3, 8): -19 |- pass -20 |- -21 |-else: -22 |- -23 |- def a(): -24 |- if b: -25 |- print(1) -26 |- elif c: -27 |- print(2) -28 |- else: -29 |- print(3) -30 |- return None - 18 |+def a(): - 19 |+ if b: - 20 |+ print(1) - 21 |+ elif c: - 22 |+ print(2) - 23 |+ else: - 24 |+ print(3) - 25 |+ return None - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap index 3badb7edafddf..a3b71f9c0c964 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap @@ -9,13 +9,6 @@ UP038.py:1:1: UP038 [*] Use `X | Y` in `isinstance` call instead of `(X, Y)` | = help: Convert to `X | Y` -1 |-isinstance(1, (int, float)) # UP038 - 1 |+isinstance(1, int | float) # UP038 -2 2 | issubclass("yes", (int, float, str)) # UP038 -3 3 | -4 4 | isinstance(1, int) # OK - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP038.py:2:1: UP038 [*] Use `X | Y` in `issubclass` call instead of `(X, Y)` | @@ -26,12 +19,3 @@ UP038.py:2:1: UP038 [*] Use `X | Y` in `issubclass` call instead of `(X, Y)` 4 | isinstance(1, int) # OK | = help: Convert to `X | Y` - -1 1 | isinstance(1, (int, float)) # UP038 -2 |-issubclass("yes", (int, float, str)) # UP038 - 2 |+issubclass("yes", int | float | str) # UP038 -3 3 | -4 4 | isinstance(1, int) # OK -5 5 | issubclass("yes", int) # OK - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap index afbe53c8b2c7c..3cf8ed265c73c 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap @@ -10,16 +10,6 @@ UP040.py:5:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of th | = help: Use the `type` keyword -2 2 | from typing import TypeAlias -3 3 | -4 4 | # UP040 -5 |-x: typing.TypeAlias = int - 5 |+type x = int -6 6 | x: TypeAlias = int -7 7 | -8 8 | # UP040 simple generic - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP040.py:6:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | @@ -32,16 +22,6 @@ UP040.py:6:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of th | = help: Use the `type` keyword -3 3 | -4 4 | # UP040 -5 5 | x: typing.TypeAlias = int -6 |-x: TypeAlias = int - 6 |+type x = int -7 7 | -8 8 | # UP040 simple generic -9 9 | T = typing.TypeVar["T"] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP040.py:10:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | @@ -54,16 +34,6 @@ UP040.py:10:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -7 7 | -8 8 | # UP040 simple generic -9 9 | T = typing.TypeVar["T"] -10 |-x: typing.TypeAlias = list[T] - 10 |+type x[T] = list[T] -11 11 | -12 12 | # UP040 call style generic -13 13 | T = typing.TypeVar("T") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP040.py:14:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | @@ -76,16 +46,6 @@ UP040.py:14:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -11 11 | -12 12 | # UP040 call style generic -13 13 | T = typing.TypeVar("T") -14 |-x: typing.TypeAlias = list[T] - 14 |+type x[T] = list[T] -15 15 | -16 16 | # UP040 bounded generic -17 17 | T = typing.TypeVar("T", bound=int) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP040.py:18:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | @@ -98,16 +58,6 @@ UP040.py:18:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -15 15 | -16 16 | # UP040 bounded generic -17 17 | T = typing.TypeVar("T", bound=int) -18 |-x: typing.TypeAlias = list[T] - 18 |+type x[T: int] = list[T] -19 19 | -20 20 | # UP040 constrained generic -21 21 | T = typing.TypeVar("T", int, str) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP040.py:22:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | @@ -120,16 +70,6 @@ UP040.py:22:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -19 19 | -20 20 | # UP040 constrained generic -21 21 | T = typing.TypeVar("T", int, str) -22 |-x: typing.TypeAlias = list[T] - 22 |+type x[T: (int, str)] = list[T] -23 23 | -24 24 | # UP040 contravariant generic -25 25 | T = typing.TypeVar("T", contravariant=True) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP040.py:26:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | @@ -142,16 +82,6 @@ UP040.py:26:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -23 23 | -24 24 | # UP040 contravariant generic -25 25 | T = typing.TypeVar("T", contravariant=True) -26 |-x: typing.TypeAlias = list[T] - 26 |+type x[T] = list[T] -27 27 | -28 28 | # UP040 covariant generic -29 29 | T = typing.TypeVar("T", covariant=True) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP040.py:30:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | @@ -164,16 +94,6 @@ UP040.py:30:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -27 27 | -28 28 | # UP040 covariant generic -29 29 | T = typing.TypeVar("T", covariant=True) -30 |-x: typing.TypeAlias = list[T] - 30 |+type x[T] = list[T] -31 31 | -32 32 | # UP040 in class scope -33 33 | T = typing.TypeVar["T"] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP040.py:36:5: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | @@ -186,16 +106,6 @@ UP040.py:36:5: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -33 33 | T = typing.TypeVar["T"] -34 34 | class Foo: -35 35 | # reference to global variable -36 |- x: typing.TypeAlias = list[T] - 36 |+ type x[T] = list[T] -37 37 | -38 38 | # reference to class variable -39 39 | TCLS = typing.TypeVar["TCLS"] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP040.py:40:5: UP040 [*] Type alias `y` uses `TypeAlias` annotation instead of the `type` keyword | @@ -208,16 +118,6 @@ UP040.py:40:5: UP040 [*] Type alias `y` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -37 37 | -38 38 | # reference to class variable -39 39 | TCLS = typing.TypeVar["TCLS"] -40 |- y: typing.TypeAlias = list[TCLS] - 40 |+ type y[TCLS] = list[TCLS] -41 41 | -42 42 | # UP040 won't add generics in fix -43 43 | T = typing.TypeVar(*args) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP040.py:44:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | @@ -230,16 +130,6 @@ UP040.py:44:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -41 41 | -42 42 | # UP040 won't add generics in fix -43 43 | T = typing.TypeVar(*args) -44 |-x: typing.TypeAlias = list[T] - 44 |+type x = list[T] -45 45 | -46 46 | # OK -47 47 | x: TypeAlias - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP040.py:53:1: UP040 [*] Type alias `Decorator` uses `TypeAlias` annotation instead of the `type` keyword | @@ -250,16 +140,6 @@ UP040.py:53:1: UP040 [*] Type alias `Decorator` uses `TypeAlias` annotation inst | = help: Use the `type` keyword -50 50 | # Ensure that "T" appears only once in the type parameters for the modernized -51 51 | # type alias. -52 52 | T = typing.TypeVar["T"] -53 |-Decorator: TypeAlias = typing.Callable[[T], T] - 53 |+type Decorator[T] = typing.Callable[[T], T] -54 54 | -55 55 | -56 56 | from typing import TypeVar, Annotated, TypeAliasType - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP040.py:63:1: UP040 [*] Type alias `PositiveList` uses `TypeAliasType` assignment instead of the `type` keyword | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP042.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP042.py.snap index b0b948f05a85c..2bfb127870527 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP042.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP042.py.snap @@ -8,17 +8,6 @@ UP042.py:4:7: UP042 [*] Class A inherits from both `str` and `enum.Enum` | = help: Inherit from `enum.StrEnum` -1 |-from enum import Enum - 1 |+from enum import Enum, StrEnum -2 2 | -3 3 | -4 |-class A(str, Enum): ... - 4 |+class A(StrEnum): ... -5 5 | -6 6 | -7 7 | class B(Enum, str): ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP042.py:7:7: UP042 [*] Class B inherits from both `str` and `enum.Enum` | @@ -27,20 +16,6 @@ UP042.py:7:7: UP042 [*] Class B inherits from both `str` and `enum.Enum` | = help: Inherit from `enum.StrEnum` -1 |-from enum import Enum - 1 |+from enum import Enum, StrEnum -2 2 | -3 3 | -4 4 | class A(str, Enum): ... -5 5 | -6 6 | -7 |-class B(Enum, str): ... - 7 |+class B(StrEnum): ... -8 8 | -9 9 | -10 10 | class D(int, str, Enum): ... - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. UP042.py:10:7: UP042 Class D inherits from both `str` and `enum.Enum` | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap index 3bdb57a6a18cf..524ea9e72b94d 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_p37.snap @@ -9,14 +9,3 @@ future_annotations.py:34:18: UP006 [*] Use `list` instead of `List` for type ann 36 | y.append(x) | = help: Replace with `list` - -31 31 | return cls(x=0, y=0) -32 32 | -33 33 | -34 |-def f(x: int) -> List[int]: - 34 |+def f(x: int) -> list[int]: -35 35 | y = List[int]() -36 36 | y.append(x) -37 37 | return y - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap index 9637ade1b0174..3848dedf3514e 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap @@ -9,13 +9,3 @@ future_annotations.py:40:4: UP007 [*] Use `X | Y` for type annotations 42 | MyList: TypeAlias = Union[List[int], List[str]] | = help: Convert to `X | Y` - -37 37 | return y -38 38 | -39 39 | -40 |-x: Optional[int] = None - 40 |+x: int | None = None -41 41 | -42 42 | MyList: TypeAlias = Union[List[int], List[str]] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap index ec78f78f10bd1..307a8a50abe2e 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap @@ -80,16 +80,6 @@ FURB110.py:10:5: FURB110 [*] Replace ternary `if` expression with `or` operator | = help: Replace with `or` operator -7 7 | else \ -8 8 | y # FURB110 -9 9 | -10 |-z = x() if x() else y() # FURB110 - 10 |+z = x() or y() # FURB110 -11 11 | -12 12 | # FURB110 -13 13 | z = x if ( - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB110.py:13:5: FURB110 [*] Replace ternary `if` expression with `or` operator | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap index 30b9727ed5813..e70eaf1248914 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap @@ -11,17 +11,6 @@ FURB113.py:23:1: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal | = help: Replace with `nums.extend((1, 2))` -20 20 | -21 21 | -22 22 | # FURB113 -23 |-nums.append(1) -24 |-nums.append(2) - 23 |+nums.extend((1, 2)) -25 24 | pass -26 25 | -27 26 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB113.py:29:1: FURB113 [*] Use `nums3.extend((1, 2))` instead of repeatedly calling `nums3.append()` | @@ -33,17 +22,6 @@ FURB113.py:29:1: FURB113 [*] Use `nums3.extend((1, 2))` instead of repeatedly ca | = help: Replace with `nums3.extend((1, 2))` -26 26 | -27 27 | -28 28 | # FURB113 -29 |-nums3.append(1) -30 |-nums3.append(2) - 29 |+nums3.extend((1, 2)) -31 30 | pass -32 31 | -33 32 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB113.py:35:1: FURB113 [*] Use `nums4.extend((1, 2))` instead of repeatedly calling `nums4.append()` | @@ -55,17 +33,6 @@ FURB113.py:35:1: FURB113 [*] Use `nums4.extend((1, 2))` instead of repeatedly ca | = help: Replace with `nums4.extend((1, 2))` -32 32 | -33 33 | -34 34 | # FURB113 -35 |-nums4.append(1) -36 |-nums4.append(2) - 35 |+nums4.extend((1, 2)) -37 36 | pass -38 37 | -39 38 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB113.py:41:1: FURB113 Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` | @@ -121,17 +88,6 @@ FURB113.py:56:1: FURB113 [*] Use `nums4.extend((1, 2))` instead of repeatedly ca | = help: Replace with `nums4.extend((1, 2))` -53 53 | nums3.append(1) -54 54 | nums.append(3) -55 55 | # FURB113 -56 |-nums4.append(1) -57 |-nums4.append(2) - 56 |+nums4.extend((1, 2)) -58 57 | nums3.append(2) -59 58 | pass -60 59 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB113.py:62:1: FURB113 [*] Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` | @@ -143,18 +99,6 @@ FURB113.py:62:1: FURB113 [*] Use `nums.extend((1, 2, 3))` instead of repeatedly | = help: Replace with `nums.extend((1, 2, 3))` -59 59 | pass -60 60 | -61 61 | # FURB113 -62 |-nums.append(1) -63 |-nums.append(2) -64 |-nums.append(3) - 62 |+nums.extend((1, 2, 3)) -65 63 | -66 64 | -67 65 | if True: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB113.py:69:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` | @@ -167,17 +111,6 @@ FURB113.py:69:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal | = help: Replace with `nums.extend((1, 2))` -66 66 | -67 67 | if True: -68 68 | # FURB113 -69 |- nums.append(1) -70 |- nums.append(2) - 69 |+ nums.extend((1, 2)) -71 70 | -72 71 | -73 72 | if True: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB113.py:75:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` | @@ -191,17 +124,6 @@ FURB113.py:75:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal | = help: Replace with `nums.extend((1, 2))` -72 72 | -73 73 | if True: -74 74 | # FURB113 -75 |- nums.append(1) -76 |- nums.append(2) - 75 |+ nums.extend((1, 2)) -77 76 | pass -78 77 | -79 78 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB113.py:82:5: FURB113 Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` | @@ -227,17 +149,6 @@ FURB113.py:90:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly callin | = help: Replace with `x.extend((1, 2))` -87 87 | -88 88 | def yes_one(x: list[int]): -89 89 | # FURB113 -90 |- x.append(1) -91 |- x.append(2) - 90 |+ x.extend((1, 2)) -92 91 | -93 92 | -94 93 | def yes_two(x: List[int]): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB113.py:96:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` | @@ -250,17 +161,6 @@ FURB113.py:96:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly callin | = help: Replace with `x.extend((1, 2))` -93 93 | -94 94 | def yes_two(x: List[int]): -95 95 | # FURB113 -96 |- x.append(1) -97 |- x.append(2) - 96 |+ x.extend((1, 2)) -98 97 | -99 98 | -100 99 | def yes_three(*, x: list[int]): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB113.py:102:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` | @@ -273,17 +173,6 @@ FURB113.py:102:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli | = help: Replace with `x.extend((1, 2))` -99 99 | -100 100 | def yes_three(*, x: list[int]): -101 101 | # FURB113 -102 |- x.append(1) -103 |- x.append(2) - 102 |+ x.extend((1, 2)) -104 103 | -105 104 | -106 105 | def yes_four(x: list[int], /): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB113.py:108:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` | @@ -296,17 +185,6 @@ FURB113.py:108:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli | = help: Replace with `x.extend((1, 2))` -105 105 | -106 106 | def yes_four(x: list[int], /): -107 107 | # FURB113 -108 |- x.append(1) -109 |- x.append(2) - 108 |+ x.extend((1, 2)) -110 109 | -111 110 | -112 111 | def yes_five(x: list[int], y: list[int]): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB113.py:114:5: FURB113 Use `x.extend((1, 2, 3))` instead of repeatedly calling `x.append()` | @@ -332,17 +210,6 @@ FURB113.py:122:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli | = help: Replace with `x.extend((1, 2))` -119 119 | -120 120 | def yes_six(x: list): -121 121 | # FURB113 -122 |- x.append(1) -123 |- x.append(2) - 122 |+ x.extend((1, 2)) -124 123 | -125 124 | -126 125 | if True: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB113.py:128:5: FURB113 Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap index 10474ac61293c..b4b541ee3c089 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB129_FURB129.py.snap @@ -12,16 +12,6 @@ FURB129.py:7:18: FURB129 [*] Instead of calling `readlines()`, iterate over file | = help: Remove `readlines()` -4 4 | -5 5 | # Errors -6 6 | with open("FURB129.py") as f: -7 |- for _line in f.readlines(): - 7 |+ for _line in f: -8 8 | pass -9 9 | a = [line.lower() for line in f.readlines()] -10 10 | b = {line.upper() for line in f.readlines()} - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB129.py:9:35: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | @@ -34,16 +24,6 @@ FURB129.py:9:35: FURB129 [*] Instead of calling `readlines()`, iterate over file | = help: Remove `readlines()` -6 6 | with open("FURB129.py") as f: -7 7 | for _line in f.readlines(): -8 8 | pass -9 |- a = [line.lower() for line in f.readlines()] - 9 |+ a = [line.lower() for line in f] -10 10 | b = {line.upper() for line in f.readlines()} -11 11 | c = {line.lower(): line.upper() for line in f.readlines()} -12 12 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB129.py:10:35: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | @@ -55,16 +35,6 @@ FURB129.py:10:35: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -7 7 | for _line in f.readlines(): -8 8 | pass -9 9 | a = [line.lower() for line in f.readlines()] -10 |- b = {line.upper() for line in f.readlines()} - 10 |+ b = {line.upper() for line in f} -11 11 | c = {line.lower(): line.upper() for line in f.readlines()} -12 12 | -13 13 | with Path("FURB129.py").open() as f: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB129.py:11:49: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | @@ -77,16 +47,6 @@ FURB129.py:11:49: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -8 8 | pass -9 9 | a = [line.lower() for line in f.readlines()] -10 10 | b = {line.upper() for line in f.readlines()} -11 |- c = {line.lower(): line.upper() for line in f.readlines()} - 11 |+ c = {line.lower(): line.upper() for line in f} -12 12 | -13 13 | with Path("FURB129.py").open() as f: -14 14 | for _line in f.readlines(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB129.py:14:18: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | @@ -97,16 +57,6 @@ FURB129.py:14:18: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -11 11 | c = {line.lower(): line.upper() for line in f.readlines()} -12 12 | -13 13 | with Path("FURB129.py").open() as f: -14 |- for _line in f.readlines(): - 14 |+ for _line in f: -15 15 | pass -16 16 | -17 17 | for _line in open("FURB129.py").readlines(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB129.py:17:14: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | @@ -118,16 +68,6 @@ FURB129.py:17:14: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -14 14 | for _line in f.readlines(): -15 15 | pass -16 16 | -17 |-for _line in open("FURB129.py").readlines(): - 17 |+for _line in open("FURB129.py"): -18 18 | pass -19 19 | -20 20 | for _line in Path("FURB129.py").open().readlines(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB129.py:20:14: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | @@ -139,16 +79,6 @@ FURB129.py:20:14: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -17 17 | for _line in open("FURB129.py").readlines(): -18 18 | pass -19 19 | -20 |-for _line in Path("FURB129.py").open().readlines(): - 20 |+for _line in Path("FURB129.py").open(): -21 21 | pass -22 22 | -23 23 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB129.py:26:18: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | @@ -161,16 +91,6 @@ FURB129.py:26:18: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -23 23 | -24 24 | def func(): -25 25 | f = Path("FURB129.py").open() -26 |- for _line in f.readlines(): - 26 |+ for _line in f: -27 27 | pass -28 28 | f.close() -29 29 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB129.py:32:18: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | @@ -181,16 +101,6 @@ FURB129.py:32:18: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -29 29 | -30 30 | -31 31 | def func(f: io.BytesIO): -32 |- for _line in f.readlines(): - 32 |+ for _line in f: -33 33 | pass -34 34 | -35 35 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB129.py:38:22: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | @@ -203,16 +113,6 @@ FURB129.py:38:22: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -35 35 | -36 36 | def func(): -37 37 | with (open("FURB129.py") as f, foo as bar): -38 |- for _line in f.readlines(): - 38 |+ for _line in f: -39 39 | pass -40 40 | for _line in bar.readlines(): -41 41 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB129.py:48:17: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | @@ -223,16 +123,6 @@ FURB129.py:48:17: FURB129 [*] Instead of calling `readlines()`, iterate over fil | = help: Remove `readlines()` -45 45 | -46 46 | -47 47 | with builtins.open("FURB129.py") as f: -48 |- for line in f.readlines(): - 48 |+ for line in f: -49 49 | pass -50 50 | -51 51 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB129.py:56:17: FURB129 [*] Instead of calling `readlines()`, iterate over file object directly | @@ -242,14 +132,3 @@ FURB129.py:56:17: FURB129 [*] Instead of calling `readlines()`, iterate over fil 57 | pass | = help: Remove `readlines()` - -53 53 | -54 54 | -55 55 | with o("FURB129.py") as f: -56 |- for line in f.readlines(): - 56 |+ for line in f: -57 57 | pass -58 58 | -59 59 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap index 7e9d41cc17d0e..0d76db8d28394 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap @@ -9,16 +9,6 @@ FURB131.py:11:1: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -8 8 | # these should match -9 9 | -10 10 | # FURB131 -11 |-del nums[:] - 11 |+nums.clear() -12 12 | -13 13 | -14 14 | # FURB131 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB131.py:15:1: FURB131 [*] Prefer `clear` over deleting a full slice | @@ -28,16 +18,6 @@ FURB131.py:15:1: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -12 12 | -13 13 | -14 14 | # FURB131 -15 |-del names[:] - 15 |+names.clear() -16 16 | -17 17 | -18 18 | # FURB131 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB131.py:19:1: FURB131 Prefer `clear` over deleting a full slice | @@ -64,16 +44,6 @@ FURB131.py:28:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -25 25 | -26 26 | def yes_one(x: list[int]): -27 27 | # FURB131 -28 |- del x[:] - 28 |+ x.clear() -29 29 | -30 30 | -31 31 | def yes_two(x: dict[int, str]): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB131.py:33:5: FURB131 [*] Prefer `clear` over deleting a full slice | @@ -84,16 +54,6 @@ FURB131.py:33:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -30 30 | -31 31 | def yes_two(x: dict[int, str]): -32 32 | # FURB131 -33 |- del x[:] - 33 |+ x.clear() -34 34 | -35 35 | -36 36 | def yes_three(x: List[int]): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB131.py:38:5: FURB131 [*] Prefer `clear` over deleting a full slice | @@ -104,16 +64,6 @@ FURB131.py:38:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -35 35 | -36 36 | def yes_three(x: List[int]): -37 37 | # FURB131 -38 |- del x[:] - 38 |+ x.clear() -39 39 | -40 40 | -41 41 | def yes_four(x: Dict[int, str]): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB131.py:43:5: FURB131 [*] Prefer `clear` over deleting a full slice | @@ -124,16 +74,6 @@ FURB131.py:43:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -40 40 | -41 41 | def yes_four(x: Dict[int, str]): -42 42 | # FURB131 -43 |- del x[:] - 43 |+ x.clear() -44 44 | -45 45 | -46 46 | def yes_five(x: Dict[int, str]): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB131.py:48:5: FURB131 [*] Prefer `clear` over deleting a full slice | @@ -146,16 +86,6 @@ FURB131.py:48:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -45 45 | -46 46 | def yes_five(x: Dict[int, str]): -47 47 | # FURB131 -48 |- del x[:] - 48 |+ x.clear() -49 49 | -50 50 | x = 1 -51 51 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB131.py:58:1: FURB131 [*] Prefer `clear` over deleting a full slice | @@ -167,14 +97,3 @@ FURB131.py:58:1: FURB131 [*] Prefer `clear` over deleting a full slice 60 | # these should not | = help: Replace with `clear()` - -55 55 | -56 56 | sneaky = SneakyList() -57 57 | # FURB131 -58 |-del sneaky[:] - 58 |+sneaky.clear() -59 59 | -60 60 | # these should not -61 61 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap index 5b5142ad11d88..843b8b41f6758 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap @@ -10,17 +10,6 @@ FURB132.py:12:1: FURB132 [*] Use `s.discard("x")` instead of check and `remove` | = help: Replace with `s.discard("x")` -9 9 | # these should match -10 10 | -11 11 | # FURB132 -12 |-if "x" in s: -13 |- s.remove("x") - 12 |+s.discard("x") -14 13 | -15 14 | -16 15 | # FURB132 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB132.py:22:1: FURB132 [*] Use `s3.discard("x")` instead of check and `remove` | @@ -31,17 +20,6 @@ FURB132.py:22:1: FURB132 [*] Use `s3.discard("x")` instead of check and `remove` | = help: Replace with `s3.discard("x")` -19 19 | -20 20 | -21 21 | # FURB132 -22 |-if "x" in s3: -23 |- s3.remove("x") - 22 |+s3.discard("x") -24 23 | -25 24 | -26 25 | var = "y" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB132.py:28:1: FURB132 [*] Use `s.discard(var)` instead of check and `remove` | @@ -53,17 +31,6 @@ FURB132.py:28:1: FURB132 [*] Use `s.discard(var)` instead of check and `remove` | = help: Replace with `s.discard(var)` -25 25 | -26 26 | var = "y" -27 27 | # FURB132 -28 |-if var in s: -29 |- s.remove(var) - 28 |+s.discard(var) -30 29 | -31 30 | -32 31 | if f"{var}:{var}" in s: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB132.py:32:1: FURB132 [*] Use `s.discard(f"{var}:{var}")` instead of check and `remove` | @@ -72,15 +39,3 @@ FURB132.py:32:1: FURB132 [*] Use `s.discard(f"{var}:{var}")` instead of check an | |____________________________^ FURB132 | = help: Replace with `s.discard(f"{var}:{var}")` - -29 29 | s.remove(var) -30 30 | -31 31 | -32 |-if f"{var}:{var}" in s: -33 |- s.remove(f"{var}:{var}") - 32 |+s.discard(f"{var}:{var}") -34 33 | -35 34 | -36 35 | def identity(x): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap index bdc62b000b1a2..b2146c1cbfc24 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap @@ -10,16 +10,6 @@ FURB148.py:14:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -11 11 | books_tuple = ("Dune", "Foundation", "Neuromancer") -12 12 | -13 13 | # Errors -14 |-for index, _ in enumerate(books): - 14 |+for index in range(len(books)): -15 15 | print(index) -16 16 | -17 17 | for index, _ in enumerate(books, start=0): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:17:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | @@ -31,16 +21,6 @@ FURB148.py:17:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -14 14 | for index, _ in enumerate(books): -15 15 | print(index) -16 16 | -17 |-for index, _ in enumerate(books, start=0): - 17 |+for index in range(len(books)): -18 18 | print(index) -19 19 | -20 20 | for index, _ in enumerate(books, 0): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:20:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | @@ -52,16 +32,6 @@ FURB148.py:20:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -17 17 | for index, _ in enumerate(books, start=0): -18 18 | print(index) -19 19 | -20 |-for index, _ in enumerate(books, 0): - 20 |+for index in range(len(books)): -21 21 | print(index) -22 22 | -23 23 | for index, _ in enumerate(books, start=1): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:23:17: FURB148 `enumerate` value is unused, use `for x in range(len(y))` instead | @@ -113,16 +83,6 @@ FURB148.py:35:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -32 32 | for index, _ in enumerate(books, x): -33 33 | print(book) -34 34 | -35 |-for _, book in enumerate(books): - 35 |+for book in books: -36 36 | print(book) -37 37 | -38 38 | for _, book in enumerate(books, start=0): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:38:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | @@ -134,16 +94,6 @@ FURB148.py:38:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -35 35 | for _, book in enumerate(books): -36 36 | print(book) -37 37 | -38 |-for _, book in enumerate(books, start=0): - 38 |+for book in books: -39 39 | print(book) -40 40 | -41 41 | for _, book in enumerate(books, 0): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:41:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | @@ -155,16 +105,6 @@ FURB148.py:41:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -38 38 | for _, book in enumerate(books, start=0): -39 39 | print(book) -40 40 | -41 |-for _, book in enumerate(books, 0): - 41 |+for book in books: -42 42 | print(book) -43 43 | -44 44 | for _, book in enumerate(books, start=1): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:44:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | @@ -176,16 +116,6 @@ FURB148.py:44:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -41 41 | for _, book in enumerate(books, 0): -42 42 | print(book) -43 43 | -44 |-for _, book in enumerate(books, start=1): - 44 |+for book in books: -45 45 | print(book) -46 46 | -47 47 | for _, book in enumerate(books, 1): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:47:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | @@ -197,16 +127,6 @@ FURB148.py:47:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -44 44 | for _, book in enumerate(books, start=1): -45 45 | print(book) -46 46 | -47 |-for _, book in enumerate(books, 1): - 47 |+for book in books: -48 48 | print(book) -49 49 | -50 50 | for _, book in enumerate(books, start=x): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:50:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | @@ -218,16 +138,6 @@ FURB148.py:50:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -47 47 | for _, book in enumerate(books, 1): -48 48 | print(book) -49 49 | -50 |-for _, book in enumerate(books, start=x): - 50 |+for book in books: -51 51 | print(book) -52 52 | -53 53 | for _, book in enumerate(books, x): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:53:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | @@ -239,16 +149,6 @@ FURB148.py:53:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -50 50 | for _, book in enumerate(books, start=x): -51 51 | print(book) -52 52 | -53 |-for _, book in enumerate(books, x): - 53 |+for book in books: -54 54 | print(book) -55 55 | -56 56 | for index, (_, _) in enumerate(books): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:56:22: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | @@ -260,16 +160,6 @@ FURB148.py:56:22: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -53 53 | for _, book in enumerate(books, x): -54 54 | print(book) -55 55 | -56 |-for index, (_, _) in enumerate(books): - 56 |+for index in range(len(books)): -57 57 | print(index) -58 58 | -59 59 | for (_, _), book in enumerate(books): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:59:21: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | @@ -281,16 +171,6 @@ FURB148.py:59:21: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -56 56 | for index, (_, _) in enumerate(books): -57 57 | print(index) -58 58 | -59 |-for (_, _), book in enumerate(books): - 59 |+for book in books: -60 60 | print(book) -61 61 | -62 62 | for(index, _)in enumerate(books): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:62:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | @@ -302,16 +182,6 @@ FURB148.py:62:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -59 59 | for (_, _), book in enumerate(books): -60 60 | print(book) -61 61 | -62 |-for(index, _)in enumerate(books): - 62 |+for index in range(len(books)): -63 63 | print(index) -64 64 | -65 65 | for(index), _ in enumerate(books): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:65:18: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | @@ -323,16 +193,6 @@ FURB148.py:65:18: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -62 62 | for(index, _)in enumerate(books): -63 63 | print(index) -64 64 | -65 |-for(index), _ in enumerate(books): - 65 |+for index in range(len(books)): -66 66 | print(index) -67 67 | -68 68 | for index, _ in enumerate(books_and_authors): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:68:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | @@ -344,16 +204,6 @@ FURB148.py:68:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -65 65 | for(index), _ in enumerate(books): -66 66 | print(index) -67 67 | -68 |-for index, _ in enumerate(books_and_authors): - 68 |+for index in range(len(books_and_authors)): -69 69 | print(index) -70 70 | -71 71 | for _, book in enumerate(books_and_authors): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:71:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | @@ -365,16 +215,6 @@ FURB148.py:71:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -68 68 | for index, _ in enumerate(books_and_authors): -69 69 | print(index) -70 70 | -71 |-for _, book in enumerate(books_and_authors): - 71 |+for book in books_and_authors: -72 72 | print(book) -73 73 | -74 74 | for index, _ in enumerate(books_set): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:74:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | @@ -386,16 +226,6 @@ FURB148.py:74:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -71 71 | for _, book in enumerate(books_and_authors): -72 72 | print(book) -73 73 | -74 |-for index, _ in enumerate(books_set): - 74 |+for index in range(len(books_set)): -75 75 | print(index) -76 76 | -77 77 | for _, book in enumerate(books_set): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:77:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | @@ -407,16 +237,6 @@ FURB148.py:77:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -74 74 | for index, _ in enumerate(books_set): -75 75 | print(index) -76 76 | -77 |-for _, book in enumerate(books_set): - 77 |+for book in books_set: -78 78 | print(book) -79 79 | -80 80 | for index, _ in enumerate(books_tuple): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:80:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | @@ -428,16 +248,6 @@ FURB148.py:80:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -77 77 | for _, book in enumerate(books_set): -78 78 | print(book) -79 79 | -80 |-for index, _ in enumerate(books_tuple): - 80 |+for index in range(len(books_tuple)): -81 81 | print(index) -82 82 | -83 83 | for _, book in enumerate(books_tuple): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB148.py:83:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | @@ -448,14 +258,3 @@ FURB148.py:83:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 84 | print(book) | = help: Remove `enumerate` - -80 80 | for index, _ in enumerate(books_tuple): -81 81 | print(index) -82 82 | -83 |-for _, book in enumerate(books_tuple): - 83 |+for book in books_tuple: -84 84 | print(book) -85 85 | -86 86 | # OK - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap index a58de2bf68bf8..e52a7cc58cdaa 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB166_FURB166.py.snap @@ -12,15 +12,6 @@ FURB166.py:3:5: FURB166 [*] Use of `int` with explicit `base=2` after removing p | = help: Replace with `base=0` -1 1 | # Errors -2 2 | -3 |-_ = int("0b1010"[2:], 2) - 3 |+_ = int("0b1010", 0) -4 4 | _ = int("0o777"[2:], 8) -5 5 | _ = int("0xFFFF"[2:], 16) -6 6 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB166.py:4:5: FURB166 [*] Use of `int` with explicit `base=8` after removing prefix | @@ -31,16 +22,6 @@ FURB166.py:4:5: FURB166 [*] Use of `int` with explicit `base=8` after removing p | = help: Replace with `base=0` -1 1 | # Errors -2 2 | -3 3 | _ = int("0b1010"[2:], 2) -4 |-_ = int("0o777"[2:], 8) - 4 |+_ = int("0o777", 0) -5 5 | _ = int("0xFFFF"[2:], 16) -6 6 | -7 7 | b = "0b11" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB166.py:5:5: FURB166 [*] Use of `int` with explicit `base=16` after removing prefix | @@ -53,16 +34,6 @@ FURB166.py:5:5: FURB166 [*] Use of `int` with explicit `base=16` after removing | = help: Replace with `base=0` -2 2 | -3 3 | _ = int("0b1010"[2:], 2) -4 4 | _ = int("0o777"[2:], 8) -5 |-_ = int("0xFFFF"[2:], 16) - 5 |+_ = int("0xFFFF", 0) -6 6 | -7 7 | b = "0b11" -8 8 | _ = int(b[2:], 2) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB166.py:8:5: FURB166 [*] Use of `int` with explicit `base=2` after removing prefix | @@ -74,16 +45,6 @@ FURB166.py:8:5: FURB166 [*] Use of `int` with explicit `base=2` after removing p | = help: Replace with `base=0` -5 5 | _ = int("0xFFFF"[2:], 16) -6 6 | -7 7 | b = "0b11" -8 |-_ = int(b[2:], 2) - 8 |+_ = int(b, 0) -9 9 | -10 10 | _ = int("0xFFFF"[2:], base=16) -11 11 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB166.py:10:5: FURB166 [*] Use of `int` with explicit `base=16` after removing prefix | @@ -96,16 +57,6 @@ FURB166.py:10:5: FURB166 [*] Use of `int` with explicit `base=16` after removing | = help: Replace with `base=0` -7 7 | b = "0b11" -8 8 | _ = int(b[2:], 2) -9 9 | -10 |-_ = int("0xFFFF"[2:], base=16) - 10 |+_ = int("0xFFFF", base=0) -11 11 | -12 12 | _ = int(b"0xFFFF"[2:], 16) -13 13 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB166.py:12:5: FURB166 [*] Use of `int` with explicit `base=16` after removing prefix | @@ -116,16 +67,6 @@ FURB166.py:12:5: FURB166 [*] Use of `int` with explicit `base=16` after removing | = help: Replace with `base=0` -9 9 | -10 10 | _ = int("0xFFFF"[2:], base=16) -11 11 | -12 |-_ = int(b"0xFFFF"[2:], 16) - 12 |+_ = int(b"0xFFFF", 0) -13 13 | -14 14 | -15 15 | def get_str(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB166.py:19:5: FURB166 [*] Use of `int` with explicit `base=16` after removing prefix | @@ -135,14 +76,3 @@ FURB166.py:19:5: FURB166 [*] Use of `int` with explicit `base=16` after removing 21 | # OK | = help: Replace with `base=0` - -16 16 | return "0xFFF" -17 17 | -18 18 | -19 |-_ = int(get_str()[2:], 16) - 19 |+_ = int(get_str(), 0) -20 20 | -21 21 | # OK -22 22 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap index 8e10386399136..ae1c884dc5171 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB181_FURB181.py.snap @@ -12,16 +12,6 @@ FURB181.py:19:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -16 16 | -17 17 | # these will match -18 18 | -19 |-blake2b().digest().hex() - 19 |+blake2b().hexdigest() -20 20 | blake2s().digest().hex() -21 21 | md5().digest().hex() -22 22 | sha1().digest().hex() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB181.py:20:1: FURB181 [*] Use of hashlib's `.digest().hex()` | @@ -33,16 +23,6 @@ FURB181.py:20:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -17 17 | # these will match -18 18 | -19 19 | blake2b().digest().hex() -20 |-blake2s().digest().hex() - 20 |+blake2s().hexdigest() -21 21 | md5().digest().hex() -22 22 | sha1().digest().hex() -23 23 | sha224().digest().hex() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB181.py:21:1: FURB181 [*] Use of hashlib's `.digest().hex()` | @@ -55,16 +35,6 @@ FURB181.py:21:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -18 18 | -19 19 | blake2b().digest().hex() -20 20 | blake2s().digest().hex() -21 |-md5().digest().hex() - 21 |+md5().hexdigest() -22 22 | sha1().digest().hex() -23 23 | sha224().digest().hex() -24 24 | sha256().digest().hex() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB181.py:22:1: FURB181 [*] Use of hashlib's `.digest().hex()` | @@ -77,16 +47,6 @@ FURB181.py:22:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -19 19 | blake2b().digest().hex() -20 20 | blake2s().digest().hex() -21 21 | md5().digest().hex() -22 |-sha1().digest().hex() - 22 |+sha1().hexdigest() -23 23 | sha224().digest().hex() -24 24 | sha256().digest().hex() -25 25 | sha384().digest().hex() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB181.py:23:1: FURB181 [*] Use of hashlib's `.digest().hex()` | @@ -99,16 +59,6 @@ FURB181.py:23:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -20 20 | blake2s().digest().hex() -21 21 | md5().digest().hex() -22 22 | sha1().digest().hex() -23 |-sha224().digest().hex() - 23 |+sha224().hexdigest() -24 24 | sha256().digest().hex() -25 25 | sha384().digest().hex() -26 26 | sha3_224().digest().hex() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB181.py:24:1: FURB181 [*] Use of hashlib's `.digest().hex()` | @@ -121,16 +71,6 @@ FURB181.py:24:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -21 21 | md5().digest().hex() -22 22 | sha1().digest().hex() -23 23 | sha224().digest().hex() -24 |-sha256().digest().hex() - 24 |+sha256().hexdigest() -25 25 | sha384().digest().hex() -26 26 | sha3_224().digest().hex() -27 27 | sha3_256().digest().hex() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB181.py:25:1: FURB181 [*] Use of hashlib's `.digest().hex()` | @@ -143,16 +83,6 @@ FURB181.py:25:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -22 22 | sha1().digest().hex() -23 23 | sha224().digest().hex() -24 24 | sha256().digest().hex() -25 |-sha384().digest().hex() - 25 |+sha384().hexdigest() -26 26 | sha3_224().digest().hex() -27 27 | sha3_256().digest().hex() -28 28 | sha3_384().digest().hex() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB181.py:26:1: FURB181 [*] Use of hashlib's `.digest().hex()` | @@ -165,16 +95,6 @@ FURB181.py:26:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -23 23 | sha224().digest().hex() -24 24 | sha256().digest().hex() -25 25 | sha384().digest().hex() -26 |-sha3_224().digest().hex() - 26 |+sha3_224().hexdigest() -27 27 | sha3_256().digest().hex() -28 28 | sha3_384().digest().hex() -29 29 | sha3_512().digest().hex() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB181.py:27:1: FURB181 [*] Use of hashlib's `.digest().hex()` | @@ -187,16 +107,6 @@ FURB181.py:27:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -24 24 | sha256().digest().hex() -25 25 | sha384().digest().hex() -26 26 | sha3_224().digest().hex() -27 |-sha3_256().digest().hex() - 27 |+sha3_256().hexdigest() -28 28 | sha3_384().digest().hex() -29 29 | sha3_512().digest().hex() -30 30 | sha512().digest().hex() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB181.py:28:1: FURB181 [*] Use of hashlib's `.digest().hex()` | @@ -209,16 +119,6 @@ FURB181.py:28:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -25 25 | sha384().digest().hex() -26 26 | sha3_224().digest().hex() -27 27 | sha3_256().digest().hex() -28 |-sha3_384().digest().hex() - 28 |+sha3_384().hexdigest() -29 29 | sha3_512().digest().hex() -30 30 | sha512().digest().hex() -31 31 | shake_128().digest(10).hex() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB181.py:29:1: FURB181 [*] Use of hashlib's `.digest().hex()` | @@ -231,16 +131,6 @@ FURB181.py:29:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -26 26 | sha3_224().digest().hex() -27 27 | sha3_256().digest().hex() -28 28 | sha3_384().digest().hex() -29 |-sha3_512().digest().hex() - 29 |+sha3_512().hexdigest() -30 30 | sha512().digest().hex() -31 31 | shake_128().digest(10).hex() -32 32 | shake_256().digest(10).hex() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB181.py:30:1: FURB181 [*] Use of hashlib's `.digest().hex()` | @@ -253,16 +143,6 @@ FURB181.py:30:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -27 27 | sha3_256().digest().hex() -28 28 | sha3_384().digest().hex() -29 29 | sha3_512().digest().hex() -30 |-sha512().digest().hex() - 30 |+sha512().hexdigest() -31 31 | shake_128().digest(10).hex() -32 32 | shake_256().digest(10).hex() -33 33 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB181.py:31:1: FURB181 Use of hashlib's `.digest().hex()` | @@ -296,16 +176,6 @@ FURB181.py:34:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -31 31 | shake_128().digest(10).hex() -32 32 | shake_256().digest(10).hex() -33 33 | -34 |-hashlib.sha256().digest().hex() - 34 |+hashlib.sha256().hexdigest() -35 35 | -36 36 | sha256(b"text").digest().hex() -37 37 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB181.py:36:1: FURB181 [*] Use of hashlib's `.digest().hex()` | @@ -318,16 +188,6 @@ FURB181.py:36:1: FURB181 [*] Use of hashlib's `.digest().hex()` | = help: Replace with `.hexdigest()` -33 33 | -34 34 | hashlib.sha256().digest().hex() -35 35 | -36 |-sha256(b"text").digest().hex() - 36 |+sha256(b"text").hexdigest() -37 37 | -38 38 | hash_algo().digest().hex() -39 39 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB181.py:38:1: FURB181 [*] Use of hashlib's `.digest().hex()` | @@ -339,14 +199,3 @@ FURB181.py:38:1: FURB181 [*] Use of hashlib's `.digest().hex()` 40 | # not yet supported | = help: Replace with `.hexdigest()` - -35 35 | -36 36 | sha256(b"text").digest().hex() -37 37 | -38 |-hash_algo().digest().hex() - 38 |+hash_algo().hexdigest() -39 39 | -40 40 | # not yet supported -41 41 | h = sha256() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB187_FURB187.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB187_FURB187.py.snap index bd77a995c625a..42ae0f3b79c5d 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB187_FURB187.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB187_FURB187.py.snap @@ -10,16 +10,6 @@ FURB187.py:6:5: FURB187 [*] Use of assignment of `reversed` on list `l` | = help: Replace with `l.reverse()` -3 3 | -4 4 | def a(): -5 5 | l = [] -6 |- l = reversed(l) - 6 |+ l.reverse() -7 7 | -8 8 | -9 9 | def b(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB187.py:11:5: FURB187 [*] Use of assignment of `reversed` on list `l` | @@ -30,16 +20,6 @@ FURB187.py:11:5: FURB187 [*] Use of assignment of `reversed` on list `l` | = help: Replace with `l.reverse()` -8 8 | -9 9 | def b(): -10 10 | l = [] -11 |- l = list(reversed(l)) - 11 |+ l.reverse() -12 12 | -13 13 | -14 14 | def c(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB187.py:16:5: FURB187 [*] Use of assignment of `reversed` on list `l` | @@ -49,14 +29,3 @@ FURB187.py:16:5: FURB187 [*] Use of assignment of `reversed` on list `l` | ^^^^^^^^^^^ FURB187 | = help: Replace with `l.reverse()` - -13 13 | -14 14 | def c(): -15 15 | l = [] -16 |- l = l[::-1] - 16 |+ l.reverse() -17 17 | -18 18 | -19 19 | # False negative - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap index 0f0b28d2be446..9bdaa26b4527e 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap @@ -143,16 +143,6 @@ FURB192.py:17:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum | = help: Replace with `min` -14 14 | -15 15 | # Unsafe -16 16 | -17 |-sorted(l, key=key_fn, reverse=True)[-1] - 17 |+min(l, key=key_fn) -18 18 | -19 19 | sorted(l, reverse=True)[0] -20 20 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB192.py:19:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum value in a sequence | @@ -165,16 +155,6 @@ FURB192.py:19:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum | = help: Replace with `max` -16 16 | -17 17 | sorted(l, key=key_fn, reverse=True)[-1] -18 18 | -19 |-sorted(l, reverse=True)[0] - 19 |+max(l) -20 20 | -21 21 | sorted(l, reverse=True)[-1] -22 22 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. FURB192.py:21:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence | @@ -186,14 +166,3 @@ FURB192.py:21:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum 23 | # Non-errors | = help: Replace with `min` - -18 18 | -19 19 | sorted(l, reverse=True)[0] -20 20 | -21 |-sorted(l, reverse=True)[-1] - 21 |+min(l) -22 22 | -23 23 | # Non-errors -24 24 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap index 787b5560851d1..c70c99d43794b 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap @@ -9,16 +9,6 @@ RUF013_0.py:20:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -17 17 | pass -18 18 | -19 19 | -20 |-def f(arg: int = None): # RUF013 - 20 |+def f(arg: Optional[int] = None): # RUF013 -21 21 | pass -22 22 | -23 23 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:24:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -28,16 +18,6 @@ RUF013_0.py:24:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -21 21 | pass -22 22 | -23 23 | -24 |-def f(arg: str = None): # RUF013 - 24 |+def f(arg: Optional[str] = None): # RUF013 -25 25 | pass -26 26 | -27 27 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:28:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -47,16 +27,6 @@ RUF013_0.py:28:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -25 25 | pass -26 26 | -27 27 | -28 |-def f(arg: Tuple[str] = None): # RUF013 - 28 |+def f(arg: Optional[Tuple[str]] = None): # RUF013 -29 29 | pass -30 30 | -31 31 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:58:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -66,16 +36,6 @@ RUF013_0.py:58:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -55 55 | pass -56 56 | -57 57 | -58 |-def f(arg: Union = None): # RUF013 - 58 |+def f(arg: Optional[Union] = None): # RUF013 -59 59 | pass -60 60 | -61 61 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:62:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -85,16 +45,6 @@ RUF013_0.py:62:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -59 59 | pass -60 60 | -61 61 | -62 |-def f(arg: Union[int] = None): # RUF013 - 62 |+def f(arg: Optional[Union[int]] = None): # RUF013 -63 63 | pass -64 64 | -65 65 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:66:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -104,16 +54,6 @@ RUF013_0.py:66:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -63 63 | pass -64 64 | -65 65 | -66 |-def f(arg: Union[int, str] = None): # RUF013 - 66 |+def f(arg: Optional[Union[int, str]] = None): # RUF013 -67 67 | pass -68 68 | -69 69 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:85:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -123,16 +63,6 @@ RUF013_0.py:85:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -82 82 | pass -83 83 | -84 84 | -85 |-def f(arg: int | float = None): # RUF013 - 85 |+def f(arg: Optional[int | float] = None): # RUF013 -86 86 | pass -87 87 | -88 88 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:89:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -142,16 +72,6 @@ RUF013_0.py:89:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -86 86 | pass -87 87 | -88 88 | -89 |-def f(arg: int | float | str | bytes = None): # RUF013 - 89 |+def f(arg: Optional[int | float | str | bytes] = None): # RUF013 -90 90 | pass -91 91 | -92 92 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:108:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -161,16 +81,6 @@ RUF013_0.py:108:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -105 105 | pass -106 106 | -107 107 | -108 |-def f(arg: Literal[1] = None): # RUF013 - 108 |+def f(arg: Optional[Literal[1]] = None): # RUF013 -109 109 | pass -110 110 | -111 111 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:112:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -180,16 +90,6 @@ RUF013_0.py:112:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -109 109 | pass -110 110 | -111 111 | -112 |-def f(arg: Literal[1, "foo"] = None): # RUF013 - 112 |+def f(arg: Optional[Literal[1, "foo"]] = None): # RUF013 -113 113 | pass -114 114 | -115 115 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:131:22: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -199,16 +99,6 @@ RUF013_0.py:131:22: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -128 128 | pass -129 129 | -130 130 | -131 |-def f(arg: Annotated[int, ...] = None): # RUF013 - 131 |+def f(arg: Annotated[Optional[int], ...] = None): # RUF013 -132 132 | pass -133 133 | -134 134 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:135:32: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -218,16 +108,6 @@ RUF013_0.py:135:32: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -132 132 | pass -133 133 | -134 134 | -135 |-def f(arg: Annotated[Annotated[int | str, ...], ...] = None): # RUF013 - 135 |+def f(arg: Annotated[Annotated[Optional[int | str], ...], ...] = None): # RUF013 -136 136 | pass -137 137 | -138 138 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:151:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -239,16 +119,6 @@ RUF013_0.py:151:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -148 148 | -149 149 | -150 150 | def f( -151 |- arg1: int = None, # RUF013 - 151 |+ arg1: Optional[int] = None, # RUF013 -152 152 | arg2: Union[int, float] = None, # RUF013 -153 153 | arg3: Literal[1, 2, 3] = None, # RUF013 -154 154 | ): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:152:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -261,16 +131,6 @@ RUF013_0.py:152:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -149 149 | -150 150 | def f( -151 151 | arg1: int = None, # RUF013 -152 |- arg2: Union[int, float] = None, # RUF013 - 152 |+ arg2: Optional[Union[int, float]] = None, # RUF013 -153 153 | arg3: Literal[1, 2, 3] = None, # RUF013 -154 154 | ): -155 155 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:153:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -283,16 +143,6 @@ RUF013_0.py:153:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -150 150 | def f( -151 151 | arg1: int = None, # RUF013 -152 152 | arg2: Union[int, float] = None, # RUF013 -153 |- arg3: Literal[1, 2, 3] = None, # RUF013 - 153 |+ arg3: Optional[Literal[1, 2, 3]] = None, # RUF013 -154 154 | ): -155 155 | pass -156 156 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:181:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -302,16 +152,6 @@ RUF013_0.py:181:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -178 178 | pass -179 179 | -180 180 | -181 |-def f(arg: Union[Annotated[int, ...], Union[str, bytes]] = None): # RUF013 - 181 |+def f(arg: Optional[Union[Annotated[int, ...], Union[str, bytes]]] = None): # RUF013 -182 182 | pass -183 183 | -184 184 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:188:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -321,16 +161,6 @@ RUF013_0.py:188:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -185 185 | # Quoted -186 186 | -187 187 | -188 |-def f(arg: "int" = None): # RUF013 - 188 |+def f(arg: "Optional[int]" = None): # RUF013 -189 189 | pass -190 190 | -191 191 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:192:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -340,16 +170,6 @@ RUF013_0.py:192:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -189 189 | pass -190 190 | -191 191 | -192 |-def f(arg: "str" = None): # RUF013 - 192 |+def f(arg: "Optional[str]" = None): # RUF013 -193 193 | pass -194 194 | -195 195 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:196:12: RUF013 PEP 484 prohibits implicit `Optional` | @@ -366,14 +186,3 @@ RUF013_0.py:204:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 205 | pass | = help: Convert to `Optional[T]` - -201 201 | pass -202 202 | -203 203 | -204 |-def f(arg: Union["int", "str"] = None): # RUF013 - 204 |+def f(arg: Optional[Union["int", "str"]] = None): # RUF013 -205 205 | pass -206 206 | -207 207 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap index ab7219393bbad..af26e32988c22 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap @@ -8,13 +8,3 @@ RUF013_1.py:4:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 5 | pass | = help: Convert to `Optional[T]` - -1 1 | # No `typing.Optional` import - 2 |+from typing import Optional -2 3 | -3 4 | -4 |-def f(arg: int = None): # RUF013 - 5 |+def f(arg: Optional[int] = None): # RUF013 -5 6 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap index ddc6446b72580..fadc9c4ffec1a 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap @@ -52,16 +52,6 @@ RUF005.py:39:7: RUF005 [*] Consider `[1, 2, 3, *foo]` instead of concatenation | = help: Replace with `[1, 2, 3, *foo]` -36 36 | yay = Fun().yay -37 37 | -38 38 | foo = [4, 5, 6] -39 |-bar = [1, 2, 3] + foo - 39 |+bar = [1, 2, 3, *foo] -40 40 | zoob = tuple(bar) -41 41 | quux = (7, 8, 9) + zoob -42 42 | spam = quux + (10, 11, 12) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF005.py:41:8: RUF005 [*] Consider `(7, 8, 9, *zoob)` instead of concatenation | @@ -74,16 +64,6 @@ RUF005.py:41:8: RUF005 [*] Consider `(7, 8, 9, *zoob)` instead of concatenation | = help: Replace with `(7, 8, 9, *zoob)` -38 38 | foo = [4, 5, 6] -39 39 | bar = [1, 2, 3] + foo -40 40 | zoob = tuple(bar) -41 |-quux = (7, 8, 9) + zoob - 41 |+quux = (7, 8, 9, *zoob) -42 42 | spam = quux + (10, 11, 12) -43 43 | spom = list(spam) -44 44 | eggs = spom + [13, 14, 15] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF005.py:42:8: RUF005 [*] Consider `(*quux, 10, 11, 12)` instead of concatenation | @@ -96,16 +76,6 @@ RUF005.py:42:8: RUF005 [*] Consider `(*quux, 10, 11, 12)` instead of concatenati | = help: Replace with `(*quux, 10, 11, 12)` -39 39 | bar = [1, 2, 3] + foo -40 40 | zoob = tuple(bar) -41 41 | quux = (7, 8, 9) + zoob -42 |-spam = quux + (10, 11, 12) - 42 |+spam = (*quux, 10, 11, 12) -43 43 | spom = list(spam) -44 44 | eggs = spom + [13, 14, 15] -45 45 | elatement = ("we all say",) + yay() - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF005.py:44:8: RUF005 [*] Consider `[*spom, 13, 14, 15]` instead of concatenation | @@ -118,16 +88,6 @@ RUF005.py:44:8: RUF005 [*] Consider `[*spom, 13, 14, 15]` instead of concatenati | = help: Replace with `[*spom, 13, 14, 15]` -41 41 | quux = (7, 8, 9) + zoob -42 42 | spam = quux + (10, 11, 12) -43 43 | spom = list(spam) -44 |-eggs = spom + [13, 14, 15] - 44 |+eggs = [*spom, 13, 14, 15] -45 45 | elatement = ("we all say",) + yay() -46 46 | excitement = ("we all think",) + Fun().yay() -47 47 | astonishment = ("we all feel",) + Fun.words - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF005.py:45:13: RUF005 [*] Consider `("we all say", *yay())` instead of concatenation | @@ -140,16 +100,6 @@ RUF005.py:45:13: RUF005 [*] Consider `("we all say", *yay())` instead of concate | = help: Replace with `("we all say", *yay())` -42 42 | spam = quux + (10, 11, 12) -43 43 | spom = list(spam) -44 44 | eggs = spom + [13, 14, 15] -45 |-elatement = ("we all say",) + yay() - 45 |+elatement = ("we all say", *yay()) -46 46 | excitement = ("we all think",) + Fun().yay() -47 47 | astonishment = ("we all feel",) + Fun.words -48 48 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF005.py:46:14: RUF005 [*] Consider `("we all think", *Fun().yay())` instead of concatenation | @@ -161,16 +111,6 @@ RUF005.py:46:14: RUF005 [*] Consider `("we all think", *Fun().yay())` instead of | = help: Replace with `("we all think", *Fun().yay())` -43 43 | spom = list(spam) -44 44 | eggs = spom + [13, 14, 15] -45 45 | elatement = ("we all say",) + yay() -46 |-excitement = ("we all think",) + Fun().yay() - 46 |+excitement = ("we all think", *Fun().yay()) -47 47 | astonishment = ("we all feel",) + Fun.words -48 48 | -49 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF005.py:47:16: RUF005 [*] Consider `("we all feel", *Fun.words)` instead of concatenation | @@ -183,16 +123,6 @@ RUF005.py:47:16: RUF005 [*] Consider `("we all feel", *Fun.words)` instead of co | = help: Replace with `("we all feel", *Fun.words)` -44 44 | eggs = spom + [13, 14, 15] -45 45 | elatement = ("we all say",) + yay() -46 46 | excitement = ("we all think",) + Fun().yay() -47 |-astonishment = ("we all feel",) + Fun.words - 47 |+astonishment = ("we all feel", *Fun.words) -48 48 | -49 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) -50 50 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF005.py:49:9: RUF005 [*] Consider iterable unpacking instead of concatenation | @@ -205,16 +135,6 @@ RUF005.py:49:9: RUF005 [*] Consider iterable unpacking instead of concatenation | = help: Replace with iterable unpacking -46 46 | excitement = ("we all think",) + Fun().yay() -47 47 | astonishment = ("we all feel",) + Fun.words -48 48 | -49 |-chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) - 49 |+chain = ["a", "b", "c", *eggs, *list(("yes", "no", "pants") + zoob)] -50 50 | -51 51 | baz = () + zoob -52 52 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF005.py:49:39: RUF005 [*] Consider `("yes", "no", "pants", *zoob)` instead of concatenation | @@ -227,16 +147,6 @@ RUF005.py:49:39: RUF005 [*] Consider `("yes", "no", "pants", *zoob)` instead of | = help: Replace with `("yes", "no", "pants", *zoob)` -46 46 | excitement = ("we all think",) + Fun().yay() -47 47 | astonishment = ("we all feel",) + Fun.words -48 48 | -49 |-chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) - 49 |+chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants", *zoob)) -50 50 | -51 51 | baz = () + zoob -52 52 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF005.py:51:7: RUF005 [*] Consider `(*zoob,)` instead of concatenation | @@ -249,16 +159,6 @@ RUF005.py:51:7: RUF005 [*] Consider `(*zoob,)` instead of concatenation | = help: Replace with `(*zoob,)` -48 48 | -49 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) -50 50 | -51 |-baz = () + zoob - 51 |+baz = (*zoob,) -52 52 | -53 53 | [] + foo + [ -54 54 | ] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF005.py:53:1: RUF005 [*] Consider `[*foo]` instead of concatenation | @@ -272,17 +172,6 @@ RUF005.py:53:1: RUF005 [*] Consider `[*foo]` instead of concatenation | = help: Replace with `[*foo]` -50 50 | -51 51 | baz = () + zoob -52 52 | -53 |-[] + foo + [ -54 |-] - 53 |+[*foo] -55 54 | -56 55 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] -57 56 | pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF005.py:56:15: RUF005 [*] Consider `[sys.executable, "-m", "pylint", *args, path]` instead of concatenation | @@ -295,16 +184,6 @@ RUF005.py:56:15: RUF005 [*] Consider `[sys.executable, "-m", "pylint", *args, pa | = help: Replace with `[sys.executable, "-m", "pylint", *args, path]` -53 53 | [] + foo + [ -54 54 | ] -55 55 | -56 |-pylint_call = [sys.executable, "-m", "pylint"] + args + [path] - 56 |+pylint_call = [sys.executable, "-m", "pylint", *args, path] -57 57 | pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) -58 58 | b = a + [2, 3] + [4] -59 59 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF005.py:57:21: RUF005 [*] Consider iterable unpacking instead of concatenation | @@ -315,16 +194,6 @@ RUF005.py:57:21: RUF005 [*] Consider iterable unpacking instead of concatenation | = help: Replace with iterable unpacking -54 54 | ] -55 55 | -56 56 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] -57 |-pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) - 57 |+pylint_call_tuple = (sys.executable, "-m", "pylint", *args, path, path2) -58 58 | b = a + [2, 3] + [4] -59 59 | -60 60 | # Uses the non-preferred quote style, which should be retained. - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF005.py:58:5: RUF005 [*] Consider `[*a, 2, 3, 4]` instead of concatenation | @@ -337,16 +206,6 @@ RUF005.py:58:5: RUF005 [*] Consider `[*a, 2, 3, 4]` instead of concatenation | = help: Replace with `[*a, 2, 3, 4]` -55 55 | -56 56 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] -57 57 | pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) -58 |-b = a + [2, 3] + [4] - 58 |+b = [*a, 2, 3, 4] -59 59 | -60 60 | # Uses the non-preferred quote style, which should be retained. -61 61 | f"{a() + ['b']}" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF005.py:61:4: RUF005 [*] Consider `[*a(), 'b']` instead of concatenation | @@ -357,14 +216,3 @@ RUF005.py:61:4: RUF005 [*] Consider `[*a(), 'b']` instead of concatenation 63 | ### | = help: Replace with `[*a(), 'b']` - -58 58 | b = a + [2, 3] + [4] -59 59 | -60 60 | # Uses the non-preferred quote style, which should be retained. -61 |-f"{a() + ['b']}" - 61 |+f"{[*a(), 'b']}" -62 62 | -63 63 | ### -64 64 | # Non-errors. - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap index 23eb7efc12dce..823f372ef4d53 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap @@ -9,16 +9,6 @@ RUF013_0.py:20:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -17 17 | pass -18 18 | -19 19 | -20 |-def f(arg: int = None): # RUF013 - 20 |+def f(arg: int | None = None): # RUF013 -21 21 | pass -22 22 | -23 23 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:24:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -28,16 +18,6 @@ RUF013_0.py:24:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -21 21 | pass -22 22 | -23 23 | -24 |-def f(arg: str = None): # RUF013 - 24 |+def f(arg: str | None = None): # RUF013 -25 25 | pass -26 26 | -27 27 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:28:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -47,16 +27,6 @@ RUF013_0.py:28:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -25 25 | pass -26 26 | -27 27 | -28 |-def f(arg: Tuple[str] = None): # RUF013 - 28 |+def f(arg: Tuple[str] | None = None): # RUF013 -29 29 | pass -30 30 | -31 31 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:58:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -66,16 +36,6 @@ RUF013_0.py:58:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -55 55 | pass -56 56 | -57 57 | -58 |-def f(arg: Union = None): # RUF013 - 58 |+def f(arg: Union | None = None): # RUF013 -59 59 | pass -60 60 | -61 61 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:62:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -85,16 +45,6 @@ RUF013_0.py:62:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -59 59 | pass -60 60 | -61 61 | -62 |-def f(arg: Union[int] = None): # RUF013 - 62 |+def f(arg: Union[int] | None = None): # RUF013 -63 63 | pass -64 64 | -65 65 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:66:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -104,16 +54,6 @@ RUF013_0.py:66:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -63 63 | pass -64 64 | -65 65 | -66 |-def f(arg: Union[int, str] = None): # RUF013 - 66 |+def f(arg: Union[int, str] | None = None): # RUF013 -67 67 | pass -68 68 | -69 69 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:85:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -123,16 +63,6 @@ RUF013_0.py:85:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -82 82 | pass -83 83 | -84 84 | -85 |-def f(arg: int | float = None): # RUF013 - 85 |+def f(arg: int | float | None = None): # RUF013 -86 86 | pass -87 87 | -88 88 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:89:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -142,16 +72,6 @@ RUF013_0.py:89:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -86 86 | pass -87 87 | -88 88 | -89 |-def f(arg: int | float | str | bytes = None): # RUF013 - 89 |+def f(arg: int | float | str | bytes | None = None): # RUF013 -90 90 | pass -91 91 | -92 92 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:108:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -161,16 +81,6 @@ RUF013_0.py:108:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -105 105 | pass -106 106 | -107 107 | -108 |-def f(arg: Literal[1] = None): # RUF013 - 108 |+def f(arg: Literal[1] | None = None): # RUF013 -109 109 | pass -110 110 | -111 111 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:112:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -180,16 +90,6 @@ RUF013_0.py:112:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -109 109 | pass -110 110 | -111 111 | -112 |-def f(arg: Literal[1, "foo"] = None): # RUF013 - 112 |+def f(arg: Literal[1, "foo"] | None = None): # RUF013 -113 113 | pass -114 114 | -115 115 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:131:22: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -199,16 +99,6 @@ RUF013_0.py:131:22: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -128 128 | pass -129 129 | -130 130 | -131 |-def f(arg: Annotated[int, ...] = None): # RUF013 - 131 |+def f(arg: Annotated[int | None, ...] = None): # RUF013 -132 132 | pass -133 133 | -134 134 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:135:32: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -218,16 +108,6 @@ RUF013_0.py:135:32: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -132 132 | pass -133 133 | -134 134 | -135 |-def f(arg: Annotated[Annotated[int | str, ...], ...] = None): # RUF013 - 135 |+def f(arg: Annotated[Annotated[int | str | None, ...], ...] = None): # RUF013 -136 136 | pass -137 137 | -138 138 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:151:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -239,16 +119,6 @@ RUF013_0.py:151:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -148 148 | -149 149 | -150 150 | def f( -151 |- arg1: int = None, # RUF013 - 151 |+ arg1: int | None = None, # RUF013 -152 152 | arg2: Union[int, float] = None, # RUF013 -153 153 | arg3: Literal[1, 2, 3] = None, # RUF013 -154 154 | ): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:152:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -261,16 +131,6 @@ RUF013_0.py:152:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -149 149 | -150 150 | def f( -151 151 | arg1: int = None, # RUF013 -152 |- arg2: Union[int, float] = None, # RUF013 - 152 |+ arg2: Union[int, float] | None = None, # RUF013 -153 153 | arg3: Literal[1, 2, 3] = None, # RUF013 -154 154 | ): -155 155 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:153:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -283,16 +143,6 @@ RUF013_0.py:153:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -150 150 | def f( -151 151 | arg1: int = None, # RUF013 -152 152 | arg2: Union[int, float] = None, # RUF013 -153 |- arg3: Literal[1, 2, 3] = None, # RUF013 - 153 |+ arg3: Literal[1, 2, 3] | None = None, # RUF013 -154 154 | ): -155 155 | pass -156 156 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:181:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -302,16 +152,6 @@ RUF013_0.py:181:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -178 178 | pass -179 179 | -180 180 | -181 |-def f(arg: Union[Annotated[int, ...], Union[str, bytes]] = None): # RUF013 - 181 |+def f(arg: Union[Annotated[int, ...], Union[str, bytes]] | None = None): # RUF013 -182 182 | pass -183 183 | -184 184 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:188:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -321,16 +161,6 @@ RUF013_0.py:188:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -185 185 | # Quoted -186 186 | -187 187 | -188 |-def f(arg: "int" = None): # RUF013 - 188 |+def f(arg: "int | None" = None): # RUF013 -189 189 | pass -190 190 | -191 191 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:192:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -340,16 +170,6 @@ RUF013_0.py:192:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -189 189 | pass -190 190 | -191 191 | -192 |-def f(arg: "str" = None): # RUF013 - 192 |+def f(arg: "str | None" = None): # RUF013 -193 193 | pass -194 194 | -195 195 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_0.py:196:12: RUF013 PEP 484 prohibits implicit `Optional` | @@ -366,14 +186,3 @@ RUF013_0.py:204:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 205 | pass | = help: Convert to `T | None` - -201 201 | pass -202 202 | -203 203 | -204 |-def f(arg: Union["int", "str"] = None): # RUF013 - 204 |+def f(arg: Union["int", "str"] | None = None): # RUF013 -205 205 | pass -206 206 | -207 207 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap index ed8dcd75dcba0..bd0fbd7a8f7d5 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap @@ -8,12 +8,3 @@ RUF013_1.py:4:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 5 | pass | = help: Convert to `T | None` - -1 1 | # No `typing.Optional` import -2 2 | -3 3 | -4 |-def f(arg: int = None): # RUF013 - 4 |+def f(arg: int | None = None): # RUF013 -5 5 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_3.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_3.py.snap index 2b332914a836f..84152b634c8d0 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_3.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_3.py.snap @@ -9,16 +9,6 @@ RUF013_3.py:4:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -1 1 | import typing -2 2 | -3 3 | -4 |-def f(arg: typing.List[str] = None): # RUF013 - 4 |+def f(arg: typing.List[str] | None = None): # RUF013 -5 5 | pass -6 6 | -7 7 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_3.py:22:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -28,16 +18,6 @@ RUF013_3.py:22:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -19 19 | pass -20 20 | -21 21 | -22 |-def f(arg: typing.Union[int, str] = None): # RUF013 - 22 |+def f(arg: typing.Union[int, str] | None = None): # RUF013 -23 23 | pass -24 24 | -25 25 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF013_3.py:29:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | @@ -46,12 +26,3 @@ RUF013_3.py:29:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 30 | pass | = help: Convert to `T | None` - -26 26 | # Literal -27 27 | -28 28 | -29 |-def f(arg: typing.Literal[1, "foo", True] = None): # RUF013 - 29 |+def f(arg: typing.Literal[1, "foo", True] | None = None): # RUF013 -30 30 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap index fd07f0c1c7d27..4626847725db7 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap @@ -11,16 +11,6 @@ RUF015.py:4:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -1 1 | x = range(10) -2 2 | -3 3 | # RUF015 -4 |-list(x)[0] - 4 |+next(iter(x)) -5 5 | tuple(x)[0] -6 6 | list(i for i in x)[0] -7 7 | [i for i in x][0] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:5:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | @@ -33,16 +23,6 @@ RUF015.py:5:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -2 2 | -3 3 | # RUF015 -4 4 | list(x)[0] -5 |-tuple(x)[0] - 5 |+next(iter(x)) -6 6 | list(i for i in x)[0] -7 7 | [i for i in x][0] -8 8 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:6:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | @@ -54,16 +34,6 @@ RUF015.py:6:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -3 3 | # RUF015 -4 4 | list(x)[0] -5 5 | tuple(x)[0] -6 |-list(i for i in x)[0] - 6 |+next(iter(x)) -7 7 | [i for i in x][0] -8 8 | -9 9 | # OK (not indexing (solely) the first element) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:7:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | @@ -76,16 +46,6 @@ RUF015.py:7:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -4 4 | list(x)[0] -5 5 | tuple(x)[0] -6 6 | list(i for i in x)[0] -7 |-[i for i in x][0] - 7 |+next(iter(x)) -8 8 | -9 9 | # OK (not indexing (solely) the first element) -10 10 | list(x) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:29:1: RUF015 [*] Prefer `next(i + 1 for i in x)` over single element slice | @@ -97,16 +57,6 @@ RUF015.py:29:1: RUF015 [*] Prefer `next(i + 1 for i in x)` over single element s | = help: Replace with `next(i + 1 for i in x)` -26 26 | [i for i in x][::] -27 27 | -28 28 | # RUF015 (doesn't mirror the underlying list) -29 |-[i + 1 for i in x][0] - 29 |+next(i + 1 for i in x) -30 30 | [i for i in x if i > 5][0] -31 31 | [(i, i + 1) for i in x][0] -32 32 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:30:1: RUF015 [*] Prefer `next(i for i in x if i > 5)` over single element slice | @@ -118,16 +68,6 @@ RUF015.py:30:1: RUF015 [*] Prefer `next(i for i in x if i > 5)` over single elem | = help: Replace with `next(i for i in x if i > 5)` -27 27 | -28 28 | # RUF015 (doesn't mirror the underlying list) -29 29 | [i + 1 for i in x][0] -30 |-[i for i in x if i > 5][0] - 30 |+next(i for i in x if i > 5) -31 31 | [(i, i + 1) for i in x][0] -32 32 | -33 33 | # RUF015 (multiple generators) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:31:1: RUF015 [*] Prefer `next((i, i + 1) for i in x)` over single element slice | @@ -140,16 +80,6 @@ RUF015.py:31:1: RUF015 [*] Prefer `next((i, i + 1) for i in x)` over single elem | = help: Replace with `next((i, i + 1) for i in x)` -28 28 | # RUF015 (doesn't mirror the underlying list) -29 29 | [i + 1 for i in x][0] -30 30 | [i for i in x if i > 5][0] -31 |-[(i, i + 1) for i in x][0] - 31 |+next((i, i + 1) for i in x) -32 32 | -33 33 | # RUF015 (multiple generators) -34 34 | y = range(10) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:35:1: RUF015 [*] Prefer `next(i + j for i in x for j in y)` over single element slice | @@ -162,16 +92,6 @@ RUF015.py:35:1: RUF015 [*] Prefer `next(i + j for i in x for j in y)` over singl | = help: Replace with `next(i + j for i in x for j in y)` -32 32 | -33 33 | # RUF015 (multiple generators) -34 34 | y = range(10) -35 |-[i + j for i in x for j in y][0] - 35 |+next(i + j for i in x for j in y) -36 36 | -37 37 | # RUF015 -38 38 | list(range(10))[0] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:38:1: RUF015 [*] Prefer `next(iter(range(10)))` over single element slice | @@ -183,16 +103,6 @@ RUF015.py:38:1: RUF015 [*] Prefer `next(iter(range(10)))` over single element sl | = help: Replace with `next(iter(range(10)))` -35 35 | [i + j for i in x for j in y][0] -36 36 | -37 37 | # RUF015 -38 |-list(range(10))[0] - 38 |+next(iter(range(10))) -39 39 | list(x.y)[0] -40 40 | list(x["y"])[0] -41 41 | [*range(10)][0] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:39:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | @@ -205,16 +115,6 @@ RUF015.py:39:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | = help: Replace with `next(iter(x.y))` -36 36 | -37 37 | # RUF015 -38 38 | list(range(10))[0] -39 |-list(x.y)[0] - 39 |+next(iter(x.y)) -40 40 | list(x["y"])[0] -41 41 | [*range(10)][0] -42 42 | [*x["y"]][0] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:40:1: RUF015 [*] Prefer `next(iter(x["y"]))` over single element slice | @@ -227,16 +127,6 @@ RUF015.py:40:1: RUF015 [*] Prefer `next(iter(x["y"]))` over single element slice | = help: Replace with `next(iter(x["y"]))` -37 37 | # RUF015 -38 38 | list(range(10))[0] -39 39 | list(x.y)[0] -40 |-list(x["y"])[0] - 40 |+next(iter(x["y"])) -41 41 | [*range(10)][0] -42 42 | [*x["y"]][0] -43 43 | [*x.y][0] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:41:1: RUF015 [*] Prefer `next(iter(range(10)))` over single element slice | @@ -249,16 +139,6 @@ RUF015.py:41:1: RUF015 [*] Prefer `next(iter(range(10)))` over single element sl | = help: Replace with `next(iter(range(10)))` -38 38 | list(range(10))[0] -39 39 | list(x.y)[0] -40 40 | list(x["y"])[0] -41 |-[*range(10)][0] - 41 |+next(iter(range(10))) -42 42 | [*x["y"]][0] -43 43 | [*x.y][0] -44 44 | [* x.y][0] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:42:1: RUF015 [*] Prefer `next(iter(x["y"]))` over single element slice | @@ -271,16 +151,6 @@ RUF015.py:42:1: RUF015 [*] Prefer `next(iter(x["y"]))` over single element slice | = help: Replace with `next(iter(x["y"]))` -39 39 | list(x.y)[0] -40 40 | list(x["y"])[0] -41 41 | [*range(10)][0] -42 |-[*x["y"]][0] - 42 |+next(iter(x["y"])) -43 43 | [*x.y][0] -44 44 | [* x.y][0] -45 45 | [ - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:43:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | @@ -293,16 +163,6 @@ RUF015.py:43:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | = help: Replace with `next(iter(x.y))` -40 40 | list(x["y"])[0] -41 41 | [*range(10)][0] -42 42 | [*x["y"]][0] -43 |-[*x.y][0] - 43 |+next(iter(x.y)) -44 44 | [* x.y][0] -45 45 | [ -46 46 | *x.y - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:44:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | @@ -315,16 +175,6 @@ RUF015.py:44:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | = help: Replace with `next(iter(x.y))` -41 41 | [*range(10)][0] -42 42 | [*x["y"]][0] -43 43 | [*x.y][0] -44 |-[* x.y][0] - 44 |+next(iter(x.y)) -45 45 | [ -46 46 | *x.y -47 47 | ][0] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:45:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | @@ -339,18 +189,6 @@ RUF015.py:45:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | = help: Replace with `next(iter(x.y))` -42 42 | [*x["y"]][0] -43 43 | [*x.y][0] -44 44 | [* x.y][0] -45 |-[ -46 |- *x.y -47 |-][0] - 45 |+next(iter(x.y)) -48 46 | -49 47 | # RUF015 (multi-line) -50 48 | revision_heads_map_ast = [ - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:50:26: RUF015 [*] Prefer `next(...)` over single element slice | @@ -367,21 +205,6 @@ RUF015.py:50:26: RUF015 [*] Prefer `next(...)` over single element slice | = help: Replace with `next(...)` -47 47 | ][0] -48 48 | -49 49 | # RUF015 (multi-line) -50 |-revision_heads_map_ast = [ - 50 |+revision_heads_map_ast = next( -51 51 | a -52 52 | for a in revision_heads_map_ast_obj.body -53 53 | if isinstance(a, ast.Assign) and a.targets[0].id == "REVISION_HEADS_MAP" -54 |-][0] - 54 |+) -55 55 | -56 56 | # RUF015 (zip) -57 57 | list(zip(x, y))[0] - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:57:1: RUF015 [*] Prefer `next(zip(x, y))` over single element slice | @@ -392,16 +215,6 @@ RUF015.py:57:1: RUF015 [*] Prefer `next(zip(x, y))` over single element slice | = help: Replace with `next(zip(x, y))` -54 54 | ][0] -55 55 | -56 56 | # RUF015 (zip) -57 |-list(zip(x, y))[0] - 57 |+next(zip(x, y)) -58 58 | [*zip(x, y)][0] -59 59 | -60 60 | # RUF015 (pop) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:58:1: RUF015 [*] Prefer `next(zip(x, y))` over single element slice | @@ -414,16 +227,6 @@ RUF015.py:58:1: RUF015 [*] Prefer `next(zip(x, y))` over single element slice | = help: Replace with `next(zip(x, y))` -55 55 | -56 56 | # RUF015 (zip) -57 57 | list(zip(x, y))[0] -58 |-[*zip(x, y)][0] - 58 |+next(zip(x, y)) -59 59 | -60 60 | # RUF015 (pop) -61 61 | list(x).pop(0) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:61:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | @@ -435,16 +238,6 @@ RUF015.py:61:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -58 58 | [*zip(x, y)][0] -59 59 | -60 60 | # RUF015 (pop) -61 |-list(x).pop(0) - 61 |+next(iter(x)) -62 62 | [i for i in x].pop(0) -63 63 | list(i for i in x).pop(0) -64 64 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:62:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | @@ -456,16 +249,6 @@ RUF015.py:62:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -59 59 | -60 60 | # RUF015 (pop) -61 61 | list(x).pop(0) -62 |-[i for i in x].pop(0) - 62 |+next(iter(x)) -63 63 | list(i for i in x).pop(0) -64 64 | -65 65 | # OK - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:63:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | @@ -478,16 +261,6 @@ RUF015.py:63:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -60 60 | # RUF015 (pop) -61 61 | list(x).pop(0) -62 62 | [i for i in x].pop(0) -63 |-list(i for i in x).pop(0) - 63 |+next(iter(x)) -64 64 | -65 65 | # OK -66 66 | list(x).pop(1) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF015.py:73:5: RUF015 [*] Prefer `next(iter(zip(x, y)))` over single element slice | @@ -497,11 +270,3 @@ RUF015.py:73:5: RUF015 [*] Prefer `next(iter(zip(x, y)))` over single element sl | ^^^^^^^^^^^^^^^^^^ RUF015 | = help: Replace with `next(iter(zip(x, y)))` - -70 70 | -71 71 | def test(): -72 72 | zip = list # Overwrite the builtin zip -73 |- list(zip(x, y))[0] - 73 |+ next(iter(zip(x, y))) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap index 83ca0eef545b2..85233ec1b215b 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap @@ -11,19 +11,6 @@ RUF017_0.py:5:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` - 1 |+import functools - 2 |+import operator -1 3 | x = [1, 2, 3] -2 4 | y = [4, 5, 6] -3 5 | -4 6 | # RUF017 -5 |-sum([x, y], start=[]) - 7 |+functools.reduce(operator.iadd, [x, y], []) -6 8 | sum([x, y], []) -7 9 | sum([[1, 2, 3], [4, 5, 6]], start=[]) -8 10 | sum([[1, 2, 3], [4, 5, 6]], []) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF017_0.py:6:1: RUF017 [*] Avoid quadratic list summation | @@ -36,20 +23,6 @@ RUF017_0.py:6:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` - 1 |+import functools - 2 |+import operator -1 3 | x = [1, 2, 3] -2 4 | y = [4, 5, 6] -3 5 | -4 6 | # RUF017 -5 7 | sum([x, y], start=[]) -6 |-sum([x, y], []) - 8 |+functools.reduce(operator.iadd, [x, y], []) -7 9 | sum([[1, 2, 3], [4, 5, 6]], start=[]) -8 10 | sum([[1, 2, 3], [4, 5, 6]], []) -9 11 | sum([[1, 2, 3], [4, 5, 6]], - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF017_0.py:7:1: RUF017 [*] Avoid quadratic list summation | @@ -62,21 +35,6 @@ RUF017_0.py:7:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` - 1 |+import functools - 2 |+import operator -1 3 | x = [1, 2, 3] -2 4 | y = [4, 5, 6] -3 5 | -4 6 | # RUF017 -5 7 | sum([x, y], start=[]) -6 8 | sum([x, y], []) -7 |-sum([[1, 2, 3], [4, 5, 6]], start=[]) - 9 |+functools.reduce(operator.iadd, [[1, 2, 3], [4, 5, 6]], []) -8 10 | sum([[1, 2, 3], [4, 5, 6]], []) -9 11 | sum([[1, 2, 3], [4, 5, 6]], -10 12 | []) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF017_0.py:8:1: RUF017 [*] Avoid quadratic list summation | @@ -89,22 +47,6 @@ RUF017_0.py:8:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` - 1 |+import functools - 2 |+import operator -1 3 | x = [1, 2, 3] -2 4 | y = [4, 5, 6] -3 5 | --------------------------------------------------------------------------------- -5 7 | sum([x, y], start=[]) -6 8 | sum([x, y], []) -7 9 | sum([[1, 2, 3], [4, 5, 6]], start=[]) -8 |-sum([[1, 2, 3], [4, 5, 6]], []) - 10 |+functools.reduce(operator.iadd, [[1, 2, 3], [4, 5, 6]], []) -9 11 | sum([[1, 2, 3], [4, 5, 6]], -10 12 | []) -11 13 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF017_0.py:9:1: RUF017 [*] Avoid quadratic list summation | @@ -118,23 +60,6 @@ RUF017_0.py:9:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` - 1 |+import functools - 2 |+import operator -1 3 | x = [1, 2, 3] -2 4 | y = [4, 5, 6] -3 5 | --------------------------------------------------------------------------------- -6 8 | sum([x, y], []) -7 9 | sum([[1, 2, 3], [4, 5, 6]], start=[]) -8 10 | sum([[1, 2, 3], [4, 5, 6]], []) -9 |-sum([[1, 2, 3], [4, 5, 6]], -10 |- []) - 11 |+functools.reduce(operator.iadd, [[1, 2, 3], [4, 5, 6]], []) -11 12 | -12 13 | # OK -13 14 | sum([x, y]) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF017_0.py:21:5: RUF017 [*] Avoid quadratic list summation | @@ -145,16 +70,6 @@ RUF017_0.py:21:5: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -18 18 | def func(): -19 19 | import functools, operator -20 20 | -21 |- sum([x, y], []) - 21 |+ functools.reduce(operator.iadd, [x, y], []) -22 22 | -23 23 | -24 24 | # Regression test for: https://github.com/astral-sh/ruff/issues/7718 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF017_0.py:26:5: RUF017 [*] Avoid quadratic list summation | @@ -164,17 +79,3 @@ RUF017_0.py:26:5: RUF017 [*] Avoid quadratic list summation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF017 | = help: Replace with `functools.reduce` - - 1 |+import functools - 2 |+import operator -1 3 | x = [1, 2, 3] -2 4 | y = [4, 5, 6] -3 5 | --------------------------------------------------------------------------------- -23 25 | -24 26 | # Regression test for: https://github.com/astral-sh/ruff/issues/7718 -25 27 | def func(): -26 |- sum((factor.dims for factor in bases), []) - 28 |+ functools.reduce(operator.iadd, (factor.dims for factor in bases), []) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap index 351939a0618c2..7541973fda0e1 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap @@ -7,10 +7,3 @@ RUF017_1.py:1:1: RUF017 [*] Avoid quadratic list summation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF017 | = help: Replace with `functools.reduce` - -1 |-sum((factor.dims for factor in bases), []) - 1 |+import functools - 2 |+import operator - 3 |+functools.reduce(operator.iadd, (factor.dims for factor in bases), []) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap index d1b3fdd8410a5..50906996f45b6 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF024_RUF024.py.snap @@ -11,16 +11,6 @@ RUF024.py:9:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkey | = help: Replace with comprehension -6 6 | ] -7 7 | -8 8 | # Errors. -9 |-dict.fromkeys(pierogi_fillings, []) - 9 |+{key: [] for key in pierogi_fillings} -10 10 | dict.fromkeys(pierogi_fillings, list()) -11 11 | dict.fromkeys(pierogi_fillings, {}) -12 12 | dict.fromkeys(pierogi_fillings, set()) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF024.py:10:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys` | @@ -33,16 +23,6 @@ RUF024.py:10:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke | = help: Replace with comprehension -7 7 | -8 8 | # Errors. -9 9 | dict.fromkeys(pierogi_fillings, []) -10 |-dict.fromkeys(pierogi_fillings, list()) - 10 |+{key: list() for key in pierogi_fillings} -11 11 | dict.fromkeys(pierogi_fillings, {}) -12 12 | dict.fromkeys(pierogi_fillings, set()) -13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"}) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF024.py:11:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys` | @@ -55,16 +35,6 @@ RUF024.py:11:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke | = help: Replace with comprehension -8 8 | # Errors. -9 9 | dict.fromkeys(pierogi_fillings, []) -10 10 | dict.fromkeys(pierogi_fillings, list()) -11 |-dict.fromkeys(pierogi_fillings, {}) - 11 |+{key: {} for key in pierogi_fillings} -12 12 | dict.fromkeys(pierogi_fillings, set()) -13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"}) -14 14 | dict.fromkeys(pierogi_fillings, dict()) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF024.py:12:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys` | @@ -77,16 +47,6 @@ RUF024.py:12:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke | = help: Replace with comprehension -9 9 | dict.fromkeys(pierogi_fillings, []) -10 10 | dict.fromkeys(pierogi_fillings, list()) -11 11 | dict.fromkeys(pierogi_fillings, {}) -12 |-dict.fromkeys(pierogi_fillings, set()) - 12 |+{key: set() for key in pierogi_fillings} -13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"}) -14 14 | dict.fromkeys(pierogi_fillings, dict()) -15 15 | import builtins - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF024.py:13:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys` | @@ -99,16 +59,6 @@ RUF024.py:13:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke | = help: Replace with comprehension -10 10 | dict.fromkeys(pierogi_fillings, list()) -11 11 | dict.fromkeys(pierogi_fillings, {}) -12 12 | dict.fromkeys(pierogi_fillings, set()) -13 |-dict.fromkeys(pierogi_fillings, {"pre": "populated!"}) - 13 |+{key: {"pre": "populated!"} for key in pierogi_fillings} -14 14 | dict.fromkeys(pierogi_fillings, dict()) -15 15 | import builtins -16 16 | builtins.dict.fromkeys(pierogi_fillings, dict()) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF024.py:14:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys` | @@ -121,16 +71,6 @@ RUF024.py:14:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke | = help: Replace with comprehension -11 11 | dict.fromkeys(pierogi_fillings, {}) -12 12 | dict.fromkeys(pierogi_fillings, set()) -13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"}) -14 |-dict.fromkeys(pierogi_fillings, dict()) - 14 |+{key: dict() for key in pierogi_fillings} -15 15 | import builtins -16 16 | builtins.dict.fromkeys(pierogi_fillings, dict()) -17 17 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF024.py:16:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromkeys` | @@ -142,14 +82,3 @@ RUF024.py:16:1: RUF024 [*] Do not pass mutable objects as values to `dict.fromke 18 | # Okay. | = help: Replace with comprehension - -13 13 | dict.fromkeys(pierogi_fillings, {"pre": "populated!"}) -14 14 | dict.fromkeys(pierogi_fillings, dict()) -15 15 | import builtins -16 |-builtins.dict.fromkeys(pierogi_fillings, dict()) - 16 |+{key: dict() for key in pierogi_fillings} -17 17 | -18 18 | # Okay. -19 19 | dict.fromkeys(pierogi_fillings) - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF026_RUF026.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF026_RUF026.py.snap index 62ae0e1a34417..4fccb0fd63920 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF026_RUF026.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF026_RUF026.py.snap @@ -9,16 +9,6 @@ RUF026.py:11:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=int)` -8 8 | -9 9 | -10 10 | def func(): -11 |- defaultdict(default_factory=int) # RUF026 - 11 |+ defaultdict(int) # RUF026 -12 12 | -13 13 | -14 14 | def func(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF026.py:15:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | @@ -28,16 +18,6 @@ RUF026.py:15:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=float)` -12 12 | -13 13 | -14 14 | def func(): -15 |- defaultdict(default_factory=float) # RUF026 - 15 |+ defaultdict(float) # RUF026 -16 16 | -17 17 | -18 18 | def func(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF026.py:19:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | @@ -47,16 +27,6 @@ RUF026.py:19:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=dict)` -16 16 | -17 17 | -18 18 | def func(): -19 |- defaultdict(default_factory=dict) # RUF026 - 19 |+ defaultdict(dict) # RUF026 -20 20 | -21 21 | -22 22 | def func(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF026.py:23:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | @@ -66,16 +36,6 @@ RUF026.py:23:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=list)` -20 20 | -21 21 | -22 22 | def func(): -23 |- defaultdict(default_factory=list) # RUF026 - 23 |+ defaultdict(list) # RUF026 -24 24 | -25 25 | -26 26 | def func(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF026.py:27:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | @@ -85,16 +45,6 @@ RUF026.py:27:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=tuple)` -24 24 | -25 25 | -26 26 | def func(): -27 |- defaultdict(default_factory=tuple) # RUF026 - 27 |+ defaultdict(tuple) # RUF026 -28 28 | -29 29 | -30 30 | def func(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF026.py:34:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | @@ -105,16 +55,6 @@ RUF026.py:34:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=foo)` -31 31 | def foo(): -32 32 | pass -33 33 | -34 |- defaultdict(default_factory=foo) # RUF026 - 34 |+ defaultdict(foo) # RUF026 -35 35 | -36 36 | -37 37 | def func(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF026.py:38:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | @@ -124,16 +64,6 @@ RUF026.py:38:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=lambda: 1)` -35 35 | -36 36 | -37 37 | def func(): -38 |- defaultdict(default_factory=lambda: 1) # RUF026 - 38 |+ defaultdict(lambda: 1) # RUF026 -39 39 | -40 40 | -41 41 | def func(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF026.py:44:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | @@ -144,16 +74,6 @@ RUF026.py:44:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=deque)` -41 41 | def func(): -42 42 | from collections import deque -43 43 | -44 |- defaultdict(default_factory=deque) # RUF026 - 44 |+ defaultdict(deque) # RUF026 -45 45 | -46 46 | -47 47 | def func(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF026.py:52:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | @@ -164,16 +84,6 @@ RUF026.py:52:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=MyCallable())` -49 49 | def __call__(self): -50 50 | pass -51 51 | -52 |- defaultdict(default_factory=MyCallable()) # RUF026 - 52 |+ defaultdict(MyCallable()) # RUF026 -53 53 | -54 54 | -55 55 | def func(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF026.py:56:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | @@ -183,16 +93,6 @@ RUF026.py:56:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=tuple)` -53 53 | -54 54 | -55 55 | def func(): -56 |- defaultdict(default_factory=tuple, member=1) # RUF026 - 56 |+ defaultdict(tuple, member=1) # RUF026 -57 57 | -58 58 | -59 59 | def func(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF026.py:60:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | @@ -202,16 +102,6 @@ RUF026.py:60:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=tuple)` -57 57 | -58 58 | -59 59 | def func(): -60 |- defaultdict(member=1, default_factory=tuple) # RUF026 - 60 |+ defaultdict(tuple, member=1) # RUF026 -61 61 | -62 62 | -63 63 | def func(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF026.py:64:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | @@ -221,16 +111,6 @@ RUF026.py:64:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=tuple)` -61 61 | -62 62 | -63 63 | def func(): -64 |- defaultdict(member=1, default_factory=tuple,) # RUF026 - 64 |+ defaultdict(tuple, member=1,) # RUF026 -65 65 | -66 66 | -67 67 | def func(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF026.py:68:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | @@ -244,17 +124,6 @@ RUF026.py:68:5: RUF026 [*] `default_factory` is a positional-only argument to `d | = help: Replace with `defaultdict(default_factory=tuple)` -66 66 | -67 67 | def func(): -68 68 | defaultdict( -69 |- member=1, -70 |- default_factory=tuple, - 69 |+ tuple, member=1, -71 70 | ) # RUF026 -72 71 | -73 72 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF026.py:75:5: RUF026 [*] `default_factory` is a positional-only argument to `defaultdict` | @@ -267,15 +136,3 @@ RUF026.py:75:5: RUF026 [*] `default_factory` is a positional-only argument to `d | |_____^ RUF026 | = help: Replace with `defaultdict(default_factory=tuple)` - -73 73 | -74 74 | def func(): -75 75 | defaultdict( -76 |- default_factory=tuple, -77 |- member=1, - 76 |+ tuple, member=1, -78 77 | ) # RUF026 -79 78 | -80 79 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap index 550e116c28386..9ae0f58893423 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF027_RUF027_0.py.snap @@ -10,16 +10,6 @@ RUF027_0.py:5:7: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -2 2 | -3 3 | "always ignore this: {val}" -4 4 | -5 |-print("but don't ignore this: {val}") # RUF027 - 5 |+print(f"but don't ignore this: {val}") # RUF027 -6 6 | -7 7 | -8 8 | def simple_cases(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF027_0.py:10:9: RUF027 [*] Possible f-string without an `f` prefix | @@ -31,16 +21,6 @@ RUF027_0.py:10:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -7 7 | -8 8 | def simple_cases(): -9 9 | a = 4 -10 |- b = "{a}" # RUF027 - 10 |+ b = f"{a}" # RUF027 -11 11 | c = "{a} {b} f'{val}' " # RUF027 -12 12 | -13 13 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF027_0.py:11:9: RUF027 [*] Possible f-string without an `f` prefix | @@ -51,16 +31,6 @@ RUF027_0.py:11:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -8 8 | def simple_cases(): -9 9 | a = 4 -10 10 | b = "{a}" # RUF027 -11 |- c = "{a} {b} f'{val}' " # RUF027 - 11 |+ c = f"{a} {b} f'{val}' " # RUF027 -12 12 | -13 13 | -14 14 | def escaped_string(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF027_0.py:21:9: RUF027 [*] Possible f-string without an `f` prefix | @@ -72,16 +42,6 @@ RUF027_0.py:21:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -18 18 | -19 19 | def raw_string(): -20 20 | a = 4 -21 |- b = r"raw string with formatting: {a}" # RUF027 - 21 |+ b = fr"raw string with formatting: {a}" # RUF027 -22 22 | c = r"raw string with \backslashes\ and \"escaped quotes\": {a}" # RUF027 -23 23 | -24 24 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF027_0.py:22:9: RUF027 [*] Possible f-string without an `f` prefix | @@ -92,16 +52,6 @@ RUF027_0.py:22:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -19 19 | def raw_string(): -20 20 | a = 4 -21 21 | b = r"raw string with formatting: {a}" # RUF027 -22 |- c = r"raw string with \backslashes\ and \"escaped quotes\": {a}" # RUF027 - 22 |+ c = fr"raw string with \backslashes\ and \"escaped quotes\": {a}" # RUF027 -23 23 | -24 24 | -25 25 | def print_name(name: str): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF027_0.py:27:11: RUF027 [*] Possible f-string without an `f` prefix | @@ -113,16 +63,6 @@ RUF027_0.py:27:11: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -24 24 | -25 25 | def print_name(name: str): -26 26 | a = 4 -27 |- print("Hello, {name}!") # RUF027 - 27 |+ print(f"Hello, {name}!") # RUF027 -28 28 | print("The test value we're using today is {a}") # RUF027 -29 29 | -30 30 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF027_0.py:28:11: RUF027 [*] Possible f-string without an `f` prefix | @@ -133,16 +73,6 @@ RUF027_0.py:28:11: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -25 25 | def print_name(name: str): -26 26 | a = 4 -27 27 | print("Hello, {name}!") # RUF027 -28 |- print("The test value we're using today is {a}") # RUF027 - 28 |+ print(f"The test value we're using today is {a}") # RUF027 -29 29 | -30 30 | -31 31 | def nested_funcs(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF027_0.py:33:33: RUF027 [*] Possible f-string without an `f` prefix | @@ -153,16 +83,6 @@ RUF027_0.py:33:33: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -30 30 | -31 31 | def nested_funcs(): -32 32 | a = 4 -33 |- print(do_nothing(do_nothing("{a}"))) # RUF027 - 33 |+ print(do_nothing(do_nothing(f"{a}"))) # RUF027 -34 34 | -35 35 | -36 36 | def tripled_quoted(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF027_0.py:39:19: RUF027 [*] Possible f-string without an `f` prefix | @@ -175,16 +95,6 @@ RUF027_0.py:39:19: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -36 36 | def tripled_quoted(): -37 37 | a = 4 -38 38 | c = a -39 |- single_line = """ {a} """ # RUF027 - 39 |+ single_line = f""" {a} """ # RUF027 -40 40 | # RUF027 -41 41 | multi_line = a = """b { # comment -42 42 | c} d - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF027_0.py:41:22: RUF027 [*] Possible f-string without an `f` prefix | @@ -198,16 +108,6 @@ RUF027_0.py:41:22: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -38 38 | c = a -39 39 | single_line = """ {a} """ # RUF027 -40 40 | # RUF027 -41 |- multi_line = a = """b { # comment - 41 |+ multi_line = a = f"""b { # comment -42 42 | c} d -43 43 | """ -44 44 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF027_0.py:49:9: RUF027 [*] Possible f-string without an `f` prefix | @@ -221,16 +121,6 @@ RUF027_0.py:49:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -46 46 | def single_quoted_multi_line(): -47 47 | a = 4 -48 48 | # RUF027 -49 |- b = " {\ - 49 |+ b = f" {\ -50 50 | a} \ -51 51 | " -52 52 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF027_0.py:56:9: RUF027 [*] Possible f-string without an `f` prefix | @@ -242,16 +132,6 @@ RUF027_0.py:56:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -53 53 | -54 54 | def implicit_concat(): -55 55 | a = 4 -56 |- b = "{a}" "+" "{b}" r" \\ " # RUF027 for the first part only - 56 |+ b = f"{a}" "+" "{b}" r" \\ " # RUF027 for the first part only -57 57 | print(f"{a}" "{a}" f"{b}") # RUF027 -58 58 | -59 59 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF027_0.py:57:18: RUF027 [*] Possible f-string without an `f` prefix | @@ -262,16 +142,6 @@ RUF027_0.py:57:18: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -54 54 | def implicit_concat(): -55 55 | a = 4 -56 56 | b = "{a}" "+" "{b}" r" \\ " # RUF027 for the first part only -57 |- print(f"{a}" "{a}" f"{b}") # RUF027 - 57 |+ print(f"{a}" f"{a}" f"{b}") # RUF027 -58 58 | -59 59 | -60 60 | def escaped_chars(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF027_0.py:62:9: RUF027 [*] Possible f-string without an `f` prefix | @@ -282,16 +152,6 @@ RUF027_0.py:62:9: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -59 59 | -60 60 | def escaped_chars(): -61 61 | a = 4 -62 |- b = "\"not escaped:\" '{a}' \"escaped:\": '{{c}}'" # RUF027 - 62 |+ b = f"\"not escaped:\" '{a}' \"escaped:\": '{{c}}'" # RUF027 -63 63 | -64 64 | -65 65 | def method_calls(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF027_0.py:70:18: RUF027 [*] Possible f-string without an `f` prefix | @@ -304,16 +164,6 @@ RUF027_0.py:70:18: RUF027 [*] Possible f-string without an `f` prefix | = help: Add `f` prefix -67 67 | value.method = print_name -68 68 | first = "Wendy" -69 69 | last = "Appleseed" -70 |- value.method("{first} {last}") # RUF027 - 70 |+ value.method(f"{first} {last}") # RUF027 -71 71 | -72 72 | def format_specifiers(): -73 73 | a = 4 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF027_0.py:74:9: RUF027 [*] Possible f-string without an `f` prefix | @@ -323,11 +173,3 @@ RUF027_0.py:74:9: RUF027 [*] Possible f-string without an `f` prefix | ^^^^^^^^^^^^^^ RUF027 | = help: Add `f` prefix - -71 71 | -72 72 | def format_specifiers(): -73 73 | a = 4 -74 |- b = "{a:b} {a:^5}" - 74 |+ b = f"{a:b} {a:^5}" - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF028_RUF028.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF028_RUF028.py.snap index 2e739f863edb9..b69379885a2e3 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF028_RUF028.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF028_RUF028.py.snap @@ -12,14 +12,6 @@ RUF028.py:3:9: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -1 1 | def fmt_off_between_lists(): -2 2 | test_list = [ -3 |- # fmt: off -4 3 | 1, -5 4 | 2, -6 5 | 3, - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF028.py:12:5: RUF028 [*] This suppression comment is invalid because it cannot be on its own line | @@ -31,15 +23,6 @@ RUF028.py:12:5: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -9 9 | -10 10 | # note: the second `fmt: skip`` should be OK -11 11 | def fmt_skip_on_own_line(): -12 |- # fmt: skip -13 12 | pass # fmt: skip -14 13 | -15 14 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF028.py:17:1: RUF028 [*] This suppression comment is invalid because it cannot be after a decorator | @@ -51,15 +34,6 @@ RUF028.py:17:1: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -14 14 | -15 15 | -16 16 | @fmt_skip_on_own_line -17 |-# fmt: off -18 17 | @fmt_off_between_lists -19 18 | def fmt_off_between_decorators(): -20 19 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF028.py:24:1: RUF028 [*] This suppression comment is invalid because it cannot be after a decorator | @@ -71,15 +45,6 @@ RUF028.py:24:1: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -21 21 | -22 22 | -23 23 | @fmt_off_between_decorators -24 |-# fmt: off -25 24 | class FmtOffBetweenClassDecorators: -26 25 | ... -27 26 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF028.py:33:5: RUF028 [*] This suppression comment is invalid because it cannot be directly above an alternate body | @@ -92,15 +57,6 @@ RUF028.py:33:5: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -30 30 | x = [1, 2, 3] -31 31 | for val in x: -32 32 | print(x) -33 |- # fmt: off -34 33 | else: -35 34 | print("done") -36 35 | while False: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF028.py:39:5: RUF028 [*] This suppression comment is invalid because it cannot be directly above an alternate body | @@ -113,15 +69,6 @@ RUF028.py:39:5: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -36 36 | while False: -37 37 | print("while") -38 38 | # fmt: off -39 |- # fmt: off -40 39 | else: -41 40 | print("done") -42 41 | if len(x) > 3: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF028.py:45:5: RUF028 [*] This suppression comment is invalid because it cannot be directly above an alternate body | @@ -134,15 +81,6 @@ RUF028.py:45:5: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -42 42 | if len(x) > 3: -43 43 | print("huh?") -44 44 | # fmt: on -45 |- # fmt: off -46 45 | else: -47 46 | print("expected") -48 47 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF028.py:52:5: RUF028 [*] This suppression comment is invalid because it cannot be after a decorator | @@ -155,15 +93,6 @@ RUF028.py:52:5: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -49 49 | -50 50 | class Test: -51 51 | @classmethod -52 |- # fmt: off -53 52 | def cls_method_a( -54 53 | # fmt: off -55 54 | cls, - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF028.py:54:9: RUF028 [*] This suppression comment is invalid because it cannot be in an expression, pattern, argument list, or other non-statement | @@ -176,15 +105,6 @@ RUF028.py:54:9: RUF028 [*] This suppression comment is invalid because it cannot | = help: Remove this comment -51 51 | @classmethod -52 52 | # fmt: off -53 53 | def cls_method_a( -54 |- # fmt: off -55 54 | cls, -56 55 | ) -> None: # noqa: test # fmt: skip -57 56 | pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF028.py:62:13: RUF028 [*] This suppression comment is invalid because it cannot be at the end of a line | @@ -196,16 +116,6 @@ RUF028.py:62:13: RUF028 [*] This suppression comment is invalid because it canno | = help: Remove this comment -59 59 | -60 60 | def fmt_on_trailing(): -61 61 | # fmt: off -62 |- val = 5 # fmt: on - 62 |+ val = 5 -63 63 | pass # fmt: on -64 64 | -65 65 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF028.py:63:10: RUF028 [*] This suppression comment is invalid because it cannot be at the end of a line | @@ -215,14 +125,3 @@ RUF028.py:63:10: RUF028 [*] This suppression comment is invalid because it canno | ^^^^^^^^^ RUF028 | = help: Remove this comment - -60 60 | def fmt_on_trailing(): -61 61 | # fmt: off -62 62 | val = 5 # fmt: on -63 |- pass # fmt: on - 63 |+ pass -64 64 | -65 65 | -66 66 | # all of these should be fine - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap index c13790730a9fd..50235dd1e4be5 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF030_RUF030.py.snap @@ -12,16 +12,6 @@ RUF030.py:6:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -3 3 | # Standard Case -4 4 | # Expects: -5 5 | # - single StringLiteral -6 |-assert True, print("This print is not intentional.") - 6 |+assert True, "This print is not intentional." -7 7 | -8 8 | # Concatenated string literals -9 9 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:11:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -34,16 +24,6 @@ RUF030.py:11:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -8 8 | # Concatenated string literals -9 9 | # Expects: -10 10 | # - single StringLiteral -11 |-assert True, print("This print" " is not intentional.") - 11 |+assert True, "This print is not intentional." -12 12 | -13 13 | # Positional arguments, string literals -14 14 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:16:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -56,16 +36,6 @@ RUF030.py:16:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -13 13 | # Positional arguments, string literals -14 14 | # Expects: -15 15 | # - single StringLiteral concatenated with " " -16 |-assert True, print("This print", "is not intentional") - 16 |+assert True, "This print is not intentional" -17 17 | -18 18 | # Concatenated string literals combined with Positional arguments -19 19 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:21:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -78,16 +48,6 @@ RUF030.py:21:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -18 18 | # Concatenated string literals combined with Positional arguments -19 19 | # Expects: -20 20 | # - single stringliteral concatenated with " " only between `print` and `is` -21 |-assert True, print("This " "print", "is not intentional.") - 21 |+assert True, "This print is not intentional." -22 22 | -23 23 | # Positional arguments, string literals with a variable -24 24 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:26:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -100,16 +60,6 @@ RUF030.py:26:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -23 23 | # Positional arguments, string literals with a variable -24 24 | # Expects: -25 25 | # - single FString concatenated with " " -26 |-assert True, print("This", print.__name__, "is not intentional.") - 26 |+assert True, f"This {print.__name__} is not intentional." -27 27 | -28 28 | # Mixed brackets string literals -29 29 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:31:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -122,16 +72,6 @@ RUF030.py:31:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -28 28 | # Mixed brackets string literals -29 29 | # Expects: -30 30 | # - single StringLiteral concatenated with " " -31 |-assert True, print("This print", 'is not intentional', """and should be removed""") - 31 |+assert True, "This print is not intentional and should be removed" -32 32 | -33 33 | # Mixed brackets with other brackets inside -34 34 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:36:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -144,16 +84,6 @@ RUF030.py:36:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -33 33 | # Mixed brackets with other brackets inside -34 34 | # Expects: -35 35 | # - single StringLiteral concatenated with " " and escaped brackets -36 |-assert True, print("This print", 'is not "intentional"', """and "should" be 'removed'""") - 36 |+assert True, "This print is not \"intentional\" and \"should\" be 'removed'" -37 37 | -38 38 | # Positional arguments, string literals with a separator -39 39 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:41:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -166,16 +96,6 @@ RUF030.py:41:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -38 38 | # Positional arguments, string literals with a separator -39 39 | # Expects: -40 40 | # - single StringLiteral concatenated with "|" -41 |-assert True, print("This print", "is not intentional", sep="|") - 41 |+assert True, "This print|is not intentional" -42 42 | -43 43 | # Positional arguments, string literals with None as separator -44 44 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:46:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -188,16 +108,6 @@ RUF030.py:46:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -43 43 | # Positional arguments, string literals with None as separator -44 44 | # Expects: -45 45 | # - single StringLiteral concatenated with " " -46 |-assert True, print("This print", "is not intentional", sep=None) - 46 |+assert True, "This print is not intentional" -47 47 | -48 48 | # Positional arguments, string literals with variable as separator, needs f-string -49 49 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:51:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -210,16 +120,6 @@ RUF030.py:51:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -48 48 | # Positional arguments, string literals with variable as separator, needs f-string -49 49 | # Expects: -50 50 | # - single FString concatenated with "{U00A0}" -51 |-assert True, print("This print", "is not intentional", sep=U00A0) - 51 |+assert True, f"This print{U00A0}is not intentional" -52 52 | -53 53 | # Unnecessary f-string -54 54 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:56:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -232,16 +132,6 @@ RUF030.py:56:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -53 53 | # Unnecessary f-string -54 54 | # Expects: -55 55 | # - single StringLiteral -56 |-assert True, print(f"This f-string is just a literal.") - 56 |+assert True, "This f-string is just a literal." -57 57 | -58 58 | # Positional arguments, string literals and f-strings -59 59 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:61:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -254,16 +144,6 @@ RUF030.py:61:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -58 58 | # Positional arguments, string literals and f-strings -59 59 | # Expects: -60 60 | # - single FString concatenated with " " -61 |-assert True, print("This print", f"is not {'intentional':s}") - 61 |+assert True, f"This print is not {'intentional':s}" -62 62 | -63 63 | # Positional arguments, string literals and f-strings with a separator -64 64 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:66:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -276,16 +156,6 @@ RUF030.py:66:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -63 63 | # Positional arguments, string literals and f-strings with a separator -64 64 | # Expects: -65 65 | # - single FString concatenated with "|" -66 |-assert True, print("This print", f"is not {'intentional':s}", sep="|") - 66 |+assert True, f"This print|is not {'intentional':s}" -67 67 | -68 68 | # A single f-string -69 69 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:71:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -298,16 +168,6 @@ RUF030.py:71:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -68 68 | # A single f-string -69 69 | # Expects: -70 70 | # - single FString -71 |-assert True, print(f"This print is not {'intentional':s}") - 71 |+assert True, f"This print is not {'intentional':s}" -72 72 | -73 73 | # A single f-string with a redundant separator -74 74 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:76:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -320,16 +180,6 @@ RUF030.py:76:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -73 73 | # A single f-string with a redundant separator -74 74 | # Expects: -75 75 | # - single FString -76 |-assert True, print(f"This print is not {'intentional':s}", sep="|") - 76 |+assert True, f"This print is not {'intentional':s}" -77 77 | -78 78 | # Complex f-string with variable as separator -79 79 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:83:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -342,16 +192,6 @@ RUF030.py:83:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -80 80 | # - single FString concatenated with "{U00A0}", all placeholders preserved -81 81 | condition = "True is True" -82 82 | maintainer = "John Doe" -83 |-assert True, print("Unreachable due to", condition, f", ask {maintainer} for advice", sep=U00A0) - 83 |+assert True, f"Unreachable due to{U00A0}{condition}{U00A0}, ask {maintainer} for advice" -84 84 | -85 85 | # Empty print -86 86 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:88:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -364,16 +204,6 @@ RUF030.py:88:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -85 85 | # Empty print -86 86 | # Expects: -87 87 | # - `msg` entirely removed from assertion -88 |-assert True, print() - 88 |+assert True -89 89 | -90 90 | # Empty print with separator -91 91 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:93:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -386,16 +216,6 @@ RUF030.py:93:14: RUF030 [*] `print()` expression in `assert` statement is likely | = help: Remove `print` -90 90 | # Empty print with separator -91 91 | # Expects: -92 92 | # - `msg` entirely removed from assertion -93 |-assert True, print(sep=" ") - 93 |+assert True -94 94 | -95 95 | # Custom print function that actually returns a string -96 96 | # Expects: - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF030.py:108:14: RUF030 [*] `print()` expression in `assert` statement is likely unintentional | @@ -405,11 +225,3 @@ RUF030.py:108:14: RUF030 [*] `print()` expression in `assert` statement is likel | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF030 | = help: Remove `print` - -105 105 | # Use of `builtins.print` -106 106 | # Expects: -107 107 | # - single StringLiteral -108 |-assert True, builtins.print("This print should be removed.") - 108 |+assert True, "This print should be removed." - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap index 2588490f30ac2..039a8b141db95 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap @@ -9,11 +9,3 @@ noqa.py:23:5: F841 [*] Local variable `I` is assigned to but never used | ^ F841 | = help: Remove assignment to unused variable `I` - -20 20 | -21 21 | def f(): -22 22 | # Only `E741` should be ignored by the `noqa`. -23 |- I = 1 # noqa: E741.F841 - 23 |+ pass # noqa: E741.F841 - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap index dcbc2698f6322..7fd60c91973d5 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap @@ -157,15 +157,6 @@ RUF100_0.py:32:5: F841 [*] Local variable `d` is assigned to but never used | = help: Remove assignment to unused variable `d` -29 29 | d = 1 # noqa: E501 -30 30 | -31 31 | # Invalid - many spaces before # -32 |- d = 1 # noqa: E501 -33 32 | # fmt: on -34 33 | -35 34 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF100_0.py:32:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | @@ -328,15 +319,6 @@ RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used | = help: Remove assignment to unused variable `e` -105 105 | def f(): -106 106 | # Invalid - nonexistent error code with multibyte character -107 107 | d = 1 # …noqa: F841, E50 -108 |- e = 1 # …noqa: E50 -109 108 | -110 109 | -111 110 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF100_0.py:108:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap index 0e86f4814c3aa..c0d0e0f2ec720 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap @@ -136,15 +136,6 @@ RUF100_0.py:32:5: F841 [*] Local variable `d` is assigned to but never used | = help: Remove assignment to unused variable `d` -29 29 | d = 1 # noqa: E501 -30 30 | -31 31 | # Invalid - many spaces before # -32 |- d = 1 # noqa: E501 -33 32 | # fmt: on -34 33 | -35 34 | - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF100_0.py:32:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | @@ -307,15 +298,6 @@ RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used | = help: Remove assignment to unused variable `e` -105 105 | def f(): -106 106 | # Invalid - nonexistent error code with multibyte character -107 107 | d = 1 # …noqa: F841, E50 -108 |- e = 1 # …noqa: E50 -109 108 | -110 109 | -111 110 | def f(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. RUF100_0.py:108:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap index d711413d4b253..a085560de90b6 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap @@ -11,15 +11,6 @@ RUF100_5.py:7:5: ERA001 Found commented-out code | = help: Remove commented-out code -4 4 | dictionary = { -5 5 | # "key1": 123, # noqa: ERA001 -6 6 | # "key2": 456, # noqa -7 |- # "key3": 789, -8 7 | } -9 8 | -10 9 | - - Ruff cannot safely apply this fix. RUF100_5.py:11:1: ERA001 Found commented-out code | @@ -28,12 +19,6 @@ RUF100_5.py:11:1: ERA001 Found commented-out code | = help: Remove commented-out code -8 8 | } -9 9 | -10 10 | -11 |-#import os # noqa: E501 - - Ruff cannot safely apply this fix. RUF100_5.py:11:13: RUF100 [*] Unused `noqa` directive (unused: `E501`) | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap index 037e7aefd3e89..8bf9a552cd7e3 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap @@ -8,11 +8,3 @@ ruff_noqa_codes.py:8:5: F841 [*] Local variable `x` is assigned to but never use | ^ F841 | = help: Remove assignment to unused variable `x` - -5 5 | -6 6 | -7 7 | def f(): -8 |- x = 1 - 8 |+ pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap index 5067d64b50fd7..23387c29f35fa 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap @@ -22,11 +22,3 @@ ruff_noqa_invalid.py:5:5: F841 [*] Local variable `x` is assigned to but never u | ^ F841 | = help: Remove assignment to unused variable `x` - -2 2 | -3 3 | -4 4 | def f(): -5 |- x = 1 - 5 |+ pass - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap index 040278aeec522..5965b44b6d5fc 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap @@ -53,16 +53,6 @@ TRY400.py:27:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -24 24 | try: -25 25 | a = 1 -26 26 | except Exception: -27 |- logger.error("Context message here") - 27 |+ logger.exception("Context message here") -28 28 | -29 29 | if True: -30 30 | logger.error("Context message here") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TRY400.py:30:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | @@ -72,16 +62,6 @@ TRY400.py:30:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -27 27 | logger.error("Context message here") -28 28 | -29 29 | if True: -30 |- logger.error("Context message here") - 30 |+ logger.exception("Context message here") -31 31 | -32 32 | -33 33 | def bad(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TRY400.py:37:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | @@ -94,16 +74,6 @@ TRY400.py:37:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -34 34 | try: -35 35 | a = 1 -36 36 | except Exception: -37 |- log.error("Context message here") - 37 |+ log.exception("Context message here") -38 38 | -39 39 | if True: -40 40 | log.error("Context message here") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TRY400.py:40:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | @@ -113,16 +83,6 @@ TRY400.py:40:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -37 37 | log.error("Context message here") -38 38 | -39 39 | if True: -40 |- log.error("Context message here") - 40 |+ log.exception("Context message here") -41 41 | -42 42 | -43 43 | def bad(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TRY400.py:47:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | @@ -135,16 +95,6 @@ TRY400.py:47:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -44 44 | try: -45 45 | a = 1 -46 46 | except Exception: -47 |- self.logger.error("Context message here") - 47 |+ self.logger.exception("Context message here") -48 48 | -49 49 | if True: -50 50 | self.logger.error("Context message here") - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TRY400.py:50:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | @@ -154,16 +104,6 @@ TRY400.py:50:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | = help: Replace with `exception` -47 47 | self.logger.error("Context message here") -48 48 | -49 49 | if True: -50 |- self.logger.error("Context message here") - 50 |+ self.logger.exception("Context message here") -51 51 | -52 52 | -53 53 | def good(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TRY400.py:100:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap index 731bcd704a842..4284bf8fa1e73 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap @@ -10,16 +10,6 @@ TRY201.py:20:15: TRY201 [*] Use `raise` without specifying exception name | = help: Remove exception name -17 17 | process() -18 18 | except MyException as e: -19 19 | logger.exception("process failed") -20 |- raise e - 20 |+ raise -21 21 | -22 22 | -23 23 | def good(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TRY201.py:63:19: TRY201 [*] Use `raise` without specifying exception name | @@ -30,16 +20,6 @@ TRY201.py:63:19: TRY201 [*] Use `raise` without specifying exception name | = help: Remove exception name -60 60 | except MyException as e: -61 61 | logger.exception("process failed") -62 62 | if True: -63 |- raise e - 63 |+ raise -64 64 | -65 65 | -66 66 | def bad_that_needs_recursion_2(): - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. TRY201.py:74:23: TRY201 [*] Use `raise` without specifying exception name | @@ -48,11 +28,3 @@ TRY201.py:74:23: TRY201 [*] Use `raise` without specifying exception name | ^ TRY201 | = help: Remove exception name - -71 71 | if True: -72 72 | -73 73 | def foo(): -74 |- raise e - 74 |+ raise - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. diff --git a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap index 85e1bb6a7ca02..3c7ebc60e70a4 100644 --- a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap +++ b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap @@ -10,14 +10,6 @@ unused_variable.ipynb:cell 1:2:5: F841 [*] Local variable `foo1` is assigned to | = help: Remove assignment to unused variable `foo1` -1 1 | def f(): -2 |- foo1 = %matplotlib --list - 2 |+ %matplotlib --list -3 3 | foo2: list[str] = %matplotlib --list -4 4 | def f(): -5 5 | bar1 = !pwd - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unused_variable.ipynb:cell 1:3:5: F841 [*] Local variable `foo2` is assigned to but never used | @@ -28,15 +20,6 @@ unused_variable.ipynb:cell 1:3:5: F841 [*] Local variable `foo2` is assigned to | = help: Remove assignment to unused variable `foo2` -1 1 | def f(): -2 2 | foo1 = %matplotlib --list -3 |- foo2: list[str] = %matplotlib --list - 3 |+ %matplotlib --list -4 4 | def f(): -5 5 | bar1 = !pwd -6 6 | bar2: str = !pwd - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unused_variable.ipynb:cell 2:2:5: F841 [*] Local variable `bar1` is assigned to but never used | @@ -47,14 +30,6 @@ unused_variable.ipynb:cell 2:2:5: F841 [*] Local variable `bar1` is assigned to | = help: Remove assignment to unused variable `bar1` -2 2 | foo1 = %matplotlib --list -3 3 | foo2: list[str] = %matplotlib --list -4 4 | def f(): -5 |- bar1 = !pwd - 5 |+ !pwd -6 6 | bar2: str = !pwd - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. unused_variable.ipynb:cell 2:3:5: F841 [*] Local variable `bar2` is assigned to but never used | @@ -64,11 +39,3 @@ unused_variable.ipynb:cell 2:3:5: F841 [*] Local variable `bar2` is assigned to | ^^^^ F841 | = help: Remove assignment to unused variable `bar2` - -3 3 | foo2: list[str] = %matplotlib --list -4 4 | def f(): -5 5 | bar1 = !pwd -6 |- bar2: str = !pwd - 6 |+ !pwd - - Run `ruff check --fix --unsafe-fixes` to apply this unsafe fix. From fde34bc7d8d47a86369cf216bfe9e62d405497b8 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Wed, 31 Jul 2024 12:27:18 -0600 Subject: [PATCH 4/4] Show only diffs, not CTAs, in `check` --- crates/ruff/tests/integration_test.rs | 34 ----- crates/ruff_linter/src/message/diff.rs | 6 - ...e8_async__tests__ASYNC115_ASYNC115.py.snap | 12 -- ..._tests__preview__ASYNC115_ASYNC115.py.snap | 20 --- ...__flake8_bugbear__tests__B004_B004.py.snap | 8 +- ...ke8_bugbear__tests__B009_B009_B010.py.snap | 36 ----- ...ke8_bugbear__tests__B010_B009_B010.py.snap | 12 -- ...__flake8_bugbear__tests__B013_B013.py.snap | 4 - ...__flake8_bugbear__tests__B014_B014.py.snap | 10 -- ...__flake8_bugbear__tests__B033_B033.py.snap | 16 --- ...rules__flake8_bugbear__tests__B905.py.snap | 20 --- ...rules__flake8_commas__tests__COM81.py.snap | 90 ------------- ...8_comprehensions__tests__C413_C413.py.snap | 2 - ...flake8_executable__tests__EXE004_1.py.snap | 2 - ...flake8_executable__tests__EXE004_4.py.snap | 2 - ...icit_str_concat__tests__ISC001_ISC.py.snap | 26 +--- ...oncat__tests__multiline_ISC001_ISC.py.snap | 26 +--- ...ake8_logging__tests__LOG009_LOG009.py.snap | 4 - ...flake8_logging_format__tests__G010.py.snap | 8 -- ...__flake8_pie__tests__PIE790_PIE790.py.snap | 72 ---------- ...__flake8_pie__tests__PIE800_PIE800.py.snap | 14 +- ...__flake8_pie__tests__PIE804_PIE804.py.snap | 20 --- ...__flake8_pie__tests__PIE807_PIE807.py.snap | 12 -- ...__flake8_pie__tests__PIE808_PIE808.py.snap | 4 - ..._flake8_pyi__tests__PYI009_PYI009.pyi.snap | 4 - ..._flake8_pyi__tests__PYI010_PYI010.pyi.snap | 6 - ..._flake8_pyi__tests__PYI011_PYI011.pyi.snap | 36 ----- ..._flake8_pyi__tests__PYI012_PYI012.pyi.snap | 12 -- ...__flake8_pyi__tests__PYI013_PYI013.py.snap | 16 --- ..._flake8_pyi__tests__PYI013_PYI013.pyi.snap | 18 --- ..._flake8_pyi__tests__PYI014_PYI014.pyi.snap | 26 ---- ..._flake8_pyi__tests__PYI015_PYI015.pyi.snap | 22 ---- ...__flake8_pyi__tests__PYI016_PYI016.py.snap | 46 ------- ..._flake8_pyi__tests__PYI016_PYI016.pyi.snap | 46 ------- ..._flake8_pyi__tests__PYI020_PYI020.pyi.snap | 18 --- ...flake8_pyi__tests__PYI025_PYI025_1.py.snap | 4 - ...lake8_pyi__tests__PYI025_PYI025_1.pyi.snap | 10 -- ..._flake8_pyi__tests__PYI026_PYI026.pyi.snap | 12 -- ..._flake8_pyi__tests__PYI029_PYI029.pyi.snap | 6 - ...__flake8_pyi__tests__PYI030_PYI030.py.snap | 52 -------- ..._flake8_pyi__tests__PYI030_PYI030.pyi.snap | 52 -------- ...__flake8_pyi__tests__PYI032_PYI032.py.snap | 4 - ..._flake8_pyi__tests__PYI032_PYI032.pyi.snap | 4 - ...__flake8_pyi__tests__PYI036_PYI036.py.snap | 6 - ..._flake8_pyi__tests__PYI036_PYI036.pyi.snap | 6 - ..._flake8_pyi__tests__PYI053_PYI053.pyi.snap | 16 --- ..._flake8_pyi__tests__PYI054_PYI054.pyi.snap | 16 --- ...__flake8_pyi__tests__PYI055_PYI055.py.snap | 14 -- ..._flake8_pyi__tests__PYI055_PYI055.pyi.snap | 18 --- ...__flake8_pyi__tests__PYI058_PYI058.py.snap | 18 +-- ..._flake8_pyi__tests__PYI058_PYI058.pyi.snap | 18 --- ...__flake8_pyi__tests__PYI059_PYI059.py.snap | 8 -- ..._flake8_pyi__tests__PYI059_PYI059.pyi.snap | 8 -- ...__flake8_pyi__tests__PYI064_PYI064.py.snap | 8 -- ..._flake8_pyi__tests__PYI064_PYI064.pyi.snap | 8 -- ...e8_pyi__tests__py38_PYI026_PYI026.pyi.snap | 12 -- ...e8_pytest_style__tests__PT001_default.snap | 8 +- ...st_style__tests__PT001_no_parentheses.snap | 12 -- ...flake8_pytest_style__tests__PT006_csv.snap | 4 - ...e8_pytest_style__tests__PT006_default.snap | 4 - ...lake8_pytest_style__tests__PT006_list.snap | 4 - ...es__flake8_pytest_style__tests__PT022.snap | 6 - ...e8_pytest_style__tests__PT023_default.snap | 12 +- ...st_style__tests__PT023_no_parentheses.snap | 10 -- ...es__flake8_pytest_style__tests__PT024.snap | 8 -- ...es__flake8_pytest_style__tests__PT025.snap | 4 - ..._tests__only_docstring_doubles_all.py.snap | 4 +- ...es__tests__only_inline_doubles_all.py.snap | 2 - ..._tests__only_multiline_doubles_all.py.snap | 2 - ...ing_doubles_over_docstring_doubles.py.snap | 10 -- ...ubles_over_docstring_doubles_class.py.snap | 6 +- ...es_over_docstring_doubles_function.py.snap | 12 +- ...docstring_doubles_module_multiline.py.snap | 4 - ...ocstring_doubles_module_singleline.py.snap | 4 - ...ing_doubles_over_docstring_singles.py.snap | 8 +- ...ubles_over_docstring_singles_class.py.snap | 6 - ...es_over_docstring_singles_function.py.snap | 6 - ...g_singles_mixed_quotes_class_var_1.py.snap | 6 - ...g_singles_mixed_quotes_class_var_2.py.snap | 12 -- ...xed_quotes_module_singleline_var_1.py.snap | 4 - ...xed_quotes_module_singleline_var_2.py.snap | 6 - ...docstring_singles_module_multiline.py.snap | 2 - ...ocstring_singles_module_singleline.py.snap | 2 - ...ing_singles_over_docstring_doubles.py.snap | 8 +- ...ngles_over_docstring_doubles_class.py.snap | 6 - ...es_over_docstring_doubles_function.py.snap | 6 - ...g_doubles_mixed_quotes_class_var_2.py.snap | 6 - ...xed_quotes_module_singleline_var_2.py.snap | 2 - ...docstring_doubles_module_multiline.py.snap | 2 - ...ocstring_doubles_module_singleline.py.snap | 2 - ...ing_singles_over_docstring_singles.py.snap | 12 -- ...ngles_over_docstring_singles_class.py.snap | 6 +- ...es_over_docstring_singles_function.py.snap | 12 +- ...docstring_singles_module_multiline.py.snap | 4 - ...ocstring_singles_module_singleline.py.snap | 4 - ...ests__require_doubles_over_singles.py.snap | 6 - ...quire_doubles_over_singles_escaped.py.snap | 22 ---- ...re_doubles_over_singles_escaped_py311.snap | 8 -- ...s_over_singles_escaped_unnecessary.py.snap | 36 ----- ...uire_doubles_over_singles_implicit.py.snap | 14 -- ...bles_over_singles_multiline_string.py.snap | 2 - ...ver_singles_would_be_triple_quotes.py.snap | 6 - ...ests__require_singles_over_doubles.py.snap | 6 - ...quire_singles_over_doubles_escaped.py.snap | 26 ---- ...re_singles_over_doubles_escaped_py311.snap | 12 -- ...s_over_doubles_escaped_unnecessary.py.snap | 38 ------ ...uire_singles_over_doubles_implicit.py.snap | 14 -- ...gles_over_doubles_multiline_string.py.snap | 2 - ...ver_doubles_would_be_triple_quotes.py.snap | 2 - ...ry-paren-on-raise-exception_RSE102.py.snap | 24 ---- ...lake8_return__tests__RET501_RET501.py.snap | 4 - ...lake8_return__tests__RET502_RET502.py.snap | 4 +- ...urn__tests__preview__RET505_RET505.py.snap | 40 ------ ...urn__tests__preview__RET506_RET506.py.snap | 14 -- ...urn__tests__preview__RET507_RET507.py.snap | 14 -- ...urn__tests__preview__RET508_RET508.py.snap | 16 --- ...ke8_simplify__tests__SIM114_SIM114.py.snap | 34 ----- ...ke8_simplify__tests__SIM118_SIM118.py.snap | 34 ----- ...ke8_simplify__tests__SIM201_SIM201.py.snap | 6 - ...ke8_simplify__tests__SIM202_SIM202.py.snap | 6 - ...ke8_simplify__tests__SIM208_SIM208.py.snap | 10 -- ...ke8_simplify__tests__SIM300_SIM300.py.snap | 34 ----- ...ke8_simplify__tests__SIM910_SIM910.py.snap | 12 -- ..._invalid-todo-capitalization_TD006.py.snap | 6 - ...__empty-type-checking-block_TCH005.py.snap | 12 -- ..._use_pathlib__tests__PTH201_PTH201.py.snap | 8 -- ...kage_first_and_third_party_imports.py.snap | 2 - ...kage_first_and_third_party_imports.py.snap | 2 - ...tests__add_newline_before_comments.py.snap | 2 - ..._isort__tests__as_imports_comments.py.snap | 2 - ..._rules__isort__tests__bom_unsorted.py.snap | 2 - ...sts__case_sensitive_case_sensitive.py.snap | 2 - ...to_furthest_relative_imports_order.py.snap | 2 - ...__isort__tests__combine_as_imports.py.snap | 2 - ...bine_as_imports_combine_as_imports.py.snap | 2 - ..._isort__tests__combine_import_from.py.snap | 2 - ...ter__rules__isort__tests__comments.py.snap | 2 - ..._isort__tests__deduplicate_imports.py.snap | 2 - ...es__isort__tests__detect_same_package.snap | 2 - ...les__isort__tests__fit_line_length.py.snap | 2 - ...rt__tests__fit_line_length_comment.py.snap | 2 - ...orce_single_line_force_single_line.py.snap | 2 - ..._tests__force_sort_within_sections.py.snap | 2 - ...ections_force_sort_within_sections.py.snap | 2 - ..._force_sort_within_sections_future.py.snap | 2 - ...sort_within_sections_with_as_names.py.snap | 2 - ..._rules__isort__tests__force_to_top.py.snap | 2 - ...__tests__force_to_top_force_to_top.py.snap | 2 - ...__isort__tests__force_wrap_aliases.py.snap | 2 - ...ce_wrap_aliases_force_wrap_aliases.py.snap | 2 - ...les__isort__tests__forced_separate.py.snap | 2 - ...__rules__isort__tests__future_from.py.snap | 2 - ...kage_first_and_third_party_imports.py.snap | 2 - ..._rules__isort__tests__if_elif_else.py.snap | 2 - ...t__tests__import_from_after_import.py.snap | 2 - ...les__isort__tests__inline_comments.py.snap | 2 - ...__isort__tests__insert_empty_lines.py.snap | 8 -- ..._isort__tests__insert_empty_lines.pyi.snap | 6 - ...sest_separate_local_folder_imports.py.snap | 2 - ...lder_separate_local_folder_imports.py.snap | 2 - ...gth_sort__length_sort_from_imports.py.snap | 2 - ...ort__length_sort_non_ascii_members.py.snap | 2 - ...ort__length_sort_non_ascii_modules.py.snap | 2 - ...gth_sort_straight_and_from_imports.py.snap | 2 - ...sort__length_sort_straight_imports.py.snap | 2 - ..._length_sort_with_relative_imports.py.snap | 2 - ...straight__length_sort_from_imports.py.snap | 2 - ...gth_sort_straight_and_from_imports.py.snap | 2 - ...ight__length_sort_straight_imports.py.snap | 2 - ...es__isort__tests__line_ending_crlf.py.snap | 4 +- ...ules__isort__tests__line_ending_lf.py.snap | 4 +- ...isort__tests__lines_after_imports.pyi.snap | 2 - ...s__lines_after_imports_class_after.py.snap | 2 - ...ts__lines_after_imports_func_after.py.snap | 2 - ...after_imports_lines_after_imports.pyi.snap | 2 - ...ts_lines_after_imports_class_after.py.snap | 2 - ...rts_lines_after_imports_func_after.py.snap | 4 +- ..._lines_after_imports_nothing_after.py.snap | 2 - ...s_between_typeslines_between_types.py.snap | 2 - ...isort__tests__magic_trailing_comma.py.snap | 2 - ...r__rules__isort__tests__match_case.py.snap | 4 - ...rules__isort__tests__natural_order.py.snap | 2 - ..._isort__tests__no_detect_same_package.snap | 2 - ...les__isort__tests__no_lines_before.py.snap | 2 - ...no_lines_before.py_no_lines_before.py.snap | 2 - ...o_lines_before_with_empty_sections.py.snap | 2 - ...andard_library_no_standard_library.py.snap | 2 - ..._rules__isort__tests__no_wrap_star.py.snap | 2 - ...rules__isort__tests__order_by_type.py.snap | 2 - ..._order_by_type_false_order_by_type.py.snap | 2 - ..._order_by_type_with_custom_classes.py.snap | 2 - ..._order_by_type_with_custom_classes.py.snap | 2 - ...rder_by_type_with_custom_constants.py.snap | 2 - ...rder_by_type_with_custom_constants.py.snap | 2 - ...rder_by_type_with_custom_variables.py.snap | 2 - ...rder_by_type_with_custom_variables.py.snap | 2 - ...s__order_relative_imports_by_level.py.snap | 2 - ...ort__tests__preserve_comment_order.py.snap | 2 - ...isort__tests__preserve_import_star.py.snap | 2 - ...isort__tests__preserve_indentation.py.snap | 4 - ...comments_propagate_inline_comments.py.snap | 2 - ...ort__tests__reorder_within_section.py.snap | 2 - ...rt__tests__required_import_comment.py.snap | 2 - ...uired_import_comments_and_newlines.py.snap | 2 - ...__tests__required_import_docstring.py.snap | 2 - ...import_docstring_with_continuation.py.snap | 2 - ...ed_import_docstring_with_semicolon.py.snap | 2 - ...s__required_import_existing_import.py.snap | 2 - ...equired_import_multiline_docstring.py.snap | 2 - ..._isort__tests__required_import_off.py.snap | 2 - ...ort__tests__required_import_unused.py.snap | 4 - ...required_import_with_alias_comment.py.snap | 2 - ...t_with_alias_comments_and_newlines.py.snap | 2 - ...quired_import_with_alias_docstring.py.snap | 2 - ..._alias_docstring_with_continuation.py.snap | 2 - ...ith_alias_docstring_with_semicolon.py.snap | 2 - ..._import_with_alias_existing_import.py.snap | 2 - ...ort_with_alias_multiline_docstring.py.snap | 2 - ...ts__required_import_with_alias_off.py.snap | 2 - ..._tests__required_imports_docstring.py.snap | 4 - ...ort__tests__section_order_sections.py.snap | 2 - ...__tests__sections_main_first_party.py.snap | 2 - ...s__isort__tests__sections_sections.py.snap | 2 - ...ests__separate_first_party_imports.py.snap | 2 - ...rt__tests__separate_future_imports.py.snap | 2 - ...sts__separate_local_folder_imports.py.snap | 2 - ...ests__separate_third_party_imports.py.snap | 2 - ..._linter__rules__isort__tests__skip.py.snap | 6 - ...isort__tests__sort_similar_imports.py.snap | 2 - ...linter__rules__isort__tests__split.py.snap | 6 - ...railing_comma_magic_trailing_comma.py.snap | 2 - ...__isort__tests__star_before_others.py.snap | 2 - ...straight_required_import_docstring.py.snap | 2 - ...traight_required_import_docstring.pyi.snap | 2 - ...es__isort__tests__trailing_comment.py.snap | 10 -- ...er__rules__isort__tests__two_space.py.snap | 2 - ...nter__rules__isort__tests__unicode.py.snap | 2 - ...__numpy-deprecated-function_NPY003.py.snap | 20 --- ...numpy-deprecated-type-alias_NPY001.py.snap | 16 --- ...__tests__numpy2-deprecation_NPY201.py.snap | 38 ------ ...tests__numpy2-deprecation_NPY201_2.py.snap | 40 ------ ...tests__numpy2-deprecation_NPY201_3.py.snap | 12 -- ...__perflint__tests__PERF101_PERF101.py.snap | 22 ---- ...ules__pycodestyle__tests__E201_E20.py.snap | 18 --- ...ules__pycodestyle__tests__E202_E20.py.snap | 16 --- ...ules__pycodestyle__tests__E203_E20.py.snap | 34 ----- ...les__pycodestyle__tests__E204_E204.py.snap | 6 - ...ules__pycodestyle__tests__E211_E21.py.snap | 14 -- ...ules__pycodestyle__tests__E221_E22.py.snap | 16 --- ...ules__pycodestyle__tests__E222_E22.py.snap | 12 +- ...ules__pycodestyle__tests__E223_E22.py.snap | 4 +- ...ules__pycodestyle__tests__E224_E22.py.snap | 4 +- ...ules__pycodestyle__tests__E225_E22.py.snap | 24 ---- ...ules__pycodestyle__tests__E226_E22.py.snap | 52 -------- ...ules__pycodestyle__tests__E227_E22.py.snap | 16 --- ...ules__pycodestyle__tests__E228_E22.py.snap | 6 - ...ules__pycodestyle__tests__E231_E23.py.snap | 46 ------- ...ules__pycodestyle__tests__E241_E24.py.snap | 8 -- ...ules__pycodestyle__tests__E242_E24.py.snap | 2 - ...ules__pycodestyle__tests__E251_E25.py.snap | 22 ---- ...ules__pycodestyle__tests__E252_E25.py.snap | 8 -- ...ules__pycodestyle__tests__E261_E26.py.snap | 2 - ...ules__pycodestyle__tests__E262_E26.py.snap | 14 -- ...ules__pycodestyle__tests__E265_E26.py.snap | 12 -- ...ules__pycodestyle__tests__E266_E26.py.snap | 12 +- ...ules__pycodestyle__tests__E271_E27.py.snap | 20 --- ...ules__pycodestyle__tests__E272_E27.py.snap | 6 - ...ules__pycodestyle__tests__E273_E27.py.snap | 12 -- ...ules__pycodestyle__tests__E274_E27.py.snap | 4 - ...ules__pycodestyle__tests__E275_E27.py.snap | 14 -- ...ules__pycodestyle__tests__E301_E30.py.snap | 10 -- ...ules__pycodestyle__tests__E302_E30.py.snap | 22 ---- ...ts__E302_E302_first_line_docstring.py.snap | 2 - ...s__E302_E302_first_line_expression.py.snap | 2 - ...sts__E302_E302_first_line_function.py.snap | 2 - ...ts__E302_E302_first_line_statement.py.snap | 2 - ...ules__pycodestyle__tests__E303_E30.py.snap | 30 +---- ...ests__E303_E303_first_line_comment.py.snap | 2 - ...ts__E303_E303_first_line_docstring.py.snap | 2 - ...s__E303_E303_first_line_expression.py.snap | 2 - ...ts__E303_E303_first_line_statement.py.snap | 2 - ...ules__pycodestyle__tests__E304_E30.py.snap | 6 - ...ules__pycodestyle__tests__E305_E30.py.snap | 10 -- ...ules__pycodestyle__tests__E306_E30.py.snap | 22 ---- ...ules__pycodestyle__tests__E401_E40.py.snap | 18 --- ...ules__pycodestyle__tests__E703_E70.py.snap | 10 -- ...__pycodestyle__tests__E703_E703.ipynb.snap | 4 - ...les__pycodestyle__tests__E713_E713.py.snap | 12 -- ...les__pycodestyle__tests__E714_E714.py.snap | 6 - ...ules__pycodestyle__tests__W291_W29.py.snap | 6 - ...les__pycodestyle__tests__W291_W291.py.snap | 4 - ...s__pycodestyle__tests__W292_W292_0.py.snap | 2 - ...ules__pycodestyle__tests__W293_W29.py.snap | 2 - ...les__pycodestyle__tests__W293_W293.py.snap | 4 - ...s__pycodestyle__tests__W605_W605_0.py.snap | 22 ---- ...s__pycodestyle__tests__W605_W605_1.py.snap | 28 ---- ...yle__tests__blank_lines_E301_notebook.snap | 2 - ...yle__tests__blank_lines_E302_notebook.snap | 2 - ...yle__tests__blank_lines_E303_notebook.snap | 4 - ...__tests__blank_lines_E303_typing_stub.snap | 8 -- ...yle__tests__blank_lines_E304_notebook.snap | 2 - ...__tests__blank_lines_E304_typing_stub.snap | 4 +- ...yle__tests__blank_lines_E305_notebook.snap | 2 - ...yle__tests__blank_lines_E306_notebook.snap | 2 - ...patibility-lines-after(-1)-between(0).snap | 14 -- ...mpatibility-lines-after(0)-between(0).snap | 12 -- ...mpatibility-lines-after(1)-between(1).snap | 12 +- ...mpatibility-lines-after(4)-between(4).snap | 16 --- ..._tests__blank_lines_typing_stub_isort.snap | 30 ----- ...pycodestyle__tests__constant_literals.snap | 46 ------- ...destyle__tests__preview__E502_E502.py.snap | 28 ---- ...style__tests__preview__W391_W391_0.py.snap | 2 - ...style__tests__preview__W391_W391_2.py.snap | 2 - ...r__rules__pycodestyle__tests__shebang.snap | 2 - ...patibility-lines-after(-1)-between(0).snap | 14 -- ...mpatibility-lines-after(0)-between(0).snap | 18 --- ...mpatibility-lines-after(1)-between(1).snap | 14 -- ...mpatibility-lines-after(4)-between(4).snap | 10 -- ...er__rules__pycodestyle__tests__w292_4.snap | 4 +- ...__rules__pydocstyle__tests__D201_D.py.snap | 8 -- ...__rules__pydocstyle__tests__D202_D.py.snap | 10 +- ...ules__pydocstyle__tests__D202_D202.py.snap | 6 - ...__rules__pydocstyle__tests__D203_D.py.snap | 12 -- ...__rules__pydocstyle__tests__D204_D.py.snap | 12 +- ...__rules__pydocstyle__tests__D205_D.py.snap | 2 - ...__rules__pydocstyle__tests__D207_D.py.snap | 8 -- ...__rules__pydocstyle__tests__D208_D.py.snap | 42 ------ ...ules__pydocstyle__tests__D208_D208.py.snap | 8 -- ...__rules__pydocstyle__tests__D209_D.py.snap | 4 - ...__rules__pydocstyle__tests__D210_D.py.snap | 6 - ...__rules__pydocstyle__tests__D211_D.py.snap | 6 +- ...__rules__pydocstyle__tests__D212_D.py.snap | 6 - ...__rules__pydocstyle__tests__D213_D.py.snap | 56 -------- ...ydocstyle__tests__D214_D214_module.py.snap | 4 - ...__pydocstyle__tests__D214_sections.py.snap | 6 +- ...ules__pydocstyle__tests__D215_D215.py.snap | 2 - ...__pydocstyle__tests__D215_sections.py.snap | 6 +- ...__rules__pydocstyle__tests__D300_D.py.snap | 22 +--- ...ules__pydocstyle__tests__D300_D300.py.snap | 2 - ...ules__pydocstyle__tests__D403_D403.py.snap | 6 - ...__pydocstyle__tests__D405_sections.py.snap | 4 - ...__pydocstyle__tests__D406_sections.py.snap | 6 - ...__pydocstyle__tests__D407_sections.py.snap | 46 ------- ...__pydocstyle__tests__D408_sections.py.snap | 4 +- ...__pydocstyle__tests__D409_sections.py.snap | 6 - ...ules__pydocstyle__tests__D410_D410.py.snap | 4 - ...__pydocstyle__tests__D410_sections.py.snap | 6 +- ...__pydocstyle__tests__D411_sections.py.snap | 8 +- ...__pydocstyle__tests__D412_sections.py.snap | 4 +- ...es__pydocstyle__tests__D412_sphinx.py.snap | 8 -- ...ules__pydocstyle__tests__D413_D413.py.snap | 8 -- ...__pydocstyle__tests__D413_sections.py.snap | 18 +-- ...linter__rules__pydocstyle__tests__bom.snap | 2 - ...__rules__pydocstyle__tests__d209_d400.snap | 2 - ...ules__pyflakes__tests__F401_F401_0.py.snap | 30 ----- ...les__pyflakes__tests__F401_F401_11.py.snap | 2 - ...les__pyflakes__tests__F401_F401_15.py.snap | 2 - ...les__pyflakes__tests__F401_F401_17.py.snap | 4 - ...les__pyflakes__tests__F401_F401_18.py.snap | 2 - ...les__pyflakes__tests__F401_F401_23.py.snap | 2 - ...ules__pyflakes__tests__F401_F401_5.py.snap | 8 -- ...ules__pyflakes__tests__F401_F401_6.py.snap | 8 -- ...ules__pyflakes__tests__F401_F401_7.py.snap | 6 - ...ules__pyflakes__tests__F401_F401_9.py.snap | 2 - ...ts__F401_deprecated_option_F401_30.py.snap | 2 - ..._rules__pyflakes__tests__F504_F504.py.snap | 10 -- ..._rules__pyflakes__tests__F504_F50x.py.snap | 2 - ..._rules__pyflakes__tests__F522_F522.py.snap | 8 -- ..._rules__pyflakes__tests__F523_F523.py.snap | 20 --- ..._rules__pyflakes__tests__F541_F541.py.snap | 40 ------ ..._rules__pyflakes__tests__F632_F632.py.snap | 24 ---- ...les__pyflakes__tests__F811_F811_17.py.snap | 2 - ...les__pyflakes__tests__F811_F811_21.py.snap | 2 - ...ules__pyflakes__tests__F811_F811_6.py.snap | 2 - ...ules__pyflakes__tests__F811_F811_8.py.snap | 2 - ...ules__pyflakes__tests__F841_F841_0.py.snap | 2 - ...ules__pyflakes__tests__F841_F841_3.py.snap | 6 - ..._rules__pyflakes__tests__F901_F901.py.snap | 6 - ...hadowed_global_import_in_global_scope.snap | 2 - ...shadowed_global_import_in_local_scope.snap | 4 - ...shadowed_import_shadow_in_local_scope.snap | 2 - ..._shadowed_local_import_in_local_scope.snap | 2 - ...view_first_party_submodule_dunder_all.snap | 2 - ...lakes__tests__f841_dummy_variable_rgx.snap | 4 - ...__pyflakes__tests__future_annotations.snap | 2 - ...er_multiple_unbinds_from_module_scope.snap | 4 - ...s__load_after_unbind_from_class_scope.snap | 2 - ...__load_after_unbind_from_module_scope.snap | 2 - ...after_unbind_from_nested_module_scope.snap | 4 - ...yflakes__tests__multi_statement_lines.snap | 34 +---- ...s__preview__F401_F401_24____init__.py.snap | 2 - ...01_F401_25__all_nonempty____init__.py.snap | 4 - ..._F401_F401_26__all_empty____init__.py.snap | 4 - ...01_F401_28__all_multiple____init__.py.snap | 4 - ...in_body_after_double_shadowing_except.snap | 4 - ..._print_in_body_after_shadowing_except.snap | 2 - ..._tests__PLC0208_iteration_over_set.py.snap | 18 +-- ...nt__tests__PLE0241_duplicate_bases.py.snap | 16 --- ...s__PLE1141_dict_iter_missing_items.py.snap | 6 +- ..._tests__PLE2510_invalid_characters.py.snap | 6 - ..._tests__PLE2512_invalid_characters.py.snap | 8 -- ..._tests__PLE2513_invalid_characters.py.snap | 8 -- ..._tests__PLE2514_invalid_characters.py.snap | Bin 875 -> 781 bytes ..._tests__PLE2515_invalid_characters.py.snap | 18 +-- ...tests__PLR0202_no_method_decorator.py.snap | 4 - ...tests__PLR0203_no_method_decorator.py.snap | 6 +- ...nt__tests__PLR0402_import_aliasing.py.snap | 4 - ...int__tests__PLR1711_useless_return.py.snap | 12 -- ...nt__tests__PLR1730_if_stmt_min_max.py.snap | 42 ------ ...1733_unnecessary_dict_index_lookup.py.snap | 12 -- ...1736_unnecessary_list_index_lookup.py.snap | 18 --- ...lint__tests__PLR2044_empty_comment.py.snap | 14 -- ...tests__PLR5501_collapsible_else_if.py.snap | 14 -- ...ests__PLW0120_useless_else_on_loop.py.snap | 16 --- ...ts__PLW0245_super_without_brackets.py.snap | 4 +- ...W1510_subprocess_run_without_check.py.snap | 6 - ...er__rules__pyupgrade__tests__UP001.py.snap | 4 - ...er__rules__pyupgrade__tests__UP003.py.snap | 12 -- ...er__rules__pyupgrade__tests__UP004.py.snap | 48 ------- ...er__rules__pyupgrade__tests__UP005.py.snap | 8 -- ...__rules__pyupgrade__tests__UP006_0.py.snap | 26 ---- ...__rules__pyupgrade__tests__UP006_1.py.snap | 2 - ...__rules__pyupgrade__tests__UP006_3.py.snap | 2 - ...er__rules__pyupgrade__tests__UP007.py.snap | 36 ----- ...__rules__pyupgrade__tests__UP009_0.py.snap | 2 - ...__rules__pyupgrade__tests__UP009_1.py.snap | 2 - ...__rules__pyupgrade__tests__UP009_6.py.snap | 2 - ...__rules__pyupgrade__tests__UP009_7.py.snap | 2 - ...er__rules__pyupgrade__tests__UP010.py.snap | 20 --- ...er__rules__pyupgrade__tests__UP011.py.snap | 8 -- ...er__rules__pyupgrade__tests__UP012.py.snap | 54 -------- ...er__rules__pyupgrade__tests__UP013.py.snap | 24 ---- ...er__rules__pyupgrade__tests__UP014.py.snap | 10 -- ...er__rules__pyupgrade__tests__UP015.py.snap | 88 ------------- ...__rules__pyupgrade__tests__UP015_1.py.snap | 4 +- ...er__rules__pyupgrade__tests__UP018.py.snap | 38 ------ ...er__rules__pyupgrade__tests__UP019.py.snap | 8 -- ...er__rules__pyupgrade__tests__UP020.py.snap | 4 - ...er__rules__pyupgrade__tests__UP021.py.snap | 6 - ...er__rules__pyupgrade__tests__UP023.py.snap | 20 --- ...__rules__pyupgrade__tests__UP024_0.py.snap | 30 ----- ...__rules__pyupgrade__tests__UP024_1.py.snap | 6 - ...__rules__pyupgrade__tests__UP024_2.py.snap | 40 ------ ...__rules__pyupgrade__tests__UP024_4.py.snap | 2 - ...er__rules__pyupgrade__tests__UP025.py.snap | 30 ----- ...er__rules__pyupgrade__tests__UP026.py.snap | 52 -------- ...er__rules__pyupgrade__tests__UP027.py.snap | 10 -- ...__rules__pyupgrade__tests__UP032_0.py.snap | 124 ------------------ ...__rules__pyupgrade__tests__UP032_1.py.snap | 2 - ...__rules__pyupgrade__tests__UP032_2.py.snap | 44 ------- ...__rules__pyupgrade__tests__UP033_0.py.snap | 6 - ...__rules__pyupgrade__tests__UP033_1.py.snap | 6 - ...er__rules__pyupgrade__tests__UP034.py.snap | 20 --- ...er__rules__pyupgrade__tests__UP035.py.snap | 108 --------------- ...__rules__pyupgrade__tests__UP037_0.py.snap | 58 +------- ...__rules__pyupgrade__tests__UP037_1.py.snap | 4 +- ...er__rules__pyupgrade__tests__UP039.py.snap | 10 -- ...er__rules__pyupgrade__tests__UP040.py.snap | 10 -- ...r__rules__pyupgrade__tests__UP040.pyi.snap | 4 - ...er__rules__pyupgrade__tests__UP041.py.snap | 14 -- ...er__rules__pyupgrade__tests__UP043.py.snap | 10 +- ...timeout_error_alias_not_applied_py310.snap | 8 -- ...rade__tests__datetime_utc_alias_py311.snap | 8 -- ..._annotations_keep_runtime_typing_p310.snap | 8 -- ...sts__future_annotations_pep_585_py310.snap | 8 -- ...sts__future_annotations_pep_604_py310.snap | 4 - ...es__refurb__tests__FURB105_FURB105.py.snap | 36 +---- ...es__refurb__tests__FURB110_FURB110.py.snap | 14 -- ...es__refurb__tests__FURB116_FURB116.py.snap | 12 -- ...es__refurb__tests__FURB118_FURB118.py.snap | 64 --------- ...es__refurb__tests__FURB136_FURB136.py.snap | 18 --- ...es__refurb__tests__FURB140_FURB140.py.snap | 20 +-- ...es__refurb__tests__FURB142_FURB142.py.snap | 20 +-- ...es__refurb__tests__FURB145_FURB145.py.snap | 12 -- ...es__refurb__tests__FURB152_FURB152.py.snap | 30 ----- ...es__refurb__tests__FURB154_FURB154.py.snap | 24 ---- ...es__refurb__tests__FURB157_FURB157.py.snap | 16 --- ...es__refurb__tests__FURB161_FURB161.py.snap | 18 --- ...es__refurb__tests__FURB163_FURB163.py.snap | 16 --- ...es__refurb__tests__FURB164_FURB164.py.snap | 34 ----- ...es__refurb__tests__FURB167_FURB167.py.snap | 4 - ...es__refurb__tests__FURB168_FURB168.py.snap | 18 +-- ...es__refurb__tests__FURB169_FURB169.py.snap | 26 +--- ...es__refurb__tests__FURB171_FURB171.py.snap | 12 -- ...es__refurb__tests__FURB180_FURB180.py.snap | 10 +- ...es__refurb__tests__FURB192_FURB192.py.snap | 12 -- ..._rules__ruff__tests__RUF010_RUF010.py.snap | 26 +--- ..._rules__ruff__tests__RUF019_RUF019.py.snap | 12 -- ..._rules__ruff__tests__RUF020_RUF020.py.snap | 14 -- ..._rules__ruff__tests__RUF021_RUF021.py.snap | 24 ---- ..._rules__ruff__tests__RUF022_RUF022.py.snap | 64 --------- ..._rules__ruff__tests__RUF023_RUF023.py.snap | 40 ------ ..._rules__ruff__tests__RUF025_RUF025.py.snap | 22 ---- ..._rules__ruff__tests__RUF101_RUF101.py.snap | 14 -- ..._linter__rules__ruff__tests__ruf100_0.snap | 42 ------ ...__rules__ruff__tests__ruf100_0_prefix.snap | 40 ------ ..._linter__rules__ruff__tests__ruf100_1.snap | 16 --- ..._linter__rules__ruff__tests__ruf100_2.snap | 2 - ..._linter__rules__ruff__tests__ruf100_3.snap | 42 ------ ..._linter__rules__ruff__tests__ruf100_5.snap | 2 - ...rules__ruff__tests__ruff_noqa_invalid.snap | 2 - ..._error-instead-of-exception_TRY400.py.snap | 10 -- ...linter__linter__tests__import_sorting.snap | 8 -- ...er__linter__tests__ipy_escape_command.snap | 4 - 504 files changed, 54 insertions(+), 5690 deletions(-) diff --git a/crates/ruff/tests/integration_test.rs b/crates/ruff/tests/integration_test.rs index 02c93149486f3..25d8662df2722 100644 --- a/crates/ruff/tests/integration_test.rs +++ b/crates/ruff/tests/integration_test.rs @@ -124,8 +124,6 @@ fn stdin_error() { 1 |-import os - Run `ruff check --fix` to apply this fix. - Found 1 error. [*] 1 fixable with the `--fix` option. @@ -152,8 +150,6 @@ fn stdin_filename() { 1 |-import os - Run `ruff check --fix` to apply this fix. - Found 1 error. [*] 1 fixable with the `--fix` option. @@ -192,8 +188,6 @@ import bar # unused import 1 1 | 2 |-import bar # unused import - Run `ruff check --fix` to apply this fix. - foo.py:2:8: F401 [*] `foo` imported but unused | 2 | import foo # unused import @@ -204,8 +198,6 @@ import bar # unused import 1 1 | 2 |-import foo # unused import - Run `ruff check --fix` to apply this fix. - Found 2 errors. [*] 2 fixable with the `--fix` option. @@ -235,8 +227,6 @@ fn check_warn_stdin_filename_with_files() { 1 |-import os - Run `ruff check --fix` to apply this fix. - Found 1 error. [*] 1 fixable with the `--fix` option. @@ -265,8 +255,6 @@ fn stdin_source_type_py() { 1 |-import os - Run `ruff check --fix` to apply this fix. - Found 1 error. [*] 1 fixable with the `--fix` option. @@ -607,8 +595,6 @@ fn stdin_override_parser_ipynb() { 3 2 | print(1) 4 3 | - Run `ruff check --fix` to apply this fix. - Jupyter.py:cell 3:1:8: F401 [*] `sys` imported but unused | 1 | import sys @@ -621,8 +607,6 @@ fn stdin_override_parser_ipynb() { 3 2 | print(1) 4 3 | - Run `ruff check --fix` to apply this fix. - Found 2 errors. [*] 2 fixable with the `--fix` option. @@ -654,8 +638,6 @@ fn stdin_override_parser_py() { 1 |-import os - Run `ruff check --fix` to apply this fix. - Found 1 error. [*] 1 fixable with the `--fix` option. @@ -1548,8 +1530,6 @@ fn check_input_from_argfile() -> Result<()> { 1 |-import os - Run `ruff check --fix` to apply this fix. - Found 1 error. [*] 1 fixable with the `--fix` option. @@ -1573,8 +1553,6 @@ fn check_hints_hidden_unsafe_fixes() { -:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix. 1 |+# fix from stable-test-rule-safe-fix - Run `ruff check --fix` to apply this fix. - -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. Found 2 errors. @@ -1615,8 +1593,6 @@ fn check_no_hint_for_hidden_unsafe_fixes_when_disabled() { -:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix. 1 |+# fix from stable-test-rule-safe-fix - Run `ruff check --fix` to apply this fix. - -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. Found 2 errors. @@ -1658,8 +1634,6 @@ fn check_shows_unsafe_fixes_with_opt_in() { -:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix. 1 |+# fix from stable-test-rule-safe-fix - Run `ruff check --fix` to apply this fix. - -:1:1: RUF902 [*] Hey this is a stable test rule with an unsafe fix. Found 2 errors. @@ -1931,13 +1905,9 @@ extend-safe-fixes = ["RUF902"] -:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix. 1 |+# fix from stable-test-rule-safe-fix - Run `ruff check --fix` to apply this fix. - -:1:1: RUF902 [*] Hey this is a stable test rule with an unsafe fix. 1 |+# fix from stable-test-rule-unsafe-fix - Run `ruff check --fix` to apply this fix. - Found 2 errors. [*] 2 fixable with the `--fix` option. @@ -1973,8 +1943,6 @@ extend-safe-fixes = ["RUF902"] -:1:1: RUF901 [*] Hey this is a stable test rule with a safe fix. 1 |+# fix from stable-test-rule-safe-fix - Run `ruff check --fix` to apply this fix. - -:1:1: RUF902 Hey this is a stable test rule with an unsafe fix. Found 2 errors. @@ -2020,8 +1988,6 @@ extend-safe-fixes = ["RUF9"] 2 3 | print(('foo')) 3 4 | print(str('foo')) - Run `ruff check --fix` to apply this fix. - -:1:1: RUF903 Hey this is a stable test rule with a display only fix. -:1:1: RUF920 Hey this is a deprecated test rule. diff --git a/crates/ruff_linter/src/message/diff.rs b/crates/ruff_linter/src/message/diff.rs index bc1492b04ceee..4eefc37baf74b 100644 --- a/crates/ruff_linter/src/message/diff.rs +++ b/crates/ruff_linter/src/message/diff.rs @@ -118,12 +118,6 @@ impl Display for Diff<'_> { } } - // TODO: https://github.com/astral-sh/ruff/issues/12598 - match self.fix.applicability() { - Applicability::Safe => writeln!(f, "\n Run `ruff check --fix` to apply this fix.")?, - Applicability::Unsafe | Applicability::DisplayOnly => {} - }; - Ok(()) } } diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap index 72caee9131652..1c03be15c47b0 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__ASYNC115_ASYNC115.py.snap @@ -21,8 +21,6 @@ ASYNC115.py:5:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 7 7 | await trio.sleep(0, 1) # OK 8 8 | await trio.sleep(...) # OK - Run `ruff check --fix` to apply this fix. - ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 9 | await trio.sleep() # OK @@ -43,8 +41,6 @@ ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 13 13 | trio.sleep(foo) # OK 14 14 | trio.sleep(1) # OK - Run `ruff check --fix` to apply this fix. - ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 15 | time.sleep(0) # OK @@ -65,8 +61,6 @@ ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 19 19 | bar = "bar" 20 20 | trio.sleep(bar) - Run `ruff check --fix` to apply this fix. - ASYNC115.py:48:14: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 46 | import trio @@ -85,8 +79,6 @@ ASYNC115.py:48:14: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri 50 50 | 51 51 | from trio import Event, sleep - Run `ruff check --fix` to apply this fix. - ASYNC115.py:55:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 54 | def func(): @@ -109,8 +101,6 @@ ASYNC115.py:55:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 57 57 | 58 58 | async def func(): - Run `ruff check --fix` to apply this fix. - ASYNC115.py:59:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 58 | async def func(): @@ -136,5 +126,3 @@ ASYNC115.py:59:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri 60 60 | 61 61 | 62 62 | def func(): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC115_ASYNC115.py.snap b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC115_ASYNC115.py.snap index 669e6ec5247ab..c60b9de90e2f4 100644 --- a/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC115_ASYNC115.py.snap +++ b/crates/ruff_linter/src/rules/flake8_async/snapshots/ruff_linter__rules__flake8_async__tests__preview__ASYNC115_ASYNC115.py.snap @@ -21,8 +21,6 @@ ASYNC115.py:5:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 7 7 | await trio.sleep(0, 1) # OK 8 8 | await trio.sleep(...) # OK - Run `ruff check --fix` to apply this fix. - ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 9 | await trio.sleep() # OK @@ -43,8 +41,6 @@ ASYNC115.py:11:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 13 13 | trio.sleep(foo) # OK 14 14 | trio.sleep(1) # OK - Run `ruff check --fix` to apply this fix. - ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 15 | time.sleep(0) # OK @@ -65,8 +61,6 @@ ASYNC115.py:17:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 19 19 | bar = "bar" 20 20 | trio.sleep(bar) - Run `ruff check --fix` to apply this fix. - ASYNC115.py:48:14: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 46 | import trio @@ -85,8 +79,6 @@ ASYNC115.py:48:14: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri 50 50 | 51 51 | from trio import Event, sleep - Run `ruff check --fix` to apply this fix. - ASYNC115.py:55:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 54 | def func(): @@ -109,8 +101,6 @@ ASYNC115.py:55:5: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio 57 57 | 58 58 | async def func(): - Run `ruff check --fix` to apply this fix. - ASYNC115.py:59:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)` | 58 | async def func(): @@ -137,8 +127,6 @@ ASYNC115.py:59:11: ASYNC115 [*] Use `trio.lowlevel.checkpoint()` instead of `tri 61 61 | 62 62 | def func(): - Run `ruff check --fix` to apply this fix. - ASYNC115.py:85:11: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` | 83 | from anyio import sleep @@ -167,8 +155,6 @@ ASYNC115.py:85:11: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of ` 87 88 | await anyio.sleep(0, 1) # OK 88 89 | await anyio.sleep(...) # OK - Run `ruff check --fix` to apply this fix. - ASYNC115.py:91:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` | 89 | await anyio.sleep() # OK @@ -197,8 +183,6 @@ ASYNC115.py:91:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `a 93 94 | anyio.sleep(foo) # OK 94 95 | anyio.sleep(1) # OK - Run `ruff check --fix` to apply this fix. - ASYNC115.py:97:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` | 95 | time.sleep(0) # OK @@ -227,8 +211,6 @@ ASYNC115.py:97:5: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `a 99 100 | bar = "bar" 100 101 | anyio.sleep(bar) - Run `ruff check --fix` to apply this fix. - ASYNC115.py:128:15: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of `asyncio.sleep(0)` | 126 | import anyio @@ -254,5 +236,3 @@ ASYNC115.py:128:15: ASYNC115 [*] Use `asyncio.lowlevel.checkpoint()` instead of 129 130 | 130 131 | 131 132 | def func(): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B004_B004.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B004_B004.py.snap index 6e9c5a5686eb6..01071da0364b7 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B004_B004.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B004_B004.py.snap @@ -20,8 +20,6 @@ B004.py:3:8: B004 [*] Using `hasattr(x, "__call__")` to test if x is callable is 5 5 | if getattr(o, "__call__", False): 6 6 | print("Ooh, callable! Or is it?") - Run `ruff check --fix` to apply this fix. - B004.py:5:8: B004 Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results. | 3 | if hasattr(o, "__call__"): @@ -52,8 +50,6 @@ B004.py:12:8: B004 [*] Using `hasattr(x, "__call__")` to test if x is callable i 14 14 | if builtins.getattr(o, "__call__", False): 15 15 | print("B U G") - Run `ruff check --fix` to apply this fix. - B004.py:14:8: B004 Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results. | 12 | if builtins.hasattr(o, "__call__"): @@ -86,6 +82,4 @@ B004.py:24:8: B004 [*] Using `hasattr(x, "__call__")` to test if x is callable i 25 |+ if builtins.callable(o): 25 26 | print("STILL a bug!") 26 27 | -27 28 | - - Run `ruff check --fix` to apply this fix. +27 28 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap index a262f6884ae3b..4ccfc45f71e27 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap @@ -20,8 +20,6 @@ B009_B010.py:19:1: B009 [*] Do not call `getattr` with a constant attribute valu 21 21 | getattr(foo, "__123abc__") 22 22 | getattr(foo, "abc123") - Run `ruff check --fix` to apply this fix. - B009_B010.py:20:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 18 | # Invalid usage @@ -42,8 +40,6 @@ B009_B010.py:20:1: B009 [*] Do not call `getattr` with a constant attribute valu 22 22 | getattr(foo, "abc123") 23 23 | getattr(foo, r"abc123") - Run `ruff check --fix` to apply this fix. - B009_B010.py:21:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 19 | getattr(foo, "bar") @@ -64,8 +60,6 @@ B009_B010.py:21:1: B009 [*] Do not call `getattr` with a constant attribute valu 23 23 | getattr(foo, r"abc123") 24 24 | _ = lambda x: getattr(x, "bar") - Run `ruff check --fix` to apply this fix. - B009_B010.py:22:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 20 | getattr(foo, "_123abc") @@ -86,8 +80,6 @@ B009_B010.py:22:1: B009 [*] Do not call `getattr` with a constant attribute valu 24 24 | _ = lambda x: getattr(x, "bar") 25 25 | if getattr(x, "bar"): - Run `ruff check --fix` to apply this fix. - B009_B010.py:23:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 21 | getattr(foo, "__123abc__") @@ -108,8 +100,6 @@ B009_B010.py:23:1: B009 [*] Do not call `getattr` with a constant attribute valu 25 25 | if getattr(x, "bar"): 26 26 | pass - Run `ruff check --fix` to apply this fix. - B009_B010.py:24:15: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 22 | getattr(foo, "abc123") @@ -130,8 +120,6 @@ B009_B010.py:24:15: B009 [*] Do not call `getattr` with a constant attribute val 26 26 | pass 27 27 | getattr(1, "real") - Run `ruff check --fix` to apply this fix. - B009_B010.py:25:4: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 23 | getattr(foo, r"abc123") @@ -152,8 +140,6 @@ B009_B010.py:25:4: B009 [*] Do not call `getattr` with a constant attribute valu 27 27 | getattr(1, "real") 28 28 | getattr(1., "real") - Run `ruff check --fix` to apply this fix. - B009_B010.py:27:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 25 | if getattr(x, "bar"): @@ -174,8 +160,6 @@ B009_B010.py:27:1: B009 [*] Do not call `getattr` with a constant attribute valu 29 29 | getattr(1.0, "real") 30 30 | getattr(1j, "real") - Run `ruff check --fix` to apply this fix. - B009_B010.py:28:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 26 | pass @@ -196,8 +180,6 @@ B009_B010.py:28:1: B009 [*] Do not call `getattr` with a constant attribute valu 30 30 | getattr(1j, "real") 31 31 | getattr(True, "real") - Run `ruff check --fix` to apply this fix. - B009_B010.py:29:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 27 | getattr(1, "real") @@ -218,8 +200,6 @@ B009_B010.py:29:1: B009 [*] Do not call `getattr` with a constant attribute valu 31 31 | getattr(True, "real") 32 32 | getattr(x := 1, "real") - Run `ruff check --fix` to apply this fix. - B009_B010.py:30:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 28 | getattr(1., "real") @@ -240,8 +220,6 @@ B009_B010.py:30:1: B009 [*] Do not call `getattr` with a constant attribute valu 32 32 | getattr(x := 1, "real") 33 33 | getattr(x + y, "real") - Run `ruff check --fix` to apply this fix. - B009_B010.py:31:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 29 | getattr(1.0, "real") @@ -262,8 +240,6 @@ B009_B010.py:31:1: B009 [*] Do not call `getattr` with a constant attribute valu 33 33 | getattr(x + y, "real") 34 34 | getattr("foo" - Run `ruff check --fix` to apply this fix. - B009_B010.py:32:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 30 | getattr(1j, "real") @@ -284,8 +260,6 @@ B009_B010.py:32:1: B009 [*] Do not call `getattr` with a constant attribute valu 34 34 | getattr("foo" 35 35 | "bar", "real") - Run `ruff check --fix` to apply this fix. - B009_B010.py:33:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 31 | getattr(True, "real") @@ -306,8 +280,6 @@ B009_B010.py:33:1: B009 [*] Do not call `getattr` with a constant attribute valu 35 35 | "bar", "real") 36 36 | - Run `ruff check --fix` to apply this fix. - B009_B010.py:34:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 32 | getattr(x := 1, "real") @@ -329,8 +301,6 @@ B009_B010.py:34:1: B009 [*] Do not call `getattr` with a constant attribute valu 37 37 | 38 38 | # Valid setattr usage - Run `ruff check --fix` to apply this fix. - B009_B010.py:58:8: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885 @@ -350,8 +320,6 @@ B009_B010.py:58:8: B009 [*] Do not call `getattr` with a constant attribute valu 60 60 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1732387247 61 61 | getattr(*foo, "bar") - Run `ruff check --fix` to apply this fix. - B009_B010.py:65:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 64 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1739800901 @@ -374,8 +342,6 @@ B009_B010.py:65:1: B009 [*] Do not call `getattr` with a constant attribute valu 68 68 | import builtins 69 69 | builtins.getattr(foo, "bar") - Run `ruff check --fix` to apply this fix. - B009_B010.py:69:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 68 | import builtins @@ -389,5 +355,3 @@ B009_B010.py:69:1: B009 [*] Do not call `getattr` with a constant attribute valu 68 68 | import builtins 69 |-builtins.getattr(foo, "bar") 69 |+foo.bar - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap index 5b71cec7aabb2..19b03198ecdb8 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap @@ -20,8 +20,6 @@ B009_B010.py:50:1: B010 [*] Do not call `setattr` with a constant attribute valu 52 52 | setattr(foo, "__123abc__", None) 53 53 | setattr(foo, "abc123", None) - Run `ruff check --fix` to apply this fix. - B009_B010.py:51:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 49 | # Invalid usage @@ -42,8 +40,6 @@ B009_B010.py:51:1: B010 [*] Do not call `setattr` with a constant attribute valu 53 53 | setattr(foo, "abc123", None) 54 54 | setattr(foo, r"abc123", None) - Run `ruff check --fix` to apply this fix. - B009_B010.py:52:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 50 | setattr(foo, "bar", None) @@ -64,8 +60,6 @@ B009_B010.py:52:1: B010 [*] Do not call `setattr` with a constant attribute valu 54 54 | setattr(foo, r"abc123", None) 55 55 | setattr(foo.bar, r"baz", None) - Run `ruff check --fix` to apply this fix. - B009_B010.py:53:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 51 | setattr(foo, "_123abc", None) @@ -86,8 +80,6 @@ B009_B010.py:53:1: B010 [*] Do not call `setattr` with a constant attribute valu 55 55 | setattr(foo.bar, r"baz", None) 56 56 | - Run `ruff check --fix` to apply this fix. - B009_B010.py:54:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 52 | setattr(foo, "__123abc__", None) @@ -107,8 +99,6 @@ B009_B010.py:54:1: B010 [*] Do not call `setattr` with a constant attribute valu 56 56 | 57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885 - Run `ruff check --fix` to apply this fix. - B009_B010.py:55:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 53 | setattr(foo, "abc123", None) @@ -128,5 +118,3 @@ B009_B010.py:55:1: B010 [*] Do not call `setattr` with a constant attribute valu 56 56 | 57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885 58 58 | assert getattr(func, '_rpc')is True - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B013_B013.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B013_B013.py.snap index 1bea9537622ea..262cfe4d49182 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B013_B013.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B013_B013.py.snap @@ -21,8 +21,6 @@ B013.py:5:8: B013 [*] A length-one tuple literal is redundant in exception handl 7 7 | except AttributeError: 8 8 | pass - Run `ruff check --fix` to apply this fix. - B013.py:13:7: B013 [*] A length-one tuple literal is redundant in exception handlers | 11 | except (*retriable_exceptions,): @@ -41,5 +39,3 @@ B013.py:13:7: B013 [*] A length-one tuple literal is redundant in exception hand 14 14 | pass 15 15 | 16 16 | list_exceptions = [FileExistsError, FileNotFoundError] - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B014_B014.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B014_B014.py.snap index 5e2b1af527249..11a9c258484fa 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B014_B014.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B014_B014.py.snap @@ -21,8 +21,6 @@ B014.py:17:8: B014 [*] Exception handler with duplicate exception: `OSError` 19 19 | pass 20 20 | - Run `ruff check --fix` to apply this fix. - B014.py:28:8: B014 [*] Exception handler with duplicate exception: `MyError` | 26 | try: @@ -43,8 +41,6 @@ B014.py:28:8: B014 [*] Exception handler with duplicate exception: `MyError` 30 30 | pass 31 31 | - Run `ruff check --fix` to apply this fix. - B014.py:49:8: B014 [*] Exception handler with duplicate exception: `re.error` | 47 | try: @@ -65,8 +61,6 @@ B014.py:49:8: B014 [*] Exception handler with duplicate exception: `re.error` 51 51 | pass 52 52 | - Run `ruff check --fix` to apply this fix. - B014.py:82:8: B014 [*] Exception handler with duplicate exception: `ValueError` | 80 | try: @@ -86,8 +80,6 @@ B014.py:82:8: B014 [*] Exception handler with duplicate exception: `ValueError` 84 84 | 85 85 | - Run `ruff check --fix` to apply this fix. - B014.py:89:7: B014 [*] Exception handler with duplicate exception: `re.error` | 87 | try: @@ -104,5 +96,3 @@ B014.py:89:7: B014 [*] Exception handler with duplicate exception: `re.error` 89 |-except(re.error, re.error): 89 |+except re.error: 90 90 | p - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap index 4cf1feae43625..e87ce710b14d9 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B033_B033.py.snap @@ -21,8 +21,6 @@ B033.py:4:35: B033 [*] Sets should not contain duplicate item `"value1"` 6 6 | incorrect_set_multiline = { 7 7 | "value1", - Run `ruff check --fix` to apply this fix. - B033.py:5:21: B033 [*] Sets should not contain duplicate item `1` | 3 | ### @@ -43,8 +41,6 @@ B033.py:5:21: B033 [*] Sets should not contain duplicate item `1` 7 7 | "value1", 8 8 | 23, - Run `ruff check --fix` to apply this fix. - B033.py:10:5: B033 [*] Sets should not contain duplicate item `"value1"` | 8 | 23, @@ -64,8 +60,6 @@ B033.py:10:5: B033 [*] Sets should not contain duplicate item `"value1"` 12 11 | } 13 12 | incorrect_set = {1, 1} - Run `ruff check --fix` to apply this fix. - B033.py:13:21: B033 [*] Sets should not contain duplicate item `1` | 11 | # B033 @@ -86,8 +80,6 @@ B033.py:13:21: B033 [*] Sets should not contain duplicate item `1` 15 15 | incorrect_set = {0, 1, 1,} 16 16 | incorrect_set = {0, 1, 1} - Run `ruff check --fix` to apply this fix. - B033.py:14:21: B033 [*] Sets should not contain duplicate item `1` | 12 | } @@ -108,8 +100,6 @@ B033.py:14:21: B033 [*] Sets should not contain duplicate item `1` 16 16 | incorrect_set = {0, 1, 1} 17 17 | incorrect_set = { - Run `ruff check --fix` to apply this fix. - B033.py:15:24: B033 [*] Sets should not contain duplicate item `1` | 13 | incorrect_set = {1, 1} @@ -130,8 +120,6 @@ B033.py:15:24: B033 [*] Sets should not contain duplicate item `1` 17 17 | incorrect_set = { 18 18 | 0, - Run `ruff check --fix` to apply this fix. - B033.py:16:24: B033 [*] Sets should not contain duplicate item `1` | 14 | incorrect_set = {1, 1,} @@ -152,8 +140,6 @@ B033.py:16:24: B033 [*] Sets should not contain duplicate item `1` 18 18 | 0, 19 19 | 1, - Run `ruff check --fix` to apply this fix. - B033.py:20:5: B033 [*] Sets should not contain duplicate item `1` | 18 | 0, @@ -171,5 +157,3 @@ B033.py:20:5: B033 [*] Sets should not contain duplicate item `1` 21 20 | } 22 21 | 23 22 | ### - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap index b266544baeb3e..d012b2da6d806 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B905.py.snap @@ -20,8 +20,6 @@ B905.py:4:1: B905 [*] `zip()` without an explicit `strict=` parameter 6 6 | zip("a", "b") 7 7 | zip("a", "b", *zip("c")) - Run `ruff check --fix` to apply this fix. - B905.py:5:1: B905 [*] `zip()` without an explicit `strict=` parameter | 3 | # Errors @@ -42,8 +40,6 @@ B905.py:5:1: B905 [*] `zip()` without an explicit `strict=` parameter 7 7 | zip("a", "b", *zip("c")) 8 8 | zip(zip("a"), strict=False) - Run `ruff check --fix` to apply this fix. - B905.py:6:1: B905 [*] `zip()` without an explicit `strict=` parameter | 4 | zip() @@ -64,8 +60,6 @@ B905.py:6:1: B905 [*] `zip()` without an explicit `strict=` parameter 8 8 | zip(zip("a"), strict=False) 9 9 | zip(zip("a", strict=True)) - Run `ruff check --fix` to apply this fix. - B905.py:7:1: B905 [*] `zip()` without an explicit `strict=` parameter | 5 | zip(range(3)) @@ -86,8 +80,6 @@ B905.py:7:1: B905 [*] `zip()` without an explicit `strict=` parameter 9 9 | zip(zip("a", strict=True)) 10 10 | - Run `ruff check --fix` to apply this fix. - B905.py:7:16: B905 [*] `zip()` without an explicit `strict=` parameter | 5 | zip(range(3)) @@ -108,8 +100,6 @@ B905.py:7:16: B905 [*] `zip()` without an explicit `strict=` parameter 9 9 | zip(zip("a", strict=True)) 10 10 | - Run `ruff check --fix` to apply this fix. - B905.py:8:5: B905 [*] `zip()` without an explicit `strict=` parameter | 6 | zip("a", "b") @@ -129,8 +119,6 @@ B905.py:8:5: B905 [*] `zip()` without an explicit `strict=` parameter 10 10 | 11 11 | # OK - Run `ruff check --fix` to apply this fix. - B905.py:9:1: B905 [*] `zip()` without an explicit `strict=` parameter | 7 | zip("a", "b", *zip("c")) @@ -151,8 +139,6 @@ B905.py:9:1: B905 [*] `zip()` without an explicit `strict=` parameter 11 11 | # OK 12 12 | zip(range(3), strict=True) - Run `ruff check --fix` to apply this fix. - B905.py:24:1: B905 [*] `zip()` without an explicit `strict=` parameter | 23 | # Errors (limited iterators). @@ -171,8 +157,6 @@ B905.py:24:1: B905 [*] `zip()` without an explicit `strict=` parameter 26 26 | 27 27 | import builtins - Run `ruff check --fix` to apply this fix. - B905.py:25:1: B905 [*] `zip()` without an explicit `strict=` parameter | 23 | # Errors (limited iterators). @@ -193,8 +177,6 @@ B905.py:25:1: B905 [*] `zip()` without an explicit `strict=` parameter 27 27 | import builtins 28 28 | # Still an error even though it uses the qualified name - Run `ruff check --fix` to apply this fix. - B905.py:29:1: B905 [*] `zip()` without an explicit `strict=` parameter | 27 | import builtins @@ -209,5 +191,3 @@ B905.py:29:1: B905 [*] `zip()` without an explicit `strict=` parameter 28 28 | # Still an error even though it uses the qualified name 29 |-builtins.zip([1, 2, 3]) 29 |+builtins.zip([1, 2, 3], strict=False) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81.py.snap b/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81.py.snap index c459f8a52772b..081880c12cf97 100644 --- a/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81.py.snap +++ b/crates/ruff_linter/src/rules/flake8_commas/snapshots/ruff_linter__rules__flake8_commas__tests__COM81.py.snap @@ -21,8 +21,6 @@ COM81.py:4:18: COM812 [*] Trailing comma missing 6 6 | # ==> bad_list.py <== 7 7 | bad_list = [ - Run `ruff check --fix` to apply this fix. - COM81.py:10:6: COM812 [*] Trailing comma missing | 8 | 1, @@ -42,8 +40,6 @@ COM81.py:10:6: COM812 [*] Trailing comma missing 12 12 | 13 13 | bad_list_with_comment = [ - Run `ruff check --fix` to apply this fix. - COM81.py:16:6: COM812 [*] Trailing comma missing | 14 | 1, @@ -64,8 +60,6 @@ COM81.py:16:6: COM812 [*] Trailing comma missing 18 18 | ] 19 19 | - Run `ruff check --fix` to apply this fix. - COM81.py:23:6: COM812 [*] Trailing comma missing | 21 | 1, @@ -84,8 +78,6 @@ COM81.py:23:6: COM812 [*] Trailing comma missing 25 25 | 26 26 | - Run `ruff check --fix` to apply this fix. - COM81.py:36:8: COM818 Trailing comma on bare tuple prohibited | 34 | foo = (1,) @@ -172,8 +164,6 @@ COM81.py:70:8: COM812 [*] Trailing comma missing 72 72 | 73 73 | {'foo': foo}['foo']( - Run `ruff check --fix` to apply this fix. - COM81.py:78:8: COM812 [*] Trailing comma missing | 77 | (foo)( @@ -192,8 +182,6 @@ COM81.py:78:8: COM812 [*] Trailing comma missing 80 80 | 81 81 | (foo)[0]( - Run `ruff check --fix` to apply this fix. - COM81.py:86:8: COM812 [*] Trailing comma missing | 85 | [foo][0]( @@ -212,8 +200,6 @@ COM81.py:86:8: COM812 [*] Trailing comma missing 88 88 | 89 89 | [foo][0]( - Run `ruff check --fix` to apply this fix. - COM81.py:152:6: COM812 [*] Trailing comma missing | 150 | # ==> keyword_before_parenth_form/base_bad.py <== @@ -233,8 +219,6 @@ COM81.py:152:6: COM812 [*] Trailing comma missing 154 154 | 155 155 | assert( - Run `ruff check --fix` to apply this fix. - COM81.py:158:11: COM812 [*] Trailing comma missing | 156 | SyntaxWarning, @@ -254,8 +238,6 @@ COM81.py:158:11: COM812 [*] Trailing comma missing 160 160 | 161 161 | # async await is fine outside an async def - Run `ruff check --fix` to apply this fix. - COM81.py:293:15: COM812 [*] Trailing comma missing | 291 | # ==> multiline_bad_dict.py <== @@ -276,8 +258,6 @@ COM81.py:293:15: COM812 [*] Trailing comma missing 295 295 | # ==> multiline_bad_function_def.py <== 296 296 | def func_good( - Run `ruff check --fix` to apply this fix. - COM81.py:304:14: COM812 [*] Trailing comma missing | 302 | def func_bad( @@ -298,8 +278,6 @@ COM81.py:304:14: COM812 [*] Trailing comma missing 306 306 | pass 307 307 | - Run `ruff check --fix` to apply this fix. - COM81.py:310:14: COM812 [*] Trailing comma missing | 308 | # ==> multiline_bad_function_one_param.py <== @@ -320,8 +298,6 @@ COM81.py:310:14: COM812 [*] Trailing comma missing 312 312 | pass 313 313 | - Run `ruff check --fix` to apply this fix. - COM81.py:316:10: COM812 [*] Trailing comma missing | 315 | func( @@ -340,8 +316,6 @@ COM81.py:316:10: COM812 [*] Trailing comma missing 318 318 | 319 319 | # ==> multiline_bad_or_dict.py <== - Run `ruff check --fix` to apply this fix. - COM81.py:322:15: COM812 [*] Trailing comma missing | 320 | multiline_bad_or_dict = { @@ -361,8 +335,6 @@ COM81.py:322:15: COM812 [*] Trailing comma missing 324 324 | 325 325 | # ==> multiline_good_dict.py <== - Run `ruff check --fix` to apply this fix. - COM81.py:368:15: COM812 [*] Trailing comma missing | 366 | multiline_index_access[ @@ -382,8 +354,6 @@ COM81.py:368:15: COM812 [*] Trailing comma missing 370 370 | 371 371 | multiline_index_access[ - Run `ruff check --fix` to apply this fix. - COM81.py:375:15: COM812 [*] Trailing comma missing | 373 | "fine", @@ -403,8 +373,6 @@ COM81.py:375:15: COM812 [*] Trailing comma missing 377 377 | 378 378 | # ==> multiline_string.py <== - Run `ruff check --fix` to apply this fix. - COM81.py:404:15: COM812 [*] Trailing comma missing | 402 | "fine" @@ -424,8 +392,6 @@ COM81.py:404:15: COM812 [*] Trailing comma missing 406 406 | 407 407 | multiline_index_access[ - Run `ruff check --fix` to apply this fix. - COM81.py:432:15: COM812 [*] Trailing comma missing | 430 | : @@ -445,8 +411,6 @@ COM81.py:432:15: COM812 [*] Trailing comma missing 434 434 | 435 435 | multiline_index_access[ - Run `ruff check --fix` to apply this fix. - COM81.py:485:21: COM819 [*] Trailing comma prohibited | 484 | # ==> prohibited.py <== @@ -466,8 +430,6 @@ COM81.py:485:21: COM819 [*] Trailing comma prohibited 487 487 | bar = { a: b,} 488 488 | - Run `ruff check --fix` to apply this fix. - COM81.py:487:13: COM819 [*] Trailing comma prohibited | 485 | foo = ['a', 'b', 'c',] @@ -488,8 +450,6 @@ COM81.py:487:13: COM819 [*] Trailing comma prohibited 489 489 | def bah(ham, spam,): 490 490 | pass - Run `ruff check --fix` to apply this fix. - COM81.py:489:18: COM819 [*] Trailing comma prohibited | 487 | bar = { a: b,} @@ -509,8 +469,6 @@ COM81.py:489:18: COM819 [*] Trailing comma prohibited 491 491 | 492 492 | (0,) - Run `ruff check --fix` to apply this fix. - COM81.py:494:6: COM819 [*] Trailing comma prohibited | 492 | (0,) @@ -531,8 +489,6 @@ COM81.py:494:6: COM819 [*] Trailing comma prohibited 496 496 | foo = ['a', 'b', 'c', ] 497 497 | - Run `ruff check --fix` to apply this fix. - COM81.py:496:21: COM819 [*] Trailing comma prohibited | 494 | (0, 1,) @@ -553,8 +509,6 @@ COM81.py:496:21: COM819 [*] Trailing comma prohibited 498 498 | bar = { a: b, } 499 499 | - Run `ruff check --fix` to apply this fix. - COM81.py:498:13: COM819 [*] Trailing comma prohibited | 496 | foo = ['a', 'b', 'c', ] @@ -575,8 +529,6 @@ COM81.py:498:13: COM819 [*] Trailing comma prohibited 500 500 | def bah(ham, spam, ): 501 501 | pass - Run `ruff check --fix` to apply this fix. - COM81.py:500:18: COM819 [*] Trailing comma prohibited | 498 | bar = { a: b, } @@ -596,8 +548,6 @@ COM81.py:500:18: COM819 [*] Trailing comma prohibited 502 502 | 503 503 | (0, ) - Run `ruff check --fix` to apply this fix. - COM81.py:505:6: COM819 [*] Trailing comma prohibited | 503 | (0, ) @@ -618,8 +568,6 @@ COM81.py:505:6: COM819 [*] Trailing comma prohibited 507 507 | image[:, :, 0] 508 508 | - Run `ruff check --fix` to apply this fix. - COM81.py:511:10: COM819 [*] Trailing comma prohibited | 509 | image[:,] @@ -640,8 +588,6 @@ COM81.py:511:10: COM819 [*] Trailing comma prohibited 513 513 | lambda x, : x 514 514 | - Run `ruff check --fix` to apply this fix. - COM81.py:513:9: COM819 [*] Trailing comma prohibited | 511 | image[:,:,] @@ -662,8 +608,6 @@ COM81.py:513:9: COM819 [*] Trailing comma prohibited 515 515 | # ==> unpack.py <== 516 516 | def function( - Run `ruff check --fix` to apply this fix. - COM81.py:519:13: COM812 [*] Trailing comma missing | 517 | foo, @@ -684,8 +628,6 @@ COM81.py:519:13: COM812 [*] Trailing comma missing 521 521 | pass 522 522 | - Run `ruff check --fix` to apply this fix. - COM81.py:526:10: COM812 [*] Trailing comma missing | 524 | foo, @@ -706,8 +648,6 @@ COM81.py:526:10: COM812 [*] Trailing comma missing 528 528 | pass 529 529 | - Run `ruff check --fix` to apply this fix. - COM81.py:534:16: COM812 [*] Trailing comma missing | 532 | bar, @@ -728,8 +668,6 @@ COM81.py:534:16: COM812 [*] Trailing comma missing 536 536 | pass 537 537 | - Run `ruff check --fix` to apply this fix. - COM81.py:541:13: COM812 [*] Trailing comma missing | 539 | foo, @@ -749,8 +687,6 @@ COM81.py:541:13: COM812 [*] Trailing comma missing 543 543 | 544 544 | result = function( - Run `ruff check --fix` to apply this fix. - COM81.py:547:24: COM812 [*] Trailing comma missing | 545 | foo, @@ -770,8 +706,6 @@ COM81.py:547:24: COM812 [*] Trailing comma missing 549 549 | 550 550 | def foo( - Run `ruff check --fix` to apply this fix. - COM81.py:554:15: COM812 [*] Trailing comma missing | 552 | spam, @@ -792,8 +726,6 @@ COM81.py:554:15: COM812 [*] Trailing comma missing 556 556 | pass 557 557 | - Run `ruff check --fix` to apply this fix. - COM81.py:561:13: COM812 [*] Trailing comma missing | 560 | foo( @@ -812,8 +744,6 @@ COM81.py:561:13: COM812 [*] Trailing comma missing 563 563 | 564 564 | { - Run `ruff check --fix` to apply this fix. - COM81.py:565:13: COM812 [*] Trailing comma missing | 564 | { @@ -832,8 +762,6 @@ COM81.py:565:13: COM812 [*] Trailing comma missing 567 567 | 568 568 | { - Run `ruff check --fix` to apply this fix. - COM81.py:569:10: COM812 [*] Trailing comma missing | 568 | { @@ -852,8 +780,6 @@ COM81.py:569:10: COM812 [*] Trailing comma missing 571 571 | 572 572 | [ - Run `ruff check --fix` to apply this fix. - COM81.py:573:10: COM812 [*] Trailing comma missing | 572 | [ @@ -872,8 +798,6 @@ COM81.py:573:10: COM812 [*] Trailing comma missing 575 575 | 576 576 | def foo( - Run `ruff check --fix` to apply this fix. - COM81.py:579:10: COM812 [*] Trailing comma missing | 577 | ham, @@ -894,8 +818,6 @@ COM81.py:579:10: COM812 [*] Trailing comma missing 581 581 | pass 582 582 | - Run `ruff check --fix` to apply this fix. - COM81.py:586:13: COM812 [*] Trailing comma missing | 584 | ham, @@ -916,8 +838,6 @@ COM81.py:586:13: COM812 [*] Trailing comma missing 588 588 | pass 589 589 | - Run `ruff check --fix` to apply this fix. - COM81.py:594:15: COM812 [*] Trailing comma missing | 592 | spam, @@ -938,8 +858,6 @@ COM81.py:594:15: COM812 [*] Trailing comma missing 596 596 | pass 597 597 | - Run `ruff check --fix` to apply this fix. - COM81.py:623:20: COM812 [*] Trailing comma missing | 621 | foo, @@ -959,8 +877,6 @@ COM81.py:623:20: COM812 [*] Trailing comma missing 625 625 | 626 626 | # Make sure the COM812 and UP034 rules don't fix simultaneously and cause a syntax error. - Run `ruff check --fix` to apply this fix. - COM81.py:628:42: COM812 [*] Trailing comma missing | 626 | # Make sure the COM812 and UP034 rules don't fix simultaneously and cause a syntax error. @@ -980,8 +896,6 @@ COM81.py:628:42: COM812 [*] Trailing comma missing 630 630 | 631 631 | foo = namedtuple( - Run `ruff check --fix` to apply this fix. - COM81.py:640:46: COM819 [*] Trailing comma prohibited | 639 | # F-strings @@ -1001,8 +915,6 @@ COM81.py:640:46: COM819 [*] Trailing comma prohibited 642 642 | raise Exception( 643 643 | "first", extra=f"Add trailing comma here ->" - Run `ruff check --fix` to apply this fix. - COM81.py:643:49: COM812 [*] Trailing comma missing | 642 | raise Exception( @@ -1020,5 +932,3 @@ COM81.py:643:49: COM812 [*] Trailing comma missing 644 644 | ) 645 645 | 646 646 | assert False, f"<- This is not a trailing comma" - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap index e0c95d3bdc3cb..e100579dc65cc 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap @@ -20,8 +20,6 @@ C413.py:3:1: C413 [*] Unnecessary `list` call around `sorted()` 5 5 | reversed(sorted(x, key=lambda e: e)) 6 6 | reversed(sorted(x, reverse=True)) - Run `ruff check --fix` to apply this fix. - C413.py:4:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 2 | list(x) diff --git a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_1.py.snap b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_1.py.snap index 29974dee8432a..742567ad3f743 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_1.py.snap @@ -10,5 +10,3 @@ EXE004_1.py:1:1: EXE004 [*] Avoid whitespace before shebang 1 |- #!/usr/bin/python 1 |+#!/usr/bin/python - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_4.py.snap b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_4.py.snap index 54bdb691235c6..a98b367a36adc 100644 --- a/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_executable/snapshots/ruff_linter__rules__flake8_executable__tests__EXE004_4.py.snap @@ -12,5 +12,3 @@ EXE004_4.py:1:1: EXE004 [*] Avoid whitespace before shebang 1 |- 2 |- #!/usr/bin/env python 1 |+#!/usr/bin/env python - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC.py.snap b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC.py.snap index 2542e832c2733..ff39e00ef5b03 100644 --- a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC.py.snap +++ b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__ISC001_ISC.py.snap @@ -16,8 +16,6 @@ ISC.py:1:5: ISC001 [*] Implicitly concatenated string literals on one line 3 3 | _ = "abc" + "def" 4 4 | - Run `ruff check --fix` to apply this fix. - ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line | 1 | _ = "a" "b" "c" @@ -33,8 +31,6 @@ ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line 3 3 | _ = "abc" + "def" 4 4 | - Run `ruff check --fix` to apply this fix. - ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line | 36 | ) @@ -55,8 +51,6 @@ ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line 40 40 | _ = """a 41 41 | b""" """c - Run `ruff check --fix` to apply this fix. - ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line | 38 | _ = """a""" """b""" @@ -80,8 +74,6 @@ ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line 43 43 | 44 44 | _ = f"""a""" f"""b""" - Run `ruff check --fix` to apply this fix. - ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line | 42 | d""" @@ -102,8 +94,6 @@ ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line 46 46 | _ = f"a" "b" 47 47 | - Run `ruff check --fix` to apply this fix. - ISC.py:46:5: ISC001 Implicitly concatenated string literals on one line | 44 | _ = f"""a""" f"""b""" @@ -157,8 +147,6 @@ ISC.py:52:5: ISC001 [*] Implicitly concatenated string literals on one line 54 54 | # Single-line explicit concatenation should be ignored. 55 55 | _ = "abc" + "def" + "ghi" - Run `ruff check --fix` to apply this fix. - ISC.py:64:10: ISC001 [*] Implicitly concatenated string literals on one line | 63 | # Multiple strings nested inside a f-string @@ -178,8 +166,6 @@ ISC.py:64:10: ISC001 [*] Implicitly concatenated string literals on one line 66 66 | _ = f"""abc { 67 67 | "def" - Run `ruff check --fix` to apply this fix. - ISC.py:64:14: ISC001 [*] Implicitly concatenated string literals on one line | 63 | # Multiple strings nested inside a f-string @@ -199,8 +185,6 @@ ISC.py:64:14: ISC001 [*] Implicitly concatenated string literals on one line 66 66 | _ = f"""abc { 67 67 | "def" - Run `ruff check --fix` to apply this fix. - ISC.py:65:14: ISC001 [*] Implicitly concatenated string literals on one line | 63 | # Multiple strings nested inside a f-string @@ -221,8 +205,6 @@ ISC.py:65:14: ISC001 [*] Implicitly concatenated string literals on one line 67 67 | "def" 68 68 | "ghi" - Run `ruff check --fix` to apply this fix. - ISC.py:72:5: ISC001 Implicitly concatenated string literals on one line | 71 | # Nested f-strings @@ -262,8 +244,6 @@ ISC.py:72:14: ISC001 [*] Implicitly concatenated string literals on one line 74 74 | _ = f"b {f"abc" \ 75 75 | f"def"} g" - Run `ruff check --fix` to apply this fix. - ISC.py:73:10: ISC001 [*] Implicitly concatenated string literals on one line | 71 | # Nested f-strings @@ -284,8 +264,6 @@ ISC.py:73:10: ISC001 [*] Implicitly concatenated string literals on one line 75 75 | f"def"} g" 76 76 | - Run `ruff check --fix` to apply this fix. - ISC.py:73:20: ISC001 [*] Implicitly concatenated string literals on one line | 71 | # Nested f-strings @@ -304,6 +282,4 @@ ISC.py:73:20: ISC001 [*] Implicitly concatenated string literals on one line 73 |+_ = f"b {f"c" f"d {f"ef"} g"} h" 74 74 | _ = f"b {f"abc" \ 75 75 | f"def"} g" -76 76 | - - Run `ruff check --fix` to apply this fix. +76 76 | diff --git a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC001_ISC.py.snap b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC001_ISC.py.snap index 2542e832c2733..ff39e00ef5b03 100644 --- a/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC001_ISC.py.snap +++ b/crates/ruff_linter/src/rules/flake8_implicit_str_concat/snapshots/ruff_linter__rules__flake8_implicit_str_concat__tests__multiline_ISC001_ISC.py.snap @@ -16,8 +16,6 @@ ISC.py:1:5: ISC001 [*] Implicitly concatenated string literals on one line 3 3 | _ = "abc" + "def" 4 4 | - Run `ruff check --fix` to apply this fix. - ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line | 1 | _ = "a" "b" "c" @@ -33,8 +31,6 @@ ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line 3 3 | _ = "abc" + "def" 4 4 | - Run `ruff check --fix` to apply this fix. - ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line | 36 | ) @@ -55,8 +51,6 @@ ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line 40 40 | _ = """a 41 41 | b""" """c - Run `ruff check --fix` to apply this fix. - ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line | 38 | _ = """a""" """b""" @@ -80,8 +74,6 @@ ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line 43 43 | 44 44 | _ = f"""a""" f"""b""" - Run `ruff check --fix` to apply this fix. - ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line | 42 | d""" @@ -102,8 +94,6 @@ ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line 46 46 | _ = f"a" "b" 47 47 | - Run `ruff check --fix` to apply this fix. - ISC.py:46:5: ISC001 Implicitly concatenated string literals on one line | 44 | _ = f"""a""" f"""b""" @@ -157,8 +147,6 @@ ISC.py:52:5: ISC001 [*] Implicitly concatenated string literals on one line 54 54 | # Single-line explicit concatenation should be ignored. 55 55 | _ = "abc" + "def" + "ghi" - Run `ruff check --fix` to apply this fix. - ISC.py:64:10: ISC001 [*] Implicitly concatenated string literals on one line | 63 | # Multiple strings nested inside a f-string @@ -178,8 +166,6 @@ ISC.py:64:10: ISC001 [*] Implicitly concatenated string literals on one line 66 66 | _ = f"""abc { 67 67 | "def" - Run `ruff check --fix` to apply this fix. - ISC.py:64:14: ISC001 [*] Implicitly concatenated string literals on one line | 63 | # Multiple strings nested inside a f-string @@ -199,8 +185,6 @@ ISC.py:64:14: ISC001 [*] Implicitly concatenated string literals on one line 66 66 | _ = f"""abc { 67 67 | "def" - Run `ruff check --fix` to apply this fix. - ISC.py:65:14: ISC001 [*] Implicitly concatenated string literals on one line | 63 | # Multiple strings nested inside a f-string @@ -221,8 +205,6 @@ ISC.py:65:14: ISC001 [*] Implicitly concatenated string literals on one line 67 67 | "def" 68 68 | "ghi" - Run `ruff check --fix` to apply this fix. - ISC.py:72:5: ISC001 Implicitly concatenated string literals on one line | 71 | # Nested f-strings @@ -262,8 +244,6 @@ ISC.py:72:14: ISC001 [*] Implicitly concatenated string literals on one line 74 74 | _ = f"b {f"abc" \ 75 75 | f"def"} g" - Run `ruff check --fix` to apply this fix. - ISC.py:73:10: ISC001 [*] Implicitly concatenated string literals on one line | 71 | # Nested f-strings @@ -284,8 +264,6 @@ ISC.py:73:10: ISC001 [*] Implicitly concatenated string literals on one line 75 75 | f"def"} g" 76 76 | - Run `ruff check --fix` to apply this fix. - ISC.py:73:20: ISC001 [*] Implicitly concatenated string literals on one line | 71 | # Nested f-strings @@ -304,6 +282,4 @@ ISC.py:73:20: ISC001 [*] Implicitly concatenated string literals on one line 73 |+_ = f"b {f"c" f"d {f"ef"} g"} h" 74 74 | _ = f"b {f"abc" \ 75 75 | f"def"} g" -76 76 | - - Run `ruff check --fix` to apply this fix. +76 76 | diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap index 8b2e653b497a0..066b523830237 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap @@ -20,8 +20,6 @@ LOG009.py:4:5: LOG009 [*] Use of undocumented `logging.WARN` constant 6 6 | 7 7 | - Run `ruff check --fix` to apply this fix. - LOG009.py:11:5: LOG009 [*] Use of undocumented `logging.WARN` constant | 9 | from logging import WARN, WARNING @@ -38,5 +36,3 @@ LOG009.py:11:5: LOG009 [*] Use of undocumented `logging.WARN` constant 11 |- WARN # LOG009 11 |+ WARNING # LOG009 12 12 | WARNING # OK - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G010.py.snap b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G010.py.snap index 7346affeab0d2..0aa7dc6864450 100644 --- a/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G010.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging_format/snapshots/ruff_linter__rules__flake8_logging_format__tests__G010.py.snap @@ -21,8 +21,6 @@ G010.py:6:9: G010 [*] Logging statement uses `warn` instead of `warning` 8 8 | logger.warn("Hello world!") 9 9 | - Run `ruff check --fix` to apply this fix. - G010.py:8:8: G010 [*] Logging statement uses `warn` instead of `warning` | 6 | logging.warn("Hello World!") @@ -43,8 +41,6 @@ G010.py:8:8: G010 [*] Logging statement uses `warn` instead of `warning` 10 10 | logging . warn("Hello World!") 11 11 | - Run `ruff check --fix` to apply this fix. - G010.py:10:11: G010 [*] Logging statement uses `warn` instead of `warning` | 8 | logger.warn("Hello world!") @@ -65,8 +61,6 @@ G010.py:10:11: G010 [*] Logging statement uses `warn` instead of `warning` 12 12 | from logging import warn, warning, exception 13 13 | warn("foo") - Run `ruff check --fix` to apply this fix. - G010.py:13:1: G010 [*] Logging statement uses `warn` instead of `warning` | 12 | from logging import warn, warning, exception @@ -84,5 +78,3 @@ G010.py:13:1: G010 [*] Logging statement uses `warn` instead of `warning` 14 13 | warning("foo") 14 |+warning("foo") 15 15 | exception("foo") - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE790_PIE790.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE790_PIE790.py.snap index 0a8fa25cc1cbd..100572a94e4be 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE790_PIE790.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE790_PIE790.py.snap @@ -18,8 +18,6 @@ PIE790.py:4:5: PIE790 [*] Unnecessary `pass` statement 6 5 | 7 6 | if foo: - Run `ruff check --fix` to apply this fix. - PIE790.py:9:5: PIE790 [*] Unnecessary `pass` statement | 7 | if foo: @@ -37,8 +35,6 @@ PIE790.py:9:5: PIE790 [*] Unnecessary `pass` statement 11 10 | 12 11 | def multi_statement() -> None: - Run `ruff check --fix` to apply this fix. - PIE790.py:14:5: PIE790 [*] Unnecessary `pass` statement | 12 | def multi_statement() -> None: @@ -57,8 +53,6 @@ PIE790.py:14:5: PIE790 [*] Unnecessary `pass` statement 16 16 | 17 17 | if foo: - Run `ruff check --fix` to apply this fix. - PIE790.py:21:5: PIE790 [*] Unnecessary `pass` statement | 19 | else: @@ -76,8 +70,6 @@ PIE790.py:21:5: PIE790 [*] Unnecessary `pass` statement 23 22 | 24 23 | while True: - Run `ruff check --fix` to apply this fix. - PIE790.py:28:5: PIE790 [*] Unnecessary `pass` statement | 26 | else: @@ -95,8 +87,6 @@ PIE790.py:28:5: PIE790 [*] Unnecessary `pass` statement 30 29 | 31 30 | for _ in range(10): - Run `ruff check --fix` to apply this fix. - PIE790.py:35:5: PIE790 [*] Unnecessary `pass` statement | 33 | else: @@ -114,8 +104,6 @@ PIE790.py:35:5: PIE790 [*] Unnecessary `pass` statement 37 36 | 38 37 | async for _ in range(10): - Run `ruff check --fix` to apply this fix. - PIE790.py:42:5: PIE790 [*] Unnecessary `pass` statement | 40 | else: @@ -133,8 +121,6 @@ PIE790.py:42:5: PIE790 [*] Unnecessary `pass` statement 44 43 | 45 44 | def foo() -> None: - Run `ruff check --fix` to apply this fix. - PIE790.py:50:5: PIE790 [*] Unnecessary `pass` statement | 48 | """ @@ -152,8 +138,6 @@ PIE790.py:50:5: PIE790 [*] Unnecessary `pass` statement 52 51 | 53 52 | async def foo(): - Run `ruff check --fix` to apply this fix. - PIE790.py:58:5: PIE790 [*] Unnecessary `pass` statement | 56 | """ @@ -171,8 +155,6 @@ PIE790.py:58:5: PIE790 [*] Unnecessary `pass` statement 60 59 | 61 60 | try: - Run `ruff check --fix` to apply this fix. - PIE790.py:65:5: PIE790 [*] Unnecessary `pass` statement | 63 | buzz @@ -192,8 +174,6 @@ PIE790.py:65:5: PIE790 [*] Unnecessary `pass` statement 67 66 | pass 68 67 | - Run `ruff check --fix` to apply this fix. - PIE790.py:74:5: PIE790 [*] Unnecessary `pass` statement | 72 | except ValueError: @@ -211,8 +191,6 @@ PIE790.py:74:5: PIE790 [*] Unnecessary `pass` statement 76 75 | 77 76 | for _ in range(10): - Run `ruff check --fix` to apply this fix. - PIE790.py:79:5: PIE790 [*] Unnecessary `pass` statement | 77 | for _ in range(10): @@ -232,8 +210,6 @@ PIE790.py:79:5: PIE790 [*] Unnecessary `pass` statement 81 80 | async for _ in range(10): 82 81 | """buzz""" - Run `ruff check --fix` to apply this fix. - PIE790.py:83:5: PIE790 [*] Unnecessary `pass` statement | 81 | async for _ in range(10): @@ -253,8 +229,6 @@ PIE790.py:83:5: PIE790 [*] Unnecessary `pass` statement 85 84 | while cond: 86 85 | """buzz""" - Run `ruff check --fix` to apply this fix. - PIE790.py:87:5: PIE790 [*] Unnecessary `pass` statement | 85 | while cond: @@ -272,8 +246,6 @@ PIE790.py:87:5: PIE790 [*] Unnecessary `pass` statement 89 88 | 90 89 | with bar: - Run `ruff check --fix` to apply this fix. - PIE790.py:92:5: PIE790 [*] Unnecessary `pass` statement | 90 | with bar: @@ -293,8 +265,6 @@ PIE790.py:92:5: PIE790 [*] Unnecessary `pass` statement 94 93 | async with bar: 95 94 | """buzz""" - Run `ruff check --fix` to apply this fix. - PIE790.py:96:5: PIE790 [*] Unnecessary `pass` statement | 94 | async with bar: @@ -312,8 +282,6 @@ PIE790.py:96:5: PIE790 [*] Unnecessary `pass` statement 98 97 | 99 98 | def foo() -> None: - Run `ruff check --fix` to apply this fix. - PIE790.py:101:5: PIE790 [*] Unnecessary `pass` statement | 99 | def foo() -> None: @@ -332,8 +300,6 @@ PIE790.py:101:5: PIE790 [*] Unnecessary `pass` statement 103 103 | 104 104 | class Foo: - Run `ruff check --fix` to apply this fix. - PIE790.py:130:5: PIE790 [*] Unnecessary `pass` statement | 128 | def foo(): @@ -351,8 +317,6 @@ PIE790.py:130:5: PIE790 [*] Unnecessary `pass` statement 132 131 | 133 132 | def foo(): - Run `ruff check --fix` to apply this fix. - PIE790.py:136:5: PIE790 [*] Unnecessary `pass` statement | 134 | """A docstring.""" @@ -370,8 +334,6 @@ PIE790.py:136:5: PIE790 [*] Unnecessary `pass` statement 138 137 | 139 138 | for i in range(10): - Run `ruff check --fix` to apply this fix. - PIE790.py:140:5: PIE790 [*] Unnecessary `pass` statement | 139 | for i in range(10): @@ -389,8 +351,6 @@ PIE790.py:140:5: PIE790 [*] Unnecessary `pass` statement 143 142 | for i in range(10): 144 143 | pass - Run `ruff check --fix` to apply this fix. - PIE790.py:141:5: PIE790 [*] Unnecessary `pass` statement | 139 | for i in range(10): @@ -410,8 +370,6 @@ PIE790.py:141:5: PIE790 [*] Unnecessary `pass` statement 143 142 | for i in range(10): 144 143 | pass - Run `ruff check --fix` to apply this fix. - PIE790.py:144:5: PIE790 [*] Unnecessary `pass` statement | 143 | for i in range(10): @@ -430,8 +388,6 @@ PIE790.py:144:5: PIE790 [*] Unnecessary `pass` statement 146 145 | pass 147 146 | - Run `ruff check --fix` to apply this fix. - PIE790.py:146:5: PIE790 [*] Unnecessary `pass` statement | 144 | pass @@ -451,8 +407,6 @@ PIE790.py:146:5: PIE790 [*] Unnecessary `pass` statement 148 147 | for i in range(10): 149 148 | pass # comment - Run `ruff check --fix` to apply this fix. - PIE790.py:149:5: PIE790 [*] Unnecessary `pass` statement | 148 | for i in range(10): @@ -471,8 +425,6 @@ PIE790.py:149:5: PIE790 [*] Unnecessary `pass` statement 151 151 | 152 152 | - Run `ruff check --fix` to apply this fix. - PIE790.py:150:5: PIE790 [*] Unnecessary `pass` statement | 148 | for i in range(10): @@ -490,8 +442,6 @@ PIE790.py:150:5: PIE790 [*] Unnecessary `pass` statement 152 151 | 153 152 | def foo(): - Run `ruff check --fix` to apply this fix. - PIE790.py:155:5: PIE790 [*] Unnecessary `...` literal | 153 | def foo(): @@ -509,8 +459,6 @@ PIE790.py:155:5: PIE790 [*] Unnecessary `...` literal 157 156 | 158 157 | def foo(): - Run `ruff check --fix` to apply this fix. - PIE790.py:161:5: PIE790 [*] Unnecessary `...` literal | 159 | """A docstring.""" @@ -528,8 +476,6 @@ PIE790.py:161:5: PIE790 [*] Unnecessary `...` literal 163 162 | 164 163 | for i in range(10): - Run `ruff check --fix` to apply this fix. - PIE790.py:165:5: PIE790 [*] Unnecessary `...` literal | 164 | for i in range(10): @@ -547,8 +493,6 @@ PIE790.py:165:5: PIE790 [*] Unnecessary `...` literal 168 167 | for i in range(10): 169 168 | ... - Run `ruff check --fix` to apply this fix. - PIE790.py:166:5: PIE790 [*] Unnecessary `...` literal | 164 | for i in range(10): @@ -568,8 +512,6 @@ PIE790.py:166:5: PIE790 [*] Unnecessary `...` literal 168 167 | for i in range(10): 169 168 | ... - Run `ruff check --fix` to apply this fix. - PIE790.py:169:5: PIE790 [*] Unnecessary `...` literal | 168 | for i in range(10): @@ -588,8 +530,6 @@ PIE790.py:169:5: PIE790 [*] Unnecessary `...` literal 171 170 | ... 172 171 | - Run `ruff check --fix` to apply this fix. - PIE790.py:171:5: PIE790 [*] Unnecessary `...` literal | 169 | ... @@ -609,8 +549,6 @@ PIE790.py:171:5: PIE790 [*] Unnecessary `...` literal 173 172 | for i in range(10): 174 173 | ... # comment - Run `ruff check --fix` to apply this fix. - PIE790.py:174:5: PIE790 [*] Unnecessary `...` literal | 173 | for i in range(10): @@ -629,8 +567,6 @@ PIE790.py:174:5: PIE790 [*] Unnecessary `...` literal 176 176 | 177 177 | for i in range(10): - Run `ruff check --fix` to apply this fix. - PIE790.py:175:5: PIE790 [*] Unnecessary `...` literal | 173 | for i in range(10): @@ -650,8 +586,6 @@ PIE790.py:175:5: PIE790 [*] Unnecessary `...` literal 177 176 | for i in range(10): 178 177 | ... - Run `ruff check --fix` to apply this fix. - PIE790.py:178:5: PIE790 [*] Unnecessary `...` literal | 177 | for i in range(10): @@ -669,8 +603,6 @@ PIE790.py:178:5: PIE790 [*] Unnecessary `...` literal 180 179 | 181 180 | from typing import Protocol - Run `ruff check --fix` to apply this fix. - PIE790.py:179:5: PIE790 [*] Unnecessary `pass` statement | 177 | for i in range(10): @@ -690,8 +622,6 @@ PIE790.py:179:5: PIE790 [*] Unnecessary `pass` statement 181 180 | from typing import Protocol 182 181 | - Run `ruff check --fix` to apply this fix. - PIE790.py:209:9: PIE790 [*] Unnecessary `...` literal | 207 | def stub(self) -> str: @@ -708,5 +638,3 @@ PIE790.py:209:9: PIE790 [*] Unnecessary `...` literal 210 209 | 211 210 | 212 211 | class Repro(Protocol[int]): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap index 2a8365037de89..1f0fac5892049 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE800_PIE800.py.snap @@ -16,8 +16,6 @@ PIE800.py:1:14: PIE800 [*] Unnecessary spread `**` 3 3 | {**{"bar": 10}, "a": "b"} # PIE800 4 4 | - Run `ruff check --fix` to apply this fix. - PIE800.py:3:4: PIE800 [*] Unnecessary spread `**` | 1 | {"foo": 1, **{"bar": 1}} # PIE800 @@ -37,8 +35,6 @@ PIE800.py:3:4: PIE800 [*] Unnecessary spread `**` 5 5 | foo({**foo, **{"bar": True}}) # PIE800 6 6 | - Run `ruff check --fix` to apply this fix. - PIE800.py:5:15: PIE800 [*] Unnecessary spread `**` | 3 | {**{"bar": 10}, "a": "b"} # PIE800 @@ -59,8 +55,6 @@ PIE800.py:5:15: PIE800 [*] Unnecessary spread `**` 7 7 | {**foo, **{"bar": 10}} # PIE800 8 8 | - Run `ruff check --fix` to apply this fix. - PIE800.py:7:11: PIE800 [*] Unnecessary spread `**` | 5 | foo({**foo, **{"bar": True}}) # PIE800 @@ -81,8 +75,6 @@ PIE800.py:7:11: PIE800 [*] Unnecessary spread `**` 9 9 | { # PIE800 10 10 | "a": "b", - Run `ruff check --fix` to apply this fix. - PIE800.py:12:7: PIE800 [*] Unnecessary spread `**` | 10 | "a": "b", @@ -113,8 +105,6 @@ PIE800.py:12:7: PIE800 [*] Unnecessary spread `**` 18 18 | 19 19 | {**foo, **buzz, **{bar: 10}} # PIE800 - Run `ruff check --fix` to apply this fix. - PIE800.py:19:19: PIE800 [*] Unnecessary spread `**` | 17 | } @@ -133,6 +123,4 @@ PIE800.py:19:19: PIE800 [*] Unnecessary spread `**` 19 |+{**foo, **buzz, bar: 10} # PIE800 20 20 | 21 21 | {**foo, "bar": True } # OK -22 22 | - - Run `ruff check --fix` to apply this fix. +22 22 | diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE804_PIE804.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE804_PIE804.py.snap index af5e70204584a..d9313e0f9455d 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE804_PIE804.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE804_PIE804.py.snap @@ -16,8 +16,6 @@ PIE804.py:1:5: PIE804 [*] Unnecessary `dict` kwargs 3 3 | foo(**{"r2d2": True}) # PIE804 4 4 | - Run `ruff check --fix` to apply this fix. - PIE804.py:3:5: PIE804 [*] Unnecessary `dict` kwargs | 1 | foo(**{"bar": True}) # PIE804 @@ -37,8 +35,6 @@ PIE804.py:3:5: PIE804 [*] Unnecessary `dict` kwargs 5 5 | Foo.objects.create(**{"bar": True}) # PIE804 6 6 | - Run `ruff check --fix` to apply this fix. - PIE804.py:5:20: PIE804 [*] Unnecessary `dict` kwargs | 3 | foo(**{"r2d2": True}) # PIE804 @@ -59,8 +55,6 @@ PIE804.py:5:20: PIE804 [*] Unnecessary `dict` kwargs 7 7 | Foo.objects.create(**{"_id": some_id}) # PIE804 8 8 | - Run `ruff check --fix` to apply this fix. - PIE804.py:7:20: PIE804 [*] Unnecessary `dict` kwargs | 5 | Foo.objects.create(**{"bar": True}) # PIE804 @@ -81,8 +75,6 @@ PIE804.py:7:20: PIE804 [*] Unnecessary `dict` kwargs 9 9 | Foo.objects.create(**{**bar}) # PIE804 10 10 | - Run `ruff check --fix` to apply this fix. - PIE804.py:9:20: PIE804 [*] Unnecessary `dict` kwargs | 7 | Foo.objects.create(**{"_id": some_id}) # PIE804 @@ -103,8 +95,6 @@ PIE804.py:9:20: PIE804 [*] Unnecessary `dict` kwargs 11 11 | foo(**{}) 12 12 | - Run `ruff check --fix` to apply this fix. - PIE804.py:11:5: PIE804 [*] Unnecessary `dict` kwargs | 9 | Foo.objects.create(**{**bar}) # PIE804 @@ -125,8 +115,6 @@ PIE804.py:11:5: PIE804 [*] Unnecessary `dict` kwargs 13 13 | foo(**{**data, "foo": "buzz"}) 14 14 | foo(**buzz) - Run `ruff check --fix` to apply this fix. - PIE804.py:22:5: PIE804 [*] Unnecessary `dict` kwargs | 20 | foo(**{f"buzz__{bar}": True}) @@ -147,8 +135,6 @@ PIE804.py:22:5: PIE804 [*] Unnecessary `dict` kwargs 24 24 | # Duplicated key names won't be fixed, to avoid syntax errors. 25 25 | abc(**{'a': b}, **{'a': c}) # PIE804 - Run `ruff check --fix` to apply this fix. - PIE804.py:25:5: PIE804 Unnecessary `dict` kwargs | 24 | # Duplicated key names won't be fixed, to avoid syntax errors. @@ -198,8 +184,6 @@ PIE804.py:26:22: PIE804 [*] Unnecessary `dict` kwargs 28 28 | # Some values need to be parenthesized. 29 29 | abc(foo=1, **{'bar': (bar := 1)}) # PIE804 - Run `ruff check --fix` to apply this fix. - PIE804.py:29:12: PIE804 [*] Unnecessary `dict` kwargs | 28 | # Some values need to be parenthesized. @@ -216,8 +200,6 @@ PIE804.py:29:12: PIE804 [*] Unnecessary `dict` kwargs 29 |+abc(foo=1, bar=(bar := 1)) # PIE804 30 30 | abc(foo=1, **{'bar': (yield 1)}) # PIE804 - Run `ruff check --fix` to apply this fix. - PIE804.py:30:12: PIE804 [*] Unnecessary `dict` kwargs | 28 | # Some values need to be parenthesized. @@ -232,5 +214,3 @@ PIE804.py:30:12: PIE804 [*] Unnecessary `dict` kwargs 29 29 | abc(foo=1, **{'bar': (bar := 1)}) # PIE804 30 |-abc(foo=1, **{'bar': (yield 1)}) # PIE804 30 |+abc(foo=1, bar=(yield 1)) # PIE804 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE807_PIE807.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE807_PIE807.py.snap index ab4880a625d6a..f56b215fbf3d6 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE807_PIE807.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE807_PIE807.py.snap @@ -19,8 +19,6 @@ PIE807.py:3:44: PIE807 [*] Prefer `list` over useless lambda 5 5 | 6 6 | - Run `ruff check --fix` to apply this fix. - PIE807.py:4:49: PIE807 [*] Prefer `dict` over useless lambda | 2 | class Foo: @@ -39,8 +37,6 @@ PIE807.py:4:49: PIE807 [*] Prefer `dict` over useless lambda 6 6 | 7 7 | class FooTable(BaseTable): - Run `ruff check --fix` to apply this fix. - PIE807.py:8:36: PIE807 [*] Prefer `list` over useless lambda | 7 | class FooTable(BaseTable): @@ -59,8 +55,6 @@ PIE807.py:8:36: PIE807 [*] Prefer `list` over useless lambda 10 10 | 11 11 | - Run `ruff check --fix` to apply this fix. - PIE807.py:9:36: PIE807 [*] Prefer `dict` over useless lambda | 7 | class FooTable(BaseTable): @@ -79,8 +73,6 @@ PIE807.py:9:36: PIE807 [*] Prefer `dict` over useless lambda 11 11 | 12 12 | class FooTable(BaseTable): - Run `ruff check --fix` to apply this fix. - PIE807.py:13:28: PIE807 [*] Prefer `list` over useless lambda | 12 | class FooTable(BaseTable): @@ -99,8 +91,6 @@ PIE807.py:13:28: PIE807 [*] Prefer `list` over useless lambda 15 15 | 16 16 | - Run `ruff check --fix` to apply this fix. - PIE807.py:14:36: PIE807 [*] Prefer `dict` over useless lambda | 12 | class FooTable(BaseTable): @@ -118,5 +108,3 @@ PIE807.py:14:36: PIE807 [*] Prefer `dict` over useless lambda 15 15 | 16 16 | 17 17 | @dataclass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE808_PIE808.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE808_PIE808.py.snap index efdc6cfafa5ea..df1d9306e6614 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE808_PIE808.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE808_PIE808.py.snap @@ -18,8 +18,6 @@ PIE808.py:2:7: PIE808 [*] Unnecessary `start` argument in `range` 4 4 | import builtins 5 5 | builtins.range(0, 10) - Run `ruff check --fix` to apply this fix. - PIE808.py:5:16: PIE808 [*] Unnecessary `start` argument in `range` | 4 | import builtins @@ -38,5 +36,3 @@ PIE808.py:5:16: PIE808 [*] Unnecessary `start` argument in `range` 6 6 | 7 7 | # OK 8 8 | range(x, 10) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI009_PYI009.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI009_PYI009.pyi.snap index c10f70efeae25..8a5513dfc82b5 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI009_PYI009.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI009_PYI009.pyi.snap @@ -20,8 +20,6 @@ PYI009.pyi:3:5: PYI009 [*] Empty body should contain `...`, not `pass` 5 5 | class Bar: ... # OK 6 6 | - Run `ruff check --fix` to apply this fix. - PYI009.pyi:8:5: PYI009 [*] Empty body should contain `...`, not `pass` | 7 | class Foo: @@ -35,5 +33,3 @@ PYI009.pyi:8:5: PYI009 [*] Empty body should contain `...`, not `pass` 7 7 | class Foo: 8 |- pass # ERROR PYI009, since we're in a stub file 8 |+ ... # ERROR PYI009, since we're in a stub file - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap index 30ad8c8834bef..bc77a0675ffe0 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap @@ -20,8 +20,6 @@ PYI010.pyi:6:5: PYI010 [*] Function body must contain only `...` 8 8 | def foo2(): 9 9 | 123 # ERROR PYI010 - Run `ruff check --fix` to apply this fix. - PYI010.pyi:9:5: PYI010 [*] Function body must contain only `...` | 8 | def foo2(): @@ -41,8 +39,6 @@ PYI010.pyi:9:5: PYI010 [*] Function body must contain only `...` 11 11 | def bizz(): 12 12 | x = 123 # ERROR PYI010 - Run `ruff check --fix` to apply this fix. - PYI010.pyi:12:5: PYI010 [*] Function body must contain only `...` | 11 | def bizz(): @@ -61,5 +57,3 @@ PYI010.pyi:12:5: PYI010 [*] Function body must contain only `...` 13 13 | 14 14 | def foo3(): 15 15 | pass # OK, pass is handled by another rule - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap index d29d421cbd2de..9b8cc3a645886 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap @@ -21,8 +21,6 @@ PYI011.pyi:10:14: PYI011 [*] Only simple default values allowed for typed argume 12 12 | def f11(*, x: str = "x") -> None: ... # OK 13 13 | def f13( - Run `ruff check --fix` to apply this fix. - PYI011.pyi:38:9: PYI011 [*] Only simple default values allowed for typed arguments | 36 | x: dict[ @@ -50,8 +48,6 @@ PYI011.pyi:38:9: PYI011 [*] Only simple default values allowed for typed argumen 43 40 | def f153( 44 41 | x: list[ - Run `ruff check --fix` to apply this fix. - PYI011.pyi:46:9: PYI011 [*] Only simple default values allowed for typed arguments | 44 | x: list[ @@ -97,8 +93,6 @@ PYI011.pyi:46:9: PYI011 [*] Only simple default values allowed for typed argumen 60 48 | def f154( 61 49 | x: tuple[ - Run `ruff check --fix` to apply this fix. - PYI011.pyi:63:9: PYI011 [*] Only simple default values allowed for typed arguments | 61 | x: tuple[ @@ -126,8 +120,6 @@ PYI011.pyi:63:9: PYI011 [*] Only simple default values allowed for typed argumen 68 65 | def f141( 69 66 | x: list[ - Run `ruff check --fix` to apply this fix. - PYI011.pyi:71:9: PYI011 [*] Only simple default values allowed for typed arguments | 69 | x: list[ @@ -153,8 +145,6 @@ PYI011.pyi:71:9: PYI011 [*] Only simple default values allowed for typed argumen 75 73 | def f142( 76 74 | x: list[ - Run `ruff check --fix` to apply this fix. - PYI011.pyi:78:9: PYI011 [*] Only simple default values allowed for typed arguments | 76 | x: list[ @@ -180,8 +170,6 @@ PYI011.pyi:78:9: PYI011 [*] Only simple default values allowed for typed argumen 82 80 | def f16( 83 81 | x: frozenset[ - Run `ruff check --fix` to apply this fix. - PYI011.pyi:85:9: PYI011 [*] Only simple default values allowed for typed arguments | 83 | x: frozenset[ @@ -207,8 +195,6 @@ PYI011.pyi:85:9: PYI011 [*] Only simple default values allowed for typed argumen 89 87 | def f17( 90 88 | x: str = "foo" # Error PYI011 Only simple default values allowed for typed arguments - Run `ruff check --fix` to apply this fix. - PYI011.pyi:90:14: PYI011 [*] Only simple default values allowed for typed arguments | 88 | ) -> None: ... @@ -232,8 +218,6 @@ PYI011.pyi:90:14: PYI011 [*] Only simple default values allowed for typed argume 93 92 | def f18( 94 93 | x: str = b"foo" # Error PYI011 Only simple default values allowed for typed arguments - Run `ruff check --fix` to apply this fix. - PYI011.pyi:94:14: PYI011 [*] Only simple default values allowed for typed arguments | 92 | ) -> None: ... @@ -257,8 +241,6 @@ PYI011.pyi:94:14: PYI011 [*] Only simple default values allowed for typed argume 97 96 | def f19( 98 97 | x: object = "foo" # Error PYI011 Only simple default values allowed for typed arguments - Run `ruff check --fix` to apply this fix. - PYI011.pyi:98:17: PYI011 [*] Only simple default values allowed for typed arguments | 96 | ) -> None: ... @@ -282,8 +264,6 @@ PYI011.pyi:98:17: PYI011 [*] Only simple default values allowed for typed argume 101 100 | def f20( 102 101 | x: int = 5 - Run `ruff check --fix` to apply this fix. - PYI011.pyi:102:14: PYI011 [*] Only simple default values allowed for typed arguments | 100 | ) -> None: ... @@ -307,8 +287,6 @@ PYI011.pyi:102:14: PYI011 [*] Only simple default values allowed for typed argum 105 104 | def f21( 106 105 | x: complex = 3j - Run `ruff check --fix` to apply this fix. - PYI011.pyi:106:18: PYI011 [*] Only simple default values allowed for typed arguments | 104 | ) -> None: ... @@ -332,8 +310,6 @@ PYI011.pyi:106:18: PYI011 [*] Only simple default values allowed for typed argum 109 108 | def f22( 110 109 | x: complex = -42.5j # Error PYI011 Only simple default values allowed for typed arguments - Run `ruff check --fix` to apply this fix. - PYI011.pyi:110:18: PYI011 [*] Only simple default values allowed for typed arguments | 108 | ) -> None: ... @@ -357,8 +333,6 @@ PYI011.pyi:110:18: PYI011 [*] Only simple default values allowed for typed argum 113 112 | def f23( 114 113 | x: bool = True, # OK - Run `ruff check --fix` to apply this fix. - PYI011.pyi:138:16: PYI011 [*] Only simple default values allowed for typed arguments | 136 | ) -> None: ... @@ -379,8 +353,6 @@ PYI011.pyi:138:16: PYI011 [*] Only simple default values allowed for typed argum 140 140 | def f32( 141 141 | x: float = np.inf, # Error PYI011 Only simple default values allowed for typed arguments - Run `ruff check --fix` to apply this fix. - PYI011.pyi:141:16: PYI011 [*] Only simple default values allowed for typed arguments | 139 | ) -> None: ... @@ -401,8 +373,6 @@ PYI011.pyi:141:16: PYI011 [*] Only simple default values allowed for typed argum 143 143 | def f33( 144 144 | x: float = math.nan, # OK - Run `ruff check --fix` to apply this fix. - PYI011.pyi:147:16: PYI011 [*] Only simple default values allowed for typed arguments | 145 | ) -> None: ... @@ -423,8 +393,6 @@ PYI011.pyi:147:16: PYI011 [*] Only simple default values allowed for typed argum 149 149 | def f35( 150 150 | x: complex = math.inf # Error PYI011 Only simple default values allowed for typed arguments - Run `ruff check --fix` to apply this fix. - PYI011.pyi:150:18: PYI011 [*] Only simple default values allowed for typed arguments | 148 | ) -> None: ... @@ -448,8 +416,6 @@ PYI011.pyi:150:18: PYI011 [*] Only simple default values allowed for typed argum 153 152 | def f36( 154 153 | *, - Run `ruff check --fix` to apply this fix. - PYI011.pyi:159:14: PYI011 [*] Only simple default values allowed for typed arguments | 157 | def f37( @@ -469,5 +435,3 @@ PYI011.pyi:159:14: PYI011 [*] Only simple default values allowed for typed argum 160 |- + "", 159 |+ x: str = ..., 161 160 | ) -> None: ... - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI012_PYI012.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI012_PYI012.pyi.snap index e4323e3350593..1035e3f99f359 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI012_PYI012.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI012_PYI012.pyi.snap @@ -20,8 +20,6 @@ PYI012.pyi:5:5: PYI012 [*] Class body must not contain `pass` 7 6 | class OneAttributeClassRev: 8 7 | pass # PYI012 Class body must not contain `pass` - Run `ruff check --fix` to apply this fix. - PYI012.pyi:8:5: PYI012 [*] Class body must not contain `pass` | 7 | class OneAttributeClassRev: @@ -39,8 +37,6 @@ PYI012.pyi:8:5: PYI012 [*] Class body must not contain `pass` 10 9 | 11 10 | class DocstringClass: - Run `ruff check --fix` to apply this fix. - PYI012.pyi:16:5: PYI012 [*] Class body must not contain `pass` | 14 | """ @@ -60,8 +56,6 @@ PYI012.pyi:16:5: PYI012 [*] Class body must not contain `pass` 18 17 | class NonEmptyChild(Exception): 19 18 | value: int - Run `ruff check --fix` to apply this fix. - PYI012.pyi:20:5: PYI012 [*] Class body must not contain `pass` | 18 | class NonEmptyChild(Exception): @@ -81,8 +75,6 @@ PYI012.pyi:20:5: PYI012 [*] Class body must not contain `pass` 22 21 | class NonEmptyChild2(Exception): 23 22 | pass # PYI012 Class body must not contain `pass` - Run `ruff check --fix` to apply this fix. - PYI012.pyi:23:5: PYI012 [*] Class body must not contain `pass` | 22 | class NonEmptyChild2(Exception): @@ -100,8 +92,6 @@ PYI012.pyi:23:5: PYI012 [*] Class body must not contain `pass` 25 24 | 26 25 | class NonEmptyWithInit: - Run `ruff check --fix` to apply this fix. - PYI012.pyi:28:5: PYI012 [*] Class body must not contain `pass` | 26 | class NonEmptyWithInit: @@ -120,5 +110,3 @@ PYI012.pyi:28:5: PYI012 [*] Class body must not contain `pass` 29 28 | 30 29 | def __init__(): 31 30 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.py.snap index f65a46a52e89d..6dae79fc6e693 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.py.snap @@ -17,8 +17,6 @@ PYI013.py:3:5: PYI013 [*] Non-empty class body must not contain `...` 5 4 | 6 5 | class OneAttributeClass2: - Run `ruff check --fix` to apply this fix. - PYI013.py:7:5: PYI013 [*] Non-empty class body must not contain `...` | 6 | class OneAttributeClass2: @@ -36,8 +34,6 @@ PYI013.py:7:5: PYI013 [*] Non-empty class body must not contain `...` 9 8 | 10 9 | - Run `ruff check --fix` to apply this fix. - PYI013.py:12:5: PYI013 [*] Non-empty class body must not contain `...` | 11 | class TwoEllipsesClass: @@ -55,8 +51,6 @@ PYI013.py:12:5: PYI013 [*] Non-empty class body must not contain `...` 15 14 | 16 15 | class DocstringClass: - Run `ruff check --fix` to apply this fix. - PYI013.py:13:5: PYI013 [*] Non-empty class body must not contain `...` | 11 | class TwoEllipsesClass: @@ -74,8 +68,6 @@ PYI013.py:13:5: PYI013 [*] Non-empty class body must not contain `...` 15 14 | 16 15 | class DocstringClass: - Run `ruff check --fix` to apply this fix. - PYI013.py:21:5: PYI013 [*] Non-empty class body must not contain `...` | 19 | """ @@ -93,8 +85,6 @@ PYI013.py:21:5: PYI013 [*] Non-empty class body must not contain `...` 23 22 | 24 23 | class NonEmptyChild(Exception): - Run `ruff check --fix` to apply this fix. - PYI013.py:26:5: PYI013 [*] Non-empty class body must not contain `...` | 24 | class NonEmptyChild(Exception): @@ -112,8 +102,6 @@ PYI013.py:26:5: PYI013 [*] Non-empty class body must not contain `...` 28 27 | 29 28 | class NonEmptyChild2(Exception): - Run `ruff check --fix` to apply this fix. - PYI013.py:30:5: PYI013 [*] Non-empty class body must not contain `...` | 29 | class NonEmptyChild2(Exception): @@ -131,8 +119,6 @@ PYI013.py:30:5: PYI013 [*] Non-empty class body must not contain `...` 32 31 | 33 32 | - Run `ruff check --fix` to apply this fix. - PYI013.py:36:5: PYI013 [*] Non-empty class body must not contain `...` | 34 | class NonEmptyWithInit: @@ -151,5 +137,3 @@ PYI013.py:36:5: PYI013 [*] Non-empty class body must not contain `...` 37 36 | 38 37 | def __init__(): 39 38 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.pyi.snap index 726f31a836c8f..105863328e350 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI013_PYI013.pyi.snap @@ -20,8 +20,6 @@ PYI013.pyi:5:5: PYI013 [*] Non-empty class body must not contain `...` 7 6 | class OneAttributeClass2: 8 7 | ... # Error - Run `ruff check --fix` to apply this fix. - PYI013.pyi:8:5: PYI013 [*] Non-empty class body must not contain `...` | 7 | class OneAttributeClass2: @@ -39,8 +37,6 @@ PYI013.pyi:8:5: PYI013 [*] Non-empty class body must not contain `...` 10 9 | 11 10 | class MyClass: - Run `ruff check --fix` to apply this fix. - PYI013.pyi:12:5: PYI013 [*] Non-empty class body must not contain `...` | 11 | class MyClass: @@ -58,8 +54,6 @@ PYI013.pyi:12:5: PYI013 [*] Non-empty class body must not contain `...` 14 13 | 15 14 | class TwoEllipsesClass: - Run `ruff check --fix` to apply this fix. - PYI013.pyi:16:5: PYI013 [*] Non-empty class body must not contain `...` | 15 | class TwoEllipsesClass: @@ -77,8 +71,6 @@ PYI013.pyi:16:5: PYI013 [*] Non-empty class body must not contain `...` 18 17 | 19 18 | class DocstringClass: - Run `ruff check --fix` to apply this fix. - PYI013.pyi:17:5: PYI013 [*] Non-empty class body must not contain `...` | 15 | class TwoEllipsesClass: @@ -98,8 +90,6 @@ PYI013.pyi:17:5: PYI013 [*] Non-empty class body must not contain `...` 19 18 | class DocstringClass: 20 19 | """ - Run `ruff check --fix` to apply this fix. - PYI013.pyi:24:5: PYI013 [*] Non-empty class body must not contain `...` | 22 | """ @@ -119,8 +109,6 @@ PYI013.pyi:24:5: PYI013 [*] Non-empty class body must not contain `...` 26 25 | class NonEmptyChild(Exception): 27 26 | value: int - Run `ruff check --fix` to apply this fix. - PYI013.pyi:28:5: PYI013 [*] Non-empty class body must not contain `...` | 26 | class NonEmptyChild(Exception): @@ -140,8 +128,6 @@ PYI013.pyi:28:5: PYI013 [*] Non-empty class body must not contain `...` 30 29 | class NonEmptyChild2(Exception): 31 30 | ... # Error - Run `ruff check --fix` to apply this fix. - PYI013.pyi:31:5: PYI013 [*] Non-empty class body must not contain `...` | 30 | class NonEmptyChild2(Exception): @@ -159,8 +145,6 @@ PYI013.pyi:31:5: PYI013 [*] Non-empty class body must not contain `...` 33 32 | 34 33 | class NonEmptyWithInit: - Run `ruff check --fix` to apply this fix. - PYI013.pyi:36:5: PYI013 [*] Non-empty class body must not contain `...` | 34 | class NonEmptyWithInit: @@ -179,5 +163,3 @@ PYI013.pyi:36:5: PYI013 [*] Non-empty class body must not contain `...` 37 36 | 38 37 | def __init__(): 39 38 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap index 5ac36a26aae43..d73baed864528 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap @@ -20,8 +20,6 @@ PYI014.pyi:3:7: PYI014 [*] Only simple default values allowed for arguments 5 5 | def f11(*, x="x") -> None: ... # OK 6 6 | def f13( - Run `ruff check --fix` to apply this fix. - PYI014.pyi:29:7: PYI014 [*] Only simple default values allowed for arguments | 27 | def f151(x={1: 2}) -> None: ... @@ -49,8 +47,6 @@ PYI014.pyi:29:7: PYI014 [*] Only simple default values allowed for arguments 34 31 | def f153( 35 32 | x=[ # Error PYI014 - Run `ruff check --fix` to apply this fix. - PYI014.pyi:35:7: PYI014 [*] Only simple default values allowed for arguments | 33 | ) -> None: ... @@ -96,8 +92,6 @@ PYI014.pyi:35:7: PYI014 [*] Only simple default values allowed for arguments 49 37 | def f154( 50 38 | x=( # Error PYI014 - Run `ruff check --fix` to apply this fix. - PYI014.pyi:50:7: PYI014 [*] Only simple default values allowed for arguments | 48 | ) -> None: ... @@ -125,8 +119,6 @@ PYI014.pyi:50:7: PYI014 [*] Only simple default values allowed for arguments 55 52 | def f141( 56 53 | x=[*range(10)], # Error PYI014 - Run `ruff check --fix` to apply this fix. - PYI014.pyi:56:7: PYI014 [*] Only simple default values allowed for arguments | 54 | ) -> None: ... @@ -147,8 +139,6 @@ PYI014.pyi:56:7: PYI014 [*] Only simple default values allowed for arguments 58 58 | def f142( 59 59 | x=list(range(10)), # Error PYI014 - Run `ruff check --fix` to apply this fix. - PYI014.pyi:59:7: PYI014 [*] Only simple default values allowed for arguments | 57 | ) -> None: ... @@ -169,8 +159,6 @@ PYI014.pyi:59:7: PYI014 [*] Only simple default values allowed for arguments 61 61 | def f16(x=frozenset({b"foo", b"bar", b"baz"})) -> None: ... # Error PYI014 62 62 | def f17( - Run `ruff check --fix` to apply this fix. - PYI014.pyi:61:11: PYI014 [*] Only simple default values allowed for arguments | 59 | x=list(range(10)), # Error PYI014 @@ -191,8 +179,6 @@ PYI014.pyi:61:11: PYI014 [*] Only simple default values allowed for arguments 63 63 | x="foo" + "bar", # Error PYI014 64 64 | ) -> None: ... - Run `ruff check --fix` to apply this fix. - PYI014.pyi:63:7: PYI014 [*] Only simple default values allowed for arguments | 61 | def f16(x=frozenset({b"foo", b"bar", b"baz"})) -> None: ... # Error PYI014 @@ -213,8 +199,6 @@ PYI014.pyi:63:7: PYI014 [*] Only simple default values allowed for arguments 65 65 | def f18( 66 66 | x=b"foo" + b"bar", # Error PYI014 - Run `ruff check --fix` to apply this fix. - PYI014.pyi:66:7: PYI014 [*] Only simple default values allowed for arguments | 64 | ) -> None: ... @@ -235,8 +219,6 @@ PYI014.pyi:66:7: PYI014 [*] Only simple default values allowed for arguments 68 68 | def f19( 69 69 | x="foo" + 4, # Error PYI014 - Run `ruff check --fix` to apply this fix. - PYI014.pyi:69:7: PYI014 [*] Only simple default values allowed for arguments | 67 | ) -> None: ... @@ -257,8 +239,6 @@ PYI014.pyi:69:7: PYI014 [*] Only simple default values allowed for arguments 71 71 | def f20( 72 72 | x=5 + 5, # Error PYI014 - Run `ruff check --fix` to apply this fix. - PYI014.pyi:72:7: PYI014 [*] Only simple default values allowed for arguments | 70 | ) -> None: ... @@ -279,8 +259,6 @@ PYI014.pyi:72:7: PYI014 [*] Only simple default values allowed for arguments 74 74 | def f21( 75 75 | x=3j - 3j, # Error PYI014 - Run `ruff check --fix` to apply this fix. - PYI014.pyi:75:7: PYI014 [*] Only simple default values allowed for arguments | 73 | ) -> None: ... @@ -301,8 +279,6 @@ PYI014.pyi:75:7: PYI014 [*] Only simple default values allowed for arguments 77 77 | def f22( 78 78 | x=-42.5j + 4.3j, # Error PYI014 - Run `ruff check --fix` to apply this fix. - PYI014.pyi:78:7: PYI014 [*] Only simple default values allowed for arguments | 76 | ) -> None: ... @@ -322,5 +298,3 @@ PYI014.pyi:78:7: PYI014 [*] Only simple default values allowed for arguments 79 79 | ) -> None: ... 80 80 | def f23( 81 81 | x=True, # OK - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap index 89f9fa94f6ac6..103b66886c5d2 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap @@ -20,8 +20,6 @@ PYI015.pyi:44:23: PYI015 [*] Only simple default values allowed for assignments 46 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments 47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments - Run `ruff check --fix` to apply this fix. - PYI015.pyi:45:23: PYI015 [*] Only simple default values allowed for assignments | 43 | # We *should* emit Y015 for more complex default values @@ -42,8 +40,6 @@ PYI015.pyi:45:23: PYI015 [*] Only simple default values allowed for assignments 47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments 48 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments - Run `ruff check --fix` to apply this fix. - PYI015.pyi:46:23: PYI015 [*] Only simple default values allowed for assignments | 44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments @@ -64,8 +60,6 @@ PYI015.pyi:46:23: PYI015 [*] Only simple default values allowed for assignments 48 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments 49 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments - Run `ruff check --fix` to apply this fix. - PYI015.pyi:47:26: PYI015 [*] Only simple default values allowed for assignments | 45 | field223: list[int] = [*range(10)] # Y015 Only simple default values are allowed for assignments @@ -86,8 +80,6 @@ PYI015.pyi:47:26: PYI015 [*] Only simple default values allowed for assignments 49 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments 50 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments - Run `ruff check --fix` to apply this fix. - PYI015.pyi:48:47: PYI015 [*] Only simple default values allowed for assignments | 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments @@ -108,8 +100,6 @@ PYI015.pyi:48:47: PYI015 [*] Only simple default values allowed for assignments 50 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments 51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node - Run `ruff check --fix` to apply this fix. - PYI015.pyi:49:31: PYI015 [*] Only simple default values allowed for assignments | 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments @@ -130,8 +120,6 @@ PYI015.pyi:49:31: PYI015 [*] Only simple default values allowed for assignments 51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node 52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments - Run `ruff check --fix` to apply this fix. - PYI015.pyi:50:37: PYI015 [*] Only simple default values allowed for assignments | 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments @@ -152,8 +140,6 @@ PYI015.pyi:50:37: PYI015 [*] Only simple default values allowed for assignments 52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments 53 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments - Run `ruff check --fix` to apply this fix. - PYI015.pyi:52:28: PYI015 [*] Only simple default values allowed for assignments | 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments @@ -174,8 +160,6 @@ PYI015.pyi:52:28: PYI015 [*] Only simple default values allowed for assignments 54 54 | field24 = b"foo" + b"bar" # Y015 Only simple default values are allowed for assignments 55 55 | field25 = 5 * 5 # Y015 Only simple default values are allowed for assignments - Run `ruff check --fix` to apply this fix. - PYI015.pyi:53:11: PYI015 [*] Only simple default values allowed for assignments | 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node @@ -196,8 +180,6 @@ PYI015.pyi:53:11: PYI015 [*] Only simple default values allowed for assignments 55 55 | field25 = 5 * 5 # Y015 Only simple default values are allowed for assignments 56 56 | - Run `ruff check --fix` to apply this fix. - PYI015.pyi:54:11: PYI015 [*] Only simple default values allowed for assignments | 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments @@ -217,8 +199,6 @@ PYI015.pyi:54:11: PYI015 [*] Only simple default values allowed for assignments 56 56 | 57 57 | # We shouldn't emit Y015 within functions - Run `ruff check --fix` to apply this fix. - PYI015.pyi:55:11: PYI015 [*] Only simple default values allowed for assignments | 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments @@ -238,5 +218,3 @@ PYI015.pyi:55:11: PYI015 [*] Only simple default values allowed for assignments 56 56 | 57 57 | # We shouldn't emit Y015 within functions 58 58 | def f(): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.py.snap index b684710deae73..24ff2410e07a4 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.py.snap @@ -20,8 +20,6 @@ PYI016.py:7:15: PYI016 [*] Duplicate union member `str` 9 9 | # Should emit for union types in arguments. 10 10 | def func1(arg1: int | int): # PYI016: Duplicate union member `int` - Run `ruff check --fix` to apply this fix. - PYI016.py:10:23: PYI016 [*] Duplicate union member `int` | 9 | # Should emit for union types in arguments. @@ -40,8 +38,6 @@ PYI016.py:10:23: PYI016 [*] Duplicate union member `int` 12 12 | 13 13 | # Should emit for unions in return types. - Run `ruff check --fix` to apply this fix. - PYI016.py:14:22: PYI016 [*] Duplicate union member `str` | 13 | # Should emit for unions in return types. @@ -60,8 +56,6 @@ PYI016.py:14:22: PYI016 [*] Duplicate union member `str` 16 16 | 17 17 | # Should emit in longer unions, even if not directly adjacent. - Run `ruff check --fix` to apply this fix. - PYI016.py:18:15: PYI016 [*] Duplicate union member `str` | 17 | # Should emit in longer unions, even if not directly adjacent. @@ -81,8 +75,6 @@ PYI016.py:18:15: PYI016 [*] Duplicate union member `str` 20 20 | field5: str | int | str # PYI016: Duplicate union member `str` 21 21 | field6: int | bool | str | int # PYI016: Duplicate union member `int` - Run `ruff check --fix` to apply this fix. - PYI016.py:19:15: PYI016 [*] Duplicate union member `int` | 17 | # Should emit in longer unions, even if not directly adjacent. @@ -103,8 +95,6 @@ PYI016.py:19:15: PYI016 [*] Duplicate union member `int` 21 21 | field6: int | bool | str | int # PYI016: Duplicate union member `int` 22 22 | - Run `ruff check --fix` to apply this fix. - PYI016.py:20:21: PYI016 [*] Duplicate union member `str` | 18 | field3: str | str | int # PYI016: Duplicate union member `str` @@ -124,8 +114,6 @@ PYI016.py:20:21: PYI016 [*] Duplicate union member `str` 22 22 | 23 23 | # Shouldn't emit for non-type unions. - Run `ruff check --fix` to apply this fix. - PYI016.py:21:28: PYI016 [*] Duplicate union member `int` | 19 | field4: int | int | str # PYI016: Duplicate union member `int` @@ -146,8 +134,6 @@ PYI016.py:21:28: PYI016 [*] Duplicate union member `int` 23 23 | # Shouldn't emit for non-type unions. 24 24 | field7 = str | str - Run `ruff check --fix` to apply this fix. - PYI016.py:27:22: PYI016 [*] Duplicate union member `int` | 26 | # Should emit for strangely-bracketed unions. @@ -167,8 +153,6 @@ PYI016.py:27:22: PYI016 [*] Duplicate union member `int` 29 29 | # Should handle user brackets when fixing. 30 30 | field9: int | (int | str) # PYI016: Duplicate union member `int` - Run `ruff check --fix` to apply this fix. - PYI016.py:30:16: PYI016 [*] Duplicate union member `int` | 29 | # Should handle user brackets when fixing. @@ -187,8 +171,6 @@ PYI016.py:30:16: PYI016 [*] Duplicate union member `int` 32 32 | 33 33 | # Should emit for nested unions. - Run `ruff check --fix` to apply this fix. - PYI016.py:31:24: PYI016 [*] Duplicate union member `str` | 29 | # Should handle user brackets when fixing. @@ -209,8 +191,6 @@ PYI016.py:31:24: PYI016 [*] Duplicate union member `str` 33 33 | # Should emit for nested unions. 34 34 | field11: dict[int | int, str] - Run `ruff check --fix` to apply this fix. - PYI016.py:34:21: PYI016 [*] Duplicate union member `int` | 33 | # Should emit for nested unions. @@ -230,8 +210,6 @@ PYI016.py:34:21: PYI016 [*] Duplicate union member `int` 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error - Run `ruff check --fix` to apply this fix. - PYI016.py:37:16: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -250,8 +228,6 @@ PYI016.py:37:16: PYI016 [*] Duplicate union member `int` 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent - Run `ruff check --fix` to apply this fix. - PYI016.py:37:22: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -270,8 +246,6 @@ PYI016.py:37:22: PYI016 [*] Duplicate union member `int` 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent - Run `ruff check --fix` to apply this fix. - PYI016.py:38:16: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -292,8 +266,6 @@ PYI016.py:38:16: PYI016 [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error - Run `ruff check --fix` to apply this fix. - PYI016.py:38:22: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -314,8 +286,6 @@ PYI016.py:38:22: PYI016 [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error - Run `ruff check --fix` to apply this fix. - PYI016.py:38:28: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -336,8 +306,6 @@ PYI016.py:38:28: PYI016 [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error - Run `ruff check --fix` to apply this fix. - PYI016.py:41:16: PYI016 [*] Duplicate union member `int` | 40 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -357,8 +325,6 @@ PYI016.py:41:16: PYI016 [*] Duplicate union member `int` 43 43 | # Should emit for duplicate literal types; also covered by PYI030 44 44 | field15: typing.Literal[1] | typing.Literal[1] # Error - Run `ruff check --fix` to apply this fix. - PYI016.py:41:28: PYI016 [*] Duplicate union member `int` | 40 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -378,8 +344,6 @@ PYI016.py:41:28: PYI016 [*] Duplicate union member `int` 43 43 | # Should emit for duplicate literal types; also covered by PYI030 44 44 | field15: typing.Literal[1] | typing.Literal[1] # Error - Run `ruff check --fix` to apply this fix. - PYI016.py:44:30: PYI016 [*] Duplicate union member `typing.Literal[1]` | 43 | # Should emit for duplicate literal types; also covered by PYI030 @@ -399,8 +363,6 @@ PYI016.py:44:30: PYI016 [*] Duplicate union member `typing.Literal[1]` 46 46 | # Shouldn't emit if in new parent type 47 47 | field16: int | dict[int, str] # OK - Run `ruff check --fix` to apply this fix. - PYI016.py:57:5: PYI016 Duplicate union member `set[int]` | 55 | int # foo @@ -453,8 +415,6 @@ PYI016.py:69:28: PYI016 [*] Duplicate union member `int` 71 71 | # Should emit only once in cases with multiple nested `typing.Union` 72 72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error - Run `ruff check --fix` to apply this fix. - PYI016.py:72:41: PYI016 Duplicate union member `int` | 71 | # Should emit only once in cases with multiple nested `typing.Union` @@ -505,8 +465,6 @@ PYI016.py:76:12: PYI016 [*] Duplicate union member `set[int]` 78 78 | # Should emit twice (once for each `int` in the nested union, both of which are 79 79 | # duplicates of the outer `int`), but not three times (which would indicate that - Run `ruff check --fix` to apply this fix. - PYI016.py:81:41: PYI016 Duplicate union member `int` | 79 | # duplicates of the outer `int`), but not three times (which would indicate that @@ -544,8 +502,6 @@ PYI016.py:86:28: PYI016 [*] Duplicate union member `int` 86 |-field25: typing.Union[int, int | int] # PYI016: Duplicate union member `int` 86 |+field25: typing.Union[int, int] # PYI016: Duplicate union member `int` - Run `ruff check --fix` to apply this fix. - PYI016.py:86:34: PYI016 [*] Duplicate union member `int` | 84 | # duplicates of the outer `int`), but not three times (which would indicate that @@ -560,5 +516,3 @@ PYI016.py:86:34: PYI016 [*] Duplicate union member `int` 85 85 | # we incorrectly re-checked the nested union). 86 |-field25: typing.Union[int, int | int] # PYI016: Duplicate union member `int` 86 |+field25: typing.Union[int, int] # PYI016: Duplicate union member `int` - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.pyi.snap index 63d067329b00d..ef4dd6f97491d 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI016_PYI016.pyi.snap @@ -20,8 +20,6 @@ PYI016.pyi:7:15: PYI016 [*] Duplicate union member `str` 9 9 | # Should emit for union types in arguments. 10 10 | def func1(arg1: int | int): # PYI016: Duplicate union member `int` - Run `ruff check --fix` to apply this fix. - PYI016.pyi:10:23: PYI016 [*] Duplicate union member `int` | 9 | # Should emit for union types in arguments. @@ -40,8 +38,6 @@ PYI016.pyi:10:23: PYI016 [*] Duplicate union member `int` 12 12 | 13 13 | # Should emit for unions in return types. - Run `ruff check --fix` to apply this fix. - PYI016.pyi:14:22: PYI016 [*] Duplicate union member `str` | 13 | # Should emit for unions in return types. @@ -60,8 +56,6 @@ PYI016.pyi:14:22: PYI016 [*] Duplicate union member `str` 16 16 | 17 17 | # Should emit in longer unions, even if not directly adjacent. - Run `ruff check --fix` to apply this fix. - PYI016.pyi:18:15: PYI016 [*] Duplicate union member `str` | 17 | # Should emit in longer unions, even if not directly adjacent. @@ -81,8 +75,6 @@ PYI016.pyi:18:15: PYI016 [*] Duplicate union member `str` 20 20 | field5: str | int | str # PYI016: Duplicate union member `str` 21 21 | field6: int | bool | str | int # PYI016: Duplicate union member `int` - Run `ruff check --fix` to apply this fix. - PYI016.pyi:19:15: PYI016 [*] Duplicate union member `int` | 17 | # Should emit in longer unions, even if not directly adjacent. @@ -103,8 +95,6 @@ PYI016.pyi:19:15: PYI016 [*] Duplicate union member `int` 21 21 | field6: int | bool | str | int # PYI016: Duplicate union member `int` 22 22 | - Run `ruff check --fix` to apply this fix. - PYI016.pyi:20:21: PYI016 [*] Duplicate union member `str` | 18 | field3: str | str | int # PYI016: Duplicate union member `str` @@ -124,8 +114,6 @@ PYI016.pyi:20:21: PYI016 [*] Duplicate union member `str` 22 22 | 23 23 | # Shouldn't emit for non-type unions. - Run `ruff check --fix` to apply this fix. - PYI016.pyi:21:28: PYI016 [*] Duplicate union member `int` | 19 | field4: int | int | str # PYI016: Duplicate union member `int` @@ -146,8 +134,6 @@ PYI016.pyi:21:28: PYI016 [*] Duplicate union member `int` 23 23 | # Shouldn't emit for non-type unions. 24 24 | field7 = str | str - Run `ruff check --fix` to apply this fix. - PYI016.pyi:27:22: PYI016 [*] Duplicate union member `int` | 26 | # Should emit for strangely-bracketed unions. @@ -167,8 +153,6 @@ PYI016.pyi:27:22: PYI016 [*] Duplicate union member `int` 29 29 | # Should handle user brackets when fixing. 30 30 | field9: int | (int | str) # PYI016: Duplicate union member `int` - Run `ruff check --fix` to apply this fix. - PYI016.pyi:30:16: PYI016 [*] Duplicate union member `int` | 29 | # Should handle user brackets when fixing. @@ -187,8 +171,6 @@ PYI016.pyi:30:16: PYI016 [*] Duplicate union member `int` 32 32 | 33 33 | # Should emit for nested unions. - Run `ruff check --fix` to apply this fix. - PYI016.pyi:31:24: PYI016 [*] Duplicate union member `str` | 29 | # Should handle user brackets when fixing. @@ -209,8 +191,6 @@ PYI016.pyi:31:24: PYI016 [*] Duplicate union member `str` 33 33 | # Should emit for nested unions. 34 34 | field11: dict[int | int, str] - Run `ruff check --fix` to apply this fix. - PYI016.pyi:34:21: PYI016 [*] Duplicate union member `int` | 33 | # Should emit for nested unions. @@ -230,8 +210,6 @@ PYI016.pyi:34:21: PYI016 [*] Duplicate union member `int` 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error - Run `ruff check --fix` to apply this fix. - PYI016.pyi:37:16: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -250,8 +228,6 @@ PYI016.pyi:37:16: PYI016 [*] Duplicate union member `int` 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent - Run `ruff check --fix` to apply this fix. - PYI016.pyi:37:22: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -270,8 +246,6 @@ PYI016.pyi:37:22: PYI016 [*] Duplicate union member `int` 39 39 | 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent - Run `ruff check --fix` to apply this fix. - PYI016.pyi:38:16: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -292,8 +266,6 @@ PYI016.pyi:38:16: PYI016 [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error - Run `ruff check --fix` to apply this fix. - PYI016.pyi:38:22: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -314,8 +286,6 @@ PYI016.pyi:38:22: PYI016 [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error - Run `ruff check --fix` to apply this fix. - PYI016.pyi:38:28: PYI016 [*] Duplicate union member `int` | 36 | # Should emit for unions with more than two cases @@ -336,8 +306,6 @@ PYI016.pyi:38:28: PYI016 [*] Duplicate union member `int` 40 40 | # Should emit for unions with more than two cases, even if not directly adjacent 41 41 | field14: int | int | str | int # Error - Run `ruff check --fix` to apply this fix. - PYI016.pyi:41:16: PYI016 [*] Duplicate union member `int` | 40 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -357,8 +325,6 @@ PYI016.pyi:41:16: PYI016 [*] Duplicate union member `int` 43 43 | # Should emit for duplicate literal types; also covered by PYI030 44 44 | field15: typing.Literal[1] | typing.Literal[1] # Error - Run `ruff check --fix` to apply this fix. - PYI016.pyi:41:28: PYI016 [*] Duplicate union member `int` | 40 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -378,8 +344,6 @@ PYI016.pyi:41:28: PYI016 [*] Duplicate union member `int` 43 43 | # Should emit for duplicate literal types; also covered by PYI030 44 44 | field15: typing.Literal[1] | typing.Literal[1] # Error - Run `ruff check --fix` to apply this fix. - PYI016.pyi:44:30: PYI016 [*] Duplicate union member `typing.Literal[1]` | 43 | # Should emit for duplicate literal types; also covered by PYI030 @@ -399,8 +363,6 @@ PYI016.pyi:44:30: PYI016 [*] Duplicate union member `typing.Literal[1]` 46 46 | # Shouldn't emit if in new parent type 47 47 | field16: int | dict[int, str] # OK - Run `ruff check --fix` to apply this fix. - PYI016.pyi:57:5: PYI016 Duplicate union member `set[int]` | 55 | int # foo @@ -453,8 +415,6 @@ PYI016.pyi:69:28: PYI016 [*] Duplicate union member `int` 71 71 | # Should emit only once in cases with multiple nested `typing.Union` 72 72 | field22: typing.Union[int, typing.Union[int, typing.Union[int, int]]] # Error - Run `ruff check --fix` to apply this fix. - PYI016.pyi:72:41: PYI016 Duplicate union member `int` | 71 | # Should emit only once in cases with multiple nested `typing.Union` @@ -505,8 +465,6 @@ PYI016.pyi:76:12: PYI016 [*] Duplicate union member `set[int]` 78 78 | # Should emit twice (once for each `int` in the nested union, both of which are 79 79 | # duplicates of the outer `int`), but not three times (which would indicate that - Run `ruff check --fix` to apply this fix. - PYI016.pyi:81:41: PYI016 Duplicate union member `int` | 79 | # duplicates of the outer `int`), but not three times (which would indicate that @@ -544,8 +502,6 @@ PYI016.pyi:86:28: PYI016 [*] Duplicate union member `int` 86 |-field25: typing.Union[int, int | int] # PYI016: Duplicate union member `int` 86 |+field25: typing.Union[int, int] # PYI016: Duplicate union member `int` - Run `ruff check --fix` to apply this fix. - PYI016.pyi:86:34: PYI016 [*] Duplicate union member `int` | 84 | # duplicates of the outer `int`), but not three times (which would indicate that @@ -560,5 +516,3 @@ PYI016.pyi:86:34: PYI016 [*] Duplicate union member `int` 85 85 | # we incorrectly re-checked the nested union). 86 |-field25: typing.Union[int, int | int] # PYI016: Duplicate union member `int` 86 |+field25: typing.Union[int, int] # PYI016: Duplicate union member `int` - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI020_PYI020.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI020_PYI020.pyi.snap index 0ed861b7bbe21..064d706087aac 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI020_PYI020.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI020_PYI020.pyi.snap @@ -21,8 +21,6 @@ PYI020.pyi:7:10: PYI020 [*] Quoted annotations should not be included in stubs 9 9 | _T = TypeVar("_T", bound="int") # Y020 Quoted annotations should never be used in stubs 10 10 | - Run `ruff check --fix` to apply this fix. - PYI020.pyi:8:15: PYI020 [*] Quoted annotations should not be included in stubs | 7 | def f(x: "int"): ... # Y020 Quoted annotations should never be used in stubs @@ -41,8 +39,6 @@ PYI020.pyi:8:15: PYI020 [*] Quoted annotations should not be included in stubs 10 10 | 11 11 | def h(w: Literal["a", "b"], x: typing.Literal["c"], y: typing_extensions.Literal["d"], z: _T) -> _T: ... - Run `ruff check --fix` to apply this fix. - PYI020.pyi:9:26: PYI020 [*] Quoted annotations should not be included in stubs | 7 | def f(x: "int"): ... # Y020 Quoted annotations should never be used in stubs @@ -63,8 +59,6 @@ PYI020.pyi:9:26: PYI020 [*] Quoted annotations should not be included in stubs 11 11 | def h(w: Literal["a", "b"], x: typing.Literal["c"], y: typing_extensions.Literal["d"], z: _T) -> _T: ... 12 12 | - Run `ruff check --fix` to apply this fix. - PYI020.pyi:13:12: PYI020 [*] Quoted annotations should not be included in stubs | 11 | def h(w: Literal["a", "b"], x: typing.Literal["c"], y: typing_extensions.Literal["d"], z: _T) -> _T: ... @@ -84,8 +78,6 @@ PYI020.pyi:13:12: PYI020 [*] Quoted annotations should not be included in stubs 15 15 | 16 16 | class Child(list["int"]): # Y020 Quoted annotations should never be used in stubs - Run `ruff check --fix` to apply this fix. - PYI020.pyi:14:25: PYI020 [*] Quoted annotations should not be included in stubs | 13 | def j() -> "int": ... # Y020 Quoted annotations should never be used in stubs @@ -105,8 +97,6 @@ PYI020.pyi:14:25: PYI020 [*] Quoted annotations should not be included in stubs 16 16 | class Child(list["int"]): # Y020 Quoted annotations should never be used in stubs 17 17 | """Documented and guaranteed useful.""" # Y021 Docstrings should not be included in stubs - Run `ruff check --fix` to apply this fix. - PYI020.pyi:16:18: PYI020 [*] Quoted annotations should not be included in stubs | 14 | Alias: TypeAlias = list["int"] # Y020 Quoted annotations should never be used in stubs @@ -126,8 +116,6 @@ PYI020.pyi:16:18: PYI020 [*] Quoted annotations should not be included in stubs 18 18 | 19 19 | if sys.platform == "linux": - Run `ruff check --fix` to apply this fix. - PYI020.pyi:20:8: PYI020 [*] Quoted annotations should not be included in stubs | 19 | if sys.platform == "linux": @@ -147,8 +135,6 @@ PYI020.pyi:20:8: PYI020 [*] Quoted annotations should not be included in stubs 22 22 | f: "str" # Y020 Quoted annotations should never be used in stubs 23 23 | else: - Run `ruff check --fix` to apply this fix. - PYI020.pyi:22:8: PYI020 [*] Quoted annotations should not be included in stubs | 20 | f: "int" # Y020 Quoted annotations should never be used in stubs @@ -169,8 +155,6 @@ PYI020.pyi:22:8: PYI020 [*] Quoted annotations should not be included in stubs 24 24 | f: "bytes" # Y020 Quoted annotations should never be used in stubs 25 25 | - Run `ruff check --fix` to apply this fix. - PYI020.pyi:24:8: PYI020 [*] Quoted annotations should not be included in stubs | 22 | f: "str" # Y020 Quoted annotations should never be used in stubs @@ -190,5 +174,3 @@ PYI020.pyi:24:8: PYI020 [*] Quoted annotations should not be included in stubs 25 25 | 26 26 | # These two shouldn't trigger Y020 -- empty strings can't be "quoted annotations" 27 27 | k = "" # Y052 Need type annotation for "k" - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap index 4531d8d65ca1c..c5dfde10cef2c 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.py.snap @@ -18,8 +18,6 @@ PYI025_1.py:10:33: PYI025 [*] Use `from collections.abc import Set as AbstractSe 12 12 | 13 13 | def f(): - Run `ruff check --fix` to apply this fix. - PYI025_1.py:14:51: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 13 | def f(): @@ -42,5 +40,3 @@ PYI025_1.py:14:51: PYI025 [*] Use `from collections.abc import Set as AbstractSe 18 18 | class Class: 19 |- member: Set[int] 19 |+ member: AbstractSet[int] - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap index 5d6686f8baddf..400c231445cbd 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025_1.pyi.snap @@ -20,8 +20,6 @@ PYI025_1.pyi:8:33: PYI025 [*] Use `from collections.abc import Set as AbstractSe 10 10 | def f(): 11 11 | from collections.abc import Container, Sized, Set, ValuesView # PYI025 - Run `ruff check --fix` to apply this fix. - PYI025_1.pyi:11:51: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 10 | def f(): @@ -41,8 +39,6 @@ PYI025_1.pyi:11:51: PYI025 [*] Use `from collections.abc import Set as AbstractS 13 13 | def f(): 14 14 | """Test: local symbol renaming.""" - Run `ruff check --fix` to apply this fix. - PYI025_1.pyi:16:37: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 14 | """Test: local symbol renaming.""" @@ -77,8 +73,6 @@ PYI025_1.pyi:16:37: PYI025 [*] Use `from collections.abc import Set as AbstractS 29 29 | def Set(): 30 30 | pass - Run `ruff check --fix` to apply this fix. - PYI025_1.pyi:33:29: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 31 | print(Set) @@ -121,8 +115,6 @@ PYI025_1.pyi:33:29: PYI025 [*] Use `from collections.abc import Set as AbstractS 42 42 | def f(): 43 43 | """Test: nonlocal symbol renaming.""" - Run `ruff check --fix` to apply this fix. - PYI025_1.pyi:44:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 42 | def f(): @@ -148,5 +140,3 @@ PYI025_1.pyi:44:33: PYI025 [*] Use `from collections.abc import Set as AbstractS 50 |- print(Set) 49 |+ AbstractSet = 1 50 |+ print(AbstractSet) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap index 30af752506f63..10e40436733b8 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap @@ -21,8 +21,6 @@ PYI026.pyi:3:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `NewAny: 5 5 | Foo = Literal["foo"] 6 6 | IntOrStr = int | str - Run `ruff check --fix` to apply this fix. - PYI026.pyi:4:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]` | 3 | NewAny = Any @@ -43,8 +41,6 @@ PYI026.pyi:4:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Optiona 6 6 | IntOrStr = int | str 7 7 | AliasNone = None - Run `ruff check --fix` to apply this fix. - PYI026.pyi:5:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]` | 3 | NewAny = Any @@ -67,8 +63,6 @@ PYI026.pyi:5:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Foo: Ty 7 7 | AliasNone = None 8 8 | - Run `ruff check --fix` to apply this fix. - PYI026.pyi:6:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str` | 4 | OptionalStr = typing.Optional[str] @@ -91,8 +85,6 @@ PYI026.pyi:6:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `IntOrSt 8 8 | 9 9 | NewAny: typing.TypeAlias = Any - Run `ruff check --fix` to apply this fix. - PYI026.pyi:7:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None` | 5 | Foo = Literal["foo"] @@ -117,8 +109,6 @@ PYI026.pyi:7:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `AliasNo 9 9 | NewAny: typing.TypeAlias = Any 10 10 | OptionalStr: TypeAlias = typing.Optional[str] - Run `ruff check --fix` to apply this fix. - PYI026.pyi:17:5: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `FLAG_THIS: TypeAlias = None` | 16 | class NotAnEnum: @@ -143,5 +133,3 @@ PYI026.pyi:17:5: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `FLAG_T 18 18 | 19 19 | # these are ok 20 20 | from enum import Enum - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI029_PYI029.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI029_PYI029.pyi.snap index 11acaee7a8684..538ffd82b5a13 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI029_PYI029.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI029_PYI029.pyi.snap @@ -20,8 +20,6 @@ PYI029.pyi:10:9: PYI029 [*] Defining `__str__` in a stub is almost always redund 12 12 | class ShouldRemove: 13 13 | def __repr__(self) -> str: ... # Error: PYI029 - Run `ruff check --fix` to apply this fix. - PYI029.pyi:13:9: PYI029 [*] Defining `__repr__` in a stub is almost always redundant | 12 | class ShouldRemove: @@ -39,8 +37,6 @@ PYI029.pyi:13:9: PYI029 [*] Defining `__repr__` in a stub is almost always redun 15 14 | 16 15 | class NoReturnSpecified: - Run `ruff check --fix` to apply this fix. - PYI029.pyi:14:9: PYI029 [*] Defining `__str__` in a stub is almost always redundant | 12 | class ShouldRemove: @@ -59,5 +55,3 @@ PYI029.pyi:14:9: PYI029 [*] Defining `__str__` in a stub is almost always redund 15 14 | 16 15 | class NoReturnSpecified: 17 16 | def __str__(self): ... - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap index 67765151089b0..1de5c1dbeb6eb 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.py.snap @@ -20,8 +20,6 @@ PYI030.py:9:9: PYI030 [*] Multiple literal members in a union. Use a single lite 11 11 | # Should emit for union types in arguments. 12 12 | def func1(arg1: Literal[1] | Literal[2]): # Error - Run `ruff check --fix` to apply this fix. - PYI030.py:12:17: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 11 | # Should emit for union types in arguments. @@ -40,8 +38,6 @@ PYI030.py:12:17: PYI030 [*] Multiple literal members in a union. Use a single li 14 14 | 15 15 | - Run `ruff check --fix` to apply this fix. - PYI030.py:17:16: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 16 | # Should emit for unions in return types. @@ -60,8 +56,6 @@ PYI030.py:17:16: PYI030 [*] Multiple literal members in a union. Use a single li 19 19 | 20 20 | - Run `ruff check --fix` to apply this fix. - PYI030.py:22:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 21 | # Should emit in longer unions, even if not directly adjacent. @@ -81,8 +75,6 @@ PYI030.py:22:9: PYI030 [*] Multiple literal members in a union. Use a single lit 24 24 | field5: Literal[1] | str | Literal[2] # Error 25 25 | field6: Literal[1] | bool | Literal[2] | str # Error - Run `ruff check --fix` to apply this fix. - PYI030.py:23:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 21 | # Should emit in longer unions, even if not directly adjacent. @@ -103,8 +95,6 @@ PYI030.py:23:9: PYI030 [*] Multiple literal members in a union. Use a single lit 25 25 | field6: Literal[1] | bool | Literal[2] | str # Error 26 26 | - Run `ruff check --fix` to apply this fix. - PYI030.py:24:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 22 | field3: Literal[1] | Literal[2] | str # Error @@ -124,8 +114,6 @@ PYI030.py:24:9: PYI030 [*] Multiple literal members in a union. Use a single lit 26 26 | 27 27 | # Should emit for non-type unions. - Run `ruff check --fix` to apply this fix. - PYI030.py:25:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 23 | field4: str | Literal[1] | Literal[2] # Error @@ -146,8 +134,6 @@ PYI030.py:25:9: PYI030 [*] Multiple literal members in a union. Use a single lit 27 27 | # Should emit for non-type unions. 28 28 | field7 = Literal[1] | Literal[2] # Error - Run `ruff check --fix` to apply this fix. - PYI030.py:28:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 27 | # Should emit for non-type unions. @@ -167,8 +153,6 @@ PYI030.py:28:10: PYI030 [*] Multiple literal members in a union. Use a single li 30 30 | # Should emit for parenthesized unions. 31 31 | field8: Literal[1] | (Literal[2] | str) # Error - Run `ruff check --fix` to apply this fix. - PYI030.py:31:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 30 | # Should emit for parenthesized unions. @@ -188,8 +172,6 @@ PYI030.py:31:9: PYI030 [*] Multiple literal members in a union. Use a single lit 33 33 | # Should handle user parentheses when fixing. 34 34 | field9: Literal[1] | (Literal[2] | str) # Error - Run `ruff check --fix` to apply this fix. - PYI030.py:34:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 33 | # Should handle user parentheses when fixing. @@ -208,8 +190,6 @@ PYI030.py:34:9: PYI030 [*] Multiple literal members in a union. Use a single lit 36 36 | 37 37 | # Should emit for union in generic parent type. - Run `ruff check --fix` to apply this fix. - PYI030.py:35:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 33 | # Should handle user parentheses when fixing. @@ -230,8 +210,6 @@ PYI030.py:35:10: PYI030 [*] Multiple literal members in a union. Use a single li 37 37 | # Should emit for union in generic parent type. 38 38 | field11: dict[Literal[1] | Literal[2], str] # Error - Run `ruff check --fix` to apply this fix. - PYI030.py:38:15: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 37 | # Should emit for union in generic parent type. @@ -251,8 +229,6 @@ PYI030.py:38:15: PYI030 [*] Multiple literal members in a union. Use a single li 40 40 | # Should emit for unions with more than two cases 41 41 | field12: Literal[1] | Literal[2] | Literal[3] # Error - Run `ruff check --fix` to apply this fix. - PYI030.py:41:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3]` | 40 | # Should emit for unions with more than two cases @@ -271,8 +247,6 @@ PYI030.py:41:10: PYI030 [*] Multiple literal members in a union. Use a single li 43 43 | 44 44 | # Should emit for unions with more than two cases, even if not directly adjacent - Run `ruff check --fix` to apply this fix. - PYI030.py:42:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` | 40 | # Should emit for unions with more than two cases @@ -293,8 +267,6 @@ PYI030.py:42:10: PYI030 [*] Multiple literal members in a union. Use a single li 44 44 | # Should emit for unions with more than two cases, even if not directly adjacent 45 45 | field14: Literal[1] | Literal[2] | str | Literal[3] # Error - Run `ruff check --fix` to apply this fix. - PYI030.py:45:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3]` | 44 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -314,8 +286,6 @@ PYI030.py:45:10: PYI030 [*] Multiple literal members in a union. Use a single li 47 47 | # Should emit for unions with mixed literal internal types 48 48 | field15: Literal[1] | Literal["foo"] | Literal[True] # Error - Run `ruff check --fix` to apply this fix. - PYI030.py:48:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, "foo", True]` | 47 | # Should emit for unions with mixed literal internal types @@ -335,8 +305,6 @@ PYI030.py:48:10: PYI030 [*] Multiple literal members in a union. Use a single li 50 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 51 51 | field16: Literal[1] | Literal[1] # OK - Run `ruff check --fix` to apply this fix. - PYI030.py:51:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 1]` | 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 @@ -356,8 +324,6 @@ PYI030.py:51:10: PYI030 [*] Multiple literal members in a union. Use a single li 53 53 | # Shouldn't emit if in new parent type 54 54 | field17: Literal[1] | dict[Literal[2], str] # OK - Run `ruff check --fix` to apply this fix. - PYI030.py:60:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 59 | # Should respect name of literal type used @@ -377,8 +343,6 @@ PYI030.py:60:10: PYI030 [*] Multiple literal members in a union. Use a single li 62 62 | # Should emit in cases with newlines 63 63 | field20: typing.Union[ - Run `ruff check --fix` to apply this fix. - PYI030.py:63:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 62 | # Should emit in cases with newlines @@ -409,8 +373,6 @@ PYI030.py:63:10: PYI030 [*] Multiple literal members in a union. Use a single li 70 65 | # Should handle multiple unions with multiple members 71 66 | field21: Literal[1, 2] | Literal[3, 4] # Error - Run `ruff check --fix` to apply this fix. - PYI030.py:71:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` | 70 | # Should handle multiple unions with multiple members @@ -430,8 +392,6 @@ PYI030.py:71:10: PYI030 [*] Multiple literal members in a union. Use a single li 73 73 | # Should emit in cases with `typing.Union` instead of `|` 74 74 | field22: typing.Union[Literal[1], Literal[2]] # Error - Run `ruff check --fix` to apply this fix. - PYI030.py:74:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 73 | # Should emit in cases with `typing.Union` instead of `|` @@ -451,8 +411,6 @@ PYI030.py:74:10: PYI030 [*] Multiple literal members in a union. Use a single li 76 76 | # Should emit in cases with `typing_extensions.Literal` 77 77 | field23: typing_extensions.Literal[1] | typing_extensions.Literal[2] # Error - Run `ruff check --fix` to apply this fix. - PYI030.py:77:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 76 | # Should emit in cases with `typing_extensions.Literal` @@ -472,8 +430,6 @@ PYI030.py:77:10: PYI030 [*] Multiple literal members in a union. Use a single li 79 79 | # Should emit in cases with nested `typing.Union` 80 80 | field24: typing.Union[Literal[1], typing.Union[Literal[2], str]] # Error - Run `ruff check --fix` to apply this fix. - PYI030.py:80:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 79 | # Should emit in cases with nested `typing.Union` @@ -493,8 +449,6 @@ PYI030.py:80:10: PYI030 [*] Multiple literal members in a union. Use a single li 82 82 | # Should emit in cases with mixed `typing.Union` and `|` 83 83 | field25: typing.Union[Literal[1], Literal[2] | str] # Error - Run `ruff check --fix` to apply this fix. - PYI030.py:83:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 82 | # Should emit in cases with mixed `typing.Union` and `|` @@ -514,8 +468,6 @@ PYI030.py:83:10: PYI030 [*] Multiple literal members in a union. Use a single li 85 85 | # Should emit only once in cases with multiple nested `typing.Union` 86 86 | field24: typing.Union[Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]]] # Error - Run `ruff check --fix` to apply this fix. - PYI030.py:86:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` | 85 | # Should emit only once in cases with multiple nested `typing.Union` @@ -535,8 +487,6 @@ PYI030.py:86:10: PYI030 [*] Multiple literal members in a union. Use a single li 88 88 | # Should use the first literal subscript attribute when fixing 89 89 | field25: typing.Union[typing_extensions.Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]], str] # Error - Run `ruff check --fix` to apply this fix. - PYI030.py:89:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` | 88 | # Should use the first literal subscript attribute when fixing @@ -550,5 +500,3 @@ PYI030.py:89:10: PYI030 [*] Multiple literal members in a union. Use a single li 88 88 | # Should use the first literal subscript attribute when fixing 89 |-field25: typing.Union[typing_extensions.Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]], str] # Error 89 |+field25: typing.Union[typing_extensions.Literal[1, 2, 3, 4], str] # Error - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap index 316a9f1f8f183..bb3f935387432 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI030_PYI030.pyi.snap @@ -20,8 +20,6 @@ PYI030.pyi:9:9: PYI030 [*] Multiple literal members in a union. Use a single lit 11 11 | # Should emit for union types in arguments. 12 12 | def func1(arg1: Literal[1] | Literal[2]): # Error - Run `ruff check --fix` to apply this fix. - PYI030.pyi:12:17: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 11 | # Should emit for union types in arguments. @@ -40,8 +38,6 @@ PYI030.pyi:12:17: PYI030 [*] Multiple literal members in a union. Use a single l 14 14 | 15 15 | - Run `ruff check --fix` to apply this fix. - PYI030.pyi:17:16: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 16 | # Should emit for unions in return types. @@ -60,8 +56,6 @@ PYI030.pyi:17:16: PYI030 [*] Multiple literal members in a union. Use a single l 19 19 | 20 20 | - Run `ruff check --fix` to apply this fix. - PYI030.pyi:22:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 21 | # Should emit in longer unions, even if not directly adjacent. @@ -81,8 +75,6 @@ PYI030.pyi:22:9: PYI030 [*] Multiple literal members in a union. Use a single li 24 24 | field5: Literal[1] | str | Literal[2] # Error 25 25 | field6: Literal[1] | bool | Literal[2] | str # Error - Run `ruff check --fix` to apply this fix. - PYI030.pyi:23:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 21 | # Should emit in longer unions, even if not directly adjacent. @@ -103,8 +95,6 @@ PYI030.pyi:23:9: PYI030 [*] Multiple literal members in a union. Use a single li 25 25 | field6: Literal[1] | bool | Literal[2] | str # Error 26 26 | - Run `ruff check --fix` to apply this fix. - PYI030.pyi:24:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 22 | field3: Literal[1] | Literal[2] | str # Error @@ -124,8 +114,6 @@ PYI030.pyi:24:9: PYI030 [*] Multiple literal members in a union. Use a single li 26 26 | 27 27 | # Should emit for non-type unions. - Run `ruff check --fix` to apply this fix. - PYI030.pyi:25:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 23 | field4: str | Literal[1] | Literal[2] # Error @@ -146,8 +134,6 @@ PYI030.pyi:25:9: PYI030 [*] Multiple literal members in a union. Use a single li 27 27 | # Should emit for non-type unions. 28 28 | field7 = Literal[1] | Literal[2] # Error - Run `ruff check --fix` to apply this fix. - PYI030.pyi:28:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 27 | # Should emit for non-type unions. @@ -167,8 +153,6 @@ PYI030.pyi:28:10: PYI030 [*] Multiple literal members in a union. Use a single l 30 30 | # Should emit for parenthesized unions. 31 31 | field8: Literal[1] | (Literal[2] | str) # Error - Run `ruff check --fix` to apply this fix. - PYI030.pyi:31:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 30 | # Should emit for parenthesized unions. @@ -188,8 +172,6 @@ PYI030.pyi:31:9: PYI030 [*] Multiple literal members in a union. Use a single li 33 33 | # Should handle user parentheses when fixing. 34 34 | field9: Literal[1] | (Literal[2] | str) # Error - Run `ruff check --fix` to apply this fix. - PYI030.pyi:34:9: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 33 | # Should handle user parentheses when fixing. @@ -208,8 +190,6 @@ PYI030.pyi:34:9: PYI030 [*] Multiple literal members in a union. Use a single li 36 36 | 37 37 | # Should emit for union in generic parent type. - Run `ruff check --fix` to apply this fix. - PYI030.pyi:35:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 33 | # Should handle user parentheses when fixing. @@ -230,8 +210,6 @@ PYI030.pyi:35:10: PYI030 [*] Multiple literal members in a union. Use a single l 37 37 | # Should emit for union in generic parent type. 38 38 | field11: dict[Literal[1] | Literal[2], str] # Error - Run `ruff check --fix` to apply this fix. - PYI030.pyi:38:15: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 37 | # Should emit for union in generic parent type. @@ -251,8 +229,6 @@ PYI030.pyi:38:15: PYI030 [*] Multiple literal members in a union. Use a single l 40 40 | # Should emit for unions with more than two cases 41 41 | field12: Literal[1] | Literal[2] | Literal[3] # Error - Run `ruff check --fix` to apply this fix. - PYI030.pyi:41:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3]` | 40 | # Should emit for unions with more than two cases @@ -271,8 +247,6 @@ PYI030.pyi:41:10: PYI030 [*] Multiple literal members in a union. Use a single l 43 43 | 44 44 | # Should emit for unions with more than two cases, even if not directly adjacent - Run `ruff check --fix` to apply this fix. - PYI030.pyi:42:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` | 40 | # Should emit for unions with more than two cases @@ -293,8 +267,6 @@ PYI030.pyi:42:10: PYI030 [*] Multiple literal members in a union. Use a single l 44 44 | # Should emit for unions with more than two cases, even if not directly adjacent 45 45 | field14: Literal[1] | Literal[2] | str | Literal[3] # Error - Run `ruff check --fix` to apply this fix. - PYI030.pyi:45:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3]` | 44 | # Should emit for unions with more than two cases, even if not directly adjacent @@ -314,8 +286,6 @@ PYI030.pyi:45:10: PYI030 [*] Multiple literal members in a union. Use a single l 47 47 | # Should emit for unions with mixed literal internal types 48 48 | field15: Literal[1] | Literal["foo"] | Literal[True] # Error - Run `ruff check --fix` to apply this fix. - PYI030.pyi:48:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, "foo", True]` | 47 | # Should emit for unions with mixed literal internal types @@ -335,8 +305,6 @@ PYI030.pyi:48:10: PYI030 [*] Multiple literal members in a union. Use a single l 50 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 51 51 | field16: Literal[1] | Literal[1] # OK - Run `ruff check --fix` to apply this fix. - PYI030.pyi:51:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 1]` | 50 | # Shouldn't emit for duplicate field types with same value; covered by Y016 @@ -356,8 +324,6 @@ PYI030.pyi:51:10: PYI030 [*] Multiple literal members in a union. Use a single l 53 53 | # Shouldn't emit if in new parent type 54 54 | field17: Literal[1] | dict[Literal[2], str] # OK - Run `ruff check --fix` to apply this fix. - PYI030.pyi:60:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 59 | # Should respect name of literal type used @@ -377,8 +343,6 @@ PYI030.pyi:60:10: PYI030 [*] Multiple literal members in a union. Use a single l 62 62 | # Should emit in cases with newlines 63 63 | field20: typing.Union[ - Run `ruff check --fix` to apply this fix. - PYI030.pyi:63:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 62 | # Should emit in cases with newlines @@ -409,8 +373,6 @@ PYI030.pyi:63:10: PYI030 [*] Multiple literal members in a union. Use a single l 70 65 | # Should handle multiple unions with multiple members 71 66 | field21: Literal[1, 2] | Literal[3, 4] # Error - Run `ruff check --fix` to apply this fix. - PYI030.pyi:71:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` | 70 | # Should handle multiple unions with multiple members @@ -430,8 +392,6 @@ PYI030.pyi:71:10: PYI030 [*] Multiple literal members in a union. Use a single l 73 73 | # Should emit in cases with `typing.Union` instead of `|` 74 74 | field22: typing.Union[Literal[1], Literal[2]] # Error - Run `ruff check --fix` to apply this fix. - PYI030.pyi:74:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 73 | # Should emit in cases with `typing.Union` instead of `|` @@ -451,8 +411,6 @@ PYI030.pyi:74:10: PYI030 [*] Multiple literal members in a union. Use a single l 76 76 | # Should emit in cases with `typing_extensions.Literal` 77 77 | field23: typing_extensions.Literal[1] | typing_extensions.Literal[2] # Error - Run `ruff check --fix` to apply this fix. - PYI030.pyi:77:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 76 | # Should emit in cases with `typing_extensions.Literal` @@ -472,8 +430,6 @@ PYI030.pyi:77:10: PYI030 [*] Multiple literal members in a union. Use a single l 79 79 | # Should emit in cases with nested `typing.Union` 80 80 | field24: typing.Union[Literal[1], typing.Union[Literal[2], str]] # Error - Run `ruff check --fix` to apply this fix. - PYI030.pyi:80:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 79 | # Should emit in cases with nested `typing.Union` @@ -493,8 +449,6 @@ PYI030.pyi:80:10: PYI030 [*] Multiple literal members in a union. Use a single l 82 82 | # Should emit in cases with mixed `typing.Union` and `|` 83 83 | field25: typing.Union[Literal[1], Literal[2] | str] # Error - Run `ruff check --fix` to apply this fix. - PYI030.pyi:83:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2]` | 82 | # Should emit in cases with mixed `typing.Union` and `|` @@ -514,8 +468,6 @@ PYI030.pyi:83:10: PYI030 [*] Multiple literal members in a union. Use a single l 85 85 | # Should emit only once in cases with multiple nested `typing.Union` 86 86 | field24: typing.Union[Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]]] # Error - Run `ruff check --fix` to apply this fix. - PYI030.pyi:86:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` | 85 | # Should emit only once in cases with multiple nested `typing.Union` @@ -535,8 +487,6 @@ PYI030.pyi:86:10: PYI030 [*] Multiple literal members in a union. Use a single l 88 88 | # Should use the first literal subscript attribute when fixing 89 89 | field25: typing.Union[typing_extensions.Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]], str] # Error - Run `ruff check --fix` to apply this fix. - PYI030.pyi:89:10: PYI030 [*] Multiple literal members in a union. Use a single literal, e.g. `Literal[1, 2, 3, 4]` | 88 | # Should use the first literal subscript attribute when fixing @@ -550,5 +500,3 @@ PYI030.pyi:89:10: PYI030 [*] Multiple literal members in a union. Use a single l 88 88 | # Should use the first literal subscript attribute when fixing 89 |-field25: typing.Union[typing_extensions.Literal[1], typing.Union[Literal[2], typing.Union[Literal[3], Literal[4]]], str] # Error 89 |+field25: typing.Union[typing_extensions.Literal[1, 2, 3, 4], str] # Error - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.py.snap index 2812736eb793c..c521f243f92b5 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.py.snap @@ -19,8 +19,6 @@ PYI032.py:6:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to 8 8 | 9 9 | - Run `ruff check --fix` to apply this fix. - PYI032.py:7:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to `__ne__` | 5 | class Bad: @@ -38,5 +36,3 @@ PYI032.py:7:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to 8 8 | 9 9 | 10 10 | class Good: - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.pyi.snap index 41fcde5b465cf..0a1b512351a0f 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.pyi.snap @@ -19,8 +19,6 @@ PYI032.pyi:6:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to 8 8 | 9 9 | - Run `ruff check --fix` to apply this fix. - PYI032.pyi:7:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to `__ne__` | 5 | class Bad: @@ -38,5 +36,3 @@ PYI032.pyi:7:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to 8 8 | 9 9 | 10 10 | class Good: - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.py.snap index 6bf34fe6f9cbe..064410ed79023 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.py.snap @@ -19,8 +19,6 @@ PYI036.py:54:31: PYI036 [*] Star-args in `__exit__` should be annotated with `ob 56 56 | 57 57 | class BadTwo: - Run `ruff check --fix` to apply this fix. - PYI036.py:55:24: PYI036 If there are no star-args, `__aexit__` should have at least 3 non-keyword-only args (excluding `self`) | 53 | class BadOne: @@ -121,8 +119,6 @@ PYI036.py:70:58: PYI036 [*] Star-args in `__exit__` should be annotated with `ob 72 72 | 73 73 | class BadSix: - Run `ruff check --fix` to apply this fix. - PYI036.py:71:74: PYI036 [*] Star-args in `__aexit__` should be annotated with `object` | 69 | class BadFive: @@ -143,8 +139,6 @@ PYI036.py:71:74: PYI036 [*] Star-args in `__aexit__` should be annotated with `o 73 73 | class BadSix: 74 74 | def __exit__(self, typ, exc, tb, weird_extra_arg, extra_arg2 = None) -> None: ... # PYI036: Extra arg must have default - Run `ruff check --fix` to apply this fix. - PYI036.py:74:38: PYI036 All arguments after the first four in `__exit__` must have a default value | 73 | class BadSix: diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.pyi.snap index 2225b779921ce..0bb6b20b198ec 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI036_PYI036.pyi.snap @@ -19,8 +19,6 @@ PYI036.pyi:54:31: PYI036 [*] Star-args in `__exit__` should be annotated with `o 56 56 | 57 57 | class BadTwo: - Run `ruff check --fix` to apply this fix. - PYI036.pyi:55:24: PYI036 If there are no star-args, `__aexit__` should have at least 3 non-keyword-only args (excluding `self`) | 53 | class BadOne: @@ -131,8 +129,6 @@ PYI036.pyi:70:58: PYI036 [*] Star-args in `__exit__` should be annotated with `o 72 72 | 73 73 | class BadSix: - Run `ruff check --fix` to apply this fix. - PYI036.pyi:71:74: PYI036 [*] Star-args in `__aexit__` should be annotated with `object` | 69 | class BadFive: @@ -153,8 +149,6 @@ PYI036.pyi:71:74: PYI036 [*] Star-args in `__aexit__` should be annotated with ` 73 73 | class BadSix: 74 74 | def __exit__(self, typ, exc, tb, weird_extra_arg, extra_arg2 = None) -> None: ... # PYI036: Extra arg must have default - Run `ruff check --fix` to apply this fix. - PYI036.pyi:74:38: PYI036 All arguments after the first four in `__exit__` must have a default value | 73 | class BadSix: diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap index 74f9cff63db1a..8c2a95255da96 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap @@ -21,8 +21,6 @@ PYI053.pyi:7:14: PYI053 [*] String and bytes literals longer than 50 characters 9 9 | def f3( 10 10 | x: str = "50 character stringgggggggggggggggggggggggggggggg\U0001f600", # OK - Run `ruff check --fix` to apply this fix. - PYI053.pyi:13:14: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 11 | ) -> None: ... @@ -43,8 +41,6 @@ PYI053.pyi:13:14: PYI053 [*] String and bytes literals longer than 50 characters 15 15 | def f5( 16 16 | x: bytes = b"50 character byte stringgggggggggggggggggggggggggg", # OK - Run `ruff check --fix` to apply this fix. - PYI053.pyi:25:16: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 23 | ) -> None: ... @@ -64,8 +60,6 @@ PYI053.pyi:25:16: PYI053 [*] String and bytes literals longer than 50 characters 27 27 | 28 28 | foo: str = "50 character stringggggggggggggggggggggggggggggggg" # OK - Run `ruff check --fix` to apply this fix. - PYI053.pyi:30:12: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 28 | foo: str = "50 character stringggggggggggggggggggggggggggggggg" # OK @@ -86,8 +80,6 @@ PYI053.pyi:30:12: PYI053 [*] String and bytes literals longer than 50 characters 32 32 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK 33 33 | - Run `ruff check --fix` to apply this fix. - PYI053.pyi:34:14: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 32 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK @@ -108,8 +100,6 @@ PYI053.pyi:34:14: PYI053 [*] String and bytes literals longer than 50 characters 36 36 | ffoo: str = f"50 character stringggggggggggggggggggggggggggggggg" # OK 37 37 | - Run `ruff check --fix` to apply this fix. - PYI053.pyi:38:13: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 36 | ffoo: str = f"50 character stringggggggggggggggggggggggggggggggg" # OK @@ -130,8 +120,6 @@ PYI053.pyi:38:13: PYI053 [*] String and bytes literals longer than 50 characters 40 40 | class Demo: 41 41 | """Docstrings are excluded from this rule. Some padding.""" # OK - Run `ruff check --fix` to apply this fix. - PYI053.pyi:64:5: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 63 | @not_warnings_dot_deprecated( @@ -151,8 +139,6 @@ PYI053.pyi:64:5: PYI053 [*] String and bytes literals longer than 50 characters 66 66 | def not_a_deprecated_function() -> None: ... 67 67 | - Run `ruff check --fix` to apply this fix. - PYI053.pyi:68:13: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 66 | def not_a_deprecated_function() -> None: ... @@ -167,5 +153,3 @@ PYI053.pyi:68:13: PYI053 [*] String and bytes literals longer than 50 characters 67 67 | 68 |-fbaz: str = f"51 character {foo} stringgggggggggggggggggggggggggg" # Error: PYI053 68 |+fbaz: str = ... # Error: PYI053 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap index 0fc04f8615f87..891fa4d843cb3 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap @@ -18,8 +18,6 @@ PYI054.pyi:2:16: PYI054 [*] Numeric literals with a string representation longer 4 4 | field04: int = -0xFFFFFFFFF # Error: PYI054 5 5 | - Run `ruff check --fix` to apply this fix. - PYI054.pyi:4:17: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 2 | field02: int = 0xFFFFFFFFF # Error: PYI054 @@ -40,8 +38,6 @@ PYI054.pyi:4:17: PYI054 [*] Numeric literals with a string representation longer 6 6 | field05: int = 1234567890 7 7 | field06: int = 12_456_890 - Run `ruff check --fix` to apply this fix. - PYI054.pyi:8:16: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 6 | field05: int = 1234567890 @@ -62,8 +58,6 @@ PYI054.pyi:8:16: PYI054 [*] Numeric literals with a string representation longer 10 10 | field09: int = -234_567_890 # Error: PYI054 11 11 | - Run `ruff check --fix` to apply this fix. - PYI054.pyi:10:17: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 8 | field07: int = 12345678901 # Error: PYI054 @@ -84,8 +78,6 @@ PYI054.pyi:10:17: PYI054 [*] Numeric literals with a string representation longe 12 12 | field10: float = 123.456789 13 13 | field11: float = 123.4567890 # Error: PYI054 - Run `ruff check --fix` to apply this fix. - PYI054.pyi:13:18: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 12 | field10: float = 123.456789 @@ -105,8 +97,6 @@ PYI054.pyi:13:18: PYI054 [*] Numeric literals with a string representation longe 15 15 | field13: float = -123.567_890 # Error: PYI054 16 16 | - Run `ruff check --fix` to apply this fix. - PYI054.pyi:15:19: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 13 | field11: float = 123.4567890 # Error: PYI054 @@ -127,8 +117,6 @@ PYI054.pyi:15:19: PYI054 [*] Numeric literals with a string representation longe 17 17 | field14: complex = 1e1234567j 18 18 | field15: complex = 1e12345678j # Error: PYI054 - Run `ruff check --fix` to apply this fix. - PYI054.pyi:18:20: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 17 | field14: complex = 1e1234567j @@ -147,8 +135,6 @@ PYI054.pyi:18:20: PYI054 [*] Numeric literals with a string representation longe 19 19 | field16: complex = -1e1234567j 20 20 | field17: complex = 1e123456789j # Error: PYI054 - Run `ruff check --fix` to apply this fix. - PYI054.pyi:20:20: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 18 | field15: complex = 1e12345678j # Error: PYI054 @@ -163,5 +149,3 @@ PYI054.pyi:20:20: PYI054 [*] Numeric literals with a string representation longe 19 19 | field16: complex = -1e1234567j 20 |-field17: complex = 1e123456789j # Error: PYI054 20 |+field17: complex = ... # Error: PYI054 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.py.snap index cca2aafb26b59..6a59f43557454 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.py.snap @@ -20,8 +20,6 @@ PYI055.py:31:8: PYI055 [*] Multiple `type` members in a union. Combine them into 33 33 | 34 34 | - Run `ruff check --fix` to apply this fix. - PYI055.py:32:8: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[requests_mock.Mocker, httpretty, str]]`. | 30 | # PYI055 @@ -40,8 +38,6 @@ PYI055.py:32:8: PYI055 [*] Multiple `type` members in a union. Combine them into 34 34 | 35 35 | def func(): - Run `ruff check --fix` to apply this fix. - PYI055.py:39:8: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[requests_mock.Mocker, httpretty, str]]`. | 38 | # PYI055 @@ -59,8 +55,6 @@ PYI055.py:39:8: PYI055 [*] Multiple `type` members in a union. Combine them into 41 41 | 42 42 | def convert_union(union: UnionType) -> _T | None: - Run `ruff check --fix` to apply this fix. - PYI055.py:44:9: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. | 42 | def convert_union(union: UnionType) -> _T | None: @@ -81,8 +75,6 @@ PYI055.py:44:9: PYI055 [*] Multiple `type` members in a union. Combine them into 46 46 | ... 47 47 | - Run `ruff check --fix` to apply this fix. - PYI055.py:50:15: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. | 48 | def convert_union(union: UnionType) -> _T | None: @@ -103,8 +95,6 @@ PYI055.py:50:15: PYI055 [*] Multiple `type` members in a union. Combine them int 52 52 | ... 53 53 | - Run `ruff check --fix` to apply this fix. - PYI055.py:56:15: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. | 54 | def convert_union(union: UnionType) -> _T | None: @@ -125,8 +115,6 @@ PYI055.py:56:15: PYI055 [*] Multiple `type` members in a union. Combine them int 58 58 | ... 59 59 | - Run `ruff check --fix` to apply this fix. - PYI055.py:62:15: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. | 60 | def convert_union(union: UnionType) -> _T | None: @@ -145,5 +133,3 @@ PYI055.py:62:15: PYI055 [*] Multiple `type` members in a union. Combine them int 62 |+ Union[type[_T | Converter[_T]] | str] | Converter[_T] | Callable[[str], _T], ... # PYI055 63 63 | ] = union.__args__ 64 64 | ... - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.pyi.snap index 2887197d4322f..763a01229df28 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI055_PYI055.pyi.snap @@ -21,8 +21,6 @@ PYI055.pyi:4:4: PYI055 [*] Multiple `type` members in a union. Combine them into 6 6 | y: builtins.type[int] | type[str] | builtins.type[complex] 7 7 | z: Union[type[float], type[complex]] - Run `ruff check --fix` to apply this fix. - PYI055.pyi:5:4: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[int | str | float]`. | 4 | w: builtins.type[int] | builtins.type[str] | builtins.type[complex] @@ -42,8 +40,6 @@ PYI055.pyi:5:4: PYI055 [*] Multiple `type` members in a union. Combine them into 7 7 | z: Union[type[float], type[complex]] 8 8 | z: Union[type[float, int], type[complex]] - Run `ruff check --fix` to apply this fix. - PYI055.pyi:6:4: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[int | str | complex]`. | 4 | w: builtins.type[int] | builtins.type[str] | builtins.type[complex] @@ -64,8 +60,6 @@ PYI055.pyi:6:4: PYI055 [*] Multiple `type` members in a union. Combine them into 8 8 | z: Union[type[float, int], type[complex]] 9 9 | - Run `ruff check --fix` to apply this fix. - PYI055.pyi:7:4: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[float, complex]]`. | 5 | x: type[int] | type[str] | type[float] @@ -85,8 +79,6 @@ PYI055.pyi:7:4: PYI055 [*] Multiple `type` members in a union. Combine them into 9 9 | 10 10 | def func(arg: type[int] | str | type[float]) -> None: ... - Run `ruff check --fix` to apply this fix. - PYI055.pyi:8:4: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[float, int, complex]]`. | 6 | y: builtins.type[int] | type[str] | builtins.type[complex] @@ -107,8 +99,6 @@ PYI055.pyi:8:4: PYI055 [*] Multiple `type` members in a union. Combine them into 10 10 | def func(arg: type[int] | str | type[float]) -> None: ... 11 11 | - Run `ruff check --fix` to apply this fix. - PYI055.pyi:10:15: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[int | float]`. | 8 | z: Union[type[float, int], type[complex]] @@ -129,8 +119,6 @@ PYI055.pyi:10:15: PYI055 [*] Multiple `type` members in a union. Combine them in 12 12 | # OK 13 13 | x: type[int, str, float] - Run `ruff check --fix` to apply this fix. - PYI055.pyi:20:7: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[requests_mock.Mocker | httpretty]`. | 19 | # OK @@ -150,8 +138,6 @@ PYI055.pyi:20:7: PYI055 [*] Multiple `type` members in a union. Combine them int 22 22 | def func(): 23 23 | # PYI055 - Run `ruff check --fix` to apply this fix. - PYI055.pyi:24:11: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[requests_mock.Mocker | httpretty | str]`. | 22 | def func(): @@ -169,8 +155,6 @@ PYI055.pyi:24:11: PYI055 [*] Multiple `type` members in a union. Combine them in 24 |+ item: type[requests_mock.Mocker | httpretty | str] = requests_mock.Mocker 25 25 | item2: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker - Run `ruff check --fix` to apply this fix. - PYI055.pyi:25:12: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[requests_mock.Mocker, httpretty, str]]`. | 23 | # PYI055 @@ -185,5 +169,3 @@ PYI055.pyi:25:12: PYI055 [*] Multiple `type` members in a union. Combine them in 24 24 | item: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker 25 |- item2: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker 25 |+ item2: type[Union[requests_mock.Mocker, httpretty, str]] = requests_mock.Mocker - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.py.snap index 611ba91607b1c..49001f96d1ade 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.py.snap @@ -21,8 +21,6 @@ PYI058.py:5:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter 7 8 | 8 9 | - Run `ruff check --fix` to apply this fix. - PYI058.py:13:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 12 | class IteratorReturningSimpleGenerator2: @@ -41,8 +39,6 @@ PYI058.py:13:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite 15 15 | 16 16 | - Run `ruff check --fix` to apply this fix. - PYI058.py:21:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 20 | class IteratorReturningSimpleGenerator3: @@ -61,8 +57,6 @@ PYI058.py:21:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite 23 23 | 24 24 | - Run `ruff check --fix` to apply this fix. - PYI058.py:30:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 29 | class IteratorReturningSimpleGenerator4: @@ -81,8 +75,6 @@ PYI058.py:30:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite 32 32 | 33 33 | - Run `ruff check --fix` to apply this fix. - PYI058.py:39:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 38 | class IteratorReturningSimpleGenerator5: @@ -101,8 +93,6 @@ PYI058.py:39:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite 41 41 | 42 42 | - Run `ruff check --fix` to apply this fix. - PYI058.py:47:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 46 | class IteratorReturningSimpleGenerator6: @@ -126,8 +116,6 @@ PYI058.py:47:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite 49 50 | 50 51 | - Run `ruff check --fix` to apply this fix. - PYI058.py:55:13: PYI058 [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods | 54 | class AsyncIteratorReturningSimpleAsyncGenerator1: @@ -147,8 +135,6 @@ PYI058.py:55:13: PYI058 [*] Use `AsyncIterator` as the return value for simple ` 59 59 | 60 60 | - Run `ruff check --fix` to apply this fix. - PYI058.py:73:13: PYI058 [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods | 72 | class AsyncIteratorReturningSimpleAsyncGenerator3: @@ -165,6 +151,4 @@ PYI058.py:73:13: PYI058 [*] Use `AsyncIterator` as the return value for simple ` 73 |+ def __aiter__(self, /) -> collections.abc.AsyncIterator[str]: 74 74 | ... # PYI058 (Use `AsyncIterator`) 75 75 | -76 76 | - - Run `ruff check --fix` to apply this fix. +76 76 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap index d6aa24e2b32b1..90b47bbbc4b11 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI058_PYI058.pyi.snap @@ -22,8 +22,6 @@ PYI058.pyi:5:13: PYI058 [*] Use `Iterator` as the return value for simple `__ite 7 8 | def scope(): 8 9 | import typing - Run `ruff check --fix` to apply this fix. - PYI058.pyi:11:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 10 | class IteratorReturningSimpleGenerator2: @@ -43,8 +41,6 @@ PYI058.pyi:11:13: PYI058 [*] Use `Iterator` as the return value for simple `__it 13 13 | def scope(): 14 14 | import collections.abc - Run `ruff check --fix` to apply this fix. - PYI058.pyi:17:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 16 | class IteratorReturningSimpleGenerator3: @@ -64,8 +60,6 @@ PYI058.pyi:17:13: PYI058 [*] Use `Iterator` as the return value for simple `__it 19 19 | def scope(): 20 20 | import collections.abc - Run `ruff check --fix` to apply this fix. - PYI058.pyi:24:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 23 | class IteratorReturningSimpleGenerator4: @@ -85,8 +79,6 @@ PYI058.pyi:24:13: PYI058 [*] Use `Iterator` as the return value for simple `__it 26 26 | def scope(): 27 27 | import collections.abc - Run `ruff check --fix` to apply this fix. - PYI058.pyi:31:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 30 | class IteratorReturningSimpleGenerator5: @@ -106,8 +98,6 @@ PYI058.pyi:31:13: PYI058 [*] Use `Iterator` as the return value for simple `__it 33 33 | def scope(): 34 34 | from collections.abc import Generator - Run `ruff check --fix` to apply this fix. - PYI058.pyi:37:13: PYI058 [*] Use `Iterator` as the return value for simple `__iter__` methods | 36 | class IteratorReturningSimpleGenerator6: @@ -132,8 +122,6 @@ PYI058.pyi:37:13: PYI058 [*] Use `Iterator` as the return value for simple `__it 39 40 | def scope(): 40 41 | import typing_extensions - Run `ruff check --fix` to apply this fix. - PYI058.pyi:43:13: PYI058 [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods | 42 | class AsyncIteratorReturningSimpleAsyncGenerator1: @@ -153,8 +141,6 @@ PYI058.pyi:43:13: PYI058 [*] Use `AsyncIterator` as the return value for simple 45 45 | def scope(): 46 46 | import collections.abc - Run `ruff check --fix` to apply this fix. - PYI058.pyi:49:13: PYI058 [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods | 48 | class AsyncIteratorReturningSimpleAsyncGenerator3: @@ -173,8 +159,6 @@ PYI058.pyi:49:13: PYI058 [*] Use `AsyncIterator` as the return value for simple 51 51 | 52 52 | def scope(): - Run `ruff check --fix` to apply this fix. - PYI058.pyi:56:13: PYI058 [*] Use `AsyncIterator` as the return value for simple `__aiter__` methods | 55 | class AsyncIteratorReturningSimpleAsyncGenerator3: @@ -193,5 +177,3 @@ PYI058.pyi:56:13: PYI058 [*] Use `AsyncIterator` as the return value for simple 57 57 | 58 58 | def scope(): 59 59 | from typing import Iterator - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap index ad31c6f238068..0ad6bec302a0f 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.py.snap @@ -21,8 +21,6 @@ PYI059.py:8:17: PYI059 [*] `Generic[]` should always be the last base class 10 10 | self._items: List[T] = [] 11 11 | - Run `ruff check --fix` to apply this fix. - PYI059.py:15:16: PYI059 [*] `Generic[]` should always be the last base class | 13 | self._items.append(item) @@ -49,8 +47,6 @@ PYI059.py:15:16: PYI059 [*] `Generic[]` should always be the last base class 20 19 | ... 21 20 | - Run `ruff check --fix` to apply this fix. - PYI059.py:26:10: PYI059 [*] `Generic[]` should always be the last base class | 24 | # to flag this issue in this case as well, since after fixing the error @@ -70,8 +66,6 @@ PYI059.py:26:10: PYI059 [*] `Generic[]` should always be the last base class 28 28 | 29 29 | - Run `ruff check --fix` to apply this fix. - PYI059.py:30:10: PYI059 [*] `Generic[]` should always be the last base class | 30 | class Foo( # comment about the bracket @@ -106,8 +100,6 @@ PYI059.py:30:10: PYI059 [*] `Generic[]` should always be the last base class 40 38 | ): # and another one for good measure 41 39 | ... - Run `ruff check --fix` to apply this fix. - PYI059.py:45:8: PYI059 `Generic[]` should always be the last base class | 44 | # in case of multiple Generic[] inheritance, don't fix it. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap index a69905cfc2825..b8472c9377092 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI059_PYI059.pyi.snap @@ -21,8 +21,6 @@ PYI059.pyi:8:17: PYI059 [*] `Generic[]` should always be the last base class 10 10 | def push(self, item: T) -> None: ... 11 11 | - Run `ruff check --fix` to apply this fix. - PYI059.pyi:12:16: PYI059 [*] `Generic[]` should always be the last base class | 10 | def push(self, item: T) -> None: ... @@ -49,8 +47,6 @@ PYI059.pyi:12:16: PYI059 [*] `Generic[]` should always be the last base class 17 16 | ... 18 17 | - Run `ruff check --fix` to apply this fix. - PYI059.pyi:22:10: PYI059 [*] `Generic[]` should always be the last base class | 20 | # to flag this issue in this case as well, since after fixing the error @@ -69,8 +65,6 @@ PYI059.pyi:22:10: PYI059 [*] `Generic[]` should always be the last base class 24 24 | 25 25 | class Foo( # comment about the bracket - Run `ruff check --fix` to apply this fix. - PYI059.pyi:25:10: PYI059 [*] `Generic[]` should always be the last base class | 25 | class Foo( # comment about the bracket @@ -105,8 +99,6 @@ PYI059.pyi:25:10: PYI059 [*] `Generic[]` should always be the last base class 35 33 | ): # and another one for good measure 36 34 | ... - Run `ruff check --fix` to apply this fix. - PYI059.pyi:40:8: PYI059 `Generic[]` should always be the last base class | 39 | # in case of multiple Generic[] inheritance, don't fix it. diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap index a64b9538e9b9d..61c46fd30fe69 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.py.snap @@ -20,8 +20,6 @@ PYI064.py:3:1: PYI064 [*] `Final[Literal[True]]` can be replaced with a bare `Fi 5 5 | z: Final[Literal[ # PYI064 6 6 | "this is a really long literal, that won't be rendered in the issue text" - Run `ruff check --fix` to apply this fix. - PYI064.py:4:1: PYI064 [*] `Final[Literal[None]]` can be replaced with a bare `Final` | 3 | x: Final[Literal[True]] = True # PYI064 @@ -41,8 +39,6 @@ PYI064.py:4:1: PYI064 [*] `Final[Literal[None]]` can be replaced with a bare `Fi 6 6 | "this is a really long literal, that won't be rendered in the issue text" 7 7 | ]] = "this is a really long literal, that won't be rendered in the issue text" - Run `ruff check --fix` to apply this fix. - PYI064.py:5:1: PYI064 [*] `Final[Literal[...]]` can be replaced with a bare `Final` | 3 | x: Final[Literal[True]] = True # PYI064 @@ -67,8 +63,6 @@ PYI064.py:5:1: PYI064 [*] `Final[Literal[...]]` can be replaced with a bare `Fin 9 7 | # This should be fixable, and marked as safe 10 8 | w1: Final[Literal[123]] # PYI064 - Run `ruff check --fix` to apply this fix. - PYI064.py:10:1: PYI064 [*] `Final[Literal[123]]` can be replaced with a bare `Final` | 9 | # This should be fixable, and marked as safe @@ -88,8 +82,6 @@ PYI064.py:10:1: PYI064 [*] `Final[Literal[123]]` can be replaced with a bare `Fi 12 12 | # This should not be fixable 13 13 | w2: Final[Literal[123]] = "random value" # PYI064 - Run `ruff check --fix` to apply this fix. - PYI064.py:13:1: PYI064 `Final[Literal[123]]` can be replaced with a bare `Final` | 12 | # This should not be fixable diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap index 523e35383243c..7a8cfbd5221c8 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI064_PYI064.pyi.snap @@ -20,8 +20,6 @@ PYI064.pyi:3:1: PYI064 [*] `Final[Literal[True]]` can be replaced with a bare `F 5 5 | z: Final[Literal["this is a really long literal, that won't be rendered in the issue text"]] # PYI064 6 6 | - Run `ruff check --fix` to apply this fix. - PYI064.pyi:4:1: PYI064 [*] `Final[Literal[None]]` can be replaced with a bare `Final` | 3 | x: Final[Literal[True]] # PYI064 @@ -40,8 +38,6 @@ PYI064.pyi:4:1: PYI064 [*] `Final[Literal[None]]` can be replaced with a bare `F 6 6 | 7 7 | # This should be fixable, and marked as safe - Run `ruff check --fix` to apply this fix. - PYI064.pyi:5:1: PYI064 [*] `Final[Literal[...]]` can be replaced with a bare `Final` | 3 | x: Final[Literal[True]] # PYI064 @@ -62,8 +58,6 @@ PYI064.pyi:5:1: PYI064 [*] `Final[Literal[...]]` can be replaced with a bare `Fi 7 7 | # This should be fixable, and marked as safe 8 8 | w1: Final[Literal[123]] # PYI064 - Run `ruff check --fix` to apply this fix. - PYI064.pyi:8:1: PYI064 [*] `Final[Literal[123]]` can be replaced with a bare `Final` | 7 | # This should be fixable, and marked as safe @@ -83,8 +77,6 @@ PYI064.pyi:8:1: PYI064 [*] `Final[Literal[123]]` can be replaced with a bare `Fi 10 10 | # This should not be fixable 11 11 | w2: Final[Literal[123]] = "random value" # PYI064 - Run `ruff check --fix` to apply this fix. - PYI064.pyi:11:1: PYI064 `Final[Literal[123]]` can be replaced with a bare `Final` | 10 | # This should not be fixable diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap index 10316a0690774..a48673aef5903 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap @@ -21,8 +21,6 @@ PYI026.pyi:3:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g 5 6 | Foo = Literal["foo"] 6 7 | IntOrStr = int | str - Run `ruff check --fix` to apply this fix. - PYI026.pyi:4:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]` | 3 | NewAny = Any @@ -43,8 +41,6 @@ PYI026.pyi:4:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g 6 7 | IntOrStr = int | str 7 8 | AliasNone = None - Run `ruff check --fix` to apply this fix. - PYI026.pyi:5:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]` | 3 | NewAny = Any @@ -67,8 +63,6 @@ PYI026.pyi:5:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g 7 8 | AliasNone = None 8 9 | - Run `ruff check --fix` to apply this fix. - PYI026.pyi:6:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str` | 4 | OptionalStr = typing.Optional[str] @@ -91,8 +85,6 @@ PYI026.pyi:6:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g 8 9 | 9 10 | NewAny: typing.TypeAlias = Any - Run `ruff check --fix` to apply this fix. - PYI026.pyi:7:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None` | 5 | Foo = Literal["foo"] @@ -117,8 +109,6 @@ PYI026.pyi:7:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g 9 10 | NewAny: typing.TypeAlias = Any 10 11 | OptionalStr: TypeAlias = typing.Optional[str] - Run `ruff check --fix` to apply this fix. - PYI026.pyi:17:5: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `FLAG_THIS: TypeAlias = None` | 16 | class NotAnEnum: @@ -143,5 +133,3 @@ PYI026.pyi:17:5: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e. 18 19 | 19 20 | # these are ok 20 21 | from enum import Enum - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_default.snap index 3bfb5d5d918ce..b9cd89379ec75 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_default.snap @@ -19,8 +19,6 @@ PT001.py:9:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` 11 11 | return 42 12 12 | - Run `ruff check --fix` to apply this fix. - PT001.py:34:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` | 34 | @fixture @@ -39,8 +37,6 @@ PT001.py:34:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` 36 36 | return 42 37 37 | - Run `ruff check --fix` to apply this fix. - PT001.py:59:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` | 59 | @aliased @@ -57,6 +53,4 @@ PT001.py:59:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` 59 |+@aliased() 60 60 | def aliased_no_parentheses(): 61 61 | return 42 -62 62 | - - Run `ruff check --fix` to apply this fix. +62 62 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_no_parentheses.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_no_parentheses.snap index c52c1c2f6d9bc..dafbb57a29e70 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_no_parentheses.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_no_parentheses.snap @@ -19,8 +19,6 @@ PT001.py:14:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` 16 16 | return 42 17 17 | - Run `ruff check --fix` to apply this fix. - PT001.py:24:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | 24 | / @pytest.fixture( @@ -43,8 +41,6 @@ PT001.py:24:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` 28 26 | return 42 29 27 | - Run `ruff check --fix` to apply this fix. - PT001.py:39:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | 39 | @fixture() @@ -63,8 +59,6 @@ PT001.py:39:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` 41 41 | return 42 42 42 | - Run `ruff check --fix` to apply this fix. - PT001.py:49:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | 49 | / @fixture( @@ -87,8 +81,6 @@ PT001.py:49:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` 53 51 | return 42 54 52 | - Run `ruff check --fix` to apply this fix. - PT001.py:64:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | 64 | @aliased() @@ -107,8 +99,6 @@ PT001.py:64:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` 66 66 | return 42 67 67 | - Run `ruff check --fix` to apply this fix. - PT001.py:74:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | 74 | / @aliased( @@ -129,5 +119,3 @@ PT001.py:74:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` 74 |+@aliased 77 75 | def aliased_parentheses_no_params_multiline(): 78 76 | return 42 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap index fd3a1dbc055ee..81e6dd9364649 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap @@ -29,8 +29,6 @@ PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 31 31 | ... 32 32 | - Run `ruff check --fix` to apply this fix. - PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected a string of comma-separated values | 34 | @pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) @@ -59,8 +57,6 @@ PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 41 41 | ... 42 42 | - Run `ruff check --fix` to apply this fix. - PT006.py:44:26: PT006 Wrong type passed to first argument of `@pytest.mark.parametrize`; expected a string of comma-separated values | 44 | @pytest.mark.parametrize([some_expr, another_expr], [1, 2, 3]) diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap index 81c3b9d67749b..6ee6f03da5ebb 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap @@ -49,8 +49,6 @@ PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 31 31 | ... 32 32 | - Run `ruff check --fix` to apply this fix. - PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | 34 | @pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) @@ -79,8 +77,6 @@ PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 41 41 | ... 42 42 | - Run `ruff check --fix` to apply this fix. - PT006.py:44:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple` | 44 | @pytest.mark.parametrize([some_expr, another_expr], [1, 2, 3]) diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap index ab38f140219e4..c8d3b5f202cb7 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap @@ -59,8 +59,6 @@ PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 31 31 | ... 32 32 | - Run `ruff check --fix` to apply this fix. - PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str` | 39 | @pytest.mark.parametrize(["param1"], [1, 2, 3]) @@ -79,8 +77,6 @@ PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p 41 41 | ... 42 42 | - Run `ruff check --fix` to apply this fix. - PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list` | 54 | @pytest.mark.parametrize(("param1, " "param2, " "param3"), [(1, 2, 3), (4, 5, 6)]) diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT022.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT022.snap index 3e45a20ad89ca..55b49f6b74548 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT022.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT022.snap @@ -19,8 +19,6 @@ PT022.py:17:5: PT022 [*] No teardown in fixture `error`, use `return` instead of 19 19 | 20 20 | import typing - Run `ruff check --fix` to apply this fix. - PT022.py:37:5: PT022 [*] No teardown in fixture `error`, use `return` instead of `yield` | 35 | def error() -> typing.Generator[typing.Any, None, None]: @@ -42,8 +40,6 @@ PT022.py:37:5: PT022 [*] No teardown in fixture `error`, use `return` instead of 39 39 | 40 40 | @pytest.fixture() - Run `ruff check --fix` to apply this fix. - PT022.py:43:5: PT022 [*] No teardown in fixture `error`, use `return` instead of `yield` | 41 | def error() -> Generator[Resource, None, None]: @@ -61,5 +57,3 @@ PT022.py:43:5: PT022 [*] No teardown in fixture `error`, use `return` instead of 42 42 | resource = acquire_resource() 43 |- yield resource 43 |+ return resource - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_default.snap index 1fe5b3b796fd9..489d0ac51a6ff 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_default.snap @@ -19,8 +19,6 @@ PT023.py:12:1: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` 14 14 | pass 15 15 | - Run `ruff check --fix` to apply this fix. - PT023.py:17:1: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | 17 | @pytest.mark.foo @@ -39,8 +37,6 @@ PT023.py:17:1: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` 19 19 | def test_something(): 20 20 | pass - Run `ruff check --fix` to apply this fix. - PT023.py:24:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | 23 | class TestClass: @@ -60,8 +56,6 @@ PT023.py:24:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` 26 26 | pass 27 27 | - Run `ruff check --fix` to apply this fix. - PT023.py:30:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | 29 | class TestClass: @@ -81,8 +75,6 @@ PT023.py:30:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` 32 32 | def test_something(): 33 33 | pass - Run `ruff check --fix` to apply this fix. - PT023.py:38:9: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | 36 | class TestClass: @@ -101,6 +93,4 @@ PT023.py:38:9: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` 38 |+ @pytest.mark.foo() 39 39 | def test_something(): 40 40 | pass -41 41 | - - Run `ruff check --fix` to apply this fix. +41 41 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_no_parentheses.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_no_parentheses.snap index a874367498d7e..b12d5ffb37364 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_no_parentheses.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT023_no_parentheses.snap @@ -19,8 +19,6 @@ PT023.py:46:1: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` 48 48 | pass 49 49 | - Run `ruff check --fix` to apply this fix. - PT023.py:51:1: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | 51 | @pytest.mark.foo() @@ -39,8 +37,6 @@ PT023.py:51:1: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` 53 53 | def test_something(): 54 54 | pass - Run `ruff check --fix` to apply this fix. - PT023.py:58:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | 57 | class TestClass: @@ -60,8 +56,6 @@ PT023.py:58:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` 60 60 | pass 61 61 | - Run `ruff check --fix` to apply this fix. - PT023.py:64:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | 63 | class TestClass: @@ -81,8 +75,6 @@ PT023.py:64:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` 66 66 | def test_something(): 67 67 | pass - Run `ruff check --fix` to apply this fix. - PT023.py:72:9: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | 70 | class TestClass: @@ -101,5 +93,3 @@ PT023.py:72:9: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` 72 |+ @pytest.mark.foo 73 73 | def test_something(): 74 74 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT024.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT024.snap index af5eecce63f06..a05303088e19d 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT024.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT024.snap @@ -18,8 +18,6 @@ PT024.py:14:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures 16 15 | async def my_fixture(): # Error before 17 16 | return 0 - Run `ruff check --fix` to apply this fix. - PT024.py:20:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures | 20 | @pytest.mark.asyncio @@ -37,8 +35,6 @@ PT024.py:20:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures 22 21 | async def my_fixture(): # Error before no parens 23 22 | return 0 - Run `ruff check --fix` to apply this fix. - PT024.py:27:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures | 26 | @pytest.fixture() @@ -57,8 +53,6 @@ PT024.py:27:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures 29 28 | return 0 30 29 | - Run `ruff check --fix` to apply this fix. - PT024.py:33:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures | 32 | @pytest.fixture() @@ -75,5 +69,3 @@ PT024.py:33:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures 33 |-@pytest.mark.asyncio 34 33 | async def my_fixture(): # Error after no parens 35 34 | return 0 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT025.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT025.snap index 96635176197e1..ac3738a2b2158 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT025.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT025.snap @@ -18,8 +18,6 @@ PT025.py:9:1: PT025 [*] `pytest.mark.usefixtures` has no effect on fixtures 11 10 | def my_fixture(): # Error before 12 11 | return 0 - Run `ruff check --fix` to apply this fix. - PT025.py:16:1: PT025 [*] `pytest.mark.usefixtures` has no effect on fixtures | 15 | @pytest.fixture() @@ -36,5 +34,3 @@ PT025.py:16:1: PT025 [*] `pytest.mark.usefixtures` has no effect on fixtures 16 |-@pytest.mark.usefixtures("a") 17 16 | def my_fixture(): # Error after 18 17 | return 0 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap index ddbf738749576..0c2bb3a868463 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.py.snap @@ -14,6 +14,4 @@ doubles_all.py:1:1: Q002 [*] Double quote docstring found but single quotes pref 1 |+'''This is a docstring.''' 2 2 | 3 3 | this_is_an_inline_string = "double quote string" -4 4 | - - Run `ruff check --fix` to apply this fix. +4 4 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap index 24890365c4f3d..a6d86c9465586 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.py.snap @@ -19,5 +19,3 @@ doubles_all.py:3:28: Q000 [*] Double quotes found but single quotes preferred 4 4 | 5 5 | this_is_a_multiline_string = """ 6 6 | double quote string - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap index 750336227542c..30f93b41d185d 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.py.snap @@ -21,5 +21,3 @@ doubles_all.py:5:30: Q001 [*] Double quote multiline found but single quotes pre 6 6 | double quote string 7 |-""" 7 |+''' - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap index a36a1b7ffd0a3..22759d13b7ff3 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles.py.snap @@ -26,8 +26,6 @@ docstring_doubles.py:5:1: Q001 [*] Double quote multiline found but single quote 9 9 | l = [] 10 10 | - Run `ruff check --fix` to apply this fix. - docstring_doubles.py:16:5: Q001 [*] Double quote multiline found but single quotes preferred | 14 | """ @@ -54,8 +52,6 @@ docstring_doubles.py:16:5: Q001 [*] Double quote multiline found but single quot 20 20 | # The colon in the list indexing below is an edge case for the docstring scanner 21 21 | def f(self, bar=""" - Run `ruff check --fix` to apply this fix. - docstring_doubles.py:21:21: Q001 [*] Double quote multiline found but single quotes preferred | 20 | # The colon in the list indexing below is an edge case for the docstring scanner @@ -79,8 +75,6 @@ docstring_doubles.py:21:21: Q001 [*] Double quote multiline found but single quo 24 24 | """ 25 25 | Double quotes multiline function docstring - Run `ruff check --fix` to apply this fix. - docstring_doubles.py:30:9: Q001 [*] Double quote multiline found but single quotes preferred | 28 | some_expression = 'hello world' @@ -107,8 +101,6 @@ docstring_doubles.py:30:9: Q001 [*] Double quote multiline found but single quot 34 34 | if l: 35 35 | """ - Run `ruff check --fix` to apply this fix. - docstring_doubles.py:35:13: Q001 [*] Double quote multiline found but single quotes preferred | 34 | if l: @@ -130,5 +122,3 @@ docstring_doubles.py:35:13: Q001 [*] Double quote multiline found but single quo 37 |- """ 37 |+ ''' 38 38 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap index a61ebe79d4bec..933d62feb81f4 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_class.py.snap @@ -20,8 +20,6 @@ docstring_doubles_class.py:3:5: Q001 [*] Double quote multiline found but single 5 5 | def foo(self, bar="""not a docstring"""): 6 6 | """ Double quotes single line method docstring""" - Run `ruff check --fix` to apply this fix. - docstring_doubles_class.py:5:23: Q001 [*] Double quote multiline found but single quotes preferred | 3 | """ Not a docstring """ @@ -40,6 +38,4 @@ docstring_doubles_class.py:5:23: Q001 [*] Double quote multiline found but singl 5 |+ def foo(self, bar='''not a docstring'''): 6 6 | """ Double quotes single line method docstring""" 7 7 | pass -8 8 | - - Run `ruff check --fix` to apply this fix. +8 8 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap index 64add3dde8f81..afe4f05cef267 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_function.py.snap @@ -19,8 +19,6 @@ docstring_doubles_function.py:3:5: Q001 [*] Double quote multiline found but sin 5 5 | 6 6 | - Run `ruff check --fix` to apply this fix. - docstring_doubles_function.py:11:5: Q001 [*] Double quote multiline found but single quotes preferred | 9 | function without params, multiline docstring @@ -40,8 +38,6 @@ docstring_doubles_function.py:11:5: Q001 [*] Double quote multiline found but si 13 13 | 14 14 | - Run `ruff check --fix` to apply this fix. - docstring_doubles_function.py:15:39: Q001 [*] Double quote multiline found but single quotes preferred | 15 | def fun_with_params_no_docstring(a, b=""" @@ -65,8 +61,6 @@ docstring_doubles_function.py:15:39: Q001 [*] Double quote multiline found but s 19 19 | 20 20 | - Run `ruff check --fix` to apply this fix. - docstring_doubles_function.py:17:5: Q001 [*] Double quote multiline found but single quotes preferred | 15 | def fun_with_params_no_docstring(a, b=""" @@ -86,8 +80,6 @@ docstring_doubles_function.py:17:5: Q001 [*] Double quote multiline found but si 19 19 | 20 20 | - Run `ruff check --fix` to apply this fix. - docstring_doubles_function.py:22:5: Q001 [*] Double quote multiline found but single quotes preferred | 21 | def fun_with_params_no_docstring2(a, b=c[foo():], c=\ @@ -104,6 +96,4 @@ docstring_doubles_function.py:22:5: Q001 [*] Double quote multiline found but si 22 |+ ''' not a docstring '''): 23 23 | pass 24 24 | -25 25 | - - Run `ruff check --fix` to apply this fix. +25 25 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap index 1eadffa6e02e9..1936be585d442 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_multiline.py.snap @@ -26,8 +26,6 @@ docstring_doubles_module_multiline.py:4:1: Q001 [*] Double quote multiline found 8 8 | pass 9 9 | """ - Run `ruff check --fix` to apply this fix. - docstring_doubles_module_multiline.py:9:1: Q001 [*] Double quote multiline found but single quotes preferred | 7 | def foo(): @@ -47,5 +45,3 @@ docstring_doubles_module_multiline.py:9:1: Q001 [*] Double quote multiline found 10 10 | this is not a docstring 11 |-""" 11 |+''' - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap index b75220e12b839..c37cd3aa5c995 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_doubles_module_singleline.py.snap @@ -18,8 +18,6 @@ docstring_doubles_module_singleline.py:2:1: Q001 [*] Double quote multiline foun 4 4 | def foo(): 5 5 | pass - Run `ruff check --fix` to apply this fix. - docstring_doubles_module_singleline.py:6:1: Q001 [*] Double quote multiline found but single quotes preferred | 4 | def foo(): @@ -34,5 +32,3 @@ docstring_doubles_module_singleline.py:6:1: Q001 [*] Double quote multiline foun 5 5 | pass 6 |-""" this is not a docstring """ 6 |+''' this is not a docstring ''' - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap index ca0b9b16904b0..662cab9336c96 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles.py.snap @@ -21,8 +21,6 @@ docstring_singles.py:1:1: Q002 [*] Single quote docstring found but double quote 5 5 | ''' 6 6 | this is not a docstring - Run `ruff check --fix` to apply this fix. - docstring_singles.py:14:5: Q002 [*] Single quote docstring found but double quotes preferred | 12 | class params \t not a docstring @@ -49,8 +47,6 @@ docstring_singles.py:14:5: Q002 [*] Single quote docstring found but double quot 18 18 | ''' 19 19 | this is not a docstring - Run `ruff check --fix` to apply this fix. - docstring_singles.py:26:9: Q002 [*] Single quote docstring found but double quotes preferred | 24 | definitely not a docstring''', @@ -75,6 +71,4 @@ docstring_singles.py:26:9: Q002 [*] Single quote docstring found but double quot 28 |+ """ 29 29 | 30 30 | some_expression = 'hello world' -31 31 | - - Run `ruff check --fix` to apply this fix. +31 31 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap index d3d17a5922eec..1ea392555614e 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_class.py.snap @@ -17,8 +17,6 @@ docstring_singles_class.py:2:5: Q002 [*] Single quote docstring found but double 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): - Run `ruff check --fix` to apply this fix. - docstring_singles_class.py:6:9: Q002 [*] Single quote docstring found but double quotes preferred | 5 | def foo(self, bar='''not a docstring'''): @@ -37,8 +35,6 @@ docstring_singles_class.py:6:9: Q002 [*] Single quote docstring found but double 8 8 | 9 9 | class Nested(foo()[:]): ''' inline docstring '''; pass - Run `ruff check --fix` to apply this fix. - docstring_singles_class.py:9:29: Q002 [*] Single quote docstring found but double quotes preferred | 7 | pass @@ -53,5 +49,3 @@ docstring_singles_class.py:9:29: Q002 [*] Single quote docstring found but doubl 8 8 | 9 |- class Nested(foo()[:]): ''' inline docstring '''; pass 9 |+ class Nested(foo()[:]): """ inline docstring """; pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap index abea62aeb296b..c73e65d5e1c01 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_function.py.snap @@ -18,8 +18,6 @@ docstring_singles_function.py:2:5: Q002 [*] Single quote docstring found but dou 4 4 | return 5 5 | - Run `ruff check --fix` to apply this fix. - docstring_singles_function.py:8:5: Q002 [*] Single quote docstring found but double quotes preferred | 7 | def foo2(): @@ -45,8 +43,6 @@ docstring_singles_function.py:8:5: Q002 [*] Single quote docstring found but dou 12 12 | return 13 13 | - Run `ruff check --fix` to apply this fix. - docstring_singles_function.py:27:5: Q002 [*] Single quote docstring found but double quotes preferred | 26 | def function_with_single_docstring(a): @@ -63,5 +59,3 @@ docstring_singles_function.py:27:5: Q002 [*] Single quote docstring found but do 28 28 | 29 29 | 30 30 | def double_inside_single(a): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap index 5f313c0649158..e8730a4ca4920 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_1.py.snap @@ -26,8 +26,6 @@ docstring_singles_mixed_quotes_class_var_1.py:2:33: Q002 [*] Single quote docstr 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): - Run `ruff check --fix` to apply this fix. - docstring_singles_mixed_quotes_class_var_1.py:6:9: Q002 Single quote docstring found but double quotes preferred | 5 | def foo(self, bar='''not a docstring'''): @@ -55,8 +53,6 @@ docstring_singles_mixed_quotes_class_var_1.py:6:37: Q002 [*] Single quote docstr 8 8 | 9 9 | class Nested(foo()[:]): ''"Start with empty string" ' and lint docstring safely'; pass - Run `ruff check --fix` to apply this fix. - docstring_singles_mixed_quotes_class_var_1.py:9:29: Q002 Single quote docstring found but double quotes preferred | 7 | pass @@ -80,5 +76,3 @@ docstring_singles_mixed_quotes_class_var_1.py:9:57: Q002 [*] Single quote docstr 8 8 | 9 |- class Nested(foo()[:]): ''"Start with empty string" ' and lint docstring safely'; pass 9 |+ class Nested(foo()[:]): ''"Start with empty string" " and lint docstring safely"; pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap index a960f22d3c4c6..132881eb619fd 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_class_var_2.py.snap @@ -17,8 +17,6 @@ docstring_singles_mixed_quotes_class_var_2.py:2:5: Q002 [*] Single quote docstri 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): - Run `ruff check --fix` to apply this fix. - docstring_singles_mixed_quotes_class_var_2.py:2:40: Q002 [*] Single quote docstring found but double quotes preferred | 1 | class SingleLineDocstrings(): @@ -35,8 +33,6 @@ docstring_singles_mixed_quotes_class_var_2.py:2:40: Q002 [*] Single quote docstr 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): - Run `ruff check --fix` to apply this fix. - docstring_singles_mixed_quotes_class_var_2.py:6:9: Q002 [*] Single quote docstring found but double quotes preferred | 5 | def foo(self, bar='''not a docstring'''): @@ -55,8 +51,6 @@ docstring_singles_mixed_quotes_class_var_2.py:6:9: Q002 [*] Single quote docstri 8 8 | 9 9 | class Nested(foo()[:]): 'Do not'" start with empty string" ' and lint docstring safely'; pass - Run `ruff check --fix` to apply this fix. - docstring_singles_mixed_quotes_class_var_2.py:6:44: Q002 [*] Single quote docstring found but double quotes preferred | 5 | def foo(self, bar='''not a docstring'''): @@ -75,8 +69,6 @@ docstring_singles_mixed_quotes_class_var_2.py:6:44: Q002 [*] Single quote docstr 8 8 | 9 9 | class Nested(foo()[:]): 'Do not'" start with empty string" ' and lint docstring safely'; pass - Run `ruff check --fix` to apply this fix. - docstring_singles_mixed_quotes_class_var_2.py:9:29: Q002 [*] Single quote docstring found but double quotes preferred | 7 | pass @@ -92,8 +84,6 @@ docstring_singles_mixed_quotes_class_var_2.py:9:29: Q002 [*] Single quote docstr 9 |- class Nested(foo()[:]): 'Do not'" start with empty string" ' and lint docstring safely'; pass 9 |+ class Nested(foo()[:]): "Do not"" start with empty string" ' and lint docstring safely'; pass - Run `ruff check --fix` to apply this fix. - docstring_singles_mixed_quotes_class_var_2.py:9:64: Q002 [*] Single quote docstring found but double quotes preferred | 7 | pass @@ -108,5 +98,3 @@ docstring_singles_mixed_quotes_class_var_2.py:9:64: Q002 [*] Single quote docstr 8 8 | 9 |- class Nested(foo()[:]): 'Do not'" start with empty string" ' and lint docstring safely'; pass 9 |+ class Nested(foo()[:]): 'Do not'" start with empty string" " and lint docstring safely"; pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap index eb98a4b96425f..cc7879f513c1b 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_1.py.snap @@ -25,8 +25,6 @@ docstring_singles_mixed_quotes_module_singleline_var_1.py:1:29: Q002 [*] Single 3 3 | def foo(): 4 4 | pass - Run `ruff check --fix` to apply this fix. - docstring_singles_mixed_quotes_module_singleline_var_1.py:5:1: Q001 [*] Double quote multiline found but single quotes preferred | 3 | def foo(): @@ -41,5 +39,3 @@ docstring_singles_mixed_quotes_module_singleline_var_1.py:5:1: Q001 [*] Double q 4 4 | pass 5 |-""" this is not a docstring """ 5 |+''' this is not a docstring ''' - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap index 9bdc99dd0c236..dd03d90af373f 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_mixed_quotes_module_singleline_var_2.py.snap @@ -16,8 +16,6 @@ docstring_singles_mixed_quotes_module_singleline_var_2.py:1:1: Q002 [*] Single q 3 3 | def foo(): 4 4 | pass - Run `ruff check --fix` to apply this fix. - docstring_singles_mixed_quotes_module_singleline_var_2.py:1:36: Q002 [*] Single quote docstring found but double quotes preferred | 1 | 'Do not'" start with empty string" ' and lint docstring safely' @@ -33,8 +31,6 @@ docstring_singles_mixed_quotes_module_singleline_var_2.py:1:36: Q002 [*] Single 3 3 | def foo(): 4 4 | pass - Run `ruff check --fix` to apply this fix. - docstring_singles_mixed_quotes_module_singleline_var_2.py:5:1: Q001 [*] Double quote multiline found but single quotes preferred | 3 | def foo(): @@ -49,5 +45,3 @@ docstring_singles_mixed_quotes_module_singleline_var_2.py:5:1: Q001 [*] Double q 4 4 | pass 5 |-""" this is not a docstring """ 5 |+''' this is not a docstring ''' - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap index 9c0f24d31c3bd..22daa9d2756a8 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_multiline.py.snap @@ -20,5 +20,3 @@ docstring_singles_module_multiline.py:1:1: Q002 [*] Single quote docstring found 4 4 | ''' 5 5 | this is not a docstring 6 6 | ''' - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap index c693a27ead08e..0da94c050ba7a 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_doubles_over_docstring_singles_module_singleline.py.snap @@ -14,5 +14,3 @@ docstring_singles_module_singleline.py:1:1: Q002 [*] Single quote docstring foun 2 2 | ''' this is not a docstring ''' 3 3 | 4 4 | def foo(): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap index f7d0f83f1912c..283c2483c6421 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles.py.snap @@ -21,8 +21,6 @@ docstring_doubles.py:1:1: Q002 [*] Double quote docstring found but single quote 5 5 | """ 6 6 | this is not a docstring - Run `ruff check --fix` to apply this fix. - docstring_doubles.py:12:5: Q002 [*] Double quote docstring found but single quotes preferred | 11 | class Cls: @@ -48,8 +46,6 @@ docstring_doubles.py:12:5: Q002 [*] Double quote docstring found but single quot 16 16 | """ 17 17 | this is not a docstring - Run `ruff check --fix` to apply this fix. - docstring_doubles.py:24:9: Q002 [*] Double quote docstring found but single quotes preferred | 22 | definitely not a docstring""", @@ -74,6 +70,4 @@ docstring_doubles.py:24:9: Q002 [*] Double quote docstring found but single quot 26 |+ ''' 27 27 | 28 28 | some_expression = 'hello world' -29 29 | - - Run `ruff check --fix` to apply this fix. +29 29 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap index 787e796e98062..d93c335700506 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_class.py.snap @@ -17,8 +17,6 @@ docstring_doubles_class.py:2:5: Q002 [*] Double quote docstring found but single 4 4 | 5 5 | def foo(self, bar="""not a docstring"""): - Run `ruff check --fix` to apply this fix. - docstring_doubles_class.py:6:9: Q002 [*] Double quote docstring found but single quotes preferred | 5 | def foo(self, bar="""not a docstring"""): @@ -37,8 +35,6 @@ docstring_doubles_class.py:6:9: Q002 [*] Double quote docstring found but single 8 8 | 9 9 | class Nested(foo()[:]): """ inline docstring """; pass - Run `ruff check --fix` to apply this fix. - docstring_doubles_class.py:9:29: Q002 [*] Double quote docstring found but single quotes preferred | 7 | pass @@ -53,5 +49,3 @@ docstring_doubles_class.py:9:29: Q002 [*] Double quote docstring found but singl 8 8 | 9 |- class Nested(foo()[:]): """ inline docstring """; pass 9 |+ class Nested(foo()[:]): ''' inline docstring '''; pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap index ab723aadb7a9d..62c1fec0a3ba2 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_function.py.snap @@ -18,8 +18,6 @@ docstring_doubles_function.py:2:5: Q002 [*] Double quote docstring found but sin 4 4 | return 5 5 | - Run `ruff check --fix` to apply this fix. - docstring_doubles_function.py:8:5: Q002 [*] Double quote docstring found but single quotes preferred | 7 | def foo2(): @@ -45,8 +43,6 @@ docstring_doubles_function.py:8:5: Q002 [*] Double quote docstring found but sin 12 12 | return 13 13 | - Run `ruff check --fix` to apply this fix. - docstring_doubles_function.py:27:5: Q002 [*] Double quote docstring found but single quotes preferred | 26 | def function_with_single_docstring(a): @@ -63,5 +59,3 @@ docstring_doubles_function.py:27:5: Q002 [*] Double quote docstring found but si 28 28 | 29 29 | 30 30 | def double_inside_single(a): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap index f37db03ef67d4..ac71c3259f667 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_class_var_2.py.snap @@ -17,8 +17,6 @@ docstring_doubles_mixed_quotes_class_var_2.py:2:5: Q002 [*] Double quote docstri 4 4 | 5 5 | def foo(self, bar="""not a docstring"""): - Run `ruff check --fix` to apply this fix. - docstring_doubles_mixed_quotes_class_var_2.py:6:9: Q002 [*] Double quote docstring found but single quotes preferred | 5 | def foo(self, bar="""not a docstring"""): @@ -37,8 +35,6 @@ docstring_doubles_mixed_quotes_class_var_2.py:6:9: Q002 [*] Double quote docstri 8 8 | 9 9 | class Nested(foo()[:]): "Do not"' start with empty string' ' and lint docstring safely'; pass - Run `ruff check --fix` to apply this fix. - docstring_doubles_mixed_quotes_class_var_2.py:9:29: Q002 [*] Double quote docstring found but single quotes preferred | 7 | pass @@ -53,5 +49,3 @@ docstring_doubles_mixed_quotes_class_var_2.py:9:29: Q002 [*] Double quote docstr 8 8 | 9 |- class Nested(foo()[:]): "Do not"' start with empty string' ' and lint docstring safely'; pass 9 |+ class Nested(foo()[:]): 'Do not'' start with empty string' ' and lint docstring safely'; pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap index 448e4bb5fb1a5..2e99077b01ec2 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_mixed_quotes_module_singleline_var_2.py.snap @@ -15,5 +15,3 @@ docstring_doubles_mixed_quotes_module_singleline_var_2.py:1:1: Q002 [*] Double q 2 2 | 3 3 | def foo(): 4 4 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap index 2d8cf2f6ed6e0..06be325d4916e 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_multiline.py.snap @@ -20,5 +20,3 @@ docstring_doubles_module_multiline.py:1:1: Q002 [*] Double quote docstring found 4 4 | """ 5 5 | this is not a docstring 6 6 | """ - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap index 4c9e7da755d50..c1be22b069894 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_doubles_module_singleline.py.snap @@ -14,5 +14,3 @@ docstring_doubles_module_singleline.py:1:1: Q002 [*] Double quote docstring foun 2 2 | """ this is not a docstring """ 3 3 | 4 4 | def foo(): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap index 4d0698b9187fe..a508f5360bab1 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles.py.snap @@ -26,8 +26,6 @@ docstring_singles.py:5:1: Q001 [*] Single quote multiline found but double quote 9 9 | l = [] 10 10 | - Run `ruff check --fix` to apply this fix. - docstring_singles.py:11:21: Q001 [*] Single quote multiline found but double quotes preferred | 9 | l = [] @@ -54,8 +52,6 @@ docstring_singles.py:11:21: Q001 [*] Single quote multiline found but double quo 15 15 | Single quotes multiline class docstring 16 16 | ''' - Run `ruff check --fix` to apply this fix. - docstring_singles.py:18:5: Q001 [*] Single quote multiline found but double quotes preferred | 16 | ''' @@ -82,8 +78,6 @@ docstring_singles.py:18:5: Q001 [*] Single quote multiline found but double quot 22 22 | # The colon in the list indexing below is an edge case for the docstring scanner 23 23 | def f(self, bar=''' - Run `ruff check --fix` to apply this fix. - docstring_singles.py:23:21: Q001 [*] Single quote multiline found but double quotes preferred | 22 | # The colon in the list indexing below is an edge case for the docstring scanner @@ -107,8 +101,6 @@ docstring_singles.py:23:21: Q001 [*] Single quote multiline found but double quo 26 26 | ''' 27 27 | Single quotes multiline function docstring - Run `ruff check --fix` to apply this fix. - docstring_singles.py:32:9: Q001 [*] Single quote multiline found but double quotes preferred | 30 | some_expression = 'hello world' @@ -135,8 +127,6 @@ docstring_singles.py:32:9: Q001 [*] Single quote multiline found but double quot 36 36 | if l: 37 37 | ''' - Run `ruff check --fix` to apply this fix. - docstring_singles.py:37:13: Q001 [*] Single quote multiline found but double quotes preferred | 36 | if l: @@ -158,5 +148,3 @@ docstring_singles.py:37:13: Q001 [*] Single quote multiline found but double quo 39 |- ''' 39 |+ """ 40 40 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap index 7f0b17582ea71..2f1e42198ab79 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_class.py.snap @@ -20,8 +20,6 @@ docstring_singles_class.py:3:5: Q001 [*] Single quote multiline found but double 5 5 | def foo(self, bar='''not a docstring'''): 6 6 | ''' Double quotes single line method docstring''' - Run `ruff check --fix` to apply this fix. - docstring_singles_class.py:5:23: Q001 [*] Single quote multiline found but double quotes preferred | 3 | ''' Not a docstring ''' @@ -40,6 +38,4 @@ docstring_singles_class.py:5:23: Q001 [*] Single quote multiline found but doubl 5 |+ def foo(self, bar="""not a docstring"""): 6 6 | ''' Double quotes single line method docstring''' 7 7 | pass -8 8 | - - Run `ruff check --fix` to apply this fix. +8 8 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap index 4d17f42a1ff56..877994a441dda 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_function.py.snap @@ -19,8 +19,6 @@ docstring_singles_function.py:3:5: Q001 [*] Single quote multiline found but dou 5 5 | 6 6 | - Run `ruff check --fix` to apply this fix. - docstring_singles_function.py:11:5: Q001 [*] Single quote multiline found but double quotes preferred | 9 | function without params, multiline docstring @@ -40,8 +38,6 @@ docstring_singles_function.py:11:5: Q001 [*] Single quote multiline found but do 13 13 | 14 14 | - Run `ruff check --fix` to apply this fix. - docstring_singles_function.py:15:39: Q001 [*] Single quote multiline found but double quotes preferred | 15 | def fun_with_params_no_docstring(a, b=''' @@ -65,8 +61,6 @@ docstring_singles_function.py:15:39: Q001 [*] Single quote multiline found but d 19 19 | 20 20 | - Run `ruff check --fix` to apply this fix. - docstring_singles_function.py:17:5: Q001 [*] Single quote multiline found but double quotes preferred | 15 | def fun_with_params_no_docstring(a, b=''' @@ -86,8 +80,6 @@ docstring_singles_function.py:17:5: Q001 [*] Single quote multiline found but do 19 19 | 20 20 | - Run `ruff check --fix` to apply this fix. - docstring_singles_function.py:22:5: Q001 [*] Single quote multiline found but double quotes preferred | 21 | def fun_with_params_no_docstring2(a, b=c[foo():], c=\ @@ -104,6 +96,4 @@ docstring_singles_function.py:22:5: Q001 [*] Single quote multiline found but do 22 |+ """ not a docstring """): 23 23 | pass 24 24 | -25 25 | - - Run `ruff check --fix` to apply this fix. +25 25 | diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap index ded426f9d2e01..dbd7badb95500 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_multiline.py.snap @@ -26,8 +26,6 @@ docstring_singles_module_multiline.py:4:1: Q001 [*] Single quote multiline found 8 8 | pass 9 9 | ''' - Run `ruff check --fix` to apply this fix. - docstring_singles_module_multiline.py:9:1: Q001 [*] Single quote multiline found but double quotes preferred | 7 | def foo(): @@ -47,5 +45,3 @@ docstring_singles_module_multiline.py:9:1: Q001 [*] Single quote multiline found 10 10 | this is not a docstring 11 |-''' 11 |+""" - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap index 62186a9c0d95c..2db9abdf142b5 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_docstring_singles_over_docstring_singles_module_singleline.py.snap @@ -18,8 +18,6 @@ docstring_singles_module_singleline.py:2:1: Q001 [*] Single quote multiline foun 4 4 | def foo(): 5 5 | pass - Run `ruff check --fix` to apply this fix. - docstring_singles_module_singleline.py:6:1: Q001 [*] Single quote multiline found but double quotes preferred | 4 | def foo(): @@ -34,5 +32,3 @@ docstring_singles_module_singleline.py:6:1: Q001 [*] Single quote multiline foun 5 5 | pass 6 |-''' this is not a docstring ''' 6 |+""" this is not a docstring """ - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap index 9fdeffc1d344a..4201889023305 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles.py.snap @@ -16,8 +16,6 @@ singles.py:1:25: Q000 [*] Single quotes found but double quotes preferred 3 3 | this_should_be_linted = f'double quote string' 4 4 | this_should_be_linted = f'double {"quote"} string' - Run `ruff check --fix` to apply this fix. - singles.py:2:25: Q000 [*] Single quotes found but double quotes preferred | 1 | this_should_be_linted = 'single quote string' @@ -35,8 +33,6 @@ singles.py:2:25: Q000 [*] Single quotes found but double quotes preferred 4 4 | this_should_be_linted = f'double {"quote"} string' 5 5 | - Run `ruff check --fix` to apply this fix. - singles.py:3:25: Q000 [*] Single quotes found but double quotes preferred | 1 | this_should_be_linted = 'single quote string' @@ -54,5 +50,3 @@ singles.py:3:25: Q000 [*] Single quotes found but double quotes preferred 4 4 | this_should_be_linted = f'double {"quote"} string' 5 5 | 6 6 | # https://github.com/astral-sh/ruff/issues/10546 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap index cd962252ed281..46993510447d5 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped.py.snap @@ -16,8 +16,6 @@ singles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner qu 3 3 | this_is_fine = 'This is a "string"' 4 4 | this_is_fine = '\'This\' is a "string"' - Run `ruff check --fix` to apply this fix. - singles_escaped.py:9:5: Q003 [*] Change outer quotes to avoid escaping inner quotes | 7 | this_should_raise = ( @@ -37,8 +35,6 @@ singles_escaped.py:9:5: Q003 [*] Change outer quotes to avoid escaping inner quo 11 11 | 12 12 | # Same as above, but with f-strings - Run `ruff check --fix` to apply this fix. - singles_escaped.py:13:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 12 | # Same as above, but with f-strings @@ -58,8 +54,6 @@ singles_escaped.py:13:1: Q003 [*] Change outer quotes to avoid escaping inner qu 15 15 | f'This is a "string"' 16 16 | f'\'This\' is a "string"' - Run `ruff check --fix` to apply this fix. - singles_escaped.py:21:5: Q003 [*] Change outer quotes to avoid escaping inner quotes | 19 | foo = ( @@ -79,8 +73,6 @@ singles_escaped.py:21:5: Q003 [*] Change outer quotes to avoid escaping inner qu 23 23 | 24 24 | # Nested f-strings (Python 3.12+) - Run `ruff check --fix` to apply this fix. - singles_escaped.py:31:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 29 | # @@ -101,8 +93,6 @@ singles_escaped.py:31:1: Q003 [*] Change outer quotes to avoid escaping inner qu 33 33 | f"\"foo\" {f"\"foo\""} \"\"" # Q003 34 34 | - Run `ruff check --fix` to apply this fix. - singles_escaped.py:32:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -122,8 +112,6 @@ singles_escaped.py:32:1: Q003 [*] Change outer quotes to avoid escaping inner qu 34 34 | 35 35 | f"normal {f"nested"} normal" - Run `ruff check --fix` to apply this fix. - singles_escaped.py:33:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 31 | f"\"foo\" {"foo"}" # Q003 @@ -144,8 +132,6 @@ singles_escaped.py:33:1: Q003 [*] Change outer quotes to avoid escaping inner qu 35 35 | f"normal {f"nested"} normal" 36 36 | f"\"normal\" {f"nested"} normal" # Q003 - Run `ruff check --fix` to apply this fix. - singles_escaped.py:33:12: Q003 [*] Change outer quotes to avoid escaping inner quotes | 31 | f"\"foo\" {"foo"}" # Q003 @@ -166,8 +152,6 @@ singles_escaped.py:33:12: Q003 [*] Change outer quotes to avoid escaping inner q 35 35 | f"normal {f"nested"} normal" 36 36 | f"\"normal\" {f"nested"} normal" # Q003 - Run `ruff check --fix` to apply this fix. - singles_escaped.py:36:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 35 | f"normal {f"nested"} normal" @@ -187,8 +171,6 @@ singles_escaped.py:36:1: Q003 [*] Change outer quotes to avoid escaping inner qu 38 38 | f"\"normal\" {f"\"nested\" {"other"} normal"} 'single quotes'" # Q003 39 39 | f"\"normal\" {f"\"nested\" {"other"} 'single quotes'"} normal" # Q003 - Run `ruff check --fix` to apply this fix. - singles_escaped.py:38:15: Q003 [*] Change outer quotes to avoid escaping inner quotes | 36 | f"\"normal\" {f"nested"} normal" # Q003 @@ -206,8 +188,6 @@ singles_escaped.py:38:15: Q003 [*] Change outer quotes to avoid escaping inner q 38 |+f"\"normal\" {f'"nested" {"other"} normal'} 'single quotes'" # Q003 39 39 | f"\"normal\" {f"\"nested\" {"other"} 'single quotes'"} normal" # Q003 - Run `ruff check --fix` to apply this fix. - singles_escaped.py:39:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 37 | f"\"normal\" {f"nested"} 'single quotes'" @@ -222,5 +202,3 @@ singles_escaped.py:39:1: Q003 [*] Change outer quotes to avoid escaping inner qu 38 38 | f"\"normal\" {f"\"nested\" {"other"} normal"} 'single quotes'" # Q003 39 |-f"\"normal\" {f"\"nested\" {"other"} 'single quotes'"} normal" # Q003 39 |+f'"normal" {f"\"nested\" {"other"} 'single quotes'"} normal' # Q003 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_py311.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_py311.snap index 59f8e92fe29c8..ff59285296e73 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_py311.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_py311.snap @@ -16,8 +16,6 @@ singles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner qu 3 3 | this_is_fine = 'This is a "string"' 4 4 | this_is_fine = '\'This\' is a "string"' - Run `ruff check --fix` to apply this fix. - singles_escaped.py:9:5: Q003 [*] Change outer quotes to avoid escaping inner quotes | 7 | this_should_raise = ( @@ -37,8 +35,6 @@ singles_escaped.py:9:5: Q003 [*] Change outer quotes to avoid escaping inner quo 11 11 | 12 12 | # Same as above, but with f-strings - Run `ruff check --fix` to apply this fix. - singles_escaped.py:13:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 12 | # Same as above, but with f-strings @@ -58,8 +54,6 @@ singles_escaped.py:13:1: Q003 [*] Change outer quotes to avoid escaping inner qu 15 15 | f'This is a "string"' 16 16 | f'\'This\' is a "string"' - Run `ruff check --fix` to apply this fix. - singles_escaped.py:21:5: Q003 [*] Change outer quotes to avoid escaping inner quotes | 19 | foo = ( @@ -78,5 +72,3 @@ singles_escaped.py:21:5: Q003 [*] Change outer quotes to avoid escaping inner qu 22 22 | ) 23 23 | 24 24 | # Nested f-strings (Python 3.12+) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap index 58b1c7028e185..8d76df92468b5 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_escaped_unnecessary.py.snap @@ -16,8 +16,6 @@ singles_escaped_unnecessary.py:1:26: Q004 [*] Unnecessary escape on inner quote 3 3 | this_is_fine = 'This is a "string"' 4 4 | this_is_fine = '\'This\' is a "string"' - Run `ruff check --fix` to apply this fix. - singles_escaped_unnecessary.py:2:26: Q004 [*] Unnecessary escape on inner quote character | 1 | this_should_raise_Q004 = "This is a \'string\'" @@ -35,8 +33,6 @@ singles_escaped_unnecessary.py:2:26: Q004 [*] Unnecessary escape on inner quote 4 4 | this_is_fine = '\'This\' is a "string"' 5 5 | this_is_fine = r"This is a \'string\'" - Run `ruff check --fix` to apply this fix. - singles_escaped_unnecessary.py:9:5: Q004 [*] Unnecessary escape on inner quote character | 7 | this_should_raise_Q004 = ( @@ -56,8 +52,6 @@ singles_escaped_unnecessary.py:9:5: Q004 [*] Unnecessary escape on inner quote c 11 11 | 12 12 | # Same as above, but with f-strings - Run `ruff check --fix` to apply this fix. - singles_escaped_unnecessary.py:13:1: Q004 [*] Unnecessary escape on inner quote character | 12 | # Same as above, but with f-strings @@ -77,8 +71,6 @@ singles_escaped_unnecessary.py:13:1: Q004 [*] Unnecessary escape on inner quote 15 15 | f'This is a "string"' 16 16 | f'\'This\' is a "string"' - Run `ruff check --fix` to apply this fix. - singles_escaped_unnecessary.py:14:1: Q004 [*] Unnecessary escape on inner quote character | 12 | # Same as above, but with f-strings @@ -99,8 +91,6 @@ singles_escaped_unnecessary.py:14:1: Q004 [*] Unnecessary escape on inner quote 16 16 | f'\'This\' is a "string"' 17 17 | fr"This is a \'string\'" - Run `ruff check --fix` to apply this fix. - singles_escaped_unnecessary.py:21:5: Q004 [*] Unnecessary escape on inner quote character | 19 | this_should_raise_Q004 = ( @@ -120,8 +110,6 @@ singles_escaped_unnecessary.py:21:5: Q004 [*] Unnecessary escape on inner quote 23 23 | 24 24 | # Nested f-strings (Python 3.12+) - Run `ruff check --fix` to apply this fix. - singles_escaped_unnecessary.py:31:1: Q004 [*] Unnecessary escape on inner quote character | 29 | # @@ -142,8 +130,6 @@ singles_escaped_unnecessary.py:31:1: Q004 [*] Unnecessary escape on inner quote 33 33 | f"\'foo\' {f"\'foo\'"} \'\'" # Q004 34 34 | - Run `ruff check --fix` to apply this fix. - singles_escaped_unnecessary.py:32:1: Q004 [*] Unnecessary escape on inner quote character | 30 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -163,8 +149,6 @@ singles_escaped_unnecessary.py:32:1: Q004 [*] Unnecessary escape on inner quote 34 34 | 35 35 | f"normal {f"nested"} normal" - Run `ruff check --fix` to apply this fix. - singles_escaped_unnecessary.py:33:1: Q004 [*] Unnecessary escape on inner quote character | 31 | f"\'foo\' {"foo"}" # Q004 @@ -185,8 +169,6 @@ singles_escaped_unnecessary.py:33:1: Q004 [*] Unnecessary escape on inner quote 35 35 | f"normal {f"nested"} normal" 36 36 | f"\'normal\' {f"nested"} normal" # Q004 - Run `ruff check --fix` to apply this fix. - singles_escaped_unnecessary.py:33:12: Q004 [*] Unnecessary escape on inner quote character | 31 | f"\'foo\' {"foo"}" # Q004 @@ -207,8 +189,6 @@ singles_escaped_unnecessary.py:33:12: Q004 [*] Unnecessary escape on inner quote 35 35 | f"normal {f"nested"} normal" 36 36 | f"\'normal\' {f"nested"} normal" # Q004 - Run `ruff check --fix` to apply this fix. - singles_escaped_unnecessary.py:36:1: Q004 [*] Unnecessary escape on inner quote character | 35 | f"normal {f"nested"} normal" @@ -228,8 +208,6 @@ singles_escaped_unnecessary.py:36:1: Q004 [*] Unnecessary escape on inner quote 38 38 | f"\'normal\' {f"\'nested\' {"other"} normal"} 'single quotes'" # Q004 39 39 | f"\'normal\' {f"\'nested\' {"other"} 'single quotes'"} normal" # Q004 - Run `ruff check --fix` to apply this fix. - singles_escaped_unnecessary.py:37:1: Q004 [*] Unnecessary escape on inner quote character | 35 | f"normal {f"nested"} normal" @@ -250,8 +228,6 @@ singles_escaped_unnecessary.py:37:1: Q004 [*] Unnecessary escape on inner quote 39 39 | f"\'normal\' {f"\'nested\' {"other"} 'single quotes'"} normal" # Q004 40 40 | - Run `ruff check --fix` to apply this fix. - singles_escaped_unnecessary.py:38:1: Q004 [*] Unnecessary escape on inner quote character | 36 | f"\'normal\' {f"nested"} normal" # Q004 @@ -271,8 +247,6 @@ singles_escaped_unnecessary.py:38:1: Q004 [*] Unnecessary escape on inner quote 40 40 | 41 41 | # Make sure we do not unescape quotes - Run `ruff check --fix` to apply this fix. - singles_escaped_unnecessary.py:38:15: Q004 [*] Unnecessary escape on inner quote character | 36 | f"\'normal\' {f"nested"} normal" # Q004 @@ -292,8 +266,6 @@ singles_escaped_unnecessary.py:38:15: Q004 [*] Unnecessary escape on inner quote 40 40 | 41 41 | # Make sure we do not unescape quotes - Run `ruff check --fix` to apply this fix. - singles_escaped_unnecessary.py:39:1: Q004 [*] Unnecessary escape on inner quote character | 37 | f"\'normal\' {f"nested"} 'single quotes'" @@ -314,8 +286,6 @@ singles_escaped_unnecessary.py:39:1: Q004 [*] Unnecessary escape on inner quote 41 41 | # Make sure we do not unescape quotes 42 42 | this_is_fine = "This is an \\'escaped\\' quote" - Run `ruff check --fix` to apply this fix. - singles_escaped_unnecessary.py:39:15: Q004 [*] Unnecessary escape on inner quote character | 37 | f"\'normal\' {f"nested"} 'single quotes'" @@ -336,8 +306,6 @@ singles_escaped_unnecessary.py:39:15: Q004 [*] Unnecessary escape on inner quote 41 41 | # Make sure we do not unescape quotes 42 42 | this_is_fine = "This is an \\'escaped\\' quote" - Run `ruff check --fix` to apply this fix. - singles_escaped_unnecessary.py:43:26: Q004 [*] Unnecessary escape on inner quote character | 41 | # Make sure we do not unescape quotes @@ -358,8 +326,6 @@ singles_escaped_unnecessary.py:43:26: Q004 [*] Unnecessary escape on inner quote 45 45 | # Invalid escapes in bytestrings are also triggered: 46 46 | x = b"\xe7\xeb\x0c\xa1\x1b\x83tN\xce=x\xe9\xbe\x01\xb9\x13B_\xba\xe7\x0c2\xce\'rm\x0e\xcd\xe9.\xf8\xd2" # Q004 - Run `ruff check --fix` to apply this fix. - singles_escaped_unnecessary.py:46:5: Q004 [*] Unnecessary escape on inner quote character | 45 | # Invalid escapes in bytestrings are also triggered: @@ -373,5 +339,3 @@ singles_escaped_unnecessary.py:46:5: Q004 [*] Unnecessary escape on inner quote 45 45 | # Invalid escapes in bytestrings are also triggered: 46 |-x = b"\xe7\xeb\x0c\xa1\x1b\x83tN\xce=x\xe9\xbe\x01\xb9\x13B_\xba\xe7\x0c2\xce\'rm\x0e\xcd\xe9.\xf8\xd2" # Q004 46 |+x = b"\xe7\xeb\x0c\xa1\x1b\x83tN\xce=x\xe9\xbe\x01\xb9\x13B_\xba\xe7\x0c2\xce'rm\x0e\xcd\xe9.\xf8\xd2" # Q004 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap index c98ff346aae2f..bcee6ae217bda 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_implicit.py.snap @@ -18,8 +18,6 @@ singles_implicit.py:2:5: Q000 [*] Single quotes found but double quotes preferre 4 4 | 'not' 5 5 | ) - Run `ruff check --fix` to apply this fix. - singles_implicit.py:3:5: Q000 [*] Single quotes found but double quotes preferred | 1 | x = ( @@ -39,8 +37,6 @@ singles_implicit.py:3:5: Q000 [*] Single quotes found but double quotes preferre 5 5 | ) 6 6 | - Run `ruff check --fix` to apply this fix. - singles_implicit.py:4:5: Q000 [*] Single quotes found but double quotes preferred | 2 | 'This' @@ -60,8 +56,6 @@ singles_implicit.py:4:5: Q000 [*] Single quotes found but double quotes preferre 6 6 | 7 7 | x = ( - Run `ruff check --fix` to apply this fix. - singles_implicit.py:8:5: Q000 [*] Single quotes found but double quotes preferred | 7 | x = ( @@ -81,8 +75,6 @@ singles_implicit.py:8:5: Q000 [*] Single quotes found but double quotes preferre 10 10 | 'not' 11 11 | ) - Run `ruff check --fix` to apply this fix. - singles_implicit.py:9:5: Q000 [*] Single quotes found but double quotes preferred | 7 | x = ( @@ -103,8 +95,6 @@ singles_implicit.py:9:5: Q000 [*] Single quotes found but double quotes preferre 11 11 | ) 12 12 | - Run `ruff check --fix` to apply this fix. - singles_implicit.py:10:5: Q000 [*] Single quotes found but double quotes preferred | 8 | 'This' \ @@ -124,8 +114,6 @@ singles_implicit.py:10:5: Q000 [*] Single quotes found but double quotes preferr 12 12 | 13 13 | x = ( - Run `ruff check --fix` to apply this fix. - singles_implicit.py:27:1: Q000 [*] Single quotes found but double quotes preferred | 25 | if True: @@ -140,5 +128,3 @@ singles_implicit.py:27:1: Q000 [*] Single quotes found but double quotes preferr 26 26 | 'This can use "single" quotes' 27 |-'But this needs to be changed' 27 |+"But this needs to be changed" - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap index 7b06ad71ef5d1..53a2c785f3210 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_multiline_string.py.snap @@ -21,5 +21,3 @@ singles_multiline_string.py:1:5: Q001 [*] Single quote multiline found but doubl 4 4 | 5 5 | s = """ This 'should' 6 6 | 'not' be - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_would_be_triple_quotes.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_would_be_triple_quotes.py.snap index 3d603de2bae5a..0db76851b068c 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_would_be_triple_quotes.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_doubles_over_singles_would_be_triple_quotes.py.snap @@ -21,8 +21,6 @@ singles_would_be_triple_quotes.py:1:33: Q000 [*] Single quotes found but double 1 |+s = ''"Start with empty string" " and lint docstring safely" 2 2 | s = 'Do not'" start with empty string" ' and lint docstring safely' - Run `ruff check --fix` to apply this fix. - singles_would_be_triple_quotes.py:2:5: Q000 [*] Single quotes found but double quotes preferred | 1 | s = ''"Start with empty string" ' and lint docstring safely' @@ -35,8 +33,6 @@ singles_would_be_triple_quotes.py:2:5: Q000 [*] Single quotes found but double q 2 |-s = 'Do not'" start with empty string" ' and lint docstring safely' 2 |+s = "Do not"" start with empty string" ' and lint docstring safely' - Run `ruff check --fix` to apply this fix. - singles_would_be_triple_quotes.py:2:40: Q000 [*] Single quotes found but double quotes preferred | 1 | s = ''"Start with empty string" ' and lint docstring safely' @@ -48,5 +44,3 @@ singles_would_be_triple_quotes.py:2:40: Q000 [*] Single quotes found but double 1 1 | s = ''"Start with empty string" ' and lint docstring safely' 2 |-s = 'Do not'" start with empty string" ' and lint docstring safely' 2 |+s = 'Do not'" start with empty string" " and lint docstring safely" - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap index f0d14f9528909..59cf683bee285 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap @@ -16,8 +16,6 @@ doubles.py:1:25: Q000 [*] Double quotes found but single quotes preferred 3 3 | this_should_be_linted = f"double quote string" 4 4 | this_should_be_linted = f"double {'quote'} string" - Run `ruff check --fix` to apply this fix. - doubles.py:2:25: Q000 [*] Double quotes found but single quotes preferred | 1 | this_should_be_linted = "double quote string" @@ -34,8 +32,6 @@ doubles.py:2:25: Q000 [*] Double quotes found but single quotes preferred 3 3 | this_should_be_linted = f"double quote string" 4 4 | this_should_be_linted = f"double {'quote'} string" - Run `ruff check --fix` to apply this fix. - doubles.py:3:25: Q000 [*] Double quotes found but single quotes preferred | 1 | this_should_be_linted = "double quote string" @@ -51,5 +47,3 @@ doubles.py:3:25: Q000 [*] Double quotes found but single quotes preferred 3 |-this_should_be_linted = f"double quote string" 3 |+this_should_be_linted = f'double quote string' 4 4 | this_should_be_linted = f"double {'quote'} string" - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap index 57ed1bb1c9ab2..718db1258a20c 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped.py.snap @@ -16,8 +16,6 @@ doubles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner qu 3 3 | this_is_fine = '"This" is a \'string\'' 4 4 | this_is_fine = "This is a 'string'" - Run `ruff check --fix` to apply this fix. - doubles_escaped.py:2:26: Q003 [*] Change outer quotes to avoid escaping inner quotes | 1 | this_should_raise_Q003 = 'This is a \'string\'' @@ -35,8 +33,6 @@ doubles_escaped.py:2:26: Q003 [*] Change outer quotes to avoid escaping inner qu 4 4 | this_is_fine = "This is a 'string'" 5 5 | this_is_fine = "\"This\" is a 'string'" - Run `ruff check --fix` to apply this fix. - doubles_escaped.py:10:5: Q003 [*] Change outer quotes to avoid escaping inner quotes | 8 | this_should_raise = ( @@ -56,8 +52,6 @@ doubles_escaped.py:10:5: Q003 [*] Change outer quotes to avoid escaping inner qu 12 12 | 13 13 | # Same as above, but with f-strings - Run `ruff check --fix` to apply this fix. - doubles_escaped.py:14:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 13 | # Same as above, but with f-strings @@ -77,8 +71,6 @@ doubles_escaped.py:14:1: Q003 [*] Change outer quotes to avoid escaping inner qu 16 16 | f'"This" is a \'string\'' 17 17 | f"This is a 'string'" - Run `ruff check --fix` to apply this fix. - doubles_escaped.py:15:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 13 | # Same as above, but with f-strings @@ -99,8 +91,6 @@ doubles_escaped.py:15:1: Q003 [*] Change outer quotes to avoid escaping inner qu 17 17 | f"This is a 'string'" 18 18 | f"\"This\" is a 'string'" - Run `ruff check --fix` to apply this fix. - doubles_escaped.py:23:5: Q003 [*] Change outer quotes to avoid escaping inner quotes | 21 | foo = ( @@ -120,8 +110,6 @@ doubles_escaped.py:23:5: Q003 [*] Change outer quotes to avoid escaping inner qu 25 25 | 26 26 | # Nested f-strings (Python 3.12+) - Run `ruff check --fix` to apply this fix. - doubles_escaped.py:33:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 31 | # @@ -142,8 +130,6 @@ doubles_escaped.py:33:1: Q003 [*] Change outer quotes to avoid escaping inner qu 35 35 | f'\'foo\' {f'\'nested\''} \'\'' # Q003 36 36 | - Run `ruff check --fix` to apply this fix. - doubles_escaped.py:34:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -163,8 +149,6 @@ doubles_escaped.py:34:1: Q003 [*] Change outer quotes to avoid escaping inner qu 36 36 | 37 37 | f'normal {f'nested'} normal' - Run `ruff check --fix` to apply this fix. - doubles_escaped.py:35:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 33 | f'\'foo\' {'nested'}' # Q003 @@ -185,8 +169,6 @@ doubles_escaped.py:35:1: Q003 [*] Change outer quotes to avoid escaping inner qu 37 37 | f'normal {f'nested'} normal' 38 38 | f'\'normal\' {f'nested'} normal' # Q003 - Run `ruff check --fix` to apply this fix. - doubles_escaped.py:35:12: Q003 [*] Change outer quotes to avoid escaping inner quotes | 33 | f'\'foo\' {'nested'}' # Q003 @@ -207,8 +189,6 @@ doubles_escaped.py:35:12: Q003 [*] Change outer quotes to avoid escaping inner q 37 37 | f'normal {f'nested'} normal' 38 38 | f'\'normal\' {f'nested'} normal' # Q003 - Run `ruff check --fix` to apply this fix. - doubles_escaped.py:38:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 37 | f'normal {f'nested'} normal' @@ -228,8 +208,6 @@ doubles_escaped.py:38:1: Q003 [*] Change outer quotes to avoid escaping inner qu 40 40 | f'\'normal\' {f'\'nested\' {'other'} normal'} "double quotes"' # Q003 41 41 | f'\'normal\' {f'\'nested\' {'other'} "double quotes"'} normal' # Q00l - Run `ruff check --fix` to apply this fix. - doubles_escaped.py:40:15: Q003 [*] Change outer quotes to avoid escaping inner quotes | 38 | f'\'normal\' {f'nested'} normal' # Q003 @@ -247,8 +225,6 @@ doubles_escaped.py:40:15: Q003 [*] Change outer quotes to avoid escaping inner q 40 |+f'\'normal\' {f"'nested' {'other'} normal"} "double quotes"' # Q003 41 41 | f'\'normal\' {f'\'nested\' {'other'} "double quotes"'} normal' # Q00l - Run `ruff check --fix` to apply this fix. - doubles_escaped.py:41:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 39 | f'\'normal\' {f'nested'} "double quotes"' @@ -263,5 +239,3 @@ doubles_escaped.py:41:1: Q003 [*] Change outer quotes to avoid escaping inner qu 40 40 | f'\'normal\' {f'\'nested\' {'other'} normal'} "double quotes"' # Q003 41 |-f'\'normal\' {f'\'nested\' {'other'} "double quotes"'} normal' # Q00l 41 |+f"'normal' {f'\'nested\' {'other'} "double quotes"'} normal" # Q00l - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_py311.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_py311.snap index 7d774f74bd53d..8348b37ec9937 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_py311.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_py311.snap @@ -16,8 +16,6 @@ doubles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner qu 3 3 | this_is_fine = '"This" is a \'string\'' 4 4 | this_is_fine = "This is a 'string'" - Run `ruff check --fix` to apply this fix. - doubles_escaped.py:2:26: Q003 [*] Change outer quotes to avoid escaping inner quotes | 1 | this_should_raise_Q003 = 'This is a \'string\'' @@ -35,8 +33,6 @@ doubles_escaped.py:2:26: Q003 [*] Change outer quotes to avoid escaping inner qu 4 4 | this_is_fine = "This is a 'string'" 5 5 | this_is_fine = "\"This\" is a 'string'" - Run `ruff check --fix` to apply this fix. - doubles_escaped.py:10:5: Q003 [*] Change outer quotes to avoid escaping inner quotes | 8 | this_should_raise = ( @@ -56,8 +52,6 @@ doubles_escaped.py:10:5: Q003 [*] Change outer quotes to avoid escaping inner qu 12 12 | 13 13 | # Same as above, but with f-strings - Run `ruff check --fix` to apply this fix. - doubles_escaped.py:14:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 13 | # Same as above, but with f-strings @@ -77,8 +71,6 @@ doubles_escaped.py:14:1: Q003 [*] Change outer quotes to avoid escaping inner qu 16 16 | f'"This" is a \'string\'' 17 17 | f"This is a 'string'" - Run `ruff check --fix` to apply this fix. - doubles_escaped.py:15:1: Q003 [*] Change outer quotes to avoid escaping inner quotes | 13 | # Same as above, but with f-strings @@ -99,8 +91,6 @@ doubles_escaped.py:15:1: Q003 [*] Change outer quotes to avoid escaping inner qu 17 17 | f"This is a 'string'" 18 18 | f"\"This\" is a 'string'" - Run `ruff check --fix` to apply this fix. - doubles_escaped.py:23:5: Q003 [*] Change outer quotes to avoid escaping inner quotes | 21 | foo = ( @@ -119,5 +109,3 @@ doubles_escaped.py:23:5: Q003 [*] Change outer quotes to avoid escaping inner qu 24 24 | ) 25 25 | 26 26 | # Nested f-strings (Python 3.12+) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap index c405a484e55a7..3dc984ea895cf 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_escaped_unnecessary.py.snap @@ -16,8 +16,6 @@ doubles_escaped_unnecessary.py:1:26: Q004 [*] Unnecessary escape on inner quote 3 3 | this_is_fine = '"This" is a \"string\"' 4 4 | this_is_fine = "This is a 'string'" - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:2:26: Q004 [*] Unnecessary escape on inner quote character | 1 | this_should_raise_Q004 = 'This is a \"string\"' @@ -35,8 +33,6 @@ doubles_escaped_unnecessary.py:2:26: Q004 [*] Unnecessary escape on inner quote 4 4 | this_is_fine = "This is a 'string'" 5 5 | this_is_fine = "\"This\" is a 'string'" - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:3:16: Q004 [*] Unnecessary escape on inner quote character | 1 | this_should_raise_Q004 = 'This is a \"string\"' @@ -56,8 +52,6 @@ doubles_escaped_unnecessary.py:3:16: Q004 [*] Unnecessary escape on inner quote 5 5 | this_is_fine = "\"This\" is a 'string'" 6 6 | this_is_fine = r'This is a \"string\"' - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:10:5: Q004 [*] Unnecessary escape on inner quote character | 8 | this_should_raise_Q004 = ( @@ -77,8 +71,6 @@ doubles_escaped_unnecessary.py:10:5: Q004 [*] Unnecessary escape on inner quote 12 12 | 13 13 | # Same as above, but with f-strings - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:14:1: Q004 [*] Unnecessary escape on inner quote character | 13 | # Same as above, but with f-strings @@ -98,8 +90,6 @@ doubles_escaped_unnecessary.py:14:1: Q004 [*] Unnecessary escape on inner quote 16 16 | f'"This" is a \"string\"' 17 17 | f"This is a 'string'" - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:15:1: Q004 [*] Unnecessary escape on inner quote character | 13 | # Same as above, but with f-strings @@ -120,8 +110,6 @@ doubles_escaped_unnecessary.py:15:1: Q004 [*] Unnecessary escape on inner quote 17 17 | f"This is a 'string'" 18 18 | f"\"This\" is a 'string'" - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:16:1: Q004 [*] Unnecessary escape on inner quote character | 14 | f'This is a \"string\"' # Q004 @@ -142,8 +130,6 @@ doubles_escaped_unnecessary.py:16:1: Q004 [*] Unnecessary escape on inner quote 18 18 | f"\"This\" is a 'string'" 19 19 | fr'This is a \"string\"' - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:23:5: Q004 [*] Unnecessary escape on inner quote character | 21 | this_should_raise_Q004 = ( @@ -163,8 +149,6 @@ doubles_escaped_unnecessary.py:23:5: Q004 [*] Unnecessary escape on inner quote 25 25 | 26 26 | # Nested f-strings (Python 3.12+) - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:33:1: Q004 [*] Unnecessary escape on inner quote character | 31 | # @@ -185,8 +169,6 @@ doubles_escaped_unnecessary.py:33:1: Q004 [*] Unnecessary escape on inner quote 35 35 | f'\"foo\" {f'\"nested\"'} \"\"' # Q004 36 36 | - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:34:1: Q004 [*] Unnecessary escape on inner quote character | 32 | # but as the actual string itself is invalid pre 3.12, we don't catch it. @@ -206,8 +188,6 @@ doubles_escaped_unnecessary.py:34:1: Q004 [*] Unnecessary escape on inner quote 36 36 | 37 37 | f'normal {f'nested'} normal' - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:35:1: Q004 [*] Unnecessary escape on inner quote character | 33 | f'\"foo\" {'nested'}' # Q004 @@ -228,8 +208,6 @@ doubles_escaped_unnecessary.py:35:1: Q004 [*] Unnecessary escape on inner quote 37 37 | f'normal {f'nested'} normal' 38 38 | f'\"normal\" {f'nested'} normal' # Q004 - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:35:12: Q004 [*] Unnecessary escape on inner quote character | 33 | f'\"foo\" {'nested'}' # Q004 @@ -250,8 +228,6 @@ doubles_escaped_unnecessary.py:35:12: Q004 [*] Unnecessary escape on inner quote 37 37 | f'normal {f'nested'} normal' 38 38 | f'\"normal\" {f'nested'} normal' # Q004 - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:38:1: Q004 [*] Unnecessary escape on inner quote character | 37 | f'normal {f'nested'} normal' @@ -271,8 +247,6 @@ doubles_escaped_unnecessary.py:38:1: Q004 [*] Unnecessary escape on inner quote 40 40 | f'\"normal\" {f'\"nested\" {'other'} normal'} "double quotes"' # Q004 41 41 | f'\"normal\" {f'\"nested\" {'other'} "double quotes"'} normal' # Q004 - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:39:1: Q004 [*] Unnecessary escape on inner quote character | 37 | f'normal {f'nested'} normal' @@ -293,8 +267,6 @@ doubles_escaped_unnecessary.py:39:1: Q004 [*] Unnecessary escape on inner quote 41 41 | f'\"normal\" {f'\"nested\" {'other'} "double quotes"'} normal' # Q004 42 42 | - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:40:1: Q004 [*] Unnecessary escape on inner quote character | 38 | f'\"normal\" {f'nested'} normal' # Q004 @@ -314,8 +286,6 @@ doubles_escaped_unnecessary.py:40:1: Q004 [*] Unnecessary escape on inner quote 42 42 | 43 43 | # Make sure we do not unescape quotes - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:40:15: Q004 [*] Unnecessary escape on inner quote character | 38 | f'\"normal\" {f'nested'} normal' # Q004 @@ -335,8 +305,6 @@ doubles_escaped_unnecessary.py:40:15: Q004 [*] Unnecessary escape on inner quote 42 42 | 43 43 | # Make sure we do not unescape quotes - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:41:1: Q004 [*] Unnecessary escape on inner quote character | 39 | f'\"normal\" {f'nested'} "double quotes"' @@ -357,8 +325,6 @@ doubles_escaped_unnecessary.py:41:1: Q004 [*] Unnecessary escape on inner quote 43 43 | # Make sure we do not unescape quotes 44 44 | this_is_fine = 'This is an \\"escaped\\" quote' - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:41:15: Q004 [*] Unnecessary escape on inner quote character | 39 | f'\"normal\" {f'nested'} "double quotes"' @@ -379,8 +345,6 @@ doubles_escaped_unnecessary.py:41:15: Q004 [*] Unnecessary escape on inner quote 43 43 | # Make sure we do not unescape quotes 44 44 | this_is_fine = 'This is an \\"escaped\\" quote' - Run `ruff check --fix` to apply this fix. - doubles_escaped_unnecessary.py:45:26: Q004 [*] Unnecessary escape on inner quote character | 43 | # Make sure we do not unescape quotes @@ -395,5 +359,3 @@ doubles_escaped_unnecessary.py:45:26: Q004 [*] Unnecessary escape on inner quote 44 44 | this_is_fine = 'This is an \\"escaped\\" quote' 45 |-this_should_raise_Q004 = 'This is an \\\"escaped\\\" quote with an extra backslash' 45 |+this_should_raise_Q004 = 'This is an \\"escaped\\" quote with an extra backslash' - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap index 3fe80d9ebd34a..50d91feae44a2 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_implicit.py.snap @@ -18,8 +18,6 @@ doubles_implicit.py:2:5: Q000 [*] Double quotes found but single quotes preferre 4 4 | "not" 5 5 | ) - Run `ruff check --fix` to apply this fix. - doubles_implicit.py:3:5: Q000 [*] Double quotes found but single quotes preferred | 1 | x = ( @@ -39,8 +37,6 @@ doubles_implicit.py:3:5: Q000 [*] Double quotes found but single quotes preferre 5 5 | ) 6 6 | - Run `ruff check --fix` to apply this fix. - doubles_implicit.py:4:5: Q000 [*] Double quotes found but single quotes preferred | 2 | "This" @@ -60,8 +56,6 @@ doubles_implicit.py:4:5: Q000 [*] Double quotes found but single quotes preferre 6 6 | 7 7 | x = ( - Run `ruff check --fix` to apply this fix. - doubles_implicit.py:8:5: Q000 [*] Double quotes found but single quotes preferred | 7 | x = ( @@ -81,8 +75,6 @@ doubles_implicit.py:8:5: Q000 [*] Double quotes found but single quotes preferre 10 10 | "not" 11 11 | ) - Run `ruff check --fix` to apply this fix. - doubles_implicit.py:9:5: Q000 [*] Double quotes found but single quotes preferred | 7 | x = ( @@ -103,8 +95,6 @@ doubles_implicit.py:9:5: Q000 [*] Double quotes found but single quotes preferre 11 11 | ) 12 12 | - Run `ruff check --fix` to apply this fix. - doubles_implicit.py:10:5: Q000 [*] Double quotes found but single quotes preferred | 8 | "This" \ @@ -124,8 +114,6 @@ doubles_implicit.py:10:5: Q000 [*] Double quotes found but single quotes preferr 12 12 | 13 13 | x = ( - Run `ruff check --fix` to apply this fix. - doubles_implicit.py:27:1: Q000 [*] Double quotes found but single quotes preferred | 25 | if True: @@ -140,5 +128,3 @@ doubles_implicit.py:27:1: Q000 [*] Double quotes found but single quotes preferr 26 26 | "This can use 'double' quotes" 27 |-"But this needs to be changed" 27 |+'But this needs to be changed' - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap index a6d4d77b58010..e2bc6f44a4d2e 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_multiline_string.py.snap @@ -21,5 +21,3 @@ doubles_multiline_string.py:1:5: Q001 [*] Double quote multiline found but singl 4 4 | 5 5 | s = ''' This "should" 6 6 | "not" be - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_would_be_triple_quotes.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_would_be_triple_quotes.py.snap index 7582f82084c8b..3f8c5b15f00ff 100644 --- a/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_would_be_triple_quotes.py.snap +++ b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles_would_be_triple_quotes.py.snap @@ -20,5 +20,3 @@ doubles_would_be_triple_quotes.py:2:5: Q000 [*] Double quotes found but single q 1 1 | s = ""'Start with empty string' ' and lint docstring safely' 2 |-s = "Do not"' start with empty string' ' and lint docstring safely' 2 |+s = 'Do not'' start with empty string' ' and lint docstring safely' - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap b/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap index faf0727c38af9..10baa41587ec3 100644 --- a/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap +++ b/crates/ruff_linter/src/rules/flake8_raise/snapshots/ruff_linter__rules__flake8_raise__tests__unnecessary-paren-on-raise-exception_RSE102.py.snap @@ -21,8 +21,6 @@ RSE102.py:5:21: RSE102 [*] Unnecessary parentheses on raised exception 7 7 | try: 8 8 | x = 1 / 0 - Run `ruff check --fix` to apply this fix. - RSE102.py:13:16: RSE102 [*] Unnecessary parentheses on raised exception | 12 | # RSE102 @@ -42,8 +40,6 @@ RSE102.py:13:16: RSE102 [*] Unnecessary parentheses on raised exception 15 15 | # RSE102 16 16 | raise TypeError () - Run `ruff check --fix` to apply this fix. - RSE102.py:16:17: RSE102 [*] Unnecessary parentheses on raised exception | 15 | # RSE102 @@ -63,8 +59,6 @@ RSE102.py:16:17: RSE102 [*] Unnecessary parentheses on raised exception 18 18 | # RSE102 19 19 | raise TypeError \ - Run `ruff check --fix` to apply this fix. - RSE102.py:20:5: RSE102 [*] Unnecessary parentheses on raised exception | 18 | # RSE102 @@ -85,8 +79,6 @@ RSE102.py:20:5: RSE102 [*] Unnecessary parentheses on raised exception 22 22 | # RSE102 23 23 | raise TypeError \ - Run `ruff check --fix` to apply this fix. - RSE102.py:24:5: RSE102 [*] Unnecessary parentheses on raised exception | 22 | # RSE102 @@ -107,8 +99,6 @@ RSE102.py:24:5: RSE102 [*] Unnecessary parentheses on raised exception 26 26 | # RSE102 27 27 | raise TypeError( - Run `ruff check --fix` to apply this fix. - RSE102.py:27:16: RSE102 [*] Unnecessary parentheses on raised exception | 26 | # RSE102 @@ -133,8 +123,6 @@ RSE102.py:27:16: RSE102 [*] Unnecessary parentheses on raised exception 31 29 | # RSE102 32 30 | raise (TypeError) ( - Run `ruff check --fix` to apply this fix. - RSE102.py:32:19: RSE102 [*] Unnecessary parentheses on raised exception | 31 | # RSE102 @@ -159,8 +147,6 @@ RSE102.py:32:19: RSE102 [*] Unnecessary parentheses on raised exception 36 34 | # RSE102 37 35 | raise TypeError( - Run `ruff check --fix` to apply this fix. - RSE102.py:37:16: RSE102 [*] Unnecessary parentheses on raised exception | 36 | # RSE102 @@ -185,8 +171,6 @@ RSE102.py:37:16: RSE102 [*] Unnecessary parentheses on raised exception 41 39 | # OK 42 40 | raise AssertionError - Run `ruff check --fix` to apply this fix. - RSE102.py:74:17: RSE102 [*] Unnecessary parentheses on raised exception | 73 | # RSE102 @@ -206,8 +190,6 @@ RSE102.py:74:17: RSE102 [*] Unnecessary parentheses on raised exception 76 76 | raise IndexError()\ 77 77 | from ZeroDivisionError - Run `ruff check --fix` to apply this fix. - RSE102.py:76:17: RSE102 [*] Unnecessary parentheses on raised exception | 74 | raise IndexError()from ZeroDivisionError @@ -227,8 +209,6 @@ RSE102.py:76:17: RSE102 [*] Unnecessary parentheses on raised exception 78 78 | 79 79 | raise IndexError() from ZeroDivisionError - Run `ruff check --fix` to apply this fix. - RSE102.py:79:17: RSE102 [*] Unnecessary parentheses on raised exception | 77 | from ZeroDivisionError @@ -249,8 +229,6 @@ RSE102.py:79:17: RSE102 [*] Unnecessary parentheses on raised exception 81 81 | raise IndexError(); 82 82 | - Run `ruff check --fix` to apply this fix. - RSE102.py:81:17: RSE102 [*] Unnecessary parentheses on raised exception | 79 | raise IndexError() from ZeroDivisionError @@ -271,8 +249,6 @@ RSE102.py:81:17: RSE102 [*] Unnecessary parentheses on raised exception 83 83 | # RSE102 84 84 | raise Foo() - Run `ruff check --fix` to apply this fix. - RSE102.py:84:10: RSE102 [*] Unnecessary parentheses on raised exception | 83 | # RSE102 diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET501_RET501.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET501_RET501.py.snap index 4522cc2fc6762..26539cff3b8c7 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET501_RET501.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET501_RET501.py.snap @@ -19,8 +19,6 @@ RET501.py:4:5: RET501 [*] Do not explicitly `return None` in function if it is t 6 6 | 7 7 | class BaseCache: - Run `ruff check --fix` to apply this fix. - RET501.py:14:9: RET501 [*] Do not explicitly `return None` in function if it is the only possible return value | 12 | def get(self, key: str) -> None: @@ -40,5 +38,3 @@ RET501.py:14:9: RET501 [*] Do not explicitly `return None` in function if it is 15 15 | 16 16 | @property 17 17 | def prop(self) -> None: - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET502_RET502.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET502_RET502.py.snap index b18c1a7aad0ab..fbdf01325e9fc 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET502_RET502.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET502_RET502.py.snap @@ -17,6 +17,4 @@ RET502.py:3:9: RET502 [*] Do not implicitly `return None` in function able to re 3 |+ return None # error 4 4 | return 1 5 5 | -6 6 | - - Run `ruff check --fix` to apply this fix. +6 6 | diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET505_RET505.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET505_RET505.py.snap index 8a3d5f83b52fd..679e149862df0 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET505_RET505.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET505_RET505.py.snap @@ -21,8 +21,6 @@ RET505.py:8:5: RET505 [*] Unnecessary `elif` after `return` statement 10 10 | return w 11 11 | else: - Run `ruff check --fix` to apply this fix. - RET505.py:23:5: RET505 [*] Unnecessary `elif` after `return` statement | 21 | b = 2 @@ -43,8 +41,6 @@ RET505.py:23:5: RET505 [*] Unnecessary `elif` after `return` statement 25 25 | else: 26 26 | c = 3 - Run `ruff check --fix` to apply this fix. - RET505.py:41:5: RET505 [*] Unnecessary `elif` after `return` statement | 39 | a = 1 @@ -65,8 +61,6 @@ RET505.py:41:5: RET505 [*] Unnecessary `elif` after `return` statement 43 43 | return w 44 44 | else: - Run `ruff check --fix` to apply this fix. - RET505.py:53:5: RET505 [*] Unnecessary `else` after `return` statement | 51 | a = 1 @@ -90,8 +84,6 @@ RET505.py:53:5: RET505 [*] Unnecessary `else` after `return` statement 57 56 | 58 57 | def foo3(x, y, z): - Run `ruff check --fix` to apply this fix. - RET505.py:64:9: RET505 [*] Unnecessary `else` after `return` statement | 62 | b = 2 @@ -115,8 +107,6 @@ RET505.py:64:9: RET505 [*] Unnecessary `else` after `return` statement 68 67 | d = 4 69 68 | return z - Run `ruff check --fix` to apply this fix. - RET505.py:79:5: RET505 [*] Unnecessary `else` after `return` statement | 77 | b = 2 @@ -138,8 +128,6 @@ RET505.py:79:5: RET505 [*] Unnecessary `else` after `return` statement 82 81 | 83 82 | - Run `ruff check --fix` to apply this fix. - RET505.py:89:9: RET505 [*] Unnecessary `else` after `return` statement | 87 | a = 4 @@ -161,8 +149,6 @@ RET505.py:89:9: RET505 [*] Unnecessary `else` after `return` statement 92 91 | c = 3 93 92 | return - Run `ruff check --fix` to apply this fix. - RET505.py:99:5: RET505 [*] Unnecessary `else` after `return` statement | 97 | if x: # [no-else-return] @@ -190,8 +176,6 @@ RET505.py:99:5: RET505 [*] Unnecessary `else` after `return` statement 105 104 | 106 105 | def fibo(n): - Run `ruff check --fix` to apply this fix. - RET505.py:109:5: RET505 [*] Unnecessary `else` after `return` statement | 107 | if n<2: @@ -215,8 +199,6 @@ RET505.py:109:5: RET505 [*] Unnecessary `else` after `return` statement 113 112 | 114 113 | ### - Run `ruff check --fix` to apply this fix. - RET505.py:145:5: RET505 [*] Unnecessary `else` after `return` statement | 143 | if True: @@ -240,8 +222,6 @@ RET505.py:145:5: RET505 [*] Unnecessary `else` after `return` statement 149 148 | 150 149 | def bar5(): - Run `ruff check --fix` to apply this fix. - RET505.py:153:5: RET505 [*] Unnecessary `else` after `return` statement | 151 | if True: @@ -263,8 +243,6 @@ RET505.py:153:5: RET505 [*] Unnecessary `else` after `return` statement 156 156 | 157 157 | def bar6(): - Run `ruff check --fix` to apply this fix. - RET505.py:160:5: RET505 [*] Unnecessary `else` after `return` statement | 158 | if True: @@ -289,8 +267,6 @@ RET505.py:160:5: RET505 [*] Unnecessary `else` after `return` statement 165 163 | 166 164 | def bar7(): - Run `ruff check --fix` to apply this fix. - RET505.py:169:5: RET505 [*] Unnecessary `else` after `return` statement | 167 | if True: @@ -314,8 +290,6 @@ RET505.py:169:5: RET505 [*] Unnecessary `else` after `return` statement 173 172 | 174 173 | def bar8(): - Run `ruff check --fix` to apply this fix. - RET505.py:177:5: RET505 [*] Unnecessary `else` after `return` statement | 175 | if True: @@ -334,8 +308,6 @@ RET505.py:177:5: RET505 [*] Unnecessary `else` after `return` statement 179 179 | 180 180 | def bar9(): - Run `ruff check --fix` to apply this fix. - RET505.py:183:5: RET505 [*] Unnecessary `else` after `return` statement | 181 | if True: @@ -356,8 +328,6 @@ RET505.py:183:5: RET505 [*] Unnecessary `else` after `return` statement 186 185 | 187 186 | x = 0 - Run `ruff check --fix` to apply this fix. - RET505.py:200:5: RET505 [*] Unnecessary `else` after `return` statement | 198 | def sb(self): @@ -376,8 +346,6 @@ RET505.py:200:5: RET505 [*] Unnecessary `else` after `return` statement 202 202 | 203 203 | def indent(x, y, w, z): - Run `ruff check --fix` to apply this fix. - RET505.py:207:5: RET505 [*] Unnecessary `else` after `return` statement | 205 | a = 1 @@ -402,8 +370,6 @@ RET505.py:207:5: RET505 [*] Unnecessary `else` after `return` statement 212 211 | 213 212 | def indent(x, y, w, z): - Run `ruff check --fix` to apply this fix. - RET505.py:217:5: RET505 [*] Unnecessary `else` after `return` statement | 215 | a = 1 @@ -429,8 +395,6 @@ RET505.py:217:5: RET505 [*] Unnecessary `else` after `return` statement 222 221 | 223 222 | def indent(x, y, w, z): - Run `ruff check --fix` to apply this fix. - RET505.py:227:5: RET505 [*] Unnecessary `else` after `return` statement | 225 | a = 1 @@ -456,8 +420,6 @@ RET505.py:227:5: RET505 [*] Unnecessary `else` after `return` statement 232 231 | 233 232 | def indent(x, y, w, z): - Run `ruff check --fix` to apply this fix. - RET505.py:237:5: RET505 [*] Unnecessary `else` after `return` statement | 235 | a = 1 @@ -478,5 +440,3 @@ RET505.py:237:5: RET505 [*] Unnecessary `else` after `return` statement 240 |- return z 238 |+ c = 3 239 |+ return z - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET506_RET506.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET506_RET506.py.snap index 6ed414c7c0a93..1cc1f0d924f34 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET506_RET506.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET506_RET506.py.snap @@ -21,8 +21,6 @@ RET506.py:8:5: RET506 [*] Unnecessary `elif` after `raise` statement 10 10 | raise Exception(w) 11 11 | else: - Run `ruff check --fix` to apply this fix. - RET506.py:23:5: RET506 [*] Unnecessary `elif` after `raise` statement | 21 | b = 2 @@ -43,8 +41,6 @@ RET506.py:23:5: RET506 [*] Unnecessary `elif` after `raise` statement 25 25 | else: 26 26 | c = 3 - Run `ruff check --fix` to apply this fix. - RET506.py:34:5: RET506 [*] Unnecessary `else` after `raise` statement | 32 | a = 1 @@ -68,8 +64,6 @@ RET506.py:34:5: RET506 [*] Unnecessary `else` after `raise` statement 38 37 | 39 38 | def foo3(x, y, z): - Run `ruff check --fix` to apply this fix. - RET506.py:45:9: RET506 [*] Unnecessary `else` after `raise` statement | 43 | b = 2 @@ -93,8 +87,6 @@ RET506.py:45:9: RET506 [*] Unnecessary `else` after `raise` statement 49 48 | d = 4 50 49 | raise Exception(z) - Run `ruff check --fix` to apply this fix. - RET506.py:60:5: RET506 [*] Unnecessary `else` after `raise` statement | 58 | b = 2 @@ -116,8 +108,6 @@ RET506.py:60:5: RET506 [*] Unnecessary `else` after `raise` statement 63 62 | 64 63 | - Run `ruff check --fix` to apply this fix. - RET506.py:70:9: RET506 [*] Unnecessary `else` after `raise` statement | 68 | a = 4 @@ -139,8 +129,6 @@ RET506.py:70:9: RET506 [*] Unnecessary `else` after `raise` statement 73 72 | c = 3 74 73 | raise Exception(y) - Run `ruff check --fix` to apply this fix. - RET506.py:80:5: RET506 [*] Unnecessary `else` after `raise` statement | 78 | if x: # [no-else-raise] @@ -167,5 +155,3 @@ RET506.py:80:5: RET506 [*] Unnecessary `else` after `raise` statement 85 84 | 86 85 | 87 86 | ### - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET507_RET507.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET507_RET507.py.snap index eb0bcffe42fec..6421c05419e56 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET507_RET507.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET507_RET507.py.snap @@ -21,8 +21,6 @@ RET507.py:8:9: RET507 [*] Unnecessary `elif` after `continue` statement 10 10 | else: 11 11 | a = z - Run `ruff check --fix` to apply this fix. - RET507.py:22:9: RET507 [*] Unnecessary `elif` after `continue` statement | 20 | b = 2 @@ -43,8 +41,6 @@ RET507.py:22:9: RET507 [*] Unnecessary `elif` after `continue` statement 24 24 | else: 25 25 | c = 3 - Run `ruff check --fix` to apply this fix. - RET507.py:36:9: RET507 [*] Unnecessary `else` after `continue` statement | 34 | if i < y: # [no-else-continue] @@ -65,8 +61,6 @@ RET507.py:36:9: RET507 [*] Unnecessary `else` after `continue` statement 39 38 | 40 39 | def foo3(x, y, z): - Run `ruff check --fix` to apply this fix. - RET507.py:47:13: RET507 [*] Unnecessary `else` after `continue` statement | 45 | b = 2 @@ -90,8 +84,6 @@ RET507.py:47:13: RET507 [*] Unnecessary `else` after `continue` statement 51 50 | d = 4 52 51 | continue - Run `ruff check --fix` to apply this fix. - RET507.py:63:9: RET507 [*] Unnecessary `else` after `continue` statement | 61 | b = 2 @@ -113,8 +105,6 @@ RET507.py:63:9: RET507 [*] Unnecessary `else` after `continue` statement 66 65 | 67 66 | - Run `ruff check --fix` to apply this fix. - RET507.py:74:13: RET507 [*] Unnecessary `else` after `continue` statement | 72 | a = 4 @@ -136,8 +126,6 @@ RET507.py:74:13: RET507 [*] Unnecessary `else` after `continue` statement 77 76 | c = 3 78 77 | continue - Run `ruff check --fix` to apply this fix. - RET507.py:85:9: RET507 [*] Unnecessary `else` after `continue` statement | 83 | if x: # [no-else-continue] @@ -164,5 +152,3 @@ RET507.py:85:9: RET507 [*] Unnecessary `else` after `continue` statement 90 89 | 91 90 | 92 91 | def bar1(x, y, z): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET508_RET508.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET508_RET508.py.snap index 1acb7cffd975d..a25572f8d1596 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET508_RET508.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__preview__RET508_RET508.py.snap @@ -21,8 +21,6 @@ RET508.py:8:9: RET508 [*] Unnecessary `elif` after `break` statement 10 10 | else: 11 11 | a = z - Run `ruff check --fix` to apply this fix. - RET508.py:22:9: RET508 [*] Unnecessary `elif` after `break` statement | 20 | b = 2 @@ -43,8 +41,6 @@ RET508.py:22:9: RET508 [*] Unnecessary `elif` after `break` statement 24 24 | else: 25 25 | c = 3 - Run `ruff check --fix` to apply this fix. - RET508.py:33:9: RET508 [*] Unnecessary `else` after `break` statement | 31 | if i > y: # [no-else-break] @@ -65,8 +61,6 @@ RET508.py:33:9: RET508 [*] Unnecessary `else` after `break` statement 36 35 | 37 36 | def foo3(x, y, z): - Run `ruff check --fix` to apply this fix. - RET508.py:44:13: RET508 [*] Unnecessary `else` after `break` statement | 42 | b = 2 @@ -90,8 +84,6 @@ RET508.py:44:13: RET508 [*] Unnecessary `else` after `break` statement 48 47 | d = 4 49 48 | break - Run `ruff check --fix` to apply this fix. - RET508.py:60:9: RET508 [*] Unnecessary `else` after `break` statement | 58 | b = 2 @@ -113,8 +105,6 @@ RET508.py:60:9: RET508 [*] Unnecessary `else` after `break` statement 63 62 | 64 63 | - Run `ruff check --fix` to apply this fix. - RET508.py:71:13: RET508 [*] Unnecessary `else` after `break` statement | 69 | a = 4 @@ -136,8 +126,6 @@ RET508.py:71:13: RET508 [*] Unnecessary `else` after `break` statement 74 73 | c = 3 75 74 | break - Run `ruff check --fix` to apply this fix. - RET508.py:82:9: RET508 [*] Unnecessary `else` after `break` statement | 80 | if x: # [no-else-break] @@ -165,8 +153,6 @@ RET508.py:82:9: RET508 [*] Unnecessary `else` after `break` statement 88 87 | 89 88 | ### - Run `ruff check --fix` to apply this fix. - RET508.py:158:13: RET508 [*] Unnecessary `else` after `break` statement | 156 | if i > w: @@ -183,5 +169,3 @@ RET508.py:158:13: RET508 [*] Unnecessary `else` after `break` statement 158 |- else: 159 |- a = z 158 |+ a = z - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM114_SIM114.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM114_SIM114.py.snap index 595c252b42485..05d1857f40d93 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM114_SIM114.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM114_SIM114.py.snap @@ -23,8 +23,6 @@ SIM114.py:2:1: SIM114 [*] Combine `if` branches using logical `or` operator 6 4 | 7 5 | if a: # we preserve comments, too! - Run `ruff check --fix` to apply this fix. - SIM114.py:7:1: SIM114 [*] Combine `if` branches using logical `or` operator | 5 | b @@ -50,8 +48,6 @@ SIM114.py:7:1: SIM114 [*] Combine `if` branches using logical `or` operator 11 9 | 12 10 | if x == 1: - Run `ruff check --fix` to apply this fix. - SIM114.py:12:1: SIM114 [*] Combine `if` branches using logical `or` operator | 10 | b @@ -80,8 +76,6 @@ SIM114.py:12:1: SIM114 [*] Combine `if` branches using logical `or` operator 17 14 | print("hello") 18 15 | - Run `ruff check --fix` to apply this fix. - SIM114.py:19:1: SIM114 [*] Combine `if` branches using logical `or` operator | 17 | print("hello") @@ -113,8 +107,6 @@ SIM114.py:19:1: SIM114 [*] Combine `if` branches using logical `or` operator 25 21 | for _ in range(20): 26 22 | print("hello") - Run `ruff check --fix` to apply this fix. - SIM114.py:28:1: SIM114 [*] Combine `if` branches using logical `or` operator | 26 | print("hello") @@ -155,8 +147,6 @@ SIM114.py:28:1: SIM114 [*] Combine `if` branches using logical `or` operator 37 30 | for _ in range(20): 38 31 | print("hello") - Run `ruff check --fix` to apply this fix. - SIM114.py:29:5: SIM114 [*] Combine `if` branches using logical `or` operator | 28 | if x == 1: @@ -185,8 +175,6 @@ SIM114.py:29:5: SIM114 [*] Combine `if` branches using logical `or` operator 34 31 | print("hello") 35 32 | elif x == 2: - Run `ruff check --fix` to apply this fix. - SIM114.py:36:5: SIM114 [*] Combine `if` branches using logical `or` operator | 34 | print("hello") @@ -216,8 +204,6 @@ SIM114.py:36:5: SIM114 [*] Combine `if` branches using logical `or` operator 41 38 | print("hello") 42 39 | - Run `ruff check --fix` to apply this fix. - SIM114.py:43:1: SIM114 [*] Combine `if` branches using logical `or` operator | 41 | print("hello") @@ -258,8 +244,6 @@ SIM114.py:43:1: SIM114 [*] Combine `if` branches using logical `or` operator 62 60 | 63 61 | if result.eofs == "O": - Run `ruff check --fix` to apply this fix. - SIM114.py:67:1: SIM114 [*] Combine `if` branches using logical `or` operator | 65 | elif result.eofs == "S": @@ -285,8 +269,6 @@ SIM114.py:67:1: SIM114 [*] Combine `if` branches using logical `or` operator 71 69 | elif result.eofs == "X": 72 70 | errors = 1 - Run `ruff check --fix` to apply this fix. - SIM114.py:69:1: SIM114 [*] Combine `if` branches using logical `or` operator | 67 | elif result.eofs == "F": @@ -312,8 +294,6 @@ SIM114.py:69:1: SIM114 [*] Combine `if` branches using logical `or` operator 73 71 | elif result.eofs == "C": 74 72 | errors = 1 - Run `ruff check --fix` to apply this fix. - SIM114.py:71:1: SIM114 [*] Combine `if` branches using logical `or` operator | 69 | elif result.eofs == "E": @@ -337,8 +317,6 @@ SIM114.py:71:1: SIM114 [*] Combine `if` branches using logical `or` operator 75 73 | 76 74 | - Run `ruff check --fix` to apply this fix. - SIM114.py:118:5: SIM114 [*] Combine `if` branches using logical `or` operator | 116 | a = True @@ -365,8 +343,6 @@ SIM114.py:118:5: SIM114 [*] Combine `if` branches using logical `or` operator 122 120 | elif a < b: # end-of-line 123 121 | return 4 - Run `ruff check --fix` to apply this fix. - SIM114.py:122:5: SIM114 [*] Combine `if` branches using logical `or` operator | 120 | elif a == b: @@ -391,8 +367,6 @@ SIM114.py:122:5: SIM114 [*] Combine `if` branches using logical `or` operator 126 124 | 127 125 | - Run `ruff check --fix` to apply this fix. - SIM114.py:132:5: SIM114 [*] Combine `if` branches using logical `or` operator | 130 | a = True @@ -417,8 +391,6 @@ SIM114.py:132:5: SIM114 [*] Combine `if` branches using logical `or` operator 136 134 | 137 135 | - Run `ruff check --fix` to apply this fix. - SIM114.py:138:1: SIM114 [*] Combine `if` branches using logical `or` operator | 138 | / if a: # we preserve comments, too! @@ -440,8 +412,6 @@ SIM114.py:138:1: SIM114 [*] Combine `if` branches using logical `or` operator 142 140 | 143 141 | - Run `ruff check --fix` to apply this fix. - SIM114.py:144:1: SIM114 [*] Combine `if` branches using logical `or` operator | 144 | / if a: b # here's a comment @@ -460,8 +430,6 @@ SIM114.py:144:1: SIM114 [*] Combine `if` branches using logical `or` operator 147 146 | 148 147 | if(x > 200): pass - Run `ruff check --fix` to apply this fix. - SIM114.py:148:1: SIM114 [*] Combine `if` branches using logical `or` operator | 148 | / if(x > 200): pass @@ -478,5 +446,3 @@ SIM114.py:148:1: SIM114 [*] Combine `if` branches using logical `or` operator 149 |-elif(100 < x and x < 200 and 300 < y and y < 800): 150 |- pass 148 |+if(x > 200) or (100 < x and x < 200 and 300 < y and y < 800): pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap index f162920fc664b..a227662d2142a 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap @@ -20,8 +20,6 @@ SIM118.py:3:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 5 5 | key not in obj.keys() # SIM118 6 6 | - Run `ruff check --fix` to apply this fix. - SIM118.py:5:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` | 3 | key in obj.keys() # SIM118 @@ -42,8 +40,6 @@ SIM118.py:5:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys 7 7 | foo["bar"] in obj.keys() # SIM118 8 8 | - Run `ruff check --fix` to apply this fix. - SIM118.py:7:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 5 | key not in obj.keys() # SIM118 @@ -64,8 +60,6 @@ SIM118.py:7:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 9 9 | foo["bar"] not in obj.keys() # SIM118 10 10 | - Run `ruff check --fix` to apply this fix. - SIM118.py:9:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` | 7 | foo["bar"] in obj.keys() # SIM118 @@ -86,8 +80,6 @@ SIM118.py:9:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys 11 11 | foo['bar'] in obj.keys() # SIM118 12 12 | - Run `ruff check --fix` to apply this fix. - SIM118.py:11:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 9 | foo["bar"] not in obj.keys() # SIM118 @@ -108,8 +100,6 @@ SIM118.py:11:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 13 13 | foo['bar'] not in obj.keys() # SIM118 14 14 | - Run `ruff check --fix` to apply this fix. - SIM118.py:13:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` | 11 | foo['bar'] in obj.keys() # SIM118 @@ -130,8 +120,6 @@ SIM118.py:13:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.key 15 15 | foo() in obj.keys() # SIM118 16 16 | - Run `ruff check --fix` to apply this fix. - SIM118.py:15:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 13 | foo['bar'] not in obj.keys() # SIM118 @@ -152,8 +140,6 @@ SIM118.py:15:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 17 17 | foo() not in obj.keys() # SIM118 18 18 | - Run `ruff check --fix` to apply this fix. - SIM118.py:17:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` | 15 | foo() in obj.keys() # SIM118 @@ -174,8 +160,6 @@ SIM118.py:17:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.key 19 19 | for key in obj.keys(): # SIM118 20 20 | pass - Run `ruff check --fix` to apply this fix. - SIM118.py:19:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 17 | foo() not in obj.keys() # SIM118 @@ -195,8 +179,6 @@ SIM118.py:19:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 21 21 | 22 22 | for key in list(obj.keys()): - Run `ruff check --fix` to apply this fix. - SIM118.py:26:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 24 | del obj[key] @@ -217,8 +199,6 @@ SIM118.py:26:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 28 28 | {k for k in obj.keys()} # SIM118 29 29 | - Run `ruff check --fix` to apply this fix. - SIM118.py:28:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 26 | [k for k in obj.keys()] # SIM118 @@ -239,8 +219,6 @@ SIM118.py:28:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 30 30 | {k: k for k in obj.keys()} # SIM118 31 31 | - Run `ruff check --fix` to apply this fix. - SIM118.py:30:11: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 28 | {k for k in obj.keys()} # SIM118 @@ -261,8 +239,6 @@ SIM118.py:30:11: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 32 32 | (k for k in obj.keys()) # SIM118 33 33 | - Run `ruff check --fix` to apply this fix. - SIM118.py:32:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 30 | {k: k for k in obj.keys()} # SIM118 @@ -283,8 +259,6 @@ SIM118.py:32:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 34 34 | key in (obj or {}).keys() # SIM118 35 35 | - Run `ruff check --fix` to apply this fix. - SIM118.py:34:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 32 | (k for k in obj.keys()) # SIM118 @@ -328,8 +302,6 @@ SIM118.py:50:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 52 52 | key in (obj.keys())and foo 53 53 | - Run `ruff check --fix` to apply this fix. - SIM118.py:51:2: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 49 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124 @@ -349,8 +321,6 @@ SIM118.py:51:2: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 53 53 | 54 54 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200 - Run `ruff check --fix` to apply this fix. - SIM118.py:52:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 50 | key in obj.keys()and foo @@ -371,8 +341,6 @@ SIM118.py:52:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 54 54 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200 55 55 | for key in ( - Run `ruff check --fix` to apply this fix. - SIM118.py:55:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 54 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200 @@ -401,5 +369,3 @@ SIM118.py:65:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 64 64 | d = SneakyDict() 65 |-key in d.keys() # SIM118 65 |+key in d # SIM118 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM201_SIM201.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM201_SIM201.py.snap index 0a21596fdac86..cf0079a7716b5 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM201_SIM201.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM201_SIM201.py.snap @@ -17,8 +17,6 @@ SIM201.py:2:4: SIM201 [*] Use `a != b` instead of `not a == b` 4 4 | 5 5 | # SIM201 - Run `ruff check --fix` to apply this fix. - SIM201.py:6:4: SIM201 [*] Use `a != b + c` instead of `not a == b + c` | 5 | # SIM201 @@ -37,8 +35,6 @@ SIM201.py:6:4: SIM201 [*] Use `a != b + c` instead of `not a == b + c` 8 8 | 9 9 | # SIM201 - Run `ruff check --fix` to apply this fix. - SIM201.py:10:4: SIM201 [*] Use `a + b != c` instead of `not a + b == c` | 9 | # SIM201 @@ -56,5 +52,3 @@ SIM201.py:10:4: SIM201 [*] Use `a + b != c` instead of `not a + b == c` 11 11 | pass 12 12 | 13 13 | # OK - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap index 5398388710202..9d74f2c101355 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap @@ -17,8 +17,6 @@ SIM202.py:2:4: SIM202 [*] Use `a == b` instead of `not a != b` 4 4 | 5 5 | # SIM202 - Run `ruff check --fix` to apply this fix. - SIM202.py:6:4: SIM202 [*] Use `a == b + c` instead of `not a != b + c` | 5 | # SIM202 @@ -37,8 +35,6 @@ SIM202.py:6:4: SIM202 [*] Use `a == b + c` instead of `not a != b + c` 8 8 | 9 9 | # SIM202 - Run `ruff check --fix` to apply this fix. - SIM202.py:10:4: SIM202 [*] Use `a + b == c` instead of `not a + b != c` | 9 | # SIM202 @@ -56,5 +52,3 @@ SIM202.py:10:4: SIM202 [*] Use `a + b == c` instead of `not a + b != c` 11 11 | pass 12 12 | 13 13 | # OK - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap index 51f9798a13ba4..7571197d0ae23 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap @@ -15,8 +15,6 @@ SIM208.py:1:4: SIM208 [*] Use `a` instead of `not (not a)` 3 3 | 4 4 | if not (not (a == b)): # SIM208 - Run `ruff check --fix` to apply this fix. - SIM208.py:4:4: SIM208 [*] Use `a == b` instead of `not (not a == b)` | 2 | pass @@ -36,8 +34,6 @@ SIM208.py:4:4: SIM208 [*] Use `a == b` instead of `not (not a == b)` 6 6 | 7 7 | if not a: # OK - Run `ruff check --fix` to apply this fix. - SIM208.py:16:5: SIM208 [*] Use `b` instead of `not (not b)` | 14 | pass @@ -58,8 +54,6 @@ SIM208.py:16:5: SIM208 [*] Use `b` instead of `not (not b)` 18 18 | f(not not a) # SIM208 19 19 | - Run `ruff check --fix` to apply this fix. - SIM208.py:18:3: SIM208 [*] Use `a` instead of `not (not a)` | 16 | a = not not b # SIM208 @@ -80,8 +74,6 @@ SIM208.py:18:3: SIM208 [*] Use `a` instead of `not (not a)` 20 20 | if 1 + (not (not a)): # SIM208 21 21 | pass - Run `ruff check --fix` to apply this fix. - SIM208.py:20:9: SIM208 [*] Use `a` instead of `not (not a)` | 18 | f(not not a) # SIM208 @@ -98,5 +90,3 @@ SIM208.py:20:9: SIM208 [*] Use `a` instead of `not (not a)` 20 |-if 1 + (not (not a)): # SIM208 20 |+if 1 + (bool(a)): # SIM208 21 21 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM300_SIM300.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM300_SIM300.py.snap index 79e6f69a51b4e..cf1b63ffdbfd7 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM300_SIM300.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM300_SIM300.py.snap @@ -18,8 +18,6 @@ SIM300.py:2:1: SIM300 [*] Yoda condition detected 4 4 | ("a", "b") == compare # SIM300 5 5 | "yoda" <= compare # SIM300 - Run `ruff check --fix` to apply this fix. - SIM300.py:3:1: SIM300 [*] Yoda condition detected | 1 | # Errors @@ -39,8 +37,6 @@ SIM300.py:3:1: SIM300 [*] Yoda condition detected 5 5 | "yoda" <= compare # SIM300 6 6 | "yoda" < compare # SIM300 - Run `ruff check --fix` to apply this fix. - SIM300.py:4:1: SIM300 [*] Yoda condition detected | 2 | "yoda" == compare # SIM300 @@ -61,8 +57,6 @@ SIM300.py:4:1: SIM300 [*] Yoda condition detected 6 6 | "yoda" < compare # SIM300 7 7 | 42 > age # SIM300 - Run `ruff check --fix` to apply this fix. - SIM300.py:5:1: SIM300 [*] Yoda condition detected | 3 | 42 == age # SIM300 @@ -83,8 +77,6 @@ SIM300.py:5:1: SIM300 [*] Yoda condition detected 7 7 | 42 > age # SIM300 8 8 | -42 > age # SIM300 - Run `ruff check --fix` to apply this fix. - SIM300.py:6:1: SIM300 [*] Yoda condition detected | 4 | ("a", "b") == compare # SIM300 @@ -105,8 +97,6 @@ SIM300.py:6:1: SIM300 [*] Yoda condition detected 8 8 | -42 > age # SIM300 9 9 | +42 > age # SIM300 - Run `ruff check --fix` to apply this fix. - SIM300.py:7:1: SIM300 [*] Yoda condition detected | 5 | "yoda" <= compare # SIM300 @@ -127,8 +117,6 @@ SIM300.py:7:1: SIM300 [*] Yoda condition detected 9 9 | +42 > age # SIM300 10 10 | YODA == age # SIM300 - Run `ruff check --fix` to apply this fix. - SIM300.py:8:1: SIM300 [*] Yoda condition detected | 6 | "yoda" < compare # SIM300 @@ -149,8 +137,6 @@ SIM300.py:8:1: SIM300 [*] Yoda condition detected 10 10 | YODA == age # SIM300 11 11 | YODA > age # SIM300 - Run `ruff check --fix` to apply this fix. - SIM300.py:9:1: SIM300 [*] Yoda condition detected | 7 | 42 > age # SIM300 @@ -171,8 +157,6 @@ SIM300.py:9:1: SIM300 [*] Yoda condition detected 11 11 | YODA > age # SIM300 12 12 | YODA >= age # SIM300 - Run `ruff check --fix` to apply this fix. - SIM300.py:10:1: SIM300 [*] Yoda condition detected | 8 | -42 > age # SIM300 @@ -193,8 +177,6 @@ SIM300.py:10:1: SIM300 [*] Yoda condition detected 12 12 | YODA >= age # SIM300 13 13 | JediOrder.YODA == age # SIM300 - Run `ruff check --fix` to apply this fix. - SIM300.py:11:1: SIM300 [*] Yoda condition detected | 9 | +42 > age # SIM300 @@ -215,8 +197,6 @@ SIM300.py:11:1: SIM300 [*] Yoda condition detected 13 13 | JediOrder.YODA == age # SIM300 14 14 | 0 < (number - 100) # SIM300 - Run `ruff check --fix` to apply this fix. - SIM300.py:12:1: SIM300 [*] Yoda condition detected | 10 | YODA == age # SIM300 @@ -237,8 +217,6 @@ SIM300.py:12:1: SIM300 [*] Yoda condition detected 14 14 | 0 < (number - 100) # SIM300 15 15 | B age # SIM300 @@ -259,8 +237,6 @@ SIM300.py:13:1: SIM300 [*] Yoda condition detected 15 15 | B= age # SIM300 @@ -281,8 +257,6 @@ SIM300.py:14:1: SIM300 [*] Yoda condition detected 16 16 | B or(B)).itemsize` instead. | 58 | np.NaN @@ -490,8 +462,6 @@ NPY201.py:62:5: NPY201 [*] `np.NINF` will be removed in NumPy 2.0. Use `-np.inf` 64 64 | np.NZERO 65 65 | - Run `ruff check --fix` to apply this fix. - NPY201.py:64:5: NPY201 [*] `np.NZERO` will be removed in NumPy 2.0. Use `-0.0` instead. | 62 | np.NINF @@ -512,8 +482,6 @@ NPY201.py:64:5: NPY201 [*] `np.NZERO` will be removed in NumPy 2.0. Use `-0.0` i 66 66 | np.longcomplex(12+34j) 67 67 | - Run `ruff check --fix` to apply this fix. - NPY201.py:66:5: NPY201 [*] `np.longcomplex` will be removed in NumPy 2.0. Use `numpy.clongdouble` instead. | 64 | np.NZERO @@ -534,8 +502,6 @@ NPY201.py:66:5: NPY201 [*] `np.longcomplex` will be removed in NumPy 2.0. Use `n 68 68 | np.longfloat(12+34j) 69 69 | - Run `ruff check --fix` to apply this fix. - NPY201.py:68:5: NPY201 [*] `np.longfloat` will be removed in NumPy 2.0. Use `numpy.longdouble` instead. | 66 | np.longcomplex(12+34j) @@ -556,8 +522,6 @@ NPY201.py:68:5: NPY201 [*] `np.longfloat` will be removed in NumPy 2.0. Use `num 70 70 | np.lookfor 71 71 | - Run `ruff check --fix` to apply this fix. - NPY201.py:70:5: NPY201 `np.lookfor` will be removed in NumPy 2.0. Search NumPy’s documentation directly. | 68 | np.longfloat(12+34j) @@ -587,5 +551,3 @@ NPY201.py:72:5: NPY201 [*] `np.NAN` will be removed in NumPy 2.0. Use `numpy.nan 73 73 | 74 74 | try: 75 75 | from numpy.lib.npyio import DataSource - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap index c7764254e5930..15cf8189c1e22 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_2.py.snap @@ -31,8 +31,6 @@ NPY201_2.py:6:5: NPY201 [*] `np.PINF` will be removed in NumPy 2.0. Use `numpy.i 8 8 | np.PZERO 9 9 | - Run `ruff check --fix` to apply this fix. - NPY201_2.py:8:5: NPY201 [*] `np.PZERO` will be removed in NumPy 2.0. Use `0.0` instead. | 6 | np.PINF @@ -53,8 +51,6 @@ NPY201_2.py:8:5: NPY201 [*] `np.PZERO` will be removed in NumPy 2.0. Use `0.0` i 10 10 | np.recfromcsv 11 11 | - Run `ruff check --fix` to apply this fix. - NPY201_2.py:10:5: NPY201 `np.recfromcsv` will be removed in NumPy 2.0. Use `np.genfromtxt` with comma delimiter instead. | 8 | np.PZERO @@ -95,8 +91,6 @@ NPY201_2.py:14:5: NPY201 [*] `np.round_` will be removed in NumPy 2.0. Use `nump 16 16 | np.safe_eval 17 17 | - Run `ruff check --fix` to apply this fix. - NPY201_2.py:16:5: NPY201 [*] `np.safe_eval` will be removed in NumPy 2.0. Use `ast.literal_eval` instead. | 14 | np.round_(12.34) @@ -122,8 +116,6 @@ NPY201_2.py:16:5: NPY201 [*] `np.safe_eval` will be removed in NumPy 2.0. Use `a 18 19 | np.sctype2char 19 20 | - Run `ruff check --fix` to apply this fix. - NPY201_2.py:18:5: NPY201 `np.sctype2char` will be removed without replacement in NumPy 2.0 | 16 | np.safe_eval @@ -184,8 +176,6 @@ NPY201_2.py:28:5: NPY201 [*] `np.singlecomplex` will be removed in NumPy 2.0. Us 30 30 | np.string_("asdf") 31 31 | - Run `ruff check --fix` to apply this fix. - NPY201_2.py:30:5: NPY201 [*] `np.string_` will be removed in NumPy 2.0. Use `numpy.bytes_` instead. | 28 | np.singlecomplex(12+1j) @@ -206,8 +196,6 @@ NPY201_2.py:30:5: NPY201 [*] `np.string_` will be removed in NumPy 2.0. Use `num 32 32 | np.source 33 33 | - Run `ruff check --fix` to apply this fix. - NPY201_2.py:32:5: NPY201 [*] `np.source` will be removed in NumPy 2.0. Use `inspect.getsource` instead. | 30 | np.string_("asdf") @@ -233,8 +221,6 @@ NPY201_2.py:32:5: NPY201 [*] `np.source` will be removed in NumPy 2.0. Use `insp 34 35 | np.tracemalloc_domain 35 36 | - Run `ruff check --fix` to apply this fix. - NPY201_2.py:34:5: NPY201 [*] `np.tracemalloc_domain` will be removed in NumPy 2.0. Use `numpy.lib.tracemalloc_domain` instead. | 32 | np.source @@ -260,8 +246,6 @@ NPY201_2.py:34:5: NPY201 [*] `np.tracemalloc_domain` will be removed in NumPy 2. 36 37 | np.unicode_("asf") 37 38 | - Run `ruff check --fix` to apply this fix. - NPY201_2.py:36:5: NPY201 [*] `np.unicode_` will be removed in NumPy 2.0. Use `numpy.str_` instead. | 34 | np.tracemalloc_domain @@ -282,8 +266,6 @@ NPY201_2.py:36:5: NPY201 [*] `np.unicode_` will be removed in NumPy 2.0. Use `nu 38 38 | np.who() 39 39 | - Run `ruff check --fix` to apply this fix. - NPY201_2.py:38:5: NPY201 `np.who` will be removed in NumPy 2.0. Use an IDE variable explorer or `locals()` instead. | 36 | np.unicode_("asf") @@ -314,8 +296,6 @@ NPY201_2.py:40:5: NPY201 [*] `np.row_stack` will be removed in NumPy 2.0. Use `n 42 42 | np.alltrue([True, True]) 43 43 | - Run `ruff check --fix` to apply this fix. - NPY201_2.py:42:5: NPY201 [*] `np.alltrue` will be removed in NumPy 2.0. Use `numpy.all` instead. | 40 | np.row_stack(([1,2], [3,4])) @@ -336,8 +316,6 @@ NPY201_2.py:42:5: NPY201 [*] `np.alltrue` will be removed in NumPy 2.0. Use `num 44 44 | np.sometrue([True, False]) 45 45 | - Run `ruff check --fix` to apply this fix. - NPY201_2.py:44:5: NPY201 [*] `np.sometrue` will be removed in NumPy 2.0. Use `numpy.any` instead. | 42 | np.alltrue([True, True]) @@ -358,8 +336,6 @@ NPY201_2.py:44:5: NPY201 [*] `np.sometrue` will be removed in NumPy 2.0. Use `nu 46 46 | np.cumproduct([1, 2, 3]) 47 47 | - Run `ruff check --fix` to apply this fix. - NPY201_2.py:46:5: NPY201 [*] `np.cumproduct` will be removed in NumPy 2.0. Use `numpy.cumprod` instead. | 44 | np.sometrue([True, False]) @@ -380,8 +356,6 @@ NPY201_2.py:46:5: NPY201 [*] `np.cumproduct` will be removed in NumPy 2.0. Use ` 48 48 | np.product([1, 2, 3]) 49 49 | - Run `ruff check --fix` to apply this fix. - NPY201_2.py:48:5: NPY201 [*] `np.product` will be removed in NumPy 2.0. Use `numpy.prod` instead. | 46 | np.cumproduct([1, 2, 3]) @@ -402,8 +376,6 @@ NPY201_2.py:48:5: NPY201 [*] `np.product` will be removed in NumPy 2.0. Use `num 50 50 | np.trapz([1, 2, 3]) 51 51 | - Run `ruff check --fix` to apply this fix. - NPY201_2.py:50:5: NPY201 [*] `np.trapz` will be removed in NumPy 2.0. Use `numpy.trapezoid` on NumPy 2.0, or ignore this warning on earlier versions. | 48 | np.product([1, 2, 3]) @@ -436,8 +408,6 @@ NPY201_2.py:52:5: NPY201 [*] `np.in1d` will be removed in NumPy 2.0. Use `numpy. 54 54 | np.AxisError 55 55 | - Run `ruff check --fix` to apply this fix. - NPY201_2.py:54:5: NPY201 [*] `np.AxisError` will be removed in NumPy 2.0. Use `numpy.exceptions.AxisError` instead. | 52 | np.in1d([1, 2], [1, 3, 5]) @@ -463,8 +433,6 @@ NPY201_2.py:54:5: NPY201 [*] `np.AxisError` will be removed in NumPy 2.0. Use `n 56 57 | np.ComplexWarning 57 58 | - Run `ruff check --fix` to apply this fix. - NPY201_2.py:56:5: NPY201 [*] `np.ComplexWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.ComplexWarning` instead. | 54 | np.AxisError @@ -490,8 +458,6 @@ NPY201_2.py:56:5: NPY201 [*] `np.ComplexWarning` will be removed in NumPy 2.0. U 58 59 | np.compare_chararrays 59 60 | - Run `ruff check --fix` to apply this fix. - NPY201_2.py:58:5: NPY201 [*] `np.compare_chararrays` will be removed in NumPy 2.0. Use `numpy.char.compare_chararrays` instead. | 56 | np.ComplexWarning @@ -517,8 +483,6 @@ NPY201_2.py:58:5: NPY201 [*] `np.compare_chararrays` will be removed in NumPy 2. 60 61 | try: 61 62 | np.all([True, True]) - Run `ruff check --fix` to apply this fix. - NPY201_2.py:63:9: NPY201 [*] `np.alltrue` will be removed in NumPy 2.0. Use `numpy.all` instead. | 61 | np.all([True, True]) @@ -539,8 +503,6 @@ NPY201_2.py:63:9: NPY201 [*] `np.alltrue` will be removed in NumPy 2.0. Use `num 65 65 | try: 66 66 | np.anyyyy([True, True]) - Run `ruff check --fix` to apply this fix. - NPY201_2.py:68:9: NPY201 [*] `np.sometrue` will be removed in NumPy 2.0. Use `numpy.any` instead. | 66 | np.anyyyy([True, True]) @@ -559,5 +521,3 @@ NPY201_2.py:68:9: NPY201 [*] `np.sometrue` will be removed in NumPy 2.0. Use `nu 69 69 | # (must have an attribute access of the undeprecated name in the `try` body for it to be ignored) 70 70 | 71 71 | try: - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap index fdc16d0f7a721..d9bd7191b1dc3 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy2-deprecation_NPY201_3.py.snap @@ -22,8 +22,6 @@ NPY201_3.py:4:5: NPY201 [*] `np.DTypePromotionError` will be removed in NumPy 2. 6 7 | np.ModuleDeprecationWarning 7 8 | - Run `ruff check --fix` to apply this fix. - NPY201_3.py:6:5: NPY201 [*] `np.ModuleDeprecationWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.ModuleDeprecationWarning` instead. | 4 | np.DTypePromotionError @@ -47,8 +45,6 @@ NPY201_3.py:6:5: NPY201 [*] `np.ModuleDeprecationWarning` will be removed in Num 8 9 | np.RankWarning 9 10 | - Run `ruff check --fix` to apply this fix. - NPY201_3.py:8:5: NPY201 [*] `np.RankWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.RankWarning` on NumPy 2.0, or ignore this warning on earlier versions. | 6 | np.ModuleDeprecationWarning @@ -86,8 +82,6 @@ NPY201_3.py:10:5: NPY201 [*] `np.TooHardError` will be removed in NumPy 2.0. Use 12 13 | np.VisibleDeprecationWarning 13 14 | - Run `ruff check --fix` to apply this fix. - NPY201_3.py:12:5: NPY201 [*] `np.VisibleDeprecationWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.VisibleDeprecationWarning` instead. | 10 | np.TooHardError @@ -113,8 +107,6 @@ NPY201_3.py:12:5: NPY201 [*] `np.VisibleDeprecationWarning` will be removed in N 14 15 | np.chararray 15 16 | - Run `ruff check --fix` to apply this fix. - NPY201_3.py:14:5: NPY201 [*] `np.chararray` will be removed in NumPy 2.0. Use `numpy.char.chararray` instead. | 12 | np.VisibleDeprecationWarning @@ -139,8 +131,6 @@ NPY201_3.py:14:5: NPY201 [*] `np.chararray` will be removed in NumPy 2.0. Use `n 15 16 | 16 17 | np.format_parser - Run `ruff check --fix` to apply this fix. - NPY201_3.py:16:5: NPY201 [*] `np.format_parser` will be removed in NumPy 2.0. Use `numpy.rec.format_parser` instead. | 14 | np.chararray @@ -160,5 +150,3 @@ NPY201_3.py:16:5: NPY201 [*] `np.format_parser` will be removed in NumPy 2.0. Us 15 16 | 16 |- np.format_parser 17 |+ format_parser - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF101_PERF101.py.snap b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF101_PERF101.py.snap index 6dd5fdffd946f..5335ea781f005 100644 --- a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF101_PERF101.py.snap +++ b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF101_PERF101.py.snap @@ -20,8 +20,6 @@ PERF101.py:7:10: PERF101 [*] Do not cast an iterable to `list` before iterating 9 9 | 10 10 | for i in list(foo_list): # PERF101 - Run `ruff check --fix` to apply this fix. - PERF101.py:10:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 8 | pass @@ -41,8 +39,6 @@ PERF101.py:10:10: PERF101 [*] Do not cast an iterable to `list` before iterating 12 12 | 13 13 | for i in list(foo_set): # PERF101 - Run `ruff check --fix` to apply this fix. - PERF101.py:13:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 11 | pass @@ -62,8 +58,6 @@ PERF101.py:13:10: PERF101 [*] Do not cast an iterable to `list` before iterating 15 15 | 16 16 | for i in list((1, 2, 3)): # PERF101 - Run `ruff check --fix` to apply this fix. - PERF101.py:16:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 14 | pass @@ -83,8 +77,6 @@ PERF101.py:16:10: PERF101 [*] Do not cast an iterable to `list` before iterating 18 18 | 19 19 | for i in list([1, 2, 3]): # PERF101 - Run `ruff check --fix` to apply this fix. - PERF101.py:19:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 17 | pass @@ -104,8 +96,6 @@ PERF101.py:19:10: PERF101 [*] Do not cast an iterable to `list` before iterating 21 21 | 22 22 | for i in list({1, 2, 3}): # PERF101 - Run `ruff check --fix` to apply this fix. - PERF101.py:22:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 20 | pass @@ -125,8 +115,6 @@ PERF101.py:22:10: PERF101 [*] Do not cast an iterable to `list` before iterating 24 24 | 25 25 | for i in list( - Run `ruff check --fix` to apply this fix. - PERF101.py:25:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 23 | pass @@ -160,8 +148,6 @@ PERF101.py:25:10: PERF101 [*] Do not cast an iterable to `list` before iterating 33 31 | 34 32 | for i in list( # Comment - Run `ruff check --fix` to apply this fix. - PERF101.py:34:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 32 | pass @@ -186,8 +172,6 @@ PERF101.py:34:10: PERF101 [*] Do not cast an iterable to `list` before iterating 38 36 | 39 37 | for i in list(foo_dict): # OK - Run `ruff check --fix` to apply this fix. - PERF101.py:57:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 55 | foo_list.append(i + 1) @@ -208,8 +192,6 @@ PERF101.py:57:10: PERF101 [*] Do not cast an iterable to `list` before iterating 59 59 | other_list.append(i + 1) 60 60 | - Run `ruff check --fix` to apply this fix. - PERF101.py:69:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 67 | x, y, nested_tuple = (1, 2, (3, 4, 5)) @@ -229,8 +211,6 @@ PERF101.py:69:10: PERF101 [*] Do not cast an iterable to `list` before iterating 71 71 | 72 72 | for i in list(foo_list): # OK - Run `ruff check --fix` to apply this fix. - PERF101.py:86:10: PERF101 [*] Do not cast an iterable to `list` before iterating over it | 84 | import builtins @@ -247,5 +227,3 @@ PERF101.py:86:10: PERF101 [*] Do not cast an iterable to `list` before iterating 86 |-for i in builtins.list(nested_tuple): # PERF101 86 |+for i in nested_tuple: # PERF101 87 87 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E201_E20.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E201_E20.py.snap index 9700d7cdb8d72..9d839f41a5244 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E201_E20.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E201_E20.py.snap @@ -18,8 +18,6 @@ E20.py:2:6: E201 [*] Whitespace after '(' 4 4 | spam(ham[ 1], {eggs: 2}) 5 5 | #: E201:1:15 - Run `ruff check --fix` to apply this fix. - E20.py:4:10: E201 [*] Whitespace after '[' | 2 | spam( ham[1], {eggs: 2}) @@ -40,8 +38,6 @@ E20.py:4:10: E201 [*] Whitespace after '[' 6 6 | spam(ham[1], { eggs: 2}) 7 7 | #: E201:1:6 - Run `ruff check --fix` to apply this fix. - E20.py:6:15: E201 [*] Whitespace after '{' | 4 | spam(ham[ 1], {eggs: 2}) @@ -62,8 +58,6 @@ E20.py:6:15: E201 [*] Whitespace after '{' 8 8 | spam( ham[1], {eggs: 2}) 9 9 | #: E201:1:10 - Run `ruff check --fix` to apply this fix. - E20.py:8:6: E201 [*] Whitespace after '(' | 6 | spam(ham[1], { eggs: 2}) @@ -84,8 +78,6 @@ E20.py:8:6: E201 [*] Whitespace after '(' 10 10 | spam(ham[ 1], {eggs: 2}) 11 11 | #: E201:1:15 - Run `ruff check --fix` to apply this fix. - E20.py:10:10: E201 [*] Whitespace after '[' | 8 | spam( ham[1], {eggs: 2}) @@ -106,8 +98,6 @@ E20.py:10:10: E201 [*] Whitespace after '[' 12 12 | spam(ham[1], { eggs: 2}) 13 13 | #: Okay - Run `ruff check --fix` to apply this fix. - E20.py:12:15: E201 [*] Whitespace after '{' | 10 | spam(ham[ 1], {eggs: 2}) @@ -128,8 +118,6 @@ E20.py:12:15: E201 [*] Whitespace after '{' 14 14 | spam(ham[1], {eggs: 2}) 15 15 | #: - Run `ruff check --fix` to apply this fix. - E20.py:107:6: E201 [*] Whitespace after '[' | 106 | #: E201:1:6 @@ -149,8 +137,6 @@ E20.py:107:6: E201 [*] Whitespace after '[' 109 109 | #: Okay 110 110 | x = [ # - Run `ruff check --fix` to apply this fix. - E20.py:116:5: E201 [*] Whitespace after '[' | 114 | # F-strings @@ -170,8 +156,6 @@ E20.py:116:5: E201 [*] Whitespace after '[' 118 118 | 119 119 | #: Okay - Run `ruff check --fix` to apply this fix. - E20.py:145:5: E201 [*] Whitespace after '[' | 144 | #: E201:1:5 @@ -190,5 +174,3 @@ E20.py:145:5: E201 [*] Whitespace after '[' 146 146 | 147 147 | #: Okay 148 148 | ham[lower + offset :: upper + offset] - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E202_E20.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E202_E20.py.snap index dad6f07ae339f..aee5ecbbeb364 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E202_E20.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E202_E20.py.snap @@ -20,8 +20,6 @@ E20.py:19:23: E202 [*] Whitespace before ')' 21 21 | spam(ham[1], {eggs: 2 }) 22 22 | #: E202:1:11 - Run `ruff check --fix` to apply this fix. - E20.py:21:22: E202 [*] Whitespace before '}' | 19 | spam(ham[1], {eggs: 2} ) @@ -42,8 +40,6 @@ E20.py:21:22: E202 [*] Whitespace before '}' 23 23 | spam(ham[1 ], {eggs: 2}) 24 24 | #: E202:1:23 - Run `ruff check --fix` to apply this fix. - E20.py:23:11: E202 [*] Whitespace before ']' | 21 | spam(ham[1], {eggs: 2 }) @@ -64,8 +60,6 @@ E20.py:23:11: E202 [*] Whitespace before ']' 25 25 | spam(ham[1], {eggs: 2} ) 26 26 | #: E202:1:22 - Run `ruff check --fix` to apply this fix. - E20.py:25:23: E202 [*] Whitespace before ')' | 23 | spam(ham[1 ], {eggs: 2}) @@ -86,8 +80,6 @@ E20.py:25:23: E202 [*] Whitespace before ')' 27 27 | spam(ham[1], {eggs: 2 }) 28 28 | #: E202:1:11 - Run `ruff check --fix` to apply this fix. - E20.py:27:22: E202 [*] Whitespace before '}' | 25 | spam(ham[1], {eggs: 2} ) @@ -108,8 +100,6 @@ E20.py:27:22: E202 [*] Whitespace before '}' 29 29 | spam(ham[1 ], {eggs: 2}) 30 30 | #: Okay - Run `ruff check --fix` to apply this fix. - E20.py:29:11: E202 [*] Whitespace before ']' | 27 | spam(ham[1], {eggs: 2 }) @@ -130,8 +120,6 @@ E20.py:29:11: E202 [*] Whitespace before ']' 31 31 | spam(ham[1], {eggs: 2}) 32 32 | - Run `ruff check --fix` to apply this fix. - E20.py:116:18: E202 [*] Whitespace before ']' | 114 | # F-strings @@ -151,8 +139,6 @@ E20.py:116:18: E202 [*] Whitespace before ']' 118 118 | 119 119 | #: Okay - Run `ruff check --fix` to apply this fix. - E20.py:172:12: E202 [*] Whitespace before ']' | 171 | #: E202:1:12 @@ -171,5 +157,3 @@ E20.py:172:12: E202 [*] Whitespace before ']' 173 173 | 174 174 | #: E203:1:10 175 175 | ham[upper :] - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E203_E20.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E203_E20.py.snap index 492ae2252b06d..80efcd4c1b457 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E203_E20.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E203_E20.py.snap @@ -20,8 +20,6 @@ E20.py:51:10: E203 [*] Whitespace before ':' 53 53 | x, y = y, x 54 54 | #: E203:1:10 - Run `ruff check --fix` to apply this fix. - E20.py:55:10: E203 [*] Whitespace before ':' | 53 | x, y = y, x @@ -42,8 +40,6 @@ E20.py:55:10: E203 [*] Whitespace before ':' 57 57 | x, y = y, x 58 58 | #: E203:2:15 E702:2:16 - Run `ruff check --fix` to apply this fix. - E20.py:60:16: E203 [*] Whitespace before ';' | 58 | #: E203:2:15 E702:2:16 @@ -64,8 +60,6 @@ E20.py:60:16: E203 [*] Whitespace before ';' 62 62 | if x == 4: 63 63 | print(x, y) ; x, y = y, x - Run `ruff check --fix` to apply this fix. - E20.py:63:16: E203 [*] Whitespace before ';' | 61 | #: E203:2:15 E702:2:16 @@ -86,8 +80,6 @@ E20.py:63:16: E203 [*] Whitespace before ';' 65 65 | if x == 4: 66 66 | print(x, y) - Run `ruff check --fix` to apply this fix. - E20.py:67:13: E203 [*] Whitespace before ',' | 65 | if x == 4: @@ -108,8 +100,6 @@ E20.py:67:13: E203 [*] Whitespace before ',' 69 69 | if x == 4: 70 70 | print(x, y) - Run `ruff check --fix` to apply this fix. - E20.py:71:13: E203 [*] Whitespace before ',' | 69 | if x == 4: @@ -130,8 +120,6 @@ E20.py:71:13: E203 [*] Whitespace before ',' 73 73 | if x == 4: 74 74 | print(x, y) - Run `ruff check --fix` to apply this fix. - E20.py:86:61: E203 [*] Whitespace before ':' | 84 | #: E203 multi whitespace before : @@ -151,8 +139,6 @@ E20.py:86:61: E203 [*] Whitespace before ':' 88 88 | 89 89 | #: E203 tab before : - Run `ruff check --fix` to apply this fix. - E20.py:91:61: E203 [*] Whitespace before ':' | 89 | #: E203 tab before : @@ -172,8 +158,6 @@ E20.py:91:61: E203 [*] Whitespace before ':' 93 93 | 94 94 | #: E203 single whitespace before : with line a comment - Run `ruff check --fix` to apply this fix. - E20.py:101:61: E203 [*] Whitespace before ':' | 99 | #: E203 multi whitespace before : with line a comment @@ -193,8 +177,6 @@ E20.py:101:61: E203 [*] Whitespace before ':' 103 103 | 104 104 | #: - Run `ruff check --fix` to apply this fix. - E20.py:126:16: E203 [*] Whitespace before ':' | 125 | #: E203:1:19 @@ -214,8 +196,6 @@ E20.py:126:16: E203 [*] Whitespace before ':' 128 128 | #: E203:1:19 129 129 | ham[lower + offset : upper + offset] - Run `ruff check --fix` to apply this fix. - E20.py:129:19: E203 [*] Whitespace before ':' | 128 | #: E203:1:19 @@ -235,8 +215,6 @@ E20.py:129:19: E203 [*] Whitespace before ':' 131 131 | #: Okay 132 132 | release_lines = history_file_lines[history_file_lines.index('## Unreleased') + 1: -1] - Run `ruff check --fix` to apply this fix. - E20.py:157:21: E203 [*] Whitespace before ':' | 156 | #: E203:1:21 @@ -256,8 +234,6 @@ E20.py:157:21: E203 [*] Whitespace before ':' 159 159 | #: E203:1:20 160 160 | ham[lower + offset: :upper + offset] - Run `ruff check --fix` to apply this fix. - E20.py:160:20: E203 [*] Whitespace before ':' | 159 | #: E203:1:20 @@ -277,8 +253,6 @@ E20.py:160:20: E203 [*] Whitespace before ':' 162 162 | #: E203:1:20 163 163 | ham[{lower + offset : upper + offset} : upper + offset] - Run `ruff check --fix` to apply this fix. - E20.py:163:20: E203 [*] Whitespace before ':' | 162 | #: E203:1:20 @@ -298,8 +272,6 @@ E20.py:163:20: E203 [*] Whitespace before ':' 165 165 | #: Okay 166 166 | ham[upper:] - Run `ruff check --fix` to apply this fix. - E20.py:175:10: E203 [*] Whitespace before ':' | 174 | #: E203:1:10 @@ -319,8 +291,6 @@ E20.py:175:10: E203 [*] Whitespace before ':' 177 177 | #: Okay 178 178 | ham[lower +1 :, "columnname"] - Run `ruff check --fix` to apply this fix. - E20.py:181:14: E203 [*] Whitespace before ':' | 180 | #: E203:1:13 @@ -340,8 +310,6 @@ E20.py:181:14: E203 [*] Whitespace before ':' 183 183 | #: Okay 184 184 | f"{ham[lower +1 :, "columnname"]}" - Run `ruff check --fix` to apply this fix. - E20.py:187:17: E203 [*] Whitespace before ':' | 186 | #: E203:1:13 @@ -360,5 +328,3 @@ E20.py:187:17: E203 [*] Whitespace before ':' 188 188 | 189 189 | #: Okay: https://github.com/astral-sh/ruff/issues/12023 190 190 | f"{x = :.2f}" - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E204_E204.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E204_E204.py.snap index 129187c355566..47831346a488b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E204_E204.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E204_E204.py.snap @@ -20,8 +20,6 @@ E204.py:14:2: E204 [*] Whitespace after decorator 16 16 | print('baz') 17 17 | - Run `ruff check --fix` to apply this fix. - E204.py:25:6: E204 [*] Whitespace after decorator | 24 | # E204 @@ -41,8 +39,6 @@ E204.py:25:6: E204 [*] Whitespace after decorator 27 27 | print('baz') 28 28 | - Run `ruff check --fix` to apply this fix. - E204.py:31:2: E204 [*] Whitespace after decorator | 30 | # E204 @@ -63,5 +59,3 @@ E204.py:31:2: E204 [*] Whitespace after decorator 31 |+@foo 33 32 | def baz(): 34 33 | print('baz') - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E211_E21.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E211_E21.py.snap index d5022d3d58a0f..5789f176b07e4 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E211_E21.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E211_E21.py.snap @@ -18,8 +18,6 @@ E21.py:2:5: E211 [*] Whitespace before '(' 4 4 | dict ['key'] = list [index] 5 5 | #: E211 - Run `ruff check --fix` to apply this fix. - E21.py:4:5: E211 [*] Whitespace before '[' | 2 | spam (1) @@ -40,8 +38,6 @@ E21.py:4:5: E211 [*] Whitespace before '[' 6 6 | dict['key'] ['subkey'] = list[index] 7 7 | #: Okay - Run `ruff check --fix` to apply this fix. - E21.py:4:20: E211 [*] Whitespace before '[' | 2 | spam (1) @@ -62,8 +58,6 @@ E21.py:4:20: E211 [*] Whitespace before '[' 6 6 | dict['key'] ['subkey'] = list[index] 7 7 | #: Okay - Run `ruff check --fix` to apply this fix. - E21.py:6:12: E211 [*] Whitespace before '[' | 4 | dict ['key'] = list [index] @@ -84,8 +78,6 @@ E21.py:6:12: E211 [*] Whitespace before '[' 8 8 | spam(1) 9 9 | dict['key'] = list[index] - Run `ruff check --fix` to apply this fix. - E21.py:17:15: E211 [*] Whitespace before '(' | 17 | def fetch_name () -> Union[str, None]: @@ -103,8 +95,6 @@ E21.py:17:15: E211 [*] Whitespace before '(' 19 19 | 20 20 | Returns: - Run `ruff check --fix` to apply this fix. - E21.py:27:19: E211 [*] Whitespace before '(' | 25 | # test commented code @@ -125,8 +115,6 @@ E21.py:27:19: E211 [*] Whitespace before '(' 29 29 | return sys.argv[i + 1] 30 30 | return None - Run `ruff check --fix` to apply this fix. - E21.py:27:27: E211 [*] Whitespace before '(' | 25 | # test commented code @@ -146,5 +134,3 @@ E21.py:27:27: E211 [*] Whitespace before '(' 28 28 | if sys.argv[i] == "--name" : 29 29 | return sys.argv[i + 1] 30 30 | return None - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E221_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E221_E22.py.snap index a671287930327..99c33816f80f5 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E221_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E221_E22.py.snap @@ -20,8 +20,6 @@ E22.py:3:6: E221 [*] Multiple spaces before operator 5 5 | x = 1 6 6 | y = 2 - Run `ruff check --fix` to apply this fix. - E22.py:5:2: E221 [*] Multiple spaces before operator | 3 | b = 4 + 5 @@ -42,8 +40,6 @@ E22.py:5:2: E221 [*] Multiple spaces before operator 7 7 | long_variable = 3 8 8 | #: E221 E221 - Run `ruff check --fix` to apply this fix. - E22.py:6:2: E221 [*] Multiple spaces before operator | 4 | #: E221 E221 @@ -64,8 +60,6 @@ E22.py:6:2: E221 [*] Multiple spaces before operator 8 8 | #: E221 E221 9 9 | x[0] = 1 - Run `ruff check --fix` to apply this fix. - E22.py:9:5: E221 [*] Multiple spaces before operator | 7 | long_variable = 3 @@ -86,8 +80,6 @@ E22.py:9:5: E221 [*] Multiple spaces before operator 11 11 | long_variable = 3 12 12 | #: E221 E221 - Run `ruff check --fix` to apply this fix. - E22.py:10:5: E221 [*] Multiple spaces before operator | 8 | #: E221 E221 @@ -108,8 +100,6 @@ E22.py:10:5: E221 [*] Multiple spaces before operator 12 12 | #: E221 E221 13 13 | x = f(x) + 1 - Run `ruff check --fix` to apply this fix. - E22.py:13:9: E221 [*] Multiple spaces before operator | 11 | long_variable = 3 @@ -130,8 +120,6 @@ E22.py:13:9: E221 [*] Multiple spaces before operator 15 15 | z = x[0] + 3 16 16 | #: E221:3:14 - Run `ruff check --fix` to apply this fix. - E22.py:15:9: E221 [*] Multiple spaces before operator | 13 | x = f(x) + 1 @@ -152,8 +140,6 @@ E22.py:15:9: E221 [*] Multiple spaces before operator 17 17 | text = """ 18 18 | bar - Run `ruff check --fix` to apply this fix. - E22.py:19:14: E221 [*] Multiple spaces before operator | 17 | text = """ @@ -173,5 +159,3 @@ E22.py:19:14: E221 [*] Multiple spaces before operator 20 20 | #: Okay 21 21 | x = 1 22 22 | y = 2 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E222_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E222_E22.py.snap index 58cce9cfe0475..9fffe206f1a60 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E222_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E222_E22.py.snap @@ -20,8 +20,6 @@ E22.py:28:8: E222 [*] Multiple spaces after operator 30 30 | #: E222 E222 31 31 | x = -1 - Run `ruff check --fix` to apply this fix. - E22.py:31:4: E222 [*] Multiple spaces after operator | 29 | b = b + 10 @@ -42,8 +40,6 @@ E22.py:31:4: E222 [*] Multiple spaces after operator 33 33 | long_variable = 3 34 34 | #: E222 E222 - Run `ruff check --fix` to apply this fix. - E22.py:32:4: E222 [*] Multiple spaces after operator | 30 | #: E222 E222 @@ -64,8 +60,6 @@ E22.py:32:4: E222 [*] Multiple spaces after operator 34 34 | #: E222 E222 35 35 | x[0] = 1 - Run `ruff check --fix` to apply this fix. - E22.py:35:7: E222 [*] Multiple spaces after operator | 33 | long_variable = 3 @@ -86,8 +80,6 @@ E22.py:35:7: E222 [*] Multiple spaces after operator 37 37 | long_variable = 3 38 38 | #: - Run `ruff check --fix` to apply this fix. - E22.py:36:7: E222 [*] Multiple spaces after operator | 34 | #: E222 E222 @@ -106,6 +98,4 @@ E22.py:36:7: E222 [*] Multiple spaces after operator 36 |+x[1] = 2 37 37 | long_variable = 3 38 38 | #: -39 39 | - - Run `ruff check --fix` to apply this fix. +39 39 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E223_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E223_E22.py.snap index a0c879c6ce868..48f3b0d2d2788 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E223_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E223_E22.py.snap @@ -18,6 +18,4 @@ E22.py:43:2: E223 [*] Tab before operator 43 |+a = 3 # aligned with tab 44 44 | #: 45 45 | -46 46 | - - Run `ruff check --fix` to apply this fix. +46 46 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E224_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E224_E22.py.snap index 189f47e834b2c..c2f6ed0625441 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E224_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E224_E22.py.snap @@ -18,6 +18,4 @@ E22.py:48:5: E224 [*] Tab after operator 48 |+a += 1 49 49 | b += 1000 50 50 | #: -51 51 | - - Run `ruff check --fix` to apply this fix. +51 51 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E225_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E225_E22.py.snap index a4a32d548cdb7..490b00a7ea63b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E225_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E225_E22.py.snap @@ -20,8 +20,6 @@ E22.py:54:11: E225 [*] Missing whitespace around operator 56 56 | submitted+= 1 57 57 | #: E225 - Run `ruff check --fix` to apply this fix. - E22.py:56:10: E225 [*] Missing whitespace around operator | 54 | submitted +=1 @@ -42,8 +40,6 @@ E22.py:56:10: E225 [*] Missing whitespace around operator 58 58 | c =-1 59 59 | #: E225 - Run `ruff check --fix` to apply this fix. - E22.py:58:3: E225 [*] Missing whitespace around operator | 56 | submitted+= 1 @@ -64,8 +60,6 @@ E22.py:58:3: E225 [*] Missing whitespace around operator 60 60 | x = x /2 - 1 61 61 | #: E225 - Run `ruff check --fix` to apply this fix. - E22.py:76:2: E225 [*] Missing whitespace around operator | 74 | _1kB = _1MB>> 10 @@ -86,8 +80,6 @@ E22.py:76:2: E225 [*] Missing whitespace around operator 78 78 | i=i +1 79 79 | #: E225 - Run `ruff check --fix` to apply this fix. - E22.py:78:2: E225 [*] Missing whitespace around operator | 76 | i=i+ 1 @@ -108,8 +100,6 @@ E22.py:78:2: E225 [*] Missing whitespace around operator 80 80 | i = 1and 1 81 81 | #: E225 - Run `ruff check --fix` to apply this fix. - E22.py:80:6: E225 [*] Missing whitespace around operator | 78 | i=i +1 @@ -130,8 +120,6 @@ E22.py:80:6: E225 [*] Missing whitespace around operator 82 82 | i = 1or 0 83 83 | #: E225 - Run `ruff check --fix` to apply this fix. - E22.py:82:6: E225 [*] Missing whitespace around operator | 80 | i = 1and 1 @@ -152,8 +140,6 @@ E22.py:82:6: E225 [*] Missing whitespace around operator 84 84 | 1is 1 85 85 | #: E225 - Run `ruff check --fix` to apply this fix. - E22.py:84:2: E225 [*] Missing whitespace around operator | 82 | i = 1or 0 @@ -174,8 +160,6 @@ E22.py:84:2: E225 [*] Missing whitespace around operator 86 86 | 1in [] 87 87 | #: E225 - Run `ruff check --fix` to apply this fix. - E22.py:86:2: E225 [*] Missing whitespace around operator | 84 | 1is 1 @@ -196,8 +180,6 @@ E22.py:86:2: E225 [*] Missing whitespace around operator 88 88 | i = 1 @2 89 89 | #: E225 - Run `ruff check --fix` to apply this fix. - E22.py:92:2: E225 [*] Missing whitespace around operator | 90 | i = 1@ 2 @@ -218,8 +200,6 @@ E22.py:92:2: E225 [*] Missing whitespace around operator 94 94 | i =i+1 95 95 | #: E225 E226 - Run `ruff check --fix` to apply this fix. - E22.py:94:3: E225 [*] Missing whitespace around operator | 92 | i=i+1 @@ -240,8 +220,6 @@ E22.py:94:3: E225 [*] Missing whitespace around operator 96 96 | i= i+1 97 97 | #: E225 E226 - Run `ruff check --fix` to apply this fix. - E22.py:96:2: E225 [*] Missing whitespace around operator | 94 | i =i+1 @@ -261,5 +239,3 @@ E22.py:96:2: E225 [*] Missing whitespace around operator 97 97 | #: E225 E226 98 98 | c = (a +b)*(a - b) 99 99 | #: E225 E226 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E226_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E226_E22.py.snap index deef5951b206b..af71285dd9500 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E226_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E226_E22.py.snap @@ -21,8 +21,6 @@ E22.py:60:7: E226 [*] Missing whitespace around arithmetic operator 62 62 | c = alpha -4 63 63 | #: E225 - Run `ruff check --fix` to apply this fix. - E22.py:62:11: E226 [*] Missing whitespace around arithmetic operator | 60 | x = x /2 - 1 @@ -43,8 +41,6 @@ E22.py:62:11: E226 [*] Missing whitespace around arithmetic operator 64 64 | c = alpha- 4 65 65 | #: E225 - Run `ruff check --fix` to apply this fix. - E22.py:64:10: E226 [*] Missing whitespace around arithmetic operator | 62 | c = alpha -4 @@ -65,8 +61,6 @@ E22.py:64:10: E226 [*] Missing whitespace around arithmetic operator 66 66 | z = x **y 67 67 | #: E225 - Run `ruff check --fix` to apply this fix. - E22.py:66:7: E226 [*] Missing whitespace around arithmetic operator | 64 | c = alpha- 4 @@ -87,8 +81,6 @@ E22.py:66:7: E226 [*] Missing whitespace around arithmetic operator 68 68 | z = (x + 1) **y 69 69 | #: E225 - Run `ruff check --fix` to apply this fix. - E22.py:68:13: E226 [*] Missing whitespace around arithmetic operator | 66 | z = x **y @@ -109,8 +101,6 @@ E22.py:68:13: E226 [*] Missing whitespace around arithmetic operator 70 70 | z = (x + 1)** y 71 71 | #: E225 - Run `ruff check --fix` to apply this fix. - E22.py:70:12: E226 [*] Missing whitespace around arithmetic operator | 68 | z = (x + 1) **y @@ -131,8 +121,6 @@ E22.py:70:12: E226 [*] Missing whitespace around arithmetic operator 72 72 | _1kB = _1MB >>10 73 73 | #: E225 - Run `ruff check --fix` to apply this fix. - E22.py:76:4: E226 [*] Missing whitespace around arithmetic operator | 74 | _1kB = _1MB>> 10 @@ -153,8 +141,6 @@ E22.py:76:4: E226 [*] Missing whitespace around arithmetic operator 78 78 | i=i +1 79 79 | #: E225 - Run `ruff check --fix` to apply this fix. - E22.py:78:5: E226 [*] Missing whitespace around arithmetic operator | 76 | i=i+ 1 @@ -175,8 +161,6 @@ E22.py:78:5: E226 [*] Missing whitespace around arithmetic operator 80 80 | i = 1and 1 81 81 | #: E225 - Run `ruff check --fix` to apply this fix. - E22.py:88:7: E226 [*] Missing whitespace around arithmetic operator | 86 | 1in [] @@ -197,8 +181,6 @@ E22.py:88:7: E226 [*] Missing whitespace around arithmetic operator 90 90 | i = 1@ 2 91 91 | #: E225 E226 - Run `ruff check --fix` to apply this fix. - E22.py:90:6: E226 [*] Missing whitespace around arithmetic operator | 88 | i = 1 @2 @@ -219,8 +201,6 @@ E22.py:90:6: E226 [*] Missing whitespace around arithmetic operator 92 92 | i=i+1 93 93 | #: E225 E226 - Run `ruff check --fix` to apply this fix. - E22.py:92:4: E226 [*] Missing whitespace around arithmetic operator | 90 | i = 1@ 2 @@ -241,8 +221,6 @@ E22.py:92:4: E226 [*] Missing whitespace around arithmetic operator 94 94 | i =i+1 95 95 | #: E225 E226 - Run `ruff check --fix` to apply this fix. - E22.py:94:5: E226 [*] Missing whitespace around arithmetic operator | 92 | i=i+1 @@ -263,8 +241,6 @@ E22.py:94:5: E226 [*] Missing whitespace around arithmetic operator 96 96 | i= i+1 97 97 | #: E225 E226 - Run `ruff check --fix` to apply this fix. - E22.py:96:5: E226 [*] Missing whitespace around arithmetic operator | 94 | i =i+1 @@ -285,8 +261,6 @@ E22.py:96:5: E226 [*] Missing whitespace around arithmetic operator 98 98 | c = (a +b)*(a - b) 99 99 | #: E225 E226 - Run `ruff check --fix` to apply this fix. - E22.py:98:8: E226 [*] Missing whitespace around arithmetic operator | 96 | i= i+1 @@ -307,8 +281,6 @@ E22.py:98:8: E226 [*] Missing whitespace around arithmetic operator 100 100 | c = (a+ b)*(a - b) 101 101 | #: - Run `ruff check --fix` to apply this fix. - E22.py:98:11: E226 [*] Missing whitespace around arithmetic operator | 96 | i= i+1 @@ -329,8 +301,6 @@ E22.py:98:11: E226 [*] Missing whitespace around arithmetic operator 100 100 | c = (a+ b)*(a - b) 101 101 | #: - Run `ruff check --fix` to apply this fix. - E22.py:100:7: E226 [*] Missing whitespace around arithmetic operator | 98 | c = (a +b)*(a - b) @@ -350,8 +320,6 @@ E22.py:100:7: E226 [*] Missing whitespace around arithmetic operator 102 102 | 103 103 | #: E226 - Run `ruff check --fix` to apply this fix. - E22.py:100:11: E226 [*] Missing whitespace around arithmetic operator | 98 | c = (a +b)*(a - b) @@ -371,8 +339,6 @@ E22.py:100:11: E226 [*] Missing whitespace around arithmetic operator 102 102 | 103 103 | #: E226 - Run `ruff check --fix` to apply this fix. - E22.py:104:6: E226 [*] Missing whitespace around arithmetic operator | 103 | #: E226 @@ -392,8 +358,6 @@ E22.py:104:6: E226 [*] Missing whitespace around arithmetic operator 106 106 | c = (a+b) * (a-b) 107 107 | #: E226 - Run `ruff check --fix` to apply this fix. - E22.py:106:7: E226 [*] Missing whitespace around arithmetic operator | 104 | z = 2//30 @@ -414,8 +378,6 @@ E22.py:106:7: E226 [*] Missing whitespace around arithmetic operator 108 108 | norman = True+False 109 109 | #: E226 - Run `ruff check --fix` to apply this fix. - E22.py:106:15: E226 [*] Missing whitespace around arithmetic operator | 104 | z = 2//30 @@ -436,8 +398,6 @@ E22.py:106:15: E226 [*] Missing whitespace around arithmetic operator 108 108 | norman = True+False 109 109 | #: E226 - Run `ruff check --fix` to apply this fix. - E22.py:110:6: E226 [*] Missing whitespace around arithmetic operator | 108 | norman = True+False @@ -458,8 +418,6 @@ E22.py:110:6: E226 [*] Missing whitespace around arithmetic operator 112 112 | x = x/2 - 1 113 113 | #: E226 E226 - Run `ruff check --fix` to apply this fix. - E22.py:112:6: E226 [*] Missing whitespace around arithmetic operator | 110 | x = x*2 - 1 @@ -480,8 +438,6 @@ E22.py:112:6: E226 [*] Missing whitespace around arithmetic operator 114 114 | hypot2 = x*x + y*y 115 115 | #: E226 - Run `ruff check --fix` to apply this fix. - E22.py:114:11: E226 [*] Missing whitespace around arithmetic operator | 112 | x = x/2 - 1 @@ -502,8 +458,6 @@ E22.py:114:11: E226 [*] Missing whitespace around arithmetic operator 116 116 | c = (a + b)*(a - b) 117 117 | #: E226 - Run `ruff check --fix` to apply this fix. - E22.py:114:17: E226 [*] Missing whitespace around arithmetic operator | 112 | x = x/2 - 1 @@ -524,8 +478,6 @@ E22.py:114:17: E226 [*] Missing whitespace around arithmetic operator 116 116 | c = (a + b)*(a - b) 117 117 | #: E226 - Run `ruff check --fix` to apply this fix. - E22.py:116:12: E226 [*] Missing whitespace around arithmetic operator | 114 | hypot2 = x*x + y*y @@ -546,8 +498,6 @@ E22.py:116:12: E226 [*] Missing whitespace around arithmetic operator 118 118 | def halves(n): 119 119 | return (i//2 for i in range(n)) - Run `ruff check --fix` to apply this fix. - E22.py:119:14: E226 [*] Missing whitespace around arithmetic operator | 117 | #: E226 @@ -567,5 +517,3 @@ E22.py:119:14: E226 [*] Missing whitespace around arithmetic operator 120 120 | #: E227 121 121 | _1kB = _1MB>>10 122 122 | #: E227 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E227_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E227_E22.py.snap index 499ee2c033e76..c5864fa361f25 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E227_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E227_E22.py.snap @@ -21,8 +21,6 @@ E22.py:72:13: E227 [*] Missing whitespace around bitwise or shift operator 74 74 | _1kB = _1MB>> 10 75 75 | #: E225 E225 - Run `ruff check --fix` to apply this fix. - E22.py:74:12: E227 [*] Missing whitespace around bitwise or shift operator | 72 | _1kB = _1MB >>10 @@ -43,8 +41,6 @@ E22.py:74:12: E227 [*] Missing whitespace around bitwise or shift operator 76 76 | i=i+ 1 77 77 | #: E225 E225 - Run `ruff check --fix` to apply this fix. - E22.py:121:12: E227 [*] Missing whitespace around bitwise or shift operator | 119 | return (i//2 for i in range(n)) @@ -65,8 +61,6 @@ E22.py:121:12: E227 [*] Missing whitespace around bitwise or shift operator 123 123 | _1MB = _1kB<<10 124 124 | #: E227 - Run `ruff check --fix` to apply this fix. - E22.py:123:12: E227 [*] Missing whitespace around bitwise or shift operator | 121 | _1kB = _1MB>>10 @@ -87,8 +81,6 @@ E22.py:123:12: E227 [*] Missing whitespace around bitwise or shift operator 125 125 | a = b|c 126 126 | #: E227 - Run `ruff check --fix` to apply this fix. - E22.py:125:6: E227 [*] Missing whitespace around bitwise or shift operator | 123 | _1MB = _1kB<<10 @@ -109,8 +101,6 @@ E22.py:125:6: E227 [*] Missing whitespace around bitwise or shift operator 127 127 | b = c&a 128 128 | #: E227 - Run `ruff check --fix` to apply this fix. - E22.py:127:6: E227 [*] Missing whitespace around bitwise or shift operator | 125 | a = b|c @@ -131,8 +121,6 @@ E22.py:127:6: E227 [*] Missing whitespace around bitwise or shift operator 129 129 | c = b^a 130 130 | #: E228 - Run `ruff check --fix` to apply this fix. - E22.py:129:6: E227 [*] Missing whitespace around bitwise or shift operator | 127 | b = c&a @@ -153,8 +141,6 @@ E22.py:129:6: E227 [*] Missing whitespace around bitwise or shift operator 131 131 | a = b%c 132 132 | #: E228 - Run `ruff check --fix` to apply this fix. - E22.py:154:11: E227 [*] Missing whitespace around bitwise or shift operator | 152 | func2(lambda a, b=h[:], c=0: (a, b, c)) @@ -174,5 +160,3 @@ E22.py:154:11: E227 [*] Missing whitespace around bitwise or shift operator 155 155 | print >> sys.stdout, "x is an integer." 156 156 | x = x / 2 - 1 157 157 | x = 1 @ 2 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E228_E22.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E228_E22.py.snap index de3650c45f246..4df6a9b256e82 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E228_E22.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E228_E22.py.snap @@ -21,8 +21,6 @@ E22.py:131:6: E228 [*] Missing whitespace around modulo operator 133 133 | msg = fmt%(errno, errmsg) 134 134 | #: E228 - Run `ruff check --fix` to apply this fix. - E22.py:133:10: E228 [*] Missing whitespace around modulo operator | 131 | a = b%c @@ -43,8 +41,6 @@ E22.py:133:10: E228 [*] Missing whitespace around modulo operator 135 135 | msg = "Error %d occurred"%errno 136 136 | #: - Run `ruff check --fix` to apply this fix. - E22.py:135:26: E228 [*] Missing whitespace around modulo operator | 133 | msg = fmt%(errno, errmsg) @@ -63,5 +59,3 @@ E22.py:135:26: E228 [*] Missing whitespace around modulo operator 136 136 | #: 137 137 | 138 138 | #: Okay - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap index 1b27d16ced389..b1013908ff9f3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap @@ -18,8 +18,6 @@ E23.py:2:7: E231 [*] Missing whitespace after ',' 4 4 | a[b1,:] 5 5 | #: E231 - Run `ruff check --fix` to apply this fix. - E23.py:4:5: E231 [*] Missing whitespace after ',' | 2 | a = (1,2) @@ -40,8 +38,6 @@ E23.py:4:5: E231 [*] Missing whitespace after ',' 6 6 | a = [{'a':''}] 7 7 | #: Okay - Run `ruff check --fix` to apply this fix. - E23.py:6:10: E231 [*] Missing whitespace after ':' | 4 | a[b1,:] @@ -62,8 +58,6 @@ E23.py:6:10: E231 [*] Missing whitespace after ':' 8 8 | a = (4,) 9 9 | b = (5, ) - Run `ruff check --fix` to apply this fix. - E23.py:19:10: E231 [*] Missing whitespace after ',' | 17 | def foo() -> None: @@ -83,8 +77,6 @@ E23.py:19:10: E231 [*] Missing whitespace after ',' 21 21 | 22 22 | #: Okay - Run `ruff check --fix` to apply this fix. - E23.py:29:20: E231 [*] Missing whitespace after ':' | 27 | mdtypes_template = { @@ -104,8 +96,6 @@ E23.py:29:20: E231 [*] Missing whitespace after ':' 31 31 | 32 32 | # E231 - Run `ruff check --fix` to apply this fix. - E23.py:33:6: E231 [*] Missing whitespace after ',' | 32 | # E231 @@ -125,8 +115,6 @@ E23.py:33:6: E231 [*] Missing whitespace after ',' 35 35 | # Okay because it's hard to differentiate between the usages of a colon in a f-string 36 36 | f"{a:=1}" - Run `ruff check --fix` to apply this fix. - E23.py:47:37: E231 [*] Missing whitespace after ':' | 46 | #: E231 @@ -146,8 +134,6 @@ E23.py:47:37: E231 [*] Missing whitespace after ':' 49 49 | #: Okay 50 50 | a = (1,) - Run `ruff check --fix` to apply this fix. - E23.py:60:13: E231 [*] Missing whitespace after ':' | 58 | results = { @@ -168,8 +154,6 @@ E23.py:60:13: E231 [*] Missing whitespace after ':' 62 62 | results_in_tuple = ( 63 63 | { - Run `ruff check --fix` to apply this fix. - E23.py:65:17: E231 [*] Missing whitespace after ':' | 63 | { @@ -190,8 +174,6 @@ E23.py:65:17: E231 [*] Missing whitespace after ':' 67 67 | ) 68 68 | results_in_list = [ - Run `ruff check --fix` to apply this fix. - E23.py:71:17: E231 [*] Missing whitespace after ':' | 69 | { @@ -212,8 +194,6 @@ E23.py:71:17: E231 [*] Missing whitespace after ':' 73 73 | ] 74 74 | results_in_list_first = [ - Run `ruff check --fix` to apply this fix. - E23.py:76:17: E231 [*] Missing whitespace after ':' | 74 | results_in_list_first = [ @@ -234,8 +214,6 @@ E23.py:76:17: E231 [*] Missing whitespace after ':' 78 78 | ] 79 79 | - Run `ruff check --fix` to apply this fix. - E23.py:82:13: E231 [*] Missing whitespace after ':' | 80 | x = [ @@ -256,8 +234,6 @@ E23.py:82:13: E231 [*] Missing whitespace after ':' 84 84 | "k3":[2], # E231 85 85 | "k4": [2], - Run `ruff check --fix` to apply this fix. - E23.py:84:13: E231 [*] Missing whitespace after ':' | 82 | "k1":[2], # E231 @@ -278,8 +254,6 @@ E23.py:84:13: E231 [*] Missing whitespace after ':' 86 86 | "k5": [2], 87 87 | "k6": [1, 2, 3, 4,5,6,7] # E231 - Run `ruff check --fix` to apply this fix. - E23.py:87:26: E231 [*] Missing whitespace after ',' | 85 | "k4": [2], @@ -300,8 +274,6 @@ E23.py:87:26: E231 [*] Missing whitespace after ',' 89 89 | { 90 90 | "k1": [ - Run `ruff check --fix` to apply this fix. - E23.py:87:28: E231 [*] Missing whitespace after ',' | 85 | "k4": [2], @@ -322,8 +294,6 @@ E23.py:87:28: E231 [*] Missing whitespace after ',' 89 89 | { 90 90 | "k1": [ - Run `ruff check --fix` to apply this fix. - E23.py:87:30: E231 [*] Missing whitespace after ',' | 85 | "k4": [2], @@ -344,8 +314,6 @@ E23.py:87:30: E231 [*] Missing whitespace after ',' 89 89 | { 90 90 | "k1": [ - Run `ruff check --fix` to apply this fix. - E23.py:92:21: E231 [*] Missing whitespace after ':' | 90 | "k1": [ @@ -366,8 +334,6 @@ E23.py:92:21: E231 [*] Missing whitespace after ':' 94 94 | { 95 95 | "kb": [2,3], # E231 - Run `ruff check --fix` to apply this fix. - E23.py:92:24: E231 [*] Missing whitespace after ',' | 90 | "k1": [ @@ -388,8 +354,6 @@ E23.py:92:24: E231 [*] Missing whitespace after ',' 94 94 | { 95 95 | "kb": [2,3], # E231 - Run `ruff check --fix` to apply this fix. - E23.py:95:25: E231 [*] Missing whitespace after ',' | 93 | }, @@ -410,8 +374,6 @@ E23.py:95:25: E231 [*] Missing whitespace after ',' 97 97 | { 98 98 | "ka":[2, 3], # E231 - Run `ruff check --fix` to apply this fix. - E23.py:98:21: E231 [*] Missing whitespace after ':' | 96 | }, @@ -432,8 +394,6 @@ E23.py:98:21: E231 [*] Missing whitespace after ':' 100 100 | "kc": [2, 3], # Ok 101 101 | "kd": [2,3], # E231 - Run `ruff check --fix` to apply this fix. - E23.py:101:25: E231 [*] Missing whitespace after ',' | 99 | "kb": [2, 3], # Ok @@ -454,8 +414,6 @@ E23.py:101:25: E231 [*] Missing whitespace after ',' 103 103 | }, 104 104 | ] - Run `ruff check --fix` to apply this fix. - E23.py:102:21: E231 [*] Missing whitespace after ':' | 100 | "kc": [2, 3], # Ok @@ -476,8 +434,6 @@ E23.py:102:21: E231 [*] Missing whitespace after ':' 104 104 | ] 105 105 | } - Run `ruff check --fix` to apply this fix. - E23.py:102:24: E231 [*] Missing whitespace after ',' | 100 | "kc": [2, 3], # Ok @@ -497,5 +453,3 @@ E23.py:102:24: E231 [*] Missing whitespace after ',' 103 103 | }, 104 104 | ] 105 105 | } - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E241_E24.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E241_E24.py.snap index bdce7011836ae..73e68a674e15a 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E241_E24.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E241_E24.py.snap @@ -18,8 +18,6 @@ E24.py:2:8: E241 [*] Multiple spaces after comma 4 4 | b = (1, 20) 5 5 | #: E242 - Run `ruff check --fix` to apply this fix. - E24.py:11:18: E241 [*] Multiple spaces after comma | 9 | #: E241 E241 E241 @@ -39,8 +37,6 @@ E24.py:11:18: E241 [*] Multiple spaces after comma 12 12 | ef, +h, 13 13 | c, -d] - Run `ruff check --fix` to apply this fix. - E24.py:12:19: E241 [*] Multiple spaces after comma | 10 | # issue 135 @@ -58,8 +54,6 @@ E24.py:12:19: E241 [*] Multiple spaces after comma 12 |+ ef, +h, 13 13 | c, -d] - Run `ruff check --fix` to apply this fix. - E24.py:13:18: E241 [*] Multiple spaces after comma | 11 | more_spaces = [a, b, @@ -74,5 +68,3 @@ E24.py:13:18: E241 [*] Multiple spaces after comma 12 12 | ef, +h, 13 |- c, -d] 13 |+ c, -d] - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E242_E24.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E242_E24.py.snap index 579e06ed1dfb0..34883face207b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E242_E24.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E242_E24.py.snap @@ -20,5 +20,3 @@ E24.py:6:8: E242 [*] Tab after comma 7 7 | #: Okay 8 8 | b = (1, 20) # space before 20 9 9 | #: E241 E241 E241 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E251_E25.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E251_E25.py.snap index 5ab54ede68535..940ac364477bd 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E251_E25.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E251_E25.py.snap @@ -18,8 +18,6 @@ E25.py:2:12: E251 [*] Unexpected spaces around keyword / parameter equals 4 4 | pass 5 5 | #: E251 - Run `ruff check --fix` to apply this fix. - E25.py:2:14: E251 [*] Unexpected spaces around keyword / parameter equals | 1 | #: E251 E251 @@ -37,8 +35,6 @@ E25.py:2:14: E251 [*] Unexpected spaces around keyword / parameter equals 4 4 | pass 5 5 | #: E251 - Run `ruff check --fix` to apply this fix. - E25.py:6:9: E251 [*] Unexpected spaces around keyword / parameter equals | 4 | pass @@ -59,8 +55,6 @@ E25.py:6:9: E251 [*] Unexpected spaces around keyword / parameter equals 8 8 | foo(bar =True) 9 9 | #: E251 E251 - Run `ruff check --fix` to apply this fix. - E25.py:8:8: E251 [*] Unexpected spaces around keyword / parameter equals | 6 | foo(bar= True) @@ -81,8 +75,6 @@ E25.py:8:8: E251 [*] Unexpected spaces around keyword / parameter equals 10 10 | foo(bar = True) 11 11 | #: E251 - Run `ruff check --fix` to apply this fix. - E25.py:10:8: E251 [*] Unexpected spaces around keyword / parameter equals | 8 | foo(bar =True) @@ -103,8 +95,6 @@ E25.py:10:8: E251 [*] Unexpected spaces around keyword / parameter equals 12 12 | y = bar(root= "sdasd") 13 13 | #: E251:2:29 - Run `ruff check --fix` to apply this fix. - E25.py:10:10: E251 [*] Unexpected spaces around keyword / parameter equals | 8 | foo(bar =True) @@ -125,8 +115,6 @@ E25.py:10:10: E251 [*] Unexpected spaces around keyword / parameter equals 12 12 | y = bar(root= "sdasd") 13 13 | #: E251:2:29 - Run `ruff check --fix` to apply this fix. - E25.py:12:14: E251 [*] Unexpected spaces around keyword / parameter equals | 10 | foo(bar = True) @@ -147,8 +135,6 @@ E25.py:12:14: E251 [*] Unexpected spaces around keyword / parameter equals 14 14 | parser.add_argument('--long-option', 15 15 | default= - Run `ruff check --fix` to apply this fix. - E25.py:15:29: E251 [*] Unexpected spaces around keyword / parameter equals | 13 | #: E251:2:29 @@ -172,8 +158,6 @@ E25.py:15:29: E251 [*] Unexpected spaces around keyword / parameter equals 18 17 | parser.add_argument('--long-option', default 19 18 | ="/rather/long/filesystem/path/here/blah/blah/blah") - Run `ruff check --fix` to apply this fix. - E25.py:18:45: E251 [*] Unexpected spaces around keyword / parameter equals | 16 | "/rather/long/filesystem/path/here/blah/blah/blah") @@ -197,8 +181,6 @@ E25.py:18:45: E251 [*] Unexpected spaces around keyword / parameter equals 21 20 | foo(True, 22 21 | baz=(1, 2), - Run `ruff check --fix` to apply this fix. - E25.py:23:8: E251 [*] Unexpected spaces around keyword / parameter equals | 21 | foo(True, @@ -219,8 +201,6 @@ E25.py:23:8: E251 [*] Unexpected spaces around keyword / parameter equals 25 25 | #: Okay 26 26 | foo(bar=(1 == 1)) - Run `ruff check --fix` to apply this fix. - E25.py:23:10: E251 [*] Unexpected spaces around keyword / parameter equals | 21 | foo(True, @@ -240,5 +220,3 @@ E25.py:23:10: E251 [*] Unexpected spaces around keyword / parameter equals 24 24 | ) 25 25 | #: Okay 26 26 | foo(bar=(1 == 1)) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E252_E25.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E252_E25.py.snap index f20c5d197321b..fd1d1bda54201 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E252_E25.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E252_E25.py.snap @@ -21,8 +21,6 @@ E25.py:46:15: E252 [*] Missing whitespace around parameter equals 48 48 | #: Okay 49 49 | def add(a: int = _default(name='f')): - Run `ruff check --fix` to apply this fix. - E25.py:46:15: E252 [*] Missing whitespace around parameter equals | 44 | return a + b @@ -43,8 +41,6 @@ E25.py:46:15: E252 [*] Missing whitespace around parameter equals 48 48 | #: Okay 49 49 | def add(a: int = _default(name='f')): - Run `ruff check --fix` to apply this fix. - E25.py:46:26: E252 [*] Missing whitespace around parameter equals | 44 | return a + b @@ -65,8 +61,6 @@ E25.py:46:26: E252 [*] Missing whitespace around parameter equals 48 48 | #: Okay 49 49 | def add(a: int = _default(name='f')): - Run `ruff check --fix` to apply this fix. - E25.py:46:36: E252 [*] Missing whitespace around parameter equals | 44 | return a + b @@ -86,5 +80,3 @@ E25.py:46:36: E252 [*] Missing whitespace around parameter equals 47 47 | return a + b + c 48 48 | #: Okay 49 49 | def add(a: int = _default(name='f')): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E261_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E261_E26.py.snap index 37d64ecf72279..ef2d83c729689 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E261_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E261_E26.py.snap @@ -17,5 +17,3 @@ E26.py:2:5: E261 [*] Insert at least two spaces before an inline comment 3 3 | #: E262:1:12 4 4 | x = x + 1 #Increment x 5 5 | #: E262:1:12 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap index e4d0cc1725938..1024ea7d46e47 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E262_E26.py.snap @@ -21,8 +21,6 @@ E26.py:4:12: E262 [*] Inline comment should start with `# ` 6 6 | x = x + 1 # Increment x 7 7 | #: E262:1:12 - Run `ruff check --fix` to apply this fix. - E26.py:6:12: E262 [*] Inline comment should start with `# ` | 4 | x = x + 1 #Increment x @@ -43,8 +41,6 @@ E26.py:6:12: E262 [*] Inline comment should start with `# ` 8 8 | x = y + 1 #: Increment x 9 9 | #: E265:1:1 - Run `ruff check --fix` to apply this fix. - E26.py:8:12: E262 [*] Inline comment should start with `# ` | 6 | x = x + 1 # Increment x @@ -65,8 +61,6 @@ E26.py:8:12: E262 [*] Inline comment should start with `# ` 10 10 | #Block comment 11 11 | a = 1 - Run `ruff check --fix` to apply this fix. - E26.py:63:9: E262 [*] Inline comment should start with `# ` | 61 | # -*- coding: utf8 -*- @@ -87,8 +81,6 @@ E26.py:63:9: E262 [*] Inline comment should start with `# ` 65 65 | # (Two spaces) Ok for block comment 66 66 | a = 42 # (Two spaces) - Run `ruff check --fix` to apply this fix. - E26.py:66:9: E262 [*] Inline comment should start with `# ` | 64 | #: E262:2:9 @@ -109,8 +101,6 @@ E26.py:66:9: E262 [*] Inline comment should start with `# ` 68 68 | #: E265:5:1 69 69 | ### Means test is not done yet - Run `ruff check --fix` to apply this fix. - E26.py:84:8: E262 [*] Inline comment should start with `# ` | 82 | ## Foo @@ -130,8 +120,6 @@ E26.py:84:8: E262 [*] Inline comment should start with `# ` 85 85 | 86 86 | a = 1 #:Foo - Run `ruff check --fix` to apply this fix. - E26.py:86:8: E262 [*] Inline comment should start with `# ` | 84 | a = 1 ## Foo @@ -146,5 +134,3 @@ E26.py:86:8: E262 [*] Inline comment should start with `# ` 85 85 | 86 |-a = 1 #:Foo 86 |+a = 1 #: Foo - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap index 82891e11b832e..cf47edcb9037e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E265_E26.py.snap @@ -21,8 +21,6 @@ E26.py:10:1: E265 [*] Block comment should start with `# ` 12 12 | #: E265:2:1 13 13 | m = 42 - Run `ruff check --fix` to apply this fix. - E26.py:14:1: E265 [*] Block comment should start with `# ` | 12 | #: E265:2:1 @@ -43,8 +41,6 @@ E26.py:14:1: E265 [*] Block comment should start with `# ` 16 16 | #: E266:3:5 E266:6:5 17 17 | def how_it_feel(r): - Run `ruff check --fix` to apply this fix. - E26.py:25:1: E265 [*] Block comment should start with `# ` | 23 | return @@ -65,8 +61,6 @@ E26.py:25:1: E265 [*] Block comment should start with `# ` 27 27 | #: W291:1:42 28 28 | ######################################### - Run `ruff check --fix` to apply this fix. - E26.py:32:1: E265 [*] Block comment should start with `# ` | 31 | #: Okay @@ -86,8 +80,6 @@ E26.py:32:1: E265 [*] Block comment should start with `# ` 34 34 | pass # an inline comment 35 35 | x = x + 1 # Increment x - Run `ruff check --fix` to apply this fix. - E26.py:73:1: E265 [*] Block comment should start with `# ` | 71 | # F Means test is failing (F) @@ -107,8 +99,6 @@ E26.py:73:1: E265 [*] Block comment should start with `# ` 75 75 | 76 76 | #: Colon prefix is okay - Run `ruff check --fix` to apply this fix. - E26.py:78:1: E265 [*] Block comment should start with `# ` | 76 | #: Colon prefix is okay @@ -128,5 +118,3 @@ E26.py:78:1: E265 [*] Block comment should start with `# ` 79 79 | 80 80 | # We should strip the space, but preserve the hashes. 81 81 | #: E266:1:3 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap index d0cc4e734e595..bc6bf79de595e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E266_E26.py.snap @@ -20,8 +20,6 @@ E26.py:19:5: E266 [*] Too many leading `#` before block comment 21 21 | 22 22 | ### Of course it is unused - Run `ruff check --fix` to apply this fix. - E26.py:22:5: E266 [*] Too many leading `#` before block comment | 20 | a = 42 @@ -42,8 +40,6 @@ E26.py:22:5: E266 [*] Too many leading `#` before block comment 24 24 | #: E265:1:1 E266:2:1 25 25 | ##if DEBUG: - Run `ruff check --fix` to apply this fix. - E26.py:26:1: E266 [*] Too many leading `#` before block comment | 24 | #: E265:1:1 E266:2:1 @@ -64,8 +60,6 @@ E26.py:26:1: E266 [*] Too many leading `#` before block comment 28 28 | ######################################### 29 29 | #: - Run `ruff check --fix` to apply this fix. - E26.py:69:1: E266 [*] Too many leading `#` before block comment | 68 | #: E265:5:1 @@ -85,8 +79,6 @@ E26.py:69:1: E266 [*] Too many leading `#` before block comment 71 71 | # F Means test is failing (F) 72 72 | # EF Means test is giving error and Failing - Run `ruff check --fix` to apply this fix. - E26.py:82:1: E266 [*] Too many leading `#` before block comment | 80 | # We should strip the space, but preserve the hashes. @@ -105,6 +97,4 @@ E26.py:82:1: E266 [*] Too many leading `#` before block comment 82 |+# Foo 83 83 | 84 84 | a = 1 ## Foo -85 85 | - - Run `ruff check --fix` to apply this fix. +85 85 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap index eeae4942df307..f0c424782e4bd 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E271_E27.py.snap @@ -21,8 +21,6 @@ E27.py:4:9: E271 [*] Multiple spaces after keyword 6 6 | True and False 7 7 | #: E271 - Run `ruff check --fix` to apply this fix. - E27.py:6:5: E271 [*] Multiple spaces after keyword | 4 | True and False @@ -43,8 +41,6 @@ E27.py:6:5: E271 [*] Multiple spaces after keyword 8 8 | if 1: 9 9 | pass - Run `ruff check --fix` to apply this fix. - E27.py:8:3: E271 [*] Multiple spaces after keyword | 6 | True and False @@ -65,8 +61,6 @@ E27.py:8:3: E271 [*] Multiple spaces after keyword 10 10 | #: E273 11 11 | True and False - Run `ruff check --fix` to apply this fix. - E27.py:15:6: E271 [*] Multiple spaces after keyword | 13 | True and False @@ -87,8 +81,6 @@ E27.py:15:6: E271 [*] Multiple spaces after keyword 17 17 | 1 and b 18 18 | #: E271 - Run `ruff check --fix` to apply this fix. - E27.py:17:6: E271 [*] Multiple spaces after keyword | 15 | a and b @@ -109,8 +101,6 @@ E27.py:17:6: E271 [*] Multiple spaces after keyword 19 19 | a and 2 20 20 | #: E271 E272 - Run `ruff check --fix` to apply this fix. - E27.py:19:6: E271 [*] Multiple spaces after keyword | 17 | 1 and b @@ -131,8 +121,6 @@ E27.py:19:6: E271 [*] Multiple spaces after keyword 21 21 | 1 and b 22 22 | #: E271 E272 - Run `ruff check --fix` to apply this fix. - E27.py:21:7: E271 [*] Multiple spaces after keyword | 19 | a and 2 @@ -153,8 +141,6 @@ E27.py:21:7: E271 [*] Multiple spaces after keyword 23 23 | a and 2 24 24 | #: E272 - Run `ruff check --fix` to apply this fix. - E27.py:23:7: E271 [*] Multiple spaces after keyword | 21 | 1 and b @@ -175,8 +161,6 @@ E27.py:23:7: E271 [*] Multiple spaces after keyword 25 25 | this and False 26 26 | #: E273 - Run `ruff check --fix` to apply this fix. - E27.py:36:14: E271 [*] Multiple spaces after keyword | 34 | from v import c, d @@ -197,8 +181,6 @@ E27.py:36:14: E271 [*] Multiple spaces after keyword 38 38 | from w import(e, f) 39 39 | #: E275 - Run `ruff check --fix` to apply this fix. - E27.py:71:5: E271 [*] Multiple spaces after keyword | 70 | #: E271 @@ -217,5 +199,3 @@ E27.py:71:5: E271 [*] Multiple spaces after keyword 72 72 | 73 73 | #: E273 74 74 | type Number = int - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E272_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E272_E27.py.snap index 2b82d9eb7d9c7..8c2472aa2329f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E272_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E272_E27.py.snap @@ -21,8 +21,6 @@ E27.py:21:2: E272 [*] Multiple spaces before keyword 23 23 | a and 2 24 24 | #: E272 - Run `ruff check --fix` to apply this fix. - E27.py:23:2: E272 [*] Multiple spaces before keyword | 21 | 1 and b @@ -43,8 +41,6 @@ E27.py:23:2: E272 [*] Multiple spaces before keyword 25 25 | this and False 26 26 | #: E273 - Run `ruff check --fix` to apply this fix. - E27.py:25:5: E272 [*] Multiple spaces before keyword | 23 | a and 2 @@ -64,5 +60,3 @@ E27.py:25:5: E272 [*] Multiple spaces before keyword 26 26 | #: E273 27 27 | a and b 28 28 | #: E274 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E273_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E273_E27.py.snap index 37fcddbba3bef..73ec80938589c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E273_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E273_E27.py.snap @@ -21,8 +21,6 @@ E27.py:11:9: E273 [*] Tab after keyword 13 13 | True and False 14 14 | #: E271 - Run `ruff check --fix` to apply this fix. - E27.py:13:5: E273 [*] Tab after keyword | 11 | True and False @@ -43,8 +41,6 @@ E27.py:13:5: E273 [*] Tab after keyword 15 15 | a and b 16 16 | #: E271 - Run `ruff check --fix` to apply this fix. - E27.py:13:10: E273 [*] Tab after keyword | 11 | True and False @@ -65,8 +61,6 @@ E27.py:13:10: E273 [*] Tab after keyword 15 15 | a and b 16 16 | #: E271 - Run `ruff check --fix` to apply this fix. - E27.py:27:6: E273 [*] Tab after keyword | 25 | this and False @@ -87,8 +81,6 @@ E27.py:27:6: E273 [*] Tab after keyword 29 29 | a and b 30 30 | #: E273 E274 - Run `ruff check --fix` to apply this fix. - E27.py:31:10: E273 [*] Tab after keyword | 29 | a and b @@ -109,8 +101,6 @@ E27.py:31:10: E273 [*] Tab after keyword 33 33 | from u import (a, b) 34 34 | from v import c, d - Run `ruff check --fix` to apply this fix. - E27.py:74:5: E273 [*] Tab after keyword | 73 | #: E273 @@ -129,5 +119,3 @@ E27.py:74:5: E273 [*] Tab after keyword 75 75 | 76 76 | #: E275 77 77 | match(foo): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E274_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E274_E27.py.snap index ee5470deb8b2d..2428a90865800 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E274_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E274_E27.py.snap @@ -21,8 +21,6 @@ E27.py:29:2: E274 [*] Tab before keyword 31 31 | this and False 32 32 | #: Okay - Run `ruff check --fix` to apply this fix. - E27.py:31:5: E274 [*] Tab before keyword | 29 | a and b @@ -42,5 +40,3 @@ E27.py:31:5: E274 [*] Tab before keyword 32 32 | #: Okay 33 33 | from u import (a, b) 34 34 | from v import c, d - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E275_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E275_E27.py.snap index 8bd46d54c5939..5fd119dc1b4cf 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E275_E27.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E275_E27.py.snap @@ -21,8 +21,6 @@ E27.py:38:8: E275 [*] Missing whitespace after keyword 40 40 | from importable.module import(e, f) 41 41 | #: E275 - Run `ruff check --fix` to apply this fix. - E27.py:40:24: E275 [*] Missing whitespace after keyword | 38 | from w import(e, f) @@ -43,8 +41,6 @@ E27.py:40:24: E275 [*] Missing whitespace after keyword 42 42 | try: 43 43 | from importable.module import(e, f) - Run `ruff check --fix` to apply this fix. - E27.py:43:28: E275 [*] Missing whitespace after keyword | 41 | #: E275 @@ -65,8 +61,6 @@ E27.py:43:28: E275 [*] Missing whitespace after keyword 45 45 | pass 46 46 | #: E275 - Run `ruff check --fix` to apply this fix. - E27.py:47:1: E275 [*] Missing whitespace after keyword | 45 | pass @@ -87,8 +81,6 @@ E27.py:47:1: E275 [*] Missing whitespace after keyword 49 49 | else: 50 50 | pass - Run `ruff check --fix` to apply this fix. - E27.py:55:5: E275 [*] Missing whitespace after keyword | 53 | #: E275:2:11 @@ -109,8 +101,6 @@ E27.py:55:5: E275 [*] Missing whitespace after keyword 57 57 | def f(): 58 58 | print((yield)) - Run `ruff check --fix` to apply this fix. - E27.py:77:1: E275 [*] Missing whitespace after keyword | 76 | #: E275 @@ -130,8 +120,6 @@ E27.py:77:1: E275 [*] Missing whitespace after keyword 79 79 | pass 80 80 | - Run `ruff check --fix` to apply this fix. - E27.py:78:5: E275 [*] Missing whitespace after keyword | 76 | #: E275 @@ -150,5 +138,3 @@ E27.py:78:5: E275 [*] Missing whitespace after keyword 79 79 | pass 80 80 | 81 81 | # https://github.com/astral-sh/ruff/issues/12094 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30.py.snap index 4fc5aecbe5efa..0e0133b9b7c2a 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30.py.snap @@ -20,8 +20,6 @@ E30.py:478:5: E301 [*] Expected 1 blank line, found 0 479 480 | pass 480 481 | # end - Run `ruff check --fix` to apply this fix. - E30.py:489:5: E301 [*] Expected 1 blank line, found 0 | 487 | pass @@ -41,8 +39,6 @@ E30.py:489:5: E301 [*] Expected 1 blank line, found 0 489 490 | def fn2(): 490 491 | pass - Run `ruff check --fix` to apply this fix. - E30.py:499:5: E301 [*] Expected 1 blank line, found 0 | 498 | columns = [] @@ -61,8 +57,6 @@ E30.py:499:5: E301 [*] Expected 1 blank line, found 0 500 501 | def cls_method(cls) -> None: 501 502 | pass - Run `ruff check --fix` to apply this fix. - E30.py:511:5: E301 [*] Expected 1 blank line, found 0 | 509 | def method(cls) -> None: @@ -82,8 +76,6 @@ E30.py:511:5: E301 [*] Expected 1 blank line, found 0 512 513 | def cls_method(cls) -> None: 513 514 | pass - Run `ruff check --fix` to apply this fix. - E30.py:526:5: E301 [*] Expected 1 blank line, found 0 | 524 | def bar(self, x: str) -> str: @@ -102,5 +94,3 @@ E30.py:526:5: E301 [*] Expected 1 blank line, found 0 526 527 | def bar(self, x: int | str) -> int | str: 527 528 | return x 528 529 | # end - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap index c441d62c0ccf6..f47ad3fd7009f 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap @@ -21,8 +21,6 @@ E30.py:533:1: E302 [*] Expected 2 blank lines, found 0 534 536 | pass 535 537 | # end - Run `ruff check --fix` to apply this fix. - E30.py:540:1: E302 [*] Expected 2 blank lines, found 0 | 538 | # E302 @@ -43,8 +41,6 @@ E30.py:540:1: E302 [*] Expected 2 blank lines, found 0 541 543 | return sys.path 542 544 | # end - Run `ruff check --fix` to apply this fix. - E30.py:549:1: E302 [*] Expected 2 blank lines, found 1 | 547 | pass @@ -64,8 +60,6 @@ E30.py:549:1: E302 [*] Expected 2 blank lines, found 1 550 551 | pass 551 552 | # end - Run `ruff check --fix` to apply this fix. - E30.py:560:1: E302 [*] Expected 2 blank lines, found 1 | 558 | # comment @@ -85,8 +79,6 @@ E30.py:560:1: E302 [*] Expected 2 blank lines, found 1 561 562 | pass 562 563 | # end - Run `ruff check --fix` to apply this fix. - E30.py:569:1: E302 [*] Expected 2 blank lines, found 1 | 567 | pass @@ -106,8 +98,6 @@ E30.py:569:1: E302 [*] Expected 2 blank lines, found 1 570 571 | pass 571 572 | # end - Run `ruff check --fix` to apply this fix. - E30.py:578:1: E302 [*] Expected 2 blank lines, found 1 | 576 | pass @@ -127,8 +117,6 @@ E30.py:578:1: E302 [*] Expected 2 blank lines, found 1 579 580 | pass 580 581 | # end - Run `ruff check --fix` to apply this fix. - E30.py:586:1: E302 [*] Expected 2 blank lines, found 0 | 584 | def bar(): @@ -148,8 +136,6 @@ E30.py:586:1: E302 [*] Expected 2 blank lines, found 0 587 589 | # end 588 590 | - Run `ruff check --fix` to apply this fix. - E30.py:592:1: E302 [*] Expected 2 blank lines, found 0 | 590 | # E302 @@ -170,8 +156,6 @@ E30.py:592:1: E302 [*] Expected 2 blank lines, found 0 593 595 | pass 594 596 | # end - Run `ruff check --fix` to apply this fix. - E30.py:602:1: E302 [*] Expected 2 blank lines, found 1 | 601 | # comment @@ -191,8 +175,6 @@ E30.py:602:1: E302 [*] Expected 2 blank lines, found 1 602 604 | @decorator 603 605 | def g(): - Run `ruff check --fix` to apply this fix. - E30.py:624:1: E302 [*] Expected 2 blank lines, found 0 | 622 | # E302 @@ -212,8 +194,6 @@ E30.py:624:1: E302 [*] Expected 2 blank lines, found 0 625 627 | # end 626 628 | - Run `ruff check --fix` to apply this fix. - E30.py:634:1: E302 [*] Expected 2 blank lines, found 1 | 632 | def fn(a: str) -> str: ... @@ -232,5 +212,3 @@ E30.py:634:1: E302 [*] Expected 2 blank lines, found 1 634 635 | def fn(a: int | str) -> int | str: 635 636 | ... 636 637 | # end - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap index c650a84858e15..be235e624d8a3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_docstring.py.snap @@ -16,5 +16,3 @@ E302_first_line_docstring.py:3:1: E302 [*] Expected 2 blank lines, found 1 3 |+ 3 4 | def fn(): 4 5 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap index dc9cff95a65af..0751a8c695ba2 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_expression.py.snap @@ -16,5 +16,3 @@ E302_first_line_expression.py:3:1: E302 [*] Expected 2 blank lines, found 1 3 |+ 3 4 | def fn(): 4 5 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap index b4cbd34cb55b3..cc614c225e05b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_function.py.snap @@ -17,5 +17,3 @@ E302_first_line_function.py:4:1: E302 [*] Expected 2 blank lines, found 1 4 |+ 4 5 | def fn2(): 5 6 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap index 7bb06c20c2688..6657de5fa1e59 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E302_first_line_statement.py.snap @@ -16,5 +16,3 @@ E302_first_line_statement.py:3:1: E302 [*] Expected 2 blank lines, found 1 3 |+ 3 4 | def fn(): 4 5 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap index e6c64b4065423..068bf6cae18b5 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30.py.snap @@ -18,8 +18,6 @@ E30.py:617:2: E303 [*] Too many blank lines (2) 618 617 | return 22 619 618 | # end - Run `ruff check --fix` to apply this fix. - E30.py:644:5: E303 [*] Too many blank lines (2) | 644 | # arbitrary comment @@ -37,8 +35,6 @@ E30.py:644:5: E303 [*] Too many blank lines (2) 645 644 | 646 645 | def inner(): # E306 not expected (pycodestyle detects E306) - Run `ruff check --fix` to apply this fix. - E30.py:656:5: E303 [*] Too many blank lines (2) | 656 | # arbitrary comment @@ -56,8 +52,6 @@ E30.py:656:5: E303 [*] Too many blank lines (2) 657 656 | def inner(): # E306 not expected (pycodestyle detects E306) 658 657 | pass - Run `ruff check --fix` to apply this fix. - E30.py:667:1: E303 [*] Too many blank lines (3) | 667 | print() @@ -74,8 +68,6 @@ E30.py:667:1: E303 [*] Too many blank lines (3) 668 667 | # end 669 668 | - Run `ruff check --fix` to apply this fix. - E30.py:676:1: E303 [*] Too many blank lines (3) | 676 | # comment @@ -93,8 +85,6 @@ E30.py:676:1: E303 [*] Too many blank lines (3) 677 676 | 678 677 | print() - Run `ruff check --fix` to apply this fix. - E30.py:687:5: E303 [*] Too many blank lines (2) | 687 | # comment @@ -110,8 +100,6 @@ E30.py:687:5: E303 [*] Too many blank lines (2) 688 687 | 689 688 | - Run `ruff check --fix` to apply this fix. - E30.py:690:5: E303 [*] Too many blank lines (2) | 690 | # another comment @@ -129,8 +117,6 @@ E30.py:690:5: E303 [*] Too many blank lines (2) 691 690 | 692 691 | print() - Run `ruff check --fix` to apply this fix. - E30.py:701:1: E303 [*] Too many blank lines (3) | 701 | / """This class docstring comes on line 5. @@ -149,8 +135,6 @@ E30.py:701:1: E303 [*] Too many blank lines (3) 702 701 | It gives error E303: too many blank lines (3) 703 702 | """ - Run `ruff check --fix` to apply this fix. - E30.py:713:5: E303 [*] Too many blank lines (2) | 713 | def b(self): @@ -168,8 +152,6 @@ E30.py:713:5: E303 [*] Too many blank lines (2) 714 713 | pass 715 714 | # end - Run `ruff check --fix` to apply this fix. - E30.py:723:5: E303 [*] Too many blank lines (2) | 723 | a = 2 @@ -186,8 +168,6 @@ E30.py:723:5: E303 [*] Too many blank lines (2) 724 723 | # end 725 724 | - Run `ruff check --fix` to apply this fix. - E30.py:731:5: E303 [*] Too many blank lines (2) | 731 | # comment @@ -203,8 +183,6 @@ E30.py:731:5: E303 [*] Too many blank lines (2) 732 731 | 733 732 | - Run `ruff check --fix` to apply this fix. - E30.py:734:5: E303 [*] Too many blank lines (2) | 734 | # another comment @@ -222,8 +200,6 @@ E30.py:734:5: E303 [*] Too many blank lines (2) 735 734 | 736 735 | def test(self): pass - Run `ruff check --fix` to apply this fix. - E30.py:748:5: E303 [*] Too many blank lines (2) | 748 | def b(self): @@ -241,8 +217,6 @@ E30.py:748:5: E303 [*] Too many blank lines (2) 749 748 | pass 750 749 | # end - Run `ruff check --fix` to apply this fix. - E30.py:758:5: E303 [*] Too many blank lines (2) | 758 | pass @@ -257,6 +231,4 @@ E30.py:758:5: E303 [*] Too many blank lines (2) 757 |- 758 757 | pass 759 758 | # end -760 759 | - - Run `ruff check --fix` to apply this fix. +760 759 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_comment.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_comment.py.snap index 883ac567a3f7b..55ddc90b46cb6 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_comment.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_comment.py.snap @@ -15,5 +15,3 @@ E303_first_line_comment.py:5:1: E303 [*] Too many blank lines (3) 4 |- 5 4 | def fn(): 6 5 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_docstring.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_docstring.py.snap index 1dce813febffc..9df97dc235265 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_docstring.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_docstring.py.snap @@ -15,5 +15,3 @@ E303_first_line_docstring.py:5:1: E303 [*] Too many blank lines (3) 4 |- 5 4 | def fn(): 6 5 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_expression.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_expression.py.snap index f134f85bbfd3b..c7333a7f09e2b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_expression.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_expression.py.snap @@ -15,5 +15,3 @@ E303_first_line_expression.py:5:1: E303 [*] Too many blank lines (3) 4 |- 5 4 | def fn(): 6 5 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_statement.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_statement.py.snap index 70017e2516730..f0d77c292705a 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_statement.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E303_first_line_statement.py.snap @@ -15,5 +15,3 @@ E303_first_line_statement.py:5:1: E303 [*] Too many blank lines (3) 4 |- 5 4 | def fn(): 6 5 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap index f36573f435849..7bcdc8b48f60e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E304_E30.py.snap @@ -20,8 +20,6 @@ E30.py:765:1: E304 [*] Blank lines found after function decorator (1) 766 765 | pass 767 766 | # end - Run `ruff check --fix` to apply this fix. - E30.py:774:1: E304 [*] Blank lines found after function decorator (1) | 773 | # comment E304 not expected @@ -40,8 +38,6 @@ E30.py:774:1: E304 [*] Blank lines found after function decorator (1) 774 773 | def function(): 775 774 | pass - Run `ruff check --fix` to apply this fix. - E30.py:786:1: E304 [*] Blank lines found after function decorator (2) | 785 | # second comment E304 not expected @@ -62,5 +58,3 @@ E30.py:786:1: E304 [*] Blank lines found after function decorator (2) 785 782 | # second comment E304 not expected 786 783 | def function(): 787 784 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap index cbd7fba2b8cf4..f10e591882032 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30.py.snap @@ -19,8 +19,6 @@ E30.py:798:1: E305 [*] Expected 2 blank lines after class or function definition 799 801 | # end 800 802 | - Run `ruff check --fix` to apply this fix. - E30.py:809:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) | 808 | # another comment @@ -39,8 +37,6 @@ E30.py:809:1: E305 [*] Expected 2 blank lines after class or function definition 810 812 | # end 811 813 | - Run `ruff check --fix` to apply this fix. - E30.py:821:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) | 819 | # another comment @@ -60,8 +56,6 @@ E30.py:821:1: E305 [*] Expected 2 blank lines after class or function definition 822 823 | fn() 823 824 | except Exception: - Run `ruff check --fix` to apply this fix. - E30.py:833:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) | 832 | # Two spaces before comments, too. @@ -81,8 +75,6 @@ E30.py:833:1: E305 [*] Expected 2 blank lines after class or function definition 834 836 | a() 835 837 | # end - Run `ruff check --fix` to apply this fix. - E30.py:846:1: E305 [*] Expected 2 blank lines after class or function definition, found (1) | 844 | blah, blah @@ -101,5 +93,3 @@ E30.py:846:1: E305 [*] Expected 2 blank lines after class or function definition 846 847 | if __name__ == '__main__': 847 848 | main() 848 849 | # end - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30.py.snap index 7e0bb86884779..aadff5667e8c3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30.py.snap @@ -20,8 +20,6 @@ E30.py:854:5: E306 [*] Expected 1 blank line before a nested definition, found 0 855 856 | pass 856 857 | # end - Run `ruff check --fix` to apply this fix. - E30.py:862:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 860 | async def a(): @@ -41,8 +39,6 @@ E30.py:862:5: E306 [*] Expected 1 blank line before a nested definition, found 0 863 864 | pass 864 865 | # end - Run `ruff check --fix` to apply this fix. - E30.py:870:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 868 | def a(): @@ -62,8 +58,6 @@ E30.py:870:5: E306 [*] Expected 1 blank line before a nested definition, found 0 871 872 | x = 1 872 873 | def c(): - Run `ruff check --fix` to apply this fix. - E30.py:872:9: E306 [*] Expected 1 blank line before a nested definition, found 0 | 870 | def b(): @@ -83,8 +77,6 @@ E30.py:872:9: E306 [*] Expected 1 blank line before a nested definition, found 0 873 874 | pass 874 875 | # end - Run `ruff check --fix` to apply this fix. - E30.py:880:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 878 | def a(): @@ -104,8 +96,6 @@ E30.py:880:5: E306 [*] Expected 1 blank line before a nested definition, found 0 881 882 | pass 882 883 | x = 2 - Run `ruff check --fix` to apply this fix. - E30.py:883:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 881 | pass @@ -125,8 +115,6 @@ E30.py:883:5: E306 [*] Expected 1 blank line before a nested definition, found 0 884 885 | pass 885 886 | # end - Run `ruff check --fix` to apply this fix. - E30.py:892:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 890 | def bar(): @@ -145,8 +133,6 @@ E30.py:892:5: E306 [*] Expected 1 blank line before a nested definition, found 0 893 894 | # end 894 895 | - Run `ruff check --fix` to apply this fix. - E30.py:899:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 897 | def foo(): @@ -166,8 +152,6 @@ E30.py:899:5: E306 [*] Expected 1 blank line before a nested definition, found 0 900 901 | pass 901 902 | # end - Run `ruff check --fix` to apply this fix. - E30.py:907:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 905 | def a(): @@ -187,8 +171,6 @@ E30.py:907:5: E306 [*] Expected 1 blank line before a nested definition, found 0 908 909 | def b(): 909 910 | pass - Run `ruff check --fix` to apply this fix. - E30.py:916:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 914 | def a(): @@ -208,8 +190,6 @@ E30.py:916:5: E306 [*] Expected 1 blank line before a nested definition, found 0 917 918 | async def b(): 918 919 | pass - Run `ruff check --fix` to apply this fix. - E30.py:925:5: E306 [*] Expected 1 blank line before a nested definition, found 0 | 923 | def a(): @@ -228,5 +208,3 @@ E30.py:925:5: E306 [*] Expected 1 blank line before a nested definition, found 0 925 926 | async def b(): 926 927 | pass 927 928 | # end - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap index 0993a890f8e4e..41091735a399d 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E401_E40.py.snap @@ -19,8 +19,6 @@ E40.py:2:1: E401 [*] Multiple imports on one line 4 5 | #: Okay 5 6 | import os - Run `ruff check --fix` to apply this fix. - E40.py:65:1: E401 [*] Multiple imports on one line | 64 | #: E401 @@ -40,8 +38,6 @@ E40.py:65:1: E401 [*] Multiple imports on one line 67 68 | 68 69 | x = 1; import re as regex, string - Run `ruff check --fix` to apply this fix. - E40.py:66:1: E401 [*] Multiple imports on one line | 64 | #: E401 @@ -62,8 +58,6 @@ E40.py:66:1: E401 [*] Multiple imports on one line 68 68 | x = 1; import re as regex, string 69 69 | - Run `ruff check --fix` to apply this fix. - E40.py:68:8: E401 [*] Multiple imports on one line | 66 | import re as regex, string; x = 1 @@ -82,8 +76,6 @@ E40.py:68:8: E401 [*] Multiple imports on one line 70 70 | 71 71 | def blah(): - Run `ruff check --fix` to apply this fix. - E40.py:72:5: E401 [*] Multiple imports on one line | 71 | def blah(): @@ -104,8 +96,6 @@ E40.py:72:5: E401 [*] Multiple imports on one line 74 75 | def nested_and_tested(): 75 76 | import builtins, textwrap as tw - Run `ruff check --fix` to apply this fix. - E40.py:75:9: E401 [*] Multiple imports on one line | 74 | def nested_and_tested(): @@ -126,8 +116,6 @@ E40.py:75:9: E401 [*] Multiple imports on one line 77 78 | x = 1; import re as regex, string 78 79 | import re as regex, string; x = 1 - Run `ruff check --fix` to apply this fix. - E40.py:77:16: E401 [*] Multiple imports on one line | 75 | import builtins, textwrap as tw @@ -147,8 +135,6 @@ E40.py:77:16: E401 [*] Multiple imports on one line 79 79 | 80 80 | if True: import re as regex, string - Run `ruff check --fix` to apply this fix. - E40.py:78:9: E401 [*] Multiple imports on one line | 77 | x = 1; import re as regex, string @@ -167,8 +153,6 @@ E40.py:78:9: E401 [*] Multiple imports on one line 79 79 | 80 80 | if True: import re as regex, string - Run `ruff check --fix` to apply this fix. - E40.py:80:14: E401 [*] Multiple imports on one line | 78 | import re as regex, string; x = 1 @@ -183,5 +167,3 @@ E40.py:80:14: E401 [*] Multiple imports on one line 79 79 | 80 |- if True: import re as regex, string 80 |+ if True: import re as regex; import string - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E70.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E70.py.snap index 3db9ba2ca588c..8453b5e546219 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E70.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E70.py.snap @@ -21,8 +21,6 @@ E70.py:10:13: E703 [*] Statement ends with an unnecessary semicolon 12 12 | del a[:]; a.append(42); 13 13 | #: E704:1:1 - Run `ruff check --fix` to apply this fix. - E70.py:12:23: E703 [*] Statement ends with an unnecessary semicolon | 10 | import shlex; @@ -43,8 +41,6 @@ E70.py:12:23: E703 [*] Statement ends with an unnecessary semicolon 14 14 | def f(x): return 2 15 15 | #: E704:1:1 - Run `ruff check --fix` to apply this fix. - E70.py:25:14: E703 [*] Statement ends with an unnecessary semicolon | 23 | def f(x): return 2*x @@ -65,8 +61,6 @@ E70.py:25:14: E703 [*] Statement ends with an unnecessary semicolon 27 27 | if True: lambda a: b 28 28 | #: E701:1:10 - Run `ruff check --fix` to apply this fix. - E70.py:68:1: E703 [*] Statement ends with an unnecessary semicolon | 66 | #: E703:2:1 @@ -88,8 +82,6 @@ E70.py:68:1: E703 [*] Statement ends with an unnecessary semicolon 70 69 | a = \ 71 70 | 5; - Run `ruff check --fix` to apply this fix. - E70.py:71:4: E703 [*] Statement ends with an unnecessary semicolon | 69 | #: E701:2:3 @@ -108,5 +100,3 @@ E70.py:71:4: E703 [*] Statement ends with an unnecessary semicolon 71 |+ 5 72 72 | #: 73 73 | with x(y) as z: ... - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E703.ipynb.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E703.ipynb.snap index 96f5112847bf5..da8ac71b83709 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E703.ipynb.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E703_E703.ipynb.snap @@ -21,8 +21,6 @@ E703.ipynb:5:2: E703 [*] Statement ends with an unnecessary semicolon 7 7 | # Nested expressions isn't relevant 8 8 | if True: - Run `ruff check --fix` to apply this fix. - E703.ipynb:9:6: E703 [*] Statement ends with an unnecessary semicolon | 7 | # Nested expressions isn't relevant @@ -42,5 +40,3 @@ E703.ipynb:9:6: E703 [*] Statement ends with an unnecessary semicolon 10 10 | # Semicolons with multiple expressions 11 11 | x; x; 12 12 | # Comments, newlines and whitespace - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E713_E713.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E713_E713.py.snap index 368c81dc21dfb..623bf51b5b50d 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E713_E713.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E713_E713.py.snap @@ -18,8 +18,6 @@ E713.py:2:8: E713 [*] Test for membership should be `not in` 4 4 | #: E713 5 5 | if not X.B in Y: - Run `ruff check --fix` to apply this fix. - E713.py:5:8: E713 [*] Test for membership should be `not in` | 3 | pass @@ -40,8 +38,6 @@ E713.py:5:8: E713 [*] Test for membership should be `not in` 7 7 | #: E713 8 8 | if not X in Y and Z == "zero": - Run `ruff check --fix` to apply this fix. - E713.py:8:8: E713 [*] Test for membership should be `not in` | 6 | pass @@ -62,8 +58,6 @@ E713.py:8:8: E713 [*] Test for membership should be `not in` 10 10 | #: E713 11 11 | if X == "zero" or not Y in Z: - Run `ruff check --fix` to apply this fix. - E713.py:11:23: E713 [*] Test for membership should be `not in` | 9 | pass @@ -84,8 +78,6 @@ E713.py:11:23: E713 [*] Test for membership should be `not in` 13 13 | #: E713 14 14 | if not (X in Y): - Run `ruff check --fix` to apply this fix. - E713.py:14:9: E713 [*] Test for membership should be `not in` | 12 | pass @@ -105,8 +97,6 @@ E713.py:14:9: E713 [*] Test for membership should be `not in` 16 16 | 17 17 | #: Okay - Run `ruff check --fix` to apply this fix. - E713.py:40:12: E713 [*] Test for membership should be `not in` | 38 | assert [42, not foo] in bar @@ -121,5 +111,3 @@ E713.py:40:12: E713 [*] Test for membership should be `not in` 39 39 | assert not (re.search(r"^.:\\Users\\[^\\]*\\Downloads\\.*") is None) 40 |-assert not('name' in request)or not request['name'] 40 |+assert 'name' not in request or not request['name'] - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E714_E714.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E714_E714.py.snap index ab11cdebfec14..a8afb1cf7c7a2 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E714_E714.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E714_E714.py.snap @@ -18,8 +18,6 @@ E714.py:2:8: E714 [*] Test for object identity should be `is not` 4 4 | #: E714 5 5 | if not X.B is Y: - Run `ruff check --fix` to apply this fix. - E714.py:5:8: E714 [*] Test for object identity should be `is not` | 3 | pass @@ -39,8 +37,6 @@ E714.py:5:8: E714 [*] Test for object identity should be `is not` 7 7 | 8 8 | #: Okay - Run `ruff check --fix` to apply this fix. - E714.py:39:13: E714 [*] Test for object identity should be `is not` | 37 | assert {"x": not foo} in bar @@ -55,5 +51,3 @@ E714.py:39:13: E714 [*] Test for object identity should be `is not` 38 38 | assert [42, not foo] in bar 39 |-assert not (re.search(r"^.:\\Users\\[^\\]*\\Downloads\\.*") is None) 39 |+assert re.search(r"^.:\\Users\\[^\\]*\\Downloads\\.*") is not None - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W29.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W29.py.snap index 4f7211b5a196a..8d7e8caca1ffe 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W29.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W29.py.snap @@ -21,8 +21,6 @@ W29.py:4:6: W291 [*] Trailing whitespace 6 6 | class Foo(object): 7 7 | - Run `ruff check --fix` to apply this fix. - W29.py:11:35: W291 [*] Trailing whitespace | 9 | #: W291:2:35 @@ -43,8 +41,6 @@ W29.py:11:35: W291 [*] Trailing whitespace 13 13 | x = 1 14 14 | #: W191 W292 noeol - Run `ruff check --fix` to apply this fix. - W29.py:13:6: W291 [*] Trailing whitespace | 11 | string with trailing whitespace''' @@ -64,5 +60,3 @@ W29.py:13:6: W291 [*] Trailing whitespace 14 14 | #: W191 W292 noeol 15 15 | if False: 16 16 | pass # indented with tabs - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap index 179295e621ef4..8b4a07133cd1e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W291_W291.py.snap @@ -40,8 +40,6 @@ W291.py:8:8: W291 [*] Trailing whitespace 10 10 | }' 11 11 | - Run `ruff check --fix` to apply this fix. - W291.py:14:10: W291 [*] Trailing whitespace | 12 | # Trailing whitespace after `2` @@ -58,5 +56,3 @@ W291.py:14:10: W291 [*] Trailing whitespace 14 |- 1 + 2 14 |+ 1 + 2 15 15 | }' - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W292_W292_0.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W292_W292_0.py.snap index 5ef72fcad084f..ebb8412ff18c4 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W292_W292_0.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W292_W292_0.py.snap @@ -12,5 +12,3 @@ W292_0.py:2:9: W292 [*] No newline at end of file 1 1 | def fn() -> None: 2 |- pass 2 |+ pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W29.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W29.py.snap index bb3c4d95f1a10..2c3720573c6e6 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W29.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W29.py.snap @@ -20,5 +20,3 @@ W29.py:7:1: W293 [*] Blank line contains whitespace 8 8 | bang = 12 9 9 | #: W291:2:35 10 10 | '''multiline - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap index 48a12b1fbde37..9ea4e80e8b37b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W293_W293.py.snap @@ -32,8 +32,6 @@ W293.py:10:1: W293 [*] Blank line contains whitespace 12 10 | 13 11 | "abc\ - Run `ruff check --fix` to apply this fix. - W293.py:16:1: W293 [*] Blank line contains whitespace | 14 | " \ @@ -55,8 +53,6 @@ W293.py:16:1: W293 [*] Blank line contains whitespace 18 16 | 19 17 | inside a multiline string''' - Run `ruff check --fix` to apply this fix. - W293.py:18:1: W293 [*] Blank line contains whitespace | 17 | '''blank line with whitespace diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_0.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_0.py.snap index 3487a52ec6a3e..e4278d78b70ff 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_0.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_0.py.snap @@ -18,8 +18,6 @@ W605_0.py:2:10: W605 [*] Invalid escape sequence: `\.` 4 4 | #: W605:2:1 5 5 | regex = ''' - Run `ruff check --fix` to apply this fix. - W605_0.py:6:1: W605 [*] Invalid escape sequence: `\.` | 4 | #: W605:2:1 @@ -39,8 +37,6 @@ W605_0.py:6:1: W605 [*] Invalid escape sequence: `\.` 7 7 | ''' 8 8 | - Run `ruff check --fix` to apply this fix. - W605_0.py:11:6: W605 [*] Invalid escape sequence: `\_` | 9 | #: W605:2:6 @@ -60,8 +56,6 @@ W605_0.py:11:6: W605 [*] Invalid escape sequence: `\_` 13 13 | 14 14 | #: W605:4:6 - Run `ruff check --fix` to apply this fix. - W605_0.py:18:6: W605 [*] Invalid escape sequence: `\_` | 16 | multi-line @@ -82,8 +76,6 @@ W605_0.py:18:6: W605 [*] Invalid escape sequence: `\_` 17 17 | literal 18 18 | with \_ somewhere - Run `ruff check --fix` to apply this fix. - W605_0.py:23:39: W605 [*] Invalid escape sequence: `\_` | 22 | #: W605:1:38 @@ -101,8 +93,6 @@ W605_0.py:23:39: W605 [*] Invalid escape sequence: `\_` 25 25 | 26 26 | def f(): - Run `ruff check --fix` to apply this fix. - W605_0.py:28:12: W605 [*] Invalid escape sequence: `\.` | 26 | def f(): @@ -123,8 +113,6 @@ W605_0.py:28:12: W605 [*] Invalid escape sequence: `\.` 30 30 | #: Okay 31 31 | regex = r'\.png$' - Run `ruff check --fix` to apply this fix. - W605_0.py:45:12: W605 [*] Invalid escape sequence: `\_` | 43 | ''' # noqa @@ -145,8 +133,6 @@ W605_0.py:45:12: W605 [*] Invalid escape sequence: `\_` 47 47 | #: W605:1:7 48 48 | u'foo\ bar' - Run `ruff check --fix` to apply this fix. - W605_0.py:48:6: W605 [*] Invalid escape sequence: `\ ` | 47 | #: W605:1:7 @@ -166,8 +152,6 @@ W605_0.py:48:6: W605 [*] Invalid escape sequence: `\ ` 50 50 | #: W605:1:13 51 51 | ( - Run `ruff check --fix` to apply this fix. - W605_0.py:53:9: W605 [*] Invalid escape sequence: `\.` | 51 | ( @@ -187,8 +171,6 @@ W605_0.py:53:9: W605 [*] Invalid escape sequence: `\.` 55 55 | 56 56 | #: W605:1:6 - Run `ruff check --fix` to apply this fix. - W605_0.py:57:6: W605 [*] Invalid escape sequence: `\.` | 56 | #: W605:1:6 @@ -208,8 +190,6 @@ W605_0.py:57:6: W605 [*] Invalid escape sequence: `\.` 59 59 | #: W605:1:13 60 60 | "foo \t bar \." - Run `ruff check --fix` to apply this fix. - W605_0.py:60:13: W605 [*] Invalid escape sequence: `\.` | 59 | #: W605:1:13 @@ -223,5 +203,3 @@ W605_0.py:60:13: W605 [*] Invalid escape sequence: `\.` 59 59 | #: W605:1:13 60 |-"foo \t bar \." 60 |+"foo \t bar \\." - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_1.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_1.py.snap index 07d2088731e50..d46290fdab078 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_1.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_1.py.snap @@ -20,8 +20,6 @@ W605_1.py:4:11: W605 [*] Invalid escape sequence: `\.` 6 6 | #: W605:2:1 7 7 | regex = f''' - Run `ruff check --fix` to apply this fix. - W605_1.py:8:1: W605 [*] Invalid escape sequence: `\.` | 6 | #: W605:2:1 @@ -41,8 +39,6 @@ W605_1.py:8:1: W605 [*] Invalid escape sequence: `\.` 9 9 | ''' 10 10 | - Run `ruff check --fix` to apply this fix. - W605_1.py:13:7: W605 [*] Invalid escape sequence: `\_` | 11 | #: W605:2:6 @@ -62,8 +58,6 @@ W605_1.py:13:7: W605 [*] Invalid escape sequence: `\_` 15 15 | 16 16 | #: W605:4:6 - Run `ruff check --fix` to apply this fix. - W605_1.py:20:6: W605 [*] Invalid escape sequence: `\_` | 18 | multi-line @@ -84,8 +78,6 @@ W605_1.py:20:6: W605 [*] Invalid escape sequence: `\_` 19 19 | literal 20 20 | with \_ somewhere - Run `ruff check --fix` to apply this fix. - W605_1.py:25:40: W605 [*] Invalid escape sequence: `\_` | 24 | #: W605:1:38 @@ -103,8 +95,6 @@ W605_1.py:25:40: W605 [*] Invalid escape sequence: `\_` 27 27 | 28 28 | #: Okay - Run `ruff check --fix` to apply this fix. - W605_1.py:43:13: W605 [*] Invalid escape sequence: `\_` | 41 | ''' # noqa @@ -125,8 +115,6 @@ W605_1.py:43:13: W605 [*] Invalid escape sequence: `\_` 45 45 | value = f'\{1}' 46 46 | value = f'{1:\}' - Run `ruff check --fix` to apply this fix. - W605_1.py:44:11: W605 [*] Invalid escape sequence: `\{` | 43 | regex = f'\\\_' @@ -146,8 +134,6 @@ W605_1.py:44:11: W605 [*] Invalid escape sequence: `\{` 46 46 | value = f'{1:\}' 47 47 | value = f"{f"\{1}"}" - Run `ruff check --fix` to apply this fix. - W605_1.py:45:11: W605 [*] Invalid escape sequence: `\{` | 43 | regex = f'\\\_' @@ -168,8 +154,6 @@ W605_1.py:45:11: W605 [*] Invalid escape sequence: `\{` 47 47 | value = f"{f"\{1}"}" 48 48 | value = rf"{f"\{1}"}" - Run `ruff check --fix` to apply this fix. - W605_1.py:46:14: W605 [*] Invalid escape sequence: `\}` | 44 | value = f'\{{1}}' @@ -190,8 +174,6 @@ W605_1.py:46:14: W605 [*] Invalid escape sequence: `\}` 48 48 | value = rf"{f"\{1}"}" 49 49 | - Run `ruff check --fix` to apply this fix. - W605_1.py:47:14: W605 [*] Invalid escape sequence: `\{` | 45 | value = f'\{1}' @@ -211,8 +193,6 @@ W605_1.py:47:14: W605 [*] Invalid escape sequence: `\{` 49 49 | 50 50 | # Okay - Run `ruff check --fix` to apply this fix. - W605_1.py:48:15: W605 [*] Invalid escape sequence: `\{` | 46 | value = f'{1:\}' @@ -233,8 +213,6 @@ W605_1.py:48:15: W605 [*] Invalid escape sequence: `\{` 50 50 | # Okay 51 51 | value = rf'\{{1}}' - Run `ruff check --fix` to apply this fix. - W605_1.py:57:9: W605 [*] Invalid escape sequence: `\d` | 56 | # Regression tests for https://github.com/astral-sh/ruff/issues/10434 @@ -253,8 +231,6 @@ W605_1.py:57:9: W605 [*] Invalid escape sequence: `\d` 58 58 | f"\n{{}}+-\d+" 59 59 | f"\n{{}}�+-\d+" - Run `ruff check --fix` to apply this fix. - W605_1.py:58:11: W605 [*] Invalid escape sequence: `\d` | 56 | # Regression tests for https://github.com/astral-sh/ruff/issues/10434 @@ -272,8 +248,6 @@ W605_1.py:58:11: W605 [*] Invalid escape sequence: `\d` 58 |+f"\n{{}}+-\\d+" 59 59 | f"\n{{}}�+-\d+" - Run `ruff check --fix` to apply this fix. - W605_1.py:59:12: W605 [*] Invalid escape sequence: `\d` | 57 | f"{{}}+-\d" @@ -288,5 +262,3 @@ W605_1.py:59:12: W605 [*] Invalid escape sequence: `\d` 58 58 | f"\n{{}}+-\d+" 59 |-f"\n{{}}�+-\d+" 59 |+f"\n{{}}�+-\\d+" - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E301_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E301_notebook.snap index 90dfcb9bf7330..fb10cd76046bb 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E301_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E301_notebook.snap @@ -19,5 +19,3 @@ E30.ipynb:13:5: E301 [*] Expected 1 blank line, found 0 13 14 | @classmethod 14 15 | def cls_method(cls) -> None: 15 16 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap index 2c2c7a34345a8..8f89a9dbf632e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E302_notebook.snap @@ -19,5 +19,3 @@ E30.ipynb:21:1: E302 [*] Expected 2 blank lines, found 1 21 22 | def b(): 22 23 | pass 23 24 | # end - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap index f8ac6e51c3524..32e286d3b40f5 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_notebook.snap @@ -18,8 +18,6 @@ E30.ipynb:29:5: E303 [*] Too many blank lines (2) 30 29 | 31 30 | def inner(): # E306 not expected (pycodestyle detects E306) - Run `ruff check --fix` to apply this fix. - E30.ipynb:39:1: E303 [*] Too many blank lines (4) | 39 | def fn(): @@ -37,5 +35,3 @@ E30.ipynb:39:1: E303 [*] Too many blank lines (4) 39 37 | def fn(): 40 38 | pass 41 39 | # end - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_typing_stub.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_typing_stub.snap index cad9326985a5c..2b50d7cf940b3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_typing_stub.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E303_typing_stub.snap @@ -18,8 +18,6 @@ E30.pyi:17:1: E303 [*] Too many blank lines (2) 18 17 | def grouped2(): ... 19 18 | def grouped3( ): ... - Run `ruff check --fix` to apply this fix. - E30.pyi:22:1: E303 [*] Too many blank lines (2) | 22 | class BackendProxy: @@ -37,8 +35,6 @@ E30.pyi:22:1: E303 [*] Too many blank lines (2) 23 22 | backend_module: str 24 23 | backend_object: str | None - Run `ruff check --fix` to apply this fix. - E30.pyi:35:5: E303 [*] Too many blank lines (2) | 35 | def ungrouped(): ... @@ -55,8 +51,6 @@ E30.pyi:35:5: E303 [*] Too many blank lines (2) 36 35 | a = "test" 37 36 | - Run `ruff check --fix` to apply this fix. - E30.pyi:43:1: E303 [*] Too many blank lines (2) | 43 | def outer(): @@ -73,5 +67,3 @@ E30.pyi:43:1: E303 [*] Too many blank lines (2) 43 42 | def outer(): 44 43 | def inner(): 45 44 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap index e1a34824ad6d0..ec439a3263389 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_notebook.snap @@ -19,5 +19,3 @@ E30.ipynb:45:1: E304 [*] Blank lines found after function decorator (1) 45 44 | def function(): 46 45 | pass 47 46 | # end - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_typing_stub.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_typing_stub.snap index f733c7bc60f84..733465fca1b9c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_typing_stub.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E304_typing_stub.snap @@ -16,6 +16,4 @@ E30.pyi:32:5: E304 [*] Blank lines found after function decorator (1) 31 |- 32 31 | def with_blank_line(): ... 33 32 | -34 33 | - - Run `ruff check --fix` to apply this fix. +34 33 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E305_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E305_notebook.snap index 531153a81af0e..00528a2e121cc 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E305_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E305_notebook.snap @@ -19,5 +19,3 @@ E30.ipynb:55:1: E305 [*] Expected 2 blank lines after class or function definiti 55 57 | fn() 56 58 | # end 57 59 | # E306:3:5 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E306_notebook.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E306_notebook.snap index 2dea5bca3a280..f94fc15923655 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E306_notebook.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_E306_notebook.snap @@ -19,5 +19,3 @@ E30.ipynb:60:5: E306 [*] Expected 1 blank line before a nested definition, found 60 61 | def b(): 61 62 | pass 62 63 | # end - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(-1)-between(0).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(-1)-between(0).snap index b11cfa0fd3468..c2b25bfc811aa 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(-1)-between(0).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(-1)-between(0).snap @@ -23,8 +23,6 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted 6 3 | 7 4 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 | 21 | abcd.foo() @@ -44,8 +42,6 @@ E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 24 25 | 25 26 | if TYPE_CHECKING: - Run `ruff check --fix` to apply this fix. - E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -70,8 +66,6 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 | 33 | abcd.foo() @@ -90,8 +84,6 @@ E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 36 37 | ... 37 38 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 | 39 | from typing_extensions import TypeAlias @@ -110,8 +102,6 @@ E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 42 43 | ... 43 44 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | 60 | / from typing import Any, Sequence @@ -127,8 +117,6 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted 62 |+ 62 63 | class MissingCommand(TypeError): ... # noqa: N818 - Run `ruff check --fix` to apply this fix. - E30_isort.py:62:1: E302 [*] Expected 2 blank lines, found 1 | 60 | from typing import Any, Sequence @@ -143,5 +131,3 @@ E30_isort.py:62:1: E302 [*] Expected 2 blank lines, found 1 61 61 | 62 |+ 62 63 | class MissingCommand(TypeError): ... # noqa: N818 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(0)-between(0).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(0)-between(0).snap index a45f6803c6c01..99b01df5d38fc 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(0)-between(0).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(0)-between(0).snap @@ -26,8 +26,6 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted 9 4 | 10 5 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 | 21 | abcd.foo() @@ -47,8 +45,6 @@ E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 24 25 | 25 26 | if TYPE_CHECKING: - Run `ruff check --fix` to apply this fix. - E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -73,8 +69,6 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 | 33 | abcd.foo() @@ -93,8 +87,6 @@ E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 36 37 | ... 37 38 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 | 39 | from typing_extensions import TypeAlias @@ -113,8 +105,6 @@ E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 42 43 | ... 43 44 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | 60 | / from typing import Any, Sequence @@ -129,5 +119,3 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted 60 60 | from typing import Any, Sequence 61 |- 62 61 | class MissingCommand(TypeError): ... # noqa: N818 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(1)-between(1).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(1)-between(1).snap index 8529d8f36f275..cbd87faf91487 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(1)-between(1).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(1)-between(1).snap @@ -25,8 +25,6 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted 8 5 | class MissingCommand(TypeError): ... # noqa: N818 9 6 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 | 21 | abcd.foo() @@ -46,8 +44,6 @@ E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 24 25 | 25 26 | if TYPE_CHECKING: - Run `ruff check --fix` to apply this fix. - E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -72,8 +68,6 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 | 33 | abcd.foo() @@ -92,8 +86,6 @@ E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 36 37 | ... 37 38 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 | 39 | from typing_extensions import TypeAlias @@ -110,6 +102,4 @@ E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 41 |+ 41 42 | def __call__2(self, name: str, *args: Any, **kwargs: Any) -> Any: 42 43 | ... -43 44 | - - Run `ruff check --fix` to apply this fix. +43 44 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(4)-between(4).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(4)-between(4).snap index 653655a97d9ab..b8236a3f366ed 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(4)-between(4).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_top_level_isort_compatibility-lines-after(4)-between(4).snap @@ -28,8 +28,6 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted 9 12 | 10 13 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:8:1: E302 [*] Expected 4 blank lines, found 2 | 8 | class MissingCommand(TypeError): ... # noqa: N818 @@ -46,8 +44,6 @@ E30_isort.py:8:1: E302 [*] Expected 4 blank lines, found 2 9 11 | 10 12 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 | 21 | abcd.foo() @@ -67,8 +63,6 @@ E30_isort.py:23:1: E302 [*] Expected 2 blank lines, found 1 24 25 | 25 26 | if TYPE_CHECKING: - Run `ruff check --fix` to apply this fix. - E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -93,8 +87,6 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 | 33 | abcd.foo() @@ -113,8 +105,6 @@ E30_isort.py:35:1: E302 [*] Expected 2 blank lines, found 1 36 37 | ... 37 38 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 | 39 | from typing_extensions import TypeAlias @@ -133,8 +123,6 @@ E30_isort.py:41:1: E302 [*] Expected 2 blank lines, found 1 42 43 | ... 43 44 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | 60 | / from typing import Any, Sequence @@ -152,8 +140,6 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted 64 |+ 62 65 | class MissingCommand(TypeError): ... # noqa: N818 - Run `ruff check --fix` to apply this fix. - E30_isort.py:62:1: E302 [*] Expected 4 blank lines, found 1 | 60 | from typing import Any, Sequence @@ -170,5 +156,3 @@ E30_isort.py:62:1: E302 [*] Expected 4 blank lines, found 1 63 |+ 64 |+ 62 65 | class MissingCommand(TypeError): ... # noqa: N818 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_typing_stub_isort.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_typing_stub_isort.snap index b39772aaa74ec..41188f1e2a35d 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_typing_stub_isort.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__blank_lines_typing_stub_isort.snap @@ -25,8 +25,6 @@ E30_isort.pyi:1:1: I001 [*] Import block is un-sorted or un-formatted 8 4 | class MissingCommand(TypeError): ... # noqa: N818 9 5 | - Run `ruff check --fix` to apply this fix. - E30_isort.pyi:5:1: E303 [*] Too many blank lines (3) | 5 | from typing import Any, Sequence @@ -42,8 +40,6 @@ E30_isort.pyi:5:1: E303 [*] Too many blank lines (3) 6 4 | 7 5 | - Run `ruff check --fix` to apply this fix. - E30_isort.pyi:8:1: E303 [*] Too many blank lines (2) | 8 | class MissingCommand(TypeError): ... # noqa: N818 @@ -59,8 +55,6 @@ E30_isort.pyi:8:1: E303 [*] Too many blank lines (2) 9 8 | 10 9 | - Run `ruff check --fix` to apply this fix. - E30_isort.pyi:11:1: E303 [*] Too many blank lines (2) | 11 | class BackendProxy: @@ -78,8 +72,6 @@ E30_isort.pyi:11:1: E303 [*] Too many blank lines (2) 12 11 | backend_module: str 13 12 | backend_object: str | None - Run `ruff check --fix` to apply this fix. - E30_isort.pyi:17:1: E303 [*] Too many blank lines (2) | 17 | if __name__ == "__main__": @@ -96,8 +88,6 @@ E30_isort.pyi:17:1: E303 [*] Too many blank lines (2) 18 17 | import abcd 19 18 | - Run `ruff check --fix` to apply this fix. - E30_isort.pyi:21:5: E303 [*] Too many blank lines (2) | 21 | abcd.foo() @@ -115,8 +105,6 @@ E30_isort.pyi:21:5: E303 [*] Too many blank lines (2) 22 21 | 23 22 | def __init__(self, backend_module: str, backend_obj: str | None) -> None: ... - Run `ruff check --fix` to apply this fix. - E30_isort.pyi:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -141,8 +129,6 @@ E30_isort.pyi:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | - Run `ruff check --fix` to apply this fix. - E30_isort.pyi:30:5: E303 [*] Too many blank lines (3) | 30 | from typing_extensions import TypeAlias @@ -159,8 +145,6 @@ E30_isort.pyi:30:5: E303 [*] Too many blank lines (3) 31 29 | 32 30 | - Run `ruff check --fix` to apply this fix. - E30_isort.pyi:33:5: E303 [*] Too many blank lines (2) | 33 | abcd.foo() @@ -178,8 +162,6 @@ E30_isort.pyi:33:5: E303 [*] Too many blank lines (2) 34 33 | 35 34 | def __call__(self, name: str, *args: Any, **kwargs: Any) -> Any: - Run `ruff check --fix` to apply this fix. - E30_isort.pyi:45:1: E303 [*] Too many blank lines (2) | 45 | def _exit(self) -> None: ... @@ -195,8 +177,6 @@ E30_isort.pyi:45:1: E303 [*] Too many blank lines (2) 46 45 | 47 46 | - Run `ruff check --fix` to apply this fix. - E30_isort.pyi:48:1: E303 [*] Too many blank lines (2) | 48 | def _optional_commands(self) -> dict[str, bool]: ... @@ -212,8 +192,6 @@ E30_isort.pyi:48:1: E303 [*] Too many blank lines (2) 49 48 | 50 49 | - Run `ruff check --fix` to apply this fix. - E30_isort.pyi:51:1: E303 [*] Too many blank lines (2) | 51 | def run(argv: Sequence[str]) -> int: ... @@ -229,8 +207,6 @@ E30_isort.pyi:51:1: E303 [*] Too many blank lines (2) 52 51 | 53 52 | - Run `ruff check --fix` to apply this fix. - E30_isort.pyi:54:1: E303 [*] Too many blank lines (2) | 54 | def read_line(fd: int = 0) -> bytearray: ... @@ -246,8 +222,6 @@ E30_isort.pyi:54:1: E303 [*] Too many blank lines (2) 55 54 | 56 55 | - Run `ruff check --fix` to apply this fix. - E30_isort.pyi:57:1: E303 [*] Too many blank lines (2) | 57 | def flush() -> None: ... @@ -263,8 +237,6 @@ E30_isort.pyi:57:1: E303 [*] Too many blank lines (2) 58 57 | 59 58 | - Run `ruff check --fix` to apply this fix. - E30_isort.pyi:60:1: E303 [*] Too many blank lines (2) | 60 | from typing import Any, Sequence @@ -281,5 +253,3 @@ E30_isort.pyi:60:1: E303 [*] Too many blank lines (2) 60 59 | from typing import Any, Sequence 61 60 | 62 61 | class MissingCommand(TypeError): ... # noqa: N818 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap index 26bb7653bf4f8..72ef6a331a134 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap @@ -21,8 +21,6 @@ constant_literals.py:4:4: F632 [*] Use `==` to compare constant literals 6 6 | if "abc" is None: # F632 (fix, but leaves behind unfixable E711) 7 7 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:6:4: F632 [*] Use `==` to compare constant literals | 4 | if "abc" is "def": # F632 (fix) @@ -43,8 +41,6 @@ constant_literals.py:6:4: F632 [*] Use `==` to compare constant literals 8 8 | if None is "abc": # F632 (fix, but leaves behind unfixable E711) 9 9 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:8:4: F632 [*] Use `==` to compare constant literals | 6 | if "abc" is None: # F632 (fix, but leaves behind unfixable E711) @@ -65,8 +61,6 @@ constant_literals.py:8:4: F632 [*] Use `==` to compare constant literals 10 10 | if "abc" is False: # F632 (fix, but leaves behind unfixable E712) 11 11 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:10:4: F632 [*] Use `==` to compare constant literals | 8 | if None is "abc": # F632 (fix, but leaves behind unfixable E711) @@ -87,8 +81,6 @@ constant_literals.py:10:4: F632 [*] Use `==` to compare constant literals 12 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) 13 13 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:12:4: F632 [*] Use `==` to compare constant literals | 10 | if "abc" is False: # F632 (fix, but leaves behind unfixable E712) @@ -109,8 +101,6 @@ constant_literals.py:12:4: F632 [*] Use `==` to compare constant literals 14 14 | if False == None: # E711, E712 (fix) 15 15 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:14:4: E712 [*] Avoid equality comparisons to `False`; use `if not None:` for false checks | 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) @@ -176,8 +166,6 @@ constant_literals.py:20:4: F632 [*] Use `==` to compare constant literals 22 22 | if named_var is []: # F632 (fix) 23 23 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:22:4: F632 [*] Use `==` to compare constant literals | 20 | if [] is []: # F632 (fix) @@ -198,8 +186,6 @@ constant_literals.py:22:4: F632 [*] Use `==` to compare constant literals 24 24 | if [] is named_var: # F632 (fix) 25 25 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:24:4: F632 [*] Use `==` to compare constant literals | 22 | if named_var is []: # F632 (fix) @@ -220,8 +206,6 @@ constant_literals.py:24:4: F632 [*] Use `==` to compare constant literals 26 26 | if named_var is [1]: # F632 (fix) 27 27 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:26:4: F632 [*] Use `==` to compare constant literals | 24 | if [] is named_var: # F632 (fix) @@ -242,8 +226,6 @@ constant_literals.py:26:4: F632 [*] Use `==` to compare constant literals 28 28 | if [1] is named_var: # F632 (fix) 29 29 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:28:4: F632 [*] Use `==` to compare constant literals | 26 | if named_var is [1]: # F632 (fix) @@ -264,8 +246,6 @@ constant_literals.py:28:4: F632 [*] Use `==` to compare constant literals 30 30 | if named_var is [i for i in [1]]: # F632 (fix) 31 31 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:30:4: F632 [*] Use `==` to compare constant literals | 28 | if [1] is named_var: # F632 (fix) @@ -285,8 +265,6 @@ constant_literals.py:30:4: F632 [*] Use `==` to compare constant literals 32 32 | 33 33 | named_var = {} - Run `ruff check --fix` to apply this fix. - constant_literals.py:34:4: F632 [*] Use `==` to compare constant literals | 33 | named_var = {} @@ -306,8 +284,6 @@ constant_literals.py:34:4: F632 [*] Use `==` to compare constant literals 36 36 | if named_var is {}: # F632 (fix) 37 37 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:36:4: F632 [*] Use `==` to compare constant literals | 34 | if {} is {}: # F632 (fix) @@ -328,8 +304,6 @@ constant_literals.py:36:4: F632 [*] Use `==` to compare constant literals 38 38 | if {} is named_var: # F632 (fix) 39 39 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:38:4: F632 [*] Use `==` to compare constant literals | 36 | if named_var is {}: # F632 (fix) @@ -350,8 +324,6 @@ constant_literals.py:38:4: F632 [*] Use `==` to compare constant literals 40 40 | if named_var is {1}: # F632 (fix) 41 41 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:40:4: F632 [*] Use `==` to compare constant literals | 38 | if {} is named_var: # F632 (fix) @@ -372,8 +344,6 @@ constant_literals.py:40:4: F632 [*] Use `==` to compare constant literals 42 42 | if {1} is named_var: # F632 (fix) 43 43 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:42:4: F632 [*] Use `==` to compare constant literals | 40 | if named_var is {1}: # F632 (fix) @@ -394,8 +364,6 @@ constant_literals.py:42:4: F632 [*] Use `==` to compare constant literals 44 44 | if named_var is {i for i in [1]}: # F632 (fix) 45 45 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:44:4: F632 [*] Use `==` to compare constant literals | 42 | if {1} is named_var: # F632 (fix) @@ -415,8 +383,6 @@ constant_literals.py:44:4: F632 [*] Use `==` to compare constant literals 46 46 | 47 47 | named_var = {1: 1} - Run `ruff check --fix` to apply this fix. - constant_literals.py:48:4: F632 [*] Use `==` to compare constant literals | 47 | named_var = {1: 1} @@ -436,8 +402,6 @@ constant_literals.py:48:4: F632 [*] Use `==` to compare constant literals 50 50 | if named_var is {1: 1}: # F632 (fix) 51 51 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:50:4: F632 [*] Use `==` to compare constant literals | 48 | if {1: 1} is {1: 1}: # F632 (fix) @@ -458,8 +422,6 @@ constant_literals.py:50:4: F632 [*] Use `==` to compare constant literals 52 52 | if {1: 1} is named_var: # F632 (fix) 53 53 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:52:4: F632 [*] Use `==` to compare constant literals | 50 | if named_var is {1: 1}: # F632 (fix) @@ -480,8 +442,6 @@ constant_literals.py:52:4: F632 [*] Use `==` to compare constant literals 54 54 | if named_var is {1: 1}: # F632 (fix) 55 55 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:54:4: F632 [*] Use `==` to compare constant literals | 52 | if {1: 1} is named_var: # F632 (fix) @@ -502,8 +462,6 @@ constant_literals.py:54:4: F632 [*] Use `==` to compare constant literals 56 56 | if {1: 1} is named_var: # F632 (fix) 57 57 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:56:4: F632 [*] Use `==` to compare constant literals | 54 | if named_var is {1: 1}: # F632 (fix) @@ -524,8 +482,6 @@ constant_literals.py:56:4: F632 [*] Use `==` to compare constant literals 58 58 | if named_var is {i: 1 for i in [1]}: # F632 (fix) 59 59 | pass - Run `ruff check --fix` to apply this fix. - constant_literals.py:58:4: F632 [*] Use `==` to compare constant literals | 56 | if {1: 1} is named_var: # F632 (fix) @@ -544,5 +500,3 @@ constant_literals.py:58:4: F632 [*] Use `==` to compare constant literals 59 59 | pass 60 60 | 61 61 | ### - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap index 8f354a5380de1..ea42b070e9558 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E502_E502.py.snap @@ -21,8 +21,6 @@ E502.py:9:9: E502 [*] Redundant backslash 11 11 | 7) 12 12 | - Run `ruff check --fix` to apply this fix. - E502.py:10:11: E502 [*] Redundant backslash | 9 | a = (3 -\ @@ -41,8 +39,6 @@ E502.py:10:11: E502 [*] Redundant backslash 12 12 | 13 13 | z = 5 + \ - Run `ruff check --fix` to apply this fix. - E502.py:14:9: E502 [*] Redundant backslash | 13 | z = 5 + \ @@ -62,8 +58,6 @@ E502.py:14:9: E502 [*] Redundant backslash 16 16 | 7) + \ 17 17 | 4 - Run `ruff check --fix` to apply this fix. - E502.py:15:11: E502 [*] Redundant backslash | 13 | z = 5 + \ @@ -84,8 +78,6 @@ E502.py:15:11: E502 [*] Redundant backslash 17 17 | 4 18 18 | - Run `ruff check --fix` to apply this fix. - E502.py:23:17: E502 [*] Redundant backslash | 22 | b = [ @@ -105,8 +97,6 @@ E502.py:23:17: E502 [*] Redundant backslash 25 25 | - 5 26 26 | ] - Run `ruff check --fix` to apply this fix. - E502.py:24:8: E502 [*] Redundant backslash | 22 | b = [ @@ -127,8 +117,6 @@ E502.py:24:8: E502 [*] Redundant backslash 26 26 | ] 27 27 | - Run `ruff check --fix` to apply this fix. - E502.py:29:11: E502 [*] Redundant backslash | 28 | c = (True and @@ -148,8 +136,6 @@ E502.py:29:11: E502 [*] Redundant backslash 31 31 | and True \ 32 32 | ) - Run `ruff check --fix` to apply this fix. - E502.py:30:14: E502 [*] Redundant backslash | 28 | c = (True and @@ -170,8 +156,6 @@ E502.py:30:14: E502 [*] Redundant backslash 32 32 | ) 33 33 | - Run `ruff check --fix` to apply this fix. - E502.py:31:14: E502 [*] Redundant backslash | 29 | False \ @@ -191,8 +175,6 @@ E502.py:31:14: E502 [*] Redundant backslash 33 33 | 34 34 | c = (True and - Run `ruff check --fix` to apply this fix. - E502.py:44:14: E502 [*] Redundant backslash | 43 | s = { @@ -212,8 +194,6 @@ E502.py:44:14: E502 [*] Redundant backslash 46 46 | } 47 47 | - Run `ruff check --fix` to apply this fix. - E502.py:55:12: E502 [*] Redundant backslash | 55 | x = {2 + 4 \ @@ -231,8 +211,6 @@ E502.py:55:12: E502 [*] Redundant backslash 57 57 | 58 58 | y = ( - Run `ruff check --fix` to apply this fix. - E502.py:61:9: E502 [*] Redundant backslash | 59 | 2 + 2 # \ @@ -253,8 +231,6 @@ E502.py:61:9: E502 [*] Redundant backslash 63 63 | ) 64 64 | - Run `ruff check --fix` to apply this fix. - E502.py:82:12: E502 [*] Redundant backslash | 80 | "xyz" @@ -274,8 +250,6 @@ E502.py:82:12: E502 [*] Redundant backslash 84 84 | 85 85 | - Run `ruff check --fix` to apply this fix. - E502.py:87:14: E502 [*] Redundant backslash | 86 | def foo(): @@ -291,5 +265,3 @@ E502.py:87:14: E502 [*] Redundant backslash 87 |- x = (a + \ 87 |+ x = (a + 88 88 | 2) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap index 719fbcf758c82..4465233d6bb39 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_0.py.snap @@ -14,5 +14,3 @@ W391_0.py:14:1: W391 [*] Extra newline at end of file 12 12 | foo() 13 13 | bar() 14 |- - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_2.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_2.py.snap index 56881f40c25c4..4d285d4fbef9e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_2.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__W391_W391_2.py.snap @@ -19,5 +19,3 @@ W391_2.py:14:1: W391 [*] Too many newlines at end of file 15 |- 16 |- 17 |- - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__shebang.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__shebang.snap index 4e4740aa8dc01..1bcda0a025dc3 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__shebang.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__shebang.snap @@ -16,5 +16,3 @@ shebang.py:3:1: E265 [*] Block comment should start with `# ` 3 |-#! 3 |+# ! 4 4 | #: - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(-1)-between(0).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(-1)-between(0).snap index 75e6d1195cc48..43986e2885eb2 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(-1)-between(0).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(-1)-between(0).snap @@ -23,8 +23,6 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted 6 3 | 7 4 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:5:1: E303 [*] Too many blank lines (3) | 5 | from typing import Any, Sequence @@ -40,8 +38,6 @@ E30_isort.py:5:1: E303 [*] Too many blank lines (3) 6 5 | 7 6 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:21:5: E303 [*] Too many blank lines (2) | 21 | abcd.foo() @@ -59,8 +55,6 @@ E30_isort.py:21:5: E303 [*] Too many blank lines (2) 22 21 | 23 22 | def __init__(self, backend_module: str, backend_obj: str | None) -> None: ... - Run `ruff check --fix` to apply this fix. - E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -85,8 +79,6 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:30:5: E303 [*] Too many blank lines (3) | 30 | from typing_extensions import TypeAlias @@ -103,8 +95,6 @@ E30_isort.py:30:5: E303 [*] Too many blank lines (3) 31 29 | 32 30 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:33:5: E303 [*] Too many blank lines (2) | 33 | abcd.foo() @@ -122,8 +112,6 @@ E30_isort.py:33:5: E303 [*] Too many blank lines (2) 34 33 | 35 34 | def __call__(self, name: str, *args: Any, **kwargs: Any) -> Any: - Run `ruff check --fix` to apply this fix. - E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | 60 | / from typing import Any, Sequence @@ -138,5 +126,3 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted 61 61 | 62 |+ 62 63 | class MissingCommand(TypeError): ... # noqa: N818 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(0)-between(0).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(0)-between(0).snap index e7e7d017c4c9d..e55a70c3d7d13 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(0)-between(0).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(0)-between(0).snap @@ -26,8 +26,6 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted 9 4 | 10 5 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:5:1: E303 [*] Too many blank lines (3) | 5 | from typing import Any, Sequence @@ -43,8 +41,6 @@ E30_isort.py:5:1: E303 [*] Too many blank lines (3) 6 5 | 7 6 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:8:1: E303 [*] Too many blank lines (2) | 8 | class MissingCommand(TypeError): ... # noqa: N818 @@ -61,8 +57,6 @@ E30_isort.py:8:1: E303 [*] Too many blank lines (2) 9 7 | 10 8 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:21:5: E303 [*] Too many blank lines (2) | 21 | abcd.foo() @@ -80,8 +74,6 @@ E30_isort.py:21:5: E303 [*] Too many blank lines (2) 22 21 | 23 22 | def __init__(self, backend_module: str, backend_obj: str | None) -> None: ... - Run `ruff check --fix` to apply this fix. - E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -106,8 +98,6 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:30:5: E303 [*] Too many blank lines (3) | 30 | from typing_extensions import TypeAlias @@ -124,8 +114,6 @@ E30_isort.py:30:5: E303 [*] Too many blank lines (3) 31 29 | 32 30 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:33:5: E303 [*] Too many blank lines (2) | 33 | abcd.foo() @@ -143,8 +131,6 @@ E30_isort.py:33:5: E303 [*] Too many blank lines (2) 34 33 | 35 34 | def __call__(self, name: str, *args: Any, **kwargs: Any) -> Any: - Run `ruff check --fix` to apply this fix. - E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | 60 | / from typing import Any, Sequence @@ -160,8 +146,6 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted 61 |- 62 61 | class MissingCommand(TypeError): ... # noqa: N818 - Run `ruff check --fix` to apply this fix. - E30_isort.py:62:1: E303 [*] Too many blank lines (1) | 60 | from typing import Any, Sequence @@ -176,5 +160,3 @@ E30_isort.py:62:1: E303 [*] Too many blank lines (1) 60 60 | from typing import Any, Sequence 61 |- 62 61 | class MissingCommand(TypeError): ... # noqa: N818 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(1)-between(1).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(1)-between(1).snap index ea6db5026c732..e822b3058aaa9 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(1)-between(1).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(1)-between(1).snap @@ -25,8 +25,6 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted 8 5 | class MissingCommand(TypeError): ... # noqa: N818 9 6 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:5:1: E303 [*] Too many blank lines (3) | 5 | from typing import Any, Sequence @@ -42,8 +40,6 @@ E30_isort.py:5:1: E303 [*] Too many blank lines (3) 6 5 | 7 6 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:8:1: E303 [*] Too many blank lines (2) | 8 | class MissingCommand(TypeError): ... # noqa: N818 @@ -59,8 +55,6 @@ E30_isort.py:8:1: E303 [*] Too many blank lines (2) 9 8 | 10 9 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:21:5: E303 [*] Too many blank lines (2) | 21 | abcd.foo() @@ -78,8 +72,6 @@ E30_isort.py:21:5: E303 [*] Too many blank lines (2) 22 21 | 23 22 | def __init__(self, backend_module: str, backend_obj: str | None) -> None: ... - Run `ruff check --fix` to apply this fix. - E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -104,8 +96,6 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:30:5: E303 [*] Too many blank lines (3) | 30 | from typing_extensions import TypeAlias @@ -122,8 +112,6 @@ E30_isort.py:30:5: E303 [*] Too many blank lines (3) 31 29 | 32 30 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:33:5: E303 [*] Too many blank lines (2) | 33 | abcd.foo() @@ -140,5 +128,3 @@ E30_isort.py:33:5: E303 [*] Too many blank lines (2) 33 32 | abcd.foo() 34 33 | 35 34 | def __call__(self, name: str, *args: Any, **kwargs: Any) -> Any: - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(4)-between(4).snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(4)-between(4).snap index 8cb3360ee3f42..84f454bbee57c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(4)-between(4).snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__too_many_blank_lines_isort_compatibility-lines-after(4)-between(4).snap @@ -28,8 +28,6 @@ E30_isort.py:1:1: I001 [*] Import block is un-sorted or un-formatted 9 12 | 10 13 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:21:5: E303 [*] Too many blank lines (2) | 21 | abcd.foo() @@ -47,8 +45,6 @@ E30_isort.py:21:5: E303 [*] Too many blank lines (2) 22 21 | 23 22 | def __init__(self, backend_module: str, backend_obj: str | None) -> None: ... - Run `ruff check --fix` to apply this fix. - E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted | 25 | if TYPE_CHECKING: @@ -73,8 +69,6 @@ E30_isort.py:26:1: I001 [*] Import block is un-sorted or un-formatted 31 29 | 32 30 | - Run `ruff check --fix` to apply this fix. - E30_isort.py:33:5: E303 [*] Too many blank lines (2) | 33 | abcd.foo() @@ -92,8 +86,6 @@ E30_isort.py:33:5: E303 [*] Too many blank lines (2) 34 33 | 35 34 | def __call__(self, name: str, *args: Any, **kwargs: Any) -> Any: - Run `ruff check --fix` to apply this fix. - E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted | 60 | / from typing import Any, Sequence @@ -110,5 +102,3 @@ E30_isort.py:60:1: I001 [*] Import block is un-sorted or un-formatted 63 |+ 64 |+ 62 65 | class MissingCommand(TypeError): ... # noqa: N818 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__w292_4.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__w292_4.snap index 25f07bb2c76e9..3809d820259c2 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__w292_4.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__w292_4.snap @@ -9,6 +9,4 @@ W292_4.py:1:2: W292 [*] No newline at end of file = help: Add trailing newline 1 |- - 1 |+ - - Run `ruff check --fix` to apply this fix. + 1 |+ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D201_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D201_D.py.snap index f4d9eb1b997d7..1a9fcdd925e65 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D201_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D201_D.py.snap @@ -18,8 +18,6 @@ D.py:137:5: D201 [*] No blank lines allowed before function docstring (found 1) 138 137 | 139 138 | - Run `ruff check --fix` to apply this fix. - D.py:151:5: D201 [*] No blank lines allowed before function docstring (found 1) | 149 | def trailing_and_leading_space(): @@ -39,8 +37,6 @@ D.py:151:5: D201 [*] No blank lines allowed before function docstring (found 1) 152 151 | 153 152 | pass - Run `ruff check --fix` to apply this fix. - D.py:546:5: D201 [*] No blank lines allowed before function docstring (found 1) | 544 | def multiline_leading_space(): @@ -62,8 +58,6 @@ D.py:546:5: D201 [*] No blank lines allowed before function docstring (found 1) 547 546 | 548 547 | More content. - Run `ruff check --fix` to apply this fix. - D.py:568:5: D201 [*] No blank lines allowed before function docstring (found 1) | 566 | def multiline_trailing_and_leading_space(): @@ -86,5 +80,3 @@ D.py:568:5: D201 [*] No blank lines allowed before function docstring (found 1) 568 567 | """Trailing and leading space. 569 568 | 570 569 | More content. - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D.py.snap index 51649e6cd268c..2a296015f19bb 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D.py.snap @@ -20,8 +20,6 @@ D.py:142:5: D202 [*] No blank lines allowed after function docstring (found 1) 145 144 | 146 145 | - Run `ruff check --fix` to apply this fix. - D.py:151:5: D202 [*] No blank lines allowed after function docstring (found 1) | 149 | def trailing_and_leading_space(): @@ -41,8 +39,6 @@ D.py:151:5: D202 [*] No blank lines allowed after function docstring (found 1) 154 153 | 155 154 | - Run `ruff check --fix` to apply this fix. - D.py:555:5: D202 [*] No blank lines allowed after function docstring (found 1) | 553 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -66,8 +62,6 @@ D.py:555:5: D202 [*] No blank lines allowed after function docstring (found 1) 561 560 | 562 561 | - Run `ruff check --fix` to apply this fix. - D.py:568:5: D202 [*] No blank lines allowed after function docstring (found 1) | 566 | def multiline_trailing_and_leading_space(): @@ -89,6 +83,4 @@ D.py:568:5: D202 [*] No blank lines allowed after function docstring (found 1) 572 |- 573 572 | pass 574 573 | -575 574 | - - Run `ruff check --fix` to apply this fix. +575 574 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D202.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D202.py.snap index 6608aa9a44749..038d164da48a0 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D202.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D202_D202.py.snap @@ -19,8 +19,6 @@ D202.py:57:5: D202 [*] No blank lines allowed after function docstring (found 2) 61 59 | return 62 60 | - Run `ruff check --fix` to apply this fix. - D202.py:68:5: D202 [*] No blank lines allowed after function docstring (found 2) | 66 | # D202 @@ -39,8 +37,6 @@ D202.py:68:5: D202 [*] No blank lines allowed after function docstring (found 2) 72 70 | def inner(): 73 71 | return - Run `ruff check --fix` to apply this fix. - D202.py:80:5: D202 [*] No blank lines allowed after function docstring (found 1) | 78 | # D202 @@ -59,5 +55,3 @@ D202.py:80:5: D202 [*] No blank lines allowed after function docstring (found 1) 82 81 | # This is a comment. 83 82 | 84 83 | def inner(): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D203_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D203_D.py.snap index 9d54c19b0901c..cafb720d97d38 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D203_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D203_D.py.snap @@ -17,8 +17,6 @@ D.py:161:5: D203 [*] 1 blank line required before class docstring 162 163 | 163 164 | - Run `ruff check --fix` to apply this fix. - D.py:192:5: D203 [*] 1 blank line required before class docstring | 191 | class LeadingAndTrailingSpaceMissing: @@ -36,8 +34,6 @@ D.py:192:5: D203 [*] 1 blank line required before class docstring 193 194 | pass 194 195 | - Run `ruff check --fix` to apply this fix. - D.py:526:5: D203 [*] 1 blank line required before class docstring | 524 | # parameters as functions for Google / Numpy conventions. @@ -64,8 +60,6 @@ D.py:526:5: D203 [*] 1 blank line required before class docstring 527 528 | 528 529 | Parameters - Run `ruff check --fix` to apply this fix. - D.py:649:5: D203 [*] 1 blank line required before class docstring | 648 | class StatementOnSameLineAsDocstring: @@ -84,8 +78,6 @@ D.py:649:5: D203 [*] 1 blank line required before class docstring 650 651 | def sort_services(self): 651 652 | pass - Run `ruff check --fix` to apply this fix. - D.py:654:5: D203 [*] 1 blank line required before class docstring | 653 | class StatementOnSameLineAsDocstring: @@ -102,8 +94,6 @@ D.py:654:5: D203 [*] 1 blank line required before class docstring 655 656 | 656 657 | - Run `ruff check --fix` to apply this fix. - D.py:658:5: D203 [*] 1 blank line required before class docstring | 657 | class CommentAfterDocstring: @@ -121,5 +111,3 @@ D.py:658:5: D203 [*] 1 blank line required before class docstring 658 659 | "After this docstring there's a comment." # priorities=1 659 660 | def sort_services(self): 660 661 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D204_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D204_D.py.snap index 8515a7f7aea84..3df242aa3ac91 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D204_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D204_D.py.snap @@ -19,8 +19,6 @@ D.py:181:5: D204 [*] 1 blank line required after class docstring 183 184 | 184 185 | - Run `ruff check --fix` to apply this fix. - D.py:192:5: D204 [*] 1 blank line required after class docstring | 191 | class LeadingAndTrailingSpaceMissing: @@ -38,8 +36,6 @@ D.py:192:5: D204 [*] 1 blank line required after class docstring 194 195 | 195 196 | - Run `ruff check --fix` to apply this fix. - D.py:649:5: D204 [*] 1 blank line required after class docstring | 648 | class StatementOnSameLineAsDocstring: @@ -61,8 +57,6 @@ D.py:649:5: D204 [*] 1 blank line required after class docstring 651 653 | pass 652 654 | - Run `ruff check --fix` to apply this fix. - D.py:654:5: D204 [*] 1 blank line required after class docstring | 653 | class StatementOnSameLineAsDocstring: @@ -82,8 +76,6 @@ D.py:654:5: D204 [*] 1 blank line required after class docstring 656 658 | 657 659 | class CommentAfterDocstring: - Run `ruff check --fix` to apply this fix. - D.py:658:5: D204 [*] 1 blank line required after class docstring | 657 | class CommentAfterDocstring: @@ -100,6 +92,4 @@ D.py:658:5: D204 [*] 1 blank line required after class docstring 659 |+ 659 660 | def sort_services(self): 660 661 | pass -661 662 | - - Run `ruff check --fix` to apply this fix. +661 662 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D205_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D205_D.py.snap index 3766fb2f17cdd..50812cea14731 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D205_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D205_D.py.snap @@ -36,5 +36,3 @@ D.py:210:5: D205 [*] 1 blank line required between summary line and description 213 212 | Description. 214 213 | 215 214 | """ - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D207_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D207_D.py.snap index d9799972a5f9d..257b6f5e8e414 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D207_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D207_D.py.snap @@ -21,8 +21,6 @@ D.py:232:1: D207 [*] Docstring is under-indented 234 234 | """ 235 235 | - Run `ruff check --fix` to apply this fix. - D.py:244:1: D207 [*] Docstring is under-indented | 242 | Description. @@ -41,8 +39,6 @@ D.py:244:1: D207 [*] Docstring is under-indented 246 246 | 247 247 | @expect('D208: Docstring is over-indented') - Run `ruff check --fix` to apply this fix. - D.py:440:1: D207 [*] Docstring is under-indented | 438 | def docstring_start_in_same_line(): """First Line. @@ -62,8 +58,6 @@ D.py:440:1: D207 [*] Docstring is under-indented 442 442 | 443 443 | - Run `ruff check --fix` to apply this fix. - D.py:441:1: D207 [*] Docstring is under-indented | 440 | Second Line @@ -80,5 +74,3 @@ D.py:441:1: D207 [*] Docstring is under-indented 442 442 | 443 443 | 444 444 | def function_with_lambda_arg(x=lambda y: y): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D.py.snap index e992984919cdc..3a8e6f80a13a3 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D.py.snap @@ -21,8 +21,6 @@ D.py:252:1: D208 [*] Docstring is over-indented 254 254 | """ 255 255 | - Run `ruff check --fix` to apply this fix. - D.py:264:1: D208 [*] Docstring is over-indented | 262 | Description. @@ -41,8 +39,6 @@ D.py:264:1: D208 [*] Docstring is over-indented 266 266 | 267 267 | @expect('D208: Docstring is over-indented') - Run `ruff check --fix` to apply this fix. - D.py:272:1: D208 [*] Docstring is over-indented | 270 | """Summary. @@ -63,8 +59,6 @@ D.py:272:1: D208 [*] Docstring is over-indented 274 274 | """ 275 275 | - Run `ruff check --fix` to apply this fix. - D.py:673:1: D208 [*] Docstring is over-indented | 671 | """Summary. @@ -85,8 +79,6 @@ D.py:673:1: D208 [*] Docstring is over-indented 675 675 | to the one before 676 676 | """ - Run `ruff check --fix` to apply this fix. - D.py:674:1: D208 [*] Docstring is over-indented | 673 | This is overindented @@ -106,8 +98,6 @@ D.py:674:1: D208 [*] Docstring is over-indented 676 676 | """ 677 677 | - Run `ruff check --fix` to apply this fix. - D.py:675:1: D208 [*] Docstring is over-indented | 673 | This is overindented @@ -127,8 +117,6 @@ D.py:675:1: D208 [*] Docstring is over-indented 677 677 | 678 678 | - Run `ruff check --fix` to apply this fix. - D.py:682:1: D208 [*] Docstring is over-indented | 680 | """Summary. @@ -149,8 +137,6 @@ D.py:682:1: D208 [*] Docstring is over-indented 684 684 | to the one before 685 685 | This is also overindented - Run `ruff check --fix` to apply this fix. - D.py:683:1: D208 [*] Docstring is over-indented | 682 | This is overindented @@ -170,8 +156,6 @@ D.py:683:1: D208 [*] Docstring is over-indented 685 685 | This is also overindented 686 686 | And so is this, but it we should preserve the extra space on this line relative - Run `ruff check --fix` to apply this fix. - D.py:684:1: D208 [*] Docstring is over-indented | 682 | This is overindented @@ -192,8 +176,6 @@ D.py:684:1: D208 [*] Docstring is over-indented 686 686 | And so is this, but it we should preserve the extra space on this line relative 687 687 | to the one before - Run `ruff check --fix` to apply this fix. - D.py:685:1: D208 [*] Docstring is over-indented | 683 | And so is this, but it we should preserve the extra space on this line relative @@ -214,8 +196,6 @@ D.py:685:1: D208 [*] Docstring is over-indented 687 687 | to the one before 688 688 | """ - Run `ruff check --fix` to apply this fix. - D.py:686:1: D208 [*] Docstring is over-indented | 684 | to the one before @@ -236,8 +216,6 @@ D.py:686:1: D208 [*] Docstring is over-indented 688 688 | """ 689 689 | - Run `ruff check --fix` to apply this fix. - D.py:687:1: D208 [*] Docstring is over-indented | 685 | This is also overindented @@ -257,8 +235,6 @@ D.py:687:1: D208 [*] Docstring is over-indented 689 689 | 690 690 | - Run `ruff check --fix` to apply this fix. - D.py:695:1: D208 [*] Docstring is over-indented | 693 | """Summary. @@ -279,8 +255,6 @@ D.py:695:1: D208 [*] Docstring is over-indented 697 697 | to the one before 698 698 | And the relative indent here should be preserved too - Run `ruff check --fix` to apply this fix. - D.py:696:1: D208 [*] Docstring is over-indented | 695 | This is overindented @@ -300,8 +274,6 @@ D.py:696:1: D208 [*] Docstring is over-indented 698 698 | And the relative indent here should be preserved too 699 699 | """ - Run `ruff check --fix` to apply this fix. - D.py:697:1: D208 [*] Docstring is over-indented | 695 | This is overindented @@ -322,8 +294,6 @@ D.py:697:1: D208 [*] Docstring is over-indented 699 699 | """ 700 700 | - Run `ruff check --fix` to apply this fix. - D.py:698:1: D208 [*] Docstring is over-indented | 696 | And so is this, but it we should preserve the extra space on this line relative @@ -343,8 +313,6 @@ D.py:698:1: D208 [*] Docstring is over-indented 700 700 | 701 701 | def retain_extra_whitespace_followed_by_same_offset(): - Run `ruff check --fix` to apply this fix. - D.py:704:1: D208 [*] Docstring is over-indented | 702 | """Summary. @@ -365,8 +333,6 @@ D.py:704:1: D208 [*] Docstring is over-indented 706 706 | This is overindented 707 707 | This is overindented - Run `ruff check --fix` to apply this fix. - D.py:705:1: D208 [*] Docstring is over-indented | 704 | This is overindented @@ -386,8 +352,6 @@ D.py:705:1: D208 [*] Docstring is over-indented 707 707 | This is overindented 708 708 | """ - Run `ruff check --fix` to apply this fix. - D.py:706:1: D208 [*] Docstring is over-indented | 704 | This is overindented @@ -408,8 +372,6 @@ D.py:706:1: D208 [*] Docstring is over-indented 708 708 | """ 709 709 | - Run `ruff check --fix` to apply this fix. - D.py:707:1: D208 [*] Docstring is over-indented | 705 | And so is this, but it we should preserve the extra space on this line relative @@ -429,8 +391,6 @@ D.py:707:1: D208 [*] Docstring is over-indented 709 709 | 710 710 | - Run `ruff check --fix` to apply this fix. - D.py:723:1: D208 [*] Docstring is over-indented | 721 | """There's a non-breaking space (2-bytes) after 3 spaces (https://github.com/astral-sh/ruff/issues/9080). @@ -447,5 +407,3 @@ D.py:723:1: D208 [*] Docstring is over-indented 723 |-     Returns: 723 |+ Returns: 724 724 | """ - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D208.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D208.py.snap index 3a837c2f27933..9d5b54e494633 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D208.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D208_D208.py.snap @@ -17,8 +17,6 @@ D208.py:2:1: D208 [*] Docstring is over-indented 4 4 | 5 5 | - Run `ruff check --fix` to apply this fix. - D208.py:8:1: D208 [*] Docstring is over-indented | 6 | class Platform: @@ -39,8 +37,6 @@ D208.py:8:1: D208 [*] Docstring is over-indented 10 10 | """ 11 11 | - Run `ruff check --fix` to apply this fix. - D208.py:9:1: D208 [*] Docstring is over-indented | 7 | """ Remove sampler @@ -60,8 +56,6 @@ D208.py:9:1: D208 [*] Docstring is over-indented 11 11 | 12 12 | - Run `ruff check --fix` to apply this fix. - D208.py:10:1: D208 [*] Docstring is over-indented | 8 | Args: @@ -79,5 +73,3 @@ D208.py:10:1: D208 [*] Docstring is over-indented 11 11 | 12 12 | 13 13 | def memory_test(): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D209_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D209_D.py.snap index 2f11a35b523a1..6844c240355d5 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D209_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D209_D.py.snap @@ -23,8 +23,6 @@ D.py:281:5: D209 [*] Multi-line docstring closing quotes should be on a separate 285 286 | 286 287 | @expect('D210: No whitespaces allowed surrounding docstring text') - Run `ruff check --fix` to apply this fix. - D.py:588:5: D209 [*] Multi-line docstring closing quotes should be on a separate line | 586 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -46,5 +44,3 @@ D.py:588:5: D209 [*] Multi-line docstring closing quotes should be on a separate 591 592 | 592 593 | 593 594 | @expect('D200: One-line docstring should fit on one line with quotes ' - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D210_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D210_D.py.snap index 00edac9188b7e..f40fe57712265 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D210_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D210_D.py.snap @@ -19,8 +19,6 @@ D.py:288:5: D210 [*] No whitespaces allowed surrounding docstring text 290 290 | 291 291 | @expect('D210: No whitespaces allowed surrounding docstring text') - Run `ruff check --fix` to apply this fix. - D.py:293:5: D210 [*] No whitespaces allowed surrounding docstring text | 291 | @expect('D210: No whitespaces allowed surrounding docstring text') @@ -39,8 +37,6 @@ D.py:293:5: D210 [*] No whitespaces allowed surrounding docstring text 295 295 | 296 296 | @expect('D210: No whitespaces allowed surrounding docstring text') - Run `ruff check --fix` to apply this fix. - D.py:299:5: D210 [*] No whitespaces allowed surrounding docstring text | 297 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -63,8 +59,6 @@ D.py:299:5: D210 [*] No whitespaces allowed surrounding docstring text 301 301 | This is the end. 302 302 | """ - Run `ruff check --fix` to apply this fix. - D.py:581:5: D210 No whitespaces allowed surrounding docstring text | 579 | "or exclamation point (not '\"')") diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D211_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D211_D.py.snap index c7ca8ccfc8192..6d41be9ed1c0c 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D211_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D211_D.py.snap @@ -18,8 +18,6 @@ D.py:170:5: D211 [*] No blank lines allowed before class docstring 171 170 | 172 171 | - Run `ruff check --fix` to apply this fix. - D.py:181:5: D211 [*] No blank lines allowed before class docstring | 179 | class TrailingSpace: @@ -36,6 +34,4 @@ D.py:181:5: D211 [*] No blank lines allowed before class docstring 180 |- 181 180 | """TrailingSpace.""" 182 181 | pass -183 182 | - - Run `ruff check --fix` to apply this fix. +183 182 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D212_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D212_D.py.snap index 11c869c3b1b8f..eb074882ac38f 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D212_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D212_D.py.snap @@ -23,8 +23,6 @@ D.py:129:5: D212 [*] Multi-line docstring summary should start at the first line 132 131 | 133 132 | - Run `ruff check --fix` to apply this fix. - D.py:597:5: D212 [*] Multi-line docstring summary should start at the first line | 595 | @expect('D212: Multi-line docstring summary should start at the first line') @@ -48,8 +46,6 @@ D.py:597:5: D212 [*] Multi-line docstring summary should start at the first line 601 599 | 602 600 | @expect('D200: One-line docstring should fit on one line with quotes ' - Run `ruff check --fix` to apply this fix. - D.py:624:5: D212 [*] Multi-line docstring summary should start at the first line | 622 | @expect('D212: Multi-line docstring summary should start at the first line') @@ -72,5 +68,3 @@ D.py:624:5: D212 [*] Multi-line docstring summary should start at the first line 627 625 | 628 626 | 629 627 | @expect('D404: First word of the docstring should not be "This"') - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D213_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D213_D.py.snap index 5ee81adf4db8d..60f2bce05ce54 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D213_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D213_D.py.snap @@ -24,8 +24,6 @@ D.py:200:5: D213 [*] Multi-line docstring summary should start at the second lin 202 203 | 203 204 | """ - Run `ruff check --fix` to apply this fix. - D.py:210:5: D213 [*] Multi-line docstring summary should start at the second line | 208 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -51,8 +49,6 @@ D.py:210:5: D213 [*] Multi-line docstring summary should start at the second lin 212 213 | 213 214 | Description. - Run `ruff check --fix` to apply this fix. - D.py:220:5: D213 [*] Multi-line docstring summary should start at the second line | 218 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -77,8 +73,6 @@ D.py:220:5: D213 [*] Multi-line docstring summary should start at the second lin 222 223 | Description. 223 224 | - Run `ruff check --fix` to apply this fix. - D.py:230:5: D213 [*] Multi-line docstring summary should start at the second line | 228 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -103,8 +97,6 @@ D.py:230:5: D213 [*] Multi-line docstring summary should start at the second lin 232 233 | Description. 233 234 | - Run `ruff check --fix` to apply this fix. - D.py:240:5: D213 [*] Multi-line docstring summary should start at the second line | 238 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -129,8 +121,6 @@ D.py:240:5: D213 [*] Multi-line docstring summary should start at the second lin 242 243 | Description. 243 244 | - Run `ruff check --fix` to apply this fix. - D.py:250:5: D213 [*] Multi-line docstring summary should start at the second line | 248 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -155,8 +145,6 @@ D.py:250:5: D213 [*] Multi-line docstring summary should start at the second lin 252 253 | Description. 253 254 | - Run `ruff check --fix` to apply this fix. - D.py:260:5: D213 [*] Multi-line docstring summary should start at the second line | 258 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -181,8 +169,6 @@ D.py:260:5: D213 [*] Multi-line docstring summary should start at the second lin 262 263 | Description. 263 264 | - Run `ruff check --fix` to apply this fix. - D.py:270:5: D213 [*] Multi-line docstring summary should start at the second line | 268 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -207,8 +193,6 @@ D.py:270:5: D213 [*] Multi-line docstring summary should start at the second lin 272 273 | Description. 273 274 | - Run `ruff check --fix` to apply this fix. - D.py:281:5: D213 [*] Multi-line docstring summary should start at the second line | 279 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -231,8 +215,6 @@ D.py:281:5: D213 [*] Multi-line docstring summary should start at the second lin 283 284 | Description.""" 284 285 | - Run `ruff check --fix` to apply this fix. - D.py:299:5: D213 [*] Multi-line docstring summary should start at the second line | 297 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -256,8 +238,6 @@ D.py:299:5: D213 [*] Multi-line docstring summary should start at the second lin 301 302 | This is the end. 302 303 | """ - Run `ruff check --fix` to apply this fix. - D.py:343:5: D213 [*] Multi-line docstring summary should start at the second line | 341 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -283,8 +263,6 @@ D.py:343:5: D213 [*] Multi-line docstring summary should start at the second lin 345 346 | In particular, line continuations \ 346 347 | and unicode literals \u0394 and \N{GREEK CAPITAL LETTER DELTA}. - Run `ruff check --fix` to apply this fix. - D.py:383:5: D213 [*] Multi-line docstring summary should start at the second line | 381 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -309,8 +287,6 @@ D.py:383:5: D213 [*] Multi-line docstring summary should start at the second lin 385 386 | More lines. 386 387 | """ - Run `ruff check --fix` to apply this fix. - D.py:392:5: D213 [*] Multi-line docstring summary should start at the second line | 390 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -335,8 +311,6 @@ D.py:392:5: D213 [*] Multi-line docstring summary should start at the second lin 394 395 | Multi-line comments. OK to have extra blank line 395 396 | - Run `ruff check --fix` to apply this fix. - D.py:438:37: D213 [*] Multi-line docstring summary should start at the second line | 436 | @expect("D207: Docstring is under-indented") @@ -360,8 +334,6 @@ D.py:438:37: D213 [*] Multi-line docstring summary should start at the second li 440 441 | Second Line 441 442 | """ - Run `ruff check --fix` to apply this fix. - D.py:450:5: D213 [*] Multi-line docstring summary should start at the second line | 448 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -386,8 +358,6 @@ D.py:450:5: D213 [*] Multi-line docstring summary should start at the second lin 452 453 | The assertion was caused in the next function, so this one is necessary. 453 454 | - Run `ruff check --fix` to apply this fix. - D.py:526:5: D213 [*] Multi-line docstring summary should start at the second line | 524 | # parameters as functions for Google / Numpy conventions. @@ -416,8 +386,6 @@ D.py:526:5: D213 [*] Multi-line docstring summary should start at the second lin 528 529 | Parameters 529 530 | ---------- - Run `ruff check --fix` to apply this fix. - D.py:546:5: D213 [*] Multi-line docstring summary should start at the second line | 544 | def multiline_leading_space(): @@ -441,8 +409,6 @@ D.py:546:5: D213 [*] Multi-line docstring summary should start at the second lin 548 549 | More content. 549 550 | """ - Run `ruff check --fix` to apply this fix. - D.py:555:5: D213 [*] Multi-line docstring summary should start at the second line | 553 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -468,8 +434,6 @@ D.py:555:5: D213 [*] Multi-line docstring summary should start at the second lin 557 558 | More content. 558 559 | """ - Run `ruff check --fix` to apply this fix. - D.py:568:5: D213 [*] Multi-line docstring summary should start at the second line | 566 | def multiline_trailing_and_leading_space(): @@ -495,8 +459,6 @@ D.py:568:5: D213 [*] Multi-line docstring summary should start at the second lin 570 571 | More content. 571 572 | """ - Run `ruff check --fix` to apply this fix. - D.py:588:5: D213 [*] Multi-line docstring summary should start at the second line | 586 | @expect('D213: Multi-line docstring summary should start at the second line') @@ -519,8 +481,6 @@ D.py:588:5: D213 [*] Multi-line docstring summary should start at the second lin 590 591 | Description. """ 591 592 | - Run `ruff check --fix` to apply this fix. - D.py:606:5: D213 [*] Multi-line docstring summary should start at the second line | 604 | @expect('D212: Multi-line docstring summary should start at the first line') @@ -543,8 +503,6 @@ D.py:606:5: D213 [*] Multi-line docstring summary should start at the second lin 608 609 | """ 609 610 | - Run `ruff check --fix` to apply this fix. - D.py:615:5: D213 [*] Multi-line docstring summary should start at the second line | 613 | @expect('D212: Multi-line docstring summary should start at the first line') @@ -567,8 +525,6 @@ D.py:615:5: D213 [*] Multi-line docstring summary should start at the second lin 617 618 | """ 618 619 | - Run `ruff check --fix` to apply this fix. - D.py:671:5: D213 [*] Multi-line docstring summary should start at the second line | 670 | def retain_extra_whitespace(): @@ -593,8 +549,6 @@ D.py:671:5: D213 [*] Multi-line docstring summary should start at the second lin 673 674 | This is overindented 674 675 | And so is this, but it we should preserve the extra space on this line relative - Run `ruff check --fix` to apply this fix. - D.py:680:5: D213 [*] Multi-line docstring summary should start at the second line | 679 | def retain_extra_whitespace_multiple(): @@ -622,8 +576,6 @@ D.py:680:5: D213 [*] Multi-line docstring summary should start at the second lin 682 683 | This is overindented 683 684 | And so is this, but it we should preserve the extra space on this line relative - Run `ruff check --fix` to apply this fix. - D.py:693:5: D213 [*] Multi-line docstring summary should start at the second line | 692 | def retain_extra_whitespace_deeper(): @@ -651,8 +603,6 @@ D.py:693:5: D213 [*] Multi-line docstring summary should start at the second lin 695 696 | This is overindented 696 697 | And so is this, but it we should preserve the extra space on this line relative - Run `ruff check --fix` to apply this fix. - D.py:702:5: D213 [*] Multi-line docstring summary should start at the second line | 701 | def retain_extra_whitespace_followed_by_same_offset(): @@ -678,8 +628,6 @@ D.py:702:5: D213 [*] Multi-line docstring summary should start at the second lin 704 705 | This is overindented 705 706 | And so is this, but it we should preserve the extra space on this line relative - Run `ruff check --fix` to apply this fix. - D.py:712:5: D213 [*] Multi-line docstring summary should start at the second line | 711 | def retain_extra_whitespace_not_overindented(): @@ -704,8 +652,6 @@ D.py:712:5: D213 [*] Multi-line docstring summary should start at the second lin 714 715 | This is not overindented 715 716 | This is overindented, but since one line is not overindented this should not raise - Run `ruff check --fix` to apply this fix. - D.py:721:5: D213 [*] Multi-line docstring summary should start at the second line | 720 | def inconsistent_indent_byte_size(): @@ -727,5 +673,3 @@ D.py:721:5: D213 [*] Multi-line docstring summary should start at the second lin 722 723 | 723 724 |     Returns: 724 725 | """ - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_D214_module.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_D214_module.py.snap index a532a728a7f53..0440ee2e60ab3 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_D214_module.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_D214_module.py.snap @@ -20,8 +20,6 @@ D214_module.py:3:5: D214 [*] Section is over-indented ("Returns") 5 5 | valid returns 6 6 | - Run `ruff check --fix` to apply this fix. - D214_module.py:7:5: D214 [*] Section is over-indented ("Args") | 5 | valid returns @@ -41,5 +39,3 @@ D214_module.py:7:5: D214 [*] Section is over-indented ("Args") 8 8 | ----- 9 9 | valid args 10 10 | """ - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_sections.py.snap index b8494d3941cf2..c2ef668241aac 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D214_sections.py.snap @@ -21,8 +21,6 @@ sections.py:146:9: D214 [*] Section is over-indented ("Returns") 148 148 | A value of some sort. 149 149 | - Run `ruff check --fix` to apply this fix. - sections.py:563:9: D214 [*] Section is over-indented ("Returns") | 561 | Here's a note. @@ -40,6 +38,4 @@ sections.py:563:9: D214 [*] Section is over-indented ("Returns") 563 |+ Returns: 564 564 | """ 565 565 | -566 566 | - - Run `ruff check --fix` to apply this fix. +566 566 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_D215.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_D215.py.snap index 906536fcf1268..b2591d36634ff 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_D215.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_D215.py.snap @@ -16,5 +16,3 @@ D215.py:3:5: D215 [*] Section underline is over-indented ("TODO") 3 |- - 3 |+ 4 4 | """ - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_sections.py.snap index f2e765ba5d42b..ddb4089de66cc 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D215_sections.py.snap @@ -19,8 +19,6 @@ sections.py:159:9: D215 [*] Section underline is over-indented ("Returns") 161 161 | 162 162 | """ - Run `ruff check --fix` to apply this fix. - sections.py:173:9: D215 [*] Section underline is over-indented ("Returns") | 172 | Returns @@ -37,6 +35,4 @@ sections.py:173:9: D215 [*] Section underline is over-indented ("Returns") 173 |+ ------ 174 174 | """ 175 175 | -176 176 | - - Run `ruff check --fix` to apply this fix. +176 176 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap index ab1d24850337f..d7f52d717b857 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap @@ -19,8 +19,6 @@ D.py:307:5: D300 [*] Use triple double quotes `"""` 309 309 | 310 310 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') - Run `ruff check --fix` to apply this fix. - D.py:312:5: D300 [*] Use triple double quotes `"""` | 310 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') @@ -39,8 +37,6 @@ D.py:312:5: D300 [*] Use triple double quotes `"""` 314 314 | 315 315 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') - Run `ruff check --fix` to apply this fix. - D.py:317:5: D300 [*] Use triple double quotes `"""` | 315 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') @@ -59,8 +55,6 @@ D.py:317:5: D300 [*] Use triple double quotes `"""` 319 319 | 320 320 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') - Run `ruff check --fix` to apply this fix. - D.py:322:5: D300 [*] Use triple double quotes `"""` | 320 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') @@ -79,8 +73,6 @@ D.py:322:5: D300 [*] Use triple double quotes `"""` 324 324 | 325 325 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') - Run `ruff check --fix` to apply this fix. - D.py:328:5: D300 [*] Use triple double quotes `"""` | 326 | @expect('D301: Use r""" if any backslashes in a docstring') @@ -99,8 +91,6 @@ D.py:328:5: D300 [*] Use triple double quotes `"""` 330 330 | 331 331 | @expect('D301: Use r""" if any backslashes in a docstring') - Run `ruff check --fix` to apply this fix. - D.py:645:5: D300 [*] Use triple double quotes `"""` | 644 | def single_line_docstring_with_an_escaped_backslash(): @@ -124,8 +114,6 @@ D.py:645:5: D300 [*] Use triple double quotes `"""` 648 648 | class StatementOnSameLineAsDocstring: 649 649 | "After this docstring there's another statement on the same line separated by a semicolon." ; priorities=1 - Run `ruff check --fix` to apply this fix. - D.py:649:5: D300 [*] Use triple double quotes `"""` | 648 | class StatementOnSameLineAsDocstring: @@ -145,8 +133,6 @@ D.py:649:5: D300 [*] Use triple double quotes `"""` 651 651 | pass 652 652 | - Run `ruff check --fix` to apply this fix. - D.py:654:5: D300 [*] Use triple double quotes `"""` | 653 | class StatementOnSameLineAsDocstring: @@ -164,8 +150,6 @@ D.py:654:5: D300 [*] Use triple double quotes `"""` 656 656 | 657 657 | class CommentAfterDocstring: - Run `ruff check --fix` to apply this fix. - D.py:658:5: D300 [*] Use triple double quotes `"""` | 657 | class CommentAfterDocstring: @@ -185,8 +169,6 @@ D.py:658:5: D300 [*] Use triple double quotes `"""` 660 660 | pass 661 661 | - Run `ruff check --fix` to apply this fix. - D.py:664:5: D300 [*] Use triple double quotes `"""` | 663 | def newline_after_closing_quote(self): @@ -206,6 +188,4 @@ D.py:664:5: D300 [*] Use triple double quotes `"""` 665 |+ but continuations shouldn't be considered multi-line""" 666 666 | 667 667 | -668 668 | - - Run `ruff check --fix` to apply this fix. +668 668 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap index b703b2b291b77..0a7e6f79b0a27 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap @@ -25,5 +25,3 @@ D300.py:10:5: D300 [*] Use triple double quotes `"""` 11 11 | 12 12 | 13 13 | # OK - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D403_D403.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D403_D403.py.snap index 4eb763e2019ab..9795a6ca79db8 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D403_D403.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D403_D403.py.snap @@ -18,8 +18,6 @@ D403.py:2:5: D403 [*] First word of the first line should be capitalized: `this` 4 4 | def good_function(): 5 5 | """This docstring is capitalized.""" - Run `ruff check --fix` to apply this fix. - D403.py:30:5: D403 [*] First word of the first line should be capitalized: `singleword` -> `Singleword` | 29 | def single_word(): @@ -39,8 +37,6 @@ D403.py:30:5: D403 [*] First word of the first line should be capitalized: `sing 32 32 | def single_word_no_dot(): 33 33 | """singleword""" - Run `ruff check --fix` to apply this fix. - D403.py:33:5: D403 [*] First word of the first line should be capitalized: `singleword` -> `Singleword` | 32 | def single_word_no_dot(): @@ -54,5 +50,3 @@ D403.py:33:5: D403 [*] First word of the first line should be capitalized: `sing 32 32 | def single_word_no_dot(): 33 |- """singleword""" 33 |+ """Singleword""" - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D405_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D405_sections.py.snap index 97ca13c634eb4..bb24e8a6c6500 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D405_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D405_sections.py.snap @@ -21,8 +21,6 @@ sections.py:19:5: D405 [*] Section name should be properly capitalized ("returns 21 21 | A value of some sort. 22 22 | - Run `ruff check --fix` to apply this fix. - sections.py:218:5: D405 [*] Section name should be properly capitalized ("Short summary") | 216 | """Toggle the gizmo. @@ -41,5 +39,3 @@ sections.py:218:5: D405 [*] Section name should be properly capitalized ("Short 219 219 | ------------- 220 220 | 221 221 | This is the function's description, which will also specify what it - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D406_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D406_sections.py.snap index bcd67b4066091..ccf274439a19f 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D406_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D406_sections.py.snap @@ -21,8 +21,6 @@ sections.py:32:5: D406 [*] Section name should end with a newline ("Returns") 34 34 | A value of some sort. 35 35 | - Run `ruff check --fix` to apply this fix. - sections.py:227:5: D406 [*] Section name should end with a newline ("Raises") | 225 | ------ @@ -42,8 +40,6 @@ sections.py:227:5: D406 [*] Section name should end with a newline ("Raises") 229 229 | 230 230 | """ - Run `ruff check --fix` to apply this fix. - sections.py:590:5: D406 [*] Section name should end with a newline ("Parameters") | 588 | """Test that lower case subsection header is valid even if it has the same name as section kind. @@ -63,5 +59,3 @@ sections.py:590:5: D406 [*] Section name should end with a newline ("Parameters" 591 591 | ---------- 592 592 | parameters: 593 593 | A list of string parameters - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D407_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D407_sections.py.snap index 5364a8efc3abf..90c7b5340a672 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D407_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D407_sections.py.snap @@ -19,8 +19,6 @@ sections.py:44:5: D407 [*] Missing dashed underline after section ("Returns") 46 47 | 47 48 | """ - Run `ruff check --fix` to apply this fix. - sections.py:56:5: D407 [*] Missing dashed underline after section ("Returns") | 54 | """Toggle the gizmo. @@ -40,8 +38,6 @@ sections.py:56:5: D407 [*] Missing dashed underline after section ("Returns") 58 59 | """ 59 60 | - Run `ruff check --fix` to apply this fix. - sections.py:67:5: D407 [*] Missing dashed underline after section ("Returns") | 65 | """Toggle the gizmo. @@ -61,8 +57,6 @@ sections.py:67:5: D407 [*] Missing dashed underline after section ("Returns") 69 70 | 70 71 | @expect(_D213) - Run `ruff check --fix` to apply this fix. - sections.py:227:5: D407 [*] Missing dashed underline after section ("Raises") | 225 | ------ @@ -81,8 +75,6 @@ sections.py:227:5: D407 [*] Missing dashed underline after section ("Raises") 229 230 | 230 231 | """ - Run `ruff check --fix` to apply this fix. - sections.py:263:5: D407 [*] Missing dashed underline after section ("Args") | 261 | """Toggle the gizmo. @@ -101,8 +93,6 @@ sections.py:263:5: D407 [*] Missing dashed underline after section ("Args") 265 266 | 266 267 | Returns: - Run `ruff check --fix` to apply this fix. - sections.py:266:5: D407 [*] Missing dashed underline after section ("Returns") | 264 | note: A random string. @@ -122,8 +112,6 @@ sections.py:266:5: D407 [*] Missing dashed underline after section ("Returns") 268 269 | Raises: 269 270 | RandomError: A random error that occurs randomly. - Run `ruff check --fix` to apply this fix. - sections.py:268:5: D407 [*] Missing dashed underline after section ("Raises") | 266 | Returns: @@ -142,8 +130,6 @@ sections.py:268:5: D407 [*] Missing dashed underline after section ("Raises") 270 271 | 271 272 | """ - Run `ruff check --fix` to apply this fix. - sections.py:280:5: D407 [*] Missing dashed underline after section ("Args") | 278 | """Toggle the gizmo. @@ -162,8 +148,6 @@ sections.py:280:5: D407 [*] Missing dashed underline after section ("Args") 282 283 | 283 284 | """ - Run `ruff check --fix` to apply this fix. - sections.py:297:9: D407 [*] Missing dashed underline after section ("Args") | 295 | Will this work when referencing x? @@ -183,8 +167,6 @@ sections.py:297:9: D407 [*] Missing dashed underline after section ("Args") 299 300 | that is broken. 300 301 | - Run `ruff check --fix` to apply this fix. - sections.py:312:5: D407 [*] Missing dashed underline after section ("Args") | 310 | """Toggle the gizmo. @@ -203,8 +185,6 @@ sections.py:312:5: D407 [*] Missing dashed underline after section ("Args") 314 315 | 315 316 | """ - Run `ruff check --fix` to apply this fix. - sections.py:324:9: D407 [*] Missing dashed underline after section ("Args") | 322 | """Test a valid args section. @@ -224,8 +204,6 @@ sections.py:324:9: D407 [*] Missing dashed underline after section ("Args") 326 327 | another_test: Another parameter. 327 328 | - Run `ruff check --fix` to apply this fix. - sections.py:336:9: D407 [*] Missing dashed underline after section ("Args") | 334 | """Test a valid args section. @@ -244,8 +222,6 @@ sections.py:336:9: D407 [*] Missing dashed underline after section ("Args") 338 339 | 339 340 | """ - Run `ruff check --fix` to apply this fix. - sections.py:348:9: D407 [*] Missing dashed underline after section ("Args") | 346 | """Test a valid args section. @@ -265,8 +241,6 @@ sections.py:348:9: D407 [*] Missing dashed underline after section ("Args") 350 351 | y: 351 352 | - Run `ruff check --fix` to apply this fix. - sections.py:361:9: D407 [*] Missing dashed underline after section ("Args") | 359 | """Test a valid args section. @@ -285,8 +259,6 @@ sections.py:361:9: D407 [*] Missing dashed underline after section ("Args") 363 364 | 364 365 | """ - Run `ruff check --fix` to apply this fix. - sections.py:373:9: D407 [*] Missing dashed underline after section ("Args") | 371 | """Test a valid args section. @@ -305,8 +277,6 @@ sections.py:373:9: D407 [*] Missing dashed underline after section ("Args") 375 376 | 376 377 | """ - Run `ruff check --fix` to apply this fix. - sections.py:382:9: D407 [*] Missing dashed underline after section ("Args") | 380 | """Do stuff. @@ -326,8 +296,6 @@ sections.py:382:9: D407 [*] Missing dashed underline after section ("Args") 384 385 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. 385 386 | Etiam at tellus a tellus faucibus maximus. Curabitur tellus - Run `ruff check --fix` to apply this fix. - sections.py:503:9: D407 [*] Missing dashed underline after section ("Args") | 501 | Testing this incorrectly indented docstring. @@ -346,8 +314,6 @@ sections.py:503:9: D407 [*] Missing dashed underline after section ("Args") 505 506 | 506 507 | """ - Run `ruff check --fix` to apply this fix. - sections.py:522:5: D407 [*] Missing dashed underline after section ("Parameters") | 521 | Parameters @@ -366,8 +332,6 @@ sections.py:522:5: D407 [*] Missing dashed underline after section ("Parameters" 524 524 | 525 525 | - Run `ruff check --fix` to apply this fix. - sections.py:530:5: D407 [*] Missing dashed underline after section ("Parameters") | 529 | Parameters @@ -386,8 +350,6 @@ sections.py:530:5: D407 [*] Missing dashed underline after section ("Parameters" 532 532 | 533 533 | - Run `ruff check --fix` to apply this fix. - sections.py:550:5: D407 [*] Missing dashed underline after section ("Args") | 548 | """Below, `returns:` should _not_ be considered a section header. @@ -406,8 +368,6 @@ sections.py:550:5: D407 [*] Missing dashed underline after section ("Args") 552 553 | 553 554 | returns: - Run `ruff check --fix` to apply this fix. - sections.py:560:5: D407 [*] Missing dashed underline after section ("Args") | 558 | """Below, `Returns:` should be considered a section header. @@ -426,8 +386,6 @@ sections.py:560:5: D407 [*] Missing dashed underline after section ("Args") 562 563 | 563 564 | Returns: - Run `ruff check --fix` to apply this fix. - sections.py:563:9: D407 [*] Missing dashed underline after section ("Returns") | 561 | Here's a note. @@ -446,8 +404,6 @@ sections.py:563:9: D407 [*] Missing dashed underline after section ("Returns") 565 566 | 566 567 | - Run `ruff check --fix` to apply this fix. - sections.py:602:4: D407 [*] Missing dashed underline after section ("Parameters") | 600 | """Test that lower case subsection header is valid even if it is of a different kind. @@ -466,5 +422,3 @@ sections.py:602:4: D407 [*] Missing dashed underline after section ("Parameters" 603 604 | -‐----------------- 604 605 | returns: 605 606 | some value - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D408_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D408_sections.py.snap index 2fca13d22bcab..81f23371f57ac 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D408_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D408_sections.py.snap @@ -17,6 +17,4 @@ sections.py:98:5: D408 [*] Section underline should be in the line following the 97 |- 98 97 | ------- 99 98 | A value of some sort. -100 99 | - - Run `ruff check --fix` to apply this fix. +100 99 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D409_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D409_sections.py.snap index 8fb6cb8f7b5ef..03f0165c075d6 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D409_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D409_sections.py.snap @@ -19,8 +19,6 @@ sections.py:111:5: D409 [*] Section underline should match the length of its nam 113 113 | 114 114 | """ - Run `ruff check --fix` to apply this fix. - sections.py:225:5: D409 [*] Section underline should match the length of its name ("Returns") | 224 | Returns @@ -40,8 +38,6 @@ sections.py:225:5: D409 [*] Section underline should match the length of its nam 227 227 | Raises: 228 228 | My attention. - Run `ruff check --fix` to apply this fix. - sections.py:578:5: D409 [*] Section underline should match the length of its name ("Other Parameters") | 577 | Other Parameters @@ -60,5 +56,3 @@ sections.py:578:5: D409 [*] Section underline should match the length of its nam 579 579 | other_parameters: 580 580 | A dictionary of string attributes 581 581 | parameters: - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_D410.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_D410.py.snap index 9d8321c821850..f85089aaae5f2 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_D410.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_D410.py.snap @@ -20,8 +20,6 @@ D410.py:4:5: D410 [*] Missing blank line after section ("Parameters") 11 12 | ------- 12 13 | int - Run `ruff check --fix` to apply this fix. - D410.py:21:5: D410 [*] Missing blank line after section ("Parameters") | 19 | """Showcase function. @@ -40,5 +38,3 @@ D410.py:21:5: D410 [*] Missing blank line after section ("Parameters") 23 24 | Returns 24 25 | ------- 25 26 | """ - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_sections.py.snap index 23b9ae4d8102a..babfdb73e0aa3 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D410_sections.py.snap @@ -20,8 +20,6 @@ sections.py:78:5: D410 [*] Missing blank line after section ("Returns") 81 82 | ------ 82 83 | - Run `ruff check --fix` to apply this fix. - sections.py:224:5: D410 [*] Missing blank line after section ("Returns") | 222 | returns. @@ -39,6 +37,4 @@ sections.py:224:5: D410 [*] Missing blank line after section ("Returns") 227 |+ 227 228 | Raises: 228 229 | My attention. -229 230 | - - Run `ruff check --fix` to apply this fix. +229 230 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D411_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D411_sections.py.snap index e27d436d66439..78cc96e5b14dd 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D411_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D411_sections.py.snap @@ -19,8 +19,6 @@ sections.py:80:5: D411 [*] Missing blank line before section ("Yields") 81 82 | ------ 82 83 | - Run `ruff check --fix` to apply this fix. - sections.py:134:5: D411 [*] Missing blank line before section ("Returns") | 133 | The function's description. @@ -39,8 +37,6 @@ sections.py:134:5: D411 [*] Missing blank line before section ("Returns") 135 136 | ------- 136 137 | A value of some sort. - Run `ruff check --fix` to apply this fix. - sections.py:227:5: D411 [*] Missing blank line before section ("Raises") | 225 | ------ @@ -57,6 +53,4 @@ sections.py:227:5: D411 [*] Missing blank line before section ("Raises") 227 |+ 227 228 | Raises: 228 229 | My attention. -229 230 | - - Run `ruff check --fix` to apply this fix. +229 230 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sections.py.snap index 653f2593387b4..241241feaef1f 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sections.py.snap @@ -17,6 +17,4 @@ sections.py:218:5: D412 [*] No blank lines allowed between a section header and 220 |- 221 220 | This is the function's description, which will also specify what it 222 221 | returns. -223 222 | - - Run `ruff check --fix` to apply this fix. +223 222 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sphinx.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sphinx.py.snap index e7a7f35282177..cea2584a9593e 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sphinx.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D412_sphinx.py.snap @@ -18,8 +18,6 @@ sphinx.py:13:5: D412 [*] No blank lines allowed between a section header and its 17 16 | 18 17 | import foo - Run `ruff check --fix` to apply this fix. - sphinx.py:24:5: D412 [*] No blank lines allowed between a section header and its content ("Example") | 22 | def func(): @@ -38,8 +36,6 @@ sphinx.py:24:5: D412 [*] No blank lines allowed between a section header and its 29 27 | 30 28 | import foo - Run `ruff check --fix` to apply this fix. - sphinx.py:47:5: D412 [*] No blank lines allowed between a section header and its content ("Example") | 45 | def func(): @@ -58,8 +54,6 @@ sphinx.py:47:5: D412 [*] No blank lines allowed between a section header and its 52 51 | 53 52 | import foo - Run `ruff check --fix` to apply this fix. - sphinx.py:59:5: D412 [*] No blank lines allowed between a section header and its content ("Example") | 57 | def func(): @@ -78,5 +72,3 @@ sphinx.py:59:5: D412 [*] No blank lines allowed between a section header and its 64 62 | .. code-block:: python 65 63 | 66 64 | import foo - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap index 812b6bebec7eb..e87a3713b407e 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_D413.py.snap @@ -20,8 +20,6 @@ D413.py:7:1: D413 [*] Missing blank line after last section ("Returns") 10 11 | 11 12 | - Run `ruff check --fix` to apply this fix. - D413.py:19:5: D413 [*] Missing blank line after last section ("Returns") | 17 | with a hanging indent @@ -41,8 +39,6 @@ D413.py:19:5: D413 [*] Missing blank line after last section ("Returns") 22 23 | 23 24 | - Run `ruff check --fix` to apply this fix. - D413.py:58:5: D413 [*] Missing blank line after last section ("Returns") | 56 | with a hanging indent @@ -64,8 +60,6 @@ D413.py:58:5: D413 [*] Missing blank line after last section ("Returns") 61 63 | 62 64 | def func(): - Run `ruff check --fix` to apply this fix. - D413.py:69:5: D413 [*] Missing blank line after last section ("Returns") | 67 | with a hanging indent @@ -83,5 +77,3 @@ D413.py:69:5: D413 [*] Missing blank line after last section ("Returns") 71 |- """ 71 |+ 72 |+ """ - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap index e6939c5f4db69..cfb1a9e652a01 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D413_sections.py.snap @@ -21,8 +21,6 @@ sections.py:67:5: D413 [*] Missing blank line after last section ("Returns") 69 71 | 70 72 | @expect(_D213) - Run `ruff check --fix` to apply this fix. - sections.py:122:5: D413 [*] Missing blank line after last section ("Returns") | 120 | """Toggle the gizmo. @@ -42,8 +40,6 @@ sections.py:122:5: D413 [*] Missing blank line after last section ("Returns") 126 127 | 127 128 | - Run `ruff check --fix` to apply this fix. - sections.py:172:5: D413 [*] Missing blank line after last section ("Returns") | 170 | """Toggle the gizmo. @@ -63,8 +59,6 @@ sections.py:172:5: D413 [*] Missing blank line after last section ("Returns") 175 176 | 176 177 | - Run `ruff check --fix` to apply this fix. - sections.py:521:5: D413 [*] Missing blank line after last section ("Parameters") | 519 | """Equal length equals should be replaced with dashes. @@ -84,8 +78,6 @@ sections.py:521:5: D413 [*] Missing blank line after last section ("Parameters") 524 525 | 525 526 | - Run `ruff check --fix` to apply this fix. - sections.py:529:5: D413 [*] Missing blank line after last section ("Parameters") | 527 | """Here, the length of equals is not the same. @@ -105,8 +97,6 @@ sections.py:529:5: D413 [*] Missing blank line after last section ("Parameters") 532 533 | 533 534 | - Run `ruff check --fix` to apply this fix. - sections.py:550:5: D413 [*] Missing blank line after last section ("Args") | 548 | """Below, `returns:` should _not_ be considered a section header. @@ -125,8 +115,6 @@ sections.py:550:5: D413 [*] Missing blank line after last section ("Args") 555 556 | 556 557 | - Run `ruff check --fix` to apply this fix. - sections.py:563:9: D413 [*] Missing blank line after last section ("Returns") | 561 | Here's a note. @@ -145,8 +133,6 @@ sections.py:563:9: D413 [*] Missing blank line after last section ("Returns") 565 566 | 566 567 | - Run `ruff check --fix` to apply this fix. - sections.py:590:5: D413 [*] Missing blank line after last section ("Parameters") | 588 | """Test that lower case subsection header is valid even if it has the same name as section kind. @@ -164,6 +150,4 @@ sections.py:590:5: D413 [*] Missing blank line after last section ("Parameters") 596 |+ 596 597 | """ 597 598 | -598 599 | - - Run `ruff check --fix` to apply this fix. +598 599 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap index d733e6f3ca70c..26d96178427eb 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap @@ -10,5 +10,3 @@ bom.py:1:1: D300 [*] Use triple double quotes `"""` 1 |-''' SAM macro definitions ''' 1 |+""" SAM macro definitions """ - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap index 40f5539a4e419..4ca8bddc73dc8 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap @@ -17,8 +17,6 @@ D209_D400.py:2:5: D209 [*] Multi-line docstring closing quotes should be on a se 3 |+ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua 4 |+ """ - Run `ruff check --fix` to apply this fix. - D209_D400.py:2:5: D400 [*] First line should end with a period | 1 | def lorem(): diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_0.py.snap index c6510aaab1b21..c26ebfa70f37e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_0.py.snap @@ -18,8 +18,6 @@ F401_0.py:2:8: F401 [*] `functools` imported but unused 4 4 | from collections import ( 5 5 | Counter, - Run `ruff check --fix` to apply this fix. - F401_0.py:6:5: F401 [*] `collections.OrderedDict` imported but unused | 4 | from collections import ( @@ -39,8 +37,6 @@ F401_0.py:6:5: F401 [*] `collections.OrderedDict` imported but unused 8 7 | ) 9 8 | import multiprocessing.pool - Run `ruff check --fix` to apply this fix. - F401_0.py:12:8: F401 [*] `logging.handlers` imported but unused | 10 | import multiprocessing.process @@ -60,8 +56,6 @@ F401_0.py:12:8: F401 [*] `logging.handlers` imported but unused 14 13 | TYPE_CHECKING, 15 14 | NamedTuple, - Run `ruff check --fix` to apply this fix. - F401_0.py:32:12: F401 [*] `shelve` imported but unused | 31 | if TYPE_CHECKING: @@ -79,8 +73,6 @@ F401_0.py:32:12: F401 [*] `shelve` imported but unused 34 33 | 35 34 | if TYPE_CHECKING: - Run `ruff check --fix` to apply this fix. - F401_0.py:33:12: F401 [*] `importlib` imported but unused | 31 | if TYPE_CHECKING: @@ -100,8 +92,6 @@ F401_0.py:33:12: F401 [*] `importlib` imported but unused 35 34 | if TYPE_CHECKING: 36 35 | """Hello, world!""" - Run `ruff check --fix` to apply this fix. - F401_0.py:37:12: F401 [*] `pathlib` imported but unused | 35 | if TYPE_CHECKING: @@ -121,8 +111,6 @@ F401_0.py:37:12: F401 [*] `pathlib` imported but unused 39 38 | z = 1 40 39 | - Run `ruff check --fix` to apply this fix. - F401_0.py:52:16: F401 [*] `pickle` imported but unused | 51 | def b(self) -> None: @@ -140,8 +128,6 @@ F401_0.py:52:16: F401 [*] `pickle` imported but unused 54 54 | 55 55 | __all__ = ["ClassA"] + ["ClassB"] - Run `ruff check --fix` to apply this fix. - F401_0.py:93:16: F401 [*] `x` imported but unused | 91 | match *0, 1, *2: @@ -160,8 +146,6 @@ F401_0.py:93:16: F401 [*] `x` imported but unused 95 94 | 96 95 | - Run `ruff check --fix` to apply this fix. - F401_0.py:94:16: F401 [*] `y` imported but unused | 92 | case 0,: @@ -179,8 +163,6 @@ F401_0.py:94:16: F401 [*] `y` imported but unused 96 95 | 97 96 | # Test: access a sub-importation via an alias. - Run `ruff check --fix` to apply this fix. - F401_0.py:99:8: F401 [*] `foo.bar.baz` imported but unused | 97 | # Test: access a sub-importation via an alias. @@ -200,8 +182,6 @@ F401_0.py:99:8: F401 [*] `foo.bar.baz` imported but unused 101 100 | print(bop.baz.read_csv("test.csv")) 102 101 | - Run `ruff check --fix` to apply this fix. - F401_0.py:105:12: F401 [*] `a1` imported but unused | 103 | # Test: isolated deletions. @@ -221,8 +201,6 @@ F401_0.py:105:12: F401 [*] `a1` imported but unused 107 106 | import a2 108 107 | - Run `ruff check --fix` to apply this fix. - F401_0.py:107:12: F401 [*] `a2` imported but unused | 105 | import a1 @@ -240,8 +218,6 @@ F401_0.py:107:12: F401 [*] `a2` imported but unused 109 108 | 110 109 | match *0, 1, *2: - Run `ruff check --fix` to apply this fix. - F401_0.py:112:16: F401 [*] `b1` imported but unused | 110 | match *0, 1, *2: @@ -261,8 +237,6 @@ F401_0.py:112:16: F401 [*] `b1` imported but unused 114 113 | import b2 115 114 | - Run `ruff check --fix` to apply this fix. - F401_0.py:114:16: F401 [*] `b2` imported but unused | 112 | import b1 @@ -280,8 +254,6 @@ F401_0.py:114:16: F401 [*] `b2` imported but unused 116 115 | 117 116 | # Regression test for: https://github.com/astral-sh/ruff/issues/7244 - Run `ruff check --fix` to apply this fix. - F401_0.py:122:1: F401 [*] `datameta_client_lib.model_helpers.noqa` imported but unused | 121 | from datameta_client_lib.model_helpers import ( @@ -295,5 +267,3 @@ F401_0.py:122:1: F401 [*] `datameta_client_lib.model_helpers.noqa` imported but 120 120 | 121 |-from datameta_client_lib.model_helpers import ( 122 |-noqa ) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_11.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_11.py.snap index e0bc330d108cc..140e7be7f064e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_11.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_11.py.snap @@ -17,5 +17,3 @@ F401_11.py:4:27: F401 [*] `pathlib.PurePath` imported but unused 5 5 | 6 6 | 7 7 | x: """List['Path']""" = [] - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_15.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_15.py.snap index f771102bca0f8..38c565af3274f 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_15.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_15.py.snap @@ -17,5 +17,3 @@ F401_15.py:5:25: F401 [*] `pathlib.Path` imported but unused 6 6 | 7 7 | 8 8 | class Foo: - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_17.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_17.py.snap index ae335b01c5486..ae550e0828ad3 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_17.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_17.py.snap @@ -19,8 +19,6 @@ F401_17.py:12:27: F401 [*] `threading.Thread` imported but unused 14 13 | # The `Thread` on the left-hand side should resolve to the `Thread` imported at the 15 14 | # top level. - Run `ruff check --fix` to apply this fix. - F401_17.py:20:27: F401 [*] `threading.Thread` imported but unused | 19 | def fn(thread: Thread): @@ -38,5 +36,3 @@ F401_17.py:20:27: F401 [*] `threading.Thread` imported but unused 21 20 | 22 21 | # The `Thread` on the left-hand side should resolve to the `Thread` imported at the 23 22 | # top level. - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_18.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_18.py.snap index da0082b0478c1..c7928f2d7c138 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_18.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_18.py.snap @@ -17,5 +17,3 @@ F401_18.py:5:12: F401 [*] `__future__` imported but unused 6 6 | 7 7 | 8 8 | def f(): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_23.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_23.py.snap index 9c178c5dde53c..055b7c47b91f4 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_23.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_23.py.snap @@ -17,5 +17,3 @@ F401_23.py:4:16: F401 [*] `re.RegexFlag` imported but unused 5 4 | from typing import Annotated 6 5 | 7 6 | p: Annotated["Path", int] = 1 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_5.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_5.py.snap index cf583375b8414..1da5724503adc 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_5.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_5.py.snap @@ -17,8 +17,6 @@ F401_5.py:2:17: F401 [*] `a.b.c` imported but unused 4 3 | import h.i 5 4 | import j.k as l - Run `ruff check --fix` to apply this fix. - F401_5.py:3:22: F401 [*] `d.e.f` imported but unused | 1 | """Test: removal of multi-segment and aliases imports.""" @@ -36,8 +34,6 @@ F401_5.py:3:22: F401 [*] `d.e.f` imported but unused 4 3 | import h.i 5 4 | import j.k as l - Run `ruff check --fix` to apply this fix. - F401_5.py:4:8: F401 [*] `h.i` imported but unused | 2 | from a.b import c @@ -54,8 +50,6 @@ F401_5.py:4:8: F401 [*] `h.i` imported but unused 4 |-import h.i 5 4 | import j.k as l - Run `ruff check --fix` to apply this fix. - F401_5.py:5:15: F401 [*] `j.k` imported but unused | 3 | from d.e import f as g @@ -69,5 +63,3 @@ F401_5.py:5:15: F401 [*] `j.k` imported but unused 3 3 | from d.e import f as g 4 4 | import h.i 5 |-import j.k as l - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_6.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_6.py.snap index 1e69b44488886..c5e546e5ccefa 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_6.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_6.py.snap @@ -19,8 +19,6 @@ F401_6.py:7:25: F401 [*] `.background.BackgroundTasks` imported but unused 9 8 | # F401 `datastructures.UploadFile` imported but unused 10 9 | from .datastructures import UploadFile as FileUpload - Run `ruff check --fix` to apply this fix. - F401_6.py:10:43: F401 [*] `.datastructures.UploadFile` imported but unused | 9 | # F401 `datastructures.UploadFile` imported but unused @@ -39,8 +37,6 @@ F401_6.py:10:43: F401 [*] `.datastructures.UploadFile` imported but unused 12 11 | # OK 13 12 | import applications as applications - Run `ruff check --fix` to apply this fix. - F401_6.py:16:8: F401 [*] `background` imported but unused | 15 | # F401 `background` imported but unused @@ -59,8 +55,6 @@ F401_6.py:16:8: F401 [*] `background` imported but unused 18 17 | # F401 `datastructures` imported but unused 19 18 | import datastructures as structures - Run `ruff check --fix` to apply this fix. - F401_6.py:19:26: F401 [*] `datastructures` imported but unused | 18 | # F401 `datastructures` imported but unused @@ -73,5 +67,3 @@ F401_6.py:19:26: F401 [*] `datastructures` imported but unused 17 17 | 18 18 | # F401 `datastructures` imported but unused 19 |-import datastructures as structures - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_7.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_7.py.snap index b0cd94c82ebc6..26a5fc8e9248d 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_7.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_7.py.snap @@ -21,8 +21,6 @@ F401_7.py:30:5: F401 [*] `typing.Union` imported but unused 33 32 | # This should ignore both errors. 34 33 | from typing import ( # noqa - Run `ruff check --fix` to apply this fix. - F401_7.py:66:20: F401 [*] `typing.Awaitable` imported but unused | 65 | # This should mark F501 as unused. @@ -36,8 +34,6 @@ F401_7.py:66:20: F401 [*] `typing.Awaitable` imported but unused 65 65 | # This should mark F501 as unused. 66 |-from typing import Awaitable, AwaitableGenerator # noqa: F501 - Run `ruff check --fix` to apply this fix. - F401_7.py:66:31: F401 [*] `typing.AwaitableGenerator` imported but unused | 65 | # This should mark F501 as unused. @@ -50,5 +46,3 @@ F401_7.py:66:31: F401 [*] `typing.AwaitableGenerator` imported but unused 64 64 | 65 65 | # This should mark F501 as unused. 66 |-from typing import Awaitable, AwaitableGenerator # noqa: F501 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_9.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_9.py.snap index ef62c7266e12d..77573d2424796 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_9.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_9.py.snap @@ -14,5 +14,3 @@ F401_9.py:4:22: F401 [*] `foo.baz` imported but unused 3 3 | __all__ = ("bar",) 4 |-from foo import bar, baz 4 |+from foo import bar - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_30.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_30.py.snap index bcb61e2b69ee8..fca763fa5880b 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_30.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_deprecated_option_F401_30.py.snap @@ -14,5 +14,3 @@ F401_30.py:6:19: F401 [*] `.main.MaμToMan` imported but unused 4 4 | """ 5 5 | 6 |-from .main import MaµToMan - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F504.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F504.py.snap index dacb8234f4358..5765f9ac0c3ea 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F504.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F504.py.snap @@ -20,8 +20,6 @@ F504.py:3:1: F504 [*] `%`-format string has unused named argument(s): b 5 5 | hidden = {"a": "!"} 6 6 | "%(a)s %(c)s" % {"x": 1, **hidden} # Ok (cannot see through splat) - Run `ruff check --fix` to apply this fix. - F504.py:8:1: F504 [*] `%`-format string has unused named argument(s): b | 6 | "%(a)s %(c)s" % {"x": 1, **hidden} # Ok (cannot see through splat) @@ -41,8 +39,6 @@ F504.py:8:1: F504 [*] `%`-format string has unused named argument(s): b 10 10 | 11 11 | '' % {'a''b' : ''} # F504 ("ab" not used) - Run `ruff check --fix` to apply this fix. - F504.py:9:1: F504 [*] `%`-format string has unused named argument(s): b | 8 | "%(a)s" % {"a": 1, r"b": "!"} # F504 ("b" not used) @@ -62,8 +58,6 @@ F504.py:9:1: F504 [*] `%`-format string has unused named argument(s): b 11 11 | '' % {'a''b' : ''} # F504 ("ab" not used) 12 12 | - Run `ruff check --fix` to apply this fix. - F504.py:11:1: F504 [*] `%`-format string has unused named argument(s): ab | 9 | "%(a)s" % {'a': 1, u"b": "!"} # F504 ("b" not used) @@ -84,8 +78,6 @@ F504.py:11:1: F504 [*] `%`-format string has unused named argument(s): ab 13 13 | # https://github.com/astral-sh/ruff/issues/4899 14 14 | "" % { - Run `ruff check --fix` to apply this fix. - F504.py:14:1: F504 [*] `%`-format string has unused named argument(s): test1, test2 | 13 | # https://github.com/astral-sh/ruff/issues/4899 @@ -102,5 +94,3 @@ F504.py:14:1: F504 [*] `%`-format string has unused named argument(s): test1, te 15 |- 'test1': '', 16 |- 'test2': '', 15 |+ 17 16 | } - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F50x.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F50x.py.snap index 665e8b841da36..f2ba29788eb7a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F50x.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F50x.py.snap @@ -20,5 +20,3 @@ F50x.py:8:1: F504 [*] `%`-format string has unused named argument(s): baz 9 9 | '%(bar)s' % (1, 2, 3) # F502 10 10 | '%s %s' % {'k': 'v'} # F503 11 11 | '%(bar)*s' % {'bar': 'baz'} # F506, F508 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F522_F522.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F522_F522.py.snap index 46a2dc467606b..6632dc890d772 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F522_F522.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F522_F522.py.snap @@ -16,8 +16,6 @@ F522.py:1:1: F522 [*] `.format` call has unused named argument(s): bar 3 3 | "{bar:{spam}}".format(bar=2, spam=3) # No issues 4 4 | "{bar:{spam}}".format(bar=2, spam=3, eggs=4, ham=5) # F522 - Run `ruff check --fix` to apply this fix. - F522.py:2:1: F522 [*] `.format` call has unused named argument(s): spam | 1 | "{}".format(1, bar=2) # F522 @@ -35,8 +33,6 @@ F522.py:2:1: F522 [*] `.format` call has unused named argument(s): spam 4 4 | "{bar:{spam}}".format(bar=2, spam=3, eggs=4, ham=5) # F522 5 5 | ('' - Run `ruff check --fix` to apply this fix. - F522.py:4:1: F522 [*] `.format` call has unused named argument(s): eggs, ham | 2 | "{bar}{}".format(1, bar=2, spam=3) # F522 @@ -56,8 +52,6 @@ F522.py:4:1: F522 [*] `.format` call has unused named argument(s): eggs, ham 5 5 | ('' 6 6 | .format(x=2)) # F522 - Run `ruff check --fix` to apply this fix. - F522.py:5:2: F522 [*] `.format` call has unused named argument(s): x | 3 | "{bar:{spam}}".format(bar=2, spam=3) # No issues @@ -74,5 +68,3 @@ F522.py:5:2: F522 [*] `.format` call has unused named argument(s): x 5 5 | ('' 6 |- .format(x=2)) # F522 6 |+ .format()) # F522 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F523_F523.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F523_F523.py.snap index 848dfa58e5332..e7484a948334e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F523_F523.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F523_F523.py.snap @@ -18,8 +18,6 @@ F523.py:2:1: F523 [*] `.format` call has unused arguments at position(s): 1 4 4 | "{1:{0}}".format(1, 2) # No issues 5 5 | "{1:{0}}".format(1, 2, 3) # F523 - Run `ruff check --fix` to apply this fix. - F523.py:3:1: F523 `.format` call has unused arguments at position(s): 0, 2 | 1 | # With indexes @@ -51,8 +49,6 @@ F523.py:5:1: F523 [*] `.format` call has unused arguments at position(s): 2 7 7 | "{1.arg[1]!r:0{2['arg']}{1}}".format(1, 2, 3, 4) # F523 8 8 | - Run `ruff check --fix` to apply this fix. - F523.py:6:1: F523 [*] `.format` call has unused arguments at position(s): 1 | 4 | "{1:{0}}".format(1, 2) # No issues @@ -72,8 +68,6 @@ F523.py:6:1: F523 [*] `.format` call has unused arguments at position(s): 1 8 8 | 9 9 | # With no indexes - Run `ruff check --fix` to apply this fix. - F523.py:7:1: F523 `.format` call has unused arguments at position(s): 0, 3 | 5 | "{1:{0}}".format(1, 2, 3) # F523 @@ -104,8 +98,6 @@ F523.py:10:1: F523 [*] `.format` call has unused arguments at position(s): 1 12 12 | "{:{}}".format(1, 2) # No issues 13 13 | "{:{}}".format(1, 2, 3) # F523 - Run `ruff check --fix` to apply this fix. - F523.py:11:1: F523 [*] `.format` call has unused arguments at position(s): 1, 2 | 9 | # With no indexes @@ -126,8 +118,6 @@ F523.py:11:1: F523 [*] `.format` call has unused arguments at position(s): 1, 2 13 13 | "{:{}}".format(1, 2, 3) # F523 14 14 | - Run `ruff check --fix` to apply this fix. - F523.py:13:1: F523 [*] `.format` call has unused arguments at position(s): 2 | 11 | "{}".format(1, 2, 3) # F523 @@ -148,8 +138,6 @@ F523.py:13:1: F523 [*] `.format` call has unused arguments at position(s): 2 15 15 | # With *args 16 16 | "{0}{1}".format(*args) # No issues - Run `ruff check --fix` to apply this fix. - F523.py:19:1: F523 `.format` call has unused arguments at position(s): 2 | 17 | "{0}{1}".format(1, *args) # No issues @@ -180,8 +168,6 @@ F523.py:22:1: F523 [*] `.format` call has unused arguments at position(s): 1, 2 24 24 | '""{1}{0}'.format(1, 2, 3) # F523 25 25 | - Run `ruff check --fix` to apply this fix. - F523.py:23:1: F523 [*] `.format` call has unused arguments at position(s): 2 | 21 | # With nested quotes @@ -201,8 +187,6 @@ F523.py:23:1: F523 [*] `.format` call has unused arguments at position(s): 2 25 25 | 26 26 | # With modified indexes - Run `ruff check --fix` to apply this fix. - F523.py:24:1: F523 [*] `.format` call has unused arguments at position(s): 2 | 22 | "''1{0}".format(1, 2, 3) # F523 @@ -223,8 +207,6 @@ F523.py:24:1: F523 [*] `.format` call has unused arguments at position(s): 2 26 26 | # With modified indexes 27 27 | "{1}{2}".format(1, 2, 3) # F523, # F524 - Run `ruff check --fix` to apply this fix. - F523.py:27:1: F523 `.format` call has unused arguments at position(s): 0 | 26 | # With modified indexes @@ -271,5 +253,3 @@ F523.py:32:2: F523 [*] `.format` call has unused arguments at position(s): 0 32 32 | ('' 33 |-.format(2)) 33 |+.format()) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F541_F541.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F541_F541.py.snap index 7f88e9c5ed4ea..a3f0cf5fd5fe2 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F541_F541.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F541_F541.py.snap @@ -20,8 +20,6 @@ F541.py:6:5: F541 [*] f-string without any placeholders 8 8 | e = ( 9 9 | f"def" + - Run `ruff check --fix` to apply this fix. - F541.py:7:5: F541 [*] f-string without any placeholders | 5 | # Errors @@ -42,8 +40,6 @@ F541.py:7:5: F541 [*] f-string without any placeholders 9 9 | f"def" + 10 10 | "ghi" - Run `ruff check --fix` to apply this fix. - F541.py:9:5: F541 [*] f-string without any placeholders | 7 | d = f"def" + "ghi" @@ -64,8 +60,6 @@ F541.py:9:5: F541 [*] f-string without any placeholders 11 11 | ) 12 12 | f = ( - Run `ruff check --fix` to apply this fix. - F541.py:13:5: F541 [*] f-string without any placeholders | 11 | ) @@ -86,8 +80,6 @@ F541.py:13:5: F541 [*] f-string without any placeholders 15 15 | "c" 16 16 | rf"d" - Run `ruff check --fix` to apply this fix. - F541.py:14:5: F541 [*] f-string without any placeholders | 12 | f = ( @@ -108,8 +100,6 @@ F541.py:14:5: F541 [*] f-string without any placeholders 16 16 | rf"d" 17 17 | fr"e" - Run `ruff check --fix` to apply this fix. - F541.py:16:5: F541 [*] f-string without any placeholders | 14 | F"b" @@ -130,8 +120,6 @@ F541.py:16:5: F541 [*] f-string without any placeholders 18 18 | ) 19 19 | g = f"" - Run `ruff check --fix` to apply this fix. - F541.py:17:5: F541 [*] f-string without any placeholders | 15 | "c" @@ -152,8 +140,6 @@ F541.py:17:5: F541 [*] f-string without any placeholders 19 19 | g = f"" 20 20 | - Run `ruff check --fix` to apply this fix. - F541.py:19:5: F541 [*] f-string without any placeholders | 17 | fr"e" @@ -174,8 +160,6 @@ F541.py:19:5: F541 [*] f-string without any placeholders 21 21 | # OK 22 22 | g = f"ghi{123:{45}}" - Run `ruff check --fix` to apply this fix. - F541.py:25:13: F541 [*] f-string without any placeholders | 24 | # Error @@ -195,8 +179,6 @@ F541.py:25:13: F541 [*] f-string without any placeholders 27 27 | v = 23.234234 28 28 | - Run `ruff check --fix` to apply this fix. - F541.py:34:7: F541 [*] f-string without any placeholders | 33 | # Errors @@ -216,8 +198,6 @@ F541.py:34:7: F541 [*] f-string without any placeholders 36 36 | f"{{test}}" 37 37 | f'{{ 40 }}' - Run `ruff check --fix` to apply this fix. - F541.py:35:4: F541 [*] f-string without any placeholders | 33 | # Errors @@ -238,8 +218,6 @@ F541.py:35:4: F541 [*] f-string without any placeholders 37 37 | f'{{ 40 }}' 38 38 | f"{{a {{x}}" - Run `ruff check --fix` to apply this fix. - F541.py:36:1: F541 [*] f-string without any placeholders | 34 | f"{v:{f'0.2f'}}" @@ -260,8 +238,6 @@ F541.py:36:1: F541 [*] f-string without any placeholders 38 38 | f"{{a {{x}}" 39 39 | f"{{{{x}}}}" - Run `ruff check --fix` to apply this fix. - F541.py:37:1: F541 [*] f-string without any placeholders | 35 | f"{f''}" @@ -282,8 +258,6 @@ F541.py:37:1: F541 [*] f-string without any placeholders 39 39 | f"{{{{x}}}}" 40 40 | ""f"" - Run `ruff check --fix` to apply this fix. - F541.py:38:1: F541 [*] f-string without any placeholders | 36 | f"{{test}}" @@ -304,8 +278,6 @@ F541.py:38:1: F541 [*] f-string without any placeholders 40 40 | ""f"" 41 41 | ''f"" - Run `ruff check --fix` to apply this fix. - F541.py:39:1: F541 [*] f-string without any placeholders | 37 | f'{{ 40 }}' @@ -326,8 +298,6 @@ F541.py:39:1: F541 [*] f-string without any placeholders 41 41 | ''f"" 42 42 | (""f""r"") - Run `ruff check --fix` to apply this fix. - F541.py:40:3: F541 [*] f-string without any placeholders | 38 | f"{{a {{x}}" @@ -348,8 +318,6 @@ F541.py:40:3: F541 [*] f-string without any placeholders 42 42 | (""f""r"") 43 43 | f"{v:{f"0.2f"}}" - Run `ruff check --fix` to apply this fix. - F541.py:41:3: F541 [*] f-string without any placeholders | 39 | f"{{{{x}}}}" @@ -370,8 +338,6 @@ F541.py:41:3: F541 [*] f-string without any placeholders 43 43 | f"{v:{f"0.2f"}}" 44 44 | f"\{{x}}" - Run `ruff check --fix` to apply this fix. - F541.py:42:4: F541 [*] f-string without any placeholders | 40 | ""f"" @@ -391,8 +357,6 @@ F541.py:42:4: F541 [*] f-string without any placeholders 43 43 | f"{v:{f"0.2f"}}" 44 44 | f"\{{x}}" - Run `ruff check --fix` to apply this fix. - F541.py:43:7: F541 [*] f-string without any placeholders | 41 | ''f"" @@ -410,8 +374,6 @@ F541.py:43:7: F541 [*] f-string without any placeholders 43 |+f"{v:{"0.2f"}}" 44 44 | f"\{{x}}" - Run `ruff check --fix` to apply this fix. - F541.py:44:1: F541 [*] f-string without any placeholders | 42 | (""f""r"") @@ -426,5 +388,3 @@ F541.py:44:1: F541 [*] f-string without any placeholders 43 43 | f"{v:{f"0.2f"}}" 44 |-f"\{{x}}" 44 |+"\{x}" - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F632_F632.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F632_F632.py.snap index 421b503544d0a..9c1df7356596d 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F632_F632.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F632_F632.py.snap @@ -15,8 +15,6 @@ F632.py:1:4: F632 [*] Use `==` to compare constant literals 3 3 | 4 4 | if 123 is not y: - Run `ruff check --fix` to apply this fix. - F632.py:4:4: F632 [*] Use `!=` to compare constant literals | 2 | pass @@ -36,8 +34,6 @@ F632.py:4:4: F632 [*] Use `!=` to compare constant literals 6 6 | 7 7 | if 123 is \ - Run `ruff check --fix` to apply this fix. - F632.py:7:4: F632 [*] Use `!=` to compare constant literals | 5 | pass @@ -60,8 +56,6 @@ F632.py:7:4: F632 [*] Use `!=` to compare constant literals 10 9 | 11 10 | if "123" is x < 3: - Run `ruff check --fix` to apply this fix. - F632.py:11:4: F632 [*] Use `==` to compare constant literals | 9 | pass @@ -81,8 +75,6 @@ F632.py:11:4: F632 [*] Use `==` to compare constant literals 13 13 | 14 14 | if "123" != x is 3: - Run `ruff check --fix` to apply this fix. - F632.py:14:4: F632 [*] Use `==` to compare constant literals | 12 | pass @@ -102,8 +94,6 @@ F632.py:14:4: F632 [*] Use `==` to compare constant literals 16 16 | 17 17 | if ("123" != x) is 3: - Run `ruff check --fix` to apply this fix. - F632.py:17:4: F632 [*] Use `==` to compare constant literals | 15 | pass @@ -123,8 +113,6 @@ F632.py:17:4: F632 [*] Use `==` to compare constant literals 19 19 | 20 20 | if "123" != (x is 3): - Run `ruff check --fix` to apply this fix. - F632.py:20:14: F632 [*] Use `==` to compare constant literals | 18 | pass @@ -144,8 +132,6 @@ F632.py:20:14: F632 [*] Use `==` to compare constant literals 22 22 | 23 23 | {2 is - Run `ruff check --fix` to apply this fix. - F632.py:23:2: F632 [*] Use `!=` to compare constant literals | 21 | pass @@ -169,8 +155,6 @@ F632.py:23:2: F632 [*] Use `!=` to compare constant literals 26 25 | {2 is 27 26 | not ''} - Run `ruff check --fix` to apply this fix. - F632.py:26:2: F632 [*] Use `!=` to compare constant literals | 24 | not ''} @@ -194,8 +178,6 @@ F632.py:26:2: F632 [*] Use `!=` to compare constant literals 29 28 | # Regression test for 30 29 | if values[1is not None ] is not '-': - Run `ruff check --fix` to apply this fix. - F632.py:30:4: F632 [*] Use `!=` to compare constant literals | 29 | # Regression test for @@ -214,8 +196,6 @@ F632.py:30:4: F632 [*] Use `!=` to compare constant literals 32 32 | 33 33 | # Regression test for https://github.com/astral-sh/ruff/issues/11736 - Run `ruff check --fix` to apply this fix. - F632.py:30:11: F632 [*] Use `!=` to compare constant literals | 29 | # Regression test for @@ -234,8 +214,6 @@ F632.py:30:11: F632 [*] Use `!=` to compare constant literals 32 32 | 33 33 | # Regression test for https://github.com/astral-sh/ruff/issues/11736 - Run `ruff check --fix` to apply this fix. - F632.py:34:12: F632 [*] Use `!=` to compare constant literals | 33 | # Regression test for https://github.com/astral-sh/ruff/issues/11736 @@ -249,5 +227,3 @@ F632.py:34:12: F632 [*] Use `!=` to compare constant literals 33 33 | # Regression test for https://github.com/astral-sh/ruff/issues/11736 34 |-variable: "123 is not y" 34 |+variable: "123 != y" - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap index cbc830b1bb3ed..8562d8f829fd7 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_17.py.snap @@ -19,8 +19,6 @@ F811_17.py:6:12: F811 [*] Redefinition of unused `fu` from line 2 8 7 | def baz(): 9 8 | def fu(): - Run `ruff check --fix` to apply this fix. - F811_17.py:9:13: F811 Redefinition of unused `fu` from line 6 | 8 | def baz(): diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_21.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_21.py.snap index ade687fee660f..732e718629ef1 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_21.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_21.py.snap @@ -20,5 +20,3 @@ F811_21.py:32:5: F811 [*] Redefinition of unused `Sequence` from line 26 34 33 | 35 34 | # This should ignore both errors. 36 35 | from typing import ( # noqa - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_6.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_6.py.snap index 3218f772d92bd..ce97ded5ecdfa 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_6.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_6.py.snap @@ -16,5 +16,3 @@ F811_6.py:6:12: F811 [*] Redefinition of unused `os` from line 5 5 5 | import os 6 |- import os 7 6 | os.path - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_8.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_8.py.snap index 2c376a5569ebd..149e19e3df9ba 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_8.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_8.py.snap @@ -19,5 +19,3 @@ F811_8.py:5:12: F811 [*] Redefinition of unused `os` from line 4 6 5 | except: 7 6 | pass 8 7 | os.path - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap index fc2ab324ace41..7b01ea8d234d3 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap @@ -19,8 +19,6 @@ F841_0.py:3:22: F841 [*] Local variable `e` is assigned to but never used 5 5 | 6 6 | - Run `ruff check --fix` to apply this fix. - F841_0.py:16:5: F841 [*] Local variable `z` is assigned to but never used | 14 | x = 1 diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap index 5b97b8265db6a..9bbab36f7ce40 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap @@ -150,8 +150,6 @@ F841_3.py:40:26: F841 [*] Local variable `x1` is assigned to but never used 42 42 | 43 43 | try: - Run `ruff check --fix` to apply this fix. - F841_3.py:45:47: F841 [*] Local variable `x2` is assigned to but never used | 43 | try: @@ -171,8 +169,6 @@ F841_3.py:45:47: F841 [*] Local variable `x2` is assigned to but never used 47 47 | 48 48 | - Run `ruff check --fix` to apply this fix. - F841_3.py:50:5: F841 [*] Local variable `x` is assigned to but never used | 49 | def f(a, b): @@ -391,8 +387,6 @@ F841_3.py:155:17: F841 [*] Local variable `e` is assigned to but never used 157 157 | 158 158 | - Run `ruff check --fix` to apply this fix. - F841_3.py:160:5: F841 [*] Local variable `x` is assigned to but never used | 159 | def f(): diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F901_F901.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F901_F901.py.snap index 2026e1a322650..5d72b897d1961 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F901_F901.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F901_F901.py.snap @@ -16,8 +16,6 @@ F901.py:2:11: F901 [*] `raise NotImplemented` should be `raise NotImplementedErr 4 4 | 5 5 | def g() -> None: - Run `ruff check --fix` to apply this fix. - F901.py:6:11: F901 [*] `raise NotImplemented` should be `raise NotImplementedError` | 5 | def g() -> None: @@ -35,8 +33,6 @@ F901.py:6:11: F901 [*] `raise NotImplemented` should be `raise NotImplementedErr 8 8 | 9 9 | def h() -> None: - Run `ruff check --fix` to apply this fix. - F901.py:11:11: F901 [*] `raise NotImplemented` should be `raise NotImplementedError` | 9 | def h() -> None: @@ -56,5 +52,3 @@ F901.py:11:11: F901 [*] `raise NotImplemented` should be `raise NotImplementedEr 10 11 | NotImplementedError = "foo" 11 |- raise NotImplemented 12 |+ raise builtins.NotImplementedError - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_global_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_global_scope.snap index b510b9c7fe79c..d338d1b798ab5 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_global_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_global_scope.snap @@ -19,5 +19,3 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 6 6 | 7 7 | # Despite this `del`, `import os` in `f` should still be flagged as shadowing an unused 8 8 | # import. (This is a false negative, but is consistent with Pyflakes.) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_local_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_local_scope.snap index 879b30449c37e..a16413dcdb9bd 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_local_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_global_import_in_local_scope.snap @@ -16,8 +16,6 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 4 3 | def f(): 5 4 | import os - Run `ruff check --fix` to apply this fix. - :5:12: F811 [*] Redefinition of unused `os` from line 2 | 4 | def f(): @@ -35,5 +33,3 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 6 5 | 7 6 | # Despite this `del`, `import os` in `f` should still be flagged as shadowing an unused 8 7 | # import. - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_import_shadow_in_local_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_import_shadow_in_local_scope.snap index 13aa14ffca58e..5404ed9635a2e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_import_shadow_in_local_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_import_shadow_in_local_scope.snap @@ -16,8 +16,6 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 4 3 | def f(): 5 4 | os = 1 - Run `ruff check --fix` to apply this fix. - :5:5: F811 Redefinition of unused `os` from line 2 | 4 | def f(): diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap index 03472bf20eee3..da12aa134da63 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__del_shadowed_local_import_in_local_scope.snap @@ -19,5 +19,3 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 5 4 | 6 5 | # Despite this `del`, `import os` should still be flagged as shadowing an unused 7 6 | # import. - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f401_preview_first_party_submodule_dunder_all.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f401_preview_first_party_submodule_dunder_all.snap index d4b19d5a5ce3f..f713007f5a94b 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f401_preview_first_party_submodule_dunder_all.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f401_preview_first_party_submodule_dunder_all.snap @@ -15,5 +15,3 @@ __init__.py:2:8: F401 [*] `submodule.a` imported but unused; consider removing, 3 |-__all__ = ['FOO'] 3 |+__all__ = ['FOO', 'submodule'] 4 4 | FOO = 42 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap index 32cbf13f77bf2..66214b7457738 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap @@ -19,8 +19,6 @@ F841_0.py:3:22: F841 [*] Local variable `e` is assigned to but never used 5 5 | 6 6 | - Run `ruff check --fix` to apply this fix. - F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used | 19 | def f(): @@ -188,5 +186,3 @@ F841_0.py:152:25: F841 [*] Local variable `_` is assigned to but never used 152 |- except Exception as _: 152 |+ except Exception: 153 153 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__future_annotations.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__future_annotations.snap index 3e72b6eecf3b7..1713984cd5bf0 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__future_annotations.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__future_annotations.snap @@ -19,8 +19,6 @@ future_annotations.py:8:5: F401 [*] `models.Nut` imported but unused 10 9 | 11 10 | - Run `ruff check --fix` to apply this fix. - future_annotations.py:26:19: F821 Undefined name `Bar` | 25 | @classmethod diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_multiple_unbinds_from_module_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_multiple_unbinds_from_module_scope.snap index 6ea60e08f1bc2..f9b257fd69b9c 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_multiple_unbinds_from_module_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_multiple_unbinds_from_module_scope.snap @@ -20,8 +20,6 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 9 9 | 10 10 | try: - Run `ruff check --fix` to apply this fix. - :12:26: F841 [*] Local variable `x` is assigned to but never used | 10 | try: @@ -40,5 +38,3 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 13 13 | pass 14 14 | 15 15 | # This should resolve to the `x` in `x = 1`. - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_class_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_class_scope.snap index 61faa64ea794a..d8cbaf91d7e9a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_class_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_class_scope.snap @@ -20,8 +20,6 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 10 10 | 11 11 | # This should raise an F821 error, rather than resolving to the - Run `ruff check --fix` to apply this fix. - :13:15: F821 Undefined name `x` | 11 | # This should raise an F821 error, rather than resolving to the diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_module_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_module_scope.snap index 93373ffece0e9..cb22fa76e4d10 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_module_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_module_scope.snap @@ -19,5 +19,3 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 8 8 | pass 9 9 | 10 10 | # This should resolve to the `x` in `x = 1`. - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_nested_module_scope.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_nested_module_scope.snap index 72f45fa5fd981..14a7fcbfb38f5 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_nested_module_scope.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__load_after_unbind_from_nested_module_scope.snap @@ -20,8 +20,6 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 9 9 | 10 10 | def g(): - Run `ruff check --fix` to apply this fix. - :13:30: F841 [*] Local variable `x` is assigned to but never used | 11 | try: @@ -40,5 +38,3 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 14 14 | pass 15 15 | 16 16 | # This should resolve to the `x` in `x = 1`. - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__multi_statement_lines.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__multi_statement_lines.snap index a332c14d47de5..46f92118de742 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__multi_statement_lines.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__multi_statement_lines.snap @@ -17,8 +17,6 @@ multi_statement_lines.py:2:12: F401 [*] `foo1` imported but unused 4 4 | 5 5 | if True: - Run `ruff check --fix` to apply this fix. - multi_statement_lines.py:3:12: F401 [*] `foo2` imported but unused | 1 | if True: @@ -38,8 +36,6 @@ multi_statement_lines.py:3:12: F401 [*] `foo2` imported but unused 5 5 | if True: 6 6 | import foo3; \ - Run `ruff check --fix` to apply this fix. - multi_statement_lines.py:6:12: F401 [*] `foo3` imported but unused | 5 | if True: @@ -59,8 +55,6 @@ multi_statement_lines.py:6:12: F401 [*] `foo3` imported but unused 9 8 | if True: 10 9 | import foo4 \ - Run `ruff check --fix` to apply this fix. - multi_statement_lines.py:10:12: F401 [*] `foo4` imported but unused | 9 | if True: @@ -80,8 +74,6 @@ multi_statement_lines.py:10:12: F401 [*] `foo4` imported but unused 13 12 | if True: 14 13 | x = 1; import foo5 - Run `ruff check --fix` to apply this fix. - multi_statement_lines.py:14:19: F401 [*] `foo5` imported but unused | 13 | if True: @@ -99,8 +91,6 @@ multi_statement_lines.py:14:19: F401 [*] `foo5` imported but unused 16 16 | 17 17 | if True: - Run `ruff check --fix` to apply this fix. - multi_statement_lines.py:19:17: F401 [*] `foo6` imported but unused | 17 | if True: @@ -122,8 +112,6 @@ multi_statement_lines.py:19:17: F401 [*] `foo6` imported but unused 21 20 | if True: 22 21 | x = 1 \ - Run `ruff check --fix` to apply this fix. - multi_statement_lines.py:23:18: F401 [*] `foo7` imported but unused | 21 | if True: @@ -144,8 +132,6 @@ multi_statement_lines.py:23:18: F401 [*] `foo7` imported but unused 25 25 | if True: 26 26 | x = 1; import foo8; x = 1 - Run `ruff check --fix` to apply this fix. - multi_statement_lines.py:26:19: F401 [*] `foo8` imported but unused | 25 | if True: @@ -164,8 +150,6 @@ multi_statement_lines.py:26:19: F401 [*] `foo8` imported but unused 28 28 | 29 29 | if True: - Run `ruff check --fix` to apply this fix. - multi_statement_lines.py:27:23: F401 [*] `foo9` imported but unused | 25 | if True: @@ -186,8 +170,6 @@ multi_statement_lines.py:27:23: F401 [*] `foo9` imported but unused 29 29 | if True: 30 30 | x = 1; \ - Run `ruff check --fix` to apply this fix. - multi_statement_lines.py:31:16: F401 [*] `foo10` imported but unused | 29 | if True: @@ -208,8 +190,6 @@ multi_statement_lines.py:31:16: F401 [*] `foo10` imported but unused 34 33 | if True: 35 34 | x = 1 \ - Run `ruff check --fix` to apply this fix. - multi_statement_lines.py:36:17: F401 [*] `foo11` imported but unused | 34 | if True: @@ -228,8 +208,6 @@ multi_statement_lines.py:36:17: F401 [*] `foo11` imported but unused 38 37 | 39 38 | if True: - Run `ruff check --fix` to apply this fix. - multi_statement_lines.py:42:16: F401 [*] `foo12` imported but unused | 40 | x = 1; \ @@ -252,8 +230,6 @@ multi_statement_lines.py:42:16: F401 [*] `foo12` imported but unused 44 42 | if True: 45 43 | x = 1; \ - Run `ruff check --fix` to apply this fix. - multi_statement_lines.py:47:12: F401 [*] `foo13` imported but unused | 45 | x = 1; \ @@ -274,8 +250,6 @@ multi_statement_lines.py:47:12: F401 [*] `foo13` imported but unused 49 47 | 50 48 | if True: - Run `ruff check --fix` to apply this fix. - multi_statement_lines.py:53:12: F401 [*] `foo14` imported but unused | 51 | x = 1; \ @@ -295,8 +269,6 @@ multi_statement_lines.py:53:12: F401 [*] `foo14` imported but unused 55 54 | # Continuation, but not as the last content in the file. 56 55 | x = 1; \ - Run `ruff check --fix` to apply this fix. - multi_statement_lines.py:57:8: F401 [*] `foo15` imported but unused | 55 | # Continuation, but not as the last content in the file. @@ -318,8 +290,6 @@ multi_statement_lines.py:57:8: F401 [*] `foo15` imported but unused 59 58 | # Continuation, followed by end-of-file. (Removing `import foo` would cause a syntax 60 59 | # error.) - Run `ruff check --fix` to apply this fix. - multi_statement_lines.py:62:8: F401 [*] `foo16` imported but unused | 60 | # error.) @@ -334,6 +304,4 @@ multi_statement_lines.py:62:8: F401 [*] `foo16` imported but unused 60 60 | # error.) 61 |-x = 1; \ 62 |-import foo16 - 61 |+x = 1; - - Run `ruff check --fix` to apply this fix. + 61 |+x = 1; diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap index 7db672fa365f9..bdab1da6a3b20 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_24____init__.py.snap @@ -25,8 +25,6 @@ __init__.py:33:15: F401 [*] `.unused` imported but unused; consider removing, ad 35 35 | 36 36 | from . import renamed as bees # F401: no fix - Run `ruff check --fix` to apply this fix. - __init__.py:36:26: F401 `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 36 | from . import renamed as bees # F401: no fix diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap index 469df4739b5a6..aa51c8d07a60e 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_25__all_nonempty____init__.py.snap @@ -22,8 +22,6 @@ __init__.py:36:15: F401 [*] `.unused` imported but unused; consider removing, ad 42 |-__all__ = ["argparse", "exported"] 42 |+__all__ = ["argparse", "exported", "unused"] - Run `ruff check --fix` to apply this fix. - __init__.py:39:26: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 39 | from . import renamed as bees # F401: add to __all__ @@ -36,5 +34,3 @@ __init__.py:39:26: F401 [*] `.renamed` imported but unused; consider removing, a 41 41 | 42 |-__all__ = ["argparse", "exported"] 42 |+__all__ = ["argparse", "exported", "bees"] - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_26__all_empty____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_26__all_empty____init__.py.snap index 71bbd5bef05d8..1694fe30530e5 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_26__all_empty____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_26__all_empty____init__.py.snap @@ -14,8 +14,6 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add 11 |-__all__ = [] 11 |+__all__ = ["unused"] - Run `ruff check --fix` to apply this fix. - __init__.py:8:26: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 8 | from . import renamed as bees # F401: add to __all__ @@ -28,5 +26,3 @@ __init__.py:8:26: F401 [*] `.renamed` imported but unused; consider removing, ad 10 10 | 11 |-__all__ = [] 11 |+__all__ = ["bees"] - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_28__all_multiple____init__.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_28__all_multiple____init__.py.snap index 6aeed928cca8a..ad62ca23280f3 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_28__all_multiple____init__.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__preview__F401_F401_28__all_multiple____init__.py.snap @@ -14,8 +14,6 @@ __init__.py:5:15: F401 [*] `.unused` imported but unused; consider removing, add 8 |-__all__ = []; 8 |+__all__ = ["bees", "unused"]; - Run `ruff check --fix` to apply this fix. - __init__.py:5:34: F401 [*] `.renamed` imported but unused; consider removing, adding to `__all__`, or using a redundant alias | 5 | from . import unused, renamed as bees # F401: add to __all__ @@ -28,5 +26,3 @@ __init__.py:5:34: F401 [*] `.renamed` imported but unused; consider removing, ad 7 7 | 8 |-__all__ = []; 8 |+__all__ = ["bees", "unused"]; - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_double_shadowing_except.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_double_shadowing_except.snap index c9ce15855414c..f7508ae7333e5 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_double_shadowing_except.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_double_shadowing_except.snap @@ -21,8 +21,6 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 9 9 | except ImportError as x: 10 10 | pass - Run `ruff check --fix` to apply this fix. - :9:27: F841 [*] Local variable `x` is assigned to but never used | 7 | except ValueError as x: @@ -41,5 +39,3 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 10 10 | pass 11 11 | 12 12 | # No error here, though it should arguably be an F821 error. `x` will - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_shadowing_except.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_shadowing_except.snap index 12208560a0bec..ef217d6fb638b 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_shadowing_except.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__print_in_body_after_shadowing_except.snap @@ -19,5 +19,3 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs 8 8 | pass 9 9 | 10 10 | # No error here, though it should arguably be an F821 error. `x` will - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0208_iteration_over_set.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0208_iteration_over_set.py.snap index 2aa0a21f067fe..46ee34927ce80 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0208_iteration_over_set.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0208_iteration_over_set.py.snap @@ -19,8 +19,6 @@ iteration_over_set.py:3:13: PLC0208 [*] Use a sequence type instead of a `set` w 5 5 | 6 6 | for item in {"apples", "lemons", "water"}: # flags in-line set literals - Run `ruff check --fix` to apply this fix. - iteration_over_set.py:6:13: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 4 | print(f"I can count to {item}!") @@ -40,8 +38,6 @@ iteration_over_set.py:6:13: PLC0208 [*] Use a sequence type instead of a `set` w 8 8 | 9 9 | for item in {1,}: - Run `ruff check --fix` to apply this fix. - iteration_over_set.py:9:13: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 7 | print(f"I like {item}.") @@ -61,8 +57,6 @@ iteration_over_set.py:9:13: PLC0208 [*] Use a sequence type instead of a `set` w 11 11 | 12 12 | for item in { - Run `ruff check --fix` to apply this fix. - iteration_over_set.py:12:13: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 10 | print(f"I can count to {item}!") @@ -88,8 +82,6 @@ iteration_over_set.py:12:13: PLC0208 [*] Use a sequence type instead of a `set` 16 16 | 17 17 | numbers_list = [i for i in {1, 2, 3}] # flags sets in list comprehensions - Run `ruff check --fix` to apply this fix. - iteration_over_set.py:17:28: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 15 | print(f"I like {item}.") @@ -110,8 +102,6 @@ iteration_over_set.py:17:28: PLC0208 [*] Use a sequence type instead of a `set` 19 19 | numbers_set = {i for i in {1, 2, 3}} # flags sets in set comprehensions 20 20 | - Run `ruff check --fix` to apply this fix. - iteration_over_set.py:19:27: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 17 | numbers_list = [i for i in {1, 2, 3}] # flags sets in list comprehensions @@ -132,8 +122,6 @@ iteration_over_set.py:19:27: PLC0208 [*] Use a sequence type instead of a `set` 21 21 | numbers_dict = {str(i): i for i in {1, 2, 3}} # flags sets in dict comprehensions 22 22 | - Run `ruff check --fix` to apply this fix. - iteration_over_set.py:21:36: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 19 | numbers_set = {i for i in {1, 2, 3}} # flags sets in set comprehensions @@ -154,8 +142,6 @@ iteration_over_set.py:21:36: PLC0208 [*] Use a sequence type instead of a `set` 23 23 | numbers_gen = (i for i in {1, 2, 3}) # flags sets in generator expressions 24 24 | - Run `ruff check --fix` to apply this fix. - iteration_over_set.py:23:27: PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | 21 | numbers_dict = {str(i): i for i in {1, 2, 3}} # flags sets in dict comprehensions @@ -174,6 +160,4 @@ iteration_over_set.py:23:27: PLC0208 [*] Use a sequence type instead of a `set` 23 |+numbers_gen = (i for i in (1, 2, 3)) # flags sets in generator expressions 24 24 | 25 25 | # Non-errors -26 26 | - - Run `ruff check --fix` to apply this fix. +26 26 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0241_duplicate_bases.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0241_duplicate_bases.py.snap index b2b761702c774..378aa0f6675ff 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0241_duplicate_bases.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE0241_duplicate_bases.py.snap @@ -19,8 +19,6 @@ duplicate_bases.py:13:13: PLE0241 [*] Duplicate base `A` for class `F1` 15 15 | 16 16 | - Run `ruff check --fix` to apply this fix. - duplicate_bases.py:17:13: PLE0241 [*] Duplicate base `A` for class `F2` | 17 | class F2(A, A,): @@ -38,8 +36,6 @@ duplicate_bases.py:17:13: PLE0241 [*] Duplicate base `A` for class `F2` 19 19 | 20 20 | - Run `ruff check --fix` to apply this fix. - duplicate_bases.py:23:5: PLE0241 [*] Duplicate base `A` for class `F3` | 21 | class F3( @@ -59,8 +55,6 @@ duplicate_bases.py:23:5: PLE0241 [*] Duplicate base `A` for class `F3` 24 23 | ): 25 24 | ... - Run `ruff check --fix` to apply this fix. - duplicate_bases.py:30:5: PLE0241 [*] Duplicate base `A` for class `F4` | 28 | class F4( @@ -80,8 +74,6 @@ duplicate_bases.py:30:5: PLE0241 [*] Duplicate base `A` for class `F4` 32 31 | ... 33 32 | - Run `ruff check --fix` to apply this fix. - duplicate_bases.py:36:13: PLE0241 [*] Duplicate base `A` for class `G1` | 35 | # Duplicate base class is not last. @@ -100,8 +92,6 @@ duplicate_bases.py:36:13: PLE0241 [*] Duplicate base `A` for class `G1` 38 38 | 39 39 | - Run `ruff check --fix` to apply this fix. - duplicate_bases.py:40:13: PLE0241 [*] Duplicate base `A` for class `G2` | 40 | class G2(A, A, B,): @@ -119,8 +109,6 @@ duplicate_bases.py:40:13: PLE0241 [*] Duplicate base `A` for class `G2` 42 42 | 43 43 | - Run `ruff check --fix` to apply this fix. - duplicate_bases.py:46:5: PLE0241 [*] Duplicate base `A` for class `G3` | 44 | class G3( @@ -140,8 +128,6 @@ duplicate_bases.py:46:5: PLE0241 [*] Duplicate base `A` for class `G3` 48 47 | ): 49 48 | ... - Run `ruff check --fix` to apply this fix. - duplicate_bases.py:54:5: PLE0241 [*] Duplicate base `A` for class `G4` | 52 | class G4( @@ -160,5 +146,3 @@ duplicate_bases.py:54:5: PLE0241 [*] Duplicate base `A` for class `G4` 55 54 | B, 56 55 | ): 57 56 | ... - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap index b2364e5303ea8..6263c576baa07 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE1141_dict_iter_missing_items.py.snap @@ -19,8 +19,6 @@ dict_iter_missing_items.py:13:13: PLE1141 [*] Unpacking a dictionary in iteratio 15 15 | 16 16 | for k, v in d_tuple_incorrect_tuple: - Run `ruff check --fix` to apply this fix. - dict_iter_missing_items.py:16:13: PLE1141 [*] Unpacking a dictionary in iteration without calling `.items()` | 14 | pass @@ -38,6 +36,4 @@ dict_iter_missing_items.py:16:13: PLE1141 [*] Unpacking a dictionary in iteratio 16 |+for k, v in d_tuple_incorrect_tuple.items(): 17 17 | pass 18 18 | -19 19 | - - Run `ruff check --fix` to apply this fix. +19 19 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters.py.snap index d894609645f4a..97c6182930b3c 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters.py.snap @@ -20,8 +20,6 @@ invalid_characters.py:15:6: PLE2510 [*] Invalid unescaped character backspace, u 17 17 | 18 18 | b_ok = '\\b' - Run `ruff check --fix` to apply this fix. - invalid_characters.py:16:7: PLE2510 [*] Invalid unescaped character backspace, use "\b" instead | 14 | #foo = 'hi' @@ -42,8 +40,6 @@ invalid_characters.py:16:7: PLE2510 [*] Invalid unescaped character backspace, u 18 18 | b_ok = '\\b' 19 19 | b_ok = f'\\b' - Run `ruff check --fix` to apply this fix. - invalid_characters.py:55:21: PLE2510 [*] Invalid unescaped character backspace, use "\b" instead | 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" @@ -63,5 +59,3 @@ invalid_characters.py:55:21: PLE2510 [*] Invalid unescaped character backspace, 56 56 | 57 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 58 58 | x = f"""}}ab""" - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2512_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2512_invalid_characters.py.snap index 3b1ade9e0f9bc..7ae9f99bc8572 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2512_invalid_characters.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2512_invalid_characters.py.snap @@ -20,8 +20,6 @@ invalid_characters.py:24:12: PLE2512 [*] Invalid unescaped character SUB, use "\ 26 26 | 27 27 | sub_ok = '\x1a' - Run `ruff check --fix` to apply this fix. - invalid_characters.py:25:13: PLE2512 [*] Invalid unescaped character SUB, use "\x1A" instead | 24 | sub = 'sub ' @@ -41,8 +39,6 @@ invalid_characters.py:25:13: PLE2512 [*] Invalid unescaped character SUB, use "\ 27 27 | sub_ok = '\x1a' 28 28 | sub_ok = f'\x1a' - Run `ruff check --fix` to apply this fix. - invalid_characters.py:55:25: PLE2512 [*] Invalid unescaped character SUB, use "\x1A" instead | 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" @@ -63,8 +59,6 @@ invalid_characters.py:55:25: PLE2512 [*] Invalid unescaped character SUB, use "\ 57 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 58 58 | x = f"""}}ab""" - Run `ruff check --fix` to apply this fix. - invalid_characters.py:58:12: PLE2512 [*] Invalid unescaped character SUB, use "\x1A" instead | 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 @@ -82,5 +76,3 @@ invalid_characters.py:58:12: PLE2512 [*] Invalid unescaped character SUB, use "\ 58 |+x = f"""}}a\x1Ab""" 59 59 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998256 60 60 | x = f"""}}a␛b""" - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2513_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2513_invalid_characters.py.snap index a354cc91c136d..1df7fe32a53bb 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2513_invalid_characters.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2513_invalid_characters.py.snap @@ -20,8 +20,6 @@ invalid_characters.py:30:16: PLE2513 [*] Invalid unescaped character ESC, use "\ 32 32 | 33 33 | esc_ok = '\x1b' - Run `ruff check --fix` to apply this fix. - invalid_characters.py:31:17: PLE2513 [*] Invalid unescaped character ESC, use "\x1B" instead | 30 | esc = 'esc esc ␛' @@ -41,8 +39,6 @@ invalid_characters.py:31:17: PLE2513 [*] Invalid unescaped character ESC, use "\ 33 33 | esc_ok = '\x1b' 34 34 | esc_ok = f'\x1b' - Run `ruff check --fix` to apply this fix. - invalid_characters.py:55:29: PLE2513 [*] Invalid unescaped character ESC, use "\x1B" instead | 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" @@ -63,8 +59,6 @@ invalid_characters.py:55:29: PLE2513 [*] Invalid unescaped character ESC, use "\ 57 57 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998106 58 58 | x = f"""}}ab""" - Run `ruff check --fix` to apply this fix. - invalid_characters.py:60:12: PLE2513 [*] Invalid unescaped character ESC, use "\x1B" instead | 58 | x = f"""}}ab""" @@ -79,5 +73,3 @@ invalid_characters.py:60:12: PLE2513 [*] Invalid unescaped character ESC, use "\ 59 59 | # https://github.com/astral-sh/ruff/issues/7455#issuecomment-1741998256 60 |-x = f"""}}a␛b""" 60 |+x = f"""}}a\x1Bb""" - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2514_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2514_invalid_characters.py.snap index 4d184966b882efcc34b1601cf4f1b94dc3faed95..a88b20ece2d230bc0081a7d3cd8516c2d05626a2 100644 GIT binary patch delta 12 TcmaFO*2}hG7USlVjKz!qB2xsx delta 106 zcmeBWd(F0C7Nf2L5CoOxDI^q?rllz)XQU=)E9mN`WmY68l;kTU78K-EDwJeo7ApXS Q^fu36EM?T^B1sPy075+?yZ`_I diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2515_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2515_invalid_characters.py.snap index 26adf27387a11..eabb9af2bbb3c 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2515_invalid_characters.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2515_invalid_characters.py.snap @@ -20,8 +20,6 @@ invalid_characters.py:44:13: PLE2515 [*] Invalid unescaped character zero-width- 46 46 | 47 47 | zwsp_ok = '\u200b' - Run `ruff check --fix` to apply this fix. - invalid_characters.py:45:14: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead | 44 | zwsp = 'zero​width' @@ -41,8 +39,6 @@ invalid_characters.py:45:14: PLE2515 [*] Invalid unescaped character zero-width- 47 47 | zwsp_ok = '\u200b' 48 48 | zwsp_ok = f'\u200b' - Run `ruff check --fix` to apply this fix. - invalid_characters.py:50:36: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead | 48 | zwsp_ok = f'\u200b' @@ -63,8 +59,6 @@ invalid_characters.py:50:36: PLE2515 [*] Invalid unescaped character zero-width- 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" - Run `ruff check --fix` to apply this fix. - invalid_characters.py:51:37: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead | 50 | zwsp_after_multibyte_character = "ಫ​" @@ -84,8 +78,6 @@ invalid_characters.py:51:37: PLE2515 [*] Invalid unescaped character zero-width- 53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 54 54 | - Run `ruff check --fix` to apply this fix. - invalid_characters.py:52:60: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead | 50 | zwsp_after_multibyte_character = "ಫ​" @@ -105,8 +97,6 @@ invalid_characters.py:52:60: PLE2515 [*] Invalid unescaped character zero-width- 54 54 | 55 55 | nested_fstrings = f'␈{f'{f'␛'}'}' - Run `ruff check --fix` to apply this fix. - invalid_characters.py:52:61: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead | 50 | zwsp_after_multibyte_character = "ಫ​" @@ -126,8 +116,6 @@ invalid_characters.py:52:61: PLE2515 [*] Invalid unescaped character zero-width- 54 54 | 55 55 | nested_fstrings = f'␈{f'{f'␛'}'}' - Run `ruff check --fix` to apply this fix. - invalid_characters.py:53:61: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead | 51 | zwsp_after_multibyte_character = f"ಫ​" @@ -148,8 +136,6 @@ invalid_characters.py:53:61: PLE2515 [*] Invalid unescaped character zero-width- 55 55 | nested_fstrings = f'␈{f'{f'␛'}'}' 56 56 | - Run `ruff check --fix` to apply this fix. - invalid_characters.py:53:62: PLE2515 [*] Invalid unescaped character zero-width-space, use "\u200B" instead | 51 | zwsp_after_multibyte_character = f"ಫ​" @@ -168,6 +154,4 @@ invalid_characters.py:53:62: PLE2515 [*] Invalid unescaped character zero-width- 53 |+zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​\u200b" 54 54 | 55 55 | nested_fstrings = f'␈{f'{f'␛'}'}' -56 56 | - - Run `ruff check --fix` to apply this fix. +56 56 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0202_no_method_decorator.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0202_no_method_decorator.py.snap index d56c30fbdc21a..16c65a1c88885 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0202_no_method_decorator.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0202_no_method_decorator.py.snap @@ -25,8 +25,6 @@ no_method_decorator.py:9:5: PLR0202 [*] Class method defined without decorator 15 15 | def pick_one_color(): # [no-staticmethod-decorator] 16 16 | """staticmethod to pick one fruit color""" - Run `ruff check --fix` to apply this fix. - no_method_decorator.py:22:5: PLR0202 [*] Class method defined without decorator | 21 | class Class: @@ -48,5 +46,3 @@ no_method_decorator.py:22:5: PLR0202 [*] Class method defined without decorator 26 27 | 27 28 | def static_method(): 28 29 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0203_no_method_decorator.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0203_no_method_decorator.py.snap index dc4fa8182659b..c9863bfe0e55a 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0203_no_method_decorator.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0203_no_method_decorator.py.snap @@ -25,8 +25,6 @@ no_method_decorator.py:15:5: PLR0203 [*] Static method defined without decorator 21 21 | class Class: 22 22 | def class_method(cls): - Run `ruff check --fix` to apply this fix. - no_method_decorator.py:27:5: PLR0203 [*] Static method defined without decorator | 25 | class_method = classmethod(class_method);another_statement @@ -45,6 +43,4 @@ no_method_decorator.py:27:5: PLR0203 [*] Static method defined without decorator 28 29 | pass 29 30 | 30 |- static_method = staticmethod(static_method); - 31 |+ - - Run `ruff check --fix` to apply this fix. + 31 |+ diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0402_import_aliasing.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0402_import_aliasing.py.snap index 96cbd31d04bf0..0d59dd39adb80 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0402_import_aliasing.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR0402_import_aliasing.py.snap @@ -21,8 +21,6 @@ import_aliasing.py:9:8: PLR0402 [*] Use `from os import path` in lieu of alias 11 11 | import foo.bar.foobar as foobar # [consider-using-from-import] 12 12 | import foo.bar.foobar as foobar, sys # [consider-using-from-import] - Run `ruff check --fix` to apply this fix. - import_aliasing.py:11:8: PLR0402 [*] Use `from foo.bar import foobar` in lieu of alias | 9 | import os.path as path # [consider-using-from-import] @@ -43,8 +41,6 @@ import_aliasing.py:11:8: PLR0402 [*] Use `from foo.bar import foobar` in lieu of 13 13 | import os 14 14 | import os as OS - Run `ruff check --fix` to apply this fix. - import_aliasing.py:12:8: PLR0402 Use `from foo.bar import foobar` in lieu of alias | 10 | import os.path as p diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1711_useless_return.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1711_useless_return.py.snap index 5ee525567d7df..01d29c73d0e22 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1711_useless_return.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1711_useless_return.py.snap @@ -18,8 +18,6 @@ useless_return.py:6:5: PLR1711 [*] Useless `return` statement at end of function 8 7 | 9 8 | def print_python_version(): - Run `ruff check --fix` to apply this fix. - useless_return.py:11:5: PLR1711 [*] Useless `return` statement at end of function | 9 | def print_python_version(): @@ -37,8 +35,6 @@ useless_return.py:11:5: PLR1711 [*] Useless `return` statement at end of functio 13 12 | 14 13 | def print_python_version(): - Run `ruff check --fix` to apply this fix. - useless_return.py:16:5: PLR1711 [*] Useless `return` statement at end of function | 14 | def print_python_version(): @@ -56,8 +52,6 @@ useless_return.py:16:5: PLR1711 [*] Useless `return` statement at end of functio 18 17 | 19 18 | class SomeClass: - Run `ruff check --fix` to apply this fix. - useless_return.py:22:9: PLR1711 [*] Useless `return` statement at end of function | 20 | def print_python_version(self): @@ -75,8 +69,6 @@ useless_return.py:22:9: PLR1711 [*] Useless `return` statement at end of functio 24 23 | 25 24 | def print_python_version(): - Run `ruff check --fix` to apply this fix. - useless_return.py:50:5: PLR1711 [*] Useless `return` statement at end of function | 48 | """This function returns None.""" @@ -94,8 +86,6 @@ useless_return.py:50:5: PLR1711 [*] Useless `return` statement at end of functio 52 51 | 53 52 | class BaseCache: - Run `ruff check --fix` to apply this fix. - useless_return.py:60:9: PLR1711 [*] Useless `return` statement at end of function | 58 | def get(self, key: str) -> None: @@ -109,5 +99,3 @@ useless_return.py:60:9: PLR1711 [*] Useless `return` statement at end of functio 58 58 | def get(self, key: str) -> None: 59 59 | print(f"{key} not found") 60 |- return None - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1730_if_stmt_min_max.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1730_if_stmt_min_max.py.snap index 98720a364bb24..1c9b90ac67502 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1730_if_stmt_min_max.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1730_if_stmt_min_max.py.snap @@ -22,8 +22,6 @@ if_stmt_min_max.py:8:1: PLR1730 [*] Replace `if` statement with `value = max(val 11 10 | if value <= 10: # [max-instead-of-if] 12 11 | value = 10 - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:11:1: PLR1730 [*] Replace `if` statement with `value = max(10, value)` | 9 | value = 10 @@ -46,8 +44,6 @@ if_stmt_min_max.py:11:1: PLR1730 [*] Replace `if` statement with `value = max(10 14 13 | if value < value2: # [max-instead-of-if] 15 14 | value = value2 - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:14:1: PLR1730 [*] Replace `if` statement with `value = max(value, value2)` | 12 | value = 10 @@ -70,8 +66,6 @@ if_stmt_min_max.py:14:1: PLR1730 [*] Replace `if` statement with `value = max(va 17 16 | if value > 10: # [min-instead-of-if] 18 17 | value = 10 - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:17:1: PLR1730 [*] Replace `if` statement with `value = min(value, 10)` | 15 | value = value2 @@ -94,8 +88,6 @@ if_stmt_min_max.py:17:1: PLR1730 [*] Replace `if` statement with `value = min(va 20 19 | if value >= 10: # [min-instead-of-if] 21 20 | value = 10 - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:20:1: PLR1730 [*] Replace `if` statement with `value = min(10, value)` | 18 | value = 10 @@ -118,8 +110,6 @@ if_stmt_min_max.py:20:1: PLR1730 [*] Replace `if` statement with `value = min(10 23 22 | if value > value2: # [min-instead-of-if] 24 23 | value = value2 - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:23:1: PLR1730 [*] Replace `if` statement with `value = min(value, value2)` | 21 | value = 10 @@ -140,8 +130,6 @@ if_stmt_min_max.py:23:1: PLR1730 [*] Replace `if` statement with `value = min(va 26 25 | 27 26 | class A: - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:33:1: PLR1730 [*] Replace `if` statement with `A1.value = max(A1.value, 10)` | 32 | A1 = A() @@ -163,8 +151,6 @@ if_stmt_min_max.py:33:1: PLR1730 [*] Replace `if` statement with `A1.value = max 36 35 | if A1.value > 10: # [min-instead-of-if] 37 36 | A1.value = 10 - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:36:1: PLR1730 [*] Replace `if` statement with `A1.value = min(A1.value, 10)` | 34 | A1.value = 10 @@ -185,8 +171,6 @@ if_stmt_min_max.py:36:1: PLR1730 [*] Replace `if` statement with `A1.value = min 39 38 | 40 39 | class AA: - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:60:1: PLR1730 [*] Replace `if` statement with `A2 = max(A2, A1)` | 58 | A2 = AA(3) @@ -209,8 +193,6 @@ if_stmt_min_max.py:60:1: PLR1730 [*] Replace `if` statement with `A2 = max(A2, A 63 62 | if A2 <= A1: # [max-instead-of-if] 64 63 | A2 = A1 - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:63:1: PLR1730 [*] Replace `if` statement with `A2 = max(A1, A2)` | 61 | A2 = A1 @@ -233,8 +215,6 @@ if_stmt_min_max.py:63:1: PLR1730 [*] Replace `if` statement with `A2 = max(A1, A 66 65 | if A2 > A1: # [min-instead-of-if] 67 66 | A2 = A1 - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:66:1: PLR1730 [*] Replace `if` statement with `A2 = min(A2, A1)` | 64 | A2 = A1 @@ -257,8 +237,6 @@ if_stmt_min_max.py:66:1: PLR1730 [*] Replace `if` statement with `A2 = min(A2, A 69 68 | if A2 >= A1: # [min-instead-of-if] 70 69 | A2 = A1 - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:69:1: PLR1730 [*] Replace `if` statement with `A2 = min(A1, A2)` | 67 | A2 = A1 @@ -281,8 +259,6 @@ if_stmt_min_max.py:69:1: PLR1730 [*] Replace `if` statement with `A2 = min(A1, A 72 71 | # Negative 73 72 | if value < 10: - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:132:1: PLR1730 [*] Replace `if` statement with `min` call | 131 | # Parenthesized expressions @@ -311,8 +287,6 @@ if_stmt_min_max.py:132:1: PLR1730 [*] Replace `if` statement with `min` call 138 137 | class Foo: 139 138 | _min = 0 - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:143:9: PLR1730 [*] Replace `if` statement with `self._min = min(value, self._min)` | 142 | def foo(self, value) -> None: @@ -335,8 +309,6 @@ if_stmt_min_max.py:143:9: PLR1730 [*] Replace `if` statement with `self._min = m 146 145 | self._max = value 147 146 | - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:145:9: PLR1730 [*] Replace `if` statement with `self._max = max(value, self._max)` | 143 | if value < self._min: @@ -360,8 +332,6 @@ if_stmt_min_max.py:145:9: PLR1730 [*] Replace `if` statement with `self._max = m 148 147 | if self._min < value: 149 148 | self._min = value - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:148:9: PLR1730 [*] Replace `if` statement with `self._min = max(self._min, value)` | 146 | self._max = value @@ -385,8 +355,6 @@ if_stmt_min_max.py:148:9: PLR1730 [*] Replace `if` statement with `self._min = m 151 150 | self._max = value 152 151 | - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:150:9: PLR1730 [*] Replace `if` statement with `self._max = min(self._max, value)` | 148 | if self._min < value: @@ -410,8 +378,6 @@ if_stmt_min_max.py:150:9: PLR1730 [*] Replace `if` statement with `self._max = m 153 152 | if value <= self._min: 154 153 | self._min = value - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:153:9: PLR1730 [*] Replace `if` statement with `self._min = min(self._min, value)` | 151 | self._max = value @@ -435,8 +401,6 @@ if_stmt_min_max.py:153:9: PLR1730 [*] Replace `if` statement with `self._min = m 156 155 | self._max = value 157 156 | - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:155:9: PLR1730 [*] Replace `if` statement with `self._max = max(self._max, value)` | 153 | if value <= self._min: @@ -460,8 +424,6 @@ if_stmt_min_max.py:155:9: PLR1730 [*] Replace `if` statement with `self._max = m 158 157 | if self._min <= value: 159 158 | self._min = value - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:158:9: PLR1730 [*] Replace `if` statement with `self._min = max(value, self._min)` | 156 | self._max = value @@ -484,8 +446,6 @@ if_stmt_min_max.py:158:9: PLR1730 [*] Replace `if` statement with `self._min = m 160 159 | if self._max >= value: 161 160 | self._max = value - Run `ruff check --fix` to apply this fix. - if_stmt_min_max.py:160:9: PLR1730 [*] Replace `if` statement with `self._max = min(value, self._max)` | 158 | if self._min <= value: @@ -503,5 +463,3 @@ if_stmt_min_max.py:160:9: PLR1730 [*] Replace `if` statement with `self._max = m 160 |- if self._max >= value: 161 |- self._max = value 160 |+ self._max = min(value, self._max) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap index 37d4939db8fd5..ca77bedf83fb1 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1733_unnecessary_dict_index_lookup.py.snap @@ -20,8 +20,6 @@ unnecessary_dict_index_lookup.py:4:6: PLR1733 [*] Unnecessary lookup of dictiona 6 6 | {fruit_name: FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()} # PLR1733 7 7 | - Run `ruff check --fix` to apply this fix. - unnecessary_dict_index_lookup.py:5:6: PLR1733 [*] Unnecessary lookup of dictionary value by key | 3 | def fix_these(): @@ -41,8 +39,6 @@ unnecessary_dict_index_lookup.py:5:6: PLR1733 [*] Unnecessary lookup of dictiona 7 7 | 8 8 | for fruit_name, fruit_count in FRUITS.items(): - Run `ruff check --fix` to apply this fix. - unnecessary_dict_index_lookup.py:6:18: PLR1733 [*] Unnecessary lookup of dictionary value by key | 4 | [FRUITS[fruit_name] for fruit_name, fruit_count in FRUITS.items()] # PLR1733 @@ -63,8 +59,6 @@ unnecessary_dict_index_lookup.py:6:18: PLR1733 [*] Unnecessary lookup of diction 8 8 | for fruit_name, fruit_count in FRUITS.items(): 9 9 | print(FRUITS[fruit_name]) # PLR1733 - Run `ruff check --fix` to apply this fix. - unnecessary_dict_index_lookup.py:9:15: PLR1733 [*] Unnecessary lookup of dictionary value by key | 8 | for fruit_name, fruit_count in FRUITS.items(): @@ -84,8 +78,6 @@ unnecessary_dict_index_lookup.py:9:15: PLR1733 [*] Unnecessary lookup of diction 11 11 | assert FRUITS[fruit_name] == "pear" # PLR1733 12 12 | - Run `ruff check --fix` to apply this fix. - unnecessary_dict_index_lookup.py:10:16: PLR1733 [*] Unnecessary lookup of dictionary value by key | 8 | for fruit_name, fruit_count in FRUITS.items(): @@ -105,8 +97,6 @@ unnecessary_dict_index_lookup.py:10:16: PLR1733 [*] Unnecessary lookup of dictio 12 12 | 13 13 | - Run `ruff check --fix` to apply this fix. - unnecessary_dict_index_lookup.py:11:16: PLR1733 [*] Unnecessary lookup of dictionary value by key | 9 | print(FRUITS[fruit_name]) # PLR1733 @@ -124,5 +114,3 @@ unnecessary_dict_index_lookup.py:11:16: PLR1733 [*] Unnecessary lookup of dictio 12 12 | 13 13 | 14 14 | def dont_fix_these(): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap index c864914278f0d..59c27e2ac187a 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1736_unnecessary_list_index_lookup.py.snap @@ -20,8 +20,6 @@ unnecessary_list_index_lookup.py:7:6: PLR1736 [*] List index lookup in `enumerat 9 9 | {letter: letters[index] for index, letter in enumerate(letters)} # PLR1736 10 10 | - Run `ruff check --fix` to apply this fix. - unnecessary_list_index_lookup.py:8:6: PLR1736 [*] List index lookup in `enumerate()` loop | 6 | def fix_these(): @@ -41,8 +39,6 @@ unnecessary_list_index_lookup.py:8:6: PLR1736 [*] List index lookup in `enumerat 10 10 | 11 11 | for index, letter in enumerate(letters): - Run `ruff check --fix` to apply this fix. - unnecessary_list_index_lookup.py:9:14: PLR1736 [*] List index lookup in `enumerate()` loop | 7 | [letters[index] for index, letter in enumerate(letters)] # PLR1736 @@ -63,8 +59,6 @@ unnecessary_list_index_lookup.py:9:14: PLR1736 [*] List index lookup in `enumera 11 11 | for index, letter in enumerate(letters): 12 12 | print(letters[index]) # PLR1736 - Run `ruff check --fix` to apply this fix. - unnecessary_list_index_lookup.py:12:15: PLR1736 [*] List index lookup in `enumerate()` loop | 11 | for index, letter in enumerate(letters): @@ -84,8 +78,6 @@ unnecessary_list_index_lookup.py:12:15: PLR1736 [*] List index lookup in `enumer 14 14 | assert letters[index] == "d" # PLR1736 15 15 | - Run `ruff check --fix` to apply this fix. - unnecessary_list_index_lookup.py:13:16: PLR1736 [*] List index lookup in `enumerate()` loop | 11 | for index, letter in enumerate(letters): @@ -105,8 +97,6 @@ unnecessary_list_index_lookup.py:13:16: PLR1736 [*] List index lookup in `enumer 15 15 | 16 16 | for index, letter in builtins.enumerate(letters): - Run `ruff check --fix` to apply this fix. - unnecessary_list_index_lookup.py:14:16: PLR1736 [*] List index lookup in `enumerate()` loop | 12 | print(letters[index]) # PLR1736 @@ -127,8 +117,6 @@ unnecessary_list_index_lookup.py:14:16: PLR1736 [*] List index lookup in `enumer 16 16 | for index, letter in builtins.enumerate(letters): 17 17 | print(letters[index]) # PLR1736 - Run `ruff check --fix` to apply this fix. - unnecessary_list_index_lookup.py:17:15: PLR1736 [*] List index lookup in `enumerate()` loop | 16 | for index, letter in builtins.enumerate(letters): @@ -148,8 +136,6 @@ unnecessary_list_index_lookup.py:17:15: PLR1736 [*] List index lookup in `enumer 19 19 | assert letters[index] == "d" # PLR1736 20 20 | - Run `ruff check --fix` to apply this fix. - unnecessary_list_index_lookup.py:18:16: PLR1736 [*] List index lookup in `enumerate()` loop | 16 | for index, letter in builtins.enumerate(letters): @@ -169,8 +155,6 @@ unnecessary_list_index_lookup.py:18:16: PLR1736 [*] List index lookup in `enumer 20 20 | 21 21 | - Run `ruff check --fix` to apply this fix. - unnecessary_list_index_lookup.py:19:16: PLR1736 [*] List index lookup in `enumerate()` loop | 17 | print(letters[index]) # PLR1736 @@ -188,5 +172,3 @@ unnecessary_list_index_lookup.py:19:16: PLR1736 [*] List index lookup in `enumer 20 20 | 21 21 | 22 22 | def dont_fix_these(): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap index a93e37c1c3838..8992118556bdd 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR2044_empty_comment.py.snap @@ -19,8 +19,6 @@ empty_comment.py:3:1: PLR2044 [*] Line with empty comment 5 4 | # 6 5 | - Run `ruff check --fix` to apply this fix. - empty_comment.py:4:5: PLR2044 [*] Line with empty comment | 2 | # this line is also OK, but the three following lines are not @@ -39,8 +37,6 @@ empty_comment.py:4:5: PLR2044 [*] Line with empty comment 6 5 | 7 6 | # this non-empty comment has trailing whitespace and is OK - Run `ruff check --fix` to apply this fix. - empty_comment.py:5:9: PLR2044 [*] Line with empty comment | 3 | # @@ -60,8 +56,6 @@ empty_comment.py:5:9: PLR2044 [*] Line with empty comment 7 6 | # this non-empty comment has trailing whitespace and is OK 8 7 | - Run `ruff check --fix` to apply this fix. - empty_comment.py:18:11: PLR2044 [*] Line with empty comment | 17 | def foo(): # this comment is OK, the one below is not @@ -79,8 +73,6 @@ empty_comment.py:18:11: PLR2044 [*] Line with empty comment 20 20 | 21 21 | # the lines below have no comments and are OK - Run `ruff check --fix` to apply this fix. - empty_comment.py:44:1: PLR2044 [*] Line with empty comment | 42 | # These should be removed, despite being an empty "block comment". @@ -99,8 +91,6 @@ empty_comment.py:44:1: PLR2044 [*] Line with empty comment 47 46 | # These should also be removed. 48 47 | - Run `ruff check --fix` to apply this fix. - empty_comment.py:45:1: PLR2044 [*] Line with empty comment | 44 | # @@ -119,8 +109,6 @@ empty_comment.py:45:1: PLR2044 [*] Line with empty comment 47 46 | # These should also be removed. 48 47 | - Run `ruff check --fix` to apply this fix. - empty_comment.py:58:2: PLR2044 [*] Line with empty comment | 57 | α = 1 @@ -134,5 +122,3 @@ empty_comment.py:58:2: PLR2044 [*] Line with empty comment 57 57 | α = 1 58 |-α# 58 |+α - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR5501_collapsible_else_if.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR5501_collapsible_else_if.py.snap index 9d07874ee02a2..85177591c14c1 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR5501_collapsible_else_if.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR5501_collapsible_else_if.py.snap @@ -25,8 +25,6 @@ collapsible_else_if.py:37:5: PLR5501 [*] Use `elif` instead of `else` then `if`, 41 40 | 42 41 | def not_ok1(): - Run `ruff check --fix` to apply this fix. - collapsible_else_if.py:45:5: PLR5501 [*] Use `elif` instead of `else` then `if`, to reduce indentation | 43 | if 1: @@ -55,8 +53,6 @@ collapsible_else_if.py:45:5: PLR5501 [*] Use `elif` instead of `else` then `if`, 51 50 | 52 51 | def not_ok1_with_comments(): - Run `ruff check --fix` to apply this fix. - collapsible_else_if.py:55:5: PLR5501 [*] Use `elif` instead of `else` then `if`, to reduce indentation | 53 | if 1: @@ -87,8 +83,6 @@ collapsible_else_if.py:55:5: PLR5501 [*] Use `elif` instead of `else` then `if`, 62 60 | 63 61 | # Regression test for https://github.com/apache/airflow/blob/f1e1cdcc3b2826e68ba133f350300b5065bbca33/airflow/models/dag.py#L1737 - Run `ruff check --fix` to apply this fix. - collapsible_else_if.py:69:5: PLR5501 [*] Use `elif` instead of `else` then `if`, to reduce indentation | 67 | elif True: @@ -117,8 +111,6 @@ collapsible_else_if.py:69:5: PLR5501 [*] Use `elif` instead of `else` then `if`, 75 74 | 76 75 | def not_ok3(): - Run `ruff check --fix` to apply this fix. - collapsible_else_if.py:79:5: PLR5501 [*] Use `elif` instead of `else` then `if`, to reduce indentation | 77 | if 1: @@ -143,8 +135,6 @@ collapsible_else_if.py:79:5: PLR5501 [*] Use `elif` instead of `else` then `if`, 83 82 | 84 83 | def not_ok4(): - Run `ruff check --fix` to apply this fix. - collapsible_else_if.py:87:5: PLR5501 [*] Use `elif` instead of `else` then `if`, to reduce indentation | 85 | if 1: @@ -171,8 +161,6 @@ collapsible_else_if.py:87:5: PLR5501 [*] Use `elif` instead of `else` then `if`, 92 91 | 93 92 | def not_ok5(): - Run `ruff check --fix` to apply this fix. - collapsible_else_if.py:96:5: PLR5501 [*] Use `elif` instead of `else` then `if`, to reduce indentation | 94 | if 1: @@ -196,5 +184,3 @@ collapsible_else_if.py:96:5: PLR5501 [*] Use `elif` instead of `else` then `if`, 96 |+ elif 2: 97 |+ pass 98 |+ else: pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap index 8c88e0a14357e..6bfc484389908 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0120_useless_else_on_loop.py.snap @@ -22,8 +22,6 @@ useless_else_on_loop.py:9:5: PLW0120 [*] `else` clause on loop without a `break` 12 11 | 13 12 | - Run `ruff check --fix` to apply this fix. - useless_else_on_loop.py:18:5: PLW0120 [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | 16 | while True: @@ -45,8 +43,6 @@ useless_else_on_loop.py:18:5: PLW0120 [*] `else` clause on loop without a `break 21 20 | 22 21 | - Run `ruff check --fix` to apply this fix. - useless_else_on_loop.py:30:1: PLW0120 [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | 28 | break @@ -67,8 +63,6 @@ useless_else_on_loop.py:30:1: PLW0120 [*] `else` clause on loop without a `break 33 32 | 34 33 | while True: - Run `ruff check --fix` to apply this fix. - useless_else_on_loop.py:37:1: PLW0120 [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | 35 | while False: @@ -89,8 +83,6 @@ useless_else_on_loop.py:37:1: PLW0120 [*] `else` clause on loop without a `break 40 39 | for j in range(10): 41 40 | pass - Run `ruff check --fix` to apply this fix. - useless_else_on_loop.py:42:1: PLW0120 [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | 40 | for j in range(10): @@ -116,8 +108,6 @@ useless_else_on_loop.py:42:1: PLW0120 [*] `else` clause on loop without a `break 47 46 | 48 47 | def test_return_for2(): - Run `ruff check --fix` to apply this fix. - useless_else_on_loop.py:88:5: PLW0120 [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | 86 | else: @@ -139,8 +129,6 @@ useless_else_on_loop.py:88:5: PLW0120 [*] `else` clause on loop without a `break 91 90 | 92 91 | - Run `ruff check --fix` to apply this fix. - useless_else_on_loop.py:98:9: PLW0120 [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | 96 | for _ in range(3): @@ -164,8 +152,6 @@ useless_else_on_loop.py:98:9: PLW0120 [*] `else` clause on loop without a `break 102 101 | return True 103 102 | return False - Run `ruff check --fix` to apply this fix. - useless_else_on_loop.py:144:5: PLW0120 [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | 142 | for j in range(10): @@ -189,5 +175,3 @@ useless_else_on_loop.py:144:5: PLW0120 [*] `else` clause on loop without a `brea 145 |+ print("fat chance") 146 |+ for j in range(10): 147 |+ break - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0245_super_without_brackets.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0245_super_without_brackets.py.snap index dbbe105188267..894c9599ada2f 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0245_super_without_brackets.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW0245_super_without_brackets.py.snap @@ -18,6 +18,4 @@ super_without_brackets.py:10:26: PLW0245 [*] `super` call is missing parentheses 10 |+ original_speak = super().speak() # PLW0245 11 11 | return f"{original_speak} But as a dog, it barks!" 12 12 | -13 13 | - - Run `ruff check --fix` to apply this fix. +13 13 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap index af9f929220be9..98c60fb0a69a5 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW1510_subprocess_run_without_check.py.snap @@ -20,8 +20,6 @@ subprocess_run_without_check.py:4:1: PLW1510 [*] `subprocess.run` without explic 6 6 | subprocess.run( 7 7 | ["ls"], - Run `ruff check --fix` to apply this fix. - subprocess_run_without_check.py:5:1: PLW1510 [*] `subprocess.run` without explicit `check` argument | 3 | # Errors. @@ -42,8 +40,6 @@ subprocess_run_without_check.py:5:1: PLW1510 [*] `subprocess.run` without explic 7 7 | ["ls"], 8 8 | shell=False, - Run `ruff check --fix` to apply this fix. - subprocess_run_without_check.py:6:1: PLW1510 [*] `subprocess.run` without explicit `check` argument | 4 | subprocess.run("ls") @@ -64,8 +60,6 @@ subprocess_run_without_check.py:6:1: PLW1510 [*] `subprocess.run` without explic 10 10 | subprocess.run(["ls"], **kwargs) 11 11 | - Run `ruff check --fix` to apply this fix. - subprocess_run_without_check.py:10:1: PLW1510 [*] `subprocess.run` without explicit `check` argument | 8 | shell=False, diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP001.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP001.py.snap index db998b4135e14..886ffe6bab2b7 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP001.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP001.py.snap @@ -16,8 +16,6 @@ UP001.py:2:5: UP001 [*] `__metaclass__ = type` is implied 4 4 | 5 5 | class B: - Run `ruff check --fix` to apply this fix. - UP001.py:6:5: UP001 [*] `__metaclass__ = type` is implied | 5 | class B: @@ -35,5 +33,3 @@ UP001.py:6:5: UP001 [*] `__metaclass__ = type` is implied 7 6 | 8 7 | def __init__(self) -> None: 9 8 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP003.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP003.py.snap index f0c8468d37aa1..c20a9aa3f01f1 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP003.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP003.py.snap @@ -16,8 +16,6 @@ UP003.py:1:1: UP003 [*] Use `str` instead of `type(...)` 3 3 | type(0) 4 4 | type(0.0) - Run `ruff check --fix` to apply this fix. - UP003.py:2:1: UP003 [*] Use `bytes` instead of `type(...)` | 1 | type("") @@ -35,8 +33,6 @@ UP003.py:2:1: UP003 [*] Use `bytes` instead of `type(...)` 4 4 | type(0.0) 5 5 | type(0j) - Run `ruff check --fix` to apply this fix. - UP003.py:3:1: UP003 [*] Use `int` instead of `type(...)` | 1 | type("") @@ -56,8 +52,6 @@ UP003.py:3:1: UP003 [*] Use `int` instead of `type(...)` 5 5 | type(0j) 6 6 | - Run `ruff check --fix` to apply this fix. - UP003.py:4:1: UP003 [*] Use `float` instead of `type(...)` | 2 | type(b"") @@ -77,8 +71,6 @@ UP003.py:4:1: UP003 [*] Use `float` instead of `type(...)` 6 6 | 7 7 | # OK - Run `ruff check --fix` to apply this fix. - UP003.py:5:1: UP003 [*] Use `complex` instead of `type(...)` | 3 | type(0) @@ -99,8 +91,6 @@ UP003.py:5:1: UP003 [*] Use `complex` instead of `type(...)` 7 7 | # OK 8 8 | type(arg)(" ") - Run `ruff check --fix` to apply this fix. - UP003.py:14:29: UP003 [*] Use `str` instead of `type(...)` | 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459841 @@ -114,5 +104,3 @@ UP003.py:14:29: UP003 [*] Use `str` instead of `type(...)` 13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459841 14 |-assert isinstance(fullname, type("")is not True) 14 |+assert isinstance(fullname, str is not True) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP004.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP004.py.snap index 463684bf16938..2e78dfa14d4ce 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP004.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP004.py.snap @@ -18,8 +18,6 @@ UP004.py:5:9: UP004 [*] Class `A` inherits from `object` 7 7 | 8 8 | - Run `ruff check --fix` to apply this fix. - UP004.py:10:5: UP004 [*] Class `A` inherits from `object` | 9 | class A( @@ -41,8 +39,6 @@ UP004.py:10:5: UP004 [*] Class `A` inherits from `object` 13 11 | 14 12 | - Run `ruff check --fix` to apply this fix. - UP004.py:16:5: UP004 [*] Class `A` inherits from `object` | 15 | class A( @@ -65,8 +61,6 @@ UP004.py:16:5: UP004 [*] Class `A` inherits from `object` 20 17 | 21 18 | - Run `ruff check --fix` to apply this fix. - UP004.py:24:5: UP004 [*] Class `A` inherits from `object` | 22 | class A( @@ -90,8 +84,6 @@ UP004.py:24:5: UP004 [*] Class `A` inherits from `object` 27 24 | 28 25 | - Run `ruff check --fix` to apply this fix. - UP004.py:31:5: UP004 [*] Class `A` inherits from `object` | 29 | class A( @@ -115,8 +107,6 @@ UP004.py:31:5: UP004 [*] Class `A` inherits from `object` 34 31 | 35 32 | - Run `ruff check --fix` to apply this fix. - UP004.py:37:5: UP004 [*] Class `A` inherits from `object` | 36 | class A( @@ -139,8 +129,6 @@ UP004.py:37:5: UP004 [*] Class `A` inherits from `object` 41 38 | 42 39 | - Run `ruff check --fix` to apply this fix. - UP004.py:45:5: UP004 [*] Class `A` inherits from `object` | 43 | class A( @@ -165,8 +153,6 @@ UP004.py:45:5: UP004 [*] Class `A` inherits from `object` 49 45 | 50 46 | - Run `ruff check --fix` to apply this fix. - UP004.py:53:5: UP004 [*] Class `A` inherits from `object` | 51 | class A( @@ -191,8 +177,6 @@ UP004.py:53:5: UP004 [*] Class `A` inherits from `object` 57 53 | 58 54 | - Run `ruff check --fix` to apply this fix. - UP004.py:61:5: UP004 [*] Class `A` inherits from `object` | 59 | class A( @@ -217,8 +201,6 @@ UP004.py:61:5: UP004 [*] Class `A` inherits from `object` 65 61 | 66 62 | - Run `ruff check --fix` to apply this fix. - UP004.py:69:5: UP004 [*] Class `A` inherits from `object` | 67 | class A( @@ -243,8 +225,6 @@ UP004.py:69:5: UP004 [*] Class `A` inherits from `object` 73 69 | 74 70 | - Run `ruff check --fix` to apply this fix. - UP004.py:75:12: UP004 [*] Class `B` inherits from `object` | 75 | class B(A, object): @@ -262,8 +242,6 @@ UP004.py:75:12: UP004 [*] Class `B` inherits from `object` 77 77 | 78 78 | - Run `ruff check --fix` to apply this fix. - UP004.py:79:9: UP004 [*] Class `B` inherits from `object` | 79 | class B(object, A): @@ -281,8 +259,6 @@ UP004.py:79:9: UP004 [*] Class `B` inherits from `object` 81 81 | 82 82 | - Run `ruff check --fix` to apply this fix. - UP004.py:84:5: UP004 [*] Class `B` inherits from `object` | 83 | class B( @@ -301,8 +277,6 @@ UP004.py:84:5: UP004 [*] Class `B` inherits from `object` 86 85 | ): 87 86 | ... - Run `ruff check --fix` to apply this fix. - UP004.py:92:5: UP004 [*] Class `B` inherits from `object` | 90 | class B( @@ -322,8 +296,6 @@ UP004.py:92:5: UP004 [*] Class `B` inherits from `object` 94 93 | ... 95 94 | - Run `ruff check --fix` to apply this fix. - UP004.py:98:5: UP004 [*] Class `B` inherits from `object` | 97 | class B( @@ -342,8 +314,6 @@ UP004.py:98:5: UP004 [*] Class `B` inherits from `object` 100 99 | A, 101 100 | ): - Run `ruff check --fix` to apply this fix. - UP004.py:108:5: UP004 [*] Class `B` inherits from `object` | 106 | # Comment on A. @@ -363,8 +333,6 @@ UP004.py:108:5: UP004 [*] Class `B` inherits from `object` 110 109 | ... 111 110 | - Run `ruff check --fix` to apply this fix. - UP004.py:119:5: UP004 [*] Class `A` inherits from `object` | 118 | class A( @@ -386,8 +354,6 @@ UP004.py:119:5: UP004 [*] Class `A` inherits from `object` 122 120 | 123 121 | - Run `ruff check --fix` to apply this fix. - UP004.py:125:5: UP004 [*] Class `A` inherits from `object` | 124 | class A( @@ -409,8 +375,6 @@ UP004.py:125:5: UP004 [*] Class `A` inherits from `object` 128 126 | 129 127 | - Run `ruff check --fix` to apply this fix. - UP004.py:131:5: UP004 [*] Class `A` inherits from `object` | 130 | class A( @@ -433,8 +397,6 @@ UP004.py:131:5: UP004 [*] Class `A` inherits from `object` 135 132 | 136 133 | - Run `ruff check --fix` to apply this fix. - UP004.py:137:9: UP004 [*] Class `A` inherits from `object` | 137 | class A(object, object): @@ -452,8 +414,6 @@ UP004.py:137:9: UP004 [*] Class `A` inherits from `object` 139 139 | 140 140 | - Run `ruff check --fix` to apply this fix. - UP004.py:137:17: UP004 [*] Class `A` inherits from `object` | 137 | class A(object, object): @@ -471,8 +431,6 @@ UP004.py:137:17: UP004 [*] Class `A` inherits from `object` 139 139 | 140 140 | - Run `ruff check --fix` to apply this fix. - UP004.py:142:9: UP004 [*] Class `A` inherits from `object` | 141 | @decorator() @@ -491,8 +449,6 @@ UP004.py:142:9: UP004 [*] Class `A` inherits from `object` 144 144 | 145 145 | @decorator() # class A(object): - Run `ruff check --fix` to apply this fix. - UP004.py:146:9: UP004 [*] Class `A` inherits from `object` | 145 | @decorator() # class A(object): @@ -511,8 +467,6 @@ UP004.py:146:9: UP004 [*] Class `A` inherits from `object` 148 148 | 149 149 | - Run `ruff check --fix` to apply this fix. - UP004.py:159:15: UP004 [*] Class `Unusual` inherits from `object` | 157 | import builtins @@ -529,5 +483,3 @@ UP004.py:159:15: UP004 [*] Class `Unusual` inherits from `object` 159 |-class Unusual(builtins.object): 159 |+class Unusual: 160 160 | ... - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap index 704e53e70100f..91d4323bf19d6 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap @@ -21,8 +21,6 @@ UP005.py:6:9: UP005 [*] `assertEquals` is deprecated, use `assertEqual` 8 8 | self.assertEqual(3, 4) 9 9 | self.failUnlessAlmostEqual(1, 1.1) - Run `ruff check --fix` to apply this fix. - UP005.py:7:9: UP005 [*] `assertEquals` is deprecated, use `assertEqual` | 5 | def test(self) -> None: @@ -43,8 +41,6 @@ UP005.py:7:9: UP005 [*] `assertEquals` is deprecated, use `assertEqual` 9 9 | self.failUnlessAlmostEqual(1, 1.1) 10 10 | self.assertNotRegexpMatches("a", "b") - Run `ruff check --fix` to apply this fix. - UP005.py:9:9: UP005 [*] `failUnlessAlmostEqual` is deprecated, use `assertAlmostEqual` | 7 | self.assertEquals(1, 2) @@ -62,8 +58,6 @@ UP005.py:9:9: UP005 [*] `failUnlessAlmostEqual` is deprecated, use `assertAlmost 9 |+ self.assertAlmostEqual(1, 1.1) 10 10 | self.assertNotRegexpMatches("a", "b") - Run `ruff check --fix` to apply this fix. - UP005.py:10:9: UP005 [*] `assertNotRegexpMatches` is deprecated, use `assertNotRegex` | 8 | self.assertEqual(3, 4) @@ -78,5 +72,3 @@ UP005.py:10:9: UP005 [*] `assertNotRegexpMatches` is deprecated, use `assertNotR 9 9 | self.failUnlessAlmostEqual(1, 1.1) 10 |- self.assertNotRegexpMatches("a", "b") 10 |+ self.assertNotRegex("a", "b") - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap index 662ac44c7aaa4..aa426276f80d4 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap @@ -18,8 +18,6 @@ UP006_0.py:4:10: UP006 [*] Use `list` instead of `typing.List` for type annotati 6 6 | 7 7 | - Run `ruff check --fix` to apply this fix. - UP006_0.py:11:10: UP006 [*] Use `list` instead of `List` for type annotation | 11 | def f(x: List[str]) -> None: @@ -37,8 +35,6 @@ UP006_0.py:11:10: UP006 [*] Use `list` instead of `List` for type annotation 13 13 | 14 14 | - Run `ruff check --fix` to apply this fix. - UP006_0.py:18:10: UP006 [*] Use `list` instead of `t.List` for type annotation | 18 | def f(x: t.List[str]) -> None: @@ -56,8 +52,6 @@ UP006_0.py:18:10: UP006 [*] Use `list` instead of `t.List` for type annotation 20 20 | 21 21 | - Run `ruff check --fix` to apply this fix. - UP006_0.py:25:10: UP006 [*] Use `list` instead of `IList` for type annotation | 25 | def f(x: IList[str]) -> None: @@ -75,8 +69,6 @@ UP006_0.py:25:10: UP006 [*] Use `list` instead of `IList` for type annotation 27 27 | 28 28 | - Run `ruff check --fix` to apply this fix. - UP006_0.py:29:11: UP006 [*] Use `list` instead of `List` for type annotation | 29 | def f(x: "List[str]") -> None: @@ -94,8 +86,6 @@ UP006_0.py:29:11: UP006 [*] Use `list` instead of `List` for type annotation 31 31 | 32 32 | - Run `ruff check --fix` to apply this fix. - UP006_0.py:33:12: UP006 [*] Use `list` instead of `List` for type annotation | 33 | def f(x: r"List[str]") -> None: @@ -113,8 +103,6 @@ UP006_0.py:33:12: UP006 [*] Use `list` instead of `List` for type annotation 35 35 | 36 36 | - Run `ruff check --fix` to apply this fix. - UP006_0.py:37:11: UP006 [*] Use `list` instead of `List` for type annotation | 37 | def f(x: "List[str]") -> None: @@ -132,8 +120,6 @@ UP006_0.py:37:11: UP006 [*] Use `list` instead of `List` for type annotation 39 39 | 40 40 | - Run `ruff check --fix` to apply this fix. - UP006_0.py:41:13: UP006 [*] Use `list` instead of `List` for type annotation | 41 | def f(x: """List[str]""") -> None: @@ -151,8 +137,6 @@ UP006_0.py:41:13: UP006 [*] Use `list` instead of `List` for type annotation 43 43 | 44 44 | - Run `ruff check --fix` to apply this fix. - UP006_0.py:45:10: UP006 Use `list` instead of `List` for type annotation | 45 | def f(x: "Li" "st[str]") -> None: @@ -178,8 +162,6 @@ UP006_0.py:49:11: UP006 [*] Use `list` instead of `List` for type annotation 51 51 | 52 52 | - Run `ruff check --fix` to apply this fix. - UP006_0.py:49:17: UP006 [*] Use `list` instead of `List` for type annotation | 49 | def f(x: "List['List[str]']") -> None: @@ -197,8 +179,6 @@ UP006_0.py:49:17: UP006 [*] Use `list` instead of `List` for type annotation 51 51 | 52 52 | - Run `ruff check --fix` to apply this fix. - UP006_0.py:53:11: UP006 [*] Use `list` instead of `List` for type annotation | 53 | def f(x: "List['Li' 'st[str]']") -> None: @@ -216,8 +196,6 @@ UP006_0.py:53:11: UP006 [*] Use `list` instead of `List` for type annotation 55 55 | 56 56 | - Run `ruff check --fix` to apply this fix. - UP006_0.py:53:16: UP006 Use `list` instead of `List` for type annotation | 53 | def f(x: "List['Li' 'st[str]']") -> None: @@ -267,8 +245,6 @@ UP006_0.py:61:10: UP006 [*] Use `collections.deque` instead of `typing.Deque` fo 63 64 | 64 65 | - Run `ruff check --fix` to apply this fix. - UP006_0.py:65:10: UP006 [*] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation | 65 | def f(x: typing.DefaultDict[str, str]) -> None: @@ -291,5 +267,3 @@ UP006_0.py:65:10: UP006 [*] Use `collections.defaultdict` instead of `typing.Def 65 |-def f(x: typing.DefaultDict[str, str]) -> None: 66 |+def f(x: defaultdict[str, str]) -> None: 66 67 | ... - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap index 3551787421b95..f3bbc98010531 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap @@ -15,5 +15,3 @@ UP006_1.py:9:10: UP006 [*] Use `collections.defaultdict` instead of `typing.Defa 9 |-def f(x: typing.DefaultDict[str, str]) -> None: 9 |+def f(x: defaultdict[str, str]) -> None: 10 10 | ... - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap index be7713f8e5202..28276ac27958c 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap @@ -15,5 +15,3 @@ UP006_3.py:7:11: UP006 [*] Use `collections.defaultdict` instead of `typing.Defa 7 |-def f(x: "typing.DefaultDict[str, str]") -> None: 7 |+def f(x: "defaultdict[str, str]") -> None: 8 8 | ... - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap index 84ab950d987fe..92639257686bf 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap @@ -18,8 +18,6 @@ UP007.py:6:10: UP007 [*] Use `X | Y` for type annotations 8 8 | 9 9 | - Run `ruff check --fix` to apply this fix. - UP007.py:10:10: UP007 [*] Use `X | Y` for type annotations | 10 | def f(x: typing.Optional[str]) -> None: @@ -37,8 +35,6 @@ UP007.py:10:10: UP007 [*] Use `X | Y` for type annotations 12 12 | 13 13 | - Run `ruff check --fix` to apply this fix. - UP007.py:14:10: UP007 [*] Use `X | Y` for type annotations | 14 | def f(x: Union[str, int, Union[float, bytes]]) -> None: @@ -56,8 +52,6 @@ UP007.py:14:10: UP007 [*] Use `X | Y` for type annotations 16 16 | 17 17 | - Run `ruff check --fix` to apply this fix. - UP007.py:14:26: UP007 [*] Use `X | Y` for type annotations | 14 | def f(x: Union[str, int, Union[float, bytes]]) -> None: @@ -75,8 +69,6 @@ UP007.py:14:26: UP007 [*] Use `X | Y` for type annotations 16 16 | 17 17 | - Run `ruff check --fix` to apply this fix. - UP007.py:18:10: UP007 [*] Use `X | Y` for type annotations | 18 | def f(x: typing.Union[str, int]) -> None: @@ -94,8 +86,6 @@ UP007.py:18:10: UP007 [*] Use `X | Y` for type annotations 20 20 | 21 21 | - Run `ruff check --fix` to apply this fix. - UP007.py:22:10: UP007 [*] Use `X | Y` for type annotations | 22 | def f(x: typing.Union[(str, int)]) -> None: @@ -113,8 +103,6 @@ UP007.py:22:10: UP007 [*] Use `X | Y` for type annotations 24 24 | 25 25 | - Run `ruff check --fix` to apply this fix. - UP007.py:26:10: UP007 [*] Use `X | Y` for type annotations | 26 | def f(x: typing.Union[(str, int), float]) -> None: @@ -132,8 +120,6 @@ UP007.py:26:10: UP007 [*] Use `X | Y` for type annotations 28 28 | 29 29 | - Run `ruff check --fix` to apply this fix. - UP007.py:30:10: UP007 [*] Use `X | Y` for type annotations | 30 | def f(x: typing.Union[(int,)]) -> None: @@ -151,8 +137,6 @@ UP007.py:30:10: UP007 [*] Use `X | Y` for type annotations 32 32 | 33 33 | - Run `ruff check --fix` to apply this fix. - UP007.py:34:10: UP007 [*] Use `X | Y` for type annotations | 34 | def f(x: typing.Union[()]) -> None: @@ -170,8 +154,6 @@ UP007.py:34:10: UP007 [*] Use `X | Y` for type annotations 36 36 | 37 37 | - Run `ruff check --fix` to apply this fix. - UP007.py:38:11: UP007 [*] Use `X | Y` for type annotations | 38 | def f(x: "Union[str, int, Union[float, bytes]]") -> None: @@ -189,8 +171,6 @@ UP007.py:38:11: UP007 [*] Use `X | Y` for type annotations 40 40 | 41 41 | - Run `ruff check --fix` to apply this fix. - UP007.py:38:27: UP007 [*] Use `X | Y` for type annotations | 38 | def f(x: "Union[str, int, Union[float, bytes]]") -> None: @@ -208,8 +188,6 @@ UP007.py:38:27: UP007 [*] Use `X | Y` for type annotations 40 40 | 41 41 | - Run `ruff check --fix` to apply this fix. - UP007.py:42:11: UP007 [*] Use `X | Y` for type annotations | 42 | def f(x: "typing.Union[str, int]") -> None: @@ -227,8 +205,6 @@ UP007.py:42:11: UP007 [*] Use `X | Y` for type annotations 44 44 | 45 45 | - Run `ruff check --fix` to apply this fix. - UP007.py:55:8: UP007 [*] Use `X | Y` for type annotations | 54 | def f() -> None: @@ -247,8 +223,6 @@ UP007.py:55:8: UP007 [*] Use `X | Y` for type annotations 57 57 | 58 58 | x = Union[str, int] - Run `ruff check --fix` to apply this fix. - UP007.py:56:9: UP007 Use `X | Y` for type annotations | 54 | def f() -> None: @@ -290,8 +264,6 @@ UP007.py:60:8: UP007 [*] Use `X | Y` for type annotations 62 62 | 63 63 | - Run `ruff check --fix` to apply this fix. - UP007.py:61:8: UP007 [*] Use `X | Y` for type annotations | 59 | x = Union["str", "int"] @@ -310,8 +282,6 @@ UP007.py:61:8: UP007 [*] Use `X | Y` for type annotations 63 63 | 64 64 | def f(x: Union[int : float]) -> None: - Run `ruff check --fix` to apply this fix. - UP007.py:64:10: UP007 Use `X | Y` for type annotations | 64 | def f(x: Union[int : float]) -> None: @@ -409,8 +379,6 @@ UP007.py:102:28: UP007 [*] Use `X | Y` for type annotations 107 104 | 108 105 | # Regression test for: https://github.com/astral-sh/ruff/issues/7201 - Run `ruff check --fix` to apply this fix. - UP007.py:110:28: UP007 [*] Use `X | Y` for type annotations | 108 | # Regression test for: https://github.com/astral-sh/ruff/issues/7201 @@ -429,8 +397,6 @@ UP007.py:110:28: UP007 [*] Use `X | Y` for type annotations 112 112 | 113 113 | # Regression test for: https://github.com/astral-sh/ruff/issues/7452 - Run `ruff check --fix` to apply this fix. - UP007.py:120:10: UP007 [*] Use `X | Y` for type annotations | 119 | # Regression test for: https://github.com/astral-sh/ruff/issues/8609 @@ -446,5 +412,3 @@ UP007.py:120:10: UP007 [*] Use `X | Y` for type annotations 120 |-def f(x: Union[int, str, bytes]) -> None: 120 |+def f(x: int | str | bytes) -> None: 121 121 | ... - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_0.py.snap index 35d4d69b580de..5d7309d619601 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_0.py.snap @@ -13,5 +13,3 @@ UP009_0.py:1:1: UP009 [*] UTF-8 encoding declaration is unnecessary 1 |-# coding=utf8 2 1 | 3 2 | print("Hello world") - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_1.py.snap index 745d5e6ccddc9..baeb863feebd1 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_1.py.snap @@ -15,5 +15,3 @@ UP009_1.py:2:1: UP009 [*] UTF-8 encoding declaration is unnecessary 2 |-# -*- coding: utf-8 -*- 3 2 | 4 3 | print('Hello world') - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_6.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_6.py.snap index 93efa1ab1cf4f..ae21eb8af5341 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_6.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_6.py.snap @@ -13,5 +13,3 @@ UP009_6.py:1:2: UP009 [*] UTF-8 encoding declaration is unnecessary 2 1 | print("Hello world") 3 2 | 4 3 | """ - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_7.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_7.py.snap index 81b5f0e10e4c7..a1ad81111b2b0 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_7.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP009_7.py.snap @@ -13,5 +13,3 @@ UP009_7.py:1:2: UP009 [*] UTF-8 encoding declaration is unnecessary 2 1 | print("Hello world") 3 2 | 4 3 | """ - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap index 19df38775639e..7dc270010a217 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap @@ -15,8 +15,6 @@ UP010.py:1:1: UP010 [*] Unnecessary `__future__` imports `generators`, `nested_s 3 2 | from __future__ import absolute_import, division 4 3 | from __future__ import generator_stop - Run `ruff check --fix` to apply this fix. - UP010.py:2:1: UP010 [*] Unnecessary `__future__` imports `unicode_literals`, `with_statement` for target Python version | 1 | from __future__ import nested_scopes, generators @@ -33,8 +31,6 @@ UP010.py:2:1: UP010 [*] Unnecessary `__future__` imports `unicode_literals`, `wi 4 3 | from __future__ import generator_stop 5 4 | from __future__ import print_function, generator_stop - Run `ruff check --fix` to apply this fix. - UP010.py:3:1: UP010 [*] Unnecessary `__future__` imports `absolute_import`, `division` for target Python version | 1 | from __future__ import nested_scopes, generators @@ -53,8 +49,6 @@ UP010.py:3:1: UP010 [*] Unnecessary `__future__` imports `absolute_import`, `div 5 4 | from __future__ import print_function, generator_stop 6 5 | from __future__ import invalid_module, generators - Run `ruff check --fix` to apply this fix. - UP010.py:4:1: UP010 [*] Unnecessary `__future__` import `generator_stop` for target Python version | 2 | from __future__ import with_statement, unicode_literals @@ -74,8 +68,6 @@ UP010.py:4:1: UP010 [*] Unnecessary `__future__` import `generator_stop` for tar 6 5 | from __future__ import invalid_module, generators 7 6 | - Run `ruff check --fix` to apply this fix. - UP010.py:5:1: UP010 [*] Unnecessary `__future__` imports `generator_stop`, `print_function` for target Python version | 3 | from __future__ import absolute_import, division @@ -94,8 +86,6 @@ UP010.py:5:1: UP010 [*] Unnecessary `__future__` imports `generator_stop`, `prin 7 6 | 8 7 | if True: - Run `ruff check --fix` to apply this fix. - UP010.py:6:1: UP010 [*] Unnecessary `__future__` import `generators` for target Python version | 4 | from __future__ import generator_stop @@ -116,8 +106,6 @@ UP010.py:6:1: UP010 [*] Unnecessary `__future__` import `generators` for target 8 8 | if True: 9 9 | from __future__ import generator_stop - Run `ruff check --fix` to apply this fix. - UP010.py:9:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for target Python version | 8 | if True: @@ -135,8 +123,6 @@ UP010.py:9:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for tar 11 10 | 12 11 | if True: - Run `ruff check --fix` to apply this fix. - UP010.py:10:5: UP010 [*] Unnecessary `__future__` import `generators` for target Python version | 8 | if True: @@ -156,8 +142,6 @@ UP010.py:10:5: UP010 [*] Unnecessary `__future__` import `generators` for target 12 11 | if True: 13 12 | from __future__ import generator_stop - Run `ruff check --fix` to apply this fix. - UP010.py:13:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for target Python version | 12 | if True: @@ -173,8 +157,6 @@ UP010.py:13:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for ta 13 |- from __future__ import generator_stop 14 13 | from __future__ import invalid_module, generators - Run `ruff check --fix` to apply this fix. - UP010.py:14:5: UP010 [*] Unnecessary `__future__` import `generators` for target Python version | 12 | if True: @@ -189,5 +171,3 @@ UP010.py:14:5: UP010 [*] Unnecessary `__future__` import `generators` for target 13 13 | from __future__ import generator_stop 14 |- from __future__ import invalid_module, generators 14 |+ from __future__ import invalid_module - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP011.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP011.py.snap index a86cc25f837f1..7deefe6c38342 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP011.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP011.py.snap @@ -19,8 +19,6 @@ UP011.py:5:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` 7 7 | pass 8 8 | - Run `ruff check --fix` to apply this fix. - UP011.py:10:11: UP011 [*] Unnecessary parentheses to `functools.lru_cache` | 10 | @lru_cache() @@ -39,8 +37,6 @@ UP011.py:10:11: UP011 [*] Unnecessary parentheses to `functools.lru_cache` 12 12 | pass 13 13 | - Run `ruff check --fix` to apply this fix. - UP011.py:16:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` | 15 | @other_decorator @@ -60,8 +56,6 @@ UP011.py:16:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` 18 18 | pass 19 19 | - Run `ruff check --fix` to apply this fix. - UP011.py:21:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` | 21 | @functools.lru_cache() @@ -79,5 +73,3 @@ UP011.py:21:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` 22 22 | @other_decorator 23 23 | def fixme(): 24 24 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP012.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP012.py.snap index 7e5d14c1a7c00..cbdbf148ec1bb 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP012.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP012.py.snap @@ -18,8 +18,6 @@ UP012.py:2:1: UP012 [*] Unnecessary call to `encode` as UTF-8 4 4 | "foo".encode() # b"foo" 5 5 | "foo".encode("UTF8") # b"foo" - Run `ruff check --fix` to apply this fix. - UP012.py:3:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 1 | # ASCII literals should be replaced by a bytes literal @@ -39,8 +37,6 @@ UP012.py:3:1: UP012 [*] Unnecessary call to `encode` as UTF-8 5 5 | "foo".encode("UTF8") # b"foo" 6 6 | U"foo".encode("utf-8") # b"foo" - Run `ruff check --fix` to apply this fix. - UP012.py:4:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 2 | "foo".encode("utf-8") # b"foo" @@ -61,8 +57,6 @@ UP012.py:4:1: UP012 [*] Unnecessary call to `encode` as UTF-8 6 6 | U"foo".encode("utf-8") # b"foo" 7 7 | "foo".encode(encoding="utf-8") # b"foo" - Run `ruff check --fix` to apply this fix. - UP012.py:5:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 3 | "foo".encode("u8") # b"foo" @@ -83,8 +77,6 @@ UP012.py:5:1: UP012 [*] Unnecessary call to `encode` as UTF-8 7 7 | "foo".encode(encoding="utf-8") # b"foo" 8 8 | """ - Run `ruff check --fix` to apply this fix. - UP012.py:6:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 4 | "foo".encode() # b"foo" @@ -105,8 +97,6 @@ UP012.py:6:1: UP012 [*] Unnecessary call to `encode` as UTF-8 8 8 | """ 9 9 | Lorem - Run `ruff check --fix` to apply this fix. - UP012.py:7:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 5 | "foo".encode("UTF8") # b"foo" @@ -127,8 +117,6 @@ UP012.py:7:1: UP012 [*] Unnecessary call to `encode` as UTF-8 9 9 | Lorem 10 10 | - Run `ruff check --fix` to apply this fix. - UP012.py:8:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 6 | U"foo".encode("utf-8") # b"foo" @@ -162,8 +150,6 @@ UP012.py:8:1: UP012 [*] Unnecessary call to `encode` as UTF-8 16 14 | "Lorem " 17 15 | "Ipsum".encode() - Run `ruff check --fix` to apply this fix. - UP012.py:16:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | 14 | ) @@ -188,8 +174,6 @@ UP012.py:16:5: UP012 [*] Unnecessary call to `encode` as UTF-8 19 19 | ( 20 20 | "Lorem " # Comment - Run `ruff check --fix` to apply this fix. - UP012.py:20:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | 18 | ) @@ -214,8 +198,6 @@ UP012.py:20:5: UP012 [*] Unnecessary call to `encode` as UTF-8 23 23 | ( 24 24 | "Lorem " "Ipsum".encode() - Run `ruff check --fix` to apply this fix. - UP012.py:24:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | 22 | ) @@ -235,8 +217,6 @@ UP012.py:24:5: UP012 [*] Unnecessary call to `encode` as UTF-8 26 26 | 27 27 | # `encode` on variables should not be processed. - Run `ruff check --fix` to apply this fix. - UP012.py:32:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | 31 | bar = "bar" @@ -256,8 +236,6 @@ UP012.py:32:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 34 34 | "foo".encode(encoding) 35 35 | f"foo{bar}".encode(encoding) - Run `ruff check --fix` to apply this fix. - UP012.py:36:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | 34 | "foo".encode(encoding) @@ -282,8 +260,6 @@ UP012.py:36:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 40 38 | # `encode` with custom args and kwargs should not be processed. 41 39 | "foo".encode("utf-8", errors="replace") - Run `ruff check --fix` to apply this fix. - UP012.py:53:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | 52 | # Unicode literals should only be stripped of default encoding. @@ -303,8 +279,6 @@ UP012.py:53:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 55 55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode() 56 56 | - Run `ruff check --fix` to apply this fix. - UP012.py:55:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | 53 | "unicode text©".encode("utf-8") # "unicode text©".encode() @@ -325,8 +299,6 @@ UP012.py:55:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 57 57 | r"foo\o".encode("utf-8") # br"foo\o" 58 58 | u"foo".encode("utf-8") # b"foo" - Run `ruff check --fix` to apply this fix. - UP012.py:57:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode() @@ -347,8 +319,6 @@ UP012.py:57:1: UP012 [*] Unnecessary call to `encode` as UTF-8 59 59 | R"foo\o".encode("utf-8") # br"foo\o" 60 60 | U"foo".encode("utf-8") # b"foo" - Run `ruff check --fix` to apply this fix. - UP012.py:58:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 57 | r"foo\o".encode("utf-8") # br"foo\o" @@ -368,8 +338,6 @@ UP012.py:58:1: UP012 [*] Unnecessary call to `encode` as UTF-8 60 60 | U"foo".encode("utf-8") # b"foo" 61 61 | print("foo".encode()) # print(b"foo") - Run `ruff check --fix` to apply this fix. - UP012.py:59:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 57 | r"foo\o".encode("utf-8") # br"foo\o" @@ -390,8 +358,6 @@ UP012.py:59:1: UP012 [*] Unnecessary call to `encode` as UTF-8 61 61 | print("foo".encode()) # print(b"foo") 62 62 | - Run `ruff check --fix` to apply this fix. - UP012.py:60:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 58 | u"foo".encode("utf-8") # b"foo" @@ -411,8 +377,6 @@ UP012.py:60:1: UP012 [*] Unnecessary call to `encode` as UTF-8 62 62 | 63 63 | # `encode` on parenthesized strings. - Run `ruff check --fix` to apply this fix. - UP012.py:61:7: UP012 [*] Unnecessary call to `encode` as UTF-8 | 59 | R"foo\o".encode("utf-8") # br"foo\o" @@ -433,8 +397,6 @@ UP012.py:61:7: UP012 [*] Unnecessary call to `encode` as UTF-8 63 63 | # `encode` on parenthesized strings. 64 64 | ( - Run `ruff check --fix` to apply this fix. - UP012.py:64:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 63 | # `encode` on parenthesized strings. @@ -461,8 +423,6 @@ UP012.py:64:1: UP012 [*] Unnecessary call to `encode` as UTF-8 69 69 | (( 70 70 | "abc" - Run `ruff check --fix` to apply this fix. - UP012.py:69:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | 67 | ).encode() @@ -490,8 +450,6 @@ UP012.py:69:1: UP012 [*] Unnecessary call to `encode` as UTF-8 74 74 | (f"foo{bar}").encode("utf-8") 75 75 | (f"foo{bar}").encode(encoding="utf-8") - Run `ruff check --fix` to apply this fix. - UP012.py:74:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | 72 | )).encode() @@ -512,8 +470,6 @@ UP012.py:74:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 76 76 | ("unicode text©").encode("utf-8") 77 77 | ("unicode text©").encode(encoding="utf-8") - Run `ruff check --fix` to apply this fix. - UP012.py:75:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | 74 | (f"foo{bar}").encode("utf-8") @@ -533,8 +489,6 @@ UP012.py:75:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 77 77 | ("unicode text©").encode(encoding="utf-8") 78 78 | - Run `ruff check --fix` to apply this fix. - UP012.py:76:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | 74 | (f"foo{bar}").encode("utf-8") @@ -554,8 +508,6 @@ UP012.py:76:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 78 78 | 79 79 | - Run `ruff check --fix` to apply this fix. - UP012.py:77:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | 75 | (f"foo{bar}").encode(encoding="utf-8") @@ -574,8 +526,6 @@ UP012.py:77:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` 79 79 | 80 80 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459882 - Run `ruff check --fix` to apply this fix. - UP012.py:82:17: UP012 [*] Unnecessary call to `encode` as UTF-8 | 80 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459882 @@ -596,8 +546,6 @@ UP012.py:82:17: UP012 [*] Unnecessary call to `encode` as UTF-8 84 84 | # Not a valid type annotation but this test shouldn't result in a panic. 85 85 | # Refer: https://github.com/astral-sh/ruff/issues/11736 - Run `ruff check --fix` to apply this fix. - UP012.py:86:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | 84 | # Not a valid type annotation but this test shouldn't result in a panic. @@ -612,5 +560,3 @@ UP012.py:86:5: UP012 [*] Unnecessary call to `encode` as UTF-8 85 85 | # Refer: https://github.com/astral-sh/ruff/issues/11736 86 |-x: '"foo".encode("utf-8")' 86 |+x: 'b"foo"' - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap index 26d4a149b85f8..d3adbb8a515f8 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap @@ -22,8 +22,6 @@ UP013.py:5:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class sy 7 9 | # dict call 8 10 | MyType = TypedDict("MyType", dict(a=int, b=str)) - Run `ruff check --fix` to apply this fix. - UP013.py:8:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 7 | # dict call @@ -45,8 +43,6 @@ UP013.py:8:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class sy 10 12 | # kwargs 11 13 | MyType = TypedDict("MyType", a=int, b=str) - Run `ruff check --fix` to apply this fix. - UP013.py:11:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 10 | # kwargs @@ -68,8 +64,6 @@ UP013.py:11:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 13 15 | # Empty TypedDict 14 16 | MyType = TypedDict("MyType") - Run `ruff check --fix` to apply this fix. - UP013.py:14:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 13 | # Empty TypedDict @@ -90,8 +84,6 @@ UP013.py:14:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 16 17 | # Literal values 17 18 | MyType = TypedDict("MyType", {"a": "hello"}) - Run `ruff check --fix` to apply this fix. - UP013.py:17:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 16 | # Literal values @@ -111,8 +103,6 @@ UP013.py:17:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 19 20 | 20 21 | # NotRequired - Run `ruff check --fix` to apply this fix. - UP013.py:18:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 16 | # Literal values @@ -134,8 +124,6 @@ UP013.py:18:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 20 21 | # NotRequired 21 22 | MyType = TypedDict("MyType", {"a": NotRequired[dict]}) - Run `ruff check --fix` to apply this fix. - UP013.py:21:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 20 | # NotRequired @@ -156,8 +144,6 @@ UP013.py:21:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 23 24 | # total 24 25 | MyType = TypedDict("MyType", {"x": int, "y": int}, total=False) - Run `ruff check --fix` to apply this fix. - UP013.py:24:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 23 | # total @@ -179,8 +165,6 @@ UP013.py:24:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 26 28 | # using Literal type 27 29 | MyType = TypedDict("MyType", {"key": Literal["value"]}) - Run `ruff check --fix` to apply this fix. - UP013.py:27:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 26 | # using Literal type @@ -201,8 +185,6 @@ UP013.py:27:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 29 30 | # using namespace TypedDict 30 31 | MyType = typing.TypedDict("MyType", {"key": int}) - Run `ruff check --fix` to apply this fix. - UP013.py:30:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 29 | # using namespace TypedDict @@ -223,8 +205,6 @@ UP013.py:30:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 32 33 | # invalid identifiers (OK) 33 34 | MyType = TypedDict("MyType", {"in": int, "x-y": int}) - Run `ruff check --fix` to apply this fix. - UP013.py:40:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 39 | # Empty dict literal @@ -245,8 +225,6 @@ UP013.py:40:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 42 43 | # Empty dict call 43 44 | MyType = TypedDict("MyType", dict()) - Run `ruff check --fix` to apply this fix. - UP013.py:43:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 42 | # Empty dict call @@ -261,5 +239,3 @@ UP013.py:43:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 43 |-MyType = TypedDict("MyType", dict()) 43 |+class MyType(TypedDict): 44 |+ pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap index b4f73e6495185..1d7ad1d7b9e9b 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap @@ -22,8 +22,6 @@ UP014.py:5:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class s 7 9 | # with namespace 8 10 | MyType = typing.NamedTuple("MyType", [("a", int), ("b", str)]) - Run `ruff check --fix` to apply this fix. - UP014.py:8:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax | 7 | # with namespace @@ -45,8 +43,6 @@ UP014.py:8:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class s 10 12 | # invalid identifiers (OK) 11 13 | MyType = NamedTuple("MyType", [("x-y", int), ("b", tuple[str, ...])]) - Run `ruff check --fix` to apply this fix. - UP014.py:14:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax | 13 | # no fields @@ -67,8 +63,6 @@ UP014.py:14:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class 16 17 | # empty fields 17 18 | MyType = typing.NamedTuple("MyType", []) - Run `ruff check --fix` to apply this fix. - UP014.py:17:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax | 16 | # empty fields @@ -89,8 +83,6 @@ UP014.py:17:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class 19 20 | # keywords 20 21 | MyType = typing.NamedTuple("MyType", a=int, b=tuple[str, ...]) - Run `ruff check --fix` to apply this fix. - UP014.py:20:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax | 19 | # keywords @@ -111,5 +103,3 @@ UP014.py:20:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class 21 23 | 22 24 | # unfixable 23 25 | MyType = typing.NamedTuple("MyType", [("a", int)], [("b", str)]) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015.py.snap index 7ffc71c59c4c3..c3301f1910ada 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015.py.snap @@ -16,8 +16,6 @@ UP015.py:1:1: UP015 [*] Unnecessary open mode parameters 3 3 | open("foo", "Ub") 4 4 | open("foo", "rUb") - Run `ruff check --fix` to apply this fix. - UP015.py:2:1: UP015 [*] Unnecessary open mode parameters | 1 | open("foo", "U") @@ -35,8 +33,6 @@ UP015.py:2:1: UP015 [*] Unnecessary open mode parameters 4 4 | open("foo", "rUb") 5 5 | open("foo", "r") - Run `ruff check --fix` to apply this fix. - UP015.py:3:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 1 | open("foo", "U") @@ -56,8 +52,6 @@ UP015.py:3:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 5 5 | open("foo", "r") 6 6 | open("foo", "rt") - Run `ruff check --fix` to apply this fix. - UP015.py:4:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 2 | open("foo", "Ur") @@ -78,8 +72,6 @@ UP015.py:4:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 6 6 | open("foo", "rt") 7 7 | open("f", "r", encoding="UTF-8") - Run `ruff check --fix` to apply this fix. - UP015.py:5:1: UP015 [*] Unnecessary open mode parameters | 3 | open("foo", "Ub") @@ -100,8 +92,6 @@ UP015.py:5:1: UP015 [*] Unnecessary open mode parameters 7 7 | open("f", "r", encoding="UTF-8") 8 8 | open("f", "wt") - Run `ruff check --fix` to apply this fix. - UP015.py:6:1: UP015 [*] Unnecessary open mode parameters | 4 | open("foo", "rUb") @@ -122,8 +112,6 @@ UP015.py:6:1: UP015 [*] Unnecessary open mode parameters 8 8 | open("f", "wt") 9 9 | - Run `ruff check --fix` to apply this fix. - UP015.py:7:1: UP015 [*] Unnecessary open mode parameters | 5 | open("foo", "r") @@ -143,8 +131,6 @@ UP015.py:7:1: UP015 [*] Unnecessary open mode parameters 9 9 | 10 10 | with open("foo", "U") as f: - Run `ruff check --fix` to apply this fix. - UP015.py:8:1: UP015 [*] Unnecessary open mode parameters, use ""w"" | 6 | open("foo", "rt") @@ -165,8 +151,6 @@ UP015.py:8:1: UP015 [*] Unnecessary open mode parameters, use ""w"" 10 10 | with open("foo", "U") as f: 11 11 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:10:6: UP015 [*] Unnecessary open mode parameters | 8 | open("f", "wt") @@ -187,8 +171,6 @@ UP015.py:10:6: UP015 [*] Unnecessary open mode parameters 12 12 | with open("foo", "Ur") as f: 13 13 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:12:6: UP015 [*] Unnecessary open mode parameters | 10 | with open("foo", "U") as f: @@ -209,8 +191,6 @@ UP015.py:12:6: UP015 [*] Unnecessary open mode parameters 14 14 | with open("foo", "Ub") as f: 15 15 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:14:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 12 | with open("foo", "Ur") as f: @@ -231,8 +211,6 @@ UP015.py:14:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" 16 16 | with open("foo", "rUb") as f: 17 17 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:16:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 14 | with open("foo", "Ub") as f: @@ -253,8 +231,6 @@ UP015.py:16:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" 18 18 | with open("foo", "r") as f: 19 19 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:18:6: UP015 [*] Unnecessary open mode parameters | 16 | with open("foo", "rUb") as f: @@ -275,8 +251,6 @@ UP015.py:18:6: UP015 [*] Unnecessary open mode parameters 20 20 | with open("foo", "rt") as f: 21 21 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:20:6: UP015 [*] Unnecessary open mode parameters | 18 | with open("foo", "r") as f: @@ -297,8 +271,6 @@ UP015.py:20:6: UP015 [*] Unnecessary open mode parameters 22 22 | with open("foo", "r", encoding="UTF-8") as f: 23 23 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:22:6: UP015 [*] Unnecessary open mode parameters | 20 | with open("foo", "rt") as f: @@ -319,8 +291,6 @@ UP015.py:22:6: UP015 [*] Unnecessary open mode parameters 24 24 | with open("foo", "wt") as f: 25 25 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:24:6: UP015 [*] Unnecessary open mode parameters, use ""w"" | 22 | with open("foo", "r", encoding="UTF-8") as f: @@ -340,8 +310,6 @@ UP015.py:24:6: UP015 [*] Unnecessary open mode parameters, use ""w"" 26 26 | 27 27 | open(f("a", "b", "c"), "U") - Run `ruff check --fix` to apply this fix. - UP015.py:27:1: UP015 [*] Unnecessary open mode parameters | 25 | pass @@ -361,8 +329,6 @@ UP015.py:27:1: UP015 [*] Unnecessary open mode parameters 29 29 | 30 30 | with open(f("a", "b", "c"), "U") as f: - Run `ruff check --fix` to apply this fix. - UP015.py:28:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 27 | open(f("a", "b", "c"), "U") @@ -382,8 +348,6 @@ UP015.py:28:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 30 30 | with open(f("a", "b", "c"), "U") as f: 31 31 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:30:6: UP015 [*] Unnecessary open mode parameters | 28 | open(f("a", "b", "c"), "Ub") @@ -404,8 +368,6 @@ UP015.py:30:6: UP015 [*] Unnecessary open mode parameters 32 32 | with open(f("a", "b", "c"), "Ub") as f: 33 33 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:32:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 30 | with open(f("a", "b", "c"), "U") as f: @@ -425,8 +387,6 @@ UP015.py:32:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" 34 34 | 35 35 | with open("foo", "U") as fa, open("bar", "U") as fb: - Run `ruff check --fix` to apply this fix. - UP015.py:35:6: UP015 [*] Unnecessary open mode parameters | 33 | pass @@ -447,8 +407,6 @@ UP015.py:35:6: UP015 [*] Unnecessary open mode parameters 37 37 | with open("foo", "Ub") as fa, open("bar", "Ub") as fb: 38 38 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:35:30: UP015 [*] Unnecessary open mode parameters | 33 | pass @@ -469,8 +427,6 @@ UP015.py:35:30: UP015 [*] Unnecessary open mode parameters 37 37 | with open("foo", "Ub") as fa, open("bar", "Ub") as fb: 38 38 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:37:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 35 | with open("foo", "U") as fa, open("bar", "U") as fb: @@ -490,8 +446,6 @@ UP015.py:37:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" 39 39 | 40 40 | open("foo", mode="U") - Run `ruff check --fix` to apply this fix. - UP015.py:37:31: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 35 | with open("foo", "U") as fa, open("bar", "U") as fb: @@ -511,8 +465,6 @@ UP015.py:37:31: UP015 [*] Unnecessary open mode parameters, use ""rb"" 39 39 | 40 40 | open("foo", mode="U") - Run `ruff check --fix` to apply this fix. - UP015.py:40:1: UP015 [*] Unnecessary open mode parameters | 38 | pass @@ -533,8 +485,6 @@ UP015.py:40:1: UP015 [*] Unnecessary open mode parameters 42 42 | open(mode="U", name="foo") 43 43 | - Run `ruff check --fix` to apply this fix. - UP015.py:41:1: UP015 [*] Unnecessary open mode parameters | 40 | open("foo", mode="U") @@ -553,8 +503,6 @@ UP015.py:41:1: UP015 [*] Unnecessary open mode parameters 43 43 | 44 44 | with open("foo", mode="U") as f: - Run `ruff check --fix` to apply this fix. - UP015.py:42:1: UP015 [*] Unnecessary open mode parameters | 40 | open("foo", mode="U") @@ -575,8 +523,6 @@ UP015.py:42:1: UP015 [*] Unnecessary open mode parameters 44 44 | with open("foo", mode="U") as f: 45 45 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:44:6: UP015 [*] Unnecessary open mode parameters | 42 | open(mode="U", name="foo") @@ -597,8 +543,6 @@ UP015.py:44:6: UP015 [*] Unnecessary open mode parameters 46 46 | with open(name="foo", mode="U") as f: 47 47 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:46:6: UP015 [*] Unnecessary open mode parameters | 44 | with open("foo", mode="U") as f: @@ -619,8 +563,6 @@ UP015.py:46:6: UP015 [*] Unnecessary open mode parameters 48 48 | with open(mode="U", name="foo") as f: 49 49 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:48:6: UP015 [*] Unnecessary open mode parameters | 46 | with open(name="foo", mode="U") as f: @@ -640,8 +582,6 @@ UP015.py:48:6: UP015 [*] Unnecessary open mode parameters 50 50 | 51 51 | open("foo", mode="Ub") - Run `ruff check --fix` to apply this fix. - UP015.py:51:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 49 | pass @@ -662,8 +602,6 @@ UP015.py:51:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 53 53 | open(mode="Ub", name="foo") 54 54 | - Run `ruff check --fix` to apply this fix. - UP015.py:52:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 51 | open("foo", mode="Ub") @@ -682,8 +620,6 @@ UP015.py:52:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 54 54 | 55 55 | with open("foo", mode="Ub") as f: - Run `ruff check --fix` to apply this fix. - UP015.py:53:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 51 | open("foo", mode="Ub") @@ -704,8 +640,6 @@ UP015.py:53:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 55 55 | with open("foo", mode="Ub") as f: 56 56 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:55:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 53 | open(mode="Ub", name="foo") @@ -726,8 +660,6 @@ UP015.py:55:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" 57 57 | with open(name="foo", mode="Ub") as f: 58 58 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:57:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 55 | with open("foo", mode="Ub") as f: @@ -748,8 +680,6 @@ UP015.py:57:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" 59 59 | with open(mode="Ub", name="foo") as f: 60 60 | pass - Run `ruff check --fix` to apply this fix. - UP015.py:59:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 57 | with open(name="foo", mode="Ub") as f: @@ -769,8 +699,6 @@ UP015.py:59:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" 61 61 | 62 62 | open(file="foo", mode='U', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) - Run `ruff check --fix` to apply this fix. - UP015.py:62:1: UP015 [*] Unnecessary open mode parameters | 60 | pass @@ -791,8 +719,6 @@ UP015.py:62:1: UP015 [*] Unnecessary open mode parameters 64 64 | open(file="foo", buffering=-1, encoding=None, errors=None, mode='U', newline=None, closefd=True, opener=None) 65 65 | open(mode='U', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) - Run `ruff check --fix` to apply this fix. - UP015.py:63:1: UP015 [*] Unnecessary open mode parameters | 62 | open(file="foo", mode='U', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) @@ -812,8 +738,6 @@ UP015.py:63:1: UP015 [*] Unnecessary open mode parameters 65 65 | open(mode='U', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 66 66 | - Run `ruff check --fix` to apply this fix. - UP015.py:64:1: UP015 [*] Unnecessary open mode parameters | 62 | open(file="foo", mode='U', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) @@ -833,8 +757,6 @@ UP015.py:64:1: UP015 [*] Unnecessary open mode parameters 66 66 | 67 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) - Run `ruff check --fix` to apply this fix. - UP015.py:65:1: UP015 [*] Unnecessary open mode parameters | 63 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='U') @@ -855,8 +777,6 @@ UP015.py:65:1: UP015 [*] Unnecessary open mode parameters 67 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 68 68 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='Ub') - Run `ruff check --fix` to apply this fix. - UP015.py:67:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 65 | open(mode='U', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) @@ -877,8 +797,6 @@ UP015.py:67:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 69 69 | open(file="foo", buffering=-1, encoding=None, errors=None, mode='Ub', newline=None, closefd=True, opener=None) 70 70 | open(mode='Ub', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) - Run `ruff check --fix` to apply this fix. - UP015.py:68:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) @@ -898,8 +816,6 @@ UP015.py:68:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 70 70 | open(mode='Ub', file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 71 71 | - Run `ruff check --fix` to apply this fix. - UP015.py:69:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 67 | open(file="foo", mode='Ub', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) @@ -919,8 +835,6 @@ UP015.py:69:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 71 71 | 72 72 | open = 1 - Run `ruff check --fix` to apply this fix. - UP015.py:70:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | 68 | open(file="foo", buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None, mode='Ub') @@ -940,5 +854,3 @@ UP015.py:70:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" 71 71 | 72 72 | open = 1 73 73 | open("foo", "U") - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015_1.py.snap index 1381d568b0442..427f55ae5b6a3 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP015_1.py.snap @@ -14,6 +14,4 @@ UP015_1.py:3:5: UP015 [*] Unnecessary open mode parameters 2 2 | # Refer: https://github.com/astral-sh/ruff/issues/11736 3 |-x: 'open("foo", "r")' 3 |+x: 'open("foo")' -4 4 | - - Run `ruff check --fix` to apply this fix. +4 4 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP018.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP018.py.snap index e8f7a8a59767b..6ba375dfd57ab 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP018.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP018.py.snap @@ -20,8 +20,6 @@ UP018.py:37:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) 39 39 | str(""" 40 40 | foo""") - Run `ruff check --fix` to apply this fix. - UP018.py:38:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) | 36 | # These become literals @@ -42,8 +40,6 @@ UP018.py:38:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) 40 40 | foo""") 41 41 | bytes() - Run `ruff check --fix` to apply this fix. - UP018.py:39:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) | 37 | str() @@ -67,8 +63,6 @@ UP018.py:39:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) 42 42 | bytes(b"foo") 43 43 | bytes(b""" - Run `ruff check --fix` to apply this fix. - UP018.py:41:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) | 39 | str(""" @@ -89,8 +83,6 @@ UP018.py:41:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) 43 43 | bytes(b""" 44 44 | foo""") - Run `ruff check --fix` to apply this fix. - UP018.py:42:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) | 40 | foo""") @@ -111,8 +103,6 @@ UP018.py:42:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) 44 44 | foo""") 45 45 | f"{str()}" - Run `ruff check --fix` to apply this fix. - UP018.py:43:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) | 41 | bytes() @@ -136,8 +126,6 @@ UP018.py:43:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) 46 46 | int() 47 47 | int(1) - Run `ruff check --fix` to apply this fix. - UP018.py:45:4: UP018 [*] Unnecessary `str` call (rewrite as a literal) | 43 | bytes(b""" @@ -158,8 +146,6 @@ UP018.py:45:4: UP018 [*] Unnecessary `str` call (rewrite as a literal) 47 47 | int(1) 48 48 | float() - Run `ruff check --fix` to apply this fix. - UP018.py:46:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | 44 | foo""") @@ -180,8 +166,6 @@ UP018.py:46:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) 48 48 | float() 49 49 | float(1.0) - Run `ruff check --fix` to apply this fix. - UP018.py:47:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | 45 | f"{str()}" @@ -202,8 +186,6 @@ UP018.py:47:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) 49 49 | float(1.0) 50 50 | bool() - Run `ruff check --fix` to apply this fix. - UP018.py:48:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | 46 | int() @@ -224,8 +206,6 @@ UP018.py:48:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) 50 50 | bool() 51 51 | bool(True) - Run `ruff check --fix` to apply this fix. - UP018.py:49:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | 47 | int(1) @@ -246,8 +226,6 @@ UP018.py:49:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) 51 51 | bool(True) 52 52 | bool(False) - Run `ruff check --fix` to apply this fix. - UP018.py:50:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) | 48 | float() @@ -268,8 +246,6 @@ UP018.py:50:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) 52 52 | bool(False) 53 53 | - Run `ruff check --fix` to apply this fix. - UP018.py:51:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) | 49 | float(1.0) @@ -289,8 +265,6 @@ UP018.py:51:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) 53 53 | 54 54 | # These become a literal but retain parentheses - Run `ruff check --fix` to apply this fix. - UP018.py:52:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) | 50 | bool() @@ -311,8 +285,6 @@ UP018.py:52:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) 54 54 | # These become a literal but retain parentheses 55 55 | int(1).denominator - Run `ruff check --fix` to apply this fix. - UP018.py:55:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | 54 | # These become a literal but retain parentheses @@ -332,8 +304,6 @@ UP018.py:55:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) 57 57 | # These too are literals in spirit 58 58 | int(+1) - Run `ruff check --fix` to apply this fix. - UP018.py:58:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | 57 | # These too are literals in spirit @@ -353,8 +323,6 @@ UP018.py:58:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) 60 60 | float(+1.0) 61 61 | float(-1.0) - Run `ruff check --fix` to apply this fix. - UP018.py:59:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | 57 | # These too are literals in spirit @@ -374,8 +342,6 @@ UP018.py:59:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) 60 60 | float(+1.0) 61 61 | float(-1.0) - Run `ruff check --fix` to apply this fix. - UP018.py:60:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | 58 | int(+1) @@ -393,8 +359,6 @@ UP018.py:60:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) 60 |++1.0 61 61 | float(-1.0) - Run `ruff check --fix` to apply this fix. - UP018.py:61:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | 59 | int(-1) @@ -409,5 +373,3 @@ UP018.py:61:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) 60 60 | float(+1.0) 61 |-float(-1.0) 61 |+-1.0 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP019.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP019.py.snap index 99970f9592f58..bd4fc7d87b6b0 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP019.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP019.py.snap @@ -18,8 +18,6 @@ UP019.py:7:22: UP019 [*] `typing.Text` is deprecated, use `str` 9 9 | 10 10 | - Run `ruff check --fix` to apply this fix. - UP019.py:11:29: UP019 [*] `typing.Text` is deprecated, use `str` | 11 | def print_second_word(word: typing.Text) -> None: @@ -37,8 +35,6 @@ UP019.py:11:29: UP019 [*] `typing.Text` is deprecated, use `str` 13 13 | 14 14 | - Run `ruff check --fix` to apply this fix. - UP019.py:15:28: UP019 [*] `typing.Text` is deprecated, use `str` | 15 | def print_third_word(word: Hello.Text) -> None: @@ -56,8 +52,6 @@ UP019.py:15:28: UP019 [*] `typing.Text` is deprecated, use `str` 17 17 | 18 18 | - Run `ruff check --fix` to apply this fix. - UP019.py:19:29: UP019 [*] `typing.Text` is deprecated, use `str` | 19 | def print_fourth_word(word: Goodbye) -> None: @@ -72,5 +66,3 @@ UP019.py:19:29: UP019 [*] `typing.Text` is deprecated, use `str` 19 |-def print_fourth_word(word: Goodbye) -> None: 19 |+def print_fourth_word(word: str) -> None: 20 20 | print(word) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap index 880c86d833c98..99fc67ea00f9a 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap @@ -19,8 +19,6 @@ UP020.py:3:6: UP020 [*] Use builtin `open` 5 5 | 6 6 | from io import open - Run `ruff check --fix` to apply this fix. - UP020.py:8:6: UP020 [*] Use builtin `open` | 6 | from io import open @@ -39,5 +37,3 @@ UP020.py:8:6: UP020 [*] Use builtin `open` 8 |-with open("f.txt") as f: 9 |+with builtins.open("f.txt") as f: 9 10 | print(f.read()) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap index 8e3b8d5a621ef..5de07ac3c6be4 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap @@ -20,8 +20,6 @@ UP021.py:5:25: UP021 [*] `universal_newlines` is deprecated, use `text` 7 7 | run(["foo"], universal_newlines=True, check=False) 8 8 | - Run `ruff check --fix` to apply this fix. - UP021.py:6:25: UP021 [*] `universal_newlines` is deprecated, use `text` | 4 | # Errors @@ -41,8 +39,6 @@ UP021.py:6:25: UP021 [*] `universal_newlines` is deprecated, use `text` 8 8 | 9 9 | # OK - Run `ruff check --fix` to apply this fix. - UP021.py:7:14: UP021 [*] `universal_newlines` is deprecated, use `text` | 5 | subprocess.run(["foo"], universal_newlines=True, check=True) @@ -62,5 +58,3 @@ UP021.py:7:14: UP021 [*] `universal_newlines` is deprecated, use `text` 8 8 | 9 9 | # OK 10 10 | subprocess.run(["foo"], check=True) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap index 7b157918060f8..6137c8fb34cf2 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap @@ -17,8 +17,6 @@ UP023.py:2:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 4 4 | 5 5 | # Weird spacing should not cause issues. - Run `ruff check --fix` to apply this fix. - UP023.py:3:8: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 1 | # These two imports have something after cElementTree, so they should be fixed. @@ -38,8 +36,6 @@ UP023.py:3:8: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 5 5 | # Weird spacing should not cause issues. 6 6 | from xml.etree.cElementTree import XML - Run `ruff check --fix` to apply this fix. - UP023.py:6:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 5 | # Weird spacing should not cause issues. @@ -58,8 +54,6 @@ UP023.py:6:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 8 8 | 9 9 | # Multi line imports should also work fine. - Run `ruff check --fix` to apply this fix. - UP023.py:7:11: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 5 | # Weird spacing should not cause issues. @@ -80,8 +74,6 @@ UP023.py:7:11: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 9 9 | # Multi line imports should also work fine. 10 10 | from xml.etree.cElementTree import ( - Run `ruff check --fix` to apply this fix. - UP023.py:10:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 9 | # Multi line imports should also work fine. @@ -105,8 +97,6 @@ UP023.py:10:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 12 12 | Element, 13 13 | SubElement, - Run `ruff check --fix` to apply this fix. - UP023.py:16:12: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 14 | ) @@ -126,8 +116,6 @@ UP023.py:16:12: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 18 18 | 19 19 | from xml.etree import cElementTree as ET - Run `ruff check --fix` to apply this fix. - UP023.py:17:27: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 15 | if True: @@ -148,8 +136,6 @@ UP023.py:17:27: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 19 19 | from xml.etree import cElementTree as ET 20 20 | - Run `ruff check --fix` to apply this fix. - UP023.py:19:23: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 17 | from xml.etree import cElementTree as CET @@ -170,8 +156,6 @@ UP023.py:19:23: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 21 21 | import contextlib, xml.etree.cElementTree as ET 22 22 | - Run `ruff check --fix` to apply this fix. - UP023.py:21:20: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 19 | from xml.etree import cElementTree as ET @@ -192,8 +176,6 @@ UP023.py:21:20: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 23 23 | # This should fix the second, but not the first invocation. 24 24 | import xml.etree.cElementTree, xml.etree.cElementTree as ET - Run `ruff check --fix` to apply this fix. - UP023.py:24:32: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 23 | # This should fix the second, but not the first invocation. @@ -212,5 +194,3 @@ UP023.py:24:32: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 25 25 | 26 26 | # The below items should NOT be changed. 27 27 | import xml.etree.cElementTree - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_0.py.snap index 2406846f3abe2..806b40ae822be 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_0.py.snap @@ -20,8 +20,6 @@ UP024_0.py:6:8: UP024 [*] Replace aliased errors with `OSError` 8 8 | 9 9 | try: - Run `ruff check --fix` to apply this fix. - UP024_0.py:11:8: UP024 [*] Replace aliased errors with `OSError` | 9 | try: @@ -41,8 +39,6 @@ UP024_0.py:11:8: UP024 [*] Replace aliased errors with `OSError` 13 13 | 14 14 | try: - Run `ruff check --fix` to apply this fix. - UP024_0.py:16:8: UP024 [*] Replace aliased errors with `OSError` | 14 | try: @@ -62,8 +58,6 @@ UP024_0.py:16:8: UP024 [*] Replace aliased errors with `OSError` 18 18 | 19 19 | try: - Run `ruff check --fix` to apply this fix. - UP024_0.py:21:8: UP024 [*] Replace aliased errors with `OSError` | 19 | try: @@ -83,8 +77,6 @@ UP024_0.py:21:8: UP024 [*] Replace aliased errors with `OSError` 23 23 | 24 24 | try: - Run `ruff check --fix` to apply this fix. - UP024_0.py:26:8: UP024 [*] Replace aliased errors with `OSError` | 24 | try: @@ -104,8 +96,6 @@ UP024_0.py:26:8: UP024 [*] Replace aliased errors with `OSError` 28 28 | 29 29 | try: - Run `ruff check --fix` to apply this fix. - UP024_0.py:31:8: UP024 [*] Replace aliased errors with `OSError` | 29 | try: @@ -125,8 +115,6 @@ UP024_0.py:31:8: UP024 [*] Replace aliased errors with `OSError` 33 33 | 34 34 | try: - Run `ruff check --fix` to apply this fix. - UP024_0.py:36:8: UP024 [*] Replace aliased errors with `OSError` | 34 | try: @@ -146,8 +134,6 @@ UP024_0.py:36:8: UP024 [*] Replace aliased errors with `OSError` 38 38 | 39 39 | # Should NOT be in parentheses when replaced - Run `ruff check --fix` to apply this fix. - UP024_0.py:43:8: UP024 [*] Replace aliased errors with `OSError` | 41 | try: @@ -168,8 +154,6 @@ UP024_0.py:43:8: UP024 [*] Replace aliased errors with `OSError` 45 45 | try: 46 46 | pass - Run `ruff check --fix` to apply this fix. - UP024_0.py:47:8: UP024 [*] Replace aliased errors with `OSError` | 45 | try: @@ -190,8 +174,6 @@ UP024_0.py:47:8: UP024 [*] Replace aliased errors with `OSError` 49 49 | try: 50 50 | pass - Run `ruff check --fix` to apply this fix. - UP024_0.py:51:8: UP024 [*] Replace aliased errors with `OSError` | 49 | try: @@ -211,8 +193,6 @@ UP024_0.py:51:8: UP024 [*] Replace aliased errors with `OSError` 53 53 | 54 54 | # Should be kept in parentheses (because multiple) - Run `ruff check --fix` to apply this fix. - UP024_0.py:58:8: UP024 [*] Replace aliased errors with `OSError` | 56 | try: @@ -232,8 +212,6 @@ UP024_0.py:58:8: UP024 [*] Replace aliased errors with `OSError` 60 60 | 61 61 | # First should change, second should not - Run `ruff check --fix` to apply this fix. - UP024_0.py:65:8: UP024 [*] Replace aliased errors with `OSError` | 63 | try: @@ -254,8 +232,6 @@ UP024_0.py:65:8: UP024 [*] Replace aliased errors with `OSError` 67 67 | # These should not change 68 68 | - Run `ruff check --fix` to apply this fix. - UP024_0.py:87:8: UP024 [*] Replace aliased errors with `OSError` | 85 | try: @@ -275,8 +251,6 @@ UP024_0.py:87:8: UP024 [*] Replace aliased errors with `OSError` 89 89 | 90 90 | try: - Run `ruff check --fix` to apply this fix. - UP024_0.py:105:11: UP024 [*] Replace aliased errors with `OSError` | 103 | try: @@ -296,8 +270,6 @@ UP024_0.py:105:11: UP024 [*] Replace aliased errors with `OSError` 107 107 | 108 108 | - Run `ruff check --fix` to apply this fix. - UP024_0.py:114:8: UP024 [*] Replace aliased errors with `OSError` | 112 | try: @@ -314,5 +286,3 @@ UP024_0.py:114:8: UP024 [*] Replace aliased errors with `OSError` 114 |-except os.error: 114 |+except OSError: 115 115 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_1.py.snap index 7c00ffe350748..30ff808e5960f 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_1.py.snap @@ -21,8 +21,6 @@ UP024_1.py:5:8: UP024 [*] Replace aliased errors with `OSError` 7 7 | except (OSError, socket.error, KeyError): 8 8 | pass - Run `ruff check --fix` to apply this fix. - UP024_1.py:7:8: UP024 [*] Replace aliased errors with `OSError` | 5 | except (OSError, mmap.error, IOError): @@ -42,8 +40,6 @@ UP024_1.py:7:8: UP024 [*] Replace aliased errors with `OSError` 9 9 | 10 10 | try: - Run `ruff check --fix` to apply this fix. - UP024_1.py:12:8: UP024 [*] Replace aliased errors with `OSError` | 10 | try: @@ -69,5 +65,3 @@ UP024_1.py:12:8: UP024 [*] Replace aliased errors with `OSError` 16 |-): 12 |+except OSError: 17 13 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_2.py.snap index aaeee7b155b91..eb7cddf1044d8 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_2.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_2.py.snap @@ -21,8 +21,6 @@ UP024_2.py:10:7: UP024 [*] Replace aliased errors with `OSError` 12 12 | raise select.error 13 13 | - Run `ruff check --fix` to apply this fix. - UP024_2.py:11:7: UP024 [*] Replace aliased errors with `OSError` | 9 | import socket, mmap, select @@ -42,8 +40,6 @@ UP024_2.py:11:7: UP024 [*] Replace aliased errors with `OSError` 13 13 | 14 14 | raise socket.error() - Run `ruff check --fix` to apply this fix. - UP024_2.py:12:7: UP024 [*] Replace aliased errors with `OSError` | 10 | raise socket.error @@ -64,8 +60,6 @@ UP024_2.py:12:7: UP024 [*] Replace aliased errors with `OSError` 14 14 | raise socket.error() 15 15 | raise mmap.error(1) - Run `ruff check --fix` to apply this fix. - UP024_2.py:14:7: UP024 [*] Replace aliased errors with `OSError` | 12 | raise select.error @@ -86,8 +80,6 @@ UP024_2.py:14:7: UP024 [*] Replace aliased errors with `OSError` 16 16 | raise select.error(1, 2) 17 17 | - Run `ruff check --fix` to apply this fix. - UP024_2.py:15:7: UP024 [*] Replace aliased errors with `OSError` | 14 | raise socket.error() @@ -106,8 +98,6 @@ UP024_2.py:15:7: UP024 [*] Replace aliased errors with `OSError` 17 17 | 18 18 | raise socket.error( - Run `ruff check --fix` to apply this fix. - UP024_2.py:16:7: UP024 [*] Replace aliased errors with `OSError` | 14 | raise socket.error() @@ -128,8 +118,6 @@ UP024_2.py:16:7: UP024 [*] Replace aliased errors with `OSError` 18 18 | raise socket.error( 19 19 | 1, - Run `ruff check --fix` to apply this fix. - UP024_2.py:18:7: UP024 [*] Replace aliased errors with `OSError` | 16 | raise select.error(1, 2) @@ -150,8 +138,6 @@ UP024_2.py:18:7: UP024 [*] Replace aliased errors with `OSError` 20 20 | 2, 21 21 | 3, - Run `ruff check --fix` to apply this fix. - UP024_2.py:25:7: UP024 [*] Replace aliased errors with `OSError` | 24 | from mmap import error @@ -171,8 +157,6 @@ UP024_2.py:25:7: UP024 [*] Replace aliased errors with `OSError` 27 27 | from socket import error 28 28 | raise error(1) - Run `ruff check --fix` to apply this fix. - UP024_2.py:28:7: UP024 [*] Replace aliased errors with `OSError` | 27 | from socket import error @@ -192,8 +176,6 @@ UP024_2.py:28:7: UP024 [*] Replace aliased errors with `OSError` 30 30 | from select import error 31 31 | raise error(1, 2) - Run `ruff check --fix` to apply this fix. - UP024_2.py:31:7: UP024 [*] Replace aliased errors with `OSError` | 30 | from select import error @@ -213,8 +195,6 @@ UP024_2.py:31:7: UP024 [*] Replace aliased errors with `OSError` 33 33 | # Testing the names 34 34 | raise EnvironmentError - Run `ruff check --fix` to apply this fix. - UP024_2.py:34:7: UP024 [*] Replace aliased errors with `OSError` | 33 | # Testing the names @@ -234,8 +214,6 @@ UP024_2.py:34:7: UP024 [*] Replace aliased errors with `OSError` 36 36 | raise WindowsError 37 37 | - Run `ruff check --fix` to apply this fix. - UP024_2.py:35:7: UP024 [*] Replace aliased errors with `OSError` | 33 | # Testing the names @@ -255,8 +233,6 @@ UP024_2.py:35:7: UP024 [*] Replace aliased errors with `OSError` 37 37 | 38 38 | raise EnvironmentError() - Run `ruff check --fix` to apply this fix. - UP024_2.py:36:7: UP024 [*] Replace aliased errors with `OSError` | 34 | raise EnvironmentError @@ -277,8 +253,6 @@ UP024_2.py:36:7: UP024 [*] Replace aliased errors with `OSError` 38 38 | raise EnvironmentError() 39 39 | raise IOError(1) - Run `ruff check --fix` to apply this fix. - UP024_2.py:38:7: UP024 [*] Replace aliased errors with `OSError` | 36 | raise WindowsError @@ -299,8 +273,6 @@ UP024_2.py:38:7: UP024 [*] Replace aliased errors with `OSError` 40 40 | raise WindowsError(1, 2) 41 41 | - Run `ruff check --fix` to apply this fix. - UP024_2.py:39:7: UP024 [*] Replace aliased errors with `OSError` | 38 | raise EnvironmentError() @@ -319,8 +291,6 @@ UP024_2.py:39:7: UP024 [*] Replace aliased errors with `OSError` 41 41 | 42 42 | raise EnvironmentError( - Run `ruff check --fix` to apply this fix. - UP024_2.py:40:7: UP024 [*] Replace aliased errors with `OSError` | 38 | raise EnvironmentError() @@ -341,8 +311,6 @@ UP024_2.py:40:7: UP024 [*] Replace aliased errors with `OSError` 42 42 | raise EnvironmentError( 43 43 | 1, - Run `ruff check --fix` to apply this fix. - UP024_2.py:42:7: UP024 [*] Replace aliased errors with `OSError` | 40 | raise WindowsError(1, 2) @@ -363,8 +331,6 @@ UP024_2.py:42:7: UP024 [*] Replace aliased errors with `OSError` 44 44 | 2, 45 45 | 3, - Run `ruff check --fix` to apply this fix. - UP024_2.py:48:7: UP024 [*] Replace aliased errors with `OSError` | 46 | ) @@ -384,8 +350,6 @@ UP024_2.py:48:7: UP024 [*] Replace aliased errors with `OSError` 49 49 | raise EnvironmentError(1) 50 50 | raise IOError(1, 2) - Run `ruff check --fix` to apply this fix. - UP024_2.py:49:7: UP024 [*] Replace aliased errors with `OSError` | 48 | raise WindowsError @@ -402,8 +366,6 @@ UP024_2.py:49:7: UP024 [*] Replace aliased errors with `OSError` 49 |+raise OSError(1) 50 50 | raise IOError(1, 2) - Run `ruff check --fix` to apply this fix. - UP024_2.py:50:7: UP024 [*] Replace aliased errors with `OSError` | 48 | raise WindowsError @@ -418,5 +380,3 @@ UP024_2.py:50:7: UP024 [*] Replace aliased errors with `OSError` 49 49 | raise EnvironmentError(1) 50 |-raise IOError(1, 2) 50 |+raise OSError(1, 2) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_4.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_4.py.snap index 865bfe0939cd9..6abe55a0170d9 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_4.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP024_4.py.snap @@ -17,5 +17,3 @@ UP024_4.py:9:8: UP024 [*] Replace aliased errors with `OSError` 9 |-except (socket.error, exceptions.OperationalError): 9 |+except (OSError, exceptions.OperationalError): 10 10 | return HttpResponseServerError("cache: cannot connect to broker.") - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP025.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP025.py.snap index 4c77e2cf70d79..755dfb9156f87 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP025.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP025.py.snap @@ -16,8 +16,6 @@ UP025.py:1:1: UP025 [*] Remove unicode literals from strings 3 3 | x = u"Hello" # UP025 4 4 | - Run `ruff check --fix` to apply this fix. - UP025.py:3:5: UP025 [*] Remove unicode literals from strings | 1 | u"Hello" @@ -37,8 +35,6 @@ UP025.py:3:5: UP025 [*] Remove unicode literals from strings 5 5 | u'world' # UP025 6 6 | - Run `ruff check --fix` to apply this fix. - UP025.py:5:1: UP025 [*] Remove unicode literals from strings | 3 | x = u"Hello" # UP025 @@ -59,8 +55,6 @@ UP025.py:5:1: UP025 [*] Remove unicode literals from strings 7 7 | print(u"Hello") # UP025 8 8 | - Run `ruff check --fix` to apply this fix. - UP025.py:7:7: UP025 [*] Remove unicode literals from strings | 5 | u'world' # UP025 @@ -81,8 +75,6 @@ UP025.py:7:7: UP025 [*] Remove unicode literals from strings 9 9 | print(u'world') # UP025 10 10 | - Run `ruff check --fix` to apply this fix. - UP025.py:9:7: UP025 [*] Remove unicode literals from strings | 7 | print(u"Hello") # UP025 @@ -103,8 +95,6 @@ UP025.py:9:7: UP025 [*] Remove unicode literals from strings 11 11 | import foo 12 12 | - Run `ruff check --fix` to apply this fix. - UP025.py:13:5: UP025 [*] Remove unicode literals from strings | 11 | import foo @@ -125,8 +115,6 @@ UP025.py:13:5: UP025 [*] Remove unicode literals from strings 15 15 | # Retain quotes when fixing. 16 16 | x = u'hello' # UP025 - Run `ruff check --fix` to apply this fix. - UP025.py:13:15: UP025 [*] Remove unicode literals from strings | 11 | import foo @@ -147,8 +135,6 @@ UP025.py:13:15: UP025 [*] Remove unicode literals from strings 15 15 | # Retain quotes when fixing. 16 16 | x = u'hello' # UP025 - Run `ruff check --fix` to apply this fix. - UP025.py:13:27: UP025 [*] Remove unicode literals from strings | 11 | import foo @@ -169,8 +155,6 @@ UP025.py:13:27: UP025 [*] Remove unicode literals from strings 15 15 | # Retain quotes when fixing. 16 16 | x = u'hello' # UP025 - Run `ruff check --fix` to apply this fix. - UP025.py:13:39: UP025 [*] Remove unicode literals from strings | 11 | import foo @@ -191,8 +175,6 @@ UP025.py:13:39: UP025 [*] Remove unicode literals from strings 15 15 | # Retain quotes when fixing. 16 16 | x = u'hello' # UP025 - Run `ruff check --fix` to apply this fix. - UP025.py:16:5: UP025 [*] Remove unicode literals from strings | 15 | # Retain quotes when fixing. @@ -212,8 +194,6 @@ UP025.py:16:5: UP025 [*] Remove unicode literals from strings 18 18 | x = u'''hello''' # UP025 19 19 | x = u'Hello "World"' # UP025 - Run `ruff check --fix` to apply this fix. - UP025.py:17:5: UP025 [*] Remove unicode literals from strings | 15 | # Retain quotes when fixing. @@ -234,8 +214,6 @@ UP025.py:17:5: UP025 [*] Remove unicode literals from strings 19 19 | x = u'Hello "World"' # UP025 20 20 | - Run `ruff check --fix` to apply this fix. - UP025.py:18:5: UP025 [*] Remove unicode literals from strings | 16 | x = u'hello' # UP025 @@ -255,8 +233,6 @@ UP025.py:18:5: UP025 [*] Remove unicode literals from strings 20 20 | 21 21 | u = "Hello" # OK - Run `ruff check --fix` to apply this fix. - UP025.py:19:5: UP025 [*] Remove unicode literals from strings | 17 | x = u"""hello""" # UP025 @@ -277,8 +253,6 @@ UP025.py:19:5: UP025 [*] Remove unicode literals from strings 21 21 | u = "Hello" # OK 22 22 | u = u # OK - Run `ruff check --fix` to apply this fix. - UP025.py:27:7: UP025 [*] Remove unicode literals from strings | 25 | return"Hello" # OK @@ -296,8 +270,6 @@ UP025.py:27:7: UP025 [*] Remove unicode literals from strings 27 |+f"foo""bar" # OK 28 28 | f"foo" u"bar" # OK - Run `ruff check --fix` to apply this fix. - UP025.py:28:8: UP025 [*] Remove unicode literals from strings | 27 | f"foo"u"bar" # OK @@ -311,5 +283,3 @@ UP025.py:28:8: UP025 [*] Remove unicode literals from strings 27 27 | f"foo"u"bar" # OK 28 |-f"foo" u"bar" # OK 28 |+f"foo" "bar" # OK - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap index 1f1fd515e907a..d1b41cb4d0149 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap @@ -20,8 +20,6 @@ UP026.py:3:12: UP026 [*] `mock` is deprecated, use `unittest.mock` 5 5 | # Error (`from unittest import mock`) 6 6 | if True: - Run `ruff check --fix` to apply this fix. - UP026.py:7:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | 5 | # Error (`from unittest import mock`) @@ -43,8 +41,6 @@ UP026.py:7:12: UP026 [*] `mock` is deprecated, use `unittest.mock` 9 10 | # Error (`from unittest.mock import *`) 10 11 | if True: - Run `ruff check --fix` to apply this fix. - UP026.py:11:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | 9 | # Error (`from unittest.mock import *`) @@ -65,8 +61,6 @@ UP026.py:11:5: UP026 [*] `mock` is deprecated, use `unittest.mock` 13 13 | # Error (`from unittest import mock`) 14 14 | import mock.mock - Run `ruff check --fix` to apply this fix. - UP026.py:14:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | 13 | # Error (`from unittest import mock`) @@ -86,8 +80,6 @@ UP026.py:14:8: UP026 [*] `mock` is deprecated, use `unittest.mock` 16 16 | # Error (`from unittest import mock`) 17 17 | import contextlib, mock, sys - Run `ruff check --fix` to apply this fix. - UP026.py:17:20: UP026 [*] `mock` is deprecated, use `unittest.mock` | 16 | # Error (`from unittest import mock`) @@ -108,8 +100,6 @@ UP026.py:17:20: UP026 [*] `mock` is deprecated, use `unittest.mock` 19 20 | # Error (`from unittest import mock`) 20 21 | import mock, sys - Run `ruff check --fix` to apply this fix. - UP026.py:20:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | 19 | # Error (`from unittest import mock`) @@ -129,8 +119,6 @@ UP026.py:20:8: UP026 [*] `mock` is deprecated, use `unittest.mock` 22 23 | 23 24 | # Error (`from unittest import mock`) - Run `ruff check --fix` to apply this fix. - UP026.py:24:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 23 | # Error (`from unittest import mock`) @@ -150,8 +138,6 @@ UP026.py:24:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 26 26 | # Error (keep trailing comma) 27 27 | from mock import ( - Run `ruff check --fix` to apply this fix. - UP026.py:27:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 26 | # Error (keep trailing comma) @@ -182,8 +168,6 @@ UP026.py:27:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 34 34 | a, 35 35 | b, - Run `ruff check --fix` to apply this fix. - UP026.py:33:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 31 | c, @@ -215,8 +199,6 @@ UP026.py:33:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 40 40 | # Error (avoid trailing comma) 41 41 | from mock import ( - Run `ruff check --fix` to apply this fix. - UP026.py:41:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 40 | # Error (avoid trailing comma) @@ -247,8 +229,6 @@ UP026.py:41:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 48 48 | a, 49 49 | b, - Run `ruff check --fix` to apply this fix. - UP026.py:47:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 45 | c @@ -281,8 +261,6 @@ UP026.py:47:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 54 54 | from mock import a, b, c, mock 55 55 | - Run `ruff check --fix` to apply this fix. - UP026.py:53:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 51 | mock @@ -303,8 +281,6 @@ UP026.py:53:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 55 56 | 56 57 | if True: - Run `ruff check --fix` to apply this fix. - UP026.py:54:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 52 | ) @@ -326,8 +302,6 @@ UP026.py:54:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 56 57 | if True: 57 58 | if False: - Run `ruff check --fix` to apply this fix. - UP026.py:58:9: UP026 [*] `mock` is deprecated, use `unittest.mock` | 56 | if True: @@ -360,8 +334,6 @@ UP026.py:58:9: UP026 [*] `mock` is deprecated, use `unittest.mock` 65 65 | # OK 66 66 | import os, io - Run `ruff check --fix` to apply this fix. - UP026.py:69:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | 68 | # Error (`from unittest import mock`) @@ -382,8 +354,6 @@ UP026.py:69:8: UP026 [*] `mock` is deprecated, use `unittest.mock` 71 72 | # Error (`from unittest import mock as foo`) 72 73 | import mock as foo - Run `ruff check --fix` to apply this fix. - UP026.py:69:14: UP026 [*] `mock` is deprecated, use `unittest.mock` | 68 | # Error (`from unittest import mock`) @@ -404,8 +374,6 @@ UP026.py:69:14: UP026 [*] `mock` is deprecated, use `unittest.mock` 71 72 | # Error (`from unittest import mock as foo`) 72 73 | import mock as foo - Run `ruff check --fix` to apply this fix. - UP026.py:72:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | 71 | # Error (`from unittest import mock as foo`) @@ -425,8 +393,6 @@ UP026.py:72:8: UP026 [*] `mock` is deprecated, use `unittest.mock` 74 74 | # Error (`from unittest import mock as foo`) 75 75 | from mock import mock as foo - Run `ruff check --fix` to apply this fix. - UP026.py:75:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 74 | # Error (`from unittest import mock as foo`) @@ -446,8 +412,6 @@ UP026.py:75:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 77 77 | if True: 78 78 | # This should yield multiple, aliased imports. - Run `ruff check --fix` to apply this fix. - UP026.py:79:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | 77 | if True: @@ -470,8 +434,6 @@ UP026.py:79:12: UP026 [*] `mock` is deprecated, use `unittest.mock` 81 83 | # This should yield multiple, aliased imports, and preserve `os`. 82 84 | import mock as foo, mock as bar, mock, os - Run `ruff check --fix` to apply this fix. - UP026.py:79:25: UP026 [*] `mock` is deprecated, use `unittest.mock` | 77 | if True: @@ -494,8 +456,6 @@ UP026.py:79:25: UP026 [*] `mock` is deprecated, use `unittest.mock` 81 83 | # This should yield multiple, aliased imports, and preserve `os`. 82 84 | import mock as foo, mock as bar, mock, os - Run `ruff check --fix` to apply this fix. - UP026.py:79:38: UP026 [*] `mock` is deprecated, use `unittest.mock` | 77 | if True: @@ -518,8 +478,6 @@ UP026.py:79:38: UP026 [*] `mock` is deprecated, use `unittest.mock` 81 83 | # This should yield multiple, aliased imports, and preserve `os`. 82 84 | import mock as foo, mock as bar, mock, os - Run `ruff check --fix` to apply this fix. - UP026.py:82:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | 81 | # This should yield multiple, aliased imports, and preserve `os`. @@ -542,8 +500,6 @@ UP026.py:82:12: UP026 [*] `mock` is deprecated, use `unittest.mock` 84 87 | if True: 85 88 | # This should yield multiple, aliased imports. - Run `ruff check --fix` to apply this fix. - UP026.py:82:25: UP026 [*] `mock` is deprecated, use `unittest.mock` | 81 | # This should yield multiple, aliased imports, and preserve `os`. @@ -566,8 +522,6 @@ UP026.py:82:25: UP026 [*] `mock` is deprecated, use `unittest.mock` 84 87 | if True: 85 88 | # This should yield multiple, aliased imports. - Run `ruff check --fix` to apply this fix. - UP026.py:82:38: UP026 [*] `mock` is deprecated, use `unittest.mock` | 81 | # This should yield multiple, aliased imports, and preserve `os`. @@ -590,8 +544,6 @@ UP026.py:82:38: UP026 [*] `mock` is deprecated, use `unittest.mock` 84 87 | if True: 85 88 | # This should yield multiple, aliased imports. - Run `ruff check --fix` to apply this fix. - UP026.py:86:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | 84 | if True: @@ -612,8 +564,6 @@ UP026.py:86:5: UP026 [*] `mock` is deprecated, use `unittest.mock` 88 90 | 89 91 | # OK. - Run `ruff check --fix` to apply this fix. - UP026.py:93:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | 92 | # Error (`mock.Mock()`). @@ -627,5 +577,3 @@ UP026.py:93:5: UP026 [*] `mock` is deprecated, use `unittest.mock` 92 92 | # Error (`mock.Mock()`). 93 |-x = mock.mock.Mock() 93 |+x = mock.Mock() - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap index 955a990f9b26c..49eff2ccedca9 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap @@ -18,8 +18,6 @@ UP027.py:2:17: UP027 [*] Replace unpacked list comprehension with a generator ex 4 4 | foo, bar, baz =[fn(x) for x in items] 5 5 | - Run `ruff check --fix` to apply this fix. - UP027.py:4:16: UP027 [*] Replace unpacked list comprehension with a generator expression | 2 | foo, bar, baz = [fn(x) for x in items] @@ -40,8 +38,6 @@ UP027.py:4:16: UP027 [*] Replace unpacked list comprehension with a generator ex 6 6 | foo, bar, baz = [fn(x) for x in items] 7 7 | - Run `ruff check --fix` to apply this fix. - UP027.py:6:26: UP027 [*] Replace unpacked list comprehension with a generator expression | 4 | foo, bar, baz =[fn(x) for x in items] @@ -62,8 +58,6 @@ UP027.py:6:26: UP027 [*] Replace unpacked list comprehension with a generator ex 8 8 | foo, bar, baz = [[i for i in fn(x)] for x in items] 9 9 | - Run `ruff check --fix` to apply this fix. - UP027.py:8:17: UP027 [*] Replace unpacked list comprehension with a generator expression | 6 | foo, bar, baz = [fn(x) for x in items] @@ -84,8 +78,6 @@ UP027.py:8:17: UP027 [*] Replace unpacked list comprehension with a generator ex 10 10 | foo, bar, baz = [ 11 11 | fn(x) - Run `ruff check --fix` to apply this fix. - UP027.py:10:17: UP027 [*] Replace unpacked list comprehension with a generator expression | 8 | foo, bar, baz = [[i for i in fn(x)] for x in items] @@ -113,5 +105,3 @@ UP027.py:10:17: UP027 [*] Replace unpacked list comprehension with a generator e 14 14 | 15 15 | # Should not change 16 16 | foo = [fn(x) for x in items] - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap index 52c2c315e8b35..68fb19eeae28b 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap @@ -21,8 +21,6 @@ UP032_0.py:5:1: UP032 [*] Use f-string instead of `format` call 7 7 | "{1} {0}".format(a, b) 8 8 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:7:1: UP032 [*] Use f-string instead of `format` call | 5 | "{} {}".format(a, b) @@ -43,8 +41,6 @@ UP032_0.py:7:1: UP032 [*] Use f-string instead of `format` call 9 9 | "{0} {1} {0}".format(a, b) 10 10 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:9:1: UP032 [*] Use f-string instead of `format` call | 7 | "{1} {0}".format(a, b) @@ -65,8 +61,6 @@ UP032_0.py:9:1: UP032 [*] Use f-string instead of `format` call 11 11 | "{x.y}".format(x=z) 12 12 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:11:1: UP032 [*] Use f-string instead of `format` call | 9 | "{0} {1} {0}".format(a, b) @@ -87,8 +81,6 @@ UP032_0.py:11:1: UP032 [*] Use f-string instead of `format` call 13 13 | "{x} {y} {x}".format(x=a, y=b) 14 14 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:13:1: UP032 [*] Use f-string instead of `format` call | 11 | "{x.y}".format(x=z) @@ -109,8 +101,6 @@ UP032_0.py:13:1: UP032 [*] Use f-string instead of `format` call 15 15 | "{.x} {.y}".format(a, b) 16 16 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:15:1: UP032 [*] Use f-string instead of `format` call | 13 | "{x} {y} {x}".format(x=a, y=b) @@ -131,8 +121,6 @@ UP032_0.py:15:1: UP032 [*] Use f-string instead of `format` call 17 17 | "{} {}".format(a.b, c.d) 18 18 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:17:1: UP032 [*] Use f-string instead of `format` call | 15 | "{.x} {.y}".format(a, b) @@ -153,8 +141,6 @@ UP032_0.py:17:1: UP032 [*] Use f-string instead of `format` call 19 19 | "{}".format(a()) 20 20 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:19:1: UP032 [*] Use f-string instead of `format` call | 17 | "{} {}".format(a.b, c.d) @@ -175,8 +161,6 @@ UP032_0.py:19:1: UP032 [*] Use f-string instead of `format` call 21 21 | "{}".format(a.b()) 22 22 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:21:1: UP032 [*] Use f-string instead of `format` call | 19 | "{}".format(a()) @@ -197,8 +181,6 @@ UP032_0.py:21:1: UP032 [*] Use f-string instead of `format` call 23 23 | "{}".format(a.b().c()) 24 24 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:23:1: UP032 [*] Use f-string instead of `format` call | 21 | "{}".format(a.b()) @@ -219,8 +201,6 @@ UP032_0.py:23:1: UP032 [*] Use f-string instead of `format` call 25 25 | "hello {}!".format(name) 26 26 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:25:1: UP032 [*] Use f-string instead of `format` call | 23 | "{}".format(a.b().c()) @@ -241,8 +221,6 @@ UP032_0.py:25:1: UP032 [*] Use f-string instead of `format` call 27 27 | "{}{b}{}".format(a, c, b=b) 28 28 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:27:1: UP032 [*] Use f-string instead of `format` call | 25 | "hello {}!".format(name) @@ -263,8 +241,6 @@ UP032_0.py:27:1: UP032 [*] Use f-string instead of `format` call 29 29 | "{}".format(0x0) 30 30 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:29:1: UP032 [*] Use f-string instead of `format` call | 27 | "{}{b}{}".format(a, c, b=b) @@ -285,8 +261,6 @@ UP032_0.py:29:1: UP032 [*] Use f-string instead of `format` call 31 31 | "{} {}".format(a, b) 32 32 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:31:1: UP032 [*] Use f-string instead of `format` call | 29 | "{}".format(0x0) @@ -307,8 +281,6 @@ UP032_0.py:31:1: UP032 [*] Use f-string instead of `format` call 33 33 | """{} {}""".format(a, b) 34 34 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:33:1: UP032 [*] Use f-string instead of `format` call | 31 | "{} {}".format(a, b) @@ -329,8 +301,6 @@ UP032_0.py:33:1: UP032 [*] Use f-string instead of `format` call 35 35 | "foo{}".format(1) 36 36 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:35:1: UP032 [*] Use f-string instead of `format` call | 33 | """{} {}""".format(a, b) @@ -351,8 +321,6 @@ UP032_0.py:35:1: UP032 [*] Use f-string instead of `format` call 37 37 | r"foo{}".format(1) 38 38 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:37:1: UP032 [*] Use f-string instead of `format` call | 35 | "foo{}".format(1) @@ -373,8 +341,6 @@ UP032_0.py:37:1: UP032 [*] Use f-string instead of `format` call 39 39 | x = "{a}".format(a=1) 40 40 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:39:5: UP032 [*] Use f-string instead of `format` call | 37 | r"foo{}".format(1) @@ -395,8 +361,6 @@ UP032_0.py:39:5: UP032 [*] Use f-string instead of `format` call 41 41 | print("foo {} ".format(x)) 42 42 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:41:7: UP032 [*] Use f-string instead of `format` call | 39 | x = "{a}".format(a=1) @@ -417,8 +381,6 @@ UP032_0.py:41:7: UP032 [*] Use f-string instead of `format` call 43 43 | "{a[b]}".format(a=a) 44 44 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:43:1: UP032 [*] Use f-string instead of `format` call | 41 | print("foo {} ".format(x)) @@ -439,8 +401,6 @@ UP032_0.py:43:1: UP032 [*] Use f-string instead of `format` call 45 45 | "{a.a[b]}".format(a=a) 46 46 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:45:1: UP032 [*] Use f-string instead of `format` call | 43 | "{a[b]}".format(a=a) @@ -461,8 +421,6 @@ UP032_0.py:45:1: UP032 [*] Use f-string instead of `format` call 47 47 | "{}{{}}{}".format(escaped, y) 48 48 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:47:1: UP032 [*] Use f-string instead of `format` call | 45 | "{a.a[b]}".format(a=a) @@ -483,8 +441,6 @@ UP032_0.py:47:1: UP032 [*] Use f-string instead of `format` call 49 49 | "{}".format(a) 50 50 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:49:1: UP032 [*] Use f-string instead of `format` call | 47 | "{}{{}}{}".format(escaped, y) @@ -505,8 +461,6 @@ UP032_0.py:49:1: UP032 [*] Use f-string instead of `format` call 51 51 | '({}={{0!e}})'.format(a) 52 52 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:51:1: UP032 [*] Use f-string instead of `format` call | 49 | "{}".format(a) @@ -527,8 +481,6 @@ UP032_0.py:51:1: UP032 [*] Use f-string instead of `format` call 53 53 | "{[b]}".format(a) 54 54 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:53:1: UP032 [*] Use f-string instead of `format` call | 51 | '({}={{0!e}})'.format(a) @@ -549,8 +501,6 @@ UP032_0.py:53:1: UP032 [*] Use f-string instead of `format` call 55 55 | '{[b]}'.format(a) 56 56 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:55:1: UP032 [*] Use f-string instead of `format` call | 53 | "{[b]}".format(a) @@ -571,8 +521,6 @@ UP032_0.py:55:1: UP032 [*] Use f-string instead of `format` call 57 57 | """{[b]}""".format(a) 58 58 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:57:1: UP032 [*] Use f-string instead of `format` call | 55 | '{[b]}'.format(a) @@ -593,8 +541,6 @@ UP032_0.py:57:1: UP032 [*] Use f-string instead of `format` call 59 59 | '''{[b]}'''.format(a) 60 60 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:59:1: UP032 [*] Use f-string instead of `format` call | 57 | """{[b]}""".format(a) @@ -615,8 +561,6 @@ UP032_0.py:59:1: UP032 [*] Use f-string instead of `format` call 61 61 | "{}".format( 62 62 | 1 - Run `ruff check --fix` to apply this fix. - UP032_0.py:61:1: UP032 [*] Use f-string instead of `format` call | 59 | '''{[b]}'''.format(a) @@ -641,8 +585,6 @@ UP032_0.py:61:1: UP032 [*] Use f-string instead of `format` call 65 63 | "123456789 {}".format( 66 64 | 1111111111111111111111111111111111111111111111111111111111111111111111111, - Run `ruff check --fix` to apply this fix. - UP032_0.py:65:1: UP032 [*] Use f-string instead of `format` call | 63 | ) @@ -667,8 +609,6 @@ UP032_0.py:65:1: UP032 [*] Use f-string instead of `format` call 69 67 | """ 70 68 | {} - Run `ruff check --fix` to apply this fix. - UP032_0.py:69:1: UP032 [*] Use f-string instead of `format` call | 67 | ) @@ -694,8 +634,6 @@ UP032_0.py:69:1: UP032 [*] Use f-string instead of `format` call 73 73 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = """ 74 74 | {} - Run `ruff check --fix` to apply this fix. - UP032_0.py:73:85: UP032 [*] Use f-string instead of `format` call | 71 | """.format(1) @@ -727,8 +665,6 @@ UP032_0.py:73:85: UP032 [*] Use f-string instead of `format` call 79 77 | "{a}" "{b}".format(a=1, b=1) 80 78 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:79:1: UP032 [*] Use f-string instead of `format` call | 77 | ) @@ -749,8 +685,6 @@ UP032_0.py:79:1: UP032 [*] Use f-string instead of `format` call 81 81 | ( 82 82 | "{a}" - Run `ruff check --fix` to apply this fix. - UP032_0.py:81:1: UP032 [*] Use f-string instead of `format` call | 79 | "{a}" "{b}".format(a=1, b=1) @@ -778,8 +712,6 @@ UP032_0.py:81:1: UP032 [*] Use f-string instead of `format` call 86 86 | ( 87 87 | "{a}" - Run `ruff check --fix` to apply this fix. - UP032_0.py:86:1: UP032 [*] Use f-string instead of `format` call | 84 | ).format(a=1, b=1) @@ -811,8 +743,6 @@ UP032_0.py:86:1: UP032 [*] Use f-string instead of `format` call 93 91 | ( 94 92 | ( - Run `ruff check --fix` to apply this fix. - UP032_0.py:94:5: UP032 [*] Use f-string instead of `format` call | 93 | ( @@ -846,8 +776,6 @@ UP032_0.py:94:5: UP032 [*] Use f-string instead of `format` call 103 103 | 104 104 | ( - Run `ruff check --fix` to apply this fix. - UP032_0.py:104:1: UP032 [*] Use f-string instead of `format` call | 102 | ) @@ -872,8 +800,6 @@ UP032_0.py:104:1: UP032 [*] Use f-string instead of `format` call 109 109 | 110 110 | def d(osname, version, release): - Run `ruff check --fix` to apply this fix. - UP032_0.py:111:11: UP032 [*] Use f-string instead of `format` call | 110 | def d(osname, version, release): @@ -891,8 +817,6 @@ UP032_0.py:111:11: UP032 [*] Use f-string instead of `format` call 113 113 | 114 114 | def e(): - Run `ruff check --fix` to apply this fix. - UP032_0.py:115:10: UP032 [*] Use f-string instead of `format` call | 114 | def e(): @@ -910,8 +834,6 @@ UP032_0.py:115:10: UP032 [*] Use f-string instead of `format` call 117 117 | 118 118 | assert"{}".format(1) - Run `ruff check --fix` to apply this fix. - UP032_0.py:118:7: UP032 [*] Use f-string instead of `format` call | 118 | assert"{}".format(1) @@ -928,8 +850,6 @@ UP032_0.py:118:7: UP032 [*] Use f-string instead of `format` call 120 120 | 121 121 | async def c(): - Run `ruff check --fix` to apply this fix. - UP032_0.py:122:12: UP032 [*] Use f-string instead of `format` call | 121 | async def c(): @@ -947,8 +867,6 @@ UP032_0.py:122:12: UP032 [*] Use f-string instead of `format` call 124 124 | 125 125 | async def c(): - Run `ruff check --fix` to apply this fix. - UP032_0.py:126:12: UP032 [*] Use f-string instead of `format` call | 125 | async def c(): @@ -966,8 +884,6 @@ UP032_0.py:126:12: UP032 [*] Use f-string instead of `format` call 128 128 | 129 129 | "{}".format(1 * 2) - Run `ruff check --fix` to apply this fix. - UP032_0.py:129:1: UP032 [*] Use f-string instead of `format` call | 129 | "{}".format(1 * 2) @@ -986,8 +902,6 @@ UP032_0.py:129:1: UP032 [*] Use f-string instead of `format` call 131 131 | ### 132 132 | # Non-errors - Run `ruff check --fix` to apply this fix. - UP032_0.py:160:1: UP032 [*] Use f-string instead of `format` call | 158 | r'"\N{snowman} {}".format(a)' @@ -1012,8 +926,6 @@ UP032_0.py:160:1: UP032 [*] Use f-string instead of `format` call 164 162 | """ 165 163 | {} - Run `ruff check --fix` to apply this fix. - UP032_0.py:164:1: UP032 [*] Use f-string instead of `format` call | 162 | ) @@ -1053,8 +965,6 @@ UP032_0.py:164:1: UP032 [*] Use f-string instead of `format` call 174 170 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = """{} 175 171 | """.format( - Run `ruff check --fix` to apply this fix. - UP032_0.py:174:84: UP032 [*] Use f-string instead of `format` call | 172 | ) @@ -1083,8 +993,6 @@ UP032_0.py:174:84: UP032 [*] Use f-string instead of `format` call 179 177 | "{}".format( 180 178 | [ - Run `ruff check --fix` to apply this fix. - UP032_0.py:202:1: UP032 Use f-string instead of `format` call | 200 | "{}".format(**c) @@ -1116,8 +1024,6 @@ UP032_0.py:209:1: UP032 [*] Use f-string instead of `format` call 211 211 | # When fixing, trim the trailing empty string. 212 212 | raise ValueError("Conflicting configuration dicts: {!r} {!r}" - Run `ruff check --fix` to apply this fix. - UP032_0.py:212:18: UP032 [*] Use f-string instead of `format` call | 211 | # When fixing, trim the trailing empty string. @@ -1140,8 +1046,6 @@ UP032_0.py:212:18: UP032 [*] Use f-string instead of `format` call 215 214 | # When fixing, trim the trailing empty string. 216 215 | raise ValueError("Conflicting configuration dicts: {!r} {!r}" - Run `ruff check --fix` to apply this fix. - UP032_0.py:216:18: UP032 [*] Use f-string instead of `format` call | 215 | # When fixing, trim the trailing empty string. @@ -1165,8 +1069,6 @@ UP032_0.py:216:18: UP032 [*] Use f-string instead of `format` call 219 219 | raise ValueError( 220 220 | "Conflicting configuration dicts: {!r} {!r}" - Run `ruff check --fix` to apply this fix. - UP032_0.py:220:5: UP032 [*] Use f-string instead of `format` call | 219 | raise ValueError( @@ -1188,8 +1090,6 @@ UP032_0.py:220:5: UP032 [*] Use f-string instead of `format` call 223 222 | 224 223 | raise ValueError( - Run `ruff check --fix` to apply this fix. - UP032_0.py:225:5: UP032 [*] Use f-string instead of `format` call | 224 | raise ValueError( @@ -1212,8 +1112,6 @@ UP032_0.py:225:5: UP032 [*] Use f-string instead of `format` call 228 227 | ) 229 228 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:231:1: UP032 [*] Use f-string instead of `format` call | 230 | # The first string will be converted to an f-string and the curly braces in the second should be converted to be unescaped @@ -1239,8 +1137,6 @@ UP032_0.py:231:1: UP032 [*] Use f-string instead of `format` call 236 236 | ("{}" "{{}}").format(a) 237 237 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:236:1: UP032 [*] Use f-string instead of `format` call | 234 | ).format(a) @@ -1259,8 +1155,6 @@ UP032_0.py:236:1: UP032 [*] Use f-string instead of `format` call 238 238 | 239 239 | # Both strings will be converted to an f-string and the curly braces in the second should left escaped - Run `ruff check --fix` to apply this fix. - UP032_0.py:240:1: UP032 [*] Use f-string instead of `format` call | 239 | # Both strings will be converted to an f-string and the curly braces in the second should left escaped @@ -1287,8 +1181,6 @@ UP032_0.py:240:1: UP032 [*] Use f-string instead of `format` call 245 245 | ("{}" "{{{}}}").format(a, b) 246 246 | - Run `ruff check --fix` to apply this fix. - UP032_0.py:245:1: UP032 [*] Use f-string instead of `format` call | 243 | ).format(a, b) @@ -1309,8 +1201,6 @@ UP032_0.py:245:1: UP032 [*] Use f-string instead of `format` call 247 247 | # The dictionary should be parenthesized. 248 248 | "{}".format({0: 1}[0]) - Run `ruff check --fix` to apply this fix. - UP032_0.py:248:1: UP032 [*] Use f-string instead of `format` call | 247 | # The dictionary should be parenthesized. @@ -1330,8 +1220,6 @@ UP032_0.py:248:1: UP032 [*] Use f-string instead of `format` call 250 250 | # The dictionary should be parenthesized. 251 251 | "{}".format({0: 1}.bar) - Run `ruff check --fix` to apply this fix. - UP032_0.py:251:1: UP032 [*] Use f-string instead of `format` call | 250 | # The dictionary should be parenthesized. @@ -1351,8 +1239,6 @@ UP032_0.py:251:1: UP032 [*] Use f-string instead of `format` call 253 253 | # The dictionary should be parenthesized. 254 254 | "{}".format({0: 1}()) - Run `ruff check --fix` to apply this fix. - UP032_0.py:254:1: UP032 [*] Use f-string instead of `format` call | 253 | # The dictionary should be parenthesized. @@ -1372,8 +1258,6 @@ UP032_0.py:254:1: UP032 [*] Use f-string instead of `format` call 256 256 | # The string shouldn't be converted, since it would require repeating the function call. 257 257 | "{x} {x}".format(x=foo()) - Run `ruff check --fix` to apply this fix. - UP032_0.py:261:1: UP032 [*] Use f-string instead of `format` call | 260 | # The string _should_ be converted, since the function call is repeated in the arguments. @@ -1393,8 +1277,6 @@ UP032_0.py:261:1: UP032 [*] Use f-string instead of `format` call 263 263 | # The call should be removed, but the string itself should remain. 264 264 | ''.format(self.project) - Run `ruff check --fix` to apply this fix. - UP032_0.py:264:1: UP032 [*] Use f-string instead of `format` call | 263 | # The call should be removed, but the string itself should remain. @@ -1414,8 +1296,6 @@ UP032_0.py:264:1: UP032 [*] Use f-string instead of `format` call 266 266 | # The call should be removed, but the string itself should remain. 267 267 | "".format(self.project) - Run `ruff check --fix` to apply this fix. - UP032_0.py:267:1: UP032 [*] Use f-string instead of `format` call | 266 | # The call should be removed, but the string itself should remain. @@ -1435,8 +1315,6 @@ UP032_0.py:267:1: UP032 [*] Use f-string instead of `format` call 269 269 | # Not a valid type annotation but this test shouldn't result in a panic. 270 270 | # Refer: https://github.com/astral-sh/ruff/issues/11736 - Run `ruff check --fix` to apply this fix. - UP032_0.py:271:5: UP032 [*] Use f-string instead of `format` call | 269 | # Not a valid type annotation but this test shouldn't result in a panic. @@ -1451,5 +1329,3 @@ UP032_0.py:271:5: UP032 [*] Use f-string instead of `format` call 270 270 | # Refer: https://github.com/astral-sh/ruff/issues/11736 271 |-x: "'{} + {}'.format(x, y)" 271 |+x: "f'{x} + {y}'" - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap index 386a17514fecb..21e6da29d4a30 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap @@ -10,5 +10,3 @@ UP032_1.py:1:1: UP032 [*] Use f-string instead of `format` call 1 |-"{} {}".format(a, b) # Intentionally at start-of-file, to ensure graceful handling. 1 |+f"{a} {b}" # Intentionally at start-of-file, to ensure graceful handling. - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap index 10d07aa21abb2..5f1cb6ea0da40 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap @@ -18,8 +18,6 @@ UP032_2.py:2:1: UP032 [*] Use f-string instead of `format` call 4 4 | "{a.real}".format(a=1) 5 5 | - Run `ruff check --fix` to apply this fix. - UP032_2.py:3:1: UP032 [*] Use f-string instead of `format` call | 1 | # Errors @@ -38,8 +36,6 @@ UP032_2.py:3:1: UP032 [*] Use f-string instead of `format` call 5 5 | 6 6 | "{.real}".format(1.0) - Run `ruff check --fix` to apply this fix. - UP032_2.py:4:1: UP032 [*] Use f-string instead of `format` call | 2 | "{.real}".format(1) @@ -60,8 +56,6 @@ UP032_2.py:4:1: UP032 [*] Use f-string instead of `format` call 6 6 | "{.real}".format(1.0) 7 7 | "{0.real}".format(1.0) - Run `ruff check --fix` to apply this fix. - UP032_2.py:6:1: UP032 [*] Use f-string instead of `format` call | 4 | "{a.real}".format(a=1) @@ -82,8 +76,6 @@ UP032_2.py:6:1: UP032 [*] Use f-string instead of `format` call 8 8 | "{a.real}".format(a=1.0) 9 9 | - Run `ruff check --fix` to apply this fix. - UP032_2.py:7:1: UP032 [*] Use f-string instead of `format` call | 6 | "{.real}".format(1.0) @@ -102,8 +94,6 @@ UP032_2.py:7:1: UP032 [*] Use f-string instead of `format` call 9 9 | 10 10 | "{.real}".format(1j) - Run `ruff check --fix` to apply this fix. - UP032_2.py:8:1: UP032 [*] Use f-string instead of `format` call | 6 | "{.real}".format(1.0) @@ -124,8 +114,6 @@ UP032_2.py:8:1: UP032 [*] Use f-string instead of `format` call 10 10 | "{.real}".format(1j) 11 11 | "{0.real}".format(1j) - Run `ruff check --fix` to apply this fix. - UP032_2.py:10:1: UP032 [*] Use f-string instead of `format` call | 8 | "{a.real}".format(a=1.0) @@ -146,8 +134,6 @@ UP032_2.py:10:1: UP032 [*] Use f-string instead of `format` call 12 12 | "{a.real}".format(a=1j) 13 13 | - Run `ruff check --fix` to apply this fix. - UP032_2.py:11:1: UP032 [*] Use f-string instead of `format` call | 10 | "{.real}".format(1j) @@ -166,8 +152,6 @@ UP032_2.py:11:1: UP032 [*] Use f-string instead of `format` call 13 13 | 14 14 | "{.real}".format(0b01) - Run `ruff check --fix` to apply this fix. - UP032_2.py:12:1: UP032 [*] Use f-string instead of `format` call | 10 | "{.real}".format(1j) @@ -188,8 +172,6 @@ UP032_2.py:12:1: UP032 [*] Use f-string instead of `format` call 14 14 | "{.real}".format(0b01) 15 15 | "{0.real}".format(0b01) - Run `ruff check --fix` to apply this fix. - UP032_2.py:14:1: UP032 [*] Use f-string instead of `format` call | 12 | "{a.real}".format(a=1j) @@ -210,8 +192,6 @@ UP032_2.py:14:1: UP032 [*] Use f-string instead of `format` call 16 16 | "{a.real}".format(a=0b01) 17 17 | - Run `ruff check --fix` to apply this fix. - UP032_2.py:15:1: UP032 [*] Use f-string instead of `format` call | 14 | "{.real}".format(0b01) @@ -230,8 +210,6 @@ UP032_2.py:15:1: UP032 [*] Use f-string instead of `format` call 17 17 | 18 18 | "{}".format(1 + 2) - Run `ruff check --fix` to apply this fix. - UP032_2.py:16:1: UP032 [*] Use f-string instead of `format` call | 14 | "{.real}".format(0b01) @@ -252,8 +230,6 @@ UP032_2.py:16:1: UP032 [*] Use f-string instead of `format` call 18 18 | "{}".format(1 + 2) 19 19 | "{}".format([1, 2]) - Run `ruff check --fix` to apply this fix. - UP032_2.py:18:1: UP032 [*] Use f-string instead of `format` call | 16 | "{a.real}".format(a=0b01) @@ -274,8 +250,6 @@ UP032_2.py:18:1: UP032 [*] Use f-string instead of `format` call 20 20 | "{}".format({1, 2}) 21 21 | "{}".format({1: 2, 3: 4}) - Run `ruff check --fix` to apply this fix. - UP032_2.py:19:1: UP032 [*] Use f-string instead of `format` call | 18 | "{}".format(1 + 2) @@ -295,8 +269,6 @@ UP032_2.py:19:1: UP032 [*] Use f-string instead of `format` call 21 21 | "{}".format({1: 2, 3: 4}) 22 22 | "{}".format((i for i in range(2))) - Run `ruff check --fix` to apply this fix. - UP032_2.py:20:1: UP032 [*] Use f-string instead of `format` call | 18 | "{}".format(1 + 2) @@ -317,8 +289,6 @@ UP032_2.py:20:1: UP032 [*] Use f-string instead of `format` call 22 22 | "{}".format((i for i in range(2))) 23 23 | - Run `ruff check --fix` to apply this fix. - UP032_2.py:21:1: UP032 [*] Use f-string instead of `format` call | 19 | "{}".format([1, 2]) @@ -338,8 +308,6 @@ UP032_2.py:21:1: UP032 [*] Use f-string instead of `format` call 23 23 | 24 24 | "{.real}".format(1 + 2) - Run `ruff check --fix` to apply this fix. - UP032_2.py:22:1: UP032 [*] Use f-string instead of `format` call | 20 | "{}".format({1, 2}) @@ -360,8 +328,6 @@ UP032_2.py:22:1: UP032 [*] Use f-string instead of `format` call 24 24 | "{.real}".format(1 + 2) 25 25 | "{.real}".format([1, 2]) - Run `ruff check --fix` to apply this fix. - UP032_2.py:24:1: UP032 [*] Use f-string instead of `format` call | 22 | "{}".format((i for i in range(2))) @@ -382,8 +348,6 @@ UP032_2.py:24:1: UP032 [*] Use f-string instead of `format` call 26 26 | "{.real}".format({1, 2}) 27 27 | "{.real}".format({1: 2, 3: 4}) - Run `ruff check --fix` to apply this fix. - UP032_2.py:25:1: UP032 [*] Use f-string instead of `format` call | 24 | "{.real}".format(1 + 2) @@ -403,8 +367,6 @@ UP032_2.py:25:1: UP032 [*] Use f-string instead of `format` call 27 27 | "{.real}".format({1: 2, 3: 4}) 28 28 | "{}".format((i for i in range(2))) - Run `ruff check --fix` to apply this fix. - UP032_2.py:26:1: UP032 [*] Use f-string instead of `format` call | 24 | "{.real}".format(1 + 2) @@ -424,8 +386,6 @@ UP032_2.py:26:1: UP032 [*] Use f-string instead of `format` call 27 27 | "{.real}".format({1: 2, 3: 4}) 28 28 | "{}".format((i for i in range(2))) - Run `ruff check --fix` to apply this fix. - UP032_2.py:27:1: UP032 [*] Use f-string instead of `format` call | 25 | "{.real}".format([1, 2]) @@ -443,8 +403,6 @@ UP032_2.py:27:1: UP032 [*] Use f-string instead of `format` call 27 |+f"{({1: 2, 3: 4}).real}" 28 28 | "{}".format((i for i in range(2))) - Run `ruff check --fix` to apply this fix. - UP032_2.py:28:1: UP032 [*] Use f-string instead of `format` call | 26 | "{.real}".format({1, 2}) @@ -459,5 +417,3 @@ UP032_2.py:28:1: UP032 [*] Use f-string instead of `format` call 27 27 | "{.real}".format({1: 2, 3: 4}) 28 |-"{}".format((i for i in range(2))) 28 |+f"{(i for i in range(2))}" - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_0.py.snap index 90a6c6cbe2dcf..fbdee645ee2bf 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_0.py.snap @@ -19,8 +19,6 @@ UP033_0.py:4:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_cac 6 6 | pass 7 7 | - Run `ruff check --fix` to apply this fix. - UP033_0.py:10:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` | 9 | @other_decorator @@ -40,8 +38,6 @@ UP033_0.py:10:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca 12 12 | pass 13 13 | - Run `ruff check --fix` to apply this fix. - UP033_0.py:15:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` | 15 | @functools.lru_cache(maxsize=None) @@ -59,5 +55,3 @@ UP033_0.py:15:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca 16 16 | @other_decorator 17 17 | def fixme(): 18 18 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_1.py.snap index 16dbb72014b3a..a232329211d81 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP033_1.py.snap @@ -20,8 +20,6 @@ UP033_1.py:4:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_cac 6 6 | pass 7 7 | - Run `ruff check --fix` to apply this fix. - UP033_1.py:10:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` | 9 | @other_decorator @@ -47,8 +45,6 @@ UP033_1.py:10:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca 12 12 | pass 13 13 | - Run `ruff check --fix` to apply this fix. - UP033_1.py:15:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_cache(maxsize=None)` | 15 | @lru_cache(maxsize=None) @@ -72,5 +68,3 @@ UP033_1.py:15:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca 16 16 | @other_decorator 17 17 | def fixme(): 18 18 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP034.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP034.py.snap index b3160ea7d7f9d..96c5ece3dc4d5 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP034.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP034.py.snap @@ -18,8 +18,6 @@ UP034.py:2:7: UP034 [*] Avoid extraneous parentheses 4 4 | # UP034 5 5 | print(("hell((goodybe))o")) - Run `ruff check --fix` to apply this fix. - UP034.py:5:7: UP034 [*] Avoid extraneous parentheses | 4 | # UP034 @@ -39,8 +37,6 @@ UP034.py:5:7: UP034 [*] Avoid extraneous parentheses 7 7 | # UP034 8 8 | print((("foo"))) - Run `ruff check --fix` to apply this fix. - UP034.py:8:7: UP034 [*] Avoid extraneous parentheses | 7 | # UP034 @@ -60,8 +56,6 @@ UP034.py:8:7: UP034 [*] Avoid extraneous parentheses 10 10 | # UP034 11 11 | print((((1)))) - Run `ruff check --fix` to apply this fix. - UP034.py:11:7: UP034 [*] Avoid extraneous parentheses | 10 | # UP034 @@ -81,8 +75,6 @@ UP034.py:11:7: UP034 [*] Avoid extraneous parentheses 13 13 | # UP034 14 14 | print(("foo{}".format(1))) - Run `ruff check --fix` to apply this fix. - UP034.py:14:7: UP034 [*] Avoid extraneous parentheses | 13 | # UP034 @@ -102,8 +94,6 @@ UP034.py:14:7: UP034 [*] Avoid extraneous parentheses 16 16 | # UP034 17 17 | print( - Run `ruff check --fix` to apply this fix. - UP034.py:18:5: UP034 [*] Avoid extraneous parentheses | 16 | # UP034 @@ -123,8 +113,6 @@ UP034.py:18:5: UP034 [*] Avoid extraneous parentheses 20 20 | 21 21 | # UP034 - Run `ruff check --fix` to apply this fix. - UP034.py:23:5: UP034 [*] Avoid extraneous parentheses | 21 | # UP034 @@ -150,8 +138,6 @@ UP034.py:23:5: UP034 [*] Avoid extraneous parentheses 27 27 | 28 28 | # UP034 - Run `ruff check --fix` to apply this fix. - UP034.py:30:13: UP034 [*] Avoid extraneous parentheses | 28 | # UP034 @@ -172,8 +158,6 @@ UP034.py:30:13: UP034 [*] Avoid extraneous parentheses 32 32 | # UP034 33 33 | if True: - Run `ruff check --fix` to apply this fix. - UP034.py:35:9: UP034 [*] Avoid extraneous parentheses | 33 | if True: @@ -193,8 +177,6 @@ UP034.py:35:9: UP034 [*] Avoid extraneous parentheses 37 37 | 38 38 | # UP034 - Run `ruff check --fix` to apply this fix. - UP034.py:39:7: UP034 [*] Avoid extraneous parentheses | 38 | # UP034 @@ -213,5 +195,3 @@ UP034.py:39:7: UP034 [*] Avoid extraneous parentheses 40 40 | 41 41 | # OK 42 42 | print("foo") - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap index c07b7f8c232b9..cdd1e507e1f88 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap @@ -18,8 +18,6 @@ UP035.py:2:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 4 4 | from collections import Mapping as MAP 5 5 | - Run `ruff check --fix` to apply this fix. - UP035.py:4:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 2 | from collections import Mapping @@ -40,8 +38,6 @@ UP035.py:4:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 6 6 | from collections import Mapping, Sequence 7 7 | - Run `ruff check --fix` to apply this fix. - UP035.py:6:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequence` | 4 | from collections import Mapping as MAP @@ -62,8 +58,6 @@ UP035.py:6:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Seque 8 8 | from collections import Counter, Mapping 9 9 | - Run `ruff check --fix` to apply this fix. - UP035.py:8:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 6 | from collections import Mapping, Sequence @@ -85,8 +79,6 @@ UP035.py:8:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 10 11 | from collections import (Counter, Mapping) 11 12 | - Run `ruff check --fix` to apply this fix. - UP035.py:10:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 8 | from collections import Counter, Mapping @@ -108,8 +100,6 @@ UP035.py:10:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 12 13 | from collections import (Counter, 13 14 | Mapping) - Run `ruff check --fix` to apply this fix. - UP035.py:12:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 10 | from collections import (Counter, Mapping) @@ -133,8 +123,6 @@ UP035.py:12:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 15 15 | from collections import Counter, \ 16 16 | Mapping - Run `ruff check --fix` to apply this fix. - UP035.py:15:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 13 | Mapping) @@ -158,8 +146,6 @@ UP035.py:15:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 18 18 | from collections import Counter, Mapping, Sequence 19 19 | - Run `ruff check --fix` to apply this fix. - UP035.py:18:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequence` | 16 | Mapping @@ -181,8 +167,6 @@ UP035.py:18:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequ 20 21 | from collections import Mapping as mapping, Counter 21 22 | - Run `ruff check --fix` to apply this fix. - UP035.py:20:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 18 | from collections import Counter, Mapping, Sequence @@ -204,8 +188,6 @@ UP035.py:20:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 22 23 | if True: 23 24 | from collections import Mapping, Counter - Run `ruff check --fix` to apply this fix. - UP035.py:23:5: UP035 [*] Import from `collections.abc` instead: `Mapping` | 22 | if True: @@ -226,8 +208,6 @@ UP035.py:23:5: UP035 [*] Import from `collections.abc` instead: `Mapping` 25 26 | if True: 26 27 | if True: - Run `ruff check --fix` to apply this fix. - UP035.py:28:5: UP035 [*] Import from `collections.abc` instead: `Mapping` | 26 | if True: @@ -249,8 +229,6 @@ UP035.py:28:5: UP035 [*] Import from `collections.abc` instead: `Mapping` 30 31 | if True: from collections import Mapping 31 32 | - Run `ruff check --fix` to apply this fix. - UP035.py:30:10: UP035 [*] Import from `collections.abc` instead: `Mapping` | 28 | from collections import Mapping, Counter @@ -271,8 +249,6 @@ UP035.py:30:10: UP035 [*] Import from `collections.abc` instead: `Mapping` 32 32 | import os 33 33 | from collections import Counter, Mapping - Run `ruff check --fix` to apply this fix. - UP035.py:33:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 32 | import os @@ -292,8 +268,6 @@ UP035.py:33:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 35 36 | 36 37 | if True: - Run `ruff check --fix` to apply this fix. - UP035.py:37:5: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Callable` | 36 | if True: @@ -323,8 +297,6 @@ UP035.py:37:5: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Call 44 43 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager 45 44 | - Run `ruff check --fix` to apply this fix. - UP035.py:44:1: UP035 [*] Import from `collections.abc` instead: `Callable` | 42 | ) @@ -346,8 +318,6 @@ UP035.py:44:1: UP035 [*] Import from `collections.abc` instead: `Callable` 46 47 | if True: from collections import ( 47 48 | Mapping, Counter) - Run `ruff check --fix` to apply this fix. - UP035.py:44:1: UP035 [*] Import from `collections` instead: `OrderedDict` | 42 | ) @@ -369,8 +339,6 @@ UP035.py:44:1: UP035 [*] Import from `collections` instead: `OrderedDict` 46 47 | if True: from collections import ( 47 48 | Mapping, Counter) - Run `ruff check --fix` to apply this fix. - UP035.py:44:1: UP035 [*] Import from `re` instead: `Match`, `Pattern` | 42 | ) @@ -392,8 +360,6 @@ UP035.py:44:1: UP035 [*] Import from `re` instead: `Match`, `Pattern` 46 47 | if True: from collections import ( 47 48 | Mapping, Counter) - Run `ruff check --fix` to apply this fix. - UP035.py:44:1: UP035 `typing.List` is deprecated, use `list` instead | 42 | ) @@ -466,8 +432,6 @@ UP035.py:51:1: UP035 [*] Import from `collections` instead: `OrderedDict` 53 53 | from typing import Callable 54 54 | from typing import ByteString - Run `ruff check --fix` to apply this fix. - UP035.py:52:1: UP035 [*] Import from `typing` instead: `OrderedDict` | 50 | from typing import ContextManager @@ -488,8 +452,6 @@ UP035.py:52:1: UP035 [*] Import from `typing` instead: `OrderedDict` 54 54 | from typing import ByteString 55 55 | from typing import Container - Run `ruff check --fix` to apply this fix. - UP035.py:53:1: UP035 [*] Import from `collections.abc` instead: `Callable` | 51 | from typing import OrderedDict @@ -510,8 +472,6 @@ UP035.py:53:1: UP035 [*] Import from `collections.abc` instead: `Callable` 55 55 | from typing import Container 56 56 | from typing import Hashable - Run `ruff check --fix` to apply this fix. - UP035.py:54:1: UP035 [*] Import from `collections.abc` instead: `ByteString` | 52 | from typing_extensions import OrderedDict @@ -532,8 +492,6 @@ UP035.py:54:1: UP035 [*] Import from `collections.abc` instead: `ByteString` 56 56 | from typing import Hashable 57 57 | from typing import ItemsView - Run `ruff check --fix` to apply this fix. - UP035.py:55:1: UP035 [*] Import from `collections.abc` instead: `Container` | 53 | from typing import Callable @@ -554,8 +512,6 @@ UP035.py:55:1: UP035 [*] Import from `collections.abc` instead: `Container` 57 57 | from typing import ItemsView 58 58 | from typing import Iterable - Run `ruff check --fix` to apply this fix. - UP035.py:56:1: UP035 [*] Import from `collections.abc` instead: `Hashable` | 54 | from typing import ByteString @@ -576,8 +532,6 @@ UP035.py:56:1: UP035 [*] Import from `collections.abc` instead: `Hashable` 58 58 | from typing import Iterable 59 59 | from typing import Iterator - Run `ruff check --fix` to apply this fix. - UP035.py:57:1: UP035 [*] Import from `collections.abc` instead: `ItemsView` | 55 | from typing import Container @@ -598,8 +552,6 @@ UP035.py:57:1: UP035 [*] Import from `collections.abc` instead: `ItemsView` 59 59 | from typing import Iterator 60 60 | from typing import KeysView - Run `ruff check --fix` to apply this fix. - UP035.py:58:1: UP035 [*] Import from `collections.abc` instead: `Iterable` | 56 | from typing import Hashable @@ -620,8 +572,6 @@ UP035.py:58:1: UP035 [*] Import from `collections.abc` instead: `Iterable` 60 60 | from typing import KeysView 61 61 | from typing import Mapping - Run `ruff check --fix` to apply this fix. - UP035.py:59:1: UP035 [*] Import from `collections.abc` instead: `Iterator` | 57 | from typing import ItemsView @@ -642,8 +592,6 @@ UP035.py:59:1: UP035 [*] Import from `collections.abc` instead: `Iterator` 61 61 | from typing import Mapping 62 62 | from typing import MappingView - Run `ruff check --fix` to apply this fix. - UP035.py:60:1: UP035 [*] Import from `collections.abc` instead: `KeysView` | 58 | from typing import Iterable @@ -664,8 +612,6 @@ UP035.py:60:1: UP035 [*] Import from `collections.abc` instead: `KeysView` 62 62 | from typing import MappingView 63 63 | from typing import MutableMapping - Run `ruff check --fix` to apply this fix. - UP035.py:61:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 59 | from typing import Iterator @@ -686,8 +632,6 @@ UP035.py:61:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 63 63 | from typing import MutableMapping 64 64 | from typing import MutableSequence - Run `ruff check --fix` to apply this fix. - UP035.py:62:1: UP035 [*] Import from `collections.abc` instead: `MappingView` | 60 | from typing import KeysView @@ -708,8 +652,6 @@ UP035.py:62:1: UP035 [*] Import from `collections.abc` instead: `MappingView` 64 64 | from typing import MutableSequence 65 65 | from typing import MutableSet - Run `ruff check --fix` to apply this fix. - UP035.py:63:1: UP035 [*] Import from `collections.abc` instead: `MutableMapping` | 61 | from typing import Mapping @@ -730,8 +672,6 @@ UP035.py:63:1: UP035 [*] Import from `collections.abc` instead: `MutableMapping` 65 65 | from typing import MutableSet 66 66 | from typing import Sequence - Run `ruff check --fix` to apply this fix. - UP035.py:64:1: UP035 [*] Import from `collections.abc` instead: `MutableSequence` | 62 | from typing import MappingView @@ -752,8 +692,6 @@ UP035.py:64:1: UP035 [*] Import from `collections.abc` instead: `MutableSequence 66 66 | from typing import Sequence 67 67 | from typing import Sized - Run `ruff check --fix` to apply this fix. - UP035.py:65:1: UP035 [*] Import from `collections.abc` instead: `MutableSet` | 63 | from typing import MutableMapping @@ -774,8 +712,6 @@ UP035.py:65:1: UP035 [*] Import from `collections.abc` instead: `MutableSet` 67 67 | from typing import Sized 68 68 | from typing import ValuesView - Run `ruff check --fix` to apply this fix. - UP035.py:66:1: UP035 [*] Import from `collections.abc` instead: `Sequence` | 64 | from typing import MutableSequence @@ -796,8 +732,6 @@ UP035.py:66:1: UP035 [*] Import from `collections.abc` instead: `Sequence` 68 68 | from typing import ValuesView 69 69 | from typing import Awaitable - Run `ruff check --fix` to apply this fix. - UP035.py:67:1: UP035 [*] Import from `collections.abc` instead: `Sized` | 65 | from typing import MutableSet @@ -818,8 +752,6 @@ UP035.py:67:1: UP035 [*] Import from `collections.abc` instead: `Sized` 69 69 | from typing import Awaitable 70 70 | from typing import AsyncIterator - Run `ruff check --fix` to apply this fix. - UP035.py:68:1: UP035 [*] Import from `collections.abc` instead: `ValuesView` | 66 | from typing import Sequence @@ -840,8 +772,6 @@ UP035.py:68:1: UP035 [*] Import from `collections.abc` instead: `ValuesView` 70 70 | from typing import AsyncIterator 71 71 | from typing import AsyncIterable - Run `ruff check --fix` to apply this fix. - UP035.py:69:1: UP035 [*] Import from `collections.abc` instead: `Awaitable` | 67 | from typing import Sized @@ -862,8 +792,6 @@ UP035.py:69:1: UP035 [*] Import from `collections.abc` instead: `Awaitable` 71 71 | from typing import AsyncIterable 72 72 | from typing import Coroutine - Run `ruff check --fix` to apply this fix. - UP035.py:70:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterator` | 68 | from typing import ValuesView @@ -884,8 +812,6 @@ UP035.py:70:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterator` 72 72 | from typing import Coroutine 73 73 | from typing import Collection - Run `ruff check --fix` to apply this fix. - UP035.py:71:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterable` | 69 | from typing import Awaitable @@ -906,8 +832,6 @@ UP035.py:71:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterable` 73 73 | from typing import Collection 74 74 | from typing import AsyncGenerator - Run `ruff check --fix` to apply this fix. - UP035.py:72:1: UP035 [*] Import from `collections.abc` instead: `Coroutine` | 70 | from typing import AsyncIterator @@ -928,8 +852,6 @@ UP035.py:72:1: UP035 [*] Import from `collections.abc` instead: `Coroutine` 74 74 | from typing import AsyncGenerator 75 75 | from typing import Reversible - Run `ruff check --fix` to apply this fix. - UP035.py:73:1: UP035 [*] Import from `collections.abc` instead: `Collection` | 71 | from typing import AsyncIterable @@ -950,8 +872,6 @@ UP035.py:73:1: UP035 [*] Import from `collections.abc` instead: `Collection` 75 75 | from typing import Reversible 76 76 | from typing import Generator - Run `ruff check --fix` to apply this fix. - UP035.py:74:1: UP035 [*] Import from `collections.abc` instead: `AsyncGenerator` | 72 | from typing import Coroutine @@ -972,8 +892,6 @@ UP035.py:74:1: UP035 [*] Import from `collections.abc` instead: `AsyncGenerator` 76 76 | from typing import Generator 77 77 | from typing import Callable - Run `ruff check --fix` to apply this fix. - UP035.py:75:1: UP035 [*] Import from `collections.abc` instead: `Reversible` | 73 | from typing import Collection @@ -994,8 +912,6 @@ UP035.py:75:1: UP035 [*] Import from `collections.abc` instead: `Reversible` 77 77 | from typing import Callable 78 78 | from typing import cast - Run `ruff check --fix` to apply this fix. - UP035.py:76:1: UP035 [*] Import from `collections.abc` instead: `Generator` | 74 | from typing import AsyncGenerator @@ -1016,8 +932,6 @@ UP035.py:76:1: UP035 [*] Import from `collections.abc` instead: `Generator` 78 78 | from typing import cast 79 79 | - Run `ruff check --fix` to apply this fix. - UP035.py:77:1: UP035 [*] Import from `collections.abc` instead: `Callable` | 75 | from typing import Reversible @@ -1037,8 +951,6 @@ UP035.py:77:1: UP035 [*] Import from `collections.abc` instead: `Callable` 79 79 | 80 80 | # OK - Run `ruff check --fix` to apply this fix. - UP035.py:84:1: UP035 [*] Import from `typing` instead: `SupportsIndex` | 83 | # UP035 on py312+ only @@ -1058,8 +970,6 @@ UP035.py:84:1: UP035 [*] Import from `typing` instead: `SupportsIndex` 86 86 | # UP035 on py312+ only 87 87 | from typing_extensions import NamedTuple - Run `ruff check --fix` to apply this fix. - UP035.py:87:1: UP035 [*] Import from `typing` instead: `NamedTuple` | 86 | # UP035 on py312+ only @@ -1079,8 +989,6 @@ UP035.py:87:1: UP035 [*] Import from `typing` instead: `NamedTuple` 89 89 | # UP035 on py312+ only: `typing_extensions` supports `frozen_default` (backported from 3.12). 90 90 | from typing_extensions import dataclass_transform - Run `ruff check --fix` to apply this fix. - UP035.py:90:1: UP035 [*] Import from `typing` instead: `dataclass_transform` | 89 | # UP035 on py312+ only: `typing_extensions` supports `frozen_default` (backported from 3.12). @@ -1100,8 +1008,6 @@ UP035.py:90:1: UP035 [*] Import from `typing` instead: `dataclass_transform` 92 92 | # UP035 93 93 | from backports.strenum import StrEnum - Run `ruff check --fix` to apply this fix. - UP035.py:93:1: UP035 [*] Import from `enum` instead: `StrEnum` | 92 | # UP035 @@ -1121,8 +1027,6 @@ UP035.py:93:1: UP035 [*] Import from `enum` instead: `StrEnum` 95 95 | # UP035 96 96 | from typing_extensions import override - Run `ruff check --fix` to apply this fix. - UP035.py:96:1: UP035 [*] Import from `typing` instead: `override` | 95 | # UP035 @@ -1142,8 +1046,6 @@ UP035.py:96:1: UP035 [*] Import from `typing` instead: `override` 98 98 | # UP035 99 99 | from typing_extensions import Buffer - Run `ruff check --fix` to apply this fix. - UP035.py:99:1: UP035 [*] Import from `collections.abc` instead: `Buffer` | 98 | # UP035 @@ -1163,8 +1065,6 @@ UP035.py:99:1: UP035 [*] Import from `collections.abc` instead: `Buffer` 101 101 | # UP035 102 102 | from typing_extensions import get_original_bases - Run `ruff check --fix` to apply this fix. - UP035.py:102:1: UP035 [*] Import from `types` instead: `get_original_bases` | 101 | # UP035 @@ -1184,8 +1084,6 @@ UP035.py:102:1: UP035 [*] Import from `types` instead: `get_original_bases` 104 104 | # UP035 on py313+ only 105 105 | from typing_extensions import TypeVar - Run `ruff check --fix` to apply this fix. - UP035.py:105:1: UP035 [*] Import from `typing` instead: `TypeVar` | 104 | # UP035 on py313+ only @@ -1205,8 +1103,6 @@ UP035.py:105:1: UP035 [*] Import from `typing` instead: `TypeVar` 107 107 | # UP035 on py313+ only 108 108 | from typing_extensions import CapsuleType - Run `ruff check --fix` to apply this fix. - UP035.py:108:1: UP035 [*] Import from `types` instead: `CapsuleType` | 107 | # UP035 on py313+ only @@ -1226,8 +1122,6 @@ UP035.py:108:1: UP035 [*] Import from `types` instead: `CapsuleType` 110 110 | # UP035 on py313+ only 111 111 | from typing_extensions import deprecated - Run `ruff check --fix` to apply this fix. - UP035.py:111:1: UP035 [*] Import from `warnings` instead: `deprecated` | 110 | # UP035 on py313+ only @@ -1241,5 +1135,3 @@ UP035.py:111:1: UP035 [*] Import from `warnings` instead: `deprecated` 110 110 | # UP035 on py313+ only 111 |-from typing_extensions import deprecated 111 |+from warnings import deprecated - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap index 6708c75294dd4..de7b43a211548 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_0.py.snap @@ -18,8 +18,6 @@ UP037_0.py:18:14: UP037 [*] Remove quotes from type annotation 20 20 | 21 21 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:18:28: UP037 [*] Remove quotes from type annotation | 18 | def foo(var: "MyClass") -> "MyClass": @@ -37,8 +35,6 @@ UP037_0.py:18:28: UP037 [*] Remove quotes from type annotation 20 20 | 21 21 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:19:8: UP037 [*] Remove quotes from type annotation | 18 | def foo(var: "MyClass") -> "MyClass": @@ -56,8 +52,6 @@ UP037_0.py:19:8: UP037 [*] Remove quotes from type annotation 21 21 | 22 22 | def foo(*, inplace: "bool"): - Run `ruff check --fix` to apply this fix. - UP037_0.py:22:21: UP037 [*] Remove quotes from type annotation | 22 | def foo(*, inplace: "bool"): @@ -75,8 +69,6 @@ UP037_0.py:22:21: UP037 [*] Remove quotes from type annotation 24 24 | 25 25 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:26:16: UP037 [*] Remove quotes from type annotation | 26 | def foo(*args: "str", **kwargs: "int"): @@ -94,8 +86,6 @@ UP037_0.py:26:16: UP037 [*] Remove quotes from type annotation 28 28 | 29 29 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:26:33: UP037 [*] Remove quotes from type annotation | 26 | def foo(*args: "str", **kwargs: "int"): @@ -113,8 +103,6 @@ UP037_0.py:26:33: UP037 [*] Remove quotes from type annotation 28 28 | 29 29 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:30:10: UP037 [*] Remove quotes from type annotation | 30 | x: Tuple["MyClass"] @@ -133,8 +121,6 @@ UP037_0.py:30:10: UP037 [*] Remove quotes from type annotation 32 32 | x: Callable[["MyClass"], None] 33 33 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:32:14: UP037 [*] Remove quotes from type annotation | 30 | x: Tuple["MyClass"] @@ -153,8 +139,6 @@ UP037_0.py:32:14: UP037 [*] Remove quotes from type annotation 34 34 | 35 35 | class Foo(NamedTuple): - Run `ruff check --fix` to apply this fix. - UP037_0.py:36:8: UP037 [*] Remove quotes from type annotation | 35 | class Foo(NamedTuple): @@ -172,8 +156,6 @@ UP037_0.py:36:8: UP037 [*] Remove quotes from type annotation 38 38 | 39 39 | class D(TypedDict): - Run `ruff check --fix` to apply this fix. - UP037_0.py:40:27: UP037 [*] Remove quotes from type annotation | 39 | class D(TypedDict): @@ -191,8 +173,6 @@ UP037_0.py:40:27: UP037 [*] Remove quotes from type annotation 42 42 | 43 43 | class D(TypedDict): - Run `ruff check --fix` to apply this fix. - UP037_0.py:44:31: UP037 [*] Remove quotes from type annotation | 43 | class D(TypedDict): @@ -210,8 +190,6 @@ UP037_0.py:44:31: UP037 [*] Remove quotes from type annotation 46 46 | 47 47 | x: Annotated["str", "metadata"] - Run `ruff check --fix` to apply this fix. - UP037_0.py:47:14: UP037 [*] Remove quotes from type annotation | 47 | x: Annotated["str", "metadata"] @@ -230,8 +208,6 @@ UP037_0.py:47:14: UP037 [*] Remove quotes from type annotation 49 49 | x: Arg("str", "name") 50 50 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:49:8: UP037 [*] Remove quotes from type annotation | 47 | x: Annotated["str", "metadata"] @@ -252,8 +228,6 @@ UP037_0.py:49:8: UP037 [*] Remove quotes from type annotation 51 51 | x: DefaultArg("str", "name") 52 52 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:51:15: UP037 [*] Remove quotes from type annotation | 49 | x: Arg("str", "name") @@ -274,8 +248,6 @@ UP037_0.py:51:15: UP037 [*] Remove quotes from type annotation 53 53 | x: NamedArg("str", "name") 54 54 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:53:13: UP037 [*] Remove quotes from type annotation | 51 | x: DefaultArg("str", "name") @@ -296,8 +268,6 @@ UP037_0.py:53:13: UP037 [*] Remove quotes from type annotation 55 55 | x: DefaultNamedArg("str", "name") 56 56 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:55:20: UP037 [*] Remove quotes from type annotation | 53 | x: NamedArg("str", "name") @@ -318,8 +288,6 @@ UP037_0.py:55:20: UP037 [*] Remove quotes from type annotation 57 57 | x: DefaultNamedArg("str", name="name") 58 58 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:57:20: UP037 [*] Remove quotes from type annotation | 55 | x: DefaultNamedArg("str", "name") @@ -340,8 +308,6 @@ UP037_0.py:57:20: UP037 [*] Remove quotes from type annotation 59 59 | x: VarArg("str") 60 60 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:59:11: UP037 [*] Remove quotes from type annotation | 57 | x: DefaultNamedArg("str", name="name") @@ -362,8 +328,6 @@ UP037_0.py:59:11: UP037 [*] Remove quotes from type annotation 61 61 | x: List[List[List["MyClass"]]] 62 62 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:61:19: UP037 [*] Remove quotes from type annotation | 59 | x: VarArg("str") @@ -384,8 +348,6 @@ UP037_0.py:61:19: UP037 [*] Remove quotes from type annotation 63 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 64 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:63:29: UP037 [*] Remove quotes from type annotation | 61 | x: List[List[List["MyClass"]]] @@ -406,8 +368,6 @@ UP037_0.py:63:29: UP037 [*] Remove quotes from type annotation 65 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) 66 66 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:63:45: UP037 [*] Remove quotes from type annotation | 61 | x: List[List[List["MyClass"]]] @@ -428,8 +388,6 @@ UP037_0.py:63:45: UP037 [*] Remove quotes from type annotation 65 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) 66 66 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:65:29: UP037 [*] Remove quotes from type annotation | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) @@ -450,8 +408,6 @@ UP037_0.py:65:29: UP037 [*] Remove quotes from type annotation 67 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) 68 68 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:65:36: UP037 [*] Remove quotes from type annotation | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) @@ -472,8 +428,6 @@ UP037_0.py:65:36: UP037 [*] Remove quotes from type annotation 67 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) 68 68 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:65:45: UP037 [*] Remove quotes from type annotation | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) @@ -494,8 +448,6 @@ UP037_0.py:65:45: UP037 [*] Remove quotes from type annotation 67 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) 68 68 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:65:52: UP037 [*] Remove quotes from type annotation | 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) @@ -516,8 +468,6 @@ UP037_0.py:65:52: UP037 [*] Remove quotes from type annotation 67 67 | x: NamedTuple(typename="X", fields=[("foo", "int")]) 68 68 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:67:24: UP037 [*] Remove quotes from type annotation | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) @@ -538,8 +488,6 @@ UP037_0.py:67:24: UP037 [*] Remove quotes from type annotation 69 69 | X: MyCallable("X") 70 70 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:67:38: UP037 [*] Remove quotes from type annotation | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) @@ -560,8 +508,6 @@ UP037_0.py:67:38: UP037 [*] Remove quotes from type annotation 69 69 | X: MyCallable("X") 70 70 | - Run `ruff check --fix` to apply this fix. - UP037_0.py:67:45: UP037 [*] Remove quotes from type annotation | 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) @@ -580,6 +526,4 @@ UP037_0.py:67:45: UP037 [*] Remove quotes from type annotation 67 |+x: NamedTuple(typename="X", fields=[("foo", int)]) 68 68 | 69 69 | X: MyCallable("X") -70 70 | - - Run `ruff check --fix` to apply this fix. +70 70 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_1.py.snap index e0a45a844c5d3..af2dce3eeebdc 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037_1.py.snap @@ -18,6 +18,4 @@ UP037_1.py:9:8: UP037 [*] Remove quotes from type annotation 9 |+ x: Tuple[int, int] = (0, 0) 10 10 | print(x) 11 11 | -12 12 | - - Run `ruff check --fix` to apply this fix. +12 12 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP039.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP039.py.snap index d95b6476150ed..860029d4810fe 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP039.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP039.py.snap @@ -17,8 +17,6 @@ UP039.py:2:8: UP039 [*] Unnecessary parentheses after class definition 4 4 | 5 5 | - Run `ruff check --fix` to apply this fix. - UP039.py:6:8: UP039 [*] Unnecessary parentheses after class definition | 6 | class A() \ @@ -37,8 +35,6 @@ UP039.py:6:8: UP039 [*] Unnecessary parentheses after class definition 8 8 | pass 9 9 | - Run `ruff check --fix` to apply this fix. - UP039.py:12:9: UP039 [*] Unnecessary parentheses after class definition | 11 | class A \ @@ -57,8 +53,6 @@ UP039.py:12:9: UP039 [*] Unnecessary parentheses after class definition 14 14 | 15 15 | - Run `ruff check --fix` to apply this fix. - UP039.py:17:8: UP039 [*] Unnecessary parentheses after class definition | 16 | @decorator() @@ -77,8 +71,6 @@ UP039.py:17:8: UP039 [*] Unnecessary parentheses after class definition 19 19 | 20 20 | @decorator - Run `ruff check --fix` to apply this fix. - UP039.py:21:8: UP039 [*] Unnecessary parentheses after class definition | 20 | @decorator @@ -96,5 +88,3 @@ UP039.py:21:8: UP039 [*] Unnecessary parentheses after class definition 22 22 | pass 23 23 | 24 24 | # OK - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap index 3cf8ed265c73c..3d9295c900973 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.py.snap @@ -165,8 +165,6 @@ UP040.py:63:1: UP040 [*] Type alias `PositiveList` uses `TypeAliasType` assignme 67 65 | # Bound 68 66 | T = TypeVar("T", bound=SupportGt) - Run `ruff check --fix` to apply this fix. - UP040.py:69:1: UP040 [*] Type alias `PositiveList` uses `TypeAliasType` assignment instead of the `type` keyword | 67 | # Bound @@ -191,8 +189,6 @@ UP040.py:69:1: UP040 [*] Type alias `PositiveList` uses `TypeAliasType` assignme 73 71 | # Multiple bounds 74 72 | T1 = TypeVar("T1", bound=SupportGt) - Run `ruff check --fix` to apply this fix. - UP040.py:77:1: UP040 [*] Type alias `Tuple3` uses `TypeAliasType` assignment instead of the `type` keyword | 75 | T2 = TypeVar("T2") @@ -213,8 +209,6 @@ UP040.py:77:1: UP040 [*] Type alias `Tuple3` uses `TypeAliasType` assignment ins 79 79 | # No type_params 80 80 | PositiveInt = TypeAliasType("PositiveInt", Annotated[int, Gt(0)]) - Run `ruff check --fix` to apply this fix. - UP040.py:80:1: UP040 [*] Type alias `PositiveInt` uses `TypeAliasType` assignment instead of the `type` keyword | 79 | # No type_params @@ -233,8 +227,6 @@ UP040.py:80:1: UP040 [*] Type alias `PositiveInt` uses `TypeAliasType` assignmen 82 82 | 83 83 | # OK: Other name - Run `ruff check --fix` to apply this fix. - UP040.py:81:1: UP040 [*] Type alias `PositiveInt` uses `TypeAliasType` assignment instead of the `type` keyword | 79 | # No type_params @@ -254,5 +246,3 @@ UP040.py:81:1: UP040 [*] Type alias `PositiveInt` uses `TypeAliasType` assignmen 82 82 | 83 83 | # OK: Other name 84 84 | T = TypeVar("T", bound=SupportGt) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.pyi.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.pyi.snap index 584dc63eb6bb0..c221dbe21cf7b 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.pyi.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP040.pyi.snap @@ -18,8 +18,6 @@ UP040.pyi:6:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 6 |+type x = int 7 7 | x: TypeAlias = int - Run `ruff check --fix` to apply this fix. - UP040.pyi:7:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of the `type` keyword | 5 | # Fixes in type stub files should be safe to apply unlike in regular code where runtime behavior could change @@ -34,5 +32,3 @@ UP040.pyi:7:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t 6 6 | x: typing.TypeAlias = int 7 |-x: TypeAlias = int 7 |+type x = int - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP041.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP041.py.snap index c0de306d315e3..43b04a62156e2 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP041.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP041.py.snap @@ -20,8 +20,6 @@ UP041.py:5:8: UP041 [*] Replace aliased errors with `TimeoutError` 7 7 | 8 8 | try: - Run `ruff check --fix` to apply this fix. - UP041.py:10:8: UP041 [*] Replace aliased errors with `TimeoutError` | 8 | try: @@ -41,8 +39,6 @@ UP041.py:10:8: UP041 [*] Replace aliased errors with `TimeoutError` 12 12 | 13 13 | # Should NOT be in parentheses when replaced - Run `ruff check --fix` to apply this fix. - UP041.py:17:8: UP041 [*] Replace aliased errors with `TimeoutError` | 15 | try: @@ -62,8 +58,6 @@ UP041.py:17:8: UP041 [*] Replace aliased errors with `TimeoutError` 19 19 | 20 20 | try: - Run `ruff check --fix` to apply this fix. - UP041.py:22:8: UP041 [*] Replace aliased errors with `TimeoutError` | 20 | try: @@ -83,8 +77,6 @@ UP041.py:22:8: UP041 [*] Replace aliased errors with `TimeoutError` 24 24 | 25 25 | try: - Run `ruff check --fix` to apply this fix. - UP041.py:27:8: UP041 [*] Replace aliased errors with `TimeoutError` | 25 | try: @@ -104,8 +96,6 @@ UP041.py:27:8: UP041 [*] Replace aliased errors with `TimeoutError` 29 29 | 30 30 | # Should be kept in parentheses (because multiple) - Run `ruff check --fix` to apply this fix. - UP041.py:34:8: UP041 [*] Replace aliased errors with `TimeoutError` | 32 | try: @@ -125,8 +115,6 @@ UP041.py:34:8: UP041 [*] Replace aliased errors with `TimeoutError` 36 36 | 37 37 | # First should change, second should not - Run `ruff check --fix` to apply this fix. - UP041.py:42:8: UP041 [*] Replace aliased errors with `TimeoutError` | 40 | try: @@ -145,5 +133,3 @@ UP041.py:42:8: UP041 [*] Replace aliased errors with `TimeoutError` 43 43 | pass 44 44 | 45 45 | # These should not change - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP043.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP043.py.snap index c62bdfa93b892..00a25cf0f2f40 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP043.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP043.py.snap @@ -18,8 +18,6 @@ UP043.py:4:15: UP043 [*] Unnecessary default type arguments 6 6 | 7 7 | - Run `ruff check --fix` to apply this fix. - UP043.py:8:15: UP043 [*] Unnecessary default type arguments | 8 | def func() -> Generator[int, None]: @@ -37,8 +35,6 @@ UP043.py:8:15: UP043 [*] Unnecessary default type arguments 10 10 | 11 11 | - Run `ruff check --fix` to apply this fix. - UP043.py:21:15: UP043 [*] Unnecessary default type arguments | 21 | def func() -> Generator[int, int, None]: @@ -57,8 +53,6 @@ UP043.py:21:15: UP043 [*] Unnecessary default type arguments 23 23 | return None 24 24 | - Run `ruff check --fix` to apply this fix. - UP043.py:31:21: UP043 [*] Unnecessary default type arguments | 31 | async def func() -> AsyncGenerator[int, None]: @@ -74,6 +68,4 @@ UP043.py:31:21: UP043 [*] Unnecessary default type arguments 31 |+async def func() -> AsyncGenerator[int]: 32 32 | yield 42 33 33 | -34 34 | - - Run `ruff check --fix` to apply this fix. +34 34 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__async_timeout_error_alias_not_applied_py310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__async_timeout_error_alias_not_applied_py310.snap index a86308caa128b..e432e6796d2ac 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__async_timeout_error_alias_not_applied_py310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__async_timeout_error_alias_not_applied_py310.snap @@ -20,8 +20,6 @@ UP041.py:10:8: UP041 [*] Replace aliased errors with `TimeoutError` 12 12 | 13 13 | # Should NOT be in parentheses when replaced - Run `ruff check --fix` to apply this fix. - UP041.py:22:8: UP041 [*] Replace aliased errors with `TimeoutError` | 20 | try: @@ -41,8 +39,6 @@ UP041.py:22:8: UP041 [*] Replace aliased errors with `TimeoutError` 24 24 | 25 25 | try: - Run `ruff check --fix` to apply this fix. - UP041.py:27:8: UP041 [*] Replace aliased errors with `TimeoutError` | 25 | try: @@ -62,8 +58,6 @@ UP041.py:27:8: UP041 [*] Replace aliased errors with `TimeoutError` 29 29 | 30 30 | # Should be kept in parentheses (because multiple) - Run `ruff check --fix` to apply this fix. - UP041.py:34:8: UP041 [*] Replace aliased errors with `TimeoutError` | 32 | try: @@ -82,5 +76,3 @@ UP041.py:34:8: UP041 [*] Replace aliased errors with `TimeoutError` 35 35 | pass 36 36 | 37 37 | # First should change, second should not - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap index e593cb3abc959..a1e5a6d244174 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap @@ -24,8 +24,6 @@ UP017.py:10:11: UP017 [*] Use `datetime.UTC` alias 12 13 | 13 14 | def func(): - Run `ruff check --fix` to apply this fix. - UP017.py:16:11: UP017 [*] Use `datetime.UTC` alias | 14 | from datetime import timezone as tz @@ -49,8 +47,6 @@ UP017.py:16:11: UP017 [*] Use `datetime.UTC` alias 18 19 | 19 20 | def func(): - Run `ruff check --fix` to apply this fix. - UP017.py:22:11: UP017 [*] Use `datetime.UTC` alias | 20 | import datetime @@ -69,8 +65,6 @@ UP017.py:22:11: UP017 [*] Use `datetime.UTC` alias 24 24 | 25 25 | def func(): - Run `ruff check --fix` to apply this fix. - UP017.py:28:11: UP017 [*] Use `datetime.UTC` alias | 26 | import datetime as dt @@ -85,5 +79,3 @@ UP017.py:28:11: UP017 [*] Use `datetime.UTC` alias 27 27 | 28 |- print(dt.timezone.utc) 28 |+ print(dt.UTC) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_keep_runtime_typing_p310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_keep_runtime_typing_p310.snap index 3f2931da043a5..6c8d12578468a 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_keep_runtime_typing_p310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_keep_runtime_typing_p310.snap @@ -19,8 +19,6 @@ future_annotations.py:34:18: UP006 [*] Use `list` instead of `List` for type ann 36 36 | y.append(x) 37 37 | return y - Run `ruff check --fix` to apply this fix. - future_annotations.py:35:9: UP006 [*] Use `list` instead of `List` for type annotation | 34 | def f(x: int) -> List[int]: @@ -40,8 +38,6 @@ future_annotations.py:35:9: UP006 [*] Use `list` instead of `List` for type anno 37 37 | return y 38 38 | - Run `ruff check --fix` to apply this fix. - future_annotations.py:42:27: UP006 [*] Use `list` instead of `List` for type annotation | 40 | x: Optional[int] = None @@ -57,8 +53,6 @@ future_annotations.py:42:27: UP006 [*] Use `list` instead of `List` for type ann 42 |-MyList: TypeAlias = Union[List[int], List[str]] 42 |+MyList: TypeAlias = Union[list[int], List[str]] - Run `ruff check --fix` to apply this fix. - future_annotations.py:42:38: UP006 [*] Use `list` instead of `List` for type annotation | 40 | x: Optional[int] = None @@ -73,5 +67,3 @@ future_annotations.py:42:38: UP006 [*] Use `list` instead of `List` for type ann 41 41 | 42 |-MyList: TypeAlias = Union[List[int], List[str]] 42 |+MyList: TypeAlias = Union[List[int], list[str]] - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap index 3f2931da043a5..6c8d12578468a 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_585_py310.snap @@ -19,8 +19,6 @@ future_annotations.py:34:18: UP006 [*] Use `list` instead of `List` for type ann 36 36 | y.append(x) 37 37 | return y - Run `ruff check --fix` to apply this fix. - future_annotations.py:35:9: UP006 [*] Use `list` instead of `List` for type annotation | 34 | def f(x: int) -> List[int]: @@ -40,8 +38,6 @@ future_annotations.py:35:9: UP006 [*] Use `list` instead of `List` for type anno 37 37 | return y 38 38 | - Run `ruff check --fix` to apply this fix. - future_annotations.py:42:27: UP006 [*] Use `list` instead of `List` for type annotation | 40 | x: Optional[int] = None @@ -57,8 +53,6 @@ future_annotations.py:42:27: UP006 [*] Use `list` instead of `List` for type ann 42 |-MyList: TypeAlias = Union[List[int], List[str]] 42 |+MyList: TypeAlias = Union[list[int], List[str]] - Run `ruff check --fix` to apply this fix. - future_annotations.py:42:38: UP006 [*] Use `list` instead of `List` for type annotation | 40 | x: Optional[int] = None @@ -73,5 +67,3 @@ future_annotations.py:42:38: UP006 [*] Use `list` instead of `List` for type ann 41 41 | 42 |-MyList: TypeAlias = Union[List[int], List[str]] 42 |+MyList: TypeAlias = Union[List[int], list[str]] - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap index 83f827e16ccd3..dbf4b01dfebc7 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap @@ -18,8 +18,6 @@ future_annotations.py:40:4: UP007 [*] Use `X | Y` for type annotations 41 41 | 42 42 | MyList: TypeAlias = Union[List[int], List[str]] - Run `ruff check --fix` to apply this fix. - future_annotations.py:42:21: UP007 [*] Use `X | Y` for type annotations | 40 | x: Optional[int] = None @@ -34,5 +32,3 @@ future_annotations.py:42:21: UP007 [*] Use `X | Y` for type annotations 41 41 | 42 |-MyList: TypeAlias = Union[List[int], List[str]] 42 |+MyList: TypeAlias = List[int] | List[str] - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap index b6eacde73f4ce..a940a12deceee 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap @@ -20,8 +20,6 @@ FURB105.py:3:1: FURB105 [*] Unnecessary empty string passed to `print` 5 5 | print("", end="bar") 6 6 | print("", sep=",", end="bar") - Run `ruff check --fix` to apply this fix. - FURB105.py:4:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 3 | print("") @@ -41,8 +39,6 @@ FURB105.py:4:1: FURB105 [*] Unnecessary empty string and separator passed to `pr 6 6 | print("", sep=",", end="bar") 7 7 | print(sep="") - Run `ruff check --fix` to apply this fix. - FURB105.py:5:1: FURB105 [*] Unnecessary empty string passed to `print` | 3 | print("") @@ -63,8 +59,6 @@ FURB105.py:5:1: FURB105 [*] Unnecessary empty string passed to `print` 7 7 | print(sep="") 8 8 | print("", sep="") - Run `ruff check --fix` to apply this fix. - FURB105.py:6:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 4 | print("", sep=",") @@ -85,8 +79,6 @@ FURB105.py:6:1: FURB105 [*] Unnecessary empty string and separator passed to `pr 8 8 | print("", sep="") 9 9 | print("", "", sep="") - Run `ruff check --fix` to apply this fix. - FURB105.py:7:1: FURB105 [*] Unnecessary separator passed to `print` | 5 | print("", end="bar") @@ -107,8 +99,6 @@ FURB105.py:7:1: FURB105 [*] Unnecessary separator passed to `print` 9 9 | print("", "", sep="") 10 10 | print("", "", sep="", end="") - Run `ruff check --fix` to apply this fix. - FURB105.py:8:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 6 | print("", sep=",", end="bar") @@ -129,8 +119,6 @@ FURB105.py:8:1: FURB105 [*] Unnecessary empty string and separator passed to `pr 10 10 | print("", "", sep="", end="") 11 11 | print("", "", sep="", end="bar") - Run `ruff check --fix` to apply this fix. - FURB105.py:9:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 7 | print(sep="") @@ -151,8 +139,6 @@ FURB105.py:9:1: FURB105 [*] Unnecessary empty string and separator passed to `pr 11 11 | print("", "", sep="", end="bar") 12 12 | print("", sep="", end="bar") - Run `ruff check --fix` to apply this fix. - FURB105.py:10:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 8 | print("", sep="") @@ -173,8 +159,6 @@ FURB105.py:10:1: FURB105 [*] Unnecessary empty string and separator passed to `p 12 12 | print("", sep="", end="bar") 13 13 | print(sep="", end="bar") - Run `ruff check --fix` to apply this fix. - FURB105.py:11:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 9 | print("", "", sep="") @@ -195,8 +179,6 @@ FURB105.py:11:1: FURB105 [*] Unnecessary empty string and separator passed to `p 13 13 | print(sep="", end="bar") 14 14 | print("", "foo", sep="") - Run `ruff check --fix` to apply this fix. - FURB105.py:12:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 10 | print("", "", sep="", end="") @@ -217,8 +199,6 @@ FURB105.py:12:1: FURB105 [*] Unnecessary empty string and separator passed to `p 14 14 | print("", "foo", sep="") 15 15 | print("foo", "", sep="") - Run `ruff check --fix` to apply this fix. - FURB105.py:13:1: FURB105 [*] Unnecessary separator passed to `print` | 11 | print("", "", sep="", end="bar") @@ -239,8 +219,6 @@ FURB105.py:13:1: FURB105 [*] Unnecessary separator passed to `print` 15 15 | print("foo", "", sep="") 16 16 | print("foo", "", "bar", sep="") - Run `ruff check --fix` to apply this fix. - FURB105.py:14:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 12 | print("", sep="", end="bar") @@ -261,8 +239,6 @@ FURB105.py:14:1: FURB105 [*] Unnecessary empty string and separator passed to `p 16 16 | print("foo", "", "bar", sep="") 17 17 | print("", *args) - Run `ruff check --fix` to apply this fix. - FURB105.py:15:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 13 | print(sep="", end="bar") @@ -283,8 +259,6 @@ FURB105.py:15:1: FURB105 [*] Unnecessary empty string and separator passed to `p 17 17 | print("", *args) 18 18 | print("", *args, sep="") - Run `ruff check --fix` to apply this fix. - FURB105.py:16:1: FURB105 [*] Unnecessary empty string passed to `print` | 14 | print("", "foo", sep="") @@ -305,8 +279,6 @@ FURB105.py:16:1: FURB105 [*] Unnecessary empty string passed to `print` 18 18 | print("", *args, sep="") 19 19 | print("", **kwargs) - Run `ruff check --fix` to apply this fix. - FURB105.py:18:1: FURB105 [*] Unnecessary empty string passed to `print` | 16 | print("foo", "", "bar", sep="") @@ -327,8 +299,6 @@ FURB105.py:18:1: FURB105 [*] Unnecessary empty string passed to `print` 20 20 | print(sep="\t") 21 21 | - Run `ruff check --fix` to apply this fix. - FURB105.py:19:1: FURB105 [*] Unnecessary empty string passed to `print` | 17 | print("", *args) @@ -348,8 +318,6 @@ FURB105.py:19:1: FURB105 [*] Unnecessary empty string passed to `print` 21 21 | 22 22 | # OK. - Run `ruff check --fix` to apply this fix. - FURB105.py:20:1: FURB105 [*] Unnecessary separator passed to `print` | 18 | print("", *args, sep="") @@ -368,6 +336,4 @@ FURB105.py:20:1: FURB105 [*] Unnecessary separator passed to `print` 20 |+print() 21 21 | 22 22 | # OK. -23 23 | - - Run `ruff check --fix` to apply this fix. +23 23 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap index 307a8a50abe2e..fe51dcbd1f487 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB110_FURB110.py.snap @@ -16,8 +16,6 @@ FURB110.py:1:5: FURB110 [*] Replace ternary `if` expression with `or` operator 3 3 | z = x \ 4 4 | if x else y # FURB110 - Run `ruff check --fix` to apply this fix. - FURB110.py:3:5: FURB110 [*] Replace ternary `if` expression with `or` operator | 1 | z = x if x else y # FURB110 @@ -40,8 +38,6 @@ FURB110.py:3:5: FURB110 [*] Replace ternary `if` expression with `or` operator 6 5 | z = x if x \ 7 6 | else \ - Run `ruff check --fix` to apply this fix. - FURB110.py:6:5: FURB110 [*] Replace ternary `if` expression with `or` operator | 4 | if x else y # FURB110 @@ -67,8 +63,6 @@ FURB110.py:6:5: FURB110 [*] Replace ternary `if` expression with `or` operator 10 8 | z = x() if x() else y() # FURB110 11 9 | - Run `ruff check --fix` to apply this fix. - FURB110.py:10:5: FURB110 [*] Replace ternary `if` expression with `or` operator | 8 | y # FURB110 @@ -111,8 +105,6 @@ FURB110.py:13:5: FURB110 [*] Replace ternary `if` expression with `or` operator 18 18 | y 19 19 | ) - Run `ruff check --fix` to apply this fix. - FURB110.py:23:5: FURB110 [*] Replace ternary `if` expression with `or` operator | 21 | # FURB110 @@ -143,8 +135,6 @@ FURB110.py:23:5: FURB110 [*] Replace ternary `if` expression with `or` operator 28 28 | y 29 29 | ) - Run `ruff check --fix` to apply this fix. - FURB110.py:34:5: FURB110 [*] Replace ternary `if` expression with `or` operator | 32 | # FURB110 @@ -175,8 +165,6 @@ FURB110.py:34:5: FURB110 [*] Replace ternary `if` expression with `or` operator 41 36 | 42 37 | # FURB110 - Run `ruff check --fix` to apply this fix. - FURB110.py:44:5: FURB110 [*] Replace ternary `if` expression with `or` operator | 42 | # FURB110 @@ -203,5 +191,3 @@ FURB110.py:44:5: FURB110 [*] Replace ternary `if` expression with `or` operator 48 |- else None 46 |+ else None) 49 47 | ) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap index f3f31c1816257..0a141f68b3e34 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB116_FURB116.py.snap @@ -21,8 +21,6 @@ FURB116.py:6:7: FURB116 [*] Replace `oct` call with `f"{num:o}"` 8 8 | print(bin(num)[2:]) # FURB116 9 9 | - Run `ruff check --fix` to apply this fix. - FURB116.py:7:7: FURB116 [*] Replace `hex` call with `f"{num:x}"` | 6 | print(oct(num)[2:]) # FURB116 @@ -41,8 +39,6 @@ FURB116.py:7:7: FURB116 [*] Replace `hex` call with `f"{num:x}"` 9 9 | 10 10 | print(oct(1337)[2:]) # FURB116 - Run `ruff check --fix` to apply this fix. - FURB116.py:8:7: FURB116 [*] Replace `bin` call with `f"{num:b}"` | 6 | print(oct(num)[2:]) # FURB116 @@ -63,8 +59,6 @@ FURB116.py:8:7: FURB116 [*] Replace `bin` call with `f"{num:b}"` 10 10 | print(oct(1337)[2:]) # FURB116 11 11 | print(hex(1337)[2:]) # FURB116 - Run `ruff check --fix` to apply this fix. - FURB116.py:10:7: FURB116 [*] Replace `oct` call with `f"{1337:o}"` | 8 | print(bin(num)[2:]) # FURB116 @@ -85,8 +79,6 @@ FURB116.py:10:7: FURB116 [*] Replace `oct` call with `f"{1337:o}"` 12 12 | print(bin(1337)[2:]) # FURB116 13 13 | - Run `ruff check --fix` to apply this fix. - FURB116.py:11:7: FURB116 [*] Replace `hex` call with `f"{1337:x}"` | 10 | print(oct(1337)[2:]) # FURB116 @@ -105,8 +97,6 @@ FURB116.py:11:7: FURB116 [*] Replace `hex` call with `f"{1337:x}"` 13 13 | 14 14 | print(bin(return_num())[2:]) # FURB116 (no autofix) - Run `ruff check --fix` to apply this fix. - FURB116.py:12:7: FURB116 [*] Replace `bin` call with `f"{1337:b}"` | 10 | print(oct(1337)[2:]) # FURB116 @@ -127,8 +117,6 @@ FURB116.py:12:7: FURB116 [*] Replace `bin` call with `f"{1337:b}"` 14 14 | print(bin(return_num())[2:]) # FURB116 (no autofix) 15 15 | print(bin(int(f"{num}"))[2:]) # FURB116 (no autofix) - Run `ruff check --fix` to apply this fix. - FURB116.py:14:7: FURB116 Replace `bin` call with f-string | 12 | print(bin(1337)[2:]) # FURB116 diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap index 744505325749f..e6f0e8f9d1757 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB118_FURB118.py.snap @@ -19,8 +19,6 @@ FURB118.py:2:13: FURB118 [*] Use `operator.invert` instead of defining a lambda 4 5 | op_pos = lambda x: +x 5 6 | op_neg = lambda x: -x - Run `ruff check --fix` to apply this fix. - FURB118.py:3:10: FURB118 [*] Use `operator.not_` instead of defining a lambda | 1 | # Errors. @@ -41,8 +39,6 @@ FURB118.py:3:10: FURB118 [*] Use `operator.not_` instead of defining a lambda 5 6 | op_neg = lambda x: -x 6 7 | - Run `ruff check --fix` to apply this fix. - FURB118.py:4:10: FURB118 [*] Use `operator.pos` instead of defining a lambda | 2 | op_bitnot = lambda x: ~x @@ -63,8 +59,6 @@ FURB118.py:4:10: FURB118 [*] Use `operator.pos` instead of defining a lambda 6 7 | 7 8 | op_add = lambda x, y: x + y - Run `ruff check --fix` to apply this fix. - FURB118.py:5:10: FURB118 [*] Use `operator.neg` instead of defining a lambda | 3 | op_not = lambda x: not x @@ -87,8 +81,6 @@ FURB118.py:5:10: FURB118 [*] Use `operator.neg` instead of defining a lambda 7 8 | op_add = lambda x, y: x + y 8 9 | op_sub = lambda x, y: x - y - Run `ruff check --fix` to apply this fix. - FURB118.py:7:10: FURB118 [*] Use `operator.add` instead of defining a lambda | 5 | op_neg = lambda x: -x @@ -113,8 +105,6 @@ FURB118.py:7:10: FURB118 [*] Use `operator.add` instead of defining a lambda 9 10 | op_mult = lambda x, y: x * y 10 11 | op_matmutl = lambda x, y: x @ y - Run `ruff check --fix` to apply this fix. - FURB118.py:8:10: FURB118 [*] Use `operator.sub` instead of defining a lambda | 7 | op_add = lambda x, y: x + y @@ -139,8 +129,6 @@ FURB118.py:8:10: FURB118 [*] Use `operator.sub` instead of defining a lambda 10 11 | op_matmutl = lambda x, y: x @ y 11 12 | op_truediv = lambda x, y: x / y - Run `ruff check --fix` to apply this fix. - FURB118.py:9:11: FURB118 [*] Use `operator.mul` instead of defining a lambda | 7 | op_add = lambda x, y: x + y @@ -167,8 +155,6 @@ FURB118.py:9:11: FURB118 [*] Use `operator.mul` instead of defining a lambda 11 12 | op_truediv = lambda x, y: x / y 12 13 | op_mod = lambda x, y: x % y - Run `ruff check --fix` to apply this fix. - FURB118.py:10:14: FURB118 [*] Use `operator.matmul` instead of defining a lambda | 8 | op_sub = lambda x, y: x - y @@ -195,8 +181,6 @@ FURB118.py:10:14: FURB118 [*] Use `operator.matmul` instead of defining a lambda 12 13 | op_mod = lambda x, y: x % y 13 14 | op_pow = lambda x, y: x ** y - Run `ruff check --fix` to apply this fix. - FURB118.py:11:14: FURB118 [*] Use `operator.truediv` instead of defining a lambda | 9 | op_mult = lambda x, y: x * y @@ -223,8 +207,6 @@ FURB118.py:11:14: FURB118 [*] Use `operator.truediv` instead of defining a lambd 13 14 | op_pow = lambda x, y: x ** y 14 15 | op_lshift = lambda x, y: x << y - Run `ruff check --fix` to apply this fix. - FURB118.py:12:10: FURB118 [*] Use `operator.mod` instead of defining a lambda | 10 | op_matmutl = lambda x, y: x @ y @@ -251,8 +233,6 @@ FURB118.py:12:10: FURB118 [*] Use `operator.mod` instead of defining a lambda 14 15 | op_lshift = lambda x, y: x << y 15 16 | op_rshift = lambda x, y: x >> y - Run `ruff check --fix` to apply this fix. - FURB118.py:13:10: FURB118 [*] Use `operator.pow` instead of defining a lambda | 11 | op_truediv = lambda x, y: x / y @@ -279,8 +259,6 @@ FURB118.py:13:10: FURB118 [*] Use `operator.pow` instead of defining a lambda 15 16 | op_rshift = lambda x, y: x >> y 16 17 | op_bitor = lambda x, y: x | y - Run `ruff check --fix` to apply this fix. - FURB118.py:14:13: FURB118 [*] Use `operator.lshift` instead of defining a lambda | 12 | op_mod = lambda x, y: x % y @@ -307,8 +285,6 @@ FURB118.py:14:13: FURB118 [*] Use `operator.lshift` instead of defining a lambda 16 17 | op_bitor = lambda x, y: x | y 17 18 | op_xor = lambda x, y: x ^ y - Run `ruff check --fix` to apply this fix. - FURB118.py:15:13: FURB118 [*] Use `operator.rshift` instead of defining a lambda | 13 | op_pow = lambda x, y: x ** y @@ -335,8 +311,6 @@ FURB118.py:15:13: FURB118 [*] Use `operator.rshift` instead of defining a lambda 17 18 | op_xor = lambda x, y: x ^ y 18 19 | op_bitand = lambda x, y: x & y - Run `ruff check --fix` to apply this fix. - FURB118.py:16:12: FURB118 [*] Use `operator.or_` instead of defining a lambda | 14 | op_lshift = lambda x, y: x << y @@ -363,8 +337,6 @@ FURB118.py:16:12: FURB118 [*] Use `operator.or_` instead of defining a lambda 18 19 | op_bitand = lambda x, y: x & y 19 20 | op_floordiv = lambda x, y: x // y - Run `ruff check --fix` to apply this fix. - FURB118.py:17:10: FURB118 [*] Use `operator.xor` instead of defining a lambda | 15 | op_rshift = lambda x, y: x >> y @@ -391,8 +363,6 @@ FURB118.py:17:10: FURB118 [*] Use `operator.xor` instead of defining a lambda 19 20 | op_floordiv = lambda x, y: x // y 20 21 | - Run `ruff check --fix` to apply this fix. - FURB118.py:18:13: FURB118 [*] Use `operator.and_` instead of defining a lambda | 16 | op_bitor = lambda x, y: x | y @@ -418,8 +388,6 @@ FURB118.py:18:13: FURB118 [*] Use `operator.and_` instead of defining a lambda 20 21 | 21 22 | op_eq = lambda x, y: x == y - Run `ruff check --fix` to apply this fix. - FURB118.py:19:15: FURB118 [*] Use `operator.floordiv` instead of defining a lambda | 17 | op_xor = lambda x, y: x ^ y @@ -446,8 +414,6 @@ FURB118.py:19:15: FURB118 [*] Use `operator.floordiv` instead of defining a lamb 21 22 | op_eq = lambda x, y: x == y 22 23 | op_ne = lambda x, y: x != y - Run `ruff check --fix` to apply this fix. - FURB118.py:21:9: FURB118 [*] Use `operator.eq` instead of defining a lambda | 19 | op_floordiv = lambda x, y: x // y @@ -474,8 +440,6 @@ FURB118.py:21:9: FURB118 [*] Use `operator.eq` instead of defining a lambda 23 24 | op_lt = lambda x, y: x < y 24 25 | op_lte = lambda x, y: x <= y - Run `ruff check --fix` to apply this fix. - FURB118.py:22:9: FURB118 [*] Use `operator.ne` instead of defining a lambda | 21 | op_eq = lambda x, y: x == y @@ -501,8 +465,6 @@ FURB118.py:22:9: FURB118 [*] Use `operator.ne` instead of defining a lambda 24 25 | op_lte = lambda x, y: x <= y 25 26 | op_gt = lambda x, y: x > y - Run `ruff check --fix` to apply this fix. - FURB118.py:23:9: FURB118 [*] Use `operator.lt` instead of defining a lambda | 21 | op_eq = lambda x, y: x == y @@ -529,8 +491,6 @@ FURB118.py:23:9: FURB118 [*] Use `operator.lt` instead of defining a lambda 25 26 | op_gt = lambda x, y: x > y 26 27 | op_gte = lambda x, y: x >= y - Run `ruff check --fix` to apply this fix. - FURB118.py:24:10: FURB118 [*] Use `operator.le` instead of defining a lambda | 22 | op_ne = lambda x, y: x != y @@ -557,8 +517,6 @@ FURB118.py:24:10: FURB118 [*] Use `operator.le` instead of defining a lambda 26 27 | op_gte = lambda x, y: x >= y 27 28 | op_is = lambda x, y: x is y - Run `ruff check --fix` to apply this fix. - FURB118.py:25:9: FURB118 [*] Use `operator.gt` instead of defining a lambda | 23 | op_lt = lambda x, y: x < y @@ -585,8 +543,6 @@ FURB118.py:25:9: FURB118 [*] Use `operator.gt` instead of defining a lambda 27 28 | op_is = lambda x, y: x is y 28 29 | op_isnot = lambda x, y: x is not y - Run `ruff check --fix` to apply this fix. - FURB118.py:26:10: FURB118 [*] Use `operator.ge` instead of defining a lambda | 24 | op_lte = lambda x, y: x <= y @@ -613,8 +569,6 @@ FURB118.py:26:10: FURB118 [*] Use `operator.ge` instead of defining a lambda 28 29 | op_isnot = lambda x, y: x is not y 29 30 | op_in = lambda x, y: y in x - Run `ruff check --fix` to apply this fix. - FURB118.py:27:9: FURB118 [*] Use `operator.is_` instead of defining a lambda | 25 | op_gt = lambda x, y: x > y @@ -641,8 +595,6 @@ FURB118.py:27:9: FURB118 [*] Use `operator.is_` instead of defining a lambda 29 30 | op_in = lambda x, y: y in x 30 31 | op_itemgetter = lambda x: x[0] - Run `ruff check --fix` to apply this fix. - FURB118.py:28:12: FURB118 [*] Use `operator.is_not` instead of defining a lambda | 26 | op_gte = lambda x, y: x >= y @@ -669,8 +621,6 @@ FURB118.py:28:12: FURB118 [*] Use `operator.is_not` instead of defining a lambda 30 31 | op_itemgetter = lambda x: x[0] 31 32 | op_itemgetter = lambda x: (x[0], x[1], x[2]) - Run `ruff check --fix` to apply this fix. - FURB118.py:29:9: FURB118 [*] Use `operator.contains` instead of defining a lambda | 27 | op_is = lambda x, y: x is y @@ -697,8 +647,6 @@ FURB118.py:29:9: FURB118 [*] Use `operator.contains` instead of defining a lambd 31 32 | op_itemgetter = lambda x: (x[0], x[1], x[2]) 32 33 | op_itemgetter = lambda x: (x[1:], x[2]) - Run `ruff check --fix` to apply this fix. - FURB118.py:30:17: FURB118 [*] Use `operator.itemgetter(0)` instead of defining a lambda | 28 | op_isnot = lambda x, y: x is not y @@ -725,8 +673,6 @@ FURB118.py:30:17: FURB118 [*] Use `operator.itemgetter(0)` instead of defining a 32 33 | op_itemgetter = lambda x: (x[1:], x[2]) 33 34 | op_itemgetter = lambda x: x[:] - Run `ruff check --fix` to apply this fix. - FURB118.py:31:17: FURB118 [*] Use `operator.itemgetter(0, 1, 2)` instead of defining a lambda | 29 | op_in = lambda x, y: y in x @@ -753,8 +699,6 @@ FURB118.py:31:17: FURB118 [*] Use `operator.itemgetter(0, 1, 2)` instead of defi 33 34 | op_itemgetter = lambda x: x[:] 34 35 | op_itemgetter = lambda x: x[0, 1] - Run `ruff check --fix` to apply this fix. - FURB118.py:32:17: FURB118 [*] Use `operator.itemgetter(slice(1, None), 2)` instead of defining a lambda | 30 | op_itemgetter = lambda x: x[0] @@ -781,8 +725,6 @@ FURB118.py:32:17: FURB118 [*] Use `operator.itemgetter(slice(1, None), 2)` inste 34 35 | op_itemgetter = lambda x: x[0, 1] 35 36 | op_itemgetter = lambda x: x[(0, 1)] - Run `ruff check --fix` to apply this fix. - FURB118.py:33:17: FURB118 [*] Use `operator.itemgetter(slice(None))` instead of defining a lambda | 31 | op_itemgetter = lambda x: (x[0], x[1], x[2]) @@ -809,8 +751,6 @@ FURB118.py:33:17: FURB118 [*] Use `operator.itemgetter(slice(None))` instead of 35 36 | op_itemgetter = lambda x: x[(0, 1)] 36 37 | - Run `ruff check --fix` to apply this fix. - FURB118.py:34:17: FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defining a lambda | 32 | op_itemgetter = lambda x: (x[1:], x[2]) @@ -836,8 +776,6 @@ FURB118.py:34:17: FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defin 36 37 | 37 38 | - Run `ruff check --fix` to apply this fix. - FURB118.py:35:17: FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defining a lambda | 33 | op_itemgetter = lambda x: x[:] @@ -862,8 +800,6 @@ FURB118.py:35:17: FURB118 [*] Use `operator.itemgetter((0, 1))` instead of defin 37 38 | 38 39 | def op_not2(x): - Run `ruff check --fix` to apply this fix. - FURB118.py:38:5: FURB118 Use `operator.not_` instead of defining a function | 38 | def op_not2(x): diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap index bcdfc7b468847..6612ab30090ae 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB136_FURB136.py.snap @@ -21,8 +21,6 @@ FURB136.py:4:1: FURB136 [*] Replace `x if x > y else y` with `max(y, x)` 6 6 | x if x >= y else y # FURB136 7 7 | - Run `ruff check --fix` to apply this fix. - FURB136.py:6:1: FURB136 [*] Replace `x if x >= y else y` with `max(x, y)` | 4 | x if x > y else y # FURB136 @@ -43,8 +41,6 @@ FURB136.py:6:1: FURB136 [*] Replace `x if x >= y else y` with `max(x, y)` 8 8 | x if x < y else y # FURB136 9 9 | - Run `ruff check --fix` to apply this fix. - FURB136.py:8:1: FURB136 [*] Replace `x if x < y else y` with `min(y, x)` | 6 | x if x >= y else y # FURB136 @@ -65,8 +61,6 @@ FURB136.py:8:1: FURB136 [*] Replace `x if x < y else y` with `min(y, x)` 10 10 | x if x <= y else y # FURB136 11 11 | - Run `ruff check --fix` to apply this fix. - FURB136.py:10:1: FURB136 [*] Replace `x if x <= y else y` with `min(x, y)` | 8 | x if x < y else y # FURB136 @@ -87,8 +81,6 @@ FURB136.py:10:1: FURB136 [*] Replace `x if x <= y else y` with `min(x, y)` 12 12 | y if x > y else x # FURB136 13 13 | - Run `ruff check --fix` to apply this fix. - FURB136.py:12:1: FURB136 [*] Replace `y if x > y else x` with `min(x, y)` | 10 | x if x <= y else y # FURB136 @@ -109,8 +101,6 @@ FURB136.py:12:1: FURB136 [*] Replace `y if x > y else x` with `min(x, y)` 14 14 | y if x >= y else x # FURB136 15 15 | - Run `ruff check --fix` to apply this fix. - FURB136.py:14:1: FURB136 [*] Replace `y if x >= y else x` with `min(y, x)` | 12 | y if x > y else x # FURB136 @@ -131,8 +121,6 @@ FURB136.py:14:1: FURB136 [*] Replace `y if x >= y else x` with `min(y, x)` 16 16 | y if x < y else x # FURB136 17 17 | - Run `ruff check --fix` to apply this fix. - FURB136.py:16:1: FURB136 [*] Replace `y if x < y else x` with `max(x, y)` | 14 | y if x >= y else x # FURB136 @@ -153,8 +141,6 @@ FURB136.py:16:1: FURB136 [*] Replace `y if x < y else x` with `max(x, y)` 18 18 | y if x <= y else x # FURB136 19 19 | - Run `ruff check --fix` to apply this fix. - FURB136.py:18:1: FURB136 [*] Replace `y if x <= y else x` with `max(y, x)` | 16 | y if x < y else x # FURB136 @@ -175,8 +161,6 @@ FURB136.py:18:1: FURB136 [*] Replace `y if x <= y else x` with `max(y, x)` 20 20 | x + y if x > y else y # OK 21 21 | - Run `ruff check --fix` to apply this fix. - FURB136.py:22:1: FURB136 [*] Replace `if` expression with `max(y, x)` | 20 | x + y if x > y else y # OK @@ -197,5 +181,3 @@ FURB136.py:22:1: FURB136 [*] Replace `if` expression with `max(y, x)` 24 |- > y 25 |-) else y # FURB136 22 |+max(y, x) # FURB136 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap index d07440558c156..425158300611f 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap @@ -24,8 +24,6 @@ FURB140.py:7:1: FURB140 [*] Use `itertools.starmap` instead of the generator 9 10 | # FURB140 10 11 | (print(x, y) for x, y in zipped()) - Run `ruff check --fix` to apply this fix. - FURB140.py:10:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 9 | # FURB140 @@ -50,8 +48,6 @@ FURB140.py:10:1: FURB140 [*] Use `itertools.starmap` instead of the generator 12 13 | # FURB140 13 14 | {print(x, y) for x, y in zipped()} - Run `ruff check --fix` to apply this fix. - FURB140.py:13:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 12 | # FURB140 @@ -74,8 +70,6 @@ FURB140.py:13:1: FURB140 [*] Use `itertools.starmap` instead of the generator 15 16 | 16 17 | from itertools import starmap as sm - Run `ruff check --fix` to apply this fix. - FURB140.py:19:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 18 | # FURB140 @@ -95,8 +89,6 @@ FURB140.py:19:1: FURB140 [*] Use `itertools.starmap` instead of the generator 21 21 | # FURB140 22 22 | (print(x, y) for x, y in zipped()) - Run `ruff check --fix` to apply this fix. - FURB140.py:22:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 21 | # FURB140 @@ -116,8 +108,6 @@ FURB140.py:22:1: FURB140 [*] Use `itertools.starmap` instead of the generator 24 24 | # FURB140 25 25 | {print(x, y) for x, y in zipped()} - Run `ruff check --fix` to apply this fix. - FURB140.py:25:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 24 | # FURB140 @@ -137,8 +127,6 @@ FURB140.py:25:1: FURB140 [*] Use `itertools.starmap` instead of the generator 27 27 | # FURB140 (check it still flags starred arguments). 28 28 | # See https://github.com/astral-sh/ruff/issues/7636 - Run `ruff check --fix` to apply this fix. - FURB140.py:29:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 27 | # FURB140 (check it still flags starred arguments). @@ -159,8 +147,6 @@ FURB140.py:29:1: FURB140 [*] Use `itertools.starmap` instead of the generator 31 31 | {foo(*t) for t in [(85, 60), (100, 80)]} 32 32 | - Run `ruff check --fix` to apply this fix. - FURB140.py:30:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 28 | # See https://github.com/astral-sh/ruff/issues/7636 @@ -180,8 +166,6 @@ FURB140.py:30:1: FURB140 [*] Use `itertools.starmap` instead of the generator 32 32 | 33 33 | # Non-errors. - Run `ruff check --fix` to apply this fix. - FURB140.py:31:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 29 | [foo(*t) for t in [(85, 60), (100, 80)]] @@ -200,6 +184,4 @@ FURB140.py:31:1: FURB140 [*] Use `itertools.starmap` instead of the generator 31 |+set(sm(foo, [(85, 60), (100, 80)])) 32 32 | 33 33 | # Non-errors. -34 34 | - - Run `ruff check --fix` to apply this fix. +34 34 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap index 075b93eb5df0a..198adfb0b13b0 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB142_FURB142.py.snap @@ -23,8 +23,6 @@ FURB142.py:5:1: FURB142 [*] Use of `set.add()` in a for loop 8 7 | for x in {1, 2, 3}: 9 8 | s.add(x) - Run `ruff check --fix` to apply this fix. - FURB142.py:8:1: FURB142 [*] Use of `set.add()` in a for loop | 6 | s.add(x) @@ -47,8 +45,6 @@ FURB142.py:8:1: FURB142 [*] Use of `set.add()` in a for loop 11 10 | for x in (1, 2, 3): 12 11 | s.add(x) - Run `ruff check --fix` to apply this fix. - FURB142.py:11:1: FURB142 [*] Use of `set.add()` in a for loop | 9 | s.add(x) @@ -71,8 +67,6 @@ FURB142.py:11:1: FURB142 [*] Use of `set.add()` in a for loop 14 13 | for x in (1, 2, 3): 15 14 | s.discard(x) - Run `ruff check --fix` to apply this fix. - FURB142.py:14:1: FURB142 [*] Use of `set.discard()` in a for loop | 12 | s.add(x) @@ -95,8 +89,6 @@ FURB142.py:14:1: FURB142 [*] Use of `set.discard()` in a for loop 17 16 | for x in (1, 2, 3): 18 17 | s.add(x + 1) - Run `ruff check --fix` to apply this fix. - FURB142.py:17:1: FURB142 [*] Use of `set.add()` in a for loop | 15 | s.discard(x) @@ -119,8 +111,6 @@ FURB142.py:17:1: FURB142 [*] Use of `set.add()` in a for loop 20 19 | for x, y in ((1, 2), (3, 4)): 21 20 | s.add((x, y)) - Run `ruff check --fix` to apply this fix. - FURB142.py:20:1: FURB142 [*] Use of `set.add()` in a for loop | 18 | s.add(x + 1) @@ -143,8 +133,6 @@ FURB142.py:20:1: FURB142 [*] Use of `set.add()` in a for loop 23 22 | num = 123 24 23 | - Run `ruff check --fix` to apply this fix. - FURB142.py:25:1: FURB142 [*] Use of `set.add()` in a for loop | 23 | num = 123 @@ -167,8 +155,6 @@ FURB142.py:25:1: FURB142 [*] Use of `set.add()` in a for loop 28 27 | for x in (1, 2, 3): 29 28 | s.add((num, x)) - Run `ruff check --fix` to apply this fix. - FURB142.py:28:1: FURB142 [*] Use of `set.add()` in a for loop | 26 | s.add(num) @@ -191,8 +177,6 @@ FURB142.py:28:1: FURB142 [*] Use of `set.add()` in a for loop 31 30 | for x in (1, 2, 3): 32 31 | s.add(x + num) - Run `ruff check --fix` to apply this fix. - FURB142.py:31:1: FURB142 [*] Use of `set.add()` in a for loop | 29 | s.add((num, x)) @@ -213,6 +197,4 @@ FURB142.py:31:1: FURB142 [*] Use of `set.add()` in a for loop 31 |+s.update(x + num for x in (1, 2, 3)) 33 32 | 34 33 | # False negative -35 34 | - - Run `ruff check --fix` to apply this fix. +35 34 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap index 39bf463993065..3c00b0028410e 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap @@ -20,8 +20,6 @@ FURB145.py:4:5: FURB145 [*] Prefer `copy` method over slicing 6 6 | d, e = l[:], 1 7 7 | m = l[::] - Run `ruff check --fix` to apply this fix. - FURB145.py:5:11: FURB145 [*] Prefer `copy` method over slicing | 3 | # Errors. @@ -42,8 +40,6 @@ FURB145.py:5:11: FURB145 [*] Prefer `copy` method over slicing 7 7 | m = l[::] 8 8 | l[:] - Run `ruff check --fix` to apply this fix. - FURB145.py:6:8: FURB145 [*] Prefer `copy` method over slicing | 4 | a = l[:] @@ -64,8 +60,6 @@ FURB145.py:6:8: FURB145 [*] Prefer `copy` method over slicing 8 8 | l[:] 9 9 | print(l[:]) - Run `ruff check --fix` to apply this fix. - FURB145.py:7:5: FURB145 [*] Prefer `copy` method over slicing | 5 | b, c = 1, l[:] @@ -86,8 +80,6 @@ FURB145.py:7:5: FURB145 [*] Prefer `copy` method over slicing 9 9 | print(l[:]) 10 10 | - Run `ruff check --fix` to apply this fix. - FURB145.py:8:1: FURB145 [*] Prefer `copy` method over slicing | 6 | d, e = l[:], 1 @@ -107,8 +99,6 @@ FURB145.py:8:1: FURB145 [*] Prefer `copy` method over slicing 10 10 | 11 11 | # False negatives. - Run `ruff check --fix` to apply this fix. - FURB145.py:9:7: FURB145 [*] Prefer `copy` method over slicing | 7 | m = l[::] @@ -128,5 +118,3 @@ FURB145.py:9:7: FURB145 [*] Prefer `copy` method over slicing 10 10 | 11 11 | # False negatives. 12 12 | aa = a[:] # Type inference. - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap index cd38704a74977..f1c76ec8c16a0 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB152_FURB152.py.snap @@ -21,8 +21,6 @@ FURB152.py:3:5: FURB152 [*] Replace `3.14` with `math.pi` 5 6 | C = 6.28 * r # FURB152 6 7 | - Run `ruff check --fix` to apply this fix. - FURB152.py:5:5: FURB152 [*] Replace `6.28` with `math.tau` | 3 | A = 3.14 * r ** 2 # FURB152 @@ -45,8 +43,6 @@ FURB152.py:5:5: FURB152 [*] Replace `6.28` with `math.tau` 7 8 | e = 2.71 # FURB152 8 9 | - Run `ruff check --fix` to apply this fix. - FURB152.py:7:5: FURB152 [*] Replace `2.71` with `math.e` | 5 | C = 6.28 * r # FURB152 @@ -71,8 +67,6 @@ FURB152.py:7:5: FURB152 [*] Replace `2.71` with `math.e` 9 10 | r = 3.15 # OK 10 11 | - Run `ruff check --fix` to apply this fix. - FURB152.py:11:5: FURB152 [*] Replace `3.141` with `math.pi` | 9 | r = 3.15 # OK @@ -98,8 +92,6 @@ FURB152.py:11:5: FURB152 [*] Replace `3.141` with `math.pi` 13 14 | r = 3.142 # FURB152 14 15 | - Run `ruff check --fix` to apply this fix. - FURB152.py:13:5: FURB152 [*] Replace `3.142` with `math.pi` | 11 | r = 3.141 # FURB152 @@ -125,8 +117,6 @@ FURB152.py:13:5: FURB152 [*] Replace `3.142` with `math.pi` 15 16 | r = 3.1415 # FURB152 16 17 | - Run `ruff check --fix` to apply this fix. - FURB152.py:15:5: FURB152 [*] Replace `3.1415` with `math.pi` | 13 | r = 3.142 # FURB152 @@ -152,8 +142,6 @@ FURB152.py:15:5: FURB152 [*] Replace `3.1415` with `math.pi` 17 18 | r = 3.1416 # FURB152 18 19 | - Run `ruff check --fix` to apply this fix. - FURB152.py:17:5: FURB152 [*] Replace `3.1416` with `math.pi` | 15 | r = 3.1415 # FURB152 @@ -179,8 +167,6 @@ FURB152.py:17:5: FURB152 [*] Replace `3.1416` with `math.pi` 19 20 | r = 3.141592 # FURB152 20 21 | - Run `ruff check --fix` to apply this fix. - FURB152.py:19:5: FURB152 [*] Replace `3.141592` with `math.pi` | 17 | r = 3.1416 # FURB152 @@ -206,8 +192,6 @@ FURB152.py:19:5: FURB152 [*] Replace `3.141592` with `math.pi` 21 22 | r = 3.141593 # FURB152 22 23 | - Run `ruff check --fix` to apply this fix. - FURB152.py:21:5: FURB152 [*] Replace `3.141593` with `math.pi` | 19 | r = 3.141592 # FURB152 @@ -233,8 +217,6 @@ FURB152.py:21:5: FURB152 [*] Replace `3.141593` with `math.pi` 23 24 | r = 3.14159265 # FURB152 24 25 | - Run `ruff check --fix` to apply this fix. - FURB152.py:23:5: FURB152 [*] Replace `3.14159265` with `math.pi` | 21 | r = 3.141593 # FURB152 @@ -260,8 +242,6 @@ FURB152.py:23:5: FURB152 [*] Replace `3.14159265` with `math.pi` 25 26 | r = 3.141592653589793238462643383279 # FURB152 26 27 | - Run `ruff check --fix` to apply this fix. - FURB152.py:25:5: FURB152 [*] Replace `3.141592653589793238462643383279` with `math.pi` | 23 | r = 3.14159265 # FURB152 @@ -287,8 +267,6 @@ FURB152.py:25:5: FURB152 [*] Replace `3.141592653589793238462643383279` with `ma 27 28 | r = 3.14159266 # OK 28 29 | - Run `ruff check --fix` to apply this fix. - FURB152.py:31:5: FURB152 [*] Replace `2.718` with `math.e` | 29 | e = 2.7 # OK @@ -314,8 +292,6 @@ FURB152.py:31:5: FURB152 [*] Replace `2.718` with `math.e` 33 34 | e = 2.7182 # FURB152 34 35 | - Run `ruff check --fix` to apply this fix. - FURB152.py:33:5: FURB152 [*] Replace `2.7182` with `math.e` | 31 | e = 2.718 # FURB152 @@ -341,8 +317,6 @@ FURB152.py:33:5: FURB152 [*] Replace `2.7182` with `math.e` 35 36 | e = 2.7183 # FURB152 36 37 | - Run `ruff check --fix` to apply this fix. - FURB152.py:35:5: FURB152 [*] Replace `2.7183` with `math.e` | 33 | e = 2.7182 # FURB152 @@ -368,8 +342,6 @@ FURB152.py:35:5: FURB152 [*] Replace `2.7183` with `math.e` 37 38 | e = 2.719 # OK 38 39 | - Run `ruff check --fix` to apply this fix. - FURB152.py:45:5: FURB152 [*] Replace `2.7182000000000001` with `math.e` | 43 | e = 2.718200000000001 # OK @@ -389,5 +361,3 @@ FURB152.py:45:5: FURB152 [*] Replace `2.7182000000000001` with `math.e` 44 45 | 45 |-e = 2.7182000000000001 # FURB152 46 |+e = math.e # FURB152 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB154_FURB154.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB154_FURB154.py.snap index 765cf9d29cdca..5f8d208fa3bbf 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB154_FURB154.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB154_FURB154.py.snap @@ -21,8 +21,6 @@ FURB154.py:4:5: FURB154 [*] Use of repeated consecutive `global` 7 6 | 8 7 | def f3(): - Run `ruff check --fix` to apply this fix. - FURB154.py:9:5: FURB154 [*] Use of repeated consecutive `global` | 8 | def f3(): @@ -45,8 +43,6 @@ FURB154.py:9:5: FURB154 [*] Use of repeated consecutive `global` 13 11 | 14 12 | def f4(): - Run `ruff check --fix` to apply this fix. - FURB154.py:15:5: FURB154 [*] Use of repeated consecutive `global` | 14 | def f4(): @@ -69,8 +65,6 @@ FURB154.py:15:5: FURB154 [*] Use of repeated consecutive `global` 18 17 | global x 19 18 | global y - Run `ruff check --fix` to apply this fix. - FURB154.py:18:5: FURB154 [*] Use of repeated consecutive `global` | 16 | global y @@ -92,8 +86,6 @@ FURB154.py:18:5: FURB154 [*] Use of repeated consecutive `global` 21 20 | 22 21 | def f2(): - Run `ruff check --fix` to apply this fix. - FURB154.py:26:9: FURB154 [*] Use of repeated consecutive `nonlocal` | 25 | def inner(): @@ -116,8 +108,6 @@ FURB154.py:26:9: FURB154 [*] Use of repeated consecutive `nonlocal` 29 28 | def inner2(): 30 29 | nonlocal x - Run `ruff check --fix` to apply this fix. - FURB154.py:30:9: FURB154 [*] Use of repeated consecutive `nonlocal` | 29 | def inner2(): @@ -142,8 +132,6 @@ FURB154.py:30:9: FURB154 [*] Use of repeated consecutive `nonlocal` 34 32 | def inner3(): 35 33 | nonlocal x - Run `ruff check --fix` to apply this fix. - FURB154.py:35:9: FURB154 [*] Use of repeated consecutive `nonlocal` | 34 | def inner3(): @@ -166,8 +154,6 @@ FURB154.py:35:9: FURB154 [*] Use of repeated consecutive `nonlocal` 38 37 | nonlocal x 39 38 | nonlocal y - Run `ruff check --fix` to apply this fix. - FURB154.py:38:9: FURB154 [*] Use of repeated consecutive `nonlocal` | 36 | nonlocal y @@ -189,8 +175,6 @@ FURB154.py:38:9: FURB154 [*] Use of repeated consecutive `nonlocal` 41 40 | 42 41 | def f5(): - Run `ruff check --fix` to apply this fix. - FURB154.py:46:9: FURB154 [*] Use of repeated consecutive `global` | 45 | def inner(): @@ -213,8 +197,6 @@ FURB154.py:46:9: FURB154 [*] Use of repeated consecutive `global` 49 48 | nonlocal z 50 49 | - Run `ruff check --fix` to apply this fix. - FURB154.py:48:9: FURB154 [*] Use of repeated consecutive `nonlocal` | 46 | global w @@ -238,8 +220,6 @@ FURB154.py:48:9: FURB154 [*] Use of repeated consecutive `nonlocal` 51 50 | def inner2(): 52 51 | global x - Run `ruff check --fix` to apply this fix. - FURB154.py:53:9: FURB154 [*] Use of repeated consecutive `nonlocal` | 51 | def inner2(): @@ -261,8 +241,6 @@ FURB154.py:53:9: FURB154 [*] Use of repeated consecutive `nonlocal` 56 55 | 57 56 | def f6(): - Run `ruff check --fix` to apply this fix. - FURB154.py:58:5: FURB154 [*] Use of repeated consecutive `global` | 57 | def f6(): @@ -284,5 +262,3 @@ FURB154.py:58:5: FURB154 [*] Use of repeated consecutive `global` 61 59 | 62 60 | 63 61 | # Ok - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap index b1c6ee68a69f8..908e0c3ace646 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB157_FURB157.py.snap @@ -20,8 +20,6 @@ FURB157.py:5:9: FURB157 [*] Verbose expression in `Decimal` constructor 7 7 | Decimal(float("Infinity")) 8 8 | Decimal(float("-Infinity")) - Run `ruff check --fix` to apply this fix. - FURB157.py:6:9: FURB157 [*] Verbose expression in `Decimal` constructor | 4 | # Errors @@ -42,8 +40,6 @@ FURB157.py:6:9: FURB157 [*] Verbose expression in `Decimal` constructor 8 8 | Decimal(float("-Infinity")) 9 9 | Decimal(float("inf")) - Run `ruff check --fix` to apply this fix. - FURB157.py:7:9: FURB157 [*] Verbose expression in `Decimal` constructor | 5 | Decimal("0") @@ -64,8 +60,6 @@ FURB157.py:7:9: FURB157 [*] Verbose expression in `Decimal` constructor 9 9 | Decimal(float("inf")) 10 10 | Decimal(float("-inf")) - Run `ruff check --fix` to apply this fix. - FURB157.py:8:9: FURB157 [*] Verbose expression in `Decimal` constructor | 6 | Decimal("-42") @@ -86,8 +80,6 @@ FURB157.py:8:9: FURB157 [*] Verbose expression in `Decimal` constructor 10 10 | Decimal(float("-inf")) 11 11 | Decimal(float("nan")) - Run `ruff check --fix` to apply this fix. - FURB157.py:9:9: FURB157 [*] Verbose expression in `Decimal` constructor | 7 | Decimal(float("Infinity")) @@ -108,8 +100,6 @@ FURB157.py:9:9: FURB157 [*] Verbose expression in `Decimal` constructor 11 11 | Decimal(float("nan")) 12 12 | decimal.Decimal("0") - Run `ruff check --fix` to apply this fix. - FURB157.py:10:9: FURB157 [*] Verbose expression in `Decimal` constructor | 8 | Decimal(float("-Infinity")) @@ -130,8 +120,6 @@ FURB157.py:10:9: FURB157 [*] Verbose expression in `Decimal` constructor 12 12 | decimal.Decimal("0") 13 13 | - Run `ruff check --fix` to apply this fix. - FURB157.py:11:9: FURB157 [*] Verbose expression in `Decimal` constructor | 9 | Decimal(float("inf")) @@ -151,8 +139,6 @@ FURB157.py:11:9: FURB157 [*] Verbose expression in `Decimal` constructor 13 13 | 14 14 | # OK - Run `ruff check --fix` to apply this fix. - FURB157.py:12:17: FURB157 [*] Verbose expression in `Decimal` constructor | 10 | Decimal(float("-inf")) @@ -172,5 +158,3 @@ FURB157.py:12:17: FURB157 [*] Verbose expression in `Decimal` constructor 13 13 | 14 14 | # OK 15 15 | Decimal(0) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap index c4fd18c322c35..a7d017572258e 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB161_FURB161.py.snap @@ -21,8 +21,6 @@ FURB161.py:6:9: FURB161 [*] Use of `bin(x).count('1')` 8 8 | count = bin(0b1010).count("1") # FURB161 9 9 | count = bin(0xA).count("1") # FURB161 - Run `ruff check --fix` to apply this fix. - FURB161.py:7:9: FURB161 [*] Use of `bin(10).count('1')` | 6 | count = bin(x).count("1") # FURB161 @@ -42,8 +40,6 @@ FURB161.py:7:9: FURB161 [*] Use of `bin(10).count('1')` 9 9 | count = bin(0xA).count("1") # FURB161 10 10 | count = bin(0o12).count("1") # FURB161 - Run `ruff check --fix` to apply this fix. - FURB161.py:8:9: FURB161 [*] Use of `bin(0b1010).count('1')` | 6 | count = bin(x).count("1") # FURB161 @@ -64,8 +60,6 @@ FURB161.py:8:9: FURB161 [*] Use of `bin(0b1010).count('1')` 10 10 | count = bin(0o12).count("1") # FURB161 11 11 | count = bin(0x10 + 0x1000).count("1") # FURB161 - Run `ruff check --fix` to apply this fix. - FURB161.py:9:9: FURB161 [*] Use of `bin(0xA).count('1')` | 7 | count = bin(10).count("1") # FURB161 @@ -86,8 +80,6 @@ FURB161.py:9:9: FURB161 [*] Use of `bin(0xA).count('1')` 11 11 | count = bin(0x10 + 0x1000).count("1") # FURB161 12 12 | count = bin(ten()).count("1") # FURB161 - Run `ruff check --fix` to apply this fix. - FURB161.py:10:9: FURB161 [*] Use of `bin(0o12).count('1')` | 8 | count = bin(0b1010).count("1") # FURB161 @@ -108,8 +100,6 @@ FURB161.py:10:9: FURB161 [*] Use of `bin(0o12).count('1')` 12 12 | count = bin(ten()).count("1") # FURB161 13 13 | count = bin((10)).count("1") # FURB161 - Run `ruff check --fix` to apply this fix. - FURB161.py:11:9: FURB161 [*] Use of `bin(0x10 + 0x1000).count('1')` | 9 | count = bin(0xA).count("1") # FURB161 @@ -130,8 +120,6 @@ FURB161.py:11:9: FURB161 [*] Use of `bin(0x10 + 0x1000).count('1')` 13 13 | count = bin((10)).count("1") # FURB161 14 14 | count = bin("10" "15").count("1") # FURB161 - Run `ruff check --fix` to apply this fix. - FURB161.py:12:9: FURB161 [*] Use of `bin(ten()).count('1')` | 10 | count = bin(0o12).count("1") # FURB161 @@ -152,8 +140,6 @@ FURB161.py:12:9: FURB161 [*] Use of `bin(ten()).count('1')` 14 14 | count = bin("10" "15").count("1") # FURB161 15 15 | - Run `ruff check --fix` to apply this fix. - FURB161.py:13:9: FURB161 [*] Use of `bin(10).count('1')` | 11 | count = bin(0x10 + 0x1000).count("1") # FURB161 @@ -173,8 +159,6 @@ FURB161.py:13:9: FURB161 [*] Use of `bin(10).count('1')` 15 15 | 16 16 | count = x.bit_count() # OK - Run `ruff check --fix` to apply this fix. - FURB161.py:14:9: FURB161 [*] Use of `bin("10" "15").count('1')` | 12 | count = bin(ten()).count("1") # FURB161 @@ -194,5 +178,3 @@ FURB161.py:14:9: FURB161 [*] Use of `bin("10" "15").count('1')` 15 15 | 16 16 | count = x.bit_count() # OK 17 17 | count = (10).bit_count() # OK - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap index f184bfd0b184f..561395836fab1 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB163_FURB163.py.snap @@ -20,8 +20,6 @@ FURB163.py:4:1: FURB163 [*] Prefer `math.log2(1)` over `math.log` with a redunda 6 6 | math.log(1, math.e) 7 7 | foo = ... - Run `ruff check --fix` to apply this fix. - FURB163.py:5:1: FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redundant base | 3 | # Errors @@ -42,8 +40,6 @@ FURB163.py:5:1: FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redund 7 7 | foo = ... 8 8 | math.log(foo, 2) - Run `ruff check --fix` to apply this fix. - FURB163.py:6:1: FURB163 [*] Prefer `math.log(1)` over `math.log` with a redundant base | 4 | math.log(1, 2) @@ -64,8 +60,6 @@ FURB163.py:6:1: FURB163 [*] Prefer `math.log(1)` over `math.log` with a redundan 8 8 | math.log(foo, 2) 9 9 | math.log(foo, 10) - Run `ruff check --fix` to apply this fix. - FURB163.py:8:1: FURB163 [*] Prefer `math.log2(foo)` over `math.log` with a redundant base | 6 | math.log(1, math.e) @@ -86,8 +80,6 @@ FURB163.py:8:1: FURB163 [*] Prefer `math.log2(foo)` over `math.log` with a redun 10 10 | math.log(foo, math.e) 11 11 | math.log(1, 2.0) - Run `ruff check --fix` to apply this fix. - FURB163.py:9:1: FURB163 [*] Prefer `math.log10(foo)` over `math.log` with a redundant base | 7 | foo = ... @@ -108,8 +100,6 @@ FURB163.py:9:1: FURB163 [*] Prefer `math.log10(foo)` over `math.log` with a redu 11 11 | math.log(1, 2.0) 12 12 | math.log(1, 10.0) - Run `ruff check --fix` to apply this fix. - FURB163.py:10:1: FURB163 [*] Prefer `math.log(foo)` over `math.log` with a redundant base | 8 | math.log(foo, 2) @@ -130,8 +120,6 @@ FURB163.py:10:1: FURB163 [*] Prefer `math.log(foo)` over `math.log` with a redun 12 12 | math.log(1, 10.0) 13 13 | - Run `ruff check --fix` to apply this fix. - FURB163.py:11:1: FURB163 [*] Prefer `math.log2(1)` over `math.log` with a redundant base | 9 | math.log(foo, 10) @@ -151,8 +139,6 @@ FURB163.py:11:1: FURB163 [*] Prefer `math.log2(1)` over `math.log` with a redund 13 13 | 14 14 | # OK - Run `ruff check --fix` to apply this fix. - FURB163.py:12:1: FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redundant base | 10 | math.log(foo, math.e) @@ -172,5 +158,3 @@ FURB163.py:12:1: FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redun 13 13 | 14 14 | # OK 15 15 | math.log2(1) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap index b054fc6f36c7d..e95c270aa3765 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB164_FURB164.py.snap @@ -20,8 +20,6 @@ FURB164.py:7:5: FURB164 [*] Verbose method `from_float` in `Fraction` constructi 9 9 | _ = Fraction.from_float(5.0) 10 10 | _ = fractions.Fraction.from_float(4.2) - Run `ruff check --fix` to apply this fix. - FURB164.py:8:5: FURB164 [*] Verbose method `from_float` in `Fraction` construction | 6 | # Errors @@ -42,8 +40,6 @@ FURB164.py:8:5: FURB164 [*] Verbose method `from_float` in `Fraction` constructi 10 10 | _ = fractions.Fraction.from_float(4.2) 11 11 | _ = Fraction.from_decimal(Decimal("4.2")) - Run `ruff check --fix` to apply this fix. - FURB164.py:9:5: FURB164 [*] Verbose method `from_float` in `Fraction` construction | 7 | _ = Fraction.from_float(0.1) @@ -64,8 +60,6 @@ FURB164.py:9:5: FURB164 [*] Verbose method `from_float` in `Fraction` constructi 11 11 | _ = Fraction.from_decimal(Decimal("4.2")) 12 12 | _ = Fraction.from_decimal(Decimal("-4.2")) - Run `ruff check --fix` to apply this fix. - FURB164.py:10:5: FURB164 [*] Verbose method `from_float` in `Fraction` construction | 8 | _ = Fraction.from_float(-0.5) @@ -86,8 +80,6 @@ FURB164.py:10:5: FURB164 [*] Verbose method `from_float` in `Fraction` construct 12 12 | _ = Fraction.from_decimal(Decimal("-4.2")) 13 13 | _ = Fraction.from_decimal(Decimal.from_float(4.2)) - Run `ruff check --fix` to apply this fix. - FURB164.py:11:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` construction | 9 | _ = Fraction.from_float(5.0) @@ -108,8 +100,6 @@ FURB164.py:11:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` constru 13 13 | _ = Fraction.from_decimal(Decimal.from_float(4.2)) 14 14 | _ = Decimal.from_float(0.1) - Run `ruff check --fix` to apply this fix. - FURB164.py:12:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` construction | 10 | _ = fractions.Fraction.from_float(4.2) @@ -130,8 +120,6 @@ FURB164.py:12:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` constru 14 14 | _ = Decimal.from_float(0.1) 15 15 | _ = Decimal.from_float(-0.5) - Run `ruff check --fix` to apply this fix. - FURB164.py:13:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` construction | 11 | _ = Fraction.from_decimal(Decimal("4.2")) @@ -152,8 +140,6 @@ FURB164.py:13:5: FURB164 [*] Verbose method `from_decimal` in `Fraction` constru 15 15 | _ = Decimal.from_float(-0.5) 16 16 | _ = Decimal.from_float(5.0) - Run `ruff check --fix` to apply this fix. - FURB164.py:13:27: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 11 | _ = Fraction.from_decimal(Decimal("4.2")) @@ -174,8 +160,6 @@ FURB164.py:13:27: FURB164 [*] Verbose method `from_float` in `Decimal` construct 15 15 | _ = Decimal.from_float(-0.5) 16 16 | _ = Decimal.from_float(5.0) - Run `ruff check --fix` to apply this fix. - FURB164.py:14:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 12 | _ = Fraction.from_decimal(Decimal("-4.2")) @@ -196,8 +180,6 @@ FURB164.py:14:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 16 16 | _ = Decimal.from_float(5.0) 17 17 | _ = decimal.Decimal.from_float(4.2) - Run `ruff check --fix` to apply this fix. - FURB164.py:15:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 13 | _ = Fraction.from_decimal(Decimal.from_float(4.2)) @@ -218,8 +200,6 @@ FURB164.py:15:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 17 17 | _ = decimal.Decimal.from_float(4.2) 18 18 | _ = Decimal.from_float(float("inf")) - Run `ruff check --fix` to apply this fix. - FURB164.py:16:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 14 | _ = Decimal.from_float(0.1) @@ -240,8 +220,6 @@ FURB164.py:16:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 18 18 | _ = Decimal.from_float(float("inf")) 19 19 | _ = Decimal.from_float(float("-inf")) - Run `ruff check --fix` to apply this fix. - FURB164.py:17:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 15 | _ = Decimal.from_float(-0.5) @@ -262,8 +240,6 @@ FURB164.py:17:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 19 19 | _ = Decimal.from_float(float("-inf")) 20 20 | _ = Decimal.from_float(float("Infinity")) - Run `ruff check --fix` to apply this fix. - FURB164.py:18:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 16 | _ = Decimal.from_float(5.0) @@ -284,8 +260,6 @@ FURB164.py:18:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 20 20 | _ = Decimal.from_float(float("Infinity")) 21 21 | _ = Decimal.from_float(float("-Infinity")) - Run `ruff check --fix` to apply this fix. - FURB164.py:19:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 17 | _ = decimal.Decimal.from_float(4.2) @@ -306,8 +280,6 @@ FURB164.py:19:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 21 21 | _ = Decimal.from_float(float("-Infinity")) 22 22 | _ = Decimal.from_float(float("nan")) - Run `ruff check --fix` to apply this fix. - FURB164.py:20:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 18 | _ = Decimal.from_float(float("inf")) @@ -328,8 +300,6 @@ FURB164.py:20:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 22 22 | _ = Decimal.from_float(float("nan")) 23 23 | - Run `ruff check --fix` to apply this fix. - FURB164.py:21:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 19 | _ = Decimal.from_float(float("-inf")) @@ -349,8 +319,6 @@ FURB164.py:21:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 23 23 | 24 24 | # OK - Run `ruff check --fix` to apply this fix. - FURB164.py:22:5: FURB164 [*] Verbose method `from_float` in `Decimal` construction | 20 | _ = Decimal.from_float(float("Infinity")) @@ -370,5 +338,3 @@ FURB164.py:22:5: FURB164 [*] Verbose method `from_float` in `Decimal` constructi 23 23 | 24 24 | # OK 25 25 | _ = Fraction(0.1) - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB167_FURB167.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB167_FURB167.py.snap index cab8d1e076d8e..8340a03ba14d8 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB167_FURB167.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB167_FURB167.py.snap @@ -19,8 +19,6 @@ FURB167.py:13:42: FURB167 [*] Use of regular expression alias `re.I` 15 15 | 16 16 | - Run `ruff check --fix` to apply this fix. - FURB167.py:21:39: FURB167 [*] Use of regular expression alias `re.I` | 20 | # FURB167 @@ -41,5 +39,3 @@ FURB167.py:21:39: FURB167 [*] Use of regular expression alias `re.I` 21 |- if match("^hello", "hello world", I): 22 |+ if match("^hello", "hello world", re.IGNORECASE): 22 23 | pass - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB168_FURB168.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB168_FURB168.py.snap index 2b5fcce658cc5..add40e9b1fdb4 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB168_FURB168.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB168_FURB168.py.snap @@ -20,8 +20,6 @@ FURB168.py:5:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if a 7 7 | 8 8 | if isinstance(foo, (type(None))): - Run `ruff check --fix` to apply this fix. - FURB168.py:8:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 6 | pass @@ -41,8 +39,6 @@ FURB168.py:8:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if a 10 10 | 11 11 | if isinstance(foo, (type(None), type(None), type(None))): - Run `ruff check --fix` to apply this fix. - FURB168.py:11:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 9 | pass @@ -62,8 +58,6 @@ FURB168.py:11:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if 13 13 | 14 14 | if isinstance(foo, None | None): - Run `ruff check --fix` to apply this fix. - FURB168.py:14:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 12 | pass @@ -83,8 +77,6 @@ FURB168.py:14:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if 16 16 | 17 17 | if isinstance(foo, (None | None)): - Run `ruff check --fix` to apply this fix. - FURB168.py:17:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 15 | pass @@ -104,8 +96,6 @@ FURB168.py:17:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if 19 19 | 20 20 | if isinstance(foo, None | type(None)): - Run `ruff check --fix` to apply this fix. - FURB168.py:20:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 18 | pass @@ -125,8 +115,6 @@ FURB168.py:20:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if 22 22 | 23 23 | if isinstance(foo, (None | type(None))): - Run `ruff check --fix` to apply this fix. - FURB168.py:23:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 21 | pass @@ -146,8 +134,6 @@ FURB168.py:23:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if 25 25 | 26 26 | # A bit contrived, but is both technically valid and equivalent to the above. - Run `ruff check --fix` to apply this fix. - FURB168.py:27:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if an object is `None` | 26 | # A bit contrived, but is both technically valid and equivalent to the above. @@ -164,6 +150,4 @@ FURB168.py:27:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if 27 |+if foo is None: 28 28 | pass 29 29 | -30 30 | - - Run `ruff check --fix` to apply this fix. +30 30 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB169_FURB169.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB169_FURB169.py.snap index 01908fcff7321..ba378b0d46255 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB169_FURB169.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB169_FURB169.py.snap @@ -21,8 +21,6 @@ FURB169.py:5:1: FURB169 [*] Compare the identities of `foo` and `None` instead o 7 7 | type(None) is type(foo) 8 8 | - Run `ruff check --fix` to apply this fix. - FURB169.py:7:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 5 | type(foo) is type(None) @@ -43,8 +41,6 @@ FURB169.py:7:1: FURB169 [*] Compare the identities of `foo` and `None` instead o 9 9 | type(None) is type(None) 10 10 | - Run `ruff check --fix` to apply this fix. - FURB169.py:9:1: FURB169 [*] Compare the identities of `None` and `None` instead of their respective types | 7 | type(None) is type(foo) @@ -65,8 +61,6 @@ FURB169.py:9:1: FURB169 [*] Compare the identities of `None` and `None` instead 11 11 | type(foo) is not type(None) 12 12 | - Run `ruff check --fix` to apply this fix. - FURB169.py:11:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 9 | type(None) is type(None) @@ -87,8 +81,6 @@ FURB169.py:11:1: FURB169 [*] Compare the identities of `foo` and `None` instead 13 13 | type(None) is not type(foo) 14 14 | - Run `ruff check --fix` to apply this fix. - FURB169.py:13:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 11 | type(foo) is not type(None) @@ -109,8 +101,6 @@ FURB169.py:13:1: FURB169 [*] Compare the identities of `foo` and `None` instead 15 15 | type(None) is not type(None) 16 16 | - Run `ruff check --fix` to apply this fix. - FURB169.py:15:1: FURB169 [*] Compare the identities of `None` and `None` instead of their respective types | 13 | type(None) is not type(foo) @@ -131,8 +121,6 @@ FURB169.py:15:1: FURB169 [*] Compare the identities of `None` and `None` instead 17 17 | type(foo) == type(None) 18 18 | - Run `ruff check --fix` to apply this fix. - FURB169.py:17:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 15 | type(None) is not type(None) @@ -153,8 +141,6 @@ FURB169.py:17:1: FURB169 [*] Compare the identities of `foo` and `None` instead 19 19 | type(None) == type(foo) 20 20 | - Run `ruff check --fix` to apply this fix. - FURB169.py:19:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 17 | type(foo) == type(None) @@ -175,8 +161,6 @@ FURB169.py:19:1: FURB169 [*] Compare the identities of `foo` and `None` instead 21 21 | type(None) == type(None) 22 22 | - Run `ruff check --fix` to apply this fix. - FURB169.py:21:1: FURB169 [*] Compare the identities of `None` and `None` instead of their respective types | 19 | type(None) == type(foo) @@ -197,8 +181,6 @@ FURB169.py:21:1: FURB169 [*] Compare the identities of `None` and `None` instead 23 23 | type(foo) != type(None) 24 24 | - Run `ruff check --fix` to apply this fix. - FURB169.py:23:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 21 | type(None) == type(None) @@ -219,8 +201,6 @@ FURB169.py:23:1: FURB169 [*] Compare the identities of `foo` and `None` instead 25 25 | type(None) != type(foo) 26 26 | - Run `ruff check --fix` to apply this fix. - FURB169.py:25:1: FURB169 [*] Compare the identities of `foo` and `None` instead of their respective types | 23 | type(foo) != type(None) @@ -241,8 +221,6 @@ FURB169.py:25:1: FURB169 [*] Compare the identities of `foo` and `None` instead 27 27 | type(None) != type(None) 28 28 | - Run `ruff check --fix` to apply this fix. - FURB169.py:27:1: FURB169 [*] Compare the identities of `None` and `None` instead of their respective types | 25 | type(None) != type(foo) @@ -261,6 +239,4 @@ FURB169.py:27:1: FURB169 [*] Compare the identities of `None` and `None` instead 27 |+None is not None 28 28 | 29 29 | # Ok. -30 30 | - - Run `ruff check --fix` to apply this fix. +30 30 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB171_FURB171.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB171_FURB171.py.snap index 134afd53bd31a..c6cbb104b9674 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB171_FURB171.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB171_FURB171.py.snap @@ -19,8 +19,6 @@ FURB171.py:3:4: FURB171 [*] Membership test against single-item container 5 5 | 6 6 | if 1 in [1]: - Run `ruff check --fix` to apply this fix. - FURB171.py:6:4: FURB171 [*] Membership test against single-item container | 4 | print("Single-element tuple") @@ -40,8 +38,6 @@ FURB171.py:6:4: FURB171 [*] Membership test against single-item container 8 8 | 9 9 | if 1 in {1}: - Run `ruff check --fix` to apply this fix. - FURB171.py:9:4: FURB171 [*] Membership test against single-item container | 7 | print("Single-element list") @@ -61,8 +57,6 @@ FURB171.py:9:4: FURB171 [*] Membership test against single-item container 11 11 | 12 12 | if "a" in "a": - Run `ruff check --fix` to apply this fix. - FURB171.py:12:4: FURB171 [*] Membership test against single-item container | 10 | print("Single-element set") @@ -82,8 +76,6 @@ FURB171.py:12:4: FURB171 [*] Membership test against single-item container 14 14 | 15 15 | if 1 not in (1,): - Run `ruff check --fix` to apply this fix. - FURB171.py:15:4: FURB171 [*] Membership test against single-item container | 13 | print("Single-element string") @@ -103,8 +95,6 @@ FURB171.py:15:4: FURB171 [*] Membership test against single-item container 17 17 | 18 18 | if not 1 in (1,): - Run `ruff check --fix` to apply this fix. - FURB171.py:18:8: FURB171 [*] Membership test against single-item container | 16 | print("Check `not in` membership test") @@ -123,5 +113,3 @@ FURB171.py:18:8: FURB171 [*] Membership test against single-item container 19 19 | print("Check the negated membership test") 20 20 | 21 21 | # Non-errors. - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap index be1cff3d645da..d77cee1198248 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB180_FURB180.py.snap @@ -21,8 +21,6 @@ FURB180.py:7:10: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract b 9 9 | def foo(self): pass 10 10 | - Run `ruff check --fix` to apply this fix. - FURB180.py:12:10: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract base class | 12 | class A1(metaclass=ABCMeta): @@ -41,8 +39,6 @@ FURB180.py:12:10: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract 14 14 | def foo(self): pass 15 15 | - Run `ruff check --fix` to apply this fix. - FURB180.py:26:18: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract base class | 26 | class A2(B0, B1, metaclass=ABCMeta): @@ -61,8 +57,6 @@ FURB180.py:26:18: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract 28 28 | def foo(self): pass 29 29 | - Run `ruff check --fix` to apply this fix. - FURB180.py:31:34: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract base class | 31 | class A3(B0, before_metaclass=1, metaclass=abc.ABCMeta): @@ -78,6 +72,4 @@ FURB180.py:31:34: FURB180 [*] Use of `metaclass=abc.ABCMeta` to define abstract 31 |+class A3(B0, abc.ABC, before_metaclass=1): 32 32 | pass 33 33 | -34 34 | - - Run `ruff check --fix` to apply this fix. +34 34 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap index 9bdaa26b4527e..35c64f4df8f63 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB192_FURB192.py.snap @@ -20,8 +20,6 @@ FURB192.py:3:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum 5 5 | sorted(l)[-1] 6 6 | - Run `ruff check --fix` to apply this fix. - FURB192.py:5:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum value in a sequence | 3 | sorted(l)[0] @@ -42,8 +40,6 @@ FURB192.py:5:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum 7 7 | sorted(l, reverse=False)[-1] 8 8 | - Run `ruff check --fix` to apply this fix. - FURB192.py:7:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum value in a sequence | 5 | sorted(l)[-1] @@ -64,8 +60,6 @@ FURB192.py:7:1: FURB192 [*] Prefer `max` over `sorted()` to compute the maximum 9 9 | sorted(l, key=lambda x: x)[0] 10 10 | - Run `ruff check --fix` to apply this fix. - FURB192.py:9:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence | 7 | sorted(l, reverse=False)[-1] @@ -86,8 +80,6 @@ FURB192.py:9:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum 11 11 | sorted(l, key=key_fn)[0] 12 12 | - Run `ruff check --fix` to apply this fix. - FURB192.py:11:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence | 9 | sorted(l, key=lambda x: x)[0] @@ -108,8 +100,6 @@ FURB192.py:11:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum 13 13 | sorted([1, 2, 3])[0] 14 14 | - Run `ruff check --fix` to apply this fix. - FURB192.py:13:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence | 11 | sorted(l, key=key_fn)[0] @@ -130,8 +120,6 @@ FURB192.py:13:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum 15 15 | # Unsafe 16 16 | - Run `ruff check --fix` to apply this fix. - FURB192.py:17:1: FURB192 [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence | 15 | # Unsafe diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF010_RUF010.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF010_RUF010.py.snap index 65e4372778beb..34e5db65729ac 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF010_RUF010.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF010_RUF010.py.snap @@ -19,8 +19,6 @@ RUF010.py:9:4: RUF010 [*] Use explicit conversion flag 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | - Run `ruff check --fix` to apply this fix. - RUF010.py:9:16: RUF010 [*] Use explicit conversion flag | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 @@ -39,8 +37,6 @@ RUF010.py:9:16: RUF010 [*] Use explicit conversion flag 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | - Run `ruff check --fix` to apply this fix. - RUF010.py:9:29: RUF010 [*] Use explicit conversion flag | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 @@ -59,8 +55,6 @@ RUF010.py:9:29: RUF010 [*] Use explicit conversion flag 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | - Run `ruff check --fix` to apply this fix. - RUF010.py:11:4: RUF010 [*] Use explicit conversion flag | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 @@ -81,8 +75,6 @@ RUF010.py:11:4: RUF010 [*] Use explicit conversion flag 13 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 14 14 | - Run `ruff check --fix` to apply this fix. - RUF010.py:11:19: RUF010 [*] Use explicit conversion flag | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 @@ -103,8 +95,6 @@ RUF010.py:11:19: RUF010 [*] Use explicit conversion flag 13 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 14 14 | - Run `ruff check --fix` to apply this fix. - RUF010.py:11:35: RUF010 [*] Use explicit conversion flag | 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 @@ -125,8 +115,6 @@ RUF010.py:11:35: RUF010 [*] Use explicit conversion flag 13 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 14 14 | - Run `ruff check --fix` to apply this fix. - RUF010.py:13:5: RUF010 [*] Use explicit conversion flag | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 @@ -147,8 +135,6 @@ RUF010.py:13:5: RUF010 [*] Use explicit conversion flag 15 15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}" # RUF010 16 16 | - Run `ruff check --fix` to apply this fix. - RUF010.py:13:19: RUF010 [*] Use explicit conversion flag | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 @@ -169,8 +155,6 @@ RUF010.py:13:19: RUF010 [*] Use explicit conversion flag 15 15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}" # RUF010 16 16 | - Run `ruff check --fix` to apply this fix. - RUF010.py:13:34: RUF010 [*] Use explicit conversion flag | 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 @@ -191,8 +175,6 @@ RUF010.py:13:34: RUF010 [*] Use explicit conversion flag 15 15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}" # RUF010 16 16 | - Run `ruff check --fix` to apply this fix. - RUF010.py:15:14: RUF010 [*] Use explicit conversion flag | 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 @@ -213,8 +195,6 @@ RUF010.py:15:14: RUF010 [*] Use explicit conversion flag 17 17 | f"{foo(bla)}" # OK 18 18 | - Run `ruff check --fix` to apply this fix. - RUF010.py:15:29: RUF010 [*] Use explicit conversion flag | 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 @@ -235,8 +215,6 @@ RUF010.py:15:29: RUF010 [*] Use explicit conversion flag 17 17 | f"{foo(bla)}" # OK 18 18 | - Run `ruff check --fix` to apply this fix. - RUF010.py:35:20: RUF010 [*] Use explicit conversion flag | 33 | f"Member of tuple mismatches type at index {i}. Expected {of_shape_i}. Got " @@ -254,6 +232,4 @@ RUF010.py:35:20: RUF010 [*] Use explicit conversion flag 35 |+ f" that flows {obj!r} of type {type(obj)}.{additional_message}" # RUF010 36 36 | ) 37 37 | -38 38 | - - Run `ruff check --fix` to apply this fix. +38 38 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF019_RUF019.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF019_RUF019.py.snap index 98297a738054e..85a131d0d4636 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF019_RUF019.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF019_RUF019.py.snap @@ -19,8 +19,6 @@ RUF019.py:3:4: RUF019 [*] Unnecessary key check before dictionary access 5 5 | 6 6 | k = "k" - Run `ruff check --fix` to apply this fix. - RUF019.py:7:4: RUF019 [*] Unnecessary key check before dictionary access | 6 | k = "k" @@ -39,8 +37,6 @@ RUF019.py:7:4: RUF019 [*] Unnecessary key check before dictionary access 9 9 | 10 10 | if (k) in d and d[k]: - Run `ruff check --fix` to apply this fix. - RUF019.py:10:4: RUF019 [*] Unnecessary key check before dictionary access | 8 | pass @@ -60,8 +56,6 @@ RUF019.py:10:4: RUF019 [*] Unnecessary key check before dictionary access 12 12 | 13 13 | if k in d and d[(k)]: - Run `ruff check --fix` to apply this fix. - RUF019.py:13:4: RUF019 [*] Unnecessary key check before dictionary access | 11 | pass @@ -81,8 +75,6 @@ RUF019.py:13:4: RUF019 [*] Unnecessary key check before dictionary access 15 15 | 16 16 | not ("key" in dct and dct["key"]) - Run `ruff check --fix` to apply this fix. - RUF019.py:16:6: RUF019 [*] Unnecessary key check before dictionary access | 14 | pass @@ -103,8 +95,6 @@ RUF019.py:16:6: RUF019 [*] Unnecessary key check before dictionary access 18 18 | bool("key" in dct and dct["key"]) 19 19 | - Run `ruff check --fix` to apply this fix. - RUF019.py:18:6: RUF019 [*] Unnecessary key check before dictionary access | 16 | not ("key" in dct and dct["key"]) @@ -124,5 +114,3 @@ RUF019.py:18:6: RUF019 [*] Unnecessary key check before dictionary access 19 19 | 20 20 | # OK 21 21 | v = "k" in d and d["k"] - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap index fd46f930d54fe..0d0097be2c1fc 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF020_RUF020.py.snap @@ -20,8 +20,6 @@ RUF020.py:3:7: RUF020 [*] `Union[Never, T]` is equivalent to `T` 5 5 | Never | int 6 6 | NoReturn | int - Run `ruff check --fix` to apply this fix. - RUF020.py:4:7: RUF020 [*] `Union[NoReturn, T]` is equivalent to `T` | 3 | Union[Never, int] @@ -41,8 +39,6 @@ RUF020.py:4:7: RUF020 [*] `Union[NoReturn, T]` is equivalent to `T` 6 6 | NoReturn | int 7 7 | Union[Union[Never, int], Union[NoReturn, int]] - Run `ruff check --fix` to apply this fix. - RUF020.py:5:1: RUF020 [*] `Never | T` is equivalent to `T` | 3 | Union[Never, int] @@ -63,8 +59,6 @@ RUF020.py:5:1: RUF020 [*] `Never | T` is equivalent to `T` 7 7 | Union[Union[Never, int], Union[NoReturn, int]] 8 8 | Union[NoReturn, int, float] - Run `ruff check --fix` to apply this fix. - RUF020.py:6:1: RUF020 [*] `NoReturn | T` is equivalent to `T` | 4 | Union[NoReturn, int] @@ -84,8 +78,6 @@ RUF020.py:6:1: RUF020 [*] `NoReturn | T` is equivalent to `T` 7 7 | Union[Union[Never, int], Union[NoReturn, int]] 8 8 | Union[NoReturn, int, float] - Run `ruff check --fix` to apply this fix. - RUF020.py:7:13: RUF020 [*] `Union[Never, T]` is equivalent to `T` | 5 | Never | int @@ -103,8 +95,6 @@ RUF020.py:7:13: RUF020 [*] `Union[Never, T]` is equivalent to `T` 7 |+Union[int, Union[NoReturn, int]] 8 8 | Union[NoReturn, int, float] - Run `ruff check --fix` to apply this fix. - RUF020.py:7:32: RUF020 [*] `Union[NoReturn, T]` is equivalent to `T` | 5 | Never | int @@ -122,8 +112,6 @@ RUF020.py:7:32: RUF020 [*] `Union[NoReturn, T]` is equivalent to `T` 7 |+Union[Union[Never, int], int] 8 8 | Union[NoReturn, int, float] - Run `ruff check --fix` to apply this fix. - RUF020.py:8:7: RUF020 [*] `Union[NoReturn, T]` is equivalent to `T` | 6 | NoReturn | int @@ -138,5 +126,3 @@ RUF020.py:8:7: RUF020 [*] `Union[NoReturn, T]` is equivalent to `T` 7 7 | Union[Union[Never, int], Union[NoReturn, int]] 8 |-Union[NoReturn, int, float] 8 |+Union[int, float] - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap index db1db4b72cda5..83a3b2335cdbb 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF021_RUF021.py.snap @@ -19,8 +19,6 @@ RUF021.py:12:10: RUF021 [*] Parenthesize `a and b` expressions when chaining `an 14 14 | 15 15 | a, b, c = 0, 1, 2 - Run `ruff check --fix` to apply this fix. - RUF021.py:13:10: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 11 | a, b, c = 1, 0, 2 @@ -41,8 +39,6 @@ RUF021.py:13:10: RUF021 [*] Parenthesize `a and b` expressions when chaining `an 15 15 | a, b, c = 0, 1, 2 16 16 | y = a and b or c # RUF021: => `(a and b) or c` - Run `ruff check --fix` to apply this fix. - RUF021.py:16:5: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 15 | a, b, c = 0, 1, 2 @@ -62,8 +58,6 @@ RUF021.py:16:5: RUF021 [*] Parenthesize `a and b` expressions when chaining `and 18 18 | a, b, c, d = 1, 2, 0, 3 19 19 | if a or b or c and d: # RUF021: => `a or b or (c and d)` - Run `ruff check --fix` to apply this fix. - RUF021.py:19:14: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 18 | a, b, c, d = 1, 2, 0, 3 @@ -82,8 +76,6 @@ RUF021.py:19:14: RUF021 [*] Parenthesize `a and b` expressions when chaining `an 21 21 | 22 22 | a, b, c, d = 0, 0, 2, 3 - Run `ruff check --fix` to apply this fix. - RUF021.py:26:11: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 24 | if bool(): @@ -103,8 +95,6 @@ RUF021.py:26:11: RUF021 [*] Parenthesize `a and b` expressions when chaining `an 28 28 | 29 29 | a, b, c, d = 0, 1, 0, 2 - Run `ruff check --fix` to apply this fix. - RUF021.py:30:7: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 29 | a, b, c, d = 0, 1, 0, 2 @@ -123,8 +113,6 @@ RUF021.py:30:7: RUF021 [*] Parenthesize `a and b` expressions when chaining `and 32 32 | 33 33 | b, c, d, e = 2, 3, 0, 4 - Run `ruff check --fix` to apply this fix. - RUF021.py:30:18: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 29 | a, b, c, d = 0, 1, 0, 2 @@ -143,8 +131,6 @@ RUF021.py:30:18: RUF021 [*] Parenthesize `a and b` expressions when chaining `an 32 32 | 33 33 | b, c, d, e = 2, 3, 0, 4 - Run `ruff check --fix` to apply this fix. - RUF021.py:35:44: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 33 | b, c, d, e = 2, 3, 0, 4 @@ -165,8 +151,6 @@ RUF021.py:35:44: RUF021 [*] Parenthesize `a and b` expressions when chaining `an 37 37 | a, b, c, d = 0, 1, 3, 0 38 38 | assert not a and b or c or d # RUF021: => `(not a and b) or c or d` - Run `ruff check --fix` to apply this fix. - RUF021.py:38:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 37 | a, b, c, d = 0, 1, 3, 0 @@ -186,8 +170,6 @@ RUF021.py:38:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and 40 40 | if (not a) and b or c or d: # RUF021: => `((not a) and b) or c or d` 41 41 | if (not a and b) or c or d: # OK - Run `ruff check --fix` to apply this fix. - RUF021.py:40:4: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 38 | assert not a and b or c or d # RUF021: => `(not a and b) or c or d` @@ -208,8 +190,6 @@ RUF021.py:40:4: RUF021 [*] Parenthesize `a and b` expressions when chaining `and 42 42 | pass 43 43 | - Run `ruff check --fix` to apply this fix. - RUF021.py:46:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 44 | if ( @@ -234,8 +214,6 @@ RUF021.py:46:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and 49 49 | and some_fifth_reasonably_long_condition 50 50 | # a comment - Run `ruff check --fix` to apply this fix. - RUF021.py:48:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear | 46 | or some_other_reasonably_long_condition @@ -265,5 +243,3 @@ RUF021.py:48:8: RUF021 [*] Parenthesize `a and b` expressions when chaining `and 53 53 | # another comment 54 54 | or some_eighth_reasonably_long_condition 55 55 | ): - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF022_RUF022.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF022_RUF022.py.snap index 683b55ffe9911..2feae9013c4e9 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF022_RUF022.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF022_RUF022.py.snap @@ -21,8 +21,6 @@ RUF022.py:5:11: RUF022 [*] `__all__` is not sorted 7 7 | __all__ = ("d", "c", "b", "a") 8 8 | - Run `ruff check --fix` to apply this fix. - RUF022.py:6:12: RUF022 [*] `__all__` is not sorted | 5 | __all__ = ["d", "c", "b", "a"] # a comment that is untouched @@ -41,8 +39,6 @@ RUF022.py:6:12: RUF022 [*] `__all__` is not sorted 8 8 | 9 9 | # Quoting style is retained, - Run `ruff check --fix` to apply this fix. - RUF022.py:7:11: RUF022 [*] `__all__` is not sorted | 5 | __all__ = ["d", "c", "b", "a"] # a comment that is untouched @@ -63,8 +59,6 @@ RUF022.py:7:11: RUF022 [*] `__all__` is not sorted 9 9 | # Quoting style is retained, 10 10 | # but unnecessary parens are not - Run `ruff check --fix` to apply this fix. - RUF022.py:11:17: RUF022 [*] `__all__` is not sorted | 9 | # Quoting style is retained, @@ -85,8 +79,6 @@ RUF022.py:11:17: RUF022 [*] `__all__` is not sorted 13 13 | # (but they are in multiline `__all__` definitions) 14 14 | __all__: tuple = ("b", "c", "a",) - Run `ruff check --fix` to apply this fix. - RUF022.py:14:18: RUF022 [*] `__all__` is not sorted | 12 | # Trailing commas are also not retained in single-line `__all__` definitions @@ -107,8 +99,6 @@ RUF022.py:14:18: RUF022 [*] `__all__` is not sorted 16 16 | if bool(): 17 17 | __all__ += ("x", "m", "a", "s") - Run `ruff check --fix` to apply this fix. - RUF022.py:17:16: RUF022 [*] `__all__` is not sorted | 16 | if bool(): @@ -128,8 +118,6 @@ RUF022.py:17:16: RUF022 [*] `__all__` is not sorted 19 19 | __all__ += "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) 20 20 | - Run `ruff check --fix` to apply this fix. - RUF022.py:19:16: RUF022 [*] `__all__` is not sorted | 17 | __all__ += ("x", "m", "a", "s") @@ -150,8 +138,6 @@ RUF022.py:19:16: RUF022 [*] `__all__` is not sorted 21 21 | __all__: list[str] = ["the", "three", "little", "pigs"] 22 22 | - Run `ruff check --fix` to apply this fix. - RUF022.py:21:22: RUF022 [*] `__all__` is not sorted | 19 | __all__ += "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) @@ -172,8 +158,6 @@ RUF022.py:21:22: RUF022 [*] `__all__` is not sorted 23 23 | __all__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") 24 24 | __all__.extend(["foo", "bar"]) - Run `ruff check --fix` to apply this fix. - RUF022.py:23:11: RUF022 [*] `__all__` is not sorted | 21 | __all__: list[str] = ["the", "three", "little", "pigs"] @@ -194,8 +178,6 @@ RUF022.py:23:11: RUF022 [*] `__all__` is not sorted 25 25 | __all__.extend(("foo", "bar")) 26 26 | __all__.extend((((["foo", "bar"])))) - Run `ruff check --fix` to apply this fix. - RUF022.py:24:16: RUF022 [*] `__all__` is not sorted | 23 | __all__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") @@ -215,8 +197,6 @@ RUF022.py:24:16: RUF022 [*] `__all__` is not sorted 26 26 | __all__.extend((((["foo", "bar"])))) 27 27 | - Run `ruff check --fix` to apply this fix. - RUF022.py:25:16: RUF022 [*] `__all__` is not sorted | 23 | __all__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") @@ -236,8 +216,6 @@ RUF022.py:25:16: RUF022 [*] `__all__` is not sorted 27 27 | 28 28 | #################################### - Run `ruff check --fix` to apply this fix. - RUF022.py:26:19: RUF022 [*] `__all__` is not sorted | 24 | __all__.extend(["foo", "bar"]) @@ -258,8 +236,6 @@ RUF022.py:26:19: RUF022 [*] `__all__` is not sorted 28 28 | #################################### 29 29 | # Neat multiline __all__ definitions - Run `ruff check --fix` to apply this fix. - RUF022.py:32:11: RUF022 [*] `__all__` is not sorted | 30 | #################################### @@ -294,8 +270,6 @@ RUF022.py:32:11: RUF022 [*] `__all__` is not sorted 39 39 | 40 40 | __all__ = [ - Run `ruff check --fix` to apply this fix. - RUF022.py:40:11: RUF022 [*] `__all__` is not sorted | 38 | ) @@ -330,8 +304,6 @@ RUF022.py:40:11: RUF022 [*] `__all__` is not sorted 47 47 | 48 48 | # we implement an "isort-style sort": - Run `ruff check --fix` to apply this fix. - RUF022.py:54:11: RUF022 [*] `__all__` is not sorted | 52 | # This (which is currently alphabetically sorted) @@ -418,8 +390,6 @@ RUF022.py:54:11: RUF022 [*] `__all__` is not sorted 86 87 | ########################################## 87 88 | # Messier multiline __all__ definitions... - Run `ruff check --fix` to apply this fix. - RUF022.py:91:11: RUF022 [*] `__all__` is not sorted | 90 | # comment0 @@ -458,8 +428,6 @@ RUF022.py:91:11: RUF022 [*] `__all__` is not sorted 98 101 | ) # comment6 99 102 | # comment7 - Run `ruff check --fix` to apply this fix. - RUF022.py:101:11: RUF022 [*] `__all__` is not sorted | 99 | # comment7 @@ -493,8 +461,6 @@ RUF022.py:101:11: RUF022 [*] `__all__` is not sorted 106 109 | # comment5 107 110 | # comment6 - Run `ruff check --fix` to apply this fix. - RUF022.py:110:11: RUF022 [*] `__all__` is not sorted | 108 | ] # comment7 @@ -587,8 +553,6 @@ RUF022.py:110:11: RUF022 [*] `__all__` is not sorted 125 157 | __all__: tuple[str, ...] = ( # a comment about the opening paren 126 158 | # multiline comment about "bbb" part 1 - Run `ruff check --fix` to apply this fix. - RUF022.py:125:28: RUF022 [*] `__all__` is not sorted | 123 | "register_error", "lookup_error"] @@ -624,8 +588,6 @@ RUF022.py:125:28: RUF022 [*] `__all__` is not sorted 133 133 | 134 134 | # we use natural sort for `__all__`, - Run `ruff check --fix` to apply this fix. - RUF022.py:138:11: RUF022 [*] `__all__` is not sorted | 136 | # Also, this doesn't end with a trailing comma, @@ -657,8 +619,6 @@ RUF022.py:138:11: RUF022 [*] `__all__` is not sorted 144 144 | 145 145 | __all__.extend(( # comment0 - Run `ruff check --fix` to apply this fix. - RUF022.py:145:16: RUF022 [*] `__all__` is not sorted | 143 | ) @@ -691,8 +651,6 @@ RUF022.py:145:16: RUF022 [*] `__all__` is not sorted 151 151 | )) # comment2 152 152 | - Run `ruff check --fix` to apply this fix. - RUF022.py:155:5: RUF022 [*] `__all__` is not sorted | 153 | __all__.extend( # comment0 @@ -724,8 +682,6 @@ RUF022.py:155:5: RUF022 [*] `__all__` is not sorted 161 161 | ) # comment4 162 162 | ) # comment2 - Run `ruff check --fix` to apply this fix. - RUF022.py:164:16: RUF022 [*] `__all__` is not sorted | 162 | ) # comment2 @@ -758,8 +714,6 @@ RUF022.py:164:16: RUF022 [*] `__all__` is not sorted 170 170 | ]) # comment2 171 171 | - Run `ruff check --fix` to apply this fix. - RUF022.py:174:5: RUF022 [*] `__all__` is not sorted | 172 | __all__.extend( # comment0 @@ -791,8 +745,6 @@ RUF022.py:174:5: RUF022 [*] `__all__` is not sorted 180 180 | ] # comment4 181 181 | ) # comment2 - Run `ruff check --fix` to apply this fix. - RUF022.py:183:11: RUF022 [*] `__all__` is not sorted | 181 | ) # comment2 @@ -824,8 +776,6 @@ RUF022.py:183:11: RUF022 [*] `__all__` is not sorted 187 190 | 188 191 | __all__ = ["Awaitable", "Coroutine", - Run `ruff check --fix` to apply this fix. - RUF022.py:188:11: RUF022 [*] `__all__` is not sorted | 186 | ] @@ -857,8 +807,6 @@ RUF022.py:188:11: RUF022 [*] `__all__` is not sorted 192 196 | __all__ = [ 193 197 | "foo", - Run `ruff check --fix` to apply this fix. - RUF022.py:192:11: RUF022 [*] `__all__` is not sorted | 190 | ] @@ -886,8 +834,6 @@ RUF022.py:192:11: RUF022 [*] `__all__` is not sorted 197 197 | 198 198 | ######################################################################### - Run `ruff check --fix` to apply this fix. - RUF022.py:204:11: RUF022 `__all__` is not sorted | 202 | ######################################################################### @@ -959,8 +905,6 @@ RUF022.py:225:11: RUF022 [*] `__all__` is not sorted 229 230 | __all__ = [ 230 231 | "loads", - Run `ruff check --fix` to apply this fix. - RUF022.py:229:11: RUF022 [*] `__all__` is not sorted | 227 | "dumps",) @@ -986,8 +930,6 @@ RUF022.py:229:11: RUF022 [*] `__all__` is not sorted 233 233 | __all__ = ['xp', 'yp', 234 234 | 'canvas' - Run `ruff check --fix` to apply this fix. - RUF022.py:233:11: RUF022 [*] `__all__` is not sorted | 231 | "dumps" , ] @@ -1021,8 +963,6 @@ RUF022.py:233:11: RUF022 [*] `__all__` is not sorted 236 238 | # very strangely placed comment 237 239 | - Run `ruff check --fix` to apply this fix. - RUF022.py:243:11: RUF022 [*] `__all__` is not sorted | 241 | ] @@ -1057,8 +997,6 @@ RUF022.py:243:11: RUF022 [*] `__all__` is not sorted 250 249 | , 251 250 | ) - Run `ruff check --fix` to apply this fix. - RUF022.py:253:11: RUF022 [*] `__all__` is not sorted | 251 | ) @@ -1106,5 +1044,3 @@ RUF022.py:253:11: RUF022 [*] `__all__` is not sorted 263 263 | # strange multiline comment comment 2a 264 264 | # strange multiline comment 2b 265 265 | , - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap index 66eea79f477d5..38d30d89f7bd3 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF023_RUF023.py.snap @@ -19,8 +19,6 @@ RUF023.py:6:17: RUF023 [*] `Klass.__slots__` is not sorted 8 8 | 9 9 | # Quoting style is retained, - Run `ruff check --fix` to apply this fix. - RUF023.py:7:17: RUF023 [*] `Klass.__slots__` is not sorted | 5 | class Klass: @@ -41,8 +39,6 @@ RUF023.py:7:17: RUF023 [*] `Klass.__slots__` is not sorted 9 9 | # Quoting style is retained, 10 10 | # but unnecessary parens are not - Run `ruff check --fix` to apply this fix. - RUF023.py:11:22: RUF023 [*] `Klass.__slots__` is not sorted | 9 | # Quoting style is retained, @@ -63,8 +59,6 @@ RUF023.py:11:22: RUF023 [*] `Klass.__slots__` is not sorted 13 13 | # (but they are in multiline definitions) 14 14 | __slots__: tuple = ("b", "c", "a",) - Run `ruff check --fix` to apply this fix. - RUF023.py:14:24: RUF023 [*] `Klass.__slots__` is not sorted | 12 | # Trailing commas are also not retained for single-line definitions @@ -85,8 +79,6 @@ RUF023.py:14:24: RUF023 [*] `Klass.__slots__` is not sorted 16 16 | class Klass2: 17 17 | if bool(): - Run `ruff check --fix` to apply this fix. - RUF023.py:18:21: RUF023 [*] `Klass2.__slots__` is not sorted | 16 | class Klass2: @@ -107,8 +99,6 @@ RUF023.py:18:21: RUF023 [*] `Klass2.__slots__` is not sorted 20 20 | __slots__ = "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) 21 21 | - Run `ruff check --fix` to apply this fix. - RUF023.py:20:21: RUF023 [*] `Klass2.__slots__` is not sorted | 18 | __slots__ = {"x": "docs for x", "m": "docs for m", "a": "docs for a"} @@ -129,8 +119,6 @@ RUF023.py:20:21: RUF023 [*] `Klass2.__slots__` is not sorted 22 22 | __slots__: list[str] = ["the", "three", "little", "pigs"] 23 23 | __slots__ = ("parenthesized_item"), "in", ("an_unparenthesized_tuple") - Run `ruff check --fix` to apply this fix. - RUF023.py:22:28: RUF023 [*] `Klass2.__slots__` is not sorted | 20 | __slots__ = "foo3", "foo2", "foo1" # NB: an implicit tuple (without parens) @@ -151,8 +139,6 @@ RUF023.py:22:28: RUF023 [*] `Klass2.__slots__` is not sorted 24 24 | # we use natural sort, 25 25 | # not alphabetical sort or "isort-style" sort - Run `ruff check --fix` to apply this fix. - RUF023.py:23:17: RUF023 [*] `Klass2.__slots__` is not sorted | 22 | __slots__: list[str] = ["the", "three", "little", "pigs"] @@ -172,8 +158,6 @@ RUF023.py:23:17: RUF023 [*] `Klass2.__slots__` is not sorted 25 25 | # not alphabetical sort or "isort-style" sort 26 26 | __slots__ = {"aadvark237", "aadvark10092", "aadvark174", "aadvark532"} - Run `ruff check --fix` to apply this fix. - RUF023.py:26:17: RUF023 [*] `Klass2.__slots__` is not sorted | 24 | # we use natural sort, @@ -194,8 +178,6 @@ RUF023.py:26:17: RUF023 [*] `Klass2.__slots__` is not sorted 28 28 | ############################ 29 29 | # Neat multiline definitions - Run `ruff check --fix` to apply this fix. - RUF023.py:33:17: RUF023 [*] `Klass3.__slots__` is not sorted | 32 | class Klass3: @@ -229,8 +211,6 @@ RUF023.py:33:17: RUF023 [*] `Klass3.__slots__` is not sorted 40 40 | __slots__ = [ 41 41 | "d", - Run `ruff check --fix` to apply this fix. - RUF023.py:40:17: RUF023 [*] `Klass3.__slots__` is not sorted | 38 | "a0" @@ -265,8 +245,6 @@ RUF023.py:40:17: RUF023 [*] `Klass3.__slots__` is not sorted 47 47 | 48 48 | ################################## - Run `ruff check --fix` to apply this fix. - RUF023.py:54:17: RUF023 [*] `Klass4.__slots__` is not sorted | 52 | class Klass4: @@ -306,8 +284,6 @@ RUF023.py:54:17: RUF023 [*] `Klass4.__slots__` is not sorted 61 64 | ) # comment6 62 65 | # comment7 - Run `ruff check --fix` to apply this fix. - RUF023.py:64:17: RUF023 [*] `Klass4.__slots__` is not sorted | 62 | # comment7 @@ -341,8 +317,6 @@ RUF023.py:64:17: RUF023 [*] `Klass4.__slots__` is not sorted 69 72 | # comment5 70 73 | # comment6 - Run `ruff check --fix` to apply this fix. - RUF023.py:75:17: RUF023 [*] `PurePath.__slots__` is not sorted | 73 | # from cpython/Lib/pathlib/__init__.py @@ -443,8 +417,6 @@ RUF023.py:75:17: RUF023 [*] `PurePath.__slots__` is not sorted 110 107 | 111 108 | # From cpython/Lib/pickletools.py - Run `ruff check --fix` to apply this fix. - RUF023.py:113:17: RUF023 [*] `ArgumentDescriptor.__slots__` is not sorted | 111 | # From cpython/Lib/pickletools.py @@ -499,8 +471,6 @@ RUF023.py:113:17: RUF023 [*] `ArgumentDescriptor.__slots__` is not sorted 130 127 | 131 128 | #################################### - Run `ruff check --fix` to apply this fix. - RUF023.py:138:17: RUF023 `SlotUser.__slots__` is not sorted | 136 | # Multiline dicts are out of scope. @@ -584,8 +554,6 @@ RUF023.py:162:17: RUF023 [*] `BezierBuilder.__slots__` is not sorted 165 168 | class BezierBuilder2: 166 169 | __slots__ = {'xp', 'yp', - Run `ruff check --fix` to apply this fix. - RUF023.py:166:17: RUF023 [*] `BezierBuilder2.__slots__` is not sorted | 165 | class BezierBuilder2: @@ -611,8 +579,6 @@ RUF023.py:166:17: RUF023 [*] `BezierBuilder2.__slots__` is not sorted 169 171 | class BezierBuilder3: 170 172 | __slots__ = ['xp', 'yp', - Run `ruff check --fix` to apply this fix. - RUF023.py:170:17: RUF023 [*] `BezierBuilder3.__slots__` is not sorted | 169 | class BezierBuilder3: @@ -645,8 +611,6 @@ RUF023.py:170:17: RUF023 [*] `BezierBuilder3.__slots__` is not sorted 173 175 | # very strangely placed comment 174 176 | - Run `ruff check --fix` to apply this fix. - RUF023.py:181:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted | 180 | class BezierBuilder4: @@ -680,8 +644,6 @@ RUF023.py:181:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted 188 187 | , 189 188 | ) - Run `ruff check --fix` to apply this fix. - RUF023.py:191:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted | 189 | ) @@ -711,5 +673,3 @@ RUF023.py:191:17: RUF023 [*] `BezierBuilder4.__slots__` is not sorted 194 197 | 195 198 | ################################### 196 199 | # These should all not get flagged: - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF025_RUF025.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF025_RUF025.py.snap index 0db5b5d87131d..e5afeabab9954 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF025_RUF025.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF025_RUF025.py.snap @@ -19,8 +19,6 @@ RUF025.py:6:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict 8 8 | 9 9 | def func(): - Run `ruff check --fix` to apply this fix. - RUF025.py:10:23: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 9 | def func(): @@ -39,8 +37,6 @@ RUF025.py:10:23: RUF025 [*] Unnecessary dict comprehension for iterable; use `di 12 12 | 13 13 | - Run `ruff check --fix` to apply this fix. - RUF025.py:15:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 14 | def func(): @@ -58,8 +54,6 @@ RUF025.py:15:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 17 17 | 18 18 | def func(): - Run `ruff check --fix` to apply this fix. - RUF025.py:26:7: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 24 | return data @@ -78,8 +72,6 @@ RUF025.py:26:7: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 28 28 | 29 29 | def func(): - Run `ruff check --fix` to apply this fix. - RUF025.py:30:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 29 | def func(): @@ -97,8 +89,6 @@ RUF025.py:30:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 32 32 | 33 33 | def func(): - Run `ruff check --fix` to apply this fix. - RUF025.py:34:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 33 | def func(): @@ -116,8 +106,6 @@ RUF025.py:34:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 36 36 | 37 37 | def func(): - Run `ruff check --fix` to apply this fix. - RUF025.py:38:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 37 | def func(): @@ -135,8 +123,6 @@ RUF025.py:38:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 40 40 | 41 41 | def func(): - Run `ruff check --fix` to apply this fix. - RUF025.py:42:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 41 | def func(): @@ -154,8 +140,6 @@ RUF025.py:42:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 44 44 | 45 45 | def func(): - Run `ruff check --fix` to apply this fix. - RUF025.py:46:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 45 | def func(): @@ -173,8 +157,6 @@ RUF025.py:46:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 48 48 | 49 49 | def func(): - Run `ruff check --fix` to apply this fix. - RUF025.py:54:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 53 | a = f() @@ -192,8 +174,6 @@ RUF025.py:54:5: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 56 56 | 57 57 | def func(): - Run `ruff check --fix` to apply this fix. - RUF025.py:59:6: RUF025 [*] Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead | 57 | def func(): @@ -211,5 +191,3 @@ RUF025.py:59:6: RUF025 [*] Unnecessary dict comprehension for iterable; use `dic 60 60 | 61 61 | 62 62 | # Non-violation cases: RUF025 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101.py.snap index c63f3676b9772..9c8fb490386cb 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF101_RUF101.py.snap @@ -17,8 +17,6 @@ RUF101.py:1:15: RUF101 [*] `RUF940` is a redirect to `RUF950` 4 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 5 5 | x = 2 # noqa: RUF940, RUF950, RUF940 - Run `ruff check --fix` to apply this fix. - RUF101.py:3:15: RUF101 [*] `RUF940` is a redirect to `RUF950` | 1 | x = 2 # noqa: RUF940 @@ -38,8 +36,6 @@ RUF101.py:3:15: RUF101 [*] `RUF940` is a redirect to `RUF950` 5 5 | x = 2 # noqa: RUF940, RUF950, RUF940 6 6 | x = 2 # noqa: RUF940, RUF950, RUF940, RUF950 - Run `ruff check --fix` to apply this fix. - RUF101.py:4:23: RUF101 [*] `RUF940` is a redirect to `RUF950` | 2 | x = 2 # noqa: RUF950 @@ -59,8 +55,6 @@ RUF101.py:4:23: RUF101 [*] `RUF940` is a redirect to `RUF950` 5 5 | x = 2 # noqa: RUF940, RUF950, RUF940 6 6 | x = 2 # noqa: RUF940, RUF950, RUF940, RUF950 - Run `ruff check --fix` to apply this fix. - RUF101.py:5:15: RUF101 [*] `RUF940` is a redirect to `RUF950` | 3 | x = 2 # noqa: RUF940, RUF950 @@ -78,8 +72,6 @@ RUF101.py:5:15: RUF101 [*] `RUF940` is a redirect to `RUF950` 5 |+x = 2 # noqa: RUF950, RUF950, RUF940 6 6 | x = 2 # noqa: RUF940, RUF950, RUF940, RUF950 - Run `ruff check --fix` to apply this fix. - RUF101.py:5:31: RUF101 [*] `RUF940` is a redirect to `RUF950` | 3 | x = 2 # noqa: RUF940, RUF950 @@ -97,8 +89,6 @@ RUF101.py:5:31: RUF101 [*] `RUF940` is a redirect to `RUF950` 5 |+x = 2 # noqa: RUF940, RUF950, RUF950 6 6 | x = 2 # noqa: RUF940, RUF950, RUF940, RUF950 - Run `ruff check --fix` to apply this fix. - RUF101.py:6:15: RUF101 [*] `RUF940` is a redirect to `RUF950` | 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 @@ -114,8 +104,6 @@ RUF101.py:6:15: RUF101 [*] `RUF940` is a redirect to `RUF950` 6 |-x = 2 # noqa: RUF940, RUF950, RUF940, RUF950 6 |+x = 2 # noqa: RUF950, RUF950, RUF940, RUF950 - Run `ruff check --fix` to apply this fix. - RUF101.py:6:31: RUF101 [*] `RUF940` is a redirect to `RUF950` | 4 | x = 2 # noqa: RUF950, RUF940, RUF950, RUF950, RUF950 @@ -130,5 +118,3 @@ RUF101.py:6:31: RUF101 [*] `RUF940` is a redirect to `RUF950` 5 5 | x = 2 # noqa: RUF940, RUF950, RUF940 6 |-x = 2 # noqa: RUF940, RUF950, RUF940, RUF950 6 |+x = 2 # noqa: RUF940, RUF950, RUF950, RUF950 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap index 7fd60c91973d5..346b60f479057 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap @@ -19,8 +19,6 @@ RUF100_0.py:9:12: RUF100 [*] Unused blanket `noqa` directive 11 11 | 12 12 | # Invalid - Run `ruff check --fix` to apply this fix. - RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 12 | # Invalid @@ -40,8 +38,6 @@ RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) 15 15 | # Invalid 16 16 | d = 1 # noqa: F841, E501 - Run `ruff check --fix` to apply this fix. - RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) | 15 | # Invalid @@ -61,8 +57,6 @@ RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) 18 18 | # Invalid (and unimplemented or not enabled) 19 19 | d = 1 # noqa: F841, W191, F821 - Run `ruff check --fix` to apply this fix. - RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; non-enabled: `F821`) | 18 | # Invalid (and unimplemented or not enabled) @@ -82,8 +76,6 @@ RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; n 21 21 | # Invalid (but external) 22 22 | d = 1 # noqa: F841, V101 - Run `ruff check --fix` to apply this fix. - RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) | 21 | # Invalid (but external) @@ -103,8 +95,6 @@ RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) 24 24 | # Invalid (but external) 25 25 | d = 1 # noqa: V500 - Run `ruff check --fix` to apply this fix. - RUF100_0.py:25:12: RUF100 [*] Unused `noqa` directive (unknown: `V500`) | 24 | # Invalid (but external) @@ -124,8 +114,6 @@ RUF100_0.py:25:12: RUF100 [*] Unused `noqa` directive (unknown: `V500`) 27 27 | # fmt: off 28 28 | # Invalid - no space before # - Run `ruff check --fix` to apply this fix. - RUF100_0.py:29:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 27 | # fmt: off @@ -146,8 +134,6 @@ RUF100_0.py:29:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) 31 31 | # Invalid - many spaces before # 32 32 | d = 1 # noqa: E501 - Run `ruff check --fix` to apply this fix. - RUF100_0.py:32:5: F841 [*] Local variable `d` is assigned to but never used | 31 | # Invalid - many spaces before # @@ -176,8 +162,6 @@ RUF100_0.py:32:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) 34 34 | 35 35 | - Run `ruff check --fix` to apply this fix. - RUF100_0.py:58:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) | 57 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. @@ -197,8 +181,6 @@ RUF100_0.py:58:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) 60 60 | # Invalid 61 61 | _ = """Lorem ipsum dolor sit amet. - Run `ruff check --fix` to apply this fix. - RUF100_0.py:66:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 65 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. @@ -218,8 +200,6 @@ RUF100_0.py:66:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) 68 68 | # Invalid 69 69 | _ = """Lorem ipsum dolor sit amet. - Run `ruff check --fix` to apply this fix. - RUF100_0.py:74:6: RUF100 [*] Unused blanket `noqa` directive | 73 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. @@ -239,8 +219,6 @@ RUF100_0.py:74:6: RUF100 [*] Unused blanket `noqa` directive 76 76 | # Valid 77 77 | # this is a veryyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy long comment # noqa: E501 - Run `ruff check --fix` to apply this fix. - RUF100_0.py:88:8: F401 [*] `shelve` imported but unused | 86 | import collections # noqa @@ -259,8 +237,6 @@ RUF100_0.py:88:8: F401 [*] `shelve` imported but unused 90 89 | 91 90 | print(sys.path) - Run `ruff check --fix` to apply this fix. - RUF100_0.py:93:89: E501 Line too long (89 > 88) | 91 | print(sys.path) @@ -287,8 +263,6 @@ RUF100_0.py:93:92: RUF100 [*] Unused `noqa` directive (unused: `F401`) 95 95 | 96 96 | def f(): - Run `ruff check --fix` to apply this fix. - RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | 105 | def f(): @@ -308,8 +282,6 @@ RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) 109 109 | 110 110 | - Run `ruff check --fix` to apply this fix. - RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used | 106 | # Invalid - nonexistent error code with multibyte character @@ -338,8 +310,6 @@ RUF100_0.py:108:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) 110 110 | 111 111 | def f(): - Run `ruff check --fix` to apply this fix. - RUF100_0.py:118:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`; unknown: `X200`) | 116 | # Check duplicate code detection @@ -360,8 +330,6 @@ RUF100_0.py:118:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`; unkn 120 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 121 121 | - Run `ruff check --fix` to apply this fix. - RUF100_0.py:120:19: RUF100 [*] Unused `noqa` directive (duplicated: `SIM300`, `SIM300`) | 118 | x = 2 # noqa: F841, F841, X200 @@ -382,8 +350,6 @@ RUF100_0.py:120:19: RUF100 [*] Unused `noqa` directive (duplicated: `SIM300`, `S 122 122 | z = 2 # noqa: F841 F841 F841, F841, F841 123 123 | - Run `ruff check --fix` to apply this fix. - RUF100_0.py:122:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`, `F841`, `F841`, `F841`) | 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 @@ -404,8 +370,6 @@ RUF100_0.py:122:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`, `F84 124 124 | return 125 125 | - Run `ruff check --fix` to apply this fix. - RUF100_0.py:129:20: RUF100 [*] Unused `noqa` directive (duplicated: `S307`, `S307`, `S307`) | 127 | # Allow code redirects @@ -425,8 +389,6 @@ RUF100_0.py:129:20: RUF100 [*] Unused `noqa` directive (duplicated: `S307`, `S30 130 130 | x = eval(command) # noqa: PGH001, S307, PGH001 131 131 | x = eval(command) # noqa: PGH001, S307, PGH001, S307 - Run `ruff check --fix` to apply this fix. - RUF100_0.py:130:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`) | 128 | x = eval(command) # noqa: PGH001, S307 @@ -444,8 +406,6 @@ RUF100_0.py:130:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`) 130 |+x = eval(command) # noqa: PGH001, S307 131 131 | x = eval(command) # noqa: PGH001, S307, PGH001, S307 - Run `ruff check --fix` to apply this fix. - RUF100_0.py:131:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`, `S307`) | 129 | x = eval(command) # noqa: S307, PGH001, S307, S307, S307 @@ -460,5 +420,3 @@ RUF100_0.py:131:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`, `S 130 130 | x = eval(command) # noqa: PGH001, S307, PGH001 131 |-x = eval(command) # noqa: PGH001, S307, PGH001, S307 131 |+x = eval(command) # noqa: PGH001, S307 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap index c0d0e0f2ec720..7786f1f2c2036 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0_prefix.snap @@ -19,8 +19,6 @@ RUF100_0.py:9:12: RUF100 [*] Unused blanket `noqa` directive 11 11 | 12 12 | # Invalid - Run `ruff check --fix` to apply this fix. - RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 12 | # Invalid @@ -40,8 +38,6 @@ RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) 15 15 | # Invalid 16 16 | d = 1 # noqa: F841, E501 - Run `ruff check --fix` to apply this fix. - RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) | 15 | # Invalid @@ -61,8 +57,6 @@ RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) 18 18 | # Invalid (and unimplemented or not enabled) 19 19 | d = 1 # noqa: F841, W191, F821 - Run `ruff check --fix` to apply this fix. - RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; non-enabled: `F821`) | 18 | # Invalid (and unimplemented or not enabled) @@ -82,8 +76,6 @@ RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; n 21 21 | # Invalid (but external) 22 22 | d = 1 # noqa: F841, V101 - Run `ruff check --fix` to apply this fix. - RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) | 21 | # Invalid (but external) @@ -103,8 +95,6 @@ RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) 24 24 | # Invalid (but external) 25 25 | d = 1 # noqa: V500 - Run `ruff check --fix` to apply this fix. - RUF100_0.py:29:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 27 | # fmt: off @@ -125,8 +115,6 @@ RUF100_0.py:29:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) 31 31 | # Invalid - many spaces before # 32 32 | d = 1 # noqa: E501 - Run `ruff check --fix` to apply this fix. - RUF100_0.py:32:5: F841 [*] Local variable `d` is assigned to but never used | 31 | # Invalid - many spaces before # @@ -155,8 +143,6 @@ RUF100_0.py:32:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) 34 34 | 35 35 | - Run `ruff check --fix` to apply this fix. - RUF100_0.py:58:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) | 57 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. @@ -176,8 +162,6 @@ RUF100_0.py:58:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) 60 60 | # Invalid 61 61 | _ = """Lorem ipsum dolor sit amet. - Run `ruff check --fix` to apply this fix. - RUF100_0.py:66:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 65 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. @@ -197,8 +181,6 @@ RUF100_0.py:66:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) 68 68 | # Invalid 69 69 | _ = """Lorem ipsum dolor sit amet. - Run `ruff check --fix` to apply this fix. - RUF100_0.py:74:6: RUF100 [*] Unused blanket `noqa` directive | 73 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. @@ -218,8 +200,6 @@ RUF100_0.py:74:6: RUF100 [*] Unused blanket `noqa` directive 76 76 | # Valid 77 77 | # this is a veryyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy long comment # noqa: E501 - Run `ruff check --fix` to apply this fix. - RUF100_0.py:88:8: F401 [*] `shelve` imported but unused | 86 | import collections # noqa @@ -238,8 +218,6 @@ RUF100_0.py:88:8: F401 [*] `shelve` imported but unused 90 89 | 91 90 | print(sys.path) - Run `ruff check --fix` to apply this fix. - RUF100_0.py:93:89: E501 Line too long (89 > 88) | 91 | print(sys.path) @@ -266,8 +244,6 @@ RUF100_0.py:93:92: RUF100 [*] Unused `noqa` directive (unused: `F401`) 95 95 | 96 96 | def f(): - Run `ruff check --fix` to apply this fix. - RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) | 105 | def f(): @@ -287,8 +263,6 @@ RUF100_0.py:107:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) 109 109 | 110 110 | - Run `ruff check --fix` to apply this fix. - RUF100_0.py:108:5: F841 [*] Local variable `e` is assigned to but never used | 106 | # Invalid - nonexistent error code with multibyte character @@ -317,8 +291,6 @@ RUF100_0.py:108:12: RUF100 [*] Unused `noqa` directive (unknown: `E50`) 110 110 | 111 111 | def f(): - Run `ruff check --fix` to apply this fix. - RUF100_0.py:118:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`; unknown: `X200`) | 116 | # Check duplicate code detection @@ -339,8 +311,6 @@ RUF100_0.py:118:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`; unkn 120 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 121 121 | - Run `ruff check --fix` to apply this fix. - RUF100_0.py:120:19: RUF100 [*] Unused `noqa` directive (duplicated: `SIM300`, `SIM300`) | 118 | x = 2 # noqa: F841, F841, X200 @@ -361,8 +331,6 @@ RUF100_0.py:120:19: RUF100 [*] Unused `noqa` directive (duplicated: `SIM300`, `S 122 122 | z = 2 # noqa: F841 F841 F841, F841, F841 123 123 | - Run `ruff check --fix` to apply this fix. - RUF100_0.py:122:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`, `F841`, `F841`, `F841`) | 120 | y = 2 == bar # noqa: SIM300, F841, SIM300, SIM300 @@ -383,8 +351,6 @@ RUF100_0.py:122:12: RUF100 [*] Unused `noqa` directive (duplicated: `F841`, `F84 124 124 | return 125 125 | - Run `ruff check --fix` to apply this fix. - RUF100_0.py:129:20: RUF100 [*] Unused `noqa` directive (duplicated: `S307`, `S307`, `S307`) | 127 | # Allow code redirects @@ -404,8 +370,6 @@ RUF100_0.py:129:20: RUF100 [*] Unused `noqa` directive (duplicated: `S307`, `S30 130 130 | x = eval(command) # noqa: PGH001, S307, PGH001 131 131 | x = eval(command) # noqa: PGH001, S307, PGH001, S307 - Run `ruff check --fix` to apply this fix. - RUF100_0.py:130:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`) | 128 | x = eval(command) # noqa: PGH001, S307 @@ -423,8 +387,6 @@ RUF100_0.py:130:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`) 130 |+x = eval(command) # noqa: PGH001, S307 131 131 | x = eval(command) # noqa: PGH001, S307, PGH001, S307 - Run `ruff check --fix` to apply this fix. - RUF100_0.py:131:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`, `S307`) | 129 | x = eval(command) # noqa: S307, PGH001, S307, S307, S307 @@ -439,5 +401,3 @@ RUF100_0.py:131:20: RUF100 [*] Unused `noqa` directive (duplicated: `PGH001`, `S 130 130 | x = eval(command) # noqa: PGH001, S307, PGH001 131 |-x = eval(command) # noqa: PGH001, S307, PGH001, S307 131 |+x = eval(command) # noqa: PGH001, S307 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap index 7642c0b4224f4..8db7d6809e6d9 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap @@ -21,8 +21,6 @@ RUF100_1.py:37:9: F401 [*] `typing.Union` imported but unused 40 39 | 41 40 | def f(): - Run `ruff check --fix` to apply this fix. - RUF100_1.py:52:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) | 50 | # This should ignore the error, but the inner noqa should be marked as unused. @@ -42,8 +40,6 @@ RUF100_1.py:52:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) 54 54 | 55 55 | - Run `ruff check --fix` to apply this fix. - RUF100_1.py:59:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) | 57 | # This should ignore the error, but the inner noqa should be marked as unused. @@ -63,8 +59,6 @@ RUF100_1.py:59:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) 61 61 | 62 62 | - Run `ruff check --fix` to apply this fix. - RUF100_1.py:66:16: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | 64 | # This should ignore the error, but mark F501 as unused. @@ -84,8 +78,6 @@ RUF100_1.py:66:16: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) 68 68 | 69 69 | - Run `ruff check --fix` to apply this fix. - RUF100_1.py:72:27: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | 70 | def f(): @@ -106,8 +98,6 @@ RUF100_1.py:72:27: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) 74 74 | ) 75 75 | - Run `ruff check --fix` to apply this fix. - RUF100_1.py:89:24: F401 [*] `typing.Awaitable` imported but unused | 87 | def f(): @@ -123,8 +113,6 @@ RUF100_1.py:89:24: F401 [*] `typing.Awaitable` imported but unused 89 |- from typing import Awaitable, AwaitableGenerator # noqa: F501 89 |+ pass # noqa: F501 - Run `ruff check --fix` to apply this fix. - RUF100_1.py:89:35: F401 [*] `typing.AwaitableGenerator` imported but unused | 87 | def f(): @@ -140,8 +128,6 @@ RUF100_1.py:89:35: F401 [*] `typing.AwaitableGenerator` imported but unused 89 |- from typing import Awaitable, AwaitableGenerator # noqa: F501 89 |+ pass # noqa: F501 - Run `ruff check --fix` to apply this fix. - RUF100_1.py:89:55: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | 87 | def f(): @@ -156,5 +142,3 @@ RUF100_1.py:89:55: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) 88 88 | # This should mark F501 as unused. 89 |- from typing import Awaitable, AwaitableGenerator # noqa: F501 89 |+ from typing import Awaitable, AwaitableGenerator - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap index 593bad452aa19..64901a6e7f130 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap @@ -10,5 +10,3 @@ RUF100_2.py:1:19: RUF100 [*] Unused `noqa` directive (unused: `F401`) 1 |-import itertools # noqa: F401 1 |+import itertools - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap index e391a103f2471..22576cd018884 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap @@ -15,8 +15,6 @@ RUF100_3.py:1:1: RUF100 [*] Unused blanket `noqa` directive 3 2 | print() # noqa 4 3 | print() # noqa # comment - Run `ruff check --fix` to apply this fix. - RUF100_3.py:2:1: RUF100 [*] Unused blanket `noqa` directive | 1 | # noqa @@ -34,8 +32,6 @@ RUF100_3.py:2:1: RUF100 [*] Unused blanket `noqa` directive 4 4 | print() # noqa # comment 5 5 | print() # noqa # comment - Run `ruff check --fix` to apply this fix. - RUF100_3.py:3:10: RUF100 [*] Unused blanket `noqa` directive | 1 | # noqa @@ -55,8 +51,6 @@ RUF100_3.py:3:10: RUF100 [*] Unused blanket `noqa` directive 5 5 | print() # noqa # comment 6 6 | print() # noqa comment - Run `ruff check --fix` to apply this fix. - RUF100_3.py:4:10: RUF100 [*] Unused blanket `noqa` directive | 2 | # noqa # comment @@ -77,8 +71,6 @@ RUF100_3.py:4:10: RUF100 [*] Unused blanket `noqa` directive 6 6 | print() # noqa comment 7 7 | print() # noqa comment - Run `ruff check --fix` to apply this fix. - RUF100_3.py:5:10: RUF100 [*] Unused blanket `noqa` directive | 3 | print() # noqa @@ -99,8 +91,6 @@ RUF100_3.py:5:10: RUF100 [*] Unused blanket `noqa` directive 7 7 | print() # noqa comment 8 8 | print(a) # noqa - Run `ruff check --fix` to apply this fix. - RUF100_3.py:6:10: RUF100 [*] Unused blanket `noqa` directive | 4 | print() # noqa # comment @@ -121,8 +111,6 @@ RUF100_3.py:6:10: RUF100 [*] Unused blanket `noqa` directive 8 8 | print(a) # noqa 9 9 | print(a) # noqa # comment - Run `ruff check --fix` to apply this fix. - RUF100_3.py:7:10: RUF100 [*] Unused blanket `noqa` directive | 5 | print() # noqa # comment @@ -143,8 +131,6 @@ RUF100_3.py:7:10: RUF100 [*] Unused blanket `noqa` directive 9 9 | print(a) # noqa # comment 10 10 | print(a) # noqa # comment - Run `ruff check --fix` to apply this fix. - RUF100_3.py:14:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 12 | print(a) # noqa comment @@ -164,8 +150,6 @@ RUF100_3.py:14:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 16 15 | print() # noqa: E501, F821 17 16 | print() # noqa: E501, F821 # comment - Run `ruff check --fix` to apply this fix. - RUF100_3.py:15:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 14 | # noqa: E501, F821 @@ -185,8 +169,6 @@ RUF100_3.py:15:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 17 17 | print() # noqa: E501, F821 # comment 18 18 | print() # noqa: E501, F821 # comment - Run `ruff check --fix` to apply this fix. - RUF100_3.py:16:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 14 | # noqa: E501, F821 @@ -207,8 +189,6 @@ RUF100_3.py:16:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 18 18 | print() # noqa: E501, F821 # comment 19 19 | print() # noqa: E501, F821 comment - Run `ruff check --fix` to apply this fix. - RUF100_3.py:17:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 15 | # noqa: E501, F821 # comment @@ -229,8 +209,6 @@ RUF100_3.py:17:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 19 19 | print() # noqa: E501, F821 comment 20 20 | print() # noqa: E501, F821 comment - Run `ruff check --fix` to apply this fix. - RUF100_3.py:18:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 16 | print() # noqa: E501, F821 @@ -251,8 +229,6 @@ RUF100_3.py:18:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 20 20 | print() # noqa: E501, F821 comment 21 21 | print(a) # noqa: E501, F821 - Run `ruff check --fix` to apply this fix. - RUF100_3.py:19:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 17 | print() # noqa: E501, F821 # comment @@ -273,8 +249,6 @@ RUF100_3.py:19:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 21 21 | print(a) # noqa: E501, F821 22 22 | print(a) # noqa: E501, F821 # comment - Run `ruff check --fix` to apply this fix. - RUF100_3.py:20:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 18 | print() # noqa: E501, F821 # comment @@ -295,8 +269,6 @@ RUF100_3.py:20:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 22 22 | print(a) # noqa: E501, F821 # comment 23 23 | print(a) # noqa: E501, F821 # comment - Run `ruff check --fix` to apply this fix. - RUF100_3.py:21:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 19 | print() # noqa: E501, F821 comment @@ -317,8 +289,6 @@ RUF100_3.py:21:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) 23 23 | print(a) # noqa: E501, F821 # comment 24 24 | print(a) # noqa: E501, F821 comment - Run `ruff check --fix` to apply this fix. - RUF100_3.py:22:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 20 | print() # noqa: E501, F821 comment @@ -339,8 +309,6 @@ RUF100_3.py:22:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) 24 24 | print(a) # noqa: E501, F821 comment 25 25 | print(a) # noqa: E501, F821 comment - Run `ruff check --fix` to apply this fix. - RUF100_3.py:23:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 21 | print(a) # noqa: E501, F821 @@ -361,8 +329,6 @@ RUF100_3.py:23:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) 25 25 | print(a) # noqa: E501, F821 comment 26 26 | - Run `ruff check --fix` to apply this fix. - RUF100_3.py:24:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 22 | print(a) # noqa: E501, F821 # comment @@ -382,8 +348,6 @@ RUF100_3.py:24:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) 26 26 | 27 27 | print(a) # comment with unicode µ # noqa: E501 - Run `ruff check --fix` to apply this fix. - RUF100_3.py:25:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 23 | print(a) # noqa: E501, F821 # comment @@ -404,8 +368,6 @@ RUF100_3.py:25:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) 27 27 | print(a) # comment with unicode µ # noqa: E501 28 28 | print(a) # comment with unicode µ # noqa: E501, F821 - Run `ruff check --fix` to apply this fix. - RUF100_3.py:27:7: F821 Undefined name `a` | 25 | print(a) # noqa: E501, F821 comment @@ -432,8 +394,6 @@ RUF100_3.py:27:39: RUF100 [*] Unused `noqa` directive (unused: `E501`) 27 |+print(a) # comment with unicode µ 28 28 | print(a) # comment with unicode µ # noqa: E501, F821 - Run `ruff check --fix` to apply this fix. - RUF100_3.py:28:39: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 27 | print(a) # comment with unicode µ # noqa: E501 @@ -447,5 +407,3 @@ RUF100_3.py:28:39: RUF100 [*] Unused `noqa` directive (unused: `E501`) 27 27 | print(a) # comment with unicode µ # noqa: E501 28 |-print(a) # comment with unicode µ # noqa: E501, F821 28 |+print(a) # comment with unicode µ # noqa: F821 - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap index a085560de90b6..0dd8b2d38f1fd 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap @@ -32,5 +32,3 @@ RUF100_5.py:11:13: RUF100 [*] Unused `noqa` directive (unused: `E501`) 10 10 | 11 |-#import os # noqa: E501 11 |+#import os - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap index 23387c29f35fa..7816f5818a4f4 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap @@ -13,8 +13,6 @@ ruff_noqa_invalid.py:1:8: F401 [*] `os` imported but unused 3 2 | 4 3 | def f(): - Run `ruff check --fix` to apply this fix. - ruff_noqa_invalid.py:5:5: F841 [*] Local variable `x` is assigned to but never used | 4 | def f(): diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap index 5965b44b6d5fc..ddb9e28ae00ec 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__error-instead-of-exception_TRY400.py.snap @@ -21,8 +21,6 @@ TRY400.py:13:9: TRY400 [*] Use `logging.exception` instead of `logging.error` 15 15 | if True: 16 16 | logging.error("Context message here") - Run `ruff check --fix` to apply this fix. - TRY400.py:16:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | 15 | if True: @@ -40,8 +38,6 @@ TRY400.py:16:13: TRY400 [*] Use `logging.exception` instead of `logging.error` 18 18 | 19 19 | def bad(): - Run `ruff check --fix` to apply this fix. - TRY400.py:27:9: TRY400 [*] Use `logging.exception` instead of `logging.error` | 25 | a = 1 @@ -125,8 +121,6 @@ TRY400.py:100:9: TRY400 [*] Use `logging.exception` instead of `logging.error` 102 102 | if True: 103 103 | error("Context message here") - Run `ruff check --fix` to apply this fix. - TRY400.py:103:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | 102 | if True: @@ -144,8 +138,6 @@ TRY400.py:103:13: TRY400 [*] Use `logging.exception` instead of `logging.error` 105 105 | 106 106 | def good(): - Run `ruff check --fix` to apply this fix. - TRY400.py:143:13: TRY400 [*] Use `logging.exception` instead of `logging.error` | 141 | b = 2 @@ -160,5 +152,3 @@ TRY400.py:143:13: TRY400 [*] Use `logging.exception` instead of `logging.error` 142 142 | except Exception: 143 |- error("Context message here") 143 |+ exception("Context message here") - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__import_sorting.snap b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__import_sorting.snap index 63f27755e16a8..f2ab2dc4234cf 100644 --- a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__import_sorting.snap +++ b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__import_sorting.snap @@ -22,8 +22,6 @@ isort.ipynb:cell 1:1:1: I001 [*] Import block is un-sorted or un-formatted 5 5 | import collections 6 6 | # Newline should be added here - Run `ruff check --fix` to apply this fix. - isort.ipynb:cell 2:1:1: I001 [*] Import block is un-sorted or un-formatted | 1 | / from typing import Any @@ -47,8 +45,6 @@ isort.ipynb:cell 2:1:1: I001 [*] Import block is un-sorted or un-formatted 7 9 | def foo(): 8 10 | pass - Run `ruff check --fix` to apply this fix. - isort.ipynb:cell 3:1:1: I001 [*] Import block is un-sorted or un-formatted | 1 | / from pathlib import Path @@ -70,8 +66,6 @@ isort.ipynb:cell 3:1:1: I001 [*] Import block is un-sorted or un-formatted 12 12 | %matplotlib \ 13 13 | --inline - Run `ruff check --fix` to apply this fix. - isort.ipynb:cell 3:7:1: I001 [*] Import block is un-sorted or un-formatted | 5 | --inline @@ -87,5 +81,3 @@ isort.ipynb:cell 3:7:1: I001 [*] Import block is un-sorted or un-formatted 15 |+import abc 15 16 | import math 16 |-import abc - - Run `ruff check --fix` to apply this fix. diff --git a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__ipy_escape_command.snap b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__ipy_escape_command.snap index 46c83ce4d1305..0f7e59e81acf5 100644 --- a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__ipy_escape_command.snap +++ b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__ipy_escape_command.snap @@ -20,8 +20,6 @@ ipy_escape_command.ipynb:cell 1:5:8: F401 [*] `os` imported but unused 7 6 | _ = math.pi 8 7 | %%timeit - Run `ruff check --fix` to apply this fix. - ipy_escape_command.ipynb:cell 2:2:8: F401 [*] `sys` imported but unused | 1 | %%timeit @@ -34,5 +32,3 @@ ipy_escape_command.ipynb:cell 2:2:8: F401 [*] `sys` imported but unused 7 7 | _ = math.pi 8 8 | %%timeit 9 |-import sys - - Run `ruff check --fix` to apply this fix.