From 7873ca38e546c8007089a774c82fd38d7fd45a91 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Tue, 7 Nov 2023 10:11:43 -0600 Subject: [PATCH] Update applicability messages for clarity in tests (#8541) These names are only ever displayed internally right now and we could be clearer in our test snapshots. The diff is kind of scary because all of the tests fixtures are updated. --- crates/ruff_diagnostics/src/fix.rs | 14 +-- crates/ruff_linter/src/message/diff.rs | 6 +- .../eradicate/rules/commented_out_code.rs | 2 +- ...s__eradicate__tests__ERA001_ERA001.py.snap | 16 +-- ...__flake8_annotations__tests__defaults.snap | 4 +- ..._annotations__tests__mypy_init_return.snap | 6 +- ...otations__tests__simple_magic_methods.snap | 28 ++--- ...__flake8_bugbear__tests__B004_B004.py.snap | 2 +- ...flake8_bugbear__tests__B006_B006_1.py.snap | 2 +- ...flake8_bugbear__tests__B006_B006_2.py.snap | 2 +- ...flake8_bugbear__tests__B006_B006_3.py.snap | 2 +- ...flake8_bugbear__tests__B006_B006_4.py.snap | 2 +- ...flake8_bugbear__tests__B006_B006_5.py.snap | 26 ++--- ...flake8_bugbear__tests__B006_B006_6.py.snap | 2 +- ...flake8_bugbear__tests__B006_B006_7.py.snap | 2 +- ...ke8_bugbear__tests__B006_B006_B008.py.snap | 46 ++++---- ...__flake8_bugbear__tests__B007_B007.py.snap | 8 +- ...ke8_bugbear__tests__B009_B009_B010.py.snap | 34 +++--- ...ke8_bugbear__tests__B010_B009_B010.py.snap | 12 +-- ...__flake8_bugbear__tests__B011_B011.py.snap | 4 +- ...__flake8_bugbear__tests__B013_B013.py.snap | 6 +- ...__flake8_bugbear__tests__B014_B014.py.snap | 10 +- ...extend_immutable_calls_arg_annotation.snap | 2 +- ...rules__flake8_commas__tests__COM81.py.snap | 86 +++++++-------- ...8_comprehensions__tests__C400_C400.py.snap | 4 +- ...8_comprehensions__tests__C401_C401.py.snap | 26 ++--- ...8_comprehensions__tests__C402_C402.py.snap | 26 ++--- ...8_comprehensions__tests__C403_C403.py.snap | 18 ++-- ...8_comprehensions__tests__C404_C404.py.snap | 20 ++-- ...8_comprehensions__tests__C405_C405.py.snap | 40 +++---- ...8_comprehensions__tests__C406_C406.py.snap | 8 +- ...8_comprehensions__tests__C408_C408.py.snap | 32 +++--- ...low_dict_calls_with_keyword_arguments.snap | 10 +- ...8_comprehensions__tests__C409_C409.py.snap | 10 +- ...8_comprehensions__tests__C410_C410.py.snap | 8 +- ...8_comprehensions__tests__C411_C411.py.snap | 2 +- ...8_comprehensions__tests__C413_C413.py.snap | 22 ++-- ...8_comprehensions__tests__C414_C414.py.snap | 48 ++++----- ...8_comprehensions__tests__C416_C416.py.snap | 14 +-- ...8_comprehensions__tests__C417_C417.py.snap | 36 +++---- ...8_comprehensions__tests__C418_C418.py.snap | 8 +- ...8_comprehensions__tests__C419_C419.py.snap | 14 +-- ...__rules__flake8_errmsg__tests__custom.snap | 14 +-- ...rules__flake8_errmsg__tests__defaults.snap | 18 ++-- ...flake8_executable__tests__EXE004_1.py.snap | 2 +- ...flake8_executable__tests__EXE004_4.py.snap | 2 +- ...icit_str_concat__tests__ISC001_ISC.py.snap | 24 ++--- ...oncat__tests__multiline_ISC001_ISC.py.snap | 24 ++--- ...8_import_conventions__tests__defaults.snap | 26 ++--- ...ke8_import_conventions__tests__tricky.snap | 2 +- ...ake8_logging__tests__LOG001_LOG001.py.snap | 4 +- ...ake8_logging__tests__LOG002_LOG002.py.snap | 8 +- ...ake8_logging__tests__LOG009_LOG009.py.snap | 4 +- ...flake8_logging_format__tests__G010.py.snap | 8 +- ...__flake8_pie__tests__PIE790_PIE790.py.snap | 50 ++++----- ...__flake8_pie__tests__PIE794_PIE794.py.snap | 8 +- ...__flake8_pie__tests__PIE804_PIE804.py.snap | 12 +-- ...__flake8_pie__tests__PIE807_PIE807.py.snap | 6 +- ...__flake8_pie__tests__PIE808_PIE808.py.snap | 2 +- ...__flake8_pie__tests__PIE810_PIE810.py.snap | 10 +- ..._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.py.snap | 4 +- ..._flake8_pyi__tests__PYI025_PYI025.pyi.snap | 10 +- ..._flake8_pyi__tests__PYI026_PYI026.pyi.snap | 10 +- ..._flake8_pyi__tests__PYI029_PYI029.pyi.snap | 6 +- ...__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 | 10 +- ..._flake8_pyi__tests__PYI054_PYI054.pyi.snap | 16 +-- ...__flake8_pyi__tests__PYI055_PYI055.py.snap | 6 +- ..._flake8_pyi__tests__PYI055_PYI055.pyi.snap | 18 ++-- ...e8_pyi__tests__py38_PYI026_PYI026.pyi.snap | 10 +- ...e8_pytest_style__tests__PT001_default.snap | 6 +- ...st_style__tests__PT001_no_parentheses.snap | 12 +-- ...es__flake8_pytest_style__tests__PT003.snap | 16 +-- ...flake8_pytest_style__tests__PT006_csv.snap | 8 +- ...e8_pytest_style__tests__PT006_default.snap | 24 ++--- ...lake8_pytest_style__tests__PT006_list.snap | 20 ++-- ...es__flake8_pytest_style__tests__PT009.snap | 58 +++++----- ...es__flake8_pytest_style__tests__PT014.snap | 16 +-- ...es__flake8_pytest_style__tests__PT018.snap | 30 +++--- ...es__flake8_pytest_style__tests__PT022.snap | 6 +- ...e8_pytest_style__tests__PT023_default.snap | 10 +- ...st_style__tests__PT023_no_parentheses.snap | 10 +- ...es__flake8_pytest_style__tests__PT024.snap | 8 +- ...es__flake8_pytest_style__tests__PT025.snap | 4 +- ...es__flake8_pytest_style__tests__PT026.snap | 4 +- ...__flake8_pytest_style__tests__PT027_0.snap | 16 +-- ...__flake8_pytest_style__tests__PT027_1.snap | 2 +- ...ing_doubles_over_docstring_doubles.py.snap | 10 +- ...ubles_over_docstring_doubles_class.py.snap | 4 +- ...es_over_docstring_doubles_function.py.snap | 10 +- ...docstring_doubles_module_multiline.py.snap | 4 +- ...ocstring_doubles_module_singleline.py.snap | 4 +- ...ing_doubles_over_docstring_singles.py.snap | 6 +- ...ubles_over_docstring_singles_class.py.snap | 6 +- ...es_over_docstring_singles_function.py.snap | 6 +- ...docstring_singles_module_multiline.py.snap | 2 +- ...ocstring_singles_module_singleline.py.snap | 2 +- ...ing_singles_over_docstring_doubles.py.snap | 6 +- ...ngles_over_docstring_doubles_class.py.snap | 6 +- ...es_over_docstring_doubles_function.py.snap | 6 +- ...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 | 4 +- ...es_over_docstring_singles_function.py.snap | 10 +- ...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 +- ...uire_doubles_over_singles_implicit.py.snap | 14 +-- ...bles_over_singles_multiline_string.py.snap | 2 +- ...ests__require_singles_over_doubles.py.snap | 6 +- ...quire_singles_over_doubles_escaped.py.snap | 26 ++--- ...re_singles_over_doubles_escaped_py311.snap | 12 +-- ...uire_singles_over_doubles_implicit.py.snap | 14 +-- ...gles_over_doubles_multiline_string.py.snap | 2 +- ...ry-paren-on-raise-exception_RSE102.py.snap | 26 ++--- ...lake8_return__tests__RET501_RET501.py.snap | 4 +- ...lake8_return__tests__RET502_RET502.py.snap | 2 +- ...lake8_return__tests__RET503_RET503.py.snap | 40 +++---- ...lake8_return__tests__RET504_RET504.py.snap | 22 ++-- ...ke8_simplify__tests__SIM101_SIM101.py.snap | 16 +-- ...ke8_simplify__tests__SIM102_SIM102.py.snap | 24 ++--- ...ke8_simplify__tests__SIM103_SIM103.py.snap | 8 +- ...8_simplify__tests__SIM105_SIM105_0.py.snap | 18 ++-- ...8_simplify__tests__SIM105_SIM105_1.py.snap | 2 +- ...8_simplify__tests__SIM105_SIM105_2.py.snap | 2 +- ...8_simplify__tests__SIM105_SIM105_4.py.snap | 2 +- ...ke8_simplify__tests__SIM108_SIM108.py.snap | 6 +- ...ke8_simplify__tests__SIM109_SIM109.py.snap | 8 +- ...ke8_simplify__tests__SIM110_SIM110.py.snap | 24 ++--- ...ke8_simplify__tests__SIM110_SIM111.py.snap | 24 ++--- ...ke8_simplify__tests__SIM112_SIM112.py.snap | 6 +- ...ke8_simplify__tests__SIM117_SIM117.py.snap | 20 ++-- ...ke8_simplify__tests__SIM118_SIM118.py.snap | 38 +++---- ...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__SIM210_SIM210.py.snap | 8 +- ...ke8_simplify__tests__SIM211_SIM211.py.snap | 6 +- ...ke8_simplify__tests__SIM212_SIM212.py.snap | 4 +- ...ke8_simplify__tests__SIM220_SIM220.py.snap | 6 +- ...ke8_simplify__tests__SIM221_SIM221.py.snap | 6 +- ...ke8_simplify__tests__SIM222_SIM222.py.snap | 102 +++++++++--------- ...ke8_simplify__tests__SIM223_SIM223.py.snap | 98 ++++++++--------- ...ke8_simplify__tests__SIM300_SIM300.py.snap | 34 +++--- ...ke8_simplify__tests__SIM401_SIM401.py.snap | 12 +-- ...ke8_simplify__tests__SIM910_SIM910.py.snap | 10 +- ...ify__tests__preview__SIM118_SIM118.py.snap | 38 +++---- ...ify__tests__preview__SIM401_SIM401.py.snap | 16 +-- ...ts__tests__ban_parent_imports_package.snap | 12 +-- ..._invalid-todo-capitalization_TD006.py.snap | 6 +- ...lake8_trio__tests__TRIO105_TRIO105.py.snap | 48 ++++----- ...lake8_trio__tests__TRIO115_TRIO115.py.snap | 12 +-- ...__empty-type-checking-block_TCH005.py.snap | 10 +- ..._type_checking__tests__exempt_modules.snap | 2 +- ...ke8_type_checking__tests__import_from.snap | 2 +- ...ests__import_from_type_checking_block.snap | 2 +- ...ype_checking__tests__multiple_members.snap | 4 +- ...sts__multiple_modules_different_types.snap | 4 +- ...ng__tests__multiple_modules_same_type.snap | 4 +- ...ype_checking__tests__no_typing_import.snap | 2 +- ...rt-in-type-checking-block_TCH004_1.py.snap | 2 +- ...t-in-type-checking-block_TCH004_11.py.snap | 2 +- ...t-in-type-checking-block_TCH004_12.py.snap | 2 +- ...rt-in-type-checking-block_TCH004_2.py.snap | 2 +- ...rt-in-type-checking-block_TCH004_4.py.snap | 2 +- ...rt-in-type-checking-block_TCH004_5.py.snap | 6 +- ...rt-in-type-checking-block_TCH004_9.py.snap | 4 +- ...k_runtime_evaluated_base_classes_1.py.snap | 6 +- ...ock_runtime_evaluated_decorators_1.py.snap | 6 +- ...__flake8_type_checking__tests__strict.snap | 16 +-- ...ests__type_checking_block_after_usage.snap | 2 +- ...g__tests__type_checking_block_comment.snap | 2 +- ...ng__tests__type_checking_block_inline.snap | 2 +- ...__tests__type_checking_block_own_line.snap | 2 +- ...ing-only-first-party-import_TCH001.py.snap | 2 +- ...nly-standard-library-import_TCH003.py.snap | 2 +- ...t_runtime_evaluated_base_classes_3.py.snap | 2 +- ...ort_runtime_evaluated_decorators_3.py.snap | 2 +- ...ing-only-third-party-import_TCH002.py.snap | 18 ++-- ...t_runtime_evaluated_base_classes_2.py.snap | 4 +- ...ort_runtime_evaluated_decorators_2.py.snap | 2 +- ...ing-only-third-party-import_strict.py.snap | 4 +- ...s__typing_import_after_package_import.snap | 2 +- ...__typing_import_before_package_import.snap | 2 +- ..._use_pathlib__tests__PTH201_PTH201.py.snap | 8 +- ...rules__flynt__tests__FLY002_FLY002.py.snap | 14 +-- ...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 +- ...ombined_required_imports_docstring.py.snap | 4 +- ...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 +- ..._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 +- ...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 +- ...lder_separate_local_folder_imports.py.snap | 2 +- ...ts_lines_after_imports_class_after.py.snap | 2 +- ...rts_lines_after_imports_func_after.py.snap | 2 +- ..._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 +- ..._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 +- ...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 +- ...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 +- ...__numpy-deprecated-function_NPY003.py.snap | 20 ++-- ...numpy-deprecated-type-alias_NPY001.py.snap | 14 +-- ...__tests__numpy2-deprecation_NPY201.py.snap | 56 +++++----- ...es__pandas_vet__tests__PD002_PD002.py.snap | 14 +-- ..._rules__pandas_vet__tests__PD002_fail.snap | 2 +- ...__perflint__tests__PERF101_PERF101.py.snap | 16 +-- ...__perflint__tests__PERF102_PERF102.py.snap | 24 ++--- .../pycodestyle/rules/lambda_assignment.rs | 2 +- ...ules__pycodestyle__tests__E201_E20.py.snap | 16 +-- ...ules__pycodestyle__tests__E202_E20.py.snap | 14 +-- ...ules__pycodestyle__tests__E203_E20.py.snap | 12 +-- ...ules__pycodestyle__tests__E211_E21.py.snap | 14 +-- ...ules__pycodestyle__tests__E223_E22.py.snap | 2 +- ...ules__pycodestyle__tests__E224_E22.py.snap | 2 +- ...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 | 14 +-- ...ules__pycodestyle__tests__E242_E24.py.snap | 2 +- ...ules__pycodestyle__tests__E252_E25.py.snap | 8 +- ...ules__pycodestyle__tests__E261_E26.py.snap | 2 +- ...ules__pycodestyle__tests__E273_E27.py.snap | 10 +- ...ules__pycodestyle__tests__E274_E27.py.snap | 4 +- ...ules__pycodestyle__tests__E275_E27.py.snap | 10 +- ...ules__pycodestyle__tests__E703_E70.py.snap | 10 +- ...les__pycodestyle__tests__E711_E711.py.snap | 20 ++-- ...les__pycodestyle__tests__E712_E712.py.snap | 26 ++--- ...les__pycodestyle__tests__E713_E713.py.snap | 12 +-- ...les__pycodestyle__tests__E714_E714.py.snap | 6 +- ...les__pycodestyle__tests__E731_E731.py.snap | 38 +++---- ...ules__pycodestyle__tests__W291_W29.py.snap | 6 +- ...s__pycodestyle__tests__W292_W292_0.py.snap | 2 +- ...ules__pycodestyle__tests__W293_W29.py.snap | 2 +- ...s__pycodestyle__tests__W605_W605_0.py.snap | 14 +-- ...s__pycodestyle__tests__W605_W605_1.py.snap | 10 +- ...s__pycodestyle__tests__W605_W605_2.py.snap | 22 ++-- ...pycodestyle__tests__constant_literals.snap | 18 ++-- ...er__rules__pycodestyle__tests__w292_4.snap | 2 +- ...__rules__pydocstyle__tests__D200_D.py.snap | 6 +- ...ules__pydocstyle__tests__D200_D200.py.snap | 2 +- ...__rules__pydocstyle__tests__D201_D.py.snap | 8 +- ...__rules__pydocstyle__tests__D202_D.py.snap | 8 +- ...ules__pydocstyle__tests__D202_D202.py.snap | 6 +- ...__rules__pydocstyle__tests__D203_D.py.snap | 12 +-- ...__rules__pydocstyle__tests__D204_D.py.snap | 10 +- ...__rules__pydocstyle__tests__D205_D.py.snap | 2 +- ...__rules__pydocstyle__tests__D207_D.py.snap | 8 +- ...__rules__pydocstyle__tests__D208_D.py.snap | 6 +- ...__rules__pydocstyle__tests__D209_D.py.snap | 4 +- ...__rules__pydocstyle__tests__D210_D.py.snap | 6 +- ...__rules__pydocstyle__tests__D211_D.py.snap | 4 +- ...__rules__pydocstyle__tests__D212_D.py.snap | 6 +- ...__rules__pydocstyle__tests__D213_D.py.snap | 44 ++++---- ...ydocstyle__tests__D214_D214_module.py.snap | 4 +- ...__pydocstyle__tests__D214_sections.py.snap | 2 +- ...ules__pydocstyle__tests__D215_D215.py.snap | 2 +- ...__pydocstyle__tests__D215_sections.py.snap | 4 +- ...__rules__pydocstyle__tests__D301_D.py.snap | 2 +- ...ules__pydocstyle__tests__D301_D301.py.snap | 2 +- ...__rules__pydocstyle__tests__D400_D.py.snap | 34 +++--- ...ules__pydocstyle__tests__D400_D400.py.snap | 24 ++--- ...ules__pydocstyle__tests__D403_D403.py.snap | 2 +- ...__pydocstyle__tests__D405_sections.py.snap | 4 +- ...__pydocstyle__tests__D406_sections.py.snap | 4 +- ...__pydocstyle__tests__D407_sections.py.snap | 38 +++---- ...__pydocstyle__tests__D408_sections.py.snap | 2 +- ...__pydocstyle__tests__D409_sections.py.snap | 4 +- ...ules__pydocstyle__tests__D410_D410.py.snap | 4 +- ...__pydocstyle__tests__D410_sections.py.snap | 4 +- ...__pydocstyle__tests__D411_sections.py.snap | 6 +- ...__pydocstyle__tests__D412_sections.py.snap | 2 +- ...__pydocstyle__tests__D413_sections.py.snap | 2 +- ...__rules__pydocstyle__tests__D415_D.py.snap | 32 +++--- ...__rules__pydocstyle__tests__d209_d400.snap | 4 +- ...pydocstyle__tests__preview__D300_D.py.snap | 20 ++-- ...ocstyle__tests__preview__D300_D300.py.snap | 3 +- ...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 +- ...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 +- ..._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__F601_F601.py.snap | 16 +-- ..._rules__pyflakes__tests__F602_F602.py.snap | 12 +-- ..._rules__pyflakes__tests__F632_F632.py.snap | 22 ++-- ...ules__pyflakes__tests__F841_F841_0.py.snap | 18 ++-- ...ules__pyflakes__tests__F841_F841_1.py.snap | 4 +- ...ules__pyflakes__tests__F841_F841_3.py.snap | 64 +++++------ ...ules__pyflakes__tests__F841_F841_4.py.snap | 2 +- ..._rules__pyflakes__tests__F901_F901.py.snap | 4 +- ...hadowed_global_import_in_global_scope.snap | 2 +- ...shadowed_global_import_in_local_scope.snap | 2 +- ...shadowed_import_shadow_in_local_scope.snap | 2 +- ...lakes__tests__f841_dummy_variable_rgx.snap | 24 ++--- ...__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 | 32 +++--- ...lakes__tests__preview__F841_F841_4.py.snap | 2 +- ...in_body_after_double_shadowing_except.snap | 4 +- ..._print_in_body_after_shadowing_except.snap | 2 +- ..._tests__PLC0208_iteration_over_set.py.snap | 16 +-- ...nt__tests__PLC0414_import_aliasing.py.snap | 16 +-- ..._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 799 -> 809 bytes ..._tests__PLE2515_invalid_characters.py.snap | 16 +-- ...nt__tests__PLR0402_import_aliasing.py.snap | 4 +- ..._PLR1701_repeated_isinstance_calls.py.snap | 14 +-- ...int__tests__PLR1706_and_or_ternary.py.snap | 22 ++-- ...int__tests__PLR1711_useless_return.py.snap | 12 +-- ...R1714_repeated_equality_comparison.py.snap | 28 ++--- ...t__tests__PLR1722_sys_exit_alias_0.py.snap | 8 +- ...t__tests__PLR1722_sys_exit_alias_1.py.snap | 8 +- ...__tests__PLR1722_sys_exit_alias_11.py.snap | 2 +- ...__tests__PLR1722_sys_exit_alias_12.py.snap | 2 +- ...t__tests__PLR1722_sys_exit_alias_2.py.snap | 8 +- ...t__tests__PLR1722_sys_exit_alias_3.py.snap | 4 +- ...t__tests__PLR1722_sys_exit_alias_4.py.snap | 8 +- ...t__tests__PLR1722_sys_exit_alias_5.py.snap | 8 +- ...t__tests__PLR1722_sys_exit_alias_6.py.snap | 4 +- ...t__tests__PLR1722_sys_exit_alias_7.py.snap | 2 +- ...t__tests__PLR1722_sys_exit_alias_8.py.snap | 2 +- ...t__tests__PLR1722_sys_exit_alias_9.py.snap | 2 +- ..._tests__PLR6201_literal_membership.py.snap | 6 +- ...int__tests__PLW3301_nested_min_max.py.snap | 28 ++--- ...int__tests__repeated_isinstance_calls.snap | 14 +-- ...er__rules__pyupgrade__tests__UP001.py.snap | 4 +- ...er__rules__pyupgrade__tests__UP003.py.snap | 12 +-- ...er__rules__pyupgrade__tests__UP004.py.snap | 46 ++++---- ...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 | 34 +++--- ...er__rules__pyupgrade__tests__UP008.py.snap | 10 +- ...__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 | 52 ++++----- ...er__rules__pyupgrade__tests__UP013.py.snap | 24 ++--- ...er__rules__pyupgrade__tests__UP014.py.snap | 10 +- ...er__rules__pyupgrade__tests__UP015.py.snap | 88 +++++++-------- ...er__rules__pyupgrade__tests__UP018.py.snap | 30 +++--- ...er__rules__pyupgrade__tests__UP019.py.snap | 8 +- ...er__rules__pyupgrade__tests__UP020.py.snap | 2 +- ...er__rules__pyupgrade__tests__UP021.py.snap | 6 +- ...er__rules__pyupgrade__tests__UP022.py.snap | 14 +-- ...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 | 24 ++--- ...er__rules__pyupgrade__tests__UP026.py.snap | 52 ++++----- ...er__rules__pyupgrade__tests__UP027.py.snap | 10 +- ...__rules__pyupgrade__tests__UP028_0.py.snap | 26 ++--- ...er__rules__pyupgrade__tests__UP029.py.snap | 8 +- ...__rules__pyupgrade__tests__UP030_0.py.snap | 46 ++++---- ...__rules__pyupgrade__tests__UP031_0.py.snap | 82 +++++++------- ...__rules__pyupgrade__tests__UP032_0.py.snap | 88 +++++++-------- ...__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 | 94 ++++++++-------- ...__rules__pyupgrade__tests__UP036_0.py.snap | 64 +++++------ ...__rules__pyupgrade__tests__UP036_1.py.snap | 26 ++--- ...__rules__pyupgrade__tests__UP036_2.py.snap | 24 ++--- ...__rules__pyupgrade__tests__UP036_3.py.snap | 6 +- ...__rules__pyupgrade__tests__UP036_4.py.snap | 16 +-- ...__rules__pyupgrade__tests__UP036_5.py.snap | 4 +- ...er__rules__pyupgrade__tests__UP037.py.snap | 56 +++++----- ...er__rules__pyupgrade__tests__UP038.py.snap | 4 +- ...er__rules__pyupgrade__tests__UP039.py.snap | 10 +- ...er__rules__pyupgrade__tests__UP040.py.snap | 22 ++-- ...r__rules__pyupgrade__tests__UP040.pyi.snap | 4 +- ...er__rules__pyupgrade__tests__UP041.py.snap | 10 +- ...rade__tests__datetime_utc_alias_py311.snap | 8 +- ..._annotations_keep_runtime_typing_p310.snap | 8 +- ...tests__future_annotations_pep_585_p37.snap | 2 +- ...sts__future_annotations_pep_585_py310.snap | 8 +- ...tests__future_annotations_pep_604_p37.snap | 2 +- ...sts__future_annotations_pep_604_py310.snap | 4 +- ...es__refurb__tests__FURB105_FURB105.py.snap | 34 +++--- ...es__refurb__tests__FURB113_FURB113.py.snap | 24 ++--- ...es__refurb__tests__FURB131_FURB131.py.snap | 14 +-- ...es__refurb__tests__FURB132_FURB132.py.snap | 8 +- ...es__refurb__tests__FURB140_FURB140.py.snap | 18 ++-- ...es__refurb__tests__FURB145_FURB145.py.snap | 12 +-- ...es__refurb__tests__FURB148_FURB148.py.snap | 40 +++---- ...es__refurb__tests__FURB168_FURB168.py.snap | 16 +-- ...es__refurb__tests__FURB169_FURB169.py.snap | 24 ++--- ...es__refurb__tests__FURB171_FURB171.py.snap | 12 +-- ..._ruff__tests__PY39_RUF013_RUF013_0.py.snap | 44 ++++---- ..._ruff__tests__PY39_RUF013_RUF013_1.py.snap | 2 +- ..._rules__ruff__tests__RUF005_RUF005.py.snap | 30 +++--- ..._rules__ruff__tests__RUF010_RUF010.py.snap | 24 ++--- ...ules__ruff__tests__RUF013_RUF013_0.py.snap | 44 ++++---- ...ules__ruff__tests__RUF013_RUF013_1.py.snap | 2 +- ..._rules__ruff__tests__RUF015_RUF015.py.snap | 40 +++---- ...ules__ruff__tests__RUF017_RUF017_0.py.snap | 14 +-- ...ules__ruff__tests__RUF017_RUF017_1.py.snap | 2 +- ..._rules__ruff__tests__RUF019_RUF019.py.snap | 8 +- ...ruff_linter__rules__ruff__tests__noqa.snap | 2 +- ..._linter__rules__ruff__tests__ruf100_0.snap | 28 ++--- ...__rules__ruff__tests__ruf100_0_prefix.snap | 26 ++--- ..._linter__rules__ruff__tests__ruf100_1.snap | 16 +-- ..._linter__rules__ruff__tests__ruf100_2.snap | 2 +- ..._linter__rules__ruff__tests__ruf100_3.snap | 38 +++---- ..._linter__rules__ruff__tests__ruf100_5.snap | 6 +- ...__rules__ruff__tests__ruff_noqa_codes.snap | 2 +- ...rules__ruff__tests__ruff_noqa_invalid.snap | 4 +- ...atops__tests__verbose-raise_TRY201.py.snap | 6 +- ...linter__linter__tests__import_sorting.snap | 8 +- ...er__linter__tests__ipy_escape_command.snap | 2 +- ...inter__linter__tests__unused_variable.snap | 8 +- 523 files changed, 3085 insertions(+), 3086 deletions(-) diff --git a/crates/ruff_diagnostics/src/fix.rs b/crates/ruff_diagnostics/src/fix.rs index d44ef411ce..751258508f 100644 --- a/crates/ruff_diagnostics/src/fix.rs +++ b/crates/ruff_diagnostics/src/fix.rs @@ -12,7 +12,7 @@ use crate::edit::Edit; pub enum Applicability { /// The fix is unsafe and should only be displayed for manual application by the user. /// The fix is likely to be incorrect or the resulting code may have invalid syntax. - Display, + DisplayOnly, /// The fix is unsafe and should only be applied with user opt-in. /// The fix may be what the user intended, but it is uncertain; the resulting code will have valid syntax. @@ -87,22 +87,22 @@ impl Fix { } } - /// Create a new [`Fix`] that should only [display](Applicability::Display) and not apply from an [`Edit`] element . - pub fn display_edit(edit: Edit) -> Self { + /// Create a new [`Fix`] that should only [display](Applicability::DisplayOnly) and not apply from an [`Edit`] element . + pub fn display_only_edit(edit: Edit) -> Self { Self { edits: vec![edit], - applicability: Applicability::Display, + applicability: Applicability::DisplayOnly, isolation_level: IsolationLevel::default(), } } - /// Create a new [`Fix`] that should only [display](Applicability::Display) and not apply from multiple [`Edit`] elements. - pub fn display_edits(edit: Edit, rest: impl IntoIterator) -> Self { + /// Create a new [`Fix`] that should only [display](Applicability::DisplayOnly) and not apply from multiple [`Edit`] elements. + pub fn display_only_edits(edit: Edit, rest: impl IntoIterator) -> Self { let mut edits: Vec = std::iter::once(edit).chain(rest).collect(); edits.sort_by_key(|edit| (edit.start(), edit.end())); Self { edits, - applicability: Applicability::Display, + applicability: Applicability::DisplayOnly, isolation_level: IsolationLevel::default(), } } diff --git a/crates/ruff_linter/src/message/diff.rs b/crates/ruff_linter/src/message/diff.rs index 6bfe8750c4..2ba3f24ee2 100644 --- a/crates/ruff_linter/src/message/diff.rs +++ b/crates/ruff_linter/src/message/diff.rs @@ -54,9 +54,9 @@ impl Display for Diff<'_> { let message = match self.fix.applicability() { // TODO(zanieb): Adjust this messaging once it's user-facing - Applicability::Safe => "Fix", - Applicability::Unsafe => "Suggested fix", - Applicability::Display => "Possible fix", + Applicability::Safe => "Safe fix", + Applicability::Unsafe => "Unsafe fix", + Applicability::DisplayOnly => "Display-only fix", }; writeln!(f, "ℹ {}", message.blue())?; diff --git a/crates/ruff_linter/src/rules/eradicate/rules/commented_out_code.rs b/crates/ruff_linter/src/rules/eradicate/rules/commented_out_code.rs index 6dbe63570f..fd468a2c23 100644 --- a/crates/ruff_linter/src/rules/eradicate/rules/commented_out_code.rs +++ b/crates/ruff_linter/src/rules/eradicate/rules/commented_out_code.rs @@ -66,7 +66,7 @@ pub(crate) fn commented_out_code( if is_standalone_comment(line) && comment_contains_code(line, &settings.task_tags[..]) { let mut diagnostic = Diagnostic::new(CommentedOutCode, *range); - diagnostic.set_fix(Fix::display_edit(Edit::range_deletion( + diagnostic.set_fix(Fix::display_only_edit(Edit::range_deletion( locator.full_lines_range(*range), ))); diagnostics.push(diagnostic); 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 ae9b958872..6864796be7 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,7 @@ ERA001.py:1:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Possible fix +ℹ Display-only fix 1 |-#import os 2 1 | # from foo import junk 3 2 | #a = 3 @@ -26,7 +26,7 @@ ERA001.py:2:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Possible fix +ℹ Display-only fix 1 1 | #import os 2 |-# from foo import junk 3 2 | #a = 3 @@ -44,7 +44,7 @@ ERA001.py:3:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Possible fix +ℹ Display-only fix 1 1 | #import os 2 2 | # from foo import junk 3 |-#a = 3 @@ -63,7 +63,7 @@ ERA001.py:5:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Possible fix +ℹ Display-only fix 2 2 | # from foo import junk 3 3 | #a = 3 4 4 | a = 4 @@ -82,7 +82,7 @@ ERA001.py:13:5: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Possible fix +ℹ Display-only fix 10 10 | 11 11 | # This is a real comment. 12 12 | # # This is a (nested) comment. @@ -100,7 +100,7 @@ ERA001.py:21:5: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Possible fix +ℹ Display-only fix 18 18 | 19 19 | class A(): 20 20 | pass @@ -120,7 +120,7 @@ ERA001.py:26:5: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Possible fix +ℹ Display-only fix 23 23 | 24 24 | dictionary = { 25 25 | # "key1": 123, # noqa: ERA001 @@ -139,7 +139,7 @@ ERA001.py:27:5: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Possible fix +ℹ Display-only fix 24 24 | dictionary = { 25 25 | # "key1": 123, # noqa: ERA001 26 26 | # "key2": 456, 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 46f4faabe2..e54d5ec02a 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 @@ -252,7 +252,7 @@ annotation_presence.py:159:9: ANN204 [*] Missing return type annotation for spec | = help: Add `None` return type -ℹ Suggested fix +ℹ Unsafe fix 156 156 | 157 157 | class Foo: 158 158 | @decorator() @@ -272,7 +272,7 @@ annotation_presence.py:165:9: ANN204 [*] Missing return type annotation for spec | = help: Add `None` return type -ℹ Suggested fix +ℹ Unsafe 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__mypy_init_return.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap index 193ef4f8ba..0f3a069545 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 `None` return type -ℹ Suggested fix +ℹ Unsafe fix 2 2 | 3 3 | # Error 4 4 | class Foo: @@ -31,7 +31,7 @@ mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special | = help: Add `None` return type -ℹ Suggested fix +ℹ Unsafe fix 8 8 | 9 9 | # Error 10 10 | class Foo: @@ -59,7 +59,7 @@ mypy_init_return.py:47:9: ANN204 [*] Missing return type annotation for special | = help: Add `None` return type -ℹ Suggested fix +ℹ Unsafe 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 8dd48048c6..a2fca17824 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 `None` return type -ℹ Suggested fix +ℹ Unsafe fix 1 1 | class Foo: 2 |- def __str__(self): 2 |+ def __str__(self) -> str: @@ -28,7 +28,7 @@ simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for speci | = help: Add `None` return type -ℹ Suggested fix +ℹ Unsafe fix 2 2 | def __str__(self): 3 3 | ... 4 4 | @@ -48,7 +48,7 @@ simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for speci | = help: Add `None` return type -ℹ Suggested fix +ℹ Unsafe fix 5 5 | def __repr__(self): 6 6 | ... 7 7 | @@ -68,7 +68,7 @@ simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for spec | = help: Add `None` return type -ℹ Suggested fix +ℹ Unsafe fix 8 8 | def __len__(self): 9 9 | ... 10 10 | @@ -88,7 +88,7 @@ simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for spec | = help: Add `None` return type -ℹ Suggested fix +ℹ Unsafe fix 11 11 | def __length_hint__(self): 12 12 | ... 13 13 | @@ -108,7 +108,7 @@ simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for spec | = help: Add `None` return type -ℹ Suggested fix +ℹ Unsafe fix 14 14 | def __init__(self): 15 15 | ... 16 16 | @@ -128,7 +128,7 @@ simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for spec | = help: Add `None` return type -ℹ Suggested fix +ℹ Unsafe fix 17 17 | def __del__(self): 18 18 | ... 19 19 | @@ -148,7 +148,7 @@ simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for spec | = help: Add `None` return type -ℹ Suggested fix +ℹ Unsafe fix 20 20 | def __bool__(self): 21 21 | ... 22 22 | @@ -168,7 +168,7 @@ simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for spec | = help: Add `None` return type -ℹ Suggested fix +ℹ Unsafe fix 23 23 | def __bytes__(self): 24 24 | ... 25 25 | @@ -188,7 +188,7 @@ simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for spec | = help: Add `None` return type -ℹ Suggested fix +ℹ Unsafe fix 26 26 | def __format__(self, format_spec): 27 27 | ... 28 28 | @@ -208,7 +208,7 @@ simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for spec | = help: Add `None` return type -ℹ Suggested fix +ℹ Unsafe fix 29 29 | def __contains__(self, item): 30 30 | ... 31 31 | @@ -228,7 +228,7 @@ simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for spec | = help: Add `None` return type -ℹ Suggested fix +ℹ Unsafe fix 32 32 | def __complex__(self): 33 33 | ... 34 34 | @@ -248,7 +248,7 @@ simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for spec | = help: Add `None` return type -ℹ Suggested fix +ℹ Unsafe fix 35 35 | def __int__(self): 36 36 | ... 37 37 | @@ -268,7 +268,7 @@ simple_magic_methods.py:41:9: ANN204 [*] Missing return type annotation for spec | = help: Add `None` return type -ℹ Suggested fix +ℹ Unsafe fix 38 38 | def __float__(self): 39 39 | ... 40 40 | 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 67c56e33de..69af59e452 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()` -ℹ Fix +ℹ Safe fix 1 1 | def this_is_a_bug(): 2 2 | o = object() 3 |- if hasattr(o, "__call__"): 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 aa5ecfb3f1..4720535da3 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,7 @@ B006_1.py:3:22: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe 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 f37779627e..522733a5cd 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,7 @@ B006_2.py:4:22: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe 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 2013a5d199..cd7da7f1fa 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 -ℹ Suggested fix +ℹ Unsafe 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 59188b0678..2494c15ac4 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 -ℹ Suggested fix +ℹ Unsafe 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 bea5f44bb4..24ad24f06b 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 -ℹ Suggested fix +ℹ Unsafe fix 2 2 | # https://github.com/astral-sh/ruff/issues/7616 3 3 | 4 4 | @@ -30,7 +30,7 @@ B006_5.py:9:61: B006 [*] Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 6 6 | import os 7 7 | 8 8 | @@ -53,7 +53,7 @@ B006_5.py:15:50: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 12 12 | return 2 13 13 | 14 14 | @@ -76,7 +76,7 @@ B006_5.py:21:54: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 18 18 | import itertools 19 19 | 20 20 | @@ -98,7 +98,7 @@ B006_5.py:25:55: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 22 22 | from os import path 23 23 | 24 24 | @@ -121,7 +121,7 @@ B006_5.py:30:66: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 27 27 | from sys import version_info 28 28 | 29 29 | @@ -144,7 +144,7 @@ B006_5.py:35:59: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 32 32 | from sys import version_info 33 33 | 34 34 | @@ -167,7 +167,7 @@ B006_5.py:40:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 37 37 | import os 38 38 | 39 39 | @@ -190,7 +190,7 @@ B006_5.py:45:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 42 42 | import os; import sys 43 43 | 44 44 | @@ -212,7 +212,7 @@ B006_5.py:50:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 47 47 | import os; import sys; x = 1 48 48 | 49 49 | @@ -234,7 +234,7 @@ B006_5.py:55:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 52 52 | import os; import sys 53 53 | 54 54 | @@ -255,7 +255,7 @@ B006_5.py:59:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 56 56 | import os; import sys 57 57 | 58 58 | @@ -275,7 +275,7 @@ B006_5.py:63:49: B006 [*] Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe 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 be764fc137..032ad0e132 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 -ℹ Suggested fix +ℹ Unsafe 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 39599123bd..05fdbd20f1 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 -ℹ Suggested fix +ℹ Unsafe 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_B008.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap index 1f5f6764a6..eae2c6f647 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 -ℹ Suggested fix +ℹ Unsafe fix 60 60 | # Flag mutable literals/comprehensions 61 61 | 62 62 | @@ -29,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 -ℹ Suggested fix +ℹ Unsafe fix 64 64 | ... 65 65 | 66 66 | @@ -51,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 -ℹ Suggested fix +ℹ Unsafe fix 70 70 | 71 71 | class Foo: 72 72 | @staticmethod @@ -74,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 -ℹ Suggested fix +ℹ Unsafe fix 74 74 | pass 75 75 | 76 76 | @@ -105,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 -ℹ Suggested fix +ℹ Unsafe fix 82 82 | def single_line_func_wrong(value = {}): ... 83 83 | 84 84 | @@ -125,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 -ℹ Suggested fix +ℹ Unsafe fix 86 86 | ... 87 87 | 88 88 | @@ -145,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 -ℹ Suggested fix +ℹ Unsafe fix 90 90 | ... 91 91 | 92 92 | @@ -165,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 -ℹ Suggested fix +ℹ Unsafe fix 94 94 | ... 95 95 | 96 96 | @@ -186,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 -ℹ Suggested fix +ℹ Unsafe fix 99 99 | 100 100 | 101 101 | # N.B. we're also flagging the function call in the comprehension @@ -206,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 -ℹ Suggested fix +ℹ Unsafe fix 103 103 | pass 104 104 | 105 105 | @@ -226,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 -ℹ Suggested fix +ℹ Unsafe fix 107 107 | pass 108 108 | 109 109 | @@ -246,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 -ℹ Suggested fix +ℹ Unsafe fix 111 111 | pass 112 112 | 113 113 | @@ -268,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 -ℹ Suggested fix +ℹ Unsafe fix 236 236 | 237 237 | # B006 and B008 238 238 | # We should handle arbitrary nesting of these B008. @@ -290,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 -ℹ Suggested fix +ℹ Unsafe fix 273 273 | 274 274 | 275 275 | def mutable_annotations( @@ -317,7 +317,7 @@ B006_B008.py:277:35: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 274 274 | 275 275 | def mutable_annotations( 276 276 | a: list[int] | None = [], @@ -343,7 +343,7 @@ B006_B008.py:278:62: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 275 275 | def mutable_annotations( 276 276 | a: list[int] | None = [], 277 277 | b: Optional[Dict[int, int]] = {}, @@ -368,7 +368,7 @@ B006_B008.py:279:80: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe 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(), @@ -389,7 +389,7 @@ B006_B008.py:284:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 281 281 | pass 282 282 | 283 283 | @@ -411,7 +411,7 @@ B006_B008.py:288:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 285 285 | """Docstring""" 286 286 | 287 287 | @@ -432,7 +432,7 @@ B006_B008.py:293:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 290 290 | ... 291 291 | 292 292 | @@ -453,7 +453,7 @@ B006_B008.py:297:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 294 294 | """Docstring"""; ... 295 295 | 296 296 | @@ -476,7 +476,7 @@ B006_B008.py:302:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe fix 299 299 | ... 300 300 | 301 301 | @@ -508,7 +508,7 @@ B006_B008.py:313:52: B006 [*] Do not use mutable data structures for argument de | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe 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 283f28ee82..5f36888c89 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` -ℹ Suggested fix +ℹ Unsafe fix 15 15 | 16 16 | for i in range(10): 17 17 | for j in range(10): @@ -47,7 +47,7 @@ B007.py:30:13: B007 [*] Loop control variable `k` not used within loop body | = help: Rename unused `k` to `_k` -ℹ Suggested fix +ℹ Unsafe fix 27 27 | yield i, (j, (k, l)) 28 28 | 29 29 | @@ -110,7 +110,7 @@ B007.py:52:14: B007 [*] Loop control variable `bar` not used within loop body | = help: Rename unused `bar` to `_bar` -ℹ Suggested fix +ℹ Unsafe fix 49 49 | 50 50 | def f(): 51 51 | # Fixable. @@ -142,7 +142,7 @@ B007.py:68:14: B007 [*] Loop control variable `bar` not used within loop body | = help: Rename unused `bar` to `_bar` -ℹ Suggested fix +ℹ Unsafe 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 42c4808fec..6e6b51e423 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 -ℹ Fix +ℹ Safe fix 16 16 | getattr(foo, "__123abc") 17 17 | 18 18 | # Invalid usage @@ -32,7 +32,7 @@ B009_B010.py:20:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Fix +ℹ Safe fix 17 17 | 18 18 | # Invalid usage 19 19 | getattr(foo, "bar") @@ -53,7 +53,7 @@ B009_B010.py:21:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Fix +ℹ Safe fix 18 18 | # Invalid usage 19 19 | getattr(foo, "bar") 20 20 | getattr(foo, "_123abc") @@ -74,7 +74,7 @@ B009_B010.py:22:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Fix +ℹ Safe fix 19 19 | getattr(foo, "bar") 20 20 | getattr(foo, "_123abc") 21 21 | getattr(foo, "__123abc__") @@ -95,7 +95,7 @@ B009_B010.py:23:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Fix +ℹ Safe fix 20 20 | getattr(foo, "_123abc") 21 21 | getattr(foo, "__123abc__") 22 22 | getattr(foo, "abc123") @@ -116,7 +116,7 @@ B009_B010.py:24:15: B009 [*] Do not call `getattr` with a constant attribute val | = help: Replace `getattr` with attribute access -ℹ Fix +ℹ Safe fix 21 21 | getattr(foo, "__123abc__") 22 22 | getattr(foo, "abc123") 23 23 | getattr(foo, r"abc123") @@ -137,7 +137,7 @@ B009_B010.py:25:4: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Fix +ℹ Safe fix 22 22 | getattr(foo, "abc123") 23 23 | getattr(foo, r"abc123") 24 24 | _ = lambda x: getattr(x, "bar") @@ -158,7 +158,7 @@ B009_B010.py:27:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Fix +ℹ Safe fix 24 24 | _ = lambda x: getattr(x, "bar") 25 25 | if getattr(x, "bar"): 26 26 | pass @@ -179,7 +179,7 @@ B009_B010.py:28:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Fix +ℹ Safe fix 25 25 | if getattr(x, "bar"): 26 26 | pass 27 27 | getattr(1, "real") @@ -200,7 +200,7 @@ B009_B010.py:29:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Fix +ℹ Safe fix 26 26 | pass 27 27 | getattr(1, "real") 28 28 | getattr(1., "real") @@ -221,7 +221,7 @@ B009_B010.py:30:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Fix +ℹ Safe fix 27 27 | getattr(1, "real") 28 28 | getattr(1., "real") 29 29 | getattr(1.0, "real") @@ -242,7 +242,7 @@ B009_B010.py:31:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Fix +ℹ Safe fix 28 28 | getattr(1., "real") 29 29 | getattr(1.0, "real") 30 30 | getattr(1j, "real") @@ -263,7 +263,7 @@ B009_B010.py:32:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Fix +ℹ Safe fix 29 29 | getattr(1.0, "real") 30 30 | getattr(1j, "real") 31 31 | getattr(True, "real") @@ -284,7 +284,7 @@ B009_B010.py:33:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Fix +ℹ Safe fix 30 30 | getattr(1j, "real") 31 31 | getattr(True, "real") 32 32 | getattr(x := 1, "real") @@ -304,7 +304,7 @@ B009_B010.py:34:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Fix +ℹ Safe fix 31 31 | getattr(True, "real") 32 32 | getattr(x := 1, "real") 33 33 | getattr(x + y, "real") @@ -326,7 +326,7 @@ B009_B010.py:58:8: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Fix +ℹ Safe 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 @@ -345,7 +345,7 @@ B009_B010.py:65:1: B009 [*] Do not call `getattr` with a constant attribute valu | = help: Replace `getattr` with attribute access -ℹ Fix +ℹ Safe fix 62 62 | setattr(*foo, "bar", None) 63 63 | 64 64 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1739800901 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 cb21aba09f..cad3fc9306 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 -ℹ Fix +ℹ Safe fix 47 47 | pass 48 48 | 49 49 | # Invalid usage @@ -32,7 +32,7 @@ B009_B010.py:51:1: B010 [*] Do not call `setattr` with a constant attribute valu | = help: Replace `setattr` with assignment -ℹ Fix +ℹ Safe fix 48 48 | 49 49 | # Invalid usage 50 50 | setattr(foo, "bar", None) @@ -53,7 +53,7 @@ B009_B010.py:52:1: B010 [*] Do not call `setattr` with a constant attribute valu | = help: Replace `setattr` with assignment -ℹ Fix +ℹ Safe fix 49 49 | # Invalid usage 50 50 | setattr(foo, "bar", None) 51 51 | setattr(foo, "_123abc", None) @@ -74,7 +74,7 @@ B009_B010.py:53:1: B010 [*] Do not call `setattr` with a constant attribute valu | = help: Replace `setattr` with assignment -ℹ Fix +ℹ Safe fix 50 50 | setattr(foo, "bar", None) 51 51 | setattr(foo, "_123abc", None) 52 52 | setattr(foo, "__123abc__", None) @@ -94,7 +94,7 @@ B009_B010.py:54:1: B010 [*] Do not call `setattr` with a constant attribute valu | = help: Replace `setattr` with assignment -ℹ Fix +ℹ Safe fix 51 51 | setattr(foo, "_123abc", None) 52 52 | setattr(foo, "__123abc__", None) 53 53 | setattr(foo, "abc123", None) @@ -115,7 +115,7 @@ B009_B010.py:55:1: B010 [*] Do not call `setattr` with a constant attribute valu | = help: Replace `setattr` with assignment -ℹ Fix +ℹ Safe 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 5415cf1eae..828397abce 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` -ℹ Suggested fix +ℹ Unsafe fix 5 5 | """ 6 6 | 7 7 | assert 1 != 2 @@ -29,7 +29,7 @@ B011.py:10:8: B011 [*] Do not `assert False` (`python -O` removes these calls), | = help: Replace `assert False` -ℹ Suggested fix +ℹ Unsafe 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 3cbb27b7aa..4581b10bf4 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` -ℹ Fix +ℹ Safe fix 2 2 | 3 3 | try: 4 4 | pass @@ -33,7 +33,7 @@ B013.py:11:8: B013 [*] A length-one tuple literal is redundant in exception hand | = help: Replace with `except retriable_exceptions` -ℹ Fix +ℹ Safe fix 8 8 | pass 9 9 | except (ImportError, TypeError): 10 10 | pass @@ -53,7 +53,7 @@ B013.py:13:7: B013 [*] A length-one tuple literal is redundant in exception hand | = help: Replace with `except ValueError` -ℹ Fix +ℹ Safe 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 75b8d36fc7..c35fb2494d 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 -ℹ Fix +ℹ Safe fix 14 14 | 15 15 | try: 16 16 | pass @@ -33,7 +33,7 @@ B014.py:28:8: B014 [*] Exception handler with duplicate exception: `MyError` | = help: De-duplicate exceptions -ℹ Fix +ℹ Safe fix 25 25 | 26 26 | try: 27 27 | pass @@ -54,7 +54,7 @@ B014.py:49:8: B014 [*] Exception handler with duplicate exception: `re.error` | = help: De-duplicate exceptions -ℹ Fix +ℹ Safe fix 46 46 | 47 47 | try: 48 48 | pass @@ -74,7 +74,7 @@ B014.py:82:8: B014 [*] Exception handler with duplicate exception: `ValueError` | = help: De-duplicate exceptions -ℹ Fix +ℹ Safe fix 79 79 | # Regression test for: https://github.com/astral-sh/ruff/issues/6412 80 80 | try: 81 81 | pass @@ -94,7 +94,7 @@ B014.py:89:7: B014 [*] Exception handler with duplicate exception: `re.error` | = help: De-duplicate exceptions -ℹ Fix +ℹ Safe 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__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 3a211c6e94..b7b697526c 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,7 @@ B006_extended.py:17:55: B006 [*] Do not use mutable data structures for argument | = help: Replace with `None`; initialize within function -ℹ Suggested fix +ℹ Unsafe 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 fe61754579..d9e4fe146f 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 -ℹ Fix +ℹ Safe fix 1 1 | # ==> bad_function_call.py <== 2 2 | bad_function_call( 3 3 | param1='test', @@ -32,7 +32,7 @@ COM81.py:10:6: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 7 7 | bad_list = [ 8 8 | 1, 9 9 | 2, @@ -53,7 +53,7 @@ COM81.py:16:6: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 13 13 | bad_list_with_comment = [ 14 14 | 1, 15 15 | 2, @@ -72,7 +72,7 @@ COM81.py:23:6: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 20 20 | bad_list_with_extra_empty = [ 21 21 | 1, 22 22 | 2, @@ -159,7 +159,7 @@ COM81.py:70:8: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 67 67 | pass 68 68 | 69 69 | {'foo': foo}['foo']( @@ -178,7 +178,7 @@ COM81.py:78:8: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 75 75 | ) 76 76 | 77 77 | (foo)( @@ -197,7 +197,7 @@ COM81.py:86:8: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 83 83 | ) 84 84 | 85 85 | [foo][0]( @@ -217,7 +217,7 @@ COM81.py:152:6: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 149 149 | 150 150 | # ==> keyword_before_parenth_form/base_bad.py <== 151 151 | from x import ( @@ -237,7 +237,7 @@ COM81.py:158:11: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 155 155 | assert( 156 156 | SyntaxWarning, 157 157 | ThrownHere, @@ -258,7 +258,7 @@ COM81.py:293:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 290 290 | 291 291 | # ==> multiline_bad_dict.py <== 292 292 | multiline_bad_dict = { @@ -279,7 +279,7 @@ COM81.py:304:14: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 301 301 | 302 302 | def func_bad( 303 303 | a = 3, @@ -300,7 +300,7 @@ COM81.py:310:14: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 307 307 | 308 308 | # ==> multiline_bad_function_one_param.py <== 309 309 | def func( @@ -319,7 +319,7 @@ COM81.py:316:10: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 313 313 | 314 314 | 315 315 | func( @@ -339,7 +339,7 @@ COM81.py:322:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 319 319 | # ==> multiline_bad_or_dict.py <== 320 320 | multiline_bad_or_dict = { 321 321 | "good": True or False, @@ -359,7 +359,7 @@ COM81.py:368:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 365 365 | 366 366 | multiline_index_access[ 367 367 | "probably fine", @@ -379,7 +379,7 @@ COM81.py:375:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 372 372 | "fine", 373 373 | "fine", 374 374 | : @@ -399,7 +399,7 @@ COM81.py:404:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 401 401 | "fine", 402 402 | "fine" 403 403 | : @@ -419,7 +419,7 @@ COM81.py:432:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 429 429 | "fine" 430 430 | : 431 431 | "fine", @@ -439,7 +439,7 @@ COM81.py:485:21: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Fix +ℹ Safe fix 482 482 | ) 483 483 | 484 484 | # ==> prohibited.py <== @@ -460,7 +460,7 @@ COM81.py:487:13: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Fix +ℹ Safe fix 484 484 | # ==> prohibited.py <== 485 485 | foo = ['a', 'b', 'c',] 486 486 | @@ -480,7 +480,7 @@ COM81.py:489:18: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Fix +ℹ Safe fix 486 486 | 487 487 | bar = { a: b,} 488 488 | @@ -501,7 +501,7 @@ COM81.py:494:6: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Fix +ℹ Safe fix 491 491 | 492 492 | (0,) 493 493 | @@ -522,7 +522,7 @@ COM81.py:496:21: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Fix +ℹ Safe fix 493 493 | 494 494 | (0, 1,) 495 495 | @@ -543,7 +543,7 @@ COM81.py:498:13: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Fix +ℹ Safe fix 495 495 | 496 496 | foo = ['a', 'b', 'c', ] 497 497 | @@ -563,7 +563,7 @@ COM81.py:500:18: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Fix +ℹ Safe fix 497 497 | 498 498 | bar = { a: b, } 499 499 | @@ -584,7 +584,7 @@ COM81.py:505:6: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Fix +ℹ Safe fix 502 502 | 503 503 | (0, ) 504 504 | @@ -605,7 +605,7 @@ COM81.py:511:10: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Fix +ℹ Safe fix 508 508 | 509 509 | image[:,] 510 510 | @@ -626,7 +626,7 @@ COM81.py:513:9: COM819 [*] Trailing comma prohibited | = help: Remove trailing comma -ℹ Fix +ℹ Safe fix 510 510 | 511 511 | image[:,:,] 512 512 | @@ -647,7 +647,7 @@ COM81.py:519:13: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 516 516 | def function( 517 517 | foo, 518 518 | bar, @@ -668,7 +668,7 @@ COM81.py:526:10: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 523 523 | def function( 524 524 | foo, 525 525 | bar, @@ -689,7 +689,7 @@ COM81.py:534:16: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 531 531 | foo, 532 532 | bar, 533 533 | *args, @@ -709,7 +709,7 @@ COM81.py:541:13: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 538 538 | result = function( 539 539 | foo, 540 540 | bar, @@ -729,7 +729,7 @@ COM81.py:547:24: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 544 544 | result = function( 545 545 | foo, 546 546 | bar, @@ -750,7 +750,7 @@ COM81.py:554:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 551 551 | ham, 552 552 | spam, 553 553 | *args, @@ -769,7 +769,7 @@ COM81.py:561:13: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 558 558 | # In python 3.5 if it's not a function def, commas are mandatory. 559 559 | 560 560 | foo( @@ -788,7 +788,7 @@ COM81.py:565:13: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 562 562 | ) 563 563 | 564 564 | { @@ -807,7 +807,7 @@ COM81.py:573:10: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 570 570 | ) 571 571 | 572 572 | { @@ -826,7 +826,7 @@ COM81.py:577:10: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 574 574 | } 575 575 | 576 576 | [ @@ -847,7 +847,7 @@ COM81.py:583:10: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 580 580 | def foo( 581 581 | ham, 582 582 | spam, @@ -868,7 +868,7 @@ COM81.py:590:13: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 587 587 | def foo( 588 588 | ham, 589 589 | spam, @@ -889,7 +889,7 @@ COM81.py:598:15: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 595 595 | ham, 596 596 | spam, 597 597 | *args, @@ -909,7 +909,7 @@ COM81.py:627:20: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 624 624 | result = function( 625 625 | foo, 626 626 | bar, @@ -929,7 +929,7 @@ COM81.py:632:42: COM812 [*] Trailing comma missing | = help: Add trailing comma -ℹ Fix +ℹ Safe fix 629 629 | 630 630 | # Make sure the COM812 and UP034 rules don't fix simultaneously and cause a syntax error. 631 631 | the_first_one = next( 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 924f9aad19..56e0f8d95a 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 @@ -10,7 +10,7 @@ C400.py:1:5: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | = help: Rewrite as a `list` comprehension -ℹ Suggested fix +ℹ Unsafe fix 1 |-x = list(x for x in range(3)) 1 |+x = [x for x in range(3)] 2 2 | x = list( @@ -28,7 +28,7 @@ C400.py:2:5: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | = help: Rewrite as a `list` comprehension -ℹ Suggested fix +ℹ Unsafe fix 1 1 | x = list(x for x in range(3)) 2 |-x = list( 2 |+x = [ 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 a46cb832d2..85daacb403 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 @@ -10,7 +10,7 @@ C401.py:1:5: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 1 |-x = set(x for x in range(3)) 1 |+x = {x for x in range(3)} 2 2 | x = set(x for x in range(3)) @@ -27,7 +27,7 @@ C401.py:2:5: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 1 1 | x = set(x for x in range(3)) 2 |-x = set(x for x in range(3)) 2 |+x = {x for x in range(3)} @@ -46,7 +46,7 @@ C401.py:3:8: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 1 1 | x = set(x for x in range(3)) 2 2 | x = set(x for x in range(3)) 3 |-y = f"{set(a if a < 6 else 0 for a in range(3))}" @@ -65,7 +65,7 @@ C401.py:4:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 1 1 | x = set(x for x in range(3)) 2 2 | x = set(x for x in range(3)) 3 3 | y = f"{set(a if a < 6 else 0 for a in range(3))}" @@ -84,7 +84,7 @@ C401.py:5:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 2 2 | x = set(x for x in range(3)) 3 3 | y = f"{set(a if a < 6 else 0 for a in range(3))}" 4 4 | _ = "{}".format(set(a if a < 6 else 0 for a in range(3))) @@ -103,7 +103,7 @@ C401.py:12:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 9 9 | return x 10 10 | 11 11 | @@ -123,7 +123,7 @@ C401.py:13:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 10 10 | 11 11 | 12 12 | print(f'Hello {set(a for a in "abc")} World') @@ -144,7 +144,7 @@ C401.py:14:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 11 11 | 12 12 | print(f'Hello {set(a for a in "abc")} World') 13 13 | print(f"Hello {set(a for a in 'abc')} World") @@ -164,7 +164,7 @@ C401.py:15:10: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 12 12 | print(f'Hello {set(a for a in "abc")} World') 13 13 | print(f"Hello {set(a for a in 'abc')} World") 14 14 | print(f"Hello {set(f(a) for a in 'abc')} World") @@ -184,7 +184,7 @@ C401.py:15:34: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 12 12 | print(f'Hello {set(a for a in "abc")} World') 13 13 | print(f"Hello {set(a for a in 'abc')} World") 14 14 | print(f"Hello {set(f(a) for a in 'abc')} World") @@ -205,7 +205,7 @@ C401.py:16:11: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 13 13 | print(f"Hello {set(a for a in 'abc')} World") 14 14 | print(f"Hello {set(f(a) for a in 'abc')} World") 15 15 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") @@ -226,7 +226,7 @@ C401.py:16:35: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 13 13 | print(f"Hello {set(a for a in 'abc')} World") 14 14 | print(f"Hello {set(f(a) for a in 'abc')} World") 15 15 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") @@ -245,7 +245,7 @@ C401.py:20:12: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 17 17 | 18 18 | # The fix generated for this diagnostic is incorrect, as we add additional space 19 19 | # around the set comprehension. 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 86d9bacc13..1a79ba66f5 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,7 @@ C402.py:1:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe fix 1 |-dict((x, x) for x in range(3)) 1 |+{x: x for x in range(3)} 2 2 | dict( @@ -29,7 +29,7 @@ C402.py:2:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe fix 1 1 | dict((x, x) for x in range(3)) 2 |-dict( 3 |- (x, x) for x in range(3) @@ -52,7 +52,7 @@ C402.py:6:8: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe fix 3 3 | (x, x) for x in range(3) 4 4 | ) 5 5 | dict(((x, x) for x in range(3)), z=3) @@ -73,7 +73,7 @@ C402.py:7:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe 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))}' @@ -94,7 +94,7 @@ C402.py:8:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe 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') @@ -114,7 +114,7 @@ C402.py:9:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe 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") @@ -135,7 +135,7 @@ C402.py:10:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe 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') @@ -155,7 +155,7 @@ C402.py:12:4: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe 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 | @@ -175,7 +175,7 @@ C402.py:12:37: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe 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 | @@ -195,7 +195,7 @@ C402.py:13:5: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe 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))}' @@ -215,7 +215,7 @@ C402.py:13:38: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe 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))}' @@ -236,7 +236,7 @@ C402.py:18:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe fix 15 15 | def f(x): 16 16 | return x 17 17 | @@ -256,7 +256,7 @@ C402.py:21:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe 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 9091d9352b..13ff3ffd6a 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,7 @@ C403.py:1:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 1 |-s = set([x for x in range(3)]) 1 |+s = {x for x in range(3)} 2 2 | s = set( @@ -30,7 +30,7 @@ C403.py:2:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 1 1 | s = set([x for x in range(3)]) 2 |-s = set( 3 |- [x for x in range(3)] @@ -52,7 +52,7 @@ C403.py:6:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 3 3 | [x for x in range(3)] 4 4 | ) 5 5 | @@ -72,7 +72,7 @@ C403.py:7:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 4 4 | ) 5 5 | 6 6 | s = f"{set([x for x in 'ab'])}" @@ -93,7 +93,7 @@ C403.py:12:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 9 9 | def f(x): 10 10 | return x 11 11 | @@ -113,7 +113,7 @@ C403.py:14:9: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 11 11 | 12 12 | s = f"{set([f(x) for x in 'ab'])}" 13 13 | @@ -131,7 +131,7 @@ C403.py:14:34: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` com | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe fix 11 11 | 12 12 | s = f"{set([f(x) for x in 'ab'])}" 13 13 | @@ -147,7 +147,7 @@ C403.py:15:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe 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']) }" @@ -162,7 +162,7 @@ C403.py:15:33: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` com | = help: Rewrite as a `set` comprehension -ℹ Suggested fix +ℹ Unsafe 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']) }" 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 d5bfe8a3a9..6ee5af803d 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,7 @@ C404.py:1:1: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe 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) @@ -27,7 +27,7 @@ C404.py:7:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe fix 4 4 | def f(x): 5 5 | return x 6 6 | @@ -47,7 +47,7 @@ C404.py:8:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe fix 5 5 | return x 6 6 | 7 7 | f'{dict([(s,s) for s in "ab"])}' @@ -67,7 +67,7 @@ C404.py:9:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe fix 6 6 | 7 7 | f'{dict([(s,s) for s in "ab"])}' 8 8 | f"{dict([(s,s) for s in 'ab'])}" @@ -88,7 +88,7 @@ C404.py:10:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe 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'])}" @@ -108,7 +108,7 @@ C404.py:12:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe fix 9 9 | f"{dict([(s, s) for s in 'ab'])}" 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 11 | @@ -128,7 +128,7 @@ C404.py:12:34: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe fix 9 9 | f"{dict([(s, s) for s in 'ab'])}" 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 11 | @@ -148,7 +148,7 @@ C404.py:13:5: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe 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"])}' @@ -168,7 +168,7 @@ C404.py:13:35: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe 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"])}' @@ -186,7 +186,7 @@ C404.py:16:14: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co | = help: Rewrite as a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe 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 1ae0f55d0d..1ab72fff86 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,7 @@ C405.py:1:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 1 |-set([1, 2]) 1 |+{1, 2} 2 2 | set((1, 2)) @@ -27,7 +27,7 @@ C405.py:2:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 1 1 | set([1, 2]) 2 |-set((1, 2)) 2 |+{1, 2} @@ -46,7 +46,7 @@ C405.py:3:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 1 1 | set([1, 2]) 2 2 | set((1, 2)) 3 |-set([]) @@ -66,7 +66,7 @@ C405.py:4:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 1 1 | set([1, 2]) 2 2 | set((1, 2)) 3 3 | set([]) @@ -88,7 +88,7 @@ C405.py:6:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 3 3 | set([]) 4 4 | set(()) 5 5 | set() @@ -111,7 +111,7 @@ C405.py:7:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 4 4 | set(()) 5 5 | set() 6 6 | set((1,)) @@ -137,7 +137,7 @@ C405.py:10:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 7 7 | set(( 8 8 | 1, 9 9 | )) @@ -163,7 +163,7 @@ C405.py:13:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 10 10 | set([ 11 11 | 1, 12 12 | ]) @@ -188,7 +188,7 @@ C405.py:16:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 13 13 | set( 14 14 | (1,) 15 15 | ) @@ -211,7 +211,7 @@ C405.py:19:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 16 16 | set( 17 17 | [1,] 18 18 | ) @@ -231,7 +231,7 @@ C405.py:20:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 17 17 | [1,] 18 18 | ) 19 19 | f"{set([1,2,3])}" @@ -252,7 +252,7 @@ C405.py:21:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 18 18 | ) 19 19 | f"{set([1,2,3])}" 20 20 | f"{set(['a', 'b'])}" @@ -273,7 +273,7 @@ C405.py:23:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 20 20 | f"{set(['a', 'b'])}" 21 21 | f'{set(["a", "b"])}' 22 22 | @@ -294,7 +294,7 @@ C405.py:23:22: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 20 20 | f"{set(['a', 'b'])}" 21 21 | f'{set(["a", "b"])}' 22 22 | @@ -314,7 +314,7 @@ C405.py:24:5: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 21 21 | f'{set(["a", "b"])}' 22 22 | 23 23 | f"{set(['a', 'b']) - set(['a'])}" @@ -333,7 +333,7 @@ C405.py:24:23: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 21 21 | f'{set(["a", "b"])}' 22 22 | 23 23 | f"{set(['a', 'b']) - set(['a'])}" @@ -352,7 +352,7 @@ C405.py:25:6: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 22 22 | 23 23 | f"{set(['a', 'b']) - set(['a'])}" 24 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -370,7 +370,7 @@ C405.py:25:24: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe fix 22 22 | 23 23 | f"{set(['a', 'b']) - set(['a'])}" 24 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -387,7 +387,7 @@ C405.py:26:7: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe 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" @@ -403,7 +403,7 @@ C405.py:26:25: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | = help: Rewrite as a `set` literal -ℹ Suggested fix +ℹ Unsafe 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 f8983c1683..d9847ec6c6 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,7 @@ C406.py:1:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal) | = help: Rewrite as a `dict` literal -ℹ Suggested fix +ℹ Unsafe fix 1 |-d1 = dict([(1, 2)]) 1 |+d1 = {1: 2} 2 2 | d2 = dict(((1, 2),)) @@ -27,7 +27,7 @@ C406.py:2:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) | = help: Rewrite as a `dict` literal -ℹ Suggested fix +ℹ Unsafe fix 1 1 | d1 = dict([(1, 2)]) 2 |-d2 = dict(((1, 2),)) 2 |+d2 = {1: 2,} @@ -46,7 +46,7 @@ C406.py:3:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal) | = help: Rewrite as a `dict` literal -ℹ Suggested fix +ℹ Unsafe fix 1 1 | d1 = dict([(1, 2)]) 2 2 | d2 = dict(((1, 2),)) 3 |-d3 = dict([]) @@ -64,7 +64,7 @@ C406.py:4:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) | = help: Rewrite as a `dict` literal -ℹ Suggested fix +ℹ Unsafe 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 09904c22e2..755112e2e7 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,7 @@ C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 1 |-t = tuple() 1 |+t = () 2 2 | l = list() @@ -27,7 +27,7 @@ C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 1 1 | t = tuple() 2 |-l = list() 2 |+l = [] @@ -46,7 +46,7 @@ C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 1 1 | t = tuple() 2 2 | l = list() 3 |-d1 = dict() @@ -65,7 +65,7 @@ C408.py:4:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 1 1 | t = tuple() 2 2 | l = list() 3 3 | d1 = dict() @@ -86,7 +86,7 @@ C408.py:14:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 11 11 | 12 12 | a = list() 13 13 | @@ -106,7 +106,7 @@ C408.py:15:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 12 12 | a = list() 13 13 | 14 14 | f"{dict(x='y')}" @@ -126,7 +126,7 @@ C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 13 13 | 14 14 | f"{dict(x='y')}" 15 15 | f'{dict(x="y")}' @@ -147,7 +147,7 @@ C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 14 14 | f"{dict(x='y')}" 15 15 | f'{dict(x="y")}' 16 16 | f"{dict()}" @@ -168,7 +168,7 @@ C408.py:19:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 16 16 | f"{dict()}" 17 17 | f"a {dict()} b" 18 18 | @@ -189,7 +189,7 @@ C408.py:19:18: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 16 16 | f"{dict()}" 17 17 | f"a {dict()} b" 18 18 | @@ -209,7 +209,7 @@ C408.py:20:5: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 17 17 | f"a {dict()} b" 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" @@ -228,7 +228,7 @@ C408.py:20:19: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 17 17 | f"a {dict()} b" 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" @@ -247,7 +247,7 @@ C408.py:21:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" 20 20 | f"{ dict(x='y') | dict(y='z') }" @@ -265,7 +265,7 @@ C408.py:21:20: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" 20 20 | f"{ dict(x='y') | dict(y='z') }" @@ -282,7 +282,7 @@ C408.py:22:7: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe 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" @@ -298,7 +298,7 @@ C408.py:22:21: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe 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" 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 7032a8c451..43df1eb9fb 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,7 @@ C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 1 |-t = tuple() 1 |+t = () 2 2 | l = list() @@ -27,7 +27,7 @@ C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 1 1 | t = tuple() 2 |-l = list() 2 |+l = [] @@ -46,7 +46,7 @@ C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 1 1 | t = tuple() 2 2 | l = list() 3 |-d1 = dict() @@ -65,7 +65,7 @@ C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 13 13 | 14 14 | f"{dict(x='y')}" 15 15 | f'{dict(x="y")}' @@ -86,7 +86,7 @@ C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | = help: Rewrite as a literal -ℹ Suggested fix +ℹ Unsafe fix 14 14 | f"{dict(x='y')}" 15 15 | f'{dict(x="y")}' 16 16 | f"{dict()}" 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 962bd5c19a..c4531ac6d9 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,7 @@ C409.py:1:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as | = help: Rewrite as a `tuple` literal -ℹ Suggested fix +ℹ Unsafe fix 1 |-t1 = tuple([]) 1 |+t1 = () 2 2 | t2 = tuple([1, 2]) @@ -27,7 +27,7 @@ C409.py:2:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as | = help: Rewrite as a `tuple` literal -ℹ Suggested fix +ℹ Unsafe fix 1 1 | t1 = tuple([]) 2 |-t2 = tuple([1, 2]) 2 |+t2 = (1, 2) @@ -46,7 +46,7 @@ C409.py:3:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th | = help: Remove outer `tuple` call -ℹ Suggested fix +ℹ Unsafe fix 1 1 | t1 = tuple([]) 2 2 | t2 = tuple([1, 2]) 3 |-t3 = tuple((1, 2)) @@ -70,7 +70,7 @@ C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as | = help: Rewrite as a `tuple` literal -ℹ Suggested fix +ℹ Unsafe fix 1 1 | t1 = tuple([]) 2 2 | t2 = tuple([1, 2]) 3 3 | t3 = tuple((1, 2)) @@ -96,7 +96,7 @@ C409.py:8:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th | = help: Remove outer `tuple` call -ℹ Suggested fix +ℹ Unsafe fix 5 5 | 1, 6 6 | 2 7 7 | ]) 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 997e854757..360ce977b0 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,7 @@ C410.py:1:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the | = help: Remove outer `list` call -ℹ Suggested fix +ℹ Unsafe fix 1 |-l1 = list([1, 2]) 1 |+l1 = [1, 2] 2 2 | l2 = list((1, 2)) @@ -27,7 +27,7 @@ C410.py:2:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as | = help: Rewrite as a `list` literal -ℹ Suggested fix +ℹ Unsafe fix 1 1 | l1 = list([1, 2]) 2 |-l2 = list((1, 2)) 2 |+l2 = [1, 2] @@ -44,7 +44,7 @@ C410.py:3:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the | = help: Remove outer `list` call -ℹ Suggested fix +ℹ Unsafe fix 1 1 | l1 = list([1, 2]) 2 2 | l2 = list((1, 2)) 3 |-l3 = list([]) @@ -60,7 +60,7 @@ C410.py:4:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as | = help: Rewrite as a `list` literal -ℹ Suggested fix +ℹ Unsafe fix 1 1 | l1 = list([1, 2]) 2 2 | l2 = list((1, 2)) 3 3 | l3 = list([]) 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 1878f091a7..763f99136e 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,7 @@ C411.py:2:1: C411 [*] Unnecessary `list` call (remove the outer call to `list()` | = help: Remove outer `list` call -ℹ Suggested fix +ℹ Unsafe 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 ae89b1802a..4b7cd7a564 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 -ℹ Fix +ℹ Safe fix 1 1 | x = [2, 3, 1] 2 2 | list(x) 3 |-list(sorted(x)) @@ -32,7 +32,7 @@ C413.py:4:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Suggested fix +ℹ Unsafe fix 1 1 | x = [2, 3, 1] 2 2 | list(x) 3 3 | list(sorted(x)) @@ -53,7 +53,7 @@ C413.py:5:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Suggested fix +ℹ Unsafe fix 2 2 | list(x) 3 3 | list(sorted(x)) 4 4 | reversed(sorted(x)) @@ -74,7 +74,7 @@ C413.py:6:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Suggested fix +ℹ Unsafe fix 3 3 | list(sorted(x)) 4 4 | reversed(sorted(x)) 5 5 | reversed(sorted(x, key=lambda e: e)) @@ -95,7 +95,7 @@ C413.py:7:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Suggested fix +ℹ Unsafe fix 4 4 | reversed(sorted(x)) 5 5 | reversed(sorted(x, key=lambda e: e)) 6 6 | reversed(sorted(x, reverse=True)) @@ -116,7 +116,7 @@ C413.py:8:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Suggested fix +ℹ Unsafe 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)) @@ -137,7 +137,7 @@ C413.py:9:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Suggested fix +ℹ Unsafe 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)) @@ -157,7 +157,7 @@ C413.py:10:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Suggested fix +ℹ Unsafe 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)) @@ -178,7 +178,7 @@ C413.py:11:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Suggested fix +ℹ Unsafe 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)) @@ -197,7 +197,7 @@ C413.py:14:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Suggested fix +ℹ Unsafe fix 11 11 | reversed(sorted(x, reverse=not x)) 12 12 | 13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 @@ -216,7 +216,7 @@ C413.py:15:1: C413 [*] Unnecessary `reversed` call around `sorted()` | = help: Remove unnecessary `reversed` call -ℹ Suggested fix +ℹ Unsafe 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))) 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 396a8d26ab..1551f9ccec 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 -ℹ Suggested fix +ℹ Unsafe fix 1 1 | x = [1, 2, 3] 2 |-list(list(x)) 2 |+list(x) @@ -30,7 +30,7 @@ C414.py:3:1: C414 [*] Unnecessary `tuple` call within `list()` | = help: Remove the inner `tuple` call -ℹ Suggested fix +ℹ Unsafe fix 1 1 | x = [1, 2, 3] 2 2 | list(list(x)) 3 |-list(tuple(x)) @@ -50,7 +50,7 @@ C414.py:4:1: C414 [*] Unnecessary `list` call within `tuple()` | = help: Remove the inner `list` call -ℹ Suggested fix +ℹ Unsafe fix 1 1 | x = [1, 2, 3] 2 2 | list(list(x)) 3 3 | list(tuple(x)) @@ -71,7 +71,7 @@ C414.py:5:1: C414 [*] Unnecessary `tuple` call within `tuple()` | = help: Remove the inner `tuple` call -ℹ Suggested fix +ℹ Unsafe fix 2 2 | list(list(x)) 3 3 | list(tuple(x)) 4 4 | tuple(list(x)) @@ -92,7 +92,7 @@ C414.py:6:1: C414 [*] Unnecessary `set` call within `set()` | = help: Remove the inner `set` call -ℹ Suggested fix +ℹ Unsafe fix 3 3 | list(tuple(x)) 4 4 | tuple(list(x)) 5 5 | tuple(tuple(x)) @@ -113,7 +113,7 @@ C414.py:7:1: C414 [*] Unnecessary `list` call within `set()` | = help: Remove the inner `list` call -ℹ Suggested fix +ℹ Unsafe fix 4 4 | tuple(list(x)) 5 5 | tuple(tuple(x)) 6 6 | set(set(x)) @@ -134,7 +134,7 @@ C414.py:8:1: C414 [*] Unnecessary `tuple` call within `set()` | = help: Remove the inner `tuple` call -ℹ Suggested fix +ℹ Unsafe fix 5 5 | tuple(tuple(x)) 6 6 | set(set(x)) 7 7 | set(list(x)) @@ -155,7 +155,7 @@ C414.py:9:1: C414 [*] Unnecessary `sorted` call within `set()` | = help: Remove the inner `sorted` call -ℹ Suggested fix +ℹ Unsafe fix 6 6 | set(set(x)) 7 7 | set(list(x)) 8 8 | set(tuple(x)) @@ -176,7 +176,7 @@ C414.py:10:1: C414 [*] Unnecessary `sorted` call within `set()` | = help: Remove the inner `sorted` call -ℹ Suggested fix +ℹ Unsafe fix 7 7 | set(list(x)) 8 8 | set(tuple(x)) 9 9 | set(sorted(x)) @@ -197,7 +197,7 @@ C414.py:11:1: C414 [*] Unnecessary `reversed` call within `set()` | = help: Remove the inner `reversed` call -ℹ Suggested fix +ℹ Unsafe fix 8 8 | set(tuple(x)) 9 9 | set(sorted(x)) 10 10 | set(sorted(x, key=lambda y: y)) @@ -218,7 +218,7 @@ C414.py:12:1: C414 [*] Unnecessary `list` call within `sorted()` | = help: Remove the inner `list` call -ℹ Suggested fix +ℹ Unsafe fix 9 9 | set(sorted(x)) 10 10 | set(sorted(x, key=lambda y: y)) 11 11 | set(reversed(x)) @@ -239,7 +239,7 @@ C414.py:13:1: C414 [*] Unnecessary `tuple` call within `sorted()` | = help: Remove the inner `tuple` call -ℹ Suggested fix +ℹ Unsafe fix 10 10 | set(sorted(x, key=lambda y: y)) 11 11 | set(reversed(x)) 12 12 | sorted(list(x)) @@ -260,7 +260,7 @@ C414.py:14:1: C414 [*] Unnecessary `sorted` call within `sorted()` | = help: Remove the inner `sorted` call -ℹ Suggested fix +ℹ Unsafe fix 11 11 | set(reversed(x)) 12 12 | sorted(list(x)) 13 13 | sorted(tuple(x)) @@ -281,7 +281,7 @@ C414.py:15:1: C414 [*] Unnecessary `sorted` call within `sorted()` | = help: Remove the inner `sorted` call -ℹ Suggested fix +ℹ Unsafe fix 12 12 | sorted(list(x)) 13 13 | sorted(tuple(x)) 14 14 | sorted(sorted(x)) @@ -302,7 +302,7 @@ C414.py:16:1: C414 [*] Unnecessary `sorted` call within `sorted()` | = help: Remove the inner `sorted` call -ℹ Suggested fix +ℹ Unsafe fix 13 13 | sorted(tuple(x)) 14 14 | sorted(sorted(x)) 15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) @@ -323,7 +323,7 @@ C414.py:17:1: C414 [*] Unnecessary `reversed` call within `sorted()` | = help: Remove the inner `reversed` call -ℹ Suggested fix +ℹ Unsafe 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) @@ -344,7 +344,7 @@ C414.py:18:1: C414 [*] Unnecessary `list` call within `sorted()` | = help: Remove the inner `list` call -ℹ Suggested fix +ℹ Unsafe 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)) @@ -370,7 +370,7 @@ C414.py:19:1: C414 [*] Unnecessary `list` call within `tuple()` | = help: Remove the inner `list` call -ℹ Suggested fix +ℹ Unsafe fix 17 17 | sorted(reversed(x)) 18 18 | sorted(list(x), key=lambda y: y) 19 19 | tuple( @@ -394,7 +394,7 @@ C414.py:25:1: C414 [*] Unnecessary `set` call within `set()` | = help: Remove the inner `set` call -ℹ Suggested fix +ℹ Unsafe fix 22 22 | "o"] 23 23 | ) 24 24 | ) @@ -415,7 +415,7 @@ C414.py:26:1: C414 [*] Unnecessary `list` call within `set()` | = help: Remove the inner `list` call -ℹ Suggested fix +ℹ Unsafe fix 23 23 | ) 24 24 | ) 25 25 | set(set()) @@ -435,7 +435,7 @@ C414.py:27:1: C414 [*] Unnecessary `tuple` call within `set()` | = help: Remove the inner `tuple` call -ℹ Suggested fix +ℹ Unsafe fix 24 24 | ) 25 25 | set(set()) 26 26 | set(list()) @@ -456,7 +456,7 @@ C414.py:28:1: C414 [*] Unnecessary `reversed` call within `sorted()` | = help: Remove the inner `reversed` call -ℹ Suggested fix +ℹ Unsafe fix 25 25 | set(set()) 26 26 | set(list()) 27 27 | set(tuple()) @@ -482,7 +482,7 @@ C414.py:37:27: C414 [*] Unnecessary `list` call within `sorted()` | = help: Remove the inner `list` call -ℹ Suggested fix +ℹ Unsafe fix 35 35 | 36 36 | # Preserve trailing comments. 37 37 | xxxxxxxxxxx_xxxxx_xxxxx = sorted( @@ -505,7 +505,7 @@ C414.py:44:27: C414 [*] Unnecessary `list` call within `sorted()` | = help: Remove the inner `list` call -ℹ Suggested fix +ℹ Unsafe 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 f7ea1bfbbc..4ffbb2c029 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()` -ℹ Suggested fix +ℹ Unsafe fix 3 3 | z = [(1,), (2,), (3,)] 4 4 | d = {"a": 1, "b": 2, "c": 3} 5 5 | @@ -32,7 +32,7 @@ C416.py:7:1: C416 [*] Unnecessary `set` comprehension (rewrite using `set()`) | = help: Rewrite using `set()` -ℹ Suggested fix +ℹ Unsafe fix 4 4 | d = {"a": 1, "b": 2, "c": 3} 5 5 | 6 6 | [i for i in x] @@ -53,7 +53,7 @@ C416.py:8:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | = help: Rewrite using `dict()` -ℹ Suggested fix +ℹ Unsafe fix 5 5 | 6 6 | [i for i in x] 7 7 | {i for i in x} @@ -74,7 +74,7 @@ C416.py:9:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | = help: Rewrite using `dict()` -ℹ Suggested fix +ℹ Unsafe fix 6 6 | [i for i in x] 7 7 | {i for i in x} 8 8 | {k: v for k, v in y} @@ -94,7 +94,7 @@ C416.py:10:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) | = help: Rewrite using `list()` -ℹ Suggested fix +ℹ Unsafe 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()} @@ -115,7 +115,7 @@ C416.py:11:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | = help: Rewrite using `dict()` -ℹ Suggested fix +ℹ Unsafe 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()] @@ -133,7 +133,7 @@ C416.py:24:70: C416 [*] Unnecessary `list` comprehension (rewrite using `list()` | = help: Rewrite using `list()` -ℹ Suggested fix +ℹ Unsafe 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 1418d486ed..fc37727a26 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 -ℹ Suggested fix +ℹ Unsafe fix 1 1 | # Errors. 2 2 | nums = [1, 2, 3] 3 |-map(lambda x: x + 1, nums) @@ -32,7 +32,7 @@ C417.py:4:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express | = help: Replace `map` with a generator expression -ℹ Suggested fix +ℹ Unsafe fix 1 1 | # Errors. 2 2 | nums = [1, 2, 3] 3 3 | map(lambda x: x + 1, nums) @@ -53,7 +53,7 @@ C417.py:5:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehens | = help: Replace `map` with a `list` comprehension -ℹ Suggested fix +ℹ Unsafe fix 2 2 | nums = [1, 2, 3] 3 3 | map(lambda x: x + 1, nums) 4 4 | map(lambda x: str(x), nums) @@ -74,7 +74,7 @@ C417.py:6:1: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehensi | = help: Replace `map` with a `set` comprehension -ℹ Suggested fix +ℹ Unsafe 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)) @@ -95,7 +95,7 @@ C417.py:7:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehens | = help: Replace `map` with a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe 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)) @@ -116,7 +116,7 @@ C417.py:8:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehens | = help: Replace `map` with a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe 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)) @@ -137,7 +137,7 @@ C417.py:9:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express | = help: Replace `map` with a generator expression -ℹ Suggested fix +ℹ Unsafe 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)) @@ -158,7 +158,7 @@ C417.py:10:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -ℹ Suggested fix +ℹ Unsafe 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) @@ -179,7 +179,7 @@ C417.py:11:13: C417 [*] Unnecessary `map` usage (rewrite using a generator expre | = help: Replace `map` with a generator expression -ℹ Suggested fix +ℹ Unsafe fix 8 8 | dict(map(lambda v: [v, v**2], nums)) 9 9 | map(lambda: "const", nums) 10 10 | map(lambda _: 3.0, nums) @@ -200,7 +200,7 @@ C417.py:12:5: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -ℹ Suggested fix +ℹ Unsafe 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))) @@ -220,7 +220,7 @@ C417.py:13:14: C417 [*] Unnecessary `map` usage (rewrite using a generator expre | = help: Replace `map` with a generator expression -ℹ Suggested fix +ℹ Unsafe 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)) @@ -241,7 +241,7 @@ C417.py:14:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehen | = help: Replace `map` with a `list` comprehension -ℹ Suggested fix +ℹ Unsafe 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)) @@ -260,7 +260,7 @@ C417.py:17:8: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehens | = help: Replace `map` with a `set` comprehension -ℹ Suggested fix +ℹ Unsafe 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 @@ -281,7 +281,7 @@ C417.py:18:8: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehen | = help: Replace `map` with a `dict` comprehension -ℹ Suggested fix +ℹ Unsafe 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))}" @@ -301,7 +301,7 @@ C417.py:36:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -ℹ Suggested fix +ℹ Unsafe fix 33 33 | map(lambda x: lambda: x, range(4)) 34 34 | 35 35 | # Error: the `x` is overridden by the inner lambda. @@ -321,7 +321,7 @@ C417.py:47:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -ℹ Suggested fix +ℹ Unsafe 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 @@ -340,7 +340,7 @@ C417.py:48:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -ℹ Suggested fix +ℹ Unsafe 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) @@ -357,7 +357,7 @@ C417.py:49:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres | = help: Replace `map` with a generator expression -ℹ Suggested fix +ℹ Unsafe 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 301da13fcd..f350adcdce 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,7 @@ C418.py:1:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the | = help: Remove outer `dict` call -ℹ Suggested fix +ℹ Unsafe fix 1 |-dict({}) 1 |+{} 2 2 | dict({'a': 1}) @@ -27,7 +27,7 @@ C418.py:2:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the | = help: Remove outer `dict` call -ℹ Suggested fix +ℹ Unsafe fix 1 1 | dict({}) 2 |-dict({'a': 1}) 2 |+{'a': 1} @@ -46,7 +46,7 @@ C418.py:3:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remov | = help: Remove outer `dict` call -ℹ Suggested fix +ℹ Unsafe fix 1 1 | dict({}) 2 2 | dict({'a': 1}) 3 |-dict({'x': 1 for x in range(10)}) @@ -68,7 +68,7 @@ C418.py:4:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remov | = help: Remove outer `dict` call -ℹ Suggested fix +ℹ Unsafe 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 611f4aac47..1ef0f68c12 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,7 @@ C419.py:1:5: C419 [*] Unnecessary list comprehension. | = help: Remove unnecessary list comprehension -ℹ Suggested fix +ℹ Unsafe 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]) @@ -27,7 +27,7 @@ C419.py:2:5: C419 [*] Unnecessary list comprehension. | = help: Remove unnecessary list comprehension -ℹ Suggested fix +ℹ Unsafe 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) @@ -46,7 +46,7 @@ C419.py:4:5: C419 [*] Unnecessary list comprehension. | = help: Remove unnecessary list comprehension -ℹ Suggested fix +ℹ Unsafe fix 1 1 | any([x.id for x in bar]) 2 2 | all([x.id for x in bar]) 3 3 | any( # first comment @@ -67,7 +67,7 @@ C419.py:7:5: C419 [*] Unnecessary list comprehension. | = help: Remove unnecessary list comprehension -ℹ Suggested fix +ℹ Unsafe fix 4 4 | [x.id for x in bar], # second comment 5 5 | ) # third comment 6 6 | all( # first comment @@ -88,7 +88,7 @@ C419.py:9:5: C419 [*] Unnecessary list comprehension. | = help: Remove unnecessary list comprehension -ℹ Suggested fix +ℹ Unsafe fix 6 6 | all( # first comment 7 7 | [x.id for x in bar], # second comment 8 8 | ) # third comment @@ -115,7 +115,7 @@ C419.py:24:5: C419 [*] Unnecessary list comprehension. | = help: Remove unnecessary list comprehension -ℹ Suggested fix +ℹ Unsafe fix 21 21 | 22 22 | # Special comment handling 23 23 | any( @@ -147,7 +147,7 @@ C419.py:35:5: C419 [*] Unnecessary list comprehension. | = help: Remove unnecessary list comprehension -ℹ Suggested fix +ℹ Unsafe fix 32 32 | 33 33 | # Weird case where the function call, opening bracket, and comment are all 34 34 | # on the same line. 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 d972240482..8274c69781 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 -ℹ Suggested fix +ℹ Unsafe fix 2 2 | 3 3 | 4 4 | def f_a(): @@ -29,7 +29,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 -ℹ Suggested fix +ℹ Unsafe fix 15 15 | 16 16 | def f_b(): 17 17 | example = "example" @@ -48,7 +48,7 @@ EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, ass | = help: Assign to variable; remove `.format()` string -ℹ Suggested fix +ℹ Unsafe fix 19 19 | 20 20 | 21 21 | def f_c(): @@ -77,7 +77,7 @@ EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -ℹ Suggested fix +ℹ Unsafe fix 36 36 | def nested(): 37 37 | msg = "hello" 38 38 | @@ -107,7 +107,7 @@ EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -ℹ Suggested fix +ℹ Unsafe fix 48 48 | 49 49 | def f_fix_indentation_check(foo): 50 50 | if foo: @@ -128,7 +128,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 -ℹ Suggested fix +ℹ Unsafe fix 51 51 | raise RuntimeError("This is an example exception") 52 52 | else: 53 53 | if foo == "foo": @@ -148,7 +148,7 @@ EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, ass | = help: Assign to variable; remove `.format()` string -ℹ Suggested fix +ℹ Unsafe fix 52 52 | else: 53 53 | if foo == "foo": 54 54 | raise RuntimeError(f"This is an exception: {foo}") 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 03784c23fc..b97a3d336c 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 -ℹ Suggested fix +ℹ Unsafe fix 2 2 | 3 3 | 4 4 | def f_a(): @@ -28,7 +28,7 @@ EM.py:9:24: EM101 [*] Exception must not use a string literal, assign to variabl | = help: Assign to variable; remove string literal -ℹ Suggested fix +ℹ Unsafe fix 6 6 | 7 7 | 8 8 | def f_a_short(): @@ -47,7 +47,7 @@ EM.py:13:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -ℹ Suggested fix +ℹ Unsafe fix 10 10 | 11 11 | 12 12 | def f_a_empty(): @@ -67,7 +67,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 -ℹ Suggested fix +ℹ Unsafe fix 15 15 | 16 16 | def f_b(): 17 17 | example = "example" @@ -86,7 +86,7 @@ EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, ass | = help: Assign to variable; remove `.format()` string -ℹ Suggested fix +ℹ Unsafe fix 19 19 | 20 20 | 21 21 | def f_c(): @@ -115,7 +115,7 @@ EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -ℹ Suggested fix +ℹ Unsafe fix 36 36 | def nested(): 37 37 | msg = "hello" 38 38 | @@ -145,7 +145,7 @@ EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variab | = help: Assign to variable; remove string literal -ℹ Suggested fix +ℹ Unsafe fix 48 48 | 49 49 | def f_fix_indentation_check(foo): 50 50 | if foo: @@ -166,7 +166,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 -ℹ Suggested fix +ℹ Unsafe fix 51 51 | raise RuntimeError("This is an example exception") 52 52 | else: 53 53 | if foo == "foo": @@ -186,7 +186,7 @@ EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, ass | = help: Assign to variable; remove `.format()` string -ℹ Suggested fix +ℹ Unsafe fix 52 52 | else: 53 53 | if foo == "foo": 54 54 | raise RuntimeError(f"This is an exception: {foo}") 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 feff5295d0..1c613ab1b1 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,7 @@ EXE004_1.py:1:1: EXE004 [*] Avoid whitespace before shebang | = help: Remove whitespace before shebang -ℹ Fix +ℹ Safe 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 97fc901b81..feff95aa86 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,7 @@ EXE004_4.py:1:1: EXE004 [*] Avoid whitespace before shebang | = help: Remove whitespace before shebang -ℹ Fix +ℹ Safe fix 1 |- 2 |- #!/usr/bin/env python 1 |+#!/usr/bin/env python 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 9e7a0638e2..c6a7536f74 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,7 @@ ISC.py:1:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 1 |-_ = "a" "b" "c" 1 |+_ = "ab" "c" 2 2 | @@ -26,7 +26,7 @@ ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 1 |-_ = "a" "b" "c" 1 |+_ = "a" "bc" 2 2 | @@ -44,7 +44,7 @@ ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 35 35 | b"def" 36 36 | ) 37 37 | @@ -68,7 +68,7 @@ ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 38 38 | _ = """a""" """b""" 39 39 | 40 40 | _ = """a @@ -89,7 +89,7 @@ ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 41 41 | b""" """c 42 42 | d""" 43 43 | @@ -143,7 +143,7 @@ ISC.py:52:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 49 49 | 50 50 | _ = 'a' "b" 51 51 | @@ -163,7 +163,7 @@ ISC.py:64:10: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 61 61 | _ = foo + "abc" + bar 62 62 | 63 63 | # Multiple strings nested inside a f-string @@ -183,7 +183,7 @@ ISC.py:64:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 61 61 | _ = foo + "abc" + bar 62 62 | 63 63 | # Multiple strings nested inside a f-string @@ -204,7 +204,7 @@ ISC.py:65:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 62 62 | 63 63 | # Multiple strings nested inside a f-string 64 64 | _ = f"a {'b' 'c' 'd'} e" @@ -244,7 +244,7 @@ ISC.py:72:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 69 69 | } jkl""" 70 70 | 71 71 | # Nested f-strings @@ -265,7 +265,7 @@ ISC.py:73:10: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 70 70 | 71 71 | # Nested f-strings 72 72 | _ = "a" f"b {f"c" f"d"} e" "f" @@ -286,7 +286,7 @@ ISC.py:73:20: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe 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 9e7a0638e2..c6a7536f74 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,7 @@ ISC.py:1:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 1 |-_ = "a" "b" "c" 1 |+_ = "ab" "c" 2 2 | @@ -26,7 +26,7 @@ ISC.py:1:9: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 1 |-_ = "a" "b" "c" 1 |+_ = "a" "bc" 2 2 | @@ -44,7 +44,7 @@ ISC.py:38:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 35 35 | b"def" 36 36 | ) 37 37 | @@ -68,7 +68,7 @@ ISC.py:40:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 38 38 | _ = """a""" """b""" 39 39 | 40 40 | _ = """a @@ -89,7 +89,7 @@ ISC.py:44:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 41 41 | b""" """c 42 42 | d""" 43 43 | @@ -143,7 +143,7 @@ ISC.py:52:5: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 49 49 | 50 50 | _ = 'a' "b" 51 51 | @@ -163,7 +163,7 @@ ISC.py:64:10: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 61 61 | _ = foo + "abc" + bar 62 62 | 63 63 | # Multiple strings nested inside a f-string @@ -183,7 +183,7 @@ ISC.py:64:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 61 61 | _ = foo + "abc" + bar 62 62 | 63 63 | # Multiple strings nested inside a f-string @@ -204,7 +204,7 @@ ISC.py:65:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 62 62 | 63 63 | # Multiple strings nested inside a f-string 64 64 | _ = f"a {'b' 'c' 'd'} e" @@ -244,7 +244,7 @@ ISC.py:72:14: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 69 69 | } jkl""" 70 70 | 71 71 | # Nested f-strings @@ -265,7 +265,7 @@ ISC.py:73:10: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe fix 70 70 | 71 71 | # Nested f-strings 72 72 | _ = "a" f"b {f"c" f"d"} e" "f" @@ -286,7 +286,7 @@ ISC.py:73:20: ISC001 [*] Implicitly concatenated string literals on one line | = help: Combine string literals -ℹ Fix +ℹ Safe 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 848b339416..09c79038f1 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` -ℹ Suggested fix +ℹ Unsafe fix 3 3 | 4 4 | 5 5 | def unconventional(): @@ -43,7 +43,7 @@ defaults.py:8:12: ICN001 [*] `numpy` should be imported as `np` | = help: Alias `numpy` to `np` -ℹ Suggested fix +ℹ Unsafe fix 5 5 | def unconventional(): 6 6 | import altair 7 7 | import matplotlib.pyplot @@ -64,7 +64,7 @@ defaults.py:9:12: ICN001 [*] `pandas` should be imported as `pd` | = help: Alias `pandas` to `pd` -ℹ Suggested fix +ℹ Unsafe fix 6 6 | import altair 7 7 | import matplotlib.pyplot 8 8 | import numpy @@ -85,7 +85,7 @@ defaults.py:10:12: ICN001 [*] `seaborn` should be imported as `sns` | = help: Alias `seaborn` to `sns` -ℹ Suggested fix +ℹ Unsafe fix 7 7 | import matplotlib.pyplot 8 8 | import numpy 9 9 | import pandas @@ -105,7 +105,7 @@ defaults.py:11:12: ICN001 [*] `tkinter` should be imported as `tk` | = help: Alias `tkinter` to `tk` -ℹ Suggested fix +ℹ Unsafe fix 8 8 | import numpy 9 9 | import pandas 10 10 | import seaborn @@ -124,7 +124,7 @@ defaults.py:12:12: ICN001 [*] `networkx` should be imported as `nx` | = help: Alias `networkx` to `nx` -ℹ Suggested fix +ℹ Unsafe fix 9 9 | import pandas 10 10 | import seaborn 11 11 | import tkinter @@ -144,7 +144,7 @@ defaults.py:16:22: ICN001 [*] `altair` should be imported as `alt` | = help: Alias `altair` to `alt` -ℹ Suggested fix +ℹ Unsafe fix 13 13 | 14 14 | 15 15 | def unconventional_aliases(): @@ -165,7 +165,7 @@ defaults.py:17:33: ICN001 [*] `matplotlib.pyplot` should be imported as `plt` | = help: Alias `matplotlib.pyplot` to `plt` -ℹ Suggested fix +ℹ Unsafe fix 14 14 | 15 15 | def unconventional_aliases(): 16 16 | import altair as altr @@ -186,7 +186,7 @@ defaults.py:18:21: ICN001 [*] `numpy` should be imported as `np` | = help: Alias `numpy` to `np` -ℹ Suggested fix +ℹ Unsafe fix 15 15 | def unconventional_aliases(): 16 16 | import altair as altr 17 17 | import matplotlib.pyplot as plot @@ -207,7 +207,7 @@ defaults.py:19:22: ICN001 [*] `pandas` should be imported as `pd` | = help: Alias `pandas` to `pd` -ℹ Suggested fix +ℹ Unsafe fix 16 16 | import altair as altr 17 17 | import matplotlib.pyplot as plot 18 18 | import numpy as nmp @@ -228,7 +228,7 @@ defaults.py:20:23: ICN001 [*] `seaborn` should be imported as `sns` | = help: Alias `seaborn` to `sns` -ℹ Suggested fix +ℹ Unsafe fix 17 17 | import matplotlib.pyplot as plot 18 18 | import numpy as nmp 19 19 | import pandas as pdas @@ -248,7 +248,7 @@ defaults.py:21:23: ICN001 [*] `tkinter` should be imported as `tk` | = help: Alias `tkinter` to `tk` -ℹ Suggested fix +ℹ Unsafe fix 18 18 | import numpy as nmp 19 19 | import pandas as pdas 20 20 | import seaborn as sbrn @@ -269,7 +269,7 @@ defaults.py:22:24: ICN001 [*] `networkx` should be imported as `nx` | = help: Alias `networkx` to `nx` -ℹ Suggested fix +ℹ Unsafe 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__tricky.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap index 2078183e50..b3c7cc2368 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` -ℹ Suggested fix +ℹ Unsafe 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 c7ee37c94c..c72edc6042 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()` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import logging 2 2 | 3 |-logging.Logger(__name__) @@ -29,7 +29,7 @@ LOG001.py:4:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers | = help: Replace with `logging.getLogger()` -ℹ Suggested fix +ℹ Unsafe 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 e208e94121..c11e0fafdb 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` -ℹ Suggested fix +ℹ Unsafe fix 8 8 | logging.getLogger(name="custom") 9 9 | 10 10 | # LOG002 @@ -31,7 +31,7 @@ LOG002.py:12:24: LOG002 [*] Use `__name__` with `logging.getLogger()` | = help: Replace with `name` -ℹ Suggested fix +ℹ Unsafe fix 9 9 | 10 10 | # LOG002 11 11 | getLogger(__file__) @@ -51,7 +51,7 @@ LOG002.py:14:19: LOG002 [*] Use `__name__` with `logging.getLogger()` | = help: Replace with `name` -ℹ Suggested fix +ℹ Unsafe fix 11 11 | getLogger(__file__) 12 12 | logging.getLogger(name=__file__) 13 13 | @@ -69,7 +69,7 @@ LOG002.py:15:16: LOG002 [*] Use `__name__` with `logging.getLogger()` | = help: Replace with `name` -ℹ Suggested fix +ℹ Unsafe 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 7624d57af4..c0bbf6bff7 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:3:1: LOG009 [*] Use of undocumented `logging.WARN` constant | = help: Replace `logging.WARN` with `logging.WARNING` -ℹ Fix +ℹ Safe fix 1 1 | import logging 2 2 | 3 |-logging.WARN # LOG009 @@ -30,7 +30,7 @@ LOG009.py:8:1: LOG009 [*] Use of undocumented `logging.WARN` constant | = help: Replace `logging.WARN` with `logging.WARNING` -ℹ Fix +ℹ Safe fix 5 5 | 6 6 | from logging import WARN, WARNING 7 7 | 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 df5ab9dfa1..159f56a00b 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 `warn` -ℹ Fix +ℹ Safe fix 3 3 | 4 4 | from logging_setup import logger 5 5 | @@ -33,7 +33,7 @@ G010.py:8:8: G010 [*] Logging statement uses `warn` instead of `warning` | = help: Convert to `warn` -ℹ Fix +ℹ Safe fix 5 5 | 6 6 | logging.warn("Hello World!") 7 7 | log.warn("Hello world!") # This shouldn't be considered as a logger candidate @@ -54,7 +54,7 @@ G010.py:10:11: G010 [*] Logging statement uses `warn` instead of `warning` | = help: Convert to `warn` -ℹ Fix +ℹ Safe fix 7 7 | log.warn("Hello world!") # This shouldn't be considered as a logger candidate 8 8 | logger.warn("Hello world!") 9 9 | @@ -74,7 +74,7 @@ G010.py:13:1: G010 [*] Logging statement uses `warn` instead of `warning` | = help: Convert to `warn` -ℹ Fix +ℹ Safe 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 1107602350..2b498cc75c 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` -ℹ Fix +ℹ Safe fix 1 1 | class Foo: 2 2 | """buzz""" 3 3 | @@ -28,7 +28,7 @@ PIE790.py:9:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 6 6 | 7 7 | if foo: 8 8 | """foo""" @@ -46,7 +46,7 @@ PIE790.py:14:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 11 11 | 12 12 | def multi_statement() -> None: 13 13 | """This is a function.""" @@ -65,7 +65,7 @@ PIE790.py:21:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 18 18 | pass 19 19 | else: 20 20 | """bar""" @@ -83,7 +83,7 @@ PIE790.py:28:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 25 25 | pass 26 26 | else: 27 27 | """bar""" @@ -101,7 +101,7 @@ PIE790.py:35:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 32 32 | pass 33 33 | else: 34 34 | """bar""" @@ -119,7 +119,7 @@ PIE790.py:42:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 39 39 | pass 40 40 | else: 41 41 | """bar""" @@ -137,7 +137,7 @@ PIE790.py:50:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 47 47 | buzz 48 48 | """ 49 49 | @@ -155,7 +155,7 @@ PIE790.py:58:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 55 55 | buzz 56 56 | """ 57 57 | @@ -175,7 +175,7 @@ PIE790.py:65:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 62 62 | """ 63 63 | buzz 64 64 | """ @@ -193,7 +193,7 @@ PIE790.py:74:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 71 71 | bar() 72 72 | except ValueError: 73 73 | """bar""" @@ -213,7 +213,7 @@ PIE790.py:79:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 76 76 | 77 77 | for _ in range(10): 78 78 | """buzz""" @@ -233,7 +233,7 @@ PIE790.py:83:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 80 80 | 81 81 | async for _ in range(10): 82 82 | """buzz""" @@ -251,7 +251,7 @@ PIE790.py:87:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 84 84 | 85 85 | while cond: 86 86 | """buzz""" @@ -271,7 +271,7 @@ PIE790.py:92:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 89 89 | 90 90 | with bar: 91 91 | """buzz""" @@ -289,7 +289,7 @@ PIE790.py:96:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 93 93 | 94 94 | async with bar: 95 95 | """buzz""" @@ -307,7 +307,7 @@ PIE790.py:101:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 98 98 | 99 99 | def foo() -> None: 100 100 | """buzz""" @@ -326,7 +326,7 @@ PIE790.py:130:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 127 127 | 128 128 | def foo(): 129 129 | print("foo") @@ -344,7 +344,7 @@ PIE790.py:136:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 133 133 | def foo(): 134 134 | """A docstring.""" 135 135 | print("foo") @@ -362,7 +362,7 @@ PIE790.py:140:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 138 138 | 139 139 | for i in range(10): 140 140 | pass @@ -382,7 +382,7 @@ PIE790.py:141:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 138 138 | 139 139 | for i in range(10): 140 140 | pass @@ -401,7 +401,7 @@ PIE790.py:144:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 141 141 | pass 142 142 | 143 143 | for i in range(10): @@ -421,7 +421,7 @@ PIE790.py:146:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 143 143 | for i in range(10): 144 144 | pass 145 145 | @@ -439,7 +439,7 @@ PIE790.py:149:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 146 146 | pass 147 147 | 148 148 | for i in range(10): @@ -456,7 +456,7 @@ PIE790.py:150:5: PIE790 [*] Unnecessary `pass` statement | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 147 147 | 148 148 | for i in range(10): 149 149 | pass # comment 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 d67d3cfe87..3fa8ac491a 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` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | class Foo(BaseModel): 2 2 | name = StringField() 3 3 | # .... @@ -32,7 +32,7 @@ PIE794.py:13:5: PIE794 [*] Class field `name` is defined multiple times | = help: Remove duplicate field definition for `name` -ℹ Suggested fix +ℹ Unsafe fix 10 10 | class Foo(BaseModel): 11 11 | name: str = StringField() 12 12 | # .... @@ -50,7 +50,7 @@ PIE794.py:23:5: PIE794 [*] Class field `bar` is defined multiple times | = help: Remove duplicate field definition for `bar` -ℹ Suggested fix +ℹ Unsafe fix 20 20 | bar: str = StringField() 21 21 | foo: bool = BooleanField() 22 22 | # ... @@ -68,7 +68,7 @@ PIE794.py:40:5: PIE794 [*] Class field `bar` is defined multiple times | = help: Remove duplicate field definition for `bar` -ℹ Suggested fix +ℹ Unsafe fix 37 37 | bar: str = StringField() 38 38 | foo: bool = BooleanField() 39 39 | # ... 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 fee4c78e95..450ed048e6 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,7 @@ PIE804.py:1:1: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -ℹ Fix +ℹ Safe fix 1 |-foo(**{"bar": True}) # PIE804 1 |+foo(bar=True) # PIE804 2 2 | @@ -28,7 +28,7 @@ PIE804.py:3:1: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -ℹ Fix +ℹ Safe fix 1 1 | foo(**{"bar": True}) # PIE804 2 2 | 3 |-foo(**{"r2d2": True}) # PIE804 @@ -48,7 +48,7 @@ PIE804.py:5:1: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -ℹ Fix +ℹ Safe fix 2 2 | 3 3 | foo(**{"r2d2": True}) # PIE804 4 4 | @@ -69,7 +69,7 @@ PIE804.py:7:1: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -ℹ Fix +ℹ Safe fix 4 4 | 5 5 | Foo.objects.create(**{"bar": True}) # PIE804 6 6 | @@ -90,7 +90,7 @@ PIE804.py:9:1: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -ℹ Fix +ℹ Safe fix 6 6 | 7 7 | Foo.objects.create(**{"_id": some_id}) # PIE804 8 8 | @@ -109,7 +109,7 @@ PIE804.py:11:1: PIE804 [*] Unnecessary `dict` kwargs | = help: Remove unnecessary kwargs -ℹ Fix +ℹ Safe fix 8 8 | 9 9 | Foo.objects.create(**{**bar}) # PIE804 10 10 | 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 bf3189dc42..97772c61d9 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 @@ -10,7 +10,7 @@ PIE807.py:3:44: PIE807 [*] Prefer `list` over useless lambda | = help: Replace with `list` -ℹ Fix +ℹ Safe fix 1 1 | @dataclass 2 2 | class Foo: 3 |- foo: List[str] = field(default_factory=lambda: []) # PIE807 @@ -27,7 +27,7 @@ PIE807.py:7:36: PIE807 [*] Prefer `list` over useless lambda | = help: Replace with `list` -ℹ Fix +ℹ Safe fix 4 4 | 5 5 | 6 6 | class FooTable(BaseTable): @@ -45,7 +45,7 @@ PIE807.py:11:28: PIE807 [*] Prefer `list` over useless lambda | = help: Replace with `list` -ℹ Fix +ℹ Safe fix 8 8 | 9 9 | 10 10 | class FooTable(BaseTable): 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 8205dd7ac7..f51359beb7 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 -ℹ Fix +ℹ Safe fix 1 1 | # PIE808 2 |-range(0, 10) 2 |+range(10) 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 a889297249..f871e12428 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 -ℹ Suggested fix +ℹ Unsafe fix 1 1 | # error 2 |-obj.startswith("foo") or obj.startswith("bar") 2 |+obj.startswith(("foo", "bar")) @@ -30,7 +30,7 @@ PIE810.py:4:1: PIE810 [*] Call `endswith` once with a `tuple` | = help: Merge into a single `endswith` call -ℹ Suggested fix +ℹ Unsafe fix 1 1 | # error 2 2 | obj.startswith("foo") or obj.startswith("bar") 3 3 | # error @@ -51,7 +51,7 @@ PIE810.py:6:1: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -ℹ Suggested fix +ℹ Unsafe fix 3 3 | # error 4 4 | obj.endswith("foo") or obj.endswith("bar") 5 5 | # error @@ -72,7 +72,7 @@ PIE810.py:8:1: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -ℹ Suggested fix +ℹ Unsafe fix 5 5 | # error 6 6 | obj.startswith(foo) or obj.startswith(bar) 7 7 | # error @@ -93,7 +93,7 @@ PIE810.py:10:1: PIE810 [*] Call `startswith` once with a `tuple` | = help: Merge into a single `startswith` call -ℹ Suggested fix +ℹ Unsafe fix 7 7 | # error 8 8 | obj.startswith(foo) or obj.startswith("foo") 9 9 | # error 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 11e17ab3ca..d4c1347bf3 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 `...` -ℹ Fix +ℹ Safe fix 1 1 | def bar(): ... # OK 2 2 | def foo(): 3 |- pass # ERROR PYI009, since we're in a stub file @@ -29,7 +29,7 @@ PYI009.pyi:8:5: PYI009 [*] Empty body should contain `...`, not `pass` | = help: Replace `pass` with `...` -ℹ Fix +ℹ Safe 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 fe2c8c14ed..516ca749ad 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 `...` -ℹ Fix +ℹ Safe fix 3 3 | """foo""" # OK, docstrings are handled by another rule 4 4 | 5 5 | def buzz(): @@ -31,7 +31,7 @@ PYI010.pyi:9:5: PYI010 [*] Function body must contain only `...` | = help: Replace function body with `...` -ℹ Fix +ℹ Safe fix 6 6 | print("buzz") # ERROR PYI010 7 7 | 8 8 | def foo2(): @@ -51,7 +51,7 @@ PYI010.pyi:12:5: PYI010 [*] Function body must contain only `...` | = help: Replace function body with `...` -ℹ Fix +ℹ Safe 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 362e2b72fb..6a68fe21f2 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 `...` -ℹ Fix +ℹ Safe fix 7 7 | 8 8 | def f12( 9 9 | x, @@ -37,7 +37,7 @@ PYI011.pyi:38:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 35 35 | def f152( 36 36 | x: dict[ 37 37 | int, int @@ -74,7 +74,7 @@ PYI011.pyi:46:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 43 43 | def f153( 44 44 | x: list[ 45 45 | int @@ -111,7 +111,7 @@ PYI011.pyi:63:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 60 60 | def f154( 61 61 | x: tuple[ 62 62 | str, tuple[str, ...] @@ -138,7 +138,7 @@ PYI011.pyi:71:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 68 68 | def f141( 69 69 | x: list[ 70 70 | int @@ -164,7 +164,7 @@ PYI011.pyi:78:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 75 75 | def f142( 76 76 | x: list[ 77 77 | int @@ -190,7 +190,7 @@ PYI011.pyi:85:9: PYI011 [*] Only simple default values allowed for typed argumen | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 82 82 | def f16( 83 83 | x: frozenset[ 84 84 | bytes @@ -215,7 +215,7 @@ PYI011.pyi:90:14: PYI011 [*] Only simple default values allowed for typed argume | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 87 87 | ) 88 88 | ) -> None: ... 89 89 | def f17( @@ -239,7 +239,7 @@ PYI011.pyi:94:14: PYI011 [*] Only simple default values allowed for typed argume | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 91 91 | + "bar", 92 92 | ) -> None: ... 93 93 | def f18( @@ -263,7 +263,7 @@ PYI011.pyi:98:17: PYI011 [*] Only simple default values allowed for typed argume | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 95 95 | + b"bar", 96 96 | ) -> None: ... 97 97 | def f19( @@ -287,7 +287,7 @@ PYI011.pyi:102:14: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 99 99 | + 4, 100 100 | ) -> None: ... 101 101 | def f20( @@ -311,7 +311,7 @@ PYI011.pyi:106:18: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 103 103 | + 5, # Error PYI011 Only simple default values allowed for typed arguments 104 104 | ) -> None: ... 105 105 | def f21( @@ -335,7 +335,7 @@ PYI011.pyi:110:18: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 107 107 | - 3j, # Error PYI011 Only simple default values allowed for typed arguments 108 108 | ) -> None: ... 109 109 | def f22( @@ -357,7 +357,7 @@ PYI011.pyi:138:16: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 135 135 | x: float = -math.inf, # OK 136 136 | ) -> None: ... 137 137 | def f31( @@ -378,7 +378,7 @@ PYI011.pyi:141:16: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 138 138 | x: float = inf, # Error PYI011 Only simple default values allowed for typed arguments 139 139 | ) -> None: ... 140 140 | def f32( @@ -399,7 +399,7 @@ PYI011.pyi:147:16: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 144 144 | x: float = math.nan, # OK 145 145 | ) -> None: ... 146 146 | def f34( @@ -422,7 +422,7 @@ PYI011.pyi:150:18: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 147 147 | x: float = -math.nan, # Error PYI011 Only simple default values allowed for typed arguments 148 148 | ) -> None: ... 149 149 | def f35( @@ -445,7 +445,7 @@ PYI011.pyi:159:14: PYI011 [*] Only simple default values allowed for typed argum | = help: Replace default value with `...` -ℹ Fix +ℹ Safe 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 7f583b17d9..9b67fe2854 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` -ℹ Fix +ℹ Safe fix 2 2 | 3 3 | class OneAttributeClass: 4 4 | value: int @@ -30,7 +30,7 @@ PYI012.pyi:8:5: PYI012 [*] Class body must not contain `pass` | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 5 5 | pass # PYI012 Class body must not contain `pass` 6 6 | 7 7 | class OneAttributeClassRev: @@ -50,7 +50,7 @@ PYI012.pyi:16:5: PYI012 [*] Class body must not contain `pass` | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 13 13 | My body only contains pass. 14 14 | """ 15 15 | @@ -70,7 +70,7 @@ PYI012.pyi:20:5: PYI012 [*] Class body must not contain `pass` | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 17 17 | 18 18 | class NonEmptyChild(Exception): 19 19 | value: int @@ -88,7 +88,7 @@ PYI012.pyi:23:5: PYI012 [*] Class body must not contain `pass` | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe fix 20 20 | pass # PYI012 Class body must not contain `pass` 21 21 | 22 22 | class NonEmptyChild2(Exception): @@ -108,7 +108,7 @@ PYI012.pyi:28:5: PYI012 [*] Class body must not contain `pass` | = help: Remove unnecessary `pass` -ℹ Fix +ℹ Safe 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 ddcef79dee..5dfb8d8b4b 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 `...` -ℹ Fix +ℹ Safe fix 1 1 | class OneAttributeClass: 2 2 | value: int 3 |- ... @@ -27,7 +27,7 @@ PYI013.py:7:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Fix +ℹ Safe fix 4 4 | 5 5 | 6 6 | class OneAttributeClass2: @@ -45,7 +45,7 @@ PYI013.py:12:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Fix +ℹ Safe fix 10 10 | 11 11 | class TwoEllipsesClass: 12 12 | ... @@ -63,7 +63,7 @@ PYI013.py:13:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Fix +ℹ Safe fix 10 10 | 11 11 | class TwoEllipsesClass: 12 12 | ... @@ -81,7 +81,7 @@ PYI013.py:21:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Fix +ℹ Safe fix 18 18 | My body only contains an ellipsis. 19 19 | """ 20 20 | @@ -99,7 +99,7 @@ PYI013.py:26:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Fix +ℹ Safe fix 23 23 | 24 24 | class NonEmptyChild(Exception): 25 25 | value: int @@ -117,7 +117,7 @@ PYI013.py:30:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Fix +ℹ Safe fix 27 27 | 28 28 | 29 29 | class NonEmptyChild2(Exception): @@ -137,7 +137,7 @@ PYI013.py:36:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Fix +ℹ Safe 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 93cd91ba4a..83ac30ca4e 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 `...` -ℹ Fix +ℹ Safe fix 2 2 | 3 3 | class OneAttributeClass: 4 4 | value: int @@ -30,7 +30,7 @@ PYI013.pyi:8:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Fix +ℹ Safe fix 5 5 | ... # Error 6 6 | 7 7 | class OneAttributeClass2: @@ -48,7 +48,7 @@ PYI013.pyi:12:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Fix +ℹ Safe fix 9 9 | value: int 10 10 | 11 11 | class MyClass: @@ -66,7 +66,7 @@ PYI013.pyi:16:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Fix +ℹ Safe fix 13 13 | value: int 14 14 | 15 15 | class TwoEllipsesClass: @@ -86,7 +86,7 @@ PYI013.pyi:17:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Fix +ℹ Safe fix 14 14 | 15 15 | class TwoEllipsesClass: 16 16 | ... @@ -106,7 +106,7 @@ PYI013.pyi:24:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Fix +ℹ Safe fix 21 21 | My body only contains an ellipsis. 22 22 | """ 23 23 | @@ -126,7 +126,7 @@ PYI013.pyi:28:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Fix +ℹ Safe fix 25 25 | 26 26 | class NonEmptyChild(Exception): 27 27 | value: int @@ -144,7 +144,7 @@ PYI013.pyi:31:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Fix +ℹ Safe fix 28 28 | ... # Error 29 29 | 30 30 | class NonEmptyChild2(Exception): @@ -164,7 +164,7 @@ PYI013.pyi:36:5: PYI013 [*] Non-empty class body must not contain `...` | = help: Remove unnecessary `...` -ℹ Fix +ℹ Safe 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 d4224facc8..cdad97490f 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 `...` -ℹ Fix +ℹ Safe fix 1 1 | def f12( 2 2 | x, 3 |- y=os.pathsep, # Error PYI014 @@ -36,7 +36,7 @@ PYI014.pyi:29:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 26 26 | ) -> None: ... 27 27 | def f151(x={1: 2}) -> None: ... 28 28 | def f152( @@ -73,7 +73,7 @@ PYI014.pyi:35:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 32 32 | } 33 33 | ) -> None: ... 34 34 | def f153( @@ -110,7 +110,7 @@ PYI014.pyi:50:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 47 47 | ] 48 48 | ) -> None: ... 49 49 | def f154( @@ -134,7 +134,7 @@ PYI014.pyi:56:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 53 53 | ) 54 54 | ) -> None: ... 55 55 | def f141( @@ -155,7 +155,7 @@ PYI014.pyi:59:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 56 56 | x=[*range(10)], # Error PYI014 57 57 | ) -> None: ... 58 58 | def f142( @@ -176,7 +176,7 @@ PYI014.pyi:61:11: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 58 58 | def f142( 59 59 | x=list(range(10)), # Error PYI014 60 60 | ) -> None: ... @@ -197,7 +197,7 @@ PYI014.pyi:63:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 60 60 | ) -> None: ... 61 61 | def f16(x=frozenset({b"foo", b"bar", b"baz"})) -> None: ... # Error PYI014 62 62 | def f17( @@ -218,7 +218,7 @@ PYI014.pyi:66:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 63 63 | x="foo" + "bar", # Error PYI014 64 64 | ) -> None: ... 65 65 | def f18( @@ -239,7 +239,7 @@ PYI014.pyi:69:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 66 66 | x=b"foo" + b"bar", # Error PYI014 67 67 | ) -> None: ... 68 68 | def f19( @@ -260,7 +260,7 @@ PYI014.pyi:72:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 69 69 | x="foo" + 4, # Error PYI014 70 70 | ) -> None: ... 71 71 | def f20( @@ -281,7 +281,7 @@ PYI014.pyi:75:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe fix 72 72 | x=5 + 5, # Error PYI014 73 73 | ) -> None: ... 74 74 | def f21( @@ -302,7 +302,7 @@ PYI014.pyi:78:7: PYI014 [*] Only simple default values allowed for arguments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe 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 3cf50bdee4..95ae4adb58 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 `...` -ℹ Fix +ℹ Safe fix 41 41 | field22: Final = {"foo": 5} 42 42 | 43 43 | # We *should* emit Y015 for more complex default values @@ -32,7 +32,7 @@ PYI015.pyi:45:23: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe 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 @@ -53,7 +53,7 @@ PYI015.pyi:46:23: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe 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 @@ -74,7 +74,7 @@ PYI015.pyi:47:26: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe 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 @@ -95,7 +95,7 @@ PYI015.pyi:48:47: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe 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 @@ -116,7 +116,7 @@ PYI015.pyi:49:31: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe 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 @@ -137,7 +137,7 @@ PYI015.pyi:50:37: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe 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 @@ -158,7 +158,7 @@ PYI015.pyi:52:28: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe 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 @@ -179,7 +179,7 @@ PYI015.pyi:53:11: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe 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 @@ -199,7 +199,7 @@ PYI015.pyi:54:11: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe 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 @@ -220,7 +220,7 @@ PYI015.pyi:55:11: PYI015 [*] Only simple default values allowed for assignments | = help: Replace default value with `...` -ℹ Fix +ℹ Safe 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 9d0c461dc7..d3ba1b4f13 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` -ℹ Fix +ℹ Safe fix 4 4 | field1: str 5 5 | 6 6 | # Should emit for duplicate field types. @@ -30,7 +30,7 @@ PYI016.py:10:23: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 7 7 | field2: str | str # PYI016: Duplicate union member `str` 8 8 | 9 9 | # Should emit for union types in arguments. @@ -49,7 +49,7 @@ PYI016.py:14:22: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Fix +ℹ Safe fix 11 11 | print(arg1) 12 12 | 13 13 | # Should emit for unions in return types. @@ -69,7 +69,7 @@ PYI016.py:18:15: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Fix +ℹ Safe fix 15 15 | return "my string" 16 16 | 17 17 | # Should emit in longer unions, even if not directly adjacent. @@ -90,7 +90,7 @@ PYI016.py:19:15: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe 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` @@ -110,7 +110,7 @@ PYI016.py:20:21: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Fix +ℹ Safe 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` @@ -131,7 +131,7 @@ PYI016.py:21:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe 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` @@ -151,7 +151,7 @@ PYI016.py:27:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 24 24 | field7 = str | str 25 25 | 26 26 | # Should emit for strangely-bracketed unions. @@ -170,7 +170,7 @@ PYI016.py:30:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 27 27 | field8: int | (str | int) # PYI016: Duplicate union member `int` 28 28 | 29 29 | # Should handle user brackets when fixing. @@ -191,7 +191,7 @@ PYI016.py:31:24: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Fix +ℹ Safe fix 28 28 | 29 29 | # Should handle user brackets when fixing. 30 30 | field9: int | (int | str) # PYI016: Duplicate union member `int` @@ -211,7 +211,7 @@ PYI016.py:34:21: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 31 31 | field10: (str | int) | str # PYI016: Duplicate union member `str` 32 32 | 33 33 | # Should emit for nested unions. @@ -230,7 +230,7 @@ PYI016.py:37:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 34 34 | field11: dict[int | int, str] 35 35 | 36 36 | # Should emit for unions with more than two cases @@ -249,7 +249,7 @@ PYI016.py:37:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 34 34 | field11: dict[int | int, str] 35 35 | 36 36 | # Should emit for unions with more than two cases @@ -270,7 +270,7 @@ PYI016.py:38:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -291,7 +291,7 @@ PYI016.py:38:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -312,7 +312,7 @@ PYI016.py:38:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -332,7 +332,7 @@ PYI016.py:41:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe 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 @@ -352,7 +352,7 @@ PYI016.py:41:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe 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 @@ -372,7 +372,7 @@ PYI016.py:44:30: PYI016 [*] Duplicate union member `typing.Literal[1]` | = help: Remove duplicate union member `typing.Literal[1]` -ℹ Fix +ℹ Safe fix 41 41 | field14: int | int | str | int # Error 42 42 | 43 43 | # Should emit for duplicate literal types; also covered by PYI030 @@ -425,7 +425,7 @@ PYI016.py:69:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe 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 `|` @@ -476,7 +476,7 @@ PYI016.py:76:12: PYI016 [*] Duplicate union member `set[int]` | = help: Remove duplicate union member `set[int]` -ℹ Fix +ℹ Safe fix 73 73 | 74 74 | # Should emit in cases with newlines 75 75 | field23: set[ # foo @@ -517,7 +517,7 @@ PYI016.py:86:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe 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). @@ -533,7 +533,7 @@ PYI016.py:86:34: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe 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 a6cc7428c8..647791e92b 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` -ℹ Fix +ℹ Safe fix 4 4 | field1: str 5 5 | 6 6 | # Should emit for duplicate field types. @@ -30,7 +30,7 @@ PYI016.pyi:10:23: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 7 7 | field2: str | str # PYI016: Duplicate union member `str` 8 8 | 9 9 | # Should emit for union types in arguments. @@ -49,7 +49,7 @@ PYI016.pyi:14:22: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Fix +ℹ Safe fix 11 11 | print(arg1) 12 12 | 13 13 | # Should emit for unions in return types. @@ -69,7 +69,7 @@ PYI016.pyi:18:15: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Fix +ℹ Safe fix 15 15 | return "my string" 16 16 | 17 17 | # Should emit in longer unions, even if not directly adjacent. @@ -90,7 +90,7 @@ PYI016.pyi:19:15: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe 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` @@ -110,7 +110,7 @@ PYI016.pyi:20:21: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Fix +ℹ Safe 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` @@ -131,7 +131,7 @@ PYI016.pyi:21:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe 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` @@ -151,7 +151,7 @@ PYI016.pyi:27:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 24 24 | field7 = str | str 25 25 | 26 26 | # Should emit for strangely-bracketed unions. @@ -170,7 +170,7 @@ PYI016.pyi:30:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 27 27 | field8: int | (str | int) # PYI016: Duplicate union member `int` 28 28 | 29 29 | # Should handle user brackets when fixing. @@ -191,7 +191,7 @@ PYI016.pyi:31:24: PYI016 [*] Duplicate union member `str` | = help: Remove duplicate union member `str` -ℹ Fix +ℹ Safe fix 28 28 | 29 29 | # Should handle user brackets when fixing. 30 30 | field9: int | (int | str) # PYI016: Duplicate union member `int` @@ -211,7 +211,7 @@ PYI016.pyi:34:21: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 31 31 | field10: (str | int) | str # PYI016: Duplicate union member `str` 32 32 | 33 33 | # Should emit for nested unions. @@ -230,7 +230,7 @@ PYI016.pyi:37:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 34 34 | field11: dict[int | int, str] 35 35 | 36 36 | # Should emit for unions with more than two cases @@ -249,7 +249,7 @@ PYI016.pyi:37:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 34 34 | field11: dict[int | int, str] 35 35 | 36 36 | # Should emit for unions with more than two cases @@ -270,7 +270,7 @@ PYI016.pyi:38:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -291,7 +291,7 @@ PYI016.pyi:38:22: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -312,7 +312,7 @@ PYI016.pyi:38:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe fix 35 35 | 36 36 | # Should emit for unions with more than two cases 37 37 | field12: int | int | int # Error @@ -332,7 +332,7 @@ PYI016.pyi:41:16: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe 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 @@ -352,7 +352,7 @@ PYI016.pyi:41:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe 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 @@ -372,7 +372,7 @@ PYI016.pyi:44:30: PYI016 [*] Duplicate union member `typing.Literal[1]` | = help: Remove duplicate union member `typing.Literal[1]` -ℹ Fix +ℹ Safe fix 41 41 | field14: int | int | str | int # Error 42 42 | 43 43 | # Should emit for duplicate literal types; also covered by PYI030 @@ -425,7 +425,7 @@ PYI016.pyi:69:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe 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 `|` @@ -476,7 +476,7 @@ PYI016.pyi:76:12: PYI016 [*] Duplicate union member `set[int]` | = help: Remove duplicate union member `set[int]` -ℹ Fix +ℹ Safe fix 73 73 | 74 74 | # Should emit in cases with newlines 75 75 | field23: set[ # foo @@ -517,7 +517,7 @@ PYI016.pyi:86:28: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe 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). @@ -533,7 +533,7 @@ PYI016.pyi:86:34: PYI016 [*] Duplicate union member `int` | = help: Remove duplicate union member `int` -ℹ Fix +ℹ Safe 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 b1f0e17403..f10bbc7b83 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 -ℹ Fix +ℹ Safe fix 4 4 | 5 5 | import typing_extensions 6 6 | @@ -31,7 +31,7 @@ PYI020.pyi:8:15: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -ℹ Fix +ℹ Safe fix 5 5 | import typing_extensions 6 6 | 7 7 | def f(x: "int"): ... # Y020 Quoted annotations should never be used in stubs @@ -52,7 +52,7 @@ PYI020.pyi:9:26: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -ℹ Fix +ℹ Safe 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 @@ -72,7 +72,7 @@ PYI020.pyi:13:12: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -ℹ Fix +ℹ Safe 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 | @@ -92,7 +92,7 @@ PYI020.pyi:14:25: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -ℹ Fix +ℹ Safe 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 @@ -112,7 +112,7 @@ PYI020.pyi:16:18: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -ℹ Fix +ℹ Safe 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 | @@ -132,7 +132,7 @@ PYI020.pyi:20:8: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -ℹ Fix +ℹ Safe fix 17 17 | """Documented and guaranteed useful.""" # Y021 Docstrings should not be included in stubs 18 18 | 19 19 | if sys.platform == "linux": @@ -153,7 +153,7 @@ PYI020.pyi:22:8: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -ℹ Fix +ℹ Safe 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": @@ -174,7 +174,7 @@ PYI020.pyi:24:8: PYI020 [*] Quoted annotations should not be included in stubs | = help: Remove quotes -ℹ Fix +ℹ Safe 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.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.py.snap index 2bebd50a8d..4c065291fd 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.py.snap @@ -9,7 +9,7 @@ PYI025.py:10:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` | = help: Alias `Set` to `AbstractSet` -ℹ Suggested fix +ℹ Unsafe fix 7 7 | 8 8 | 9 9 | def f(): @@ -29,7 +29,7 @@ PYI025.py:14:51: PYI025 [*] Use `from collections.abc import Set as AbstractSet` | = help: Alias `Set` to `AbstractSet` -ℹ Suggested fix +ℹ Unsafe 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.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.pyi.snap index 51afedd7f8..96752937fb 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.pyi.snap @@ -11,7 +11,7 @@ PYI025.pyi:8:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` | = help: Alias `Set` to `AbstractSet` -ℹ Suggested fix +ℹ Unsafe fix 5 5 | from collections.abc import Container, Sized, Set as AbstractSet, ValuesView # Ok 6 6 | 7 7 | def f(): @@ -31,7 +31,7 @@ PYI025.pyi:11:51: PYI025 [*] Use `from collections.abc import Set as AbstractSet | = help: Alias `Set` to `AbstractSet` -ℹ Suggested fix +ℹ Unsafe fix 8 8 | from collections.abc import Set # PYI025 9 9 | 10 10 | def f(): @@ -52,7 +52,7 @@ PYI025.pyi:16:37: PYI025 [*] Use `from collections.abc import Set as AbstractSet | = help: Alias `Set` to `AbstractSet` -ℹ Suggested fix +ℹ Unsafe fix 13 13 | def f(): 14 14 | """Test: local symbol renaming.""" 15 15 | if True: @@ -87,7 +87,7 @@ PYI025.pyi:33:29: PYI025 [*] Use `from collections.abc import Set as AbstractSet | = help: Alias `Set` to `AbstractSet` -ℹ Suggested fix +ℹ Unsafe fix 17 17 | else: 18 18 | Set = 1 19 19 | @@ -130,7 +130,7 @@ PYI025.pyi:44:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet | = help: Alias `Set` to `AbstractSet` -ℹ Suggested fix +ℹ Unsafe 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__PYI026_PYI026.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap index 4136a0a8ba..80def65148 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 -ℹ Fix +ℹ Safe fix 1 |-from typing import Literal, Any 1 |+from typing import Literal, Any, TypeAlias 2 2 | @@ -32,7 +32,7 @@ PYI026.pyi:4:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Optiona | = help: Add `TypeAlias` annotation -ℹ Fix +ℹ Safe fix 1 |-from typing import Literal, Any 1 |+from typing import Literal, Any, TypeAlias 2 2 | @@ -54,7 +54,7 @@ PYI026.pyi:5:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Foo: Ty | = help: Add `TypeAlias` annotation -ℹ Fix +ℹ Safe fix 1 |-from typing import Literal, Any 1 |+from typing import Literal, Any, TypeAlias 2 2 | @@ -76,7 +76,7 @@ PYI026.pyi:6:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `IntOrSt | = help: Add `TypeAlias` annotation -ℹ Fix +ℹ Safe fix 1 |-from typing import Literal, Any 1 |+from typing import Literal, Any, TypeAlias 2 2 | @@ -100,7 +100,7 @@ PYI026.pyi:7:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `AliasNo | = help: Add `TypeAlias` annotation -ℹ Fix +ℹ Safe 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 69f694dc8e..12d866d8de 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` -ℹ Fix +ℹ Safe fix 7 7 | def __repr__(self, *, foo) -> str: ... 8 8 | 9 9 | class ShouldRemoveSingle: @@ -30,7 +30,7 @@ PYI029.pyi:13:9: PYI029 [*] Defining `__repr__` in a stub is almost always redun | = help: Remove definition of `repr` -ℹ Fix +ℹ Safe fix 10 10 | def __str__(self) -> builtins.str: ... # Error: PYI029 11 11 | 12 12 | class ShouldRemove: @@ -50,7 +50,7 @@ PYI029.pyi:14:9: PYI029 [*] Defining `__str__` in a stub is almost always redund | = help: Remove definition of `str` -ℹ Fix +ℹ Safe 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__PYI032_PYI032.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI032_PYI032.py.snap index 88482baa6e..7415a2ab74 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` -ℹ Fix +ℹ Safe fix 3 3 | 4 4 | 5 5 | class Bad: @@ -29,7 +29,7 @@ PYI032.py:7:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to | = help: Replace with `object` -ℹ Fix +ℹ Safe 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 f79803bb72..0017fe8889 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` -ℹ Fix +ℹ Safe fix 3 3 | 4 4 | 5 5 | class Bad: @@ -29,7 +29,7 @@ PYI032.pyi:7:29: PYI032 [*] Prefer `object` to `Any` for the second parameter to | = help: Replace with `object` -ℹ Fix +ℹ Safe 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 026a12083b..5e891fa5d9 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` -ℹ Fix +ℹ Safe fix 51 51 | 52 52 | 53 53 | class BadOne: @@ -111,7 +111,7 @@ PYI036.py:70:58: PYI036 [*] Star-args in `__exit__` should be annotated with `ob | = help: Annotate star-args with `object` -ℹ Fix +ℹ Safe 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: @@ -132,7 +132,7 @@ PYI036.py:71:74: PYI036 [*] Star-args in `__aexit__` should be annotated with `o | = help: Annotate star-args with `object` -ℹ Fix +ℹ Safe 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 f6b9e0b86c..2d7817652e 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` -ℹ Fix +ℹ Safe fix 51 51 | 52 52 | 53 53 | class BadOne: @@ -121,7 +121,7 @@ PYI036.pyi:70:58: PYI036 [*] Star-args in `__exit__` should be annotated with `o | = help: Annotate star-args with `object` -ℹ Fix +ℹ Safe 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: @@ -142,7 +142,7 @@ PYI036.pyi:71:74: PYI036 [*] Star-args in `__aexit__` should be annotated with ` | = help: Annotate star-args with `object` -ℹ Fix +ℹ Safe 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 6c1a2c40d4..2e8fd1a1a3 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:3:14: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -ℹ Fix +ℹ Safe fix 1 1 | def f1(x: str = "50 character stringggggggggggggggggggggggggggggggg") -> None: ... # OK 2 2 | def f2( 3 |- x: str = "51 character stringgggggggggggggggggggggggggggggggg", # Error: PYI053 @@ -32,7 +32,7 @@ PYI053.pyi:9:14: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -ℹ Fix +ℹ Safe fix 6 6 | x: str = "50 character stringgggggggggggggggggggggggggggggg\U0001f600", # OK 7 7 | ) -> None: ... 8 8 | def f4( @@ -52,7 +52,7 @@ PYI053.pyi:21:16: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -ℹ Fix +ℹ Safe fix 18 18 | x: bytes = b"50 character byte stringggggggggggggggggggggggggg\xff", # OK 19 19 | ) -> None: ... 20 20 | def f8( @@ -73,7 +73,7 @@ PYI053.pyi:26:12: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -ℹ Fix +ℹ Safe fix 23 23 | 24 24 | foo: str = "50 character stringggggggggggggggggggggggggggggggg" # OK 25 25 | @@ -94,7 +94,7 @@ PYI053.pyi:30:14: PYI053 [*] String and bytes literals longer than 50 characters | = help: Replace with `...` -ℹ Fix +ℹ Safe fix 27 27 | 28 28 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK 29 29 | 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 bcd6889290..24457599a3 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 `...` -ℹ Fix +ℹ Safe fix 1 1 | field01: int = 0xFFFFFFFF 2 |-field02: int = 0xFFFFFFFFF # Error: PYI054 2 |+field02: int = ... # Error: PYI054 @@ -30,7 +30,7 @@ PYI054.pyi:4:17: PYI054 [*] Numeric literals with a string representation longer | = help: Replace with `...` -ℹ Fix +ℹ Safe fix 1 1 | field01: int = 0xFFFFFFFF 2 2 | field02: int = 0xFFFFFFFFF # Error: PYI054 3 3 | field03: int = -0xFFFFFFFF @@ -51,7 +51,7 @@ PYI054.pyi:8:16: PYI054 [*] Numeric literals with a string representation longer | = help: Replace with `...` -ℹ Fix +ℹ Safe fix 5 5 | 6 6 | field05: int = 1234567890 7 7 | field06: int = 12_456_890 @@ -72,7 +72,7 @@ PYI054.pyi:10:17: PYI054 [*] Numeric literals with a string representation longe | = help: Replace with `...` -ℹ Fix +ℹ Safe fix 7 7 | field06: int = 12_456_890 8 8 | field07: int = 12345678901 # Error: PYI054 9 9 | field08: int = -1234567801 @@ -92,7 +92,7 @@ PYI054.pyi:13:18: PYI054 [*] Numeric literals with a string representation longe | = help: Replace with `...` -ℹ Fix +ℹ Safe fix 10 10 | field09: int = -234_567_890 # Error: PYI054 11 11 | 12 12 | field10: float = 123.456789 @@ -113,7 +113,7 @@ PYI054.pyi:15:19: PYI054 [*] Numeric literals with a string representation longe | = help: Replace with `...` -ℹ Fix +ℹ Safe fix 12 12 | field10: float = 123.456789 13 13 | field11: float = 123.4567890 # Error: PYI054 14 14 | field12: float = -123.456789 @@ -133,7 +133,7 @@ PYI054.pyi:18:20: PYI054 [*] Numeric literals with a string representation longe | = help: Replace with `...` -ℹ Fix +ℹ Safe fix 15 15 | field13: float = -123.567_890 # Error: PYI054 16 16 | 17 17 | field14: complex = 1e1234567j @@ -151,7 +151,7 @@ PYI054.pyi:20:20: PYI054 [*] Numeric literals with a string representation longe | = help: Replace with `...` -ℹ Fix +ℹ Safe 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 691a671b4e..bdd2f92937 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 -ℹ Fix +ℹ Safe fix 28 28 | 29 29 | def func(): 30 30 | # PYI055 @@ -30,7 +30,7 @@ PYI055.py:32:8: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -ℹ Fix +ℹ Safe fix 29 29 | def func(): 30 30 | # PYI055 31 31 | x: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker @@ -48,7 +48,7 @@ PYI055.py:39:8: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -ℹ Fix +ℹ Safe fix 36 36 | from typing import Union as U 37 37 | 38 38 | # PYI055 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 c8fc0694ea..b845e5269a 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 -ℹ Fix +ℹ Safe fix 1 1 | import builtins 2 2 | from typing import Union 3 3 | @@ -32,7 +32,7 @@ PYI055.pyi:5:4: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -ℹ Fix +ℹ Safe fix 2 2 | from typing import Union 3 3 | 4 4 | w: builtins.type[int] | builtins.type[str] | builtins.type[complex] @@ -53,7 +53,7 @@ PYI055.pyi:6:4: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -ℹ Fix +ℹ Safe fix 3 3 | 4 4 | w: builtins.type[int] | builtins.type[str] | builtins.type[complex] 5 5 | x: type[int] | type[str] | type[float] @@ -73,7 +73,7 @@ PYI055.pyi:7:4: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -ℹ Fix +ℹ Safe 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] @@ -94,7 +94,7 @@ PYI055.pyi:8:4: PYI055 [*] Multiple `type` members in a union. Combine them into | = help: Combine multiple `type` members -ℹ Fix +ℹ Safe 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]] @@ -115,7 +115,7 @@ PYI055.pyi:10:15: PYI055 [*] Multiple `type` members in a union. Combine them in | = help: Combine multiple `type` members -ℹ Fix +ℹ Safe fix 7 7 | z: Union[type[float], type[complex]] 8 8 | z: Union[type[float, int], type[complex]] 9 9 | @@ -135,7 +135,7 @@ PYI055.pyi:20:7: PYI055 [*] Multiple `type` members in a union. Combine them int | = help: Combine multiple `type` members -ℹ Fix +ℹ Safe fix 17 17 | def func(arg: type[int, float] | str) -> None: ... 18 18 | 19 19 | # OK @@ -155,7 +155,7 @@ PYI055.pyi:24:11: PYI055 [*] Multiple `type` members in a union. Combine them in | = help: Combine multiple `type` members -ℹ Fix +ℹ Safe fix 21 21 | 22 22 | def func(): 23 23 | # PYI055 @@ -172,7 +172,7 @@ PYI055.pyi:25:12: PYI055 [*] Multiple `type` members in a union. Combine them in | = help: Combine multiple `type` members -ℹ Fix +ℹ Safe 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__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 1cfafc1426..d10bf9016e 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 -ℹ Fix +ℹ Safe fix 1 1 | from typing import Literal, Any 2 |+import typing_extensions 2 3 | @@ -32,7 +32,7 @@ PYI026.pyi:4:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g | = help: Add `TypeAlias` annotation -ℹ Fix +ℹ Safe fix 1 1 | from typing import Literal, Any 2 |+import typing_extensions 2 3 | @@ -54,7 +54,7 @@ PYI026.pyi:5:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g | = help: Add `TypeAlias` annotation -ℹ Fix +ℹ Safe fix 1 1 | from typing import Literal, Any 2 |+import typing_extensions 2 3 | @@ -76,7 +76,7 @@ PYI026.pyi:6:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g | = help: Add `TypeAlias` annotation -ℹ Fix +ℹ Safe fix 1 1 | from typing import Literal, Any 2 |+import typing_extensions 2 3 | @@ -100,7 +100,7 @@ PYI026.pyi:7:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g | = help: Add `TypeAlias` annotation -ℹ Fix +ℹ Safe 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 6a1c478525..ebb023025c 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 -ℹ Fix +ℹ Safe fix 6 6 | # `import pytest` 7 7 | 8 8 | @@ -29,7 +29,7 @@ PT001.py:34:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` | = help: Add parentheses -ℹ Fix +ℹ Safe fix 31 31 | # `from pytest import fixture` 32 32 | 33 33 | @@ -48,7 +48,7 @@ PT001.py:59:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` | = help: Add parentheses -ℹ Fix +ℹ Safe 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 8605c4d420..e508652be8 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 -ℹ Fix +ℹ Safe fix 11 11 | return 42 12 12 | 13 13 | @@ -31,7 +31,7 @@ PT001.py:24:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | = help: Remove parentheses -ℹ Fix +ℹ Safe fix 21 21 | return 42 22 22 | 23 23 | @@ -52,7 +52,7 @@ PT001.py:39:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | = help: Remove parentheses -ℹ Fix +ℹ Safe fix 36 36 | return 42 37 37 | 38 38 | @@ -73,7 +73,7 @@ PT001.py:49:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | = help: Remove parentheses -ℹ Fix +ℹ Safe fix 46 46 | return 42 47 47 | 48 48 | @@ -94,7 +94,7 @@ PT001.py:64:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | = help: Remove parentheses -ℹ Fix +ℹ Safe fix 61 61 | return 42 62 62 | 63 63 | @@ -115,7 +115,7 @@ PT001.py:74:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | = help: Remove parentheses -ℹ Fix +ℹ Safe 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 ceb7e0f5b1..1e7536acab 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 -ℹ Suggested fix +ℹ Unsafe fix 11 11 | ... 12 12 | 13 13 | @@ -29,7 +29,7 @@ PT003.py:19:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -ℹ Suggested fix +ℹ Unsafe fix 16 16 | ... 17 17 | 18 18 | @@ -48,7 +48,7 @@ PT003.py:24:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -ℹ Suggested fix +ℹ Unsafe fix 21 21 | ... 22 22 | 23 23 | @@ -67,7 +67,7 @@ PT003.py:29:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -ℹ Suggested fix +ℹ Unsafe fix 26 26 | ... 27 27 | 28 28 | @@ -88,7 +88,7 @@ PT003.py:37:31: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -ℹ Suggested fix +ℹ Unsafe 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. @@ -108,7 +108,7 @@ PT003.py:43:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -ℹ Suggested fix +ℹ Unsafe fix 40 40 | 41 41 | 42 42 | @pytest.fixture( @@ -128,7 +128,7 @@ PT003.py:52:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -ℹ Suggested fix +ℹ Unsafe fix 49 49 | 50 50 | @pytest.fixture( 51 51 | name="my_fixture", @@ -149,7 +149,7 @@ PT003.py:66:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | = help: Remove implied `scope` argument -ℹ Suggested fix +ℹ Unsafe 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 1399986a40..0b5690895a 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 name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `csv` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 21 21 | ... 22 22 | 23 23 | @@ -29,7 +29,7 @@ PT006.py:29:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `csv` for parameter names -ℹ Fix +ℹ Safe fix 26 26 | ... 27 27 | 28 28 | @@ -48,7 +48,7 @@ PT006.py:34:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `csv` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 31 31 | ... 32 32 | 33 33 | @@ -67,7 +67,7 @@ PT006.py:39:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `csv` for parameter names -ℹ Fix +ℹ Safe 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 c9e8b5e0c5..ab40922eec 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 name(s) type in `@pytest.mark.parametrize`, expec | = help: Use a `tuple` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 6 6 | ... 7 7 | 8 8 | @@ -29,7 +29,7 @@ PT006.py:14:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `tuple` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 11 11 | ... 12 12 | 13 13 | @@ -48,7 +48,7 @@ PT006.py:19:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `tuple` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 16 16 | ... 17 17 | 18 18 | @@ -67,7 +67,7 @@ PT006.py:29:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `csv` for parameter names -ℹ Fix +ℹ Safe fix 26 26 | ... 27 27 | 28 28 | @@ -86,7 +86,7 @@ PT006.py:34:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `tuple` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 31 31 | ... 32 32 | 33 33 | @@ -105,7 +105,7 @@ PT006.py:39:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `csv` for parameter names -ℹ Fix +ℹ Safe fix 36 36 | ... 37 37 | 38 38 | @@ -124,7 +124,7 @@ PT006.py:44:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `tuple` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 41 41 | ... 42 42 | 43 43 | @@ -143,7 +143,7 @@ PT006.py:49:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `tuple` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 46 46 | ... 47 47 | 48 48 | @@ -162,7 +162,7 @@ PT006.py:54:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `tuple` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 51 51 | ... 52 52 | 53 53 | @@ -181,7 +181,7 @@ PT006.py:59:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `tuple` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 56 56 | ... 57 57 | 58 58 | @@ -200,7 +200,7 @@ PT006.py:64:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `tuple` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 61 61 | ... 62 62 | 63 63 | @@ -219,7 +219,7 @@ PT006.py:69:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `tuple` for parameter names -ℹ Suggested fix +ℹ Unsafe 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 bdce72095b..633542964b 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 name(s) type in `@pytest.mark.parametrize`, expec | = help: Use a `list` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 6 6 | ... 7 7 | 8 8 | @@ -29,7 +29,7 @@ PT006.py:14:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `list` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 11 11 | ... 12 12 | 13 13 | @@ -48,7 +48,7 @@ PT006.py:19:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `list` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 16 16 | ... 17 17 | 18 18 | @@ -67,7 +67,7 @@ PT006.py:24:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `list` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 21 21 | ... 22 22 | 23 23 | @@ -86,7 +86,7 @@ PT006.py:29:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `csv` for parameter names -ℹ Fix +ℹ Safe fix 26 26 | ... 27 27 | 28 28 | @@ -105,7 +105,7 @@ PT006.py:39:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `csv` for parameter names -ℹ Fix +ℹ Safe fix 36 36 | ... 37 37 | 38 38 | @@ -124,7 +124,7 @@ PT006.py:54:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `list` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 51 51 | ... 52 52 | 53 53 | @@ -143,7 +143,7 @@ PT006.py:59:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `list` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 56 56 | ... 57 57 | 58 58 | @@ -162,7 +162,7 @@ PT006.py:64:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `list` for parameter names -ℹ Suggested fix +ℹ Unsafe fix 61 61 | ... 62 62 | 63 63 | @@ -181,7 +181,7 @@ PT006.py:69:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe | = help: Use a `list` for parameter names -ℹ Suggested fix +ℹ Unsafe 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__PT009.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap index 9b4b7fc1e4..572c08916f 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 ...` -ℹ Suggested fix +ℹ Unsafe fix 8 8 | def test_assert_true(self): 9 9 | expr = 1 10 10 | msg = "Must be True" @@ -33,7 +33,7 @@ PT009.py:12:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 9 9 | expr = 1 10 10 | msg = "Must be True" 11 11 | self.assertTrue(expr) # Error @@ -54,7 +54,7 @@ PT009.py:13:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 10 10 | msg = "Must be True" 11 11 | self.assertTrue(expr) # Error 12 12 | self.assertTrue(expr=expr) # Error @@ -75,7 +75,7 @@ PT009.py:14:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 11 11 | self.assertTrue(expr) # Error 12 12 | self.assertTrue(expr=expr) # Error 13 13 | self.assertTrue(expr, msg) # Error @@ -96,7 +96,7 @@ PT009.py:15:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 12 12 | self.assertTrue(expr=expr) # Error 13 13 | self.assertTrue(expr, msg) # Error 14 14 | self.assertTrue(expr=expr, msg=msg) # Error @@ -193,7 +193,7 @@ PT009.py:28:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertFalse(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 25 25 | return self.assertEqual(True, False) # Error, unfixable 26 26 | 27 27 | def test_assert_false(self): @@ -213,7 +213,7 @@ PT009.py:31:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertEqual(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 28 28 | self.assertFalse(True) # Error 29 29 | 30 30 | def test_assert_equal(self): @@ -233,7 +233,7 @@ PT009.py:34:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotEqual(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 31 31 | self.assertEqual(1, 2) # Error 32 32 | 33 33 | def test_assert_not_equal(self): @@ -253,7 +253,7 @@ PT009.py:37:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertGreater(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 34 34 | self.assertNotEqual(1, 1) # Error 35 35 | 36 36 | def test_assert_greater(self): @@ -273,7 +273,7 @@ PT009.py:40:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertGreaterEqual(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 37 37 | self.assertGreater(1, 2) # Error 38 38 | 39 39 | def test_assert_greater_equal(self): @@ -293,7 +293,7 @@ PT009.py:43:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertLess(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 40 40 | self.assertGreaterEqual(1, 2) # Error 41 41 | 42 42 | def test_assert_less(self): @@ -313,7 +313,7 @@ PT009.py:46:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertLessEqual(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 43 43 | self.assertLess(2, 1) # Error 44 44 | 45 45 | def test_assert_less_equal(self): @@ -333,7 +333,7 @@ PT009.py:49:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIn(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 46 46 | self.assertLessEqual(1, 2) # Error 47 47 | 48 48 | def test_assert_in(self): @@ -353,7 +353,7 @@ PT009.py:52:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotIn(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 49 49 | self.assertIn(1, [2, 3]) # Error 50 50 | 51 51 | def test_assert_not_in(self): @@ -373,7 +373,7 @@ PT009.py:55:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIsNone(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 52 52 | self.assertNotIn(2, [2, 3]) # Error 53 53 | 54 54 | def test_assert_is_none(self): @@ -393,7 +393,7 @@ PT009.py:58:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIsNotNone(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 55 55 | self.assertIsNone(0) # Error 56 56 | 57 57 | def test_assert_is_not_none(self): @@ -413,7 +413,7 @@ PT009.py:61:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIs(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 58 58 | self.assertIsNotNone(0) # Error 59 59 | 60 60 | def test_assert_is(self): @@ -433,7 +433,7 @@ PT009.py:64:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIsNot(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 61 61 | self.assertIs([], []) # Error 62 62 | 63 63 | def test_assert_is_not(self): @@ -453,7 +453,7 @@ PT009.py:67:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertIsInstance(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 64 64 | self.assertIsNot(1, 1) # Error 65 65 | 66 66 | def test_assert_is_instance(self): @@ -473,7 +473,7 @@ PT009.py:70:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotIsInstance(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 67 67 | self.assertIsInstance(1, str) # Error 68 68 | 69 69 | def test_assert_is_not_instance(self): @@ -493,7 +493,7 @@ PT009.py:73:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertRegex(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 70 70 | self.assertNotIsInstance(1, int) # Error 71 71 | 72 72 | def test_assert_regex(self): @@ -513,7 +513,7 @@ PT009.py:76:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotRegex(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 73 73 | self.assertRegex("abc", r"def") # Error 74 74 | 75 75 | def test_assert_not_regex(self): @@ -533,7 +533,7 @@ PT009.py:79:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertRegexpMatches(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 76 76 | self.assertNotRegex("abc", r"abc") # Error 77 77 | 78 78 | def test_assert_regexp_matches(self): @@ -553,7 +553,7 @@ PT009.py:82:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertNotRegex(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 79 79 | self.assertRegexpMatches("abc", r"def") # Error 80 80 | 81 81 | def test_assert_not_regexp_matches(self): @@ -573,7 +573,7 @@ PT009.py:85:9: PT009 [*] Use a regular `assert` instead of unittest-style `failI | = help: Replace `failIf(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 82 82 | self.assertNotRegex("abc", r"abc") # Error 83 83 | 84 84 | def test_fail_if(self): @@ -593,7 +593,7 @@ PT009.py:88:9: PT009 [*] Use a regular `assert` instead of unittest-style `failU | = help: Replace `failUnless(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 85 85 | self.failIf("abc") # Error 86 86 | 87 87 | def test_fail_unless(self): @@ -613,7 +613,7 @@ PT009.py:91:9: PT009 [*] Use a regular `assert` instead of unittest-style `failU | = help: Replace `failUnlessEqual(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 88 88 | self.failUnless("abc") # Error 89 89 | 90 90 | def test_fail_unless_equal(self): @@ -631,7 +631,7 @@ PT009.py:94:9: PT009 [*] Use a regular `assert` instead of unittest-style `failI | = help: Replace `failIfEqual(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe fix 91 91 | self.failUnlessEqual(1, 2) # Error 92 92 | 93 93 | def test_fail_if_equal(self): @@ -651,7 +651,7 @@ PT009.py:98:2: PT009 [*] Use a regular `assert` instead of unittest-style `asser | = help: Replace `assertTrue(...)` with `assert ...` -ℹ Suggested fix +ℹ Unsafe 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 2e05167b05..2b532f9df6 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 -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import pytest 2 2 | 3 3 | @@ -29,7 +29,7 @@ PT014.py:14:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -ℹ Suggested fix +ℹ Unsafe fix 11 11 | c = 3 12 12 | 13 13 | @@ -48,7 +48,7 @@ PT014.py:14:41: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.par | = help: Remove duplicate test case -ℹ Suggested fix +ℹ Unsafe fix 11 11 | c = 3 12 12 | 13 13 | @@ -67,7 +67,7 @@ PT014.py:14:44: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.par | = help: Remove duplicate test case -ℹ Suggested fix +ℹ Unsafe fix 11 11 | c = 3 12 12 | 13 13 | @@ -97,7 +97,7 @@ PT014.py:32:39: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -ℹ Suggested fix +ℹ Unsafe fix 29 29 | ... 30 30 | 31 31 | @@ -116,7 +116,7 @@ PT014.py:32:48: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -ℹ Suggested fix +ℹ Unsafe fix 29 29 | ... 30 30 | 31 31 | @@ -137,7 +137,7 @@ PT014.py:42:10: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -ℹ Suggested fix +ℹ Unsafe fix 39 39 | [ 40 40 | a, 41 41 | b, @@ -157,7 +157,7 @@ PT014.py:44:11: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par | = help: Remove duplicate test case -ℹ Suggested fix +ℹ Unsafe fix 41 41 | b, 42 42 | (a), 43 43 | c, 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 a656a5c666..cc8b68bc3d 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 -ℹ Suggested fix +ℹ Unsafe fix 11 11 | 12 12 | 13 13 | def test_error(): @@ -33,7 +33,7 @@ PT018.py:15:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Suggested fix +ℹ Unsafe fix 12 12 | 13 13 | def test_error(): 14 14 | assert something and something_else @@ -55,7 +55,7 @@ PT018.py:16:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Suggested fix +ℹ Unsafe fix 13 13 | def test_error(): 14 14 | assert something and something_else 15 15 | assert something and something_else and something_third @@ -77,7 +77,7 @@ PT018.py:17:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Suggested fix +ℹ Unsafe 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 @@ -99,7 +99,7 @@ PT018.py:18:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Suggested fix +ℹ Unsafe 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) @@ -121,7 +121,7 @@ PT018.py:19:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Suggested fix +ℹ Unsafe 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 @@ -143,7 +143,7 @@ PT018.py:20:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Suggested fix +ℹ Unsafe 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) @@ -168,7 +168,7 @@ PT018.py:21:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Suggested fix +ℹ Unsafe 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) @@ -197,7 +197,7 @@ PT018.py:24:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Suggested fix +ℹ Unsafe fix 21 21 | assert something and something_else == """error 22 22 | message 23 23 | """ @@ -219,7 +219,7 @@ PT018.py:33:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Suggested fix +ℹ Unsafe fix 30 30 | ) 31 31 | 32 32 | # recursive case @@ -241,7 +241,7 @@ PT018.py:34:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Suggested fix +ℹ Unsafe fix 31 31 | 32 32 | # recursive case 33 33 | assert not (a or not (b or c)) @@ -291,7 +291,7 @@ PT018.py:44:1: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Suggested fix +ℹ Unsafe fix 41 41 | 42 42 | 43 43 | assert something # OK @@ -311,7 +311,7 @@ PT018.py:45:1: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Suggested fix +ℹ Unsafe fix 42 42 | 43 43 | assert something # OK 44 44 | assert something and something_else # Error @@ -367,7 +367,7 @@ PT018.py:59:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Suggested fix +ℹ Unsafe fix 59 59 | assert not ( 60 60 | self.find_graph_output(node.output[0]) 61 61 | or self.find_graph_input(node.input[0]) @@ -396,7 +396,7 @@ PT018.py:65:5: PT018 [*] Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -ℹ Suggested fix +ℹ Unsafe 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 b9134a42d5..33378e77f0 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` -ℹ Fix +ℹ Safe fix 14 14 | @pytest.fixture() 15 15 | def error(): 16 16 | resource = acquire_resource() @@ -29,7 +29,7 @@ PT022.py:37:5: PT022 [*] No teardown in fixture `error`, use `return` instead of | = help: Replace `yield` with `return` -ℹ Fix +ℹ Safe fix 32 32 | 33 33 | 34 34 | @pytest.fixture() @@ -51,7 +51,7 @@ PT022.py:43:5: PT022 [*] No teardown in fixture `error`, use `return` instead of | = help: Replace `yield` with `return` -ℹ Fix +ℹ Safe 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 f5da889e9e..419dbb107a 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 -ℹ Fix +ℹ Safe fix 9 9 | # Without parentheses 10 10 | 11 11 | @@ -29,7 +29,7 @@ PT023.py:17:1: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | = help: Add/remove parentheses -ℹ Fix +ℹ Safe fix 14 14 | pass 15 15 | 16 16 | @@ -49,7 +49,7 @@ PT023.py:24:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | = help: Add/remove parentheses -ℹ Fix +ℹ Safe fix 21 21 | 22 22 | 23 23 | class TestClass: @@ -69,7 +69,7 @@ PT023.py:30:5: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | = help: Add/remove parentheses -ℹ Fix +ℹ Safe fix 27 27 | 28 28 | 29 29 | class TestClass: @@ -90,7 +90,7 @@ PT023.py:38:9: PT023 [*] Use `@pytest.mark.foo()` over `@pytest.mark.foo` | = help: Add/remove parentheses -ℹ Fix +ℹ Safe 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 f9715a74f8..da77a9ecac 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 -ℹ Fix +ℹ Safe fix 43 43 | # With parentheses 44 44 | 45 45 | @@ -29,7 +29,7 @@ PT023.py:51:1: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | = help: Add/remove parentheses -ℹ Fix +ℹ Safe fix 48 48 | pass 49 49 | 50 50 | @@ -49,7 +49,7 @@ PT023.py:58:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | = help: Add/remove parentheses -ℹ Fix +ℹ Safe fix 55 55 | 56 56 | 57 57 | class TestClass: @@ -69,7 +69,7 @@ PT023.py:64:5: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | = help: Add/remove parentheses -ℹ Fix +ℹ Safe fix 61 61 | 62 62 | 63 63 | class TestClass: @@ -90,7 +90,7 @@ PT023.py:72:9: PT023 [*] Use `@pytest.mark.foo` over `@pytest.mark.foo()` | = help: Add/remove parentheses -ℹ Fix +ℹ Safe 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 8a872364cd..29707b0e73 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` -ℹ Fix +ℹ Safe fix 11 11 | pass 12 12 | 13 13 | @@ -28,7 +28,7 @@ PT024.py:20:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures | = help: Remove `pytest.mark.asyncio` -ℹ Fix +ℹ Safe fix 17 17 | return 0 18 18 | 19 19 | @@ -47,7 +47,7 @@ PT024.py:27:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures | = help: Remove `pytest.mark.asyncio` -ℹ Fix +ℹ Safe fix 24 24 | 25 25 | 26 26 | @pytest.fixture() @@ -66,7 +66,7 @@ PT024.py:33:1: PT024 [*] `pytest.mark.asyncio` is unnecessary for fixtures | = help: Remove `pytest.mark.asyncio` -ℹ Fix +ℹ Safe 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 5d4297f9c8..ba4457e915 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` -ℹ Fix +ℹ Safe fix 6 6 | pass 7 7 | 8 8 | @@ -29,7 +29,7 @@ PT025.py:16:1: PT025 [*] `pytest.mark.usefixtures` has no effect on fixtures | = help: Remove `pytest.mark.usefixtures` -ℹ Fix +ℹ Safe 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 4bf726cece..8fb8c8d7fe 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 -ℹ Suggested fix +ℹ Unsafe fix 16 16 | pass 17 17 | 18 18 | @@ -29,7 +29,7 @@ PT026.py:24:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters | = help: Remove `usefixtures` decorator or pass parameters -ℹ Suggested fix +ℹ Unsafe 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 dd48d60163..555cfdd5c7 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` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import unittest 2 |+import pytest 2 3 | @@ -35,7 +35,7 @@ PT027_0.py:8:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assert | = help: Replace `assertRaises` with `pytest.raises` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import unittest 2 |+import pytest 2 3 | @@ -60,7 +60,7 @@ PT027_0.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `failU | = help: Replace `failUnlessRaises` with `pytest.raises` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import unittest 2 |+import pytest 2 3 | @@ -86,7 +86,7 @@ PT027_0.py:14:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegex` with `pytest.raises` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import unittest 2 |+import pytest 2 3 | @@ -112,7 +112,7 @@ PT027_0.py:17:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegex` with `pytest.raises` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import unittest 2 |+import pytest 2 3 | @@ -139,7 +139,7 @@ PT027_0.py:20:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegex` with `pytest.raises` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import unittest 2 |+import pytest 2 3 | @@ -168,7 +168,7 @@ PT027_0.py:25:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegex` with `pytest.raises` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import unittest 2 |+import pytest 2 3 | @@ -196,7 +196,7 @@ PT027_0.py:30:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser | = help: Replace `assertRaisesRegexp` with `pytest.raises` -ℹ Suggested fix +ℹ Unsafe 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 3886db7a54..cc642fb5d8 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` -ℹ Suggested fix +ℹ Unsafe 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__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 60e045893e..771a4ddc2b 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 -ℹ Fix +ℹ Safe fix 2 2 | Double quotes multiline module docstring 3 3 | """ 4 4 | @@ -41,7 +41,7 @@ docstring_doubles.py:16:5: Q001 [*] Double quote multiline found but single quot | = help: Replace double multiline quotes with single quotes -ℹ Fix +ℹ Safe fix 13 13 | Double quotes multiline class docstring 14 14 | """ 15 15 | @@ -66,7 +66,7 @@ docstring_doubles.py:21:21: Q001 [*] Double quote multiline found but single quo | = help: Replace double multiline quotes with single quotes -ℹ Fix +ℹ Safe fix 18 18 | """ 19 19 | 20 20 | # The colon in the list indexing below is an edge case for the docstring scanner @@ -92,7 +92,7 @@ docstring_doubles.py:30:9: Q001 [*] Double quote multiline found but single quot | = help: Replace double multiline quotes with single quotes -ℹ Fix +ℹ Safe fix 27 27 | 28 28 | some_expression = 'hello world' 29 29 | @@ -117,7 +117,7 @@ docstring_doubles.py:35:13: Q001 [*] Double quote multiline found but single quo | = help: Replace double multiline quotes with single quotes -ℹ Fix +ℹ Safe 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 07da9b1275..5eb1e20892 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 -ℹ Fix +ℹ Safe fix 1 1 | class SingleLineDocstrings(): 2 2 | """ Double quotes single line class docstring """ 3 |- """ Not a docstring """ @@ -32,7 +32,7 @@ docstring_doubles_class.py:5:23: Q001 [*] Double quote multiline found but singl | = help: Replace double multiline quotes with single quotes -ℹ Fix +ℹ Safe 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 7fc768037e..b669528cd7 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 -ℹ Fix +ℹ Safe fix 1 1 | def foo(): 2 2 | """function without params, single line docstring""" 3 |- """ not a docstring""" @@ -30,7 +30,7 @@ docstring_doubles_function.py:11:5: Q001 [*] Double quote multiline found but si | = help: Replace double multiline quotes with single quotes -ℹ Fix +ℹ Safe fix 8 8 | """ 9 9 | function without params, multiline docstring 10 10 | """ @@ -51,7 +51,7 @@ docstring_doubles_function.py:15:39: Q001 [*] Double quote multiline found but s | = help: Replace double multiline quotes with single quotes -ℹ Fix +ℹ Safe fix 12 12 | return 13 13 | 14 14 | @@ -74,7 +74,7 @@ docstring_doubles_function.py:17:5: Q001 [*] Double quote multiline found but si | = help: Replace double multiline quotes with single quotes -ℹ Fix +ℹ Safe fix 14 14 | 15 15 | def fun_with_params_no_docstring(a, b=""" 16 16 | not a @@ -93,7 +93,7 @@ docstring_doubles_function.py:22:5: Q001 [*] Double quote multiline found but si | = help: Replace double multiline quotes with single quotes -ℹ Fix +ℹ Safe 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 5d69c266af..058c60b924 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 -ℹ Fix +ℹ Safe fix 1 1 | """ 2 2 | Double quotes multiline module docstring 3 3 | """ @@ -38,7 +38,7 @@ docstring_doubles_module_multiline.py:9:1: Q001 [*] Double quote multiline found | = help: Replace double multiline quotes with single quotes -ℹ Fix +ℹ Safe 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 5a80dfc1bc..64f43441c8 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 -ℹ Fix +ℹ Safe fix 1 1 | """ Double quotes singleline module docstring """ 2 |-""" this is not a docstring """ 2 |+''' this is not a docstring ''' @@ -28,7 +28,7 @@ docstring_doubles_module_singleline.py:6:1: Q001 [*] Double quote multiline foun | = help: Replace double multiline quotes with single quotes -ℹ Fix +ℹ Safe 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 6d0eeeb2e5..c1c2f2c821 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 -ℹ Fix +ℹ Safe fix 1 |-''' 1 |+""" 2 2 | Single quotes multiline module docstring @@ -36,7 +36,7 @@ docstring_singles.py:14:5: Q002 [*] Single quote docstring found but double quot | = help: Replace single quotes docstring with double quotes -ℹ Fix +ℹ Safe fix 11 11 | class Cls(MakeKlass(''' 12 12 | class params \t not a docstring 13 13 | ''')): @@ -63,7 +63,7 @@ docstring_singles.py:26:9: Q002 [*] Single quote docstring found but double quot | = help: Replace single quotes docstring with double quotes -ℹ Fix +ℹ Safe 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 45ee206e4d..da70df063d 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 -ℹ Fix +ℹ Safe fix 1 1 | class SingleLineDocstrings(): 2 |- ''' Double quotes single line class docstring ''' 2 |+ """ Double quotes single line class docstring """ @@ -27,7 +27,7 @@ docstring_singles_class.py:6:9: Q002 [*] Single quote docstring found but double | = help: Replace single quotes docstring with double quotes -ℹ Fix +ℹ Safe fix 3 3 | ''' Not a docstring ''' 4 4 | 5 5 | def foo(self, bar='''not a docstring'''): @@ -46,7 +46,7 @@ docstring_singles_class.py:9:29: Q002 [*] Single quote docstring found but doubl | = help: Replace single quotes docstring with double quotes -ℹ Fix +ℹ Safe 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 7ea3ad52f3..cad7d15422 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 -ℹ Fix +ℹ Safe fix 1 1 | def foo(): 2 |- '''function without params, single line docstring''' 2 |+ """function without params, single line docstring""" @@ -32,7 +32,7 @@ docstring_singles_function.py:8:5: Q002 [*] Single quote docstring found but dou | = help: Replace single quotes docstring with double quotes -ℹ Fix +ℹ Safe fix 5 5 | 6 6 | 7 7 | def foo2(): @@ -53,7 +53,7 @@ docstring_singles_function.py:27:5: Q002 [*] Single quote docstring found but do | = help: Replace single quotes docstring with double quotes -ℹ Fix +ℹ Safe 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_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 72e2913867..3924f21233 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 -ℹ Fix +ℹ Safe 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 32eb4bc1e4..c1c3012212 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,7 @@ docstring_singles_module_singleline.py:1:1: Q002 [*] Single quote docstring foun | = help: Replace single quotes docstring with double quotes -ℹ Fix +ℹ Safe 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 a81aba31aa..8e031c7aab 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 -ℹ Fix +ℹ Safe fix 1 |-""" 1 |+''' 2 2 | Double quotes multiline module docstring @@ -35,7 +35,7 @@ docstring_doubles.py:12:5: Q002 [*] Double quote docstring found but single quot | = help: Replace double quotes docstring with single quotes -ℹ Fix +ℹ Safe fix 9 9 | l = [] 10 10 | 11 11 | class Cls: @@ -62,7 +62,7 @@ docstring_doubles.py:24:9: Q002 [*] Double quote docstring found but single quot | = help: Replace double quotes docstring with single quotes -ℹ Fix +ℹ Safe 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 8e33030efa..18e358b897 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 -ℹ Fix +ℹ Safe fix 1 1 | class SingleLineDocstrings(): 2 |- """ Double quotes single line class docstring """ 2 |+ ''' Double quotes single line class docstring ''' @@ -27,7 +27,7 @@ docstring_doubles_class.py:6:9: Q002 [*] Double quote docstring found but single | = help: Replace double quotes docstring with single quotes -ℹ Fix +ℹ Safe fix 3 3 | """ Not a docstring """ 4 4 | 5 5 | def foo(self, bar="""not a docstring"""): @@ -46,7 +46,7 @@ docstring_doubles_class.py:9:29: Q002 [*] Double quote docstring found but singl | = help: Replace double quotes docstring with single quotes -ℹ Fix +ℹ Safe 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 c80757cb19..3758fc2a7b 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 -ℹ Fix +ℹ Safe fix 1 1 | def foo(): 2 |- """function without params, single line docstring""" 2 |+ '''function without params, single line docstring''' @@ -32,7 +32,7 @@ docstring_doubles_function.py:8:5: Q002 [*] Double quote docstring found but sin | = help: Replace double quotes docstring with single quotes -ℹ Fix +ℹ Safe fix 5 5 | 6 6 | 7 7 | def foo2(): @@ -53,7 +53,7 @@ docstring_doubles_function.py:27:5: Q002 [*] Double quote docstring found but si | = help: Replace double quotes docstring with single quotes -ℹ Fix +ℹ Safe 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_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 92a6a19370..f66291915d 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 -ℹ Fix +ℹ Safe 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 b9cc166967..025add5fdd 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,7 @@ docstring_doubles_module_singleline.py:1:1: Q002 [*] Double quote docstring foun | = help: Replace double quotes docstring with single quotes -ℹ Fix +ℹ Safe 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 4d00a36af6..2a790da62f 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 -ℹ Fix +ℹ Safe fix 2 2 | Single quotes multiline module docstring 3 3 | ''' 4 4 | @@ -41,7 +41,7 @@ docstring_singles.py:11:21: Q001 [*] Single quote multiline found but double quo | = help: Replace single multiline quotes with double quotes -ℹ Fix +ℹ Safe fix 8 8 | 9 9 | l = [] 10 10 | @@ -68,7 +68,7 @@ docstring_singles.py:18:5: Q001 [*] Single quote multiline found but double quot | = help: Replace single multiline quotes with double quotes -ℹ Fix +ℹ Safe fix 15 15 | Single quotes multiline class docstring 16 16 | ''' 17 17 | @@ -93,7 +93,7 @@ docstring_singles.py:23:21: Q001 [*] Single quote multiline found but double quo | = help: Replace single multiline quotes with double quotes -ℹ Fix +ℹ Safe fix 20 20 | ''' 21 21 | 22 22 | # The colon in the list indexing below is an edge case for the docstring scanner @@ -119,7 +119,7 @@ docstring_singles.py:32:9: Q001 [*] Single quote multiline found but double quot | = help: Replace single multiline quotes with double quotes -ℹ Fix +ℹ Safe fix 29 29 | 30 30 | some_expression = 'hello world' 31 31 | @@ -144,7 +144,7 @@ docstring_singles.py:37:13: Q001 [*] Single quote multiline found but double quo | = help: Replace single multiline quotes with double quotes -ℹ Fix +ℹ Safe 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 a3678ef54f..a3a5bcf66e 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 -ℹ Fix +ℹ Safe fix 1 1 | class SingleLineDocstrings(): 2 2 | ''' Double quotes single line class docstring ''' 3 |- ''' Not a docstring ''' @@ -32,7 +32,7 @@ docstring_singles_class.py:5:23: Q001 [*] Single quote multiline found but doubl | = help: Replace single multiline quotes with double quotes -ℹ Fix +ℹ Safe 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 14a97a1099..afede01c5e 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 -ℹ Fix +ℹ Safe fix 1 1 | def foo(): 2 2 | '''function without params, single line docstring''' 3 |- ''' not a docstring''' @@ -30,7 +30,7 @@ docstring_singles_function.py:11:5: Q001 [*] Single quote multiline found but do | = help: Replace single multiline quotes with double quotes -ℹ Fix +ℹ Safe fix 8 8 | ''' 9 9 | function without params, multiline docstring 10 10 | ''' @@ -51,7 +51,7 @@ docstring_singles_function.py:15:39: Q001 [*] Single quote multiline found but d | = help: Replace single multiline quotes with double quotes -ℹ Fix +ℹ Safe fix 12 12 | return 13 13 | 14 14 | @@ -74,7 +74,7 @@ docstring_singles_function.py:17:5: Q001 [*] Single quote multiline found but do | = help: Replace single multiline quotes with double quotes -ℹ Fix +ℹ Safe fix 14 14 | 15 15 | def fun_with_params_no_docstring(a, b=''' 16 16 | not a @@ -93,7 +93,7 @@ docstring_singles_function.py:22:5: Q001 [*] Single quote multiline found but do | = help: Replace single multiline quotes with double quotes -ℹ Fix +ℹ Safe 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 38a0beb4ce..3cefd7eb4a 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 -ℹ Fix +ℹ Safe fix 1 1 | ''' 2 2 | Double quotes multiline module docstring 3 3 | ''' @@ -38,7 +38,7 @@ docstring_singles_module_multiline.py:9:1: Q001 [*] Single quote multiline found | = help: Replace single multiline quotes with double quotes -ℹ Fix +ℹ Safe 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 beb76e195b..f92fff71db 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 -ℹ Fix +ℹ Safe fix 1 1 | ''' Double quotes singleline module docstring ''' 2 |-''' this is not a docstring ''' 2 |+""" this is not a docstring """ @@ -28,7 +28,7 @@ docstring_singles_module_singleline.py:6:1: Q001 [*] Single quote multiline foun | = help: Replace single multiline quotes with double quotes -ℹ Fix +ℹ Safe 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 01befe313e..43d3e754b3 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,7 @@ singles.py:1:25: Q000 [*] Single quotes found but double quotes preferred | = help: Replace single quotes with double quotes -ℹ Fix +ℹ Safe 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' @@ -27,7 +27,7 @@ singles.py:2:25: Q000 [*] Single quotes found but double quotes preferred | = help: Replace single quotes with double quotes -ℹ Fix +ℹ Safe 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" @@ -44,7 +44,7 @@ singles.py:3:25: Q000 [*] Single quotes found but double quotes preferred | = help: Replace single quotes with double quotes -ℹ Fix +ℹ Safe 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 911eff0086..4cc1920e73 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,7 @@ singles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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\"" @@ -27,7 +27,7 @@ singles_escaped.py:9:5: Q003 [*] Change outer quotes to avoid escaping inner quo | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe fix 6 6 | this_is_fine = R"This is a \"string\"" 7 7 | this_should_raise = ( 8 8 | "This is a" @@ -47,7 +47,7 @@ singles_escaped.py:13:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe fix 10 10 | ) 11 11 | 12 12 | # Same as above, but with f-strings @@ -67,7 +67,7 @@ singles_escaped.py:21:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe fix 18 18 | fR"This is a \"string\"" 19 19 | foo = ( 20 20 | f"This is a" @@ -88,7 +88,7 @@ singles_escaped.py:31:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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. @@ -108,7 +108,7 @@ singles_escaped.py:32:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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 @@ -129,7 +129,7 @@ singles_escaped.py:33:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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 @@ -150,7 +150,7 @@ singles_escaped.py:33:12: Q003 [*] Change outer quotes to avoid escaping inner q | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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 @@ -170,7 +170,7 @@ singles_escaped.py:36:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe fix 33 33 | f"\"foo\" {f"\"foo\""} \"\"" # Q003 34 34 | 35 35 | f"normal {f"nested"} normal" @@ -190,7 +190,7 @@ singles_escaped.py:38:15: Q003 [*] Change outer quotes to avoid escaping inner q | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe fix 35 35 | f"normal {f"nested"} normal" 36 36 | f"\"normal\" {f"nested"} normal" # Q003 37 37 | f"\"normal\" {f"nested"} 'single quotes'" @@ -207,7 +207,7 @@ singles_escaped.py:39:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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 0bc6a10ac6..e3d039ba63 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,7 @@ singles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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\"" @@ -27,7 +27,7 @@ singles_escaped.py:9:5: Q003 [*] Change outer quotes to avoid escaping inner quo | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe fix 6 6 | this_is_fine = R"This is a \"string\"" 7 7 | this_should_raise = ( 8 8 | "This is a" @@ -47,7 +47,7 @@ singles_escaped.py:13:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe fix 10 10 | ) 11 11 | 12 12 | # Same as above, but with f-strings @@ -67,7 +67,7 @@ singles_escaped.py:21:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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_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 e7f0de50e4..e85c35c669 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 -ℹ Fix +ℹ Safe fix 1 1 | x = ( 2 |- 'This' 2 |+ "This" @@ -30,7 +30,7 @@ singles_implicit.py:3:5: Q000 [*] Single quotes found but double quotes preferre | = help: Replace single quotes with double quotes -ℹ Fix +ℹ Safe fix 1 1 | x = ( 2 2 | 'This' 3 |- 'is' @@ -49,7 +49,7 @@ singles_implicit.py:4:5: Q000 [*] Single quotes found but double quotes preferre | = help: Replace single quotes with double quotes -ℹ Fix +ℹ Safe fix 1 1 | x = ( 2 2 | 'This' 3 3 | 'is' @@ -69,7 +69,7 @@ singles_implicit.py:8:5: Q000 [*] Single quotes found but double quotes preferre | = help: Replace single quotes with double quotes -ℹ Fix +ℹ Safe fix 5 5 | ) 6 6 | 7 7 | x = ( @@ -90,7 +90,7 @@ singles_implicit.py:9:5: Q000 [*] Single quotes found but double quotes preferre | = help: Replace single quotes with double quotes -ℹ Fix +ℹ Safe fix 6 6 | 7 7 | x = ( 8 8 | 'This' \ @@ -110,7 +110,7 @@ singles_implicit.py:10:5: Q000 [*] Single quotes found but double quotes preferr | = help: Replace single quotes with double quotes -ℹ Fix +ℹ Safe fix 7 7 | x = ( 8 8 | 'This' \ 9 9 | 'is' \ @@ -129,7 +129,7 @@ singles_implicit.py:27:1: Q000 [*] Single quotes found but double quotes preferr | = help: Replace single quotes with double quotes -ℹ Fix +ℹ Safe 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 4ba380293e..3fdadee4d8 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 -ℹ Fix +ℹ Safe 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.py.snap b/crates/ruff_linter/src/rules/flake8_quotes/snapshots/ruff_linter__rules__flake8_quotes__tests__require_singles_over_doubles.py.snap index 1d0c054202..594f620909 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,7 @@ doubles.py:1:25: Q000 [*] Double quotes found but single quotes preferred | = help: Replace double quotes with single quotes -ℹ Fix +ℹ Safe 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" @@ -27,7 +27,7 @@ doubles.py:2:25: Q000 [*] Double quotes found but single quotes preferred | = help: Replace double quotes with single quotes -ℹ Fix +ℹ Safe 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' @@ -44,7 +44,7 @@ doubles.py:3:25: Q000 [*] Double quotes found but single quotes preferred | = help: Replace double quotes with single quotes -ℹ Fix +ℹ Safe 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 c5d6253904..e93b1aab9a 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,7 @@ doubles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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\'' @@ -27,7 +27,7 @@ doubles_escaped.py:2:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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'" @@ -45,7 +45,7 @@ doubles_escaped.py:10:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe fix 7 7 | this_is_fine = R'This is a \'string\'' 8 8 | this_should_raise = ( 9 9 | 'This is a' @@ -65,7 +65,7 @@ doubles_escaped.py:14:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe fix 11 11 | ) 12 12 | 13 13 | # Same as above, but with f-strings @@ -86,7 +86,7 @@ doubles_escaped.py:15:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe fix 12 12 | 13 13 | # Same as above, but with f-strings 14 14 | f'This is a \'string\'' # Q003 @@ -106,7 +106,7 @@ doubles_escaped.py:23:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe fix 20 20 | fR'This is a \'string\'' 21 21 | foo = ( 22 22 | f'This is a' @@ -127,7 +127,7 @@ doubles_escaped.py:33:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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. @@ -147,7 +147,7 @@ doubles_escaped.py:34:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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 @@ -168,7 +168,7 @@ doubles_escaped.py:35:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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 @@ -189,7 +189,7 @@ doubles_escaped.py:35:12: Q003 [*] Change outer quotes to avoid escaping inner q | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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 @@ -209,7 +209,7 @@ doubles_escaped.py:38:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe fix 35 35 | f'\'foo\' {f'\'nested\''} \'\'' # Q003 36 36 | 37 37 | f'normal {f'nested'} normal' @@ -229,7 +229,7 @@ doubles_escaped.py:40:15: Q003 [*] Change outer quotes to avoid escaping inner q | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe fix 37 37 | f'normal {f'nested'} normal' 38 38 | f'\'normal\' {f'nested'} normal' # Q003 39 39 | f'\'normal\' {f'nested'} "double quotes"' @@ -246,7 +246,7 @@ doubles_escaped.py:41:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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 32f3d219be..375eaacc46 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,7 @@ doubles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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\'' @@ -27,7 +27,7 @@ doubles_escaped.py:2:26: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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'" @@ -45,7 +45,7 @@ doubles_escaped.py:10:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe fix 7 7 | this_is_fine = R'This is a \'string\'' 8 8 | this_should_raise = ( 9 9 | 'This is a' @@ -65,7 +65,7 @@ doubles_escaped.py:14:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe fix 11 11 | ) 12 12 | 13 13 | # Same as above, but with f-strings @@ -86,7 +86,7 @@ doubles_escaped.py:15:1: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe fix 12 12 | 13 13 | # Same as above, but with f-strings 14 14 | f'This is a \'string\'' # Q003 @@ -106,7 +106,7 @@ doubles_escaped.py:23:5: Q003 [*] Change outer quotes to avoid escaping inner qu | = help: Change outer quotes to avoid escaping inner quotes -ℹ Fix +ℹ Safe 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_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 bb6f91c98f..a44c07a17c 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 -ℹ Fix +ℹ Safe fix 1 1 | x = ( 2 |- "This" 2 |+ 'This' @@ -30,7 +30,7 @@ doubles_implicit.py:3:5: Q000 [*] Double quotes found but single quotes preferre | = help: Replace double quotes with single quotes -ℹ Fix +ℹ Safe fix 1 1 | x = ( 2 2 | "This" 3 |- "is" @@ -49,7 +49,7 @@ doubles_implicit.py:4:5: Q000 [*] Double quotes found but single quotes preferre | = help: Replace double quotes with single quotes -ℹ Fix +ℹ Safe fix 1 1 | x = ( 2 2 | "This" 3 3 | "is" @@ -69,7 +69,7 @@ doubles_implicit.py:8:5: Q000 [*] Double quotes found but single quotes preferre | = help: Replace double quotes with single quotes -ℹ Fix +ℹ Safe fix 5 5 | ) 6 6 | 7 7 | x = ( @@ -90,7 +90,7 @@ doubles_implicit.py:9:5: Q000 [*] Double quotes found but single quotes preferre | = help: Replace double quotes with single quotes -ℹ Fix +ℹ Safe fix 6 6 | 7 7 | x = ( 8 8 | "This" \ @@ -110,7 +110,7 @@ doubles_implicit.py:10:5: Q000 [*] Double quotes found but single quotes preferr | = help: Replace double quotes with single quotes -ℹ Fix +ℹ Safe fix 7 7 | x = ( 8 8 | "This" \ 9 9 | "is" \ @@ -129,7 +129,7 @@ doubles_implicit.py:27:1: Q000 [*] Double quotes found but single quotes preferr | = help: Replace double quotes with single quotes -ℹ Fix +ℹ Safe 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 29814f8c71..bb0ef317cb 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 -ℹ Fix +ℹ Safe fix 1 |-s = """ This "should" 1 |+s = ''' This "should" 2 2 | be 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 7c839f7859..37b632cc25 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 -ℹ Fix +ℹ Safe fix 2 2 | y = 6 + "7" 3 3 | except TypeError: 4 4 | # RSE102 @@ -32,7 +32,7 @@ RSE102.py:13:16: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Fix +ℹ Safe fix 10 10 | raise 11 11 | 12 12 | # RSE102 @@ -52,7 +52,7 @@ RSE102.py:16:17: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Fix +ℹ Safe fix 13 13 | raise TypeError() 14 14 | 15 15 | # RSE102 @@ -73,7 +73,7 @@ RSE102.py:20:5: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Fix +ℹ Safe fix 17 17 | 18 18 | # RSE102 19 19 | raise TypeError \ @@ -94,7 +94,7 @@ RSE102.py:24:5: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Fix +ℹ Safe fix 21 21 | 22 22 | # RSE102 23 23 | raise TypeError \ @@ -117,7 +117,7 @@ RSE102.py:27:16: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Fix +ℹ Safe fix 24 24 | (); 25 25 | 26 26 | # RSE102 @@ -142,7 +142,7 @@ RSE102.py:32:19: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Fix +ℹ Safe fix 29 29 | ) 30 30 | 31 31 | # RSE102 @@ -167,7 +167,7 @@ RSE102.py:37:16: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Fix +ℹ Safe fix 34 34 | ) 35 35 | 36 36 | # RSE102 @@ -189,7 +189,7 @@ RSE102.py:74:17: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Fix +ℹ Safe fix 71 71 | 72 72 | 73 73 | # RSE102 @@ -209,7 +209,7 @@ RSE102.py:76:17: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Fix +ℹ Safe fix 73 73 | # RSE102 74 74 | raise IndexError()from ZeroDivisionError 75 75 | @@ -230,7 +230,7 @@ RSE102.py:79:17: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Fix +ℹ Safe fix 76 76 | raise IndexError()\ 77 77 | from ZeroDivisionError 78 78 | @@ -251,7 +251,7 @@ RSE102.py:81:17: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Fix +ℹ Safe fix 78 78 | 79 79 | raise IndexError() from ZeroDivisionError 80 80 | @@ -269,7 +269,7 @@ RSE102.py:84:10: RSE102 [*] Unnecessary parentheses on raised exception | = help: Remove unnecessary parentheses -ℹ Suggested fix +ℹ Unsafe fix 81 81 | raise IndexError(); 82 82 | 83 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 2fc27bd29d..9705d137b6 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` -ℹ Fix +ℹ Safe fix 1 1 | def x(y): 2 2 | if not y: 3 3 | return @@ -29,7 +29,7 @@ RET501.py:14:9: RET501 [*] Do not explicitly `return None` in function if it is | = help: Remove explicit `return None` -ℹ Fix +ℹ Safe 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 9946d7b361..01d5a439db 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 -ℹ Fix +ℹ Safe 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 c3a4baa569..f3e16f5919 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:20:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 19 19 | def x(y): 20 20 | if not y: 21 21 | return 1 @@ -33,7 +33,7 @@ RET503.py:27:9: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 25 25 | def x(y): 26 26 | if not y: 27 27 | print() # error @@ -51,7 +51,7 @@ RET503.py:36:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 34 34 | return 1 35 35 | 36 36 | print() # error @@ -73,7 +73,7 @@ RET503.py:41:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 41 41 | for i in range(10): 42 42 | if i > 10: 43 43 | return i @@ -91,7 +91,7 @@ RET503.py:52:9: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 50 50 | return i 51 51 | else: 52 52 | print() # error @@ -109,7 +109,7 @@ RET503.py:59:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 57 57 | if x > 0: 58 58 | return False 59 59 | no_such_function() # error @@ -127,7 +127,7 @@ RET503.py:66:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 64 64 | if x > 0: 65 65 | return False 66 66 | print("", end="") # error @@ -149,7 +149,7 @@ RET503.py:82:5: RET503 [*] Missing explicit `return` at the end of function able | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 83 83 | if y > 0: 84 84 | return 1 85 85 | y += 1 @@ -171,7 +171,7 @@ RET503.py:113:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 114 114 | if i > y: 115 115 | break 116 116 | return z @@ -195,7 +195,7 @@ RET503.py:120:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 124 124 | else: 125 125 | return z 126 126 | return None @@ -216,7 +216,7 @@ RET503.py:130:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 131 131 | if i < y: 132 132 | continue 133 133 | return z @@ -240,7 +240,7 @@ RET503.py:137:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 141 141 | else: 142 142 | return z 143 143 | return None @@ -260,7 +260,7 @@ RET503.py:274:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 273 273 | 274 274 | for value in values: 275 275 | print(value) @@ -278,7 +278,7 @@ RET503.py:291:13: RET503 [*] Missing explicit `return` at the end of function ab | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 289 289 | return 1 290 290 | case 1: 291 291 | print() # error @@ -298,7 +298,7 @@ RET503.py:300:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 299 299 | def example(): 300 300 | if True: 301 301 | return "" @@ -317,7 +317,7 @@ RET503.py:305:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 304 304 | def example(): 305 305 | if True: 306 306 | return "" @@ -336,7 +336,7 @@ RET503.py:310:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 309 309 | def example(): 310 310 | if True: 311 311 | return "" # type: ignore @@ -355,7 +355,7 @@ RET503.py:315:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 314 314 | def example(): 315 315 | if True: 316 316 | return "" ; @@ -375,7 +375,7 @@ RET503.py:320:9: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 320 320 | if True: 321 321 | return "" \ 322 322 | ; # type: ignore @@ -393,7 +393,7 @@ RET503.py:328:5: RET503 [*] Missing explicit `return` at the end of function abl | = help: Add explicit `return` statement -ℹ Suggested fix +ℹ Unsafe fix 326 326 | if False: 327 327 | return 1 328 328 | x = 2 \ 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 c9bcc87984..9427cd7a79 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 -ℹ Suggested fix +ℹ Unsafe fix 2 2 | # Errors 3 3 | ### 4 4 | def x(): @@ -30,7 +30,7 @@ RET504.py:23:12: RET504 [*] Unnecessary assignment to `formatted` before `return | = help: Remove unnecessary assignment -ℹ Suggested fix +ℹ Unsafe fix 19 19 | def x(): 20 20 | formatted = _USER_AGENT_FORMATTER.format(format_string, **values) 21 21 | # clean up after any blank components @@ -50,7 +50,7 @@ RET504.py:246:12: RET504 [*] Unnecessary assignment to `queryset` before `return | = help: Remove unnecessary assignment -ℹ Suggested fix +ℹ Unsafe fix 242 242 | 243 243 | def get_queryset(): 244 244 | queryset = Model.filter(a=1) @@ -70,7 +70,7 @@ RET504.py:251:12: RET504 [*] Unnecessary assignment to `queryset` before `return | = help: Remove unnecessary assignment -ℹ Suggested fix +ℹ Unsafe fix 247 247 | 248 248 | 249 249 | def get_queryset(): @@ -90,7 +90,7 @@ RET504.py:269:12: RET504 [*] Unnecessary assignment to `val` before `return` sta | = help: Remove unnecessary assignment -ℹ Suggested fix +ℹ Unsafe fix 265 265 | def str_to_bool(val): 266 266 | if isinstance(val, bool): 267 267 | return val @@ -110,7 +110,7 @@ RET504.py:321:12: RET504 [*] Unnecessary assignment to `x` before `return` state | = help: Remove unnecessary assignment -ℹ Suggested fix +ℹ Unsafe fix 317 317 | # `with` statements 318 318 | def foo(): 319 319 | with open("foo.txt", "r") as f: @@ -130,7 +130,7 @@ RET504.py:342:12: RET504 [*] Unnecessary assignment to `b` before `return` state | = help: Remove unnecessary assignment -ℹ Suggested fix +ℹ Unsafe fix 338 338 | # Fix cases 339 339 | def foo(): 340 340 | a = 1 @@ -150,7 +150,7 @@ RET504.py:348:12: RET504 [*] Unnecessary assignment to `b` before `return` state | = help: Remove unnecessary assignment -ℹ Suggested fix +ℹ Unsafe fix 344 344 | 345 345 | def foo(): 346 346 | a = 1 @@ -170,7 +170,7 @@ RET504.py:354:12: RET504 [*] Unnecessary assignment to `b` before `return` state | = help: Remove unnecessary assignment -ℹ Suggested fix +ℹ Unsafe fix 350 350 | 351 351 | def foo(): 352 352 | a = 1 @@ -190,7 +190,7 @@ RET504.py:359:12: RET504 [*] Unnecessary assignment to `a` before `return` state | = help: Remove unnecessary assignment -ℹ Suggested fix +ℹ Unsafe fix 355 355 | 356 356 | 357 357 | def foo(): @@ -210,7 +210,7 @@ RET504.py:365:12: RET504 [*] Unnecessary assignment to `D` before `return` state | = help: Remove unnecessary assignment -ℹ Suggested fix +ℹ Unsafe fix 361 361 | 362 362 | # Regression test for: https://github.com/astral-sh/ruff/issues/7098 363 363 | def mavko_debari(P_kbar): 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 11dda2b013..59449d8ae6 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,7 @@ SIM101.py:1:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing | = help: Merge `isinstance` calls for `a` -ℹ Suggested fix +ℹ Unsafe fix 1 |-if isinstance(a, int) or isinstance(a, float): # SIM101 1 |+if isinstance(a, (int, float)): # SIM101 2 2 | pass @@ -26,7 +26,7 @@ SIM101.py:4:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing | = help: Merge `isinstance` calls for `a` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | if isinstance(a, int) or isinstance(a, float): # SIM101 2 2 | pass 3 3 | @@ -46,7 +46,7 @@ SIM101.py:7:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing | = help: Merge `isinstance` calls for `a` -ℹ Suggested fix +ℹ Unsafe fix 4 4 | if isinstance(a, (int, float)) or isinstance(a, bool): # SIM101 5 5 | pass 6 6 | @@ -66,7 +66,7 @@ SIM101.py:10:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -ℹ Suggested fix +ℹ Unsafe fix 7 7 | if isinstance(a, int) or isinstance(a, float) or isinstance(b, bool): # SIM101 8 8 | pass 9 9 | @@ -86,7 +86,7 @@ SIM101.py:16:5: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -ℹ Suggested fix +ℹ Unsafe fix 13 13 | if isinstance(a, int) or isinstance(b, bool) or isinstance(a, float): # SIM101 14 14 | pass 15 15 | @@ -106,7 +106,7 @@ SIM101.py:19:4: SIM101 [*] Multiple `isinstance` calls for expression, merge int | = help: Merge `isinstance` calls -ℹ Suggested fix +ℹ Unsafe fix 16 16 | if (isinstance(a, int) or isinstance(a, float)) and isinstance(b, bool): # SIM101 17 17 | pass 18 18 | @@ -136,7 +136,7 @@ SIM101.py:38:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -ℹ Suggested fix +ℹ Unsafe fix 35 35 | if isinstance(a, int) or unrelated_condition or isinstance(a, float): 36 36 | pass 37 37 | @@ -156,7 +156,7 @@ SIM101.py:41:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin | = help: Merge `isinstance` calls for `a` -ℹ Suggested fix +ℹ Unsafe fix 38 38 | if x or isinstance(a, int) or isinstance(a, float): 39 39 | pass 40 40 | 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 8f373fc0be..480bd0fa4c 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` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | # SIM102 2 |-if a: 3 |- if b: @@ -33,7 +33,7 @@ SIM102.py:7:1: SIM102 [*] Use a single `if` statement instead of nested `if` sta | = help: Combine `if` statements using `and` -ℹ Suggested fix +ℹ Unsafe fix 4 4 | c 5 5 | 6 6 | # SIM102 @@ -60,7 +60,7 @@ SIM102.py:8:5: SIM102 [*] Use a single `if` statement instead of nested `if` sta | = help: Combine `if` statements using `and` -ℹ Suggested fix +ℹ Unsafe fix 5 5 | 6 6 | # SIM102 7 7 | if a: @@ -84,7 +84,7 @@ SIM102.py:15:1: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -ℹ Suggested fix +ℹ Unsafe fix 12 12 | # SIM102 13 13 | if a: 14 14 | pass @@ -119,7 +119,7 @@ SIM102.py:26:1: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -ℹ Suggested fix +ℹ Unsafe fix 23 23 | c 24 24 | 25 25 | # SIM102 @@ -147,7 +147,7 @@ SIM102.py:51:5: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -ℹ Suggested fix +ℹ Unsafe fix 48 48 | 49 49 | while x > 0: 50 50 | # SIM102 @@ -183,7 +183,7 @@ SIM102.py:67:1: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -ℹ Suggested fix +ℹ Unsafe fix 64 64 | 65 65 | 66 66 | # SIM102 @@ -222,7 +222,7 @@ SIM102.py:83:5: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -ℹ Suggested fix +ℹ Unsafe fix 80 80 | 81 81 | while x > 0: 82 82 | # SIM102 @@ -251,7 +251,7 @@ SIM102.py:90:1: SIM102 [*] Use a single `if` statement instead of nested `if` st | = help: Combine `if` statements using `and` -ℹ Suggested fix +ℹ Unsafe fix 87 87 | print("Bad module!") 88 88 | 89 89 | # SIM102 (auto-fixable) @@ -293,7 +293,7 @@ SIM102.py:106:5: SIM102 [*] Use a single `if` statement instead of nested `if` s | = help: Combine `if` statements using `and` -ℹ Suggested fix +ℹ Unsafe fix 103 103 | # SIM102 104 104 | # Regression test for https://github.com/apache/airflow/blob/145b16caaa43f0c42bffd97344df916c602cddde/airflow/configuration.py#L1161 105 105 | if a: @@ -319,7 +319,7 @@ SIM102.py:132:5: SIM102 [*] Use a single `if` statement instead of nested `if` s | = help: Combine `if` statements using `and` -ℹ Suggested fix +ℹ Unsafe fix 129 129 | # OK 130 130 | if a: 131 131 | # SIM 102 @@ -344,7 +344,7 @@ SIM102.py:165:5: SIM102 [*] Use a single `if` statement instead of nested `if` s | = help: Combine `if` statements using `and` -ℹ Suggested fix +ℹ Unsafe 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 b6eb3af562..929549a3e3 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 `a` directly | = help: Replace with `return a` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | def f(): 2 2 | # SIM103 3 |- if a: @@ -39,7 +39,7 @@ SIM103.py:11:5: SIM103 [*] Return the condition `a == b` directly | = help: Replace with `return a == b` -ℹ Suggested fix +ℹ Unsafe fix 8 8 | 9 9 | def f(): 10 10 | # SIM103 @@ -65,7 +65,7 @@ SIM103.py:21:5: SIM103 [*] Return the condition `b` directly | = help: Replace with `return b` -ℹ Suggested fix +ℹ Unsafe fix 18 18 | # SIM103 19 19 | if a: 20 20 | return 1 @@ -91,7 +91,7 @@ SIM103.py:32:9: SIM103 [*] Return the condition `b` directly | = help: Replace with `return b` -ℹ Suggested fix +ℹ Unsafe fix 29 29 | if a: 30 30 | return 1 31 31 | else: 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 747d835818..dfd257b8a0 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)` -ℹ Suggested fix +ℹ Unsafe fix 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -41,7 +41,7 @@ SIM105_0.py:13:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` inst | = help: Replace with `contextlib.suppress(ValueError, OSError)` -ℹ Suggested fix +ℹ Unsafe fix 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -72,7 +72,7 @@ SIM105_0.py:19:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` inst | = help: Replace with `contextlib.suppress(ValueError, OSError)` -ℹ Suggested fix +ℹ Unsafe fix 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -103,7 +103,7 @@ SIM105_0.py:25:1: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `tr | = help: Replace with `contextlib.suppress(Exception)` -ℹ Suggested fix +ℹ Unsafe fix 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -134,7 +134,7 @@ 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 +ℹ Unsafe fix 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -165,7 +165,7 @@ SIM105_0.py:85:5: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `t | = help: Replace with `contextlib.suppress(ValueError)` -ℹ Suggested fix +ℹ Unsafe fix 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -212,7 +212,7 @@ SIM105_0.py:117:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try | = help: Replace with `contextlib.suppress(OSError)` -ℹ Suggested fix +ℹ Unsafe fix 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -244,7 +244,7 @@ SIM105_0.py:122:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try | = help: Replace with `contextlib.suppress(OSError)` -ℹ Suggested fix +ℹ Unsafe fix 1 |+import contextlib 1 2 | def foo(): 2 3 | pass @@ -275,7 +275,7 @@ SIM105_0.py:126:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try | = help: Replace with `contextlib.suppress(OSError)` -ℹ Suggested fix +ℹ Unsafe 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 e7eba1d76e..65f4991e17 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)` -ℹ Suggested fix +ℹ Unsafe 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 adf563480a..1963b91bc8 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)` -ℹ Suggested fix +ℹ Unsafe 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 8f221aa111..1389a2ce4f 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)` -ℹ Suggested fix +ℹ Unsafe 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 c4aad0339a..71cede1631 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` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | # SIM108 2 |-if a: 3 |- b = c @@ -38,7 +38,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` -ℹ Suggested fix +ℹ Unsafe fix 27 27 | if True: 28 28 | pass 29 29 | else: @@ -75,7 +75,7 @@ SIM108.py:82:1: SIM108 [*] Use ternary operator `b = "cccccccccccccccccccccccccc | = help: Replace `if`-`else`-block with `b = "cccccccccccccccccccccccccccccccccß" if a else "ddddddddddddddddddddddddddddddddd💣"` -ℹ Suggested fix +ℹ Unsafe 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 fd8700afba..760f432942 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)` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | # SIM109 2 |-if a == b or a == c: 2 |+if a in (b, c): @@ -27,7 +27,7 @@ SIM109.py:6:5: SIM109 [*] Use `a in (b, c)` instead of multiple equality compari | = help: Replace with `a in (b, c)` -ℹ Suggested fix +ℹ Unsafe fix 3 3 | d 4 4 | 5 5 | # SIM109 @@ -46,7 +46,7 @@ SIM109.py:10:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compar | = help: Replace with `a in (b, c)` -ℹ Suggested fix +ℹ Unsafe fix 7 7 | d 8 8 | 9 9 | # SIM109 @@ -65,7 +65,7 @@ SIM109.py:14:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compar | = help: Replace with `a in (b, c)` -ℹ Suggested fix +ℹ Unsafe 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 6ddf17ea90..f23d900036 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)` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | def f(): 2 2 | # SIM110 3 |- for x in iterable: @@ -39,7 +39,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)` -ℹ Suggested fix +ℹ Unsafe fix 22 22 | 23 23 | def f(): 24 24 | # SIM111 @@ -65,7 +65,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)` -ℹ Suggested fix +ℹ Unsafe fix 30 30 | 31 31 | def f(): 32 32 | # SIM111 @@ -92,7 +92,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)` -ℹ Suggested fix +ℹ Unsafe fix 52 52 | 53 53 | def f(): 54 54 | # SIM110 @@ -120,7 +120,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)` -ℹ Suggested fix +ℹ Unsafe fix 61 61 | 62 62 | def f(): 63 63 | # SIM111 @@ -149,7 +149,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)` -ℹ Suggested fix +ℹ Unsafe fix 70 70 | 71 71 | def f(): 72 72 | # SIM110 @@ -178,7 +178,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)` -ℹ Suggested fix +ℹ Unsafe fix 80 80 | 81 81 | def f(): 82 82 | # SIM111 @@ -230,7 +230,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)` -ℹ Suggested fix +ℹ Unsafe fix 141 141 | x = 1 142 142 | 143 143 | # SIM110 @@ -255,7 +255,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)` -ℹ Suggested fix +ℹ Unsafe fix 151 151 | x = 1 152 152 | 153 153 | # SIM111 @@ -281,7 +281,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ℝ")` -ℹ Suggested fix +ℹ Unsafe fix 159 159 | 160 160 | def f(): 161 161 | # SIM110 @@ -309,7 +309,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)` -ℹ Suggested fix +ℹ Unsafe fix 181 181 | 182 182 | async def f(): 183 183 | # SIM110 @@ -337,7 +337,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)` -ℹ Suggested fix +ℹ Unsafe 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 85c7002246..9b59955fe1 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)` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | def f(): 2 2 | # SIM110 3 |- for x in iterable: @@ -39,7 +39,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)` -ℹ Suggested fix +ℹ Unsafe fix 22 22 | 23 23 | def f(): 24 24 | # SIM111 @@ -65,7 +65,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)` -ℹ Suggested fix +ℹ Unsafe fix 30 30 | 31 31 | def f(): 32 32 | # SIM111 @@ -92,7 +92,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)` -ℹ Suggested fix +ℹ Unsafe fix 52 52 | 53 53 | def f(): 54 54 | # SIM110 @@ -120,7 +120,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)` -ℹ Suggested fix +ℹ Unsafe fix 61 61 | 62 62 | def f(): 63 63 | # SIM111 @@ -149,7 +149,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)` -ℹ Suggested fix +ℹ Unsafe fix 70 70 | 71 71 | def f(): 72 72 | # SIM110 @@ -178,7 +178,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)` -ℹ Suggested fix +ℹ Unsafe fix 80 80 | 81 81 | def f(): 82 82 | # SIM111 @@ -230,7 +230,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)` -ℹ Suggested fix +ℹ Unsafe fix 141 141 | x = 1 142 142 | 143 143 | # SIM110 @@ -255,7 +255,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)` -ℹ Suggested fix +ℹ Unsafe fix 151 151 | x = 1 152 152 | 153 153 | # SIM111 @@ -281,7 +281,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)` -ℹ Suggested fix +ℹ Unsafe fix 159 159 | 160 160 | def f(): 161 161 | # SIM111 @@ -307,7 +307,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)` -ℹ Suggested fix +ℹ Unsafe fix 167 167 | 168 168 | def f(): 169 169 | # SIM111 @@ -333,7 +333,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")` -ℹ Suggested fix +ℹ Unsafe 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 f19564b216..fb82814e61 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` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import os 2 2 | 3 3 | # Bad @@ -76,7 +76,7 @@ SIM112.py:14:18: SIM112 [*] Use capitalized environment variable `FOO` instead o | = help: Replace `foo` with `FOO` -ℹ Suggested fix +ℹ Unsafe fix 11 11 | 12 12 | env = os.environ.get('foo') 13 13 | @@ -106,7 +106,7 @@ SIM112.py:19:22: SIM112 [*] Use capitalized environment variable `FOO` instead o | = help: Replace `foo` with `FOO` -ℹ Suggested fix +ℹ Unsafe 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__SIM117_SIM117.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap index bbc83f3ed4..5b71ad0883 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 -ℹ Suggested fix +ℹ Unsafe fix 1 1 | # SIM117 2 |-with A() as a: 3 |- with B() as b: @@ -33,7 +33,7 @@ SIM117.py:7:1: SIM117 [*] Use a single `with` statement with multiple contexts i | = help: Combine `with` statements -ℹ Suggested fix +ℹ Unsafe fix 4 4 | print("hello") 5 5 | 6 6 | # SIM117 @@ -70,7 +70,7 @@ SIM117.py:19:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -ℹ Suggested fix +ℹ Unsafe fix 16 16 | print("hello") 17 17 | 18 18 | # SIM117 @@ -95,7 +95,7 @@ SIM117.py:47:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -ℹ Suggested fix +ℹ Unsafe fix 44 44 | print("hello") 45 45 | 46 46 | # SIM117 @@ -121,7 +121,7 @@ SIM117.py:53:5: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -ℹ Suggested fix +ℹ Unsafe fix 50 50 | 51 51 | while True: 52 52 | # SIM117 @@ -159,7 +159,7 @@ SIM117.py:68:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -ℹ Suggested fix +ℹ Unsafe fix 67 67 | # SIM117 68 68 | with ( 69 69 | A() as a, @@ -186,7 +186,7 @@ SIM117.py:76:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -ℹ Suggested fix +ℹ Unsafe fix 73 73 | print("hello") 74 74 | 75 75 | # SIM117 @@ -221,7 +221,7 @@ SIM117.py:84:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -ℹ Suggested fix +ℹ Unsafe fix 83 83 | # SIM117 84 84 | with ( 85 85 | A() as a, @@ -249,7 +249,7 @@ SIM117.py:95:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -ℹ Suggested fix +ℹ Unsafe fix 92 92 | print("hello") 93 93 | 94 94 | # SIM117 (auto-fixable) @@ -294,7 +294,7 @@ SIM117.py:126:1: SIM117 [*] Use a single `with` statement with multiple contexts | = help: Combine `with` statements -ℹ Suggested fix +ℹ Unsafe fix 123 123 | f(b2, c2, d2) 124 124 | 125 125 | # SIM117 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 98a7b274bc..278730a8ff 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()` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | obj = {} 2 2 | 3 |-key in obj.keys() # SIM118 @@ -32,7 +32,7 @@ SIM118.py:5:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe fix 2 2 | 3 3 | key in obj.keys() # SIM118 4 4 | @@ -53,7 +53,7 @@ SIM118.py:7:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe fix 4 4 | 5 5 | key not in obj.keys() # SIM118 6 6 | @@ -74,7 +74,7 @@ SIM118.py:9:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe fix 6 6 | 7 7 | foo["bar"] in obj.keys() # SIM118 8 8 | @@ -95,7 +95,7 @@ SIM118.py:11:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe fix 8 8 | 9 9 | foo["bar"] not in obj.keys() # SIM118 10 10 | @@ -116,7 +116,7 @@ SIM118.py:13:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.key | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe fix 10 10 | 11 11 | foo['bar'] in obj.keys() # SIM118 12 12 | @@ -137,7 +137,7 @@ SIM118.py:15:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe fix 12 12 | 13 13 | foo['bar'] not in obj.keys() # SIM118 14 14 | @@ -158,7 +158,7 @@ SIM118.py:17:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.key | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe fix 14 14 | 15 15 | foo() in obj.keys() # SIM118 16 16 | @@ -178,7 +178,7 @@ SIM118.py:19:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe fix 16 16 | 17 17 | foo() not in obj.keys() # SIM118 18 18 | @@ -199,7 +199,7 @@ SIM118.py:26:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe fix 23 23 | if some_property(key): 24 24 | del obj[key] 25 25 | @@ -220,7 +220,7 @@ SIM118.py:28:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe fix 25 25 | 26 26 | [k for k in obj.keys()] # SIM118 27 27 | @@ -241,7 +241,7 @@ SIM118.py:30:11: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe fix 27 27 | 28 28 | {k for k in obj.keys()} # SIM118 29 29 | @@ -262,7 +262,7 @@ SIM118.py:32:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe fix 29 29 | 30 30 | {k: k for k in obj.keys()} # SIM118 31 31 | @@ -283,7 +283,7 @@ SIM118.py:34:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe fix 31 31 | 32 32 | (k for k in obj.keys()) # SIM118 33 33 | @@ -304,7 +304,7 @@ SIM118.py:36:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe fix 33 33 | 34 34 | key in (obj or {}).keys() # SIM118 35 35 | @@ -324,7 +324,7 @@ SIM118.py:50:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe fix 47 47 | 48 48 | 49 49 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124 @@ -344,7 +344,7 @@ SIM118.py:51:2: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe fix 48 48 | 49 49 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124 50 50 | key in obj.keys()and foo @@ -365,7 +365,7 @@ SIM118.py:52:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe 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 @@ -389,7 +389,7 @@ SIM118.py:55:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | = help: Remove `.keys()` -ℹ Suggested fix +ℹ Unsafe fix 55 55 | for key in ( 56 56 | self.experiment.surveys[0] 57 57 | .stations[0] 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 52aeeffe4d..7bc978ae96 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 -ℹ Fix +ℹ Safe fix 1 1 | # SIM201 2 |-if not a == b: 2 |+if a != b: @@ -27,7 +27,7 @@ SIM201.py:6:4: SIM201 [*] Use `a != b + c` instead of `not a == b + c` | = help: Replace with `!=` operator -ℹ Fix +ℹ Safe fix 3 3 | pass 4 4 | 5 5 | # SIM201 @@ -46,7 +46,7 @@ SIM201.py:10:4: SIM201 [*] Use `a + b != c` instead of `not a + b == c` | = help: Replace with `!=` operator -ℹ Fix +ℹ Safe 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 e29314b74b..46e9c368fa 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 -ℹ Fix +ℹ Safe fix 1 1 | # SIM202 2 |-if not a != b: 2 |+if a == b: @@ -27,7 +27,7 @@ SIM202.py:6:4: SIM202 [*] Use `a == b + c` instead of `not a != b + c` | = help: Replace with `==` operator -ℹ Fix +ℹ Safe fix 3 3 | pass 4 4 | 5 5 | # SIM202 @@ -46,7 +46,7 @@ SIM202.py:10:4: SIM202 [*] Use `a + b == c` instead of `not a + b != c` | = help: Replace with `==` operator -ℹ Fix +ℹ Safe 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 481781d5aa..fa96fedd50 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,7 @@ SIM208.py:1:4: SIM208 [*] Use `a` instead of `not (not a)` | = help: Replace with `a` -ℹ Fix +ℹ Safe fix 1 |-if not (not a): # SIM208 1 |+if a: # SIM208 2 2 | pass @@ -26,7 +26,7 @@ SIM208.py:4:4: SIM208 [*] Use `a == b` instead of `not (not a == b)` | = help: Replace with `a == b` -ℹ Fix +ℹ Safe fix 1 1 | if not (not a): # SIM208 2 2 | pass 3 3 | @@ -47,7 +47,7 @@ SIM208.py:16:5: SIM208 [*] Use `b` instead of `not (not b)` | = help: Replace with `b` -ℹ Fix +ℹ Safe fix 13 13 | if not a != b: # OK 14 14 | pass 15 15 | @@ -68,7 +68,7 @@ SIM208.py:18:3: SIM208 [*] Use `a` instead of `not (not a)` | = help: Replace with `a` -ℹ Fix +ℹ Safe fix 15 15 | 16 16 | a = not not b # SIM208 17 17 | @@ -88,7 +88,7 @@ SIM208.py:20:9: SIM208 [*] Use `a` instead of `not (not a)` | = help: Replace with `a` -ℹ Fix +ℹ Safe 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 7f7cfde237..50c7b4ebe9 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,7 @@ SIM210.py:1:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` | = help: Replace with `bool(...) -ℹ Suggested fix +ℹ Unsafe fix 1 |-a = True if b else False # SIM210 1 |+a = bool(b) # SIM210 2 2 | @@ -28,7 +28,7 @@ SIM210.py:3:5: SIM210 [*] Remove unnecessary `True if ... else False` | = help: Remove unnecessary `True if ... else False` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | a = True if b else False # SIM210 2 2 | 3 |-a = True if b != c else False # SIM210 @@ -48,7 +48,7 @@ SIM210.py:5:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` | = help: Replace with `bool(...) -ℹ Suggested fix +ℹ Unsafe fix 2 2 | 3 3 | a = True if b != c else False # SIM210 4 4 | @@ -77,7 +77,7 @@ SIM210.py:19:11: SIM210 [*] Remove unnecessary `True if ... else False` | = help: Remove unnecessary `True if ... else False` -ℹ Suggested fix +ℹ Unsafe 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 359b5384bc..8e3650b7e5 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,7 @@ SIM211.py:1:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | = help: Replace with `not ...` -ℹ Suggested fix +ℹ Unsafe fix 1 |-a = False if b else True # SIM211 1 |+a = not b # SIM211 2 2 | @@ -28,7 +28,7 @@ SIM211.py:3:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | = help: Replace with `not ...` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | a = False if b else True # SIM211 2 2 | 3 |-a = False if b != c else True # SIM211 @@ -48,7 +48,7 @@ SIM211.py:5:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | = help: Replace with `not ...` -ℹ Suggested fix +ℹ Unsafe 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 956cc50036..35b8bc12a5 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,7 @@ 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 +ℹ Unsafe fix 1 |-c = b if not a else a # SIM212 1 |+c = a if a else b # SIM212 2 2 | @@ -28,7 +28,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` -ℹ Suggested fix +ℹ Unsafe 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 bf50be1050..b0c23c954c 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,7 @@ SIM220.py:1:4: SIM220 [*] Use `False` instead of `a and not a` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 1 |-if a and not a: 1 |+if False: 2 2 | pass @@ -26,7 +26,7 @@ SIM220.py:4:5: SIM220 [*] Use `False` instead of `a and not a` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | if a and not a: 2 2 | pass 3 3 | @@ -46,7 +46,7 @@ SIM220.py:7:5: SIM220 [*] Use `False` instead of `a and not a` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe 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 cb3d53dfe7..038e5fcf64 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,7 @@ SIM221.py:1:4: SIM221 [*] Use `True` instead of `a or not a` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 1 |-if a or not a: 1 |+if True: 2 2 | pass @@ -26,7 +26,7 @@ SIM221.py:4:5: SIM221 [*] Use `True` instead of `a or not a` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | if a or not a: 2 2 | pass 3 3 | @@ -46,7 +46,7 @@ SIM221.py:7:5: SIM221 [*] Use `True` instead of `a or not a` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe 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 02d93e42fc..585be6c06e 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,7 @@ SIM222.py:1:4: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 1 |-if a or True: # SIM222 1 |+if True: # SIM222 2 2 | pass @@ -26,7 +26,7 @@ SIM222.py:4:4: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | if a or True: # SIM222 2 2 | pass 3 3 | @@ -46,7 +46,7 @@ SIM222.py:7:10: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 4 4 | if (a or b) or True: # SIM222 5 5 | pass 6 6 | @@ -66,7 +66,7 @@ SIM222.py:24:16: SIM222 [*] Use `True` instead of `True or ...` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 21 21 | if a or f() or b or g() or True: # OK 22 22 | pass 23 23 | @@ -86,7 +86,7 @@ SIM222.py:27:4: SIM222 [*] Use `True` instead of `True or ...` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 24 24 | if a or f() or True or g() or b: # SIM222 25 25 | pass 26 26 | @@ -106,7 +106,7 @@ SIM222.py:30:4: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 27 27 | if True or f() or a or g() or b: # SIM222 28 28 | pass 29 29 | @@ -125,7 +125,7 @@ SIM222.py:47:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 44 44 | pass 45 45 | 46 46 | @@ -146,7 +146,7 @@ SIM222.py:49:6: SIM222 [*] Use `"foo"` instead of `"foo" or ...` | = help: Replace with `"foo"` -ℹ Suggested fix +ℹ Unsafe fix 46 46 | 47 47 | a or "" or True # SIM222 48 48 | @@ -167,7 +167,7 @@ SIM222.py:51:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 48 48 | 49 49 | a or "foo" or True or "bar" # SIM222 50 50 | @@ -188,7 +188,7 @@ SIM222.py:53:6: SIM222 [*] Use `1` instead of `1 or ...` | = help: Replace with `1` -ℹ Suggested fix +ℹ Unsafe fix 50 50 | 51 51 | a or 0 or True # SIM222 52 52 | @@ -209,7 +209,7 @@ SIM222.py:55:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 52 52 | 53 53 | a or 1 or True or 2 # SIM222 54 54 | @@ -230,7 +230,7 @@ SIM222.py:57:6: SIM222 [*] Use `0.1` instead of `0.1 or ...` | = help: Replace with `0.1` -ℹ Suggested fix +ℹ Unsafe fix 54 54 | 55 55 | a or 0.0 or True # SIM222 56 56 | @@ -251,7 +251,7 @@ SIM222.py:59:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 56 56 | 57 57 | a or 0.1 or True or 0.2 # SIM222 58 58 | @@ -272,7 +272,7 @@ SIM222.py:61:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 58 58 | 59 59 | a or [] or True # SIM222 60 60 | @@ -293,7 +293,7 @@ SIM222.py:63:6: SIM222 [*] Use `[1]` instead of `[1] or ...` | = help: Replace with `[1]` -ℹ Suggested fix +ℹ Unsafe fix 60 60 | 61 61 | a or list([]) or True # SIM222 62 62 | @@ -314,7 +314,7 @@ SIM222.py:65:6: SIM222 [*] Use `list([1])` instead of `list([1]) or ...` | = help: Replace with `list([1])` -ℹ Suggested fix +ℹ Unsafe fix 62 62 | 63 63 | a or [1] or True or [2] # SIM222 64 64 | @@ -335,7 +335,7 @@ SIM222.py:67:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 64 64 | 65 65 | a or list([1]) or True or list([2]) # SIM222 66 66 | @@ -356,7 +356,7 @@ SIM222.py:69:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 66 66 | 67 67 | a or {} or True # SIM222 68 68 | @@ -377,7 +377,7 @@ SIM222.py:71:6: SIM222 [*] Use `{1: 1}` instead of `{1: 1} or ...` | = help: Replace with `{1: 1}` -ℹ Suggested fix +ℹ Unsafe fix 68 68 | 69 69 | a or dict() or True # SIM222 70 70 | @@ -398,7 +398,7 @@ SIM222.py:73:6: SIM222 [*] Use `dict({1: 1})` instead of `dict({1: 1}) or ...` | = help: Replace with `dict({1: 1})` -ℹ Suggested fix +ℹ Unsafe fix 70 70 | 71 71 | a or {1: 1} or True or {2: 2} # SIM222 72 72 | @@ -419,7 +419,7 @@ SIM222.py:75:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 72 72 | 73 73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222 74 74 | @@ -440,7 +440,7 @@ SIM222.py:77:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 74 74 | 75 75 | a or set() or True # SIM222 76 76 | @@ -461,7 +461,7 @@ SIM222.py:79:6: SIM222 [*] Use `{1}` instead of `{1} or ...` | = help: Replace with `{1}` -ℹ Suggested fix +ℹ Unsafe fix 76 76 | 77 77 | a or set(set()) or True # SIM222 78 78 | @@ -482,7 +482,7 @@ SIM222.py:81:6: SIM222 [*] Use `set({1})` instead of `set({1}) or ...` | = help: Replace with `set({1})` -ℹ Suggested fix +ℹ Unsafe fix 78 78 | 79 79 | a or {1} or True or {2} # SIM222 80 80 | @@ -503,7 +503,7 @@ SIM222.py:83:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 80 80 | 81 81 | a or set({1}) or True or set({2}) # SIM222 82 82 | @@ -524,7 +524,7 @@ SIM222.py:85:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 82 82 | 83 83 | a or () or True # SIM222 84 84 | @@ -545,7 +545,7 @@ SIM222.py:87:6: SIM222 [*] Use `(1,)` instead of `(1,) or ...` | = help: Replace with `(1,)` -ℹ Suggested fix +ℹ Unsafe fix 84 84 | 85 85 | a or tuple(()) or True # SIM222 86 86 | @@ -566,7 +566,7 @@ SIM222.py:89:6: SIM222 [*] Use `tuple((1,))` instead of `tuple((1,)) or ...` | = help: Replace with `tuple((1,))` -ℹ Suggested fix +ℹ Unsafe fix 86 86 | 87 87 | a or (1,) or True or (2,) # SIM222 88 88 | @@ -587,7 +587,7 @@ SIM222.py:91:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 88 88 | 89 89 | a or tuple((1,)) or True or tuple((2,)) # SIM222 90 90 | @@ -608,7 +608,7 @@ SIM222.py:93:6: SIM222 [*] Use `True` instead of `... or True` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 90 90 | 91 91 | a or frozenset() or True # SIM222 92 92 | @@ -629,7 +629,7 @@ SIM222.py:95:6: SIM222 [*] Use `frozenset({1})` instead of `frozenset({1}) or .. | = help: Replace with `frozenset({1})` -ℹ Suggested fix +ℹ Unsafe fix 92 92 | 93 93 | a or frozenset(frozenset()) or True # SIM222 94 94 | @@ -648,7 +648,7 @@ SIM222.py:97:6: SIM222 [*] Use `frozenset(frozenset({1}))` instead of `frozenset | = help: Replace with `frozenset(frozenset({1}))` -ℹ Suggested fix +ℹ Unsafe fix 94 94 | 95 95 | a or frozenset({1}) or True or frozenset({2}) # SIM222 96 96 | @@ -669,7 +669,7 @@ SIM222.py:102:6: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 99 99 | 100 100 | # Inside test `a` is simplified. 101 101 | @@ -690,7 +690,7 @@ SIM222.py:104:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 101 101 | 102 102 | bool(a or [1] or True or [2]) # SIM222 103 103 | @@ -710,7 +710,7 @@ SIM222.py:106:5: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 103 103 | 104 104 | assert a or [1] or True or [2] # SIM222 105 105 | @@ -730,7 +730,7 @@ SIM222.py:106:35: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 103 103 | 104 104 | assert a or [1] or True or [2] # SIM222 105 105 | @@ -751,7 +751,7 @@ SIM222.py:109:6: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe 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 | @@ -771,7 +771,7 @@ SIM222.py:111:7: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 108 108 | 109 109 | 0 if a or [1] or True or [2] else 1 # SIM222 110 110 | @@ -792,7 +792,7 @@ SIM222.py:118:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 115 115 | 0 116 116 | for a in range(10) 117 117 | for b in range(10) @@ -812,7 +812,7 @@ SIM222.py:119:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe 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 @@ -833,7 +833,7 @@ SIM222.py:126:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 123 123 | 0 124 124 | for a in range(10) 125 125 | for b in range(10) @@ -853,7 +853,7 @@ SIM222.py:127:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe 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 @@ -874,7 +874,7 @@ SIM222.py:134:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 131 131 | 0: 0 132 132 | for a in range(10) 133 133 | for b in range(10) @@ -894,7 +894,7 @@ SIM222.py:135:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe 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 @@ -915,7 +915,7 @@ SIM222.py:142:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe fix 139 139 | 0 140 140 | for a in range(10) 141 141 | for b in range(10) @@ -935,7 +935,7 @@ SIM222.py:143:8: SIM222 [*] Use `True` instead of `... or True or ...` | = help: Replace with `True` -ℹ Suggested fix +ℹ Unsafe 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 @@ -956,7 +956,7 @@ SIM222.py:148:6: SIM222 [*] Use `[1]` instead of `[1] or ...` | = help: Replace with `[1]` -ℹ Suggested fix +ℹ Unsafe fix 145 145 | 146 146 | # Outside test `a` is not simplified. 147 147 | @@ -976,7 +976,7 @@ SIM222.py:150:10: SIM222 [*] Use `[1]` instead of `[1] or ...` | = help: Replace with `[1]` -ℹ Suggested fix +ℹ Unsafe fix 147 147 | 148 148 | a or [1] or True or [2] # SIM222 149 149 | @@ -996,7 +996,7 @@ SIM222.py:153:11: SIM222 [*] Use `[1]` instead of `[1] or ...` | = help: Replace with `[1]` -ℹ Suggested fix +ℹ Unsafe fix 150 150 | if (a or [1] or True or [2]) == (a or [1]): # SIM222 151 151 | pass 152 152 | @@ -1015,7 +1015,7 @@ SIM222.py:157:30: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) o | = help: Replace with `(int, int, int)` -ℹ Suggested fix +ℹ Unsafe fix 154 154 | pass 155 155 | 156 156 | # Regression test for: https://github.com/astral-sh/ruff/issues/7099 @@ -1033,7 +1033,7 @@ SIM222.py:161:31: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) o | = help: Replace with `(int, int, int)` -ℹ Suggested fix +ℹ Unsafe fix 158 158 | m, s = divmod(s0, 60) 159 159 | 160 160 | 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 4454bf4851..d1d2fae78d 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,7 @@ SIM223.py:1:4: SIM223 [*] Use `False` instead of `... and False` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 1 |-if a and False: # SIM223 1 |+if False: # SIM223 2 2 | pass @@ -26,7 +26,7 @@ SIM223.py:4:4: SIM223 [*] Use `False` instead of `... and False` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | if a and False: # SIM223 2 2 | pass 3 3 | @@ -46,7 +46,7 @@ SIM223.py:7:10: SIM223 [*] Use `False` instead of `... and False` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 4 4 | if (a or b) and False: # SIM223 5 5 | pass 6 6 | @@ -66,7 +66,7 @@ SIM223.py:19:18: SIM223 [*] Use `False` instead of `False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 16 16 | if a and f() and b and g() and False: # OK 17 17 | pass 18 18 | @@ -86,7 +86,7 @@ SIM223.py:22:4: SIM223 [*] Use `False` instead of `False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 19 19 | if a and f() and False and g() and b: # SIM223 20 20 | pass 21 21 | @@ -106,7 +106,7 @@ SIM223.py:25:4: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 22 22 | if False and f() and a and g() and b: # SIM223 23 23 | pass 24 24 | @@ -125,7 +125,7 @@ SIM223.py:42:7: SIM223 [*] Use `""` instead of `"" and ...` | = help: Replace with `""` -ℹ Suggested fix +ℹ Unsafe fix 39 39 | pass 40 40 | 41 41 | @@ -146,7 +146,7 @@ SIM223.py:44:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 41 41 | 42 42 | a and "" and False # SIM223 43 43 | @@ -167,7 +167,7 @@ SIM223.py:46:7: SIM223 [*] Use `0` instead of `0 and ...` | = help: Replace with `0` -ℹ Suggested fix +ℹ Unsafe fix 43 43 | 44 44 | a and "foo" and False and "bar" # SIM223 45 45 | @@ -188,7 +188,7 @@ SIM223.py:48:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 45 45 | 46 46 | a and 0 and False # SIM223 47 47 | @@ -209,7 +209,7 @@ SIM223.py:50:7: SIM223 [*] Use `0.0` instead of `0.0 and ...` | = help: Replace with `0.0` -ℹ Suggested fix +ℹ Unsafe fix 47 47 | 48 48 | a and 1 and False and 2 # SIM223 49 49 | @@ -230,7 +230,7 @@ SIM223.py:52:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 49 49 | 50 50 | a and 0.0 and False # SIM223 51 51 | @@ -251,7 +251,7 @@ SIM223.py:54:7: SIM223 [*] Use `[]` instead of `[] and ...` | = help: Replace with `[]` -ℹ Suggested fix +ℹ Unsafe fix 51 51 | 52 52 | a and 0.1 and False and 0.2 # SIM223 53 53 | @@ -272,7 +272,7 @@ SIM223.py:56:7: SIM223 [*] Use `list([])` instead of `list([]) and ...` | = help: Replace with `list([])` -ℹ Suggested fix +ℹ Unsafe fix 53 53 | 54 54 | a and [] and False # SIM223 55 55 | @@ -293,7 +293,7 @@ SIM223.py:58:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 55 55 | 56 56 | a and list([]) and False # SIM223 57 57 | @@ -314,7 +314,7 @@ SIM223.py:60:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 57 57 | 58 58 | a and [1] and False and [2] # SIM223 59 59 | @@ -335,7 +335,7 @@ SIM223.py:62:7: SIM223 [*] Use `{}` instead of `{} and ...` | = help: Replace with `{}` -ℹ Suggested fix +ℹ Unsafe fix 59 59 | 60 60 | a and list([1]) and False and list([2]) # SIM223 61 61 | @@ -356,7 +356,7 @@ SIM223.py:64:7: SIM223 [*] Use `dict()` instead of `dict() and ...` | = help: Replace with `dict()` -ℹ Suggested fix +ℹ Unsafe fix 61 61 | 62 62 | a and {} and False # SIM223 63 63 | @@ -377,7 +377,7 @@ SIM223.py:66:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 63 63 | 64 64 | a and dict() and False # SIM223 65 65 | @@ -398,7 +398,7 @@ SIM223.py:68:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 65 65 | 66 66 | a and {1: 1} and False and {2: 2} # SIM223 67 67 | @@ -419,7 +419,7 @@ SIM223.py:70:7: SIM223 [*] Use `set()` instead of `set() and ...` | = help: Replace with `set()` -ℹ Suggested fix +ℹ Unsafe fix 67 67 | 68 68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223 69 69 | @@ -440,7 +440,7 @@ SIM223.py:72:7: SIM223 [*] Use `set(set())` instead of `set(set()) and ...` | = help: Replace with `set(set())` -ℹ Suggested fix +ℹ Unsafe fix 69 69 | 70 70 | a and set() and False # SIM223 71 71 | @@ -461,7 +461,7 @@ SIM223.py:74:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 71 71 | 72 72 | a and set(set()) and False # SIM223 73 73 | @@ -482,7 +482,7 @@ SIM223.py:76:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 73 73 | 74 74 | a and {1} and False and {2} # SIM223 75 75 | @@ -503,7 +503,7 @@ SIM223.py:78:7: SIM223 [*] Use `()` instead of `() and ...` | = help: Replace with `()` -ℹ Suggested fix +ℹ Unsafe fix 75 75 | 76 76 | a and set({1}) and False and set({2}) # SIM223 77 77 | @@ -524,7 +524,7 @@ SIM223.py:80:7: SIM223 [*] Use `tuple(())` instead of `tuple(()) and ...` | = help: Replace with `tuple(())` -ℹ Suggested fix +ℹ Unsafe fix 77 77 | 78 78 | a and () and False # SIM222 79 79 | @@ -545,7 +545,7 @@ SIM223.py:82:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 79 79 | 80 80 | a and tuple(()) and False # SIM222 81 81 | @@ -566,7 +566,7 @@ SIM223.py:84:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 81 81 | 82 82 | a and (1,) and False and (2,) # SIM222 83 83 | @@ -587,7 +587,7 @@ SIM223.py:86:7: SIM223 [*] Use `frozenset()` instead of `frozenset() and ...` | = help: Replace with `frozenset()` -ℹ Suggested fix +ℹ Unsafe fix 83 83 | 84 84 | a and tuple((1,)) and False and tuple((2,)) # SIM222 85 85 | @@ -608,7 +608,7 @@ SIM223.py:88:7: SIM223 [*] Use `frozenset(frozenset())` instead of `frozenset(fr | = help: Replace with `frozenset(frozenset())` -ℹ Suggested fix +ℹ Unsafe fix 85 85 | 86 86 | a and frozenset() and False # SIM222 87 87 | @@ -629,7 +629,7 @@ SIM223.py:90:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 87 87 | 88 88 | a and frozenset(frozenset()) and False # SIM222 89 89 | @@ -648,7 +648,7 @@ SIM223.py:92:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 89 89 | 90 90 | a and frozenset({1}) and False and frozenset({2}) # SIM222 91 91 | @@ -669,7 +669,7 @@ SIM223.py:97:6: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 94 94 | 95 95 | # Inside test `a` is simplified. 96 96 | @@ -690,7 +690,7 @@ SIM223.py:99:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 96 96 | 97 97 | bool(a and [] and False and []) # SIM223 98 98 | @@ -710,7 +710,7 @@ SIM223.py:101:5: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 98 98 | 99 99 | assert a and [] and False and [] # SIM223 100 100 | @@ -730,7 +730,7 @@ SIM223.py:101:36: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 98 98 | 99 99 | assert a and [] and False and [] # SIM223 100 100 | @@ -751,7 +751,7 @@ SIM223.py:104:6: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 101 101 | if (a and [] and False and []) or (a and [] and False and []): # SIM223 102 102 | pass 103 103 | @@ -771,7 +771,7 @@ SIM223.py:106:7: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 103 103 | 104 104 | 0 if a and [] and False and [] else 1 # SIM222 105 105 | @@ -792,7 +792,7 @@ SIM223.py:113:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 110 110 | 0 111 111 | for a in range(10) 112 112 | for b in range(10) @@ -812,7 +812,7 @@ SIM223.py:114:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 111 111 | for a in range(10) 112 112 | for b in range(10) 113 113 | if a and [] and False and [] # SIM223 @@ -833,7 +833,7 @@ SIM223.py:121:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 118 118 | 0 119 119 | for a in range(10) 120 120 | for b in range(10) @@ -853,7 +853,7 @@ SIM223.py:122:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 119 119 | for a in range(10) 120 120 | for b in range(10) 121 121 | if a and [] and False and [] # SIM223 @@ -874,7 +874,7 @@ SIM223.py:129:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 126 126 | 0: 0 127 127 | for a in range(10) 128 128 | for b in range(10) @@ -894,7 +894,7 @@ SIM223.py:130:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 127 127 | for a in range(10) 128 128 | for b in range(10) 129 129 | if a and [] and False and [] # SIM223 @@ -915,7 +915,7 @@ SIM223.py:137:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 134 134 | 0 135 135 | for a in range(10) 136 136 | for b in range(10) @@ -935,7 +935,7 @@ SIM223.py:138:8: SIM223 [*] Use `False` instead of `... and False and ...` | = help: Replace with `False` -ℹ Suggested fix +ℹ Unsafe fix 135 135 | for a in range(10) 136 136 | for b in range(10) 137 137 | if a and [] and False and [] # SIM223 @@ -956,7 +956,7 @@ SIM223.py:143:7: SIM223 [*] Use `[]` instead of `[] and ...` | = help: Replace with `[]` -ℹ Suggested fix +ℹ Unsafe fix 140 140 | 141 141 | # Outside test `a` is not simplified. 142 142 | @@ -976,7 +976,7 @@ SIM223.py:145:11: SIM223 [*] Use `[]` instead of `[] and ...` | = help: Replace with `[]` -ℹ Suggested fix +ℹ Unsafe fix 142 142 | 143 143 | a and [] and False and [] # SIM223 144 144 | @@ -996,7 +996,7 @@ SIM223.py:148:12: SIM223 [*] Use `[]` instead of `[] and ...` | = help: Replace with `[]` -ℹ Suggested fix +ℹ Unsafe fix 145 145 | if (a and [] and False and []) == (a and []): # SIM223 146 146 | pass 147 147 | 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 6673d7a6a1..036cabca9d 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 conditions are discouraged, use `compare == "yoda | = help: Replace Yoda condition with `compare == "yoda"` -ℹ Fix +ℹ Safe fix 1 1 | # Errors 2 |-"yoda" == compare # SIM300 2 |+compare == "yoda" # SIM300 @@ -30,7 +30,7 @@ SIM300.py:3:1: SIM300 [*] Yoda conditions are discouraged, use `compare == "yoda | = help: Replace Yoda condition with `compare == "yoda"` -ℹ Fix +ℹ Safe fix 1 1 | # Errors 2 2 | "yoda" == compare # SIM300 3 |-"yoda" == compare # SIM300 @@ -50,7 +50,7 @@ SIM300.py:4:1: SIM300 [*] Yoda conditions are discouraged, use `age == 42` inste | = help: Replace Yoda condition with `age == 42` -ℹ Fix +ℹ Safe fix 1 1 | # Errors 2 2 | "yoda" == compare # SIM300 3 3 | "yoda" == compare # SIM300 @@ -71,7 +71,7 @@ SIM300.py:5:1: SIM300 [*] Yoda conditions are discouraged, use `compare == ("a", | = help: Replace Yoda condition with `compare == ("a", "b")` -ℹ Fix +ℹ Safe fix 2 2 | "yoda" == compare # SIM300 3 3 | "yoda" == compare # SIM300 4 4 | 42 == age # SIM300 @@ -92,7 +92,7 @@ SIM300.py:6:1: SIM300 [*] Yoda conditions are discouraged, use `compare >= "yoda | = help: Replace Yoda condition with `compare >= "yoda"` -ℹ Fix +ℹ Safe fix 3 3 | "yoda" == compare # SIM300 4 4 | 42 == age # SIM300 5 5 | ("a", "b") == compare # SIM300 @@ -113,7 +113,7 @@ SIM300.py:7:1: SIM300 [*] Yoda conditions are discouraged, use `compare > "yoda" | = help: Replace Yoda condition with `compare > "yoda"` -ℹ Fix +ℹ Safe fix 4 4 | 42 == age # SIM300 5 5 | ("a", "b") == compare # SIM300 6 6 | "yoda" <= compare # SIM300 @@ -134,7 +134,7 @@ SIM300.py:8:1: SIM300 [*] Yoda conditions are discouraged, use `age < 42` instea | = help: Replace Yoda condition with `age < 42` -ℹ Fix +ℹ Safe fix 5 5 | ("a", "b") == compare # SIM300 6 6 | "yoda" <= compare # SIM300 7 7 | "yoda" < compare # SIM300 @@ -155,7 +155,7 @@ SIM300.py:9:1: SIM300 [*] Yoda conditions are discouraged, use `age < -42` inste | = help: Replace Yoda condition with `age < -42` -ℹ Fix +ℹ Safe fix 6 6 | "yoda" <= compare # SIM300 7 7 | "yoda" < compare # SIM300 8 8 | 42 > age # SIM300 @@ -176,7 +176,7 @@ SIM300.py:10:1: SIM300 [*] Yoda conditions are discouraged, use `age < +42` inst | = help: Replace Yoda condition with `age < +42` -ℹ Fix +ℹ Safe fix 7 7 | "yoda" < compare # SIM300 8 8 | 42 > age # SIM300 9 9 | -42 > age # SIM300 @@ -197,7 +197,7 @@ SIM300.py:11:1: SIM300 [*] Yoda conditions are discouraged, use `age == YODA` in | = help: Replace Yoda condition with `age == YODA` -ℹ Fix +ℹ Safe fix 8 8 | 42 > age # SIM300 9 9 | -42 > age # SIM300 10 10 | +42 > age # SIM300 @@ -218,7 +218,7 @@ SIM300.py:12:1: SIM300 [*] Yoda conditions are discouraged, use `age < YODA` ins | = help: Replace Yoda condition with `age < YODA` -ℹ Fix +ℹ Safe fix 9 9 | -42 > age # SIM300 10 10 | +42 > age # SIM300 11 11 | YODA == age # SIM300 @@ -239,7 +239,7 @@ SIM300.py:13:1: SIM300 [*] Yoda conditions are discouraged, use `age <= YODA` in | = help: Replace Yoda condition with `age <= YODA` -ℹ Fix +ℹ Safe fix 10 10 | +42 > age # SIM300 11 11 | YODA == age # SIM300 12 12 | YODA > age # SIM300 @@ -260,7 +260,7 @@ SIM300.py:14:1: SIM300 [*] Yoda conditions are discouraged, use `age == JediOrde | = help: Replace Yoda condition with `age == JediOrder.YODA` -ℹ Fix +ℹ Safe fix 11 11 | YODA == age # SIM300 12 12 | YODA > age # SIM300 13 13 | YODA >= age # SIM300 @@ -281,7 +281,7 @@ SIM300.py:15:1: SIM300 [*] Yoda conditions are discouraged, use `(number - 100) | = help: Replace Yoda condition with `(number - 100) > 0` -ℹ Fix +ℹ Safe fix 12 12 | YODA > age # SIM300 13 13 | YODA >= age # SIM300 14 14 | JediOrder.YODA == age # SIM300 @@ -302,7 +302,7 @@ SIM300.py:16:1: SIM300 [*] Yoda conditions are discouraged | = help: Replace Yoda condition -ℹ Fix +ℹ Safe fix 13 13 | YODA >= age # SIM300 14 14 | JediOrder.YODA == age # SIM300 15 15 | 0 < (number - 100) # SIM300 @@ -322,7 +322,7 @@ SIM300.py:17:1: SIM300 [*] Yoda conditions are discouraged, use `A[0][0] > B` in | = help: Replace Yoda condition with `A[0][0] > B` -ℹ Fix +ℹ Safe fix 14 14 | JediOrder.YODA == age # SIM300 15 15 | 0 < (number - 100) # SIM300 16 16 | SomeClass().settings.SOME_CONSTANT_VALUE > (60 * 60) # SIM300 @@ -343,7 +343,7 @@ SIM300.py:18:5: SIM300 [*] Yoda conditions are discouraged, use `A[0][0] > (B)` | = help: Replace Yoda condition with `A[0][0] > (B)` -ℹ Fix +ℹ Safe fix 15 15 | 0 < (number - 100) # SIM300 16 16 | SomeClass().settings.SOME_CONSTANT_VALUE > (60 * 60) # SIM300 17 17 | B> 10 75 75 | #: E225 E225 @@ -95,7 +95,7 @@ E22.py:78:2: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 75 75 | #: E225 E225 76 76 | i=i+ 1 77 77 | #: E225 E225 @@ -116,7 +116,7 @@ E22.py:80:6: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 77 77 | #: E225 E225 78 78 | i=i +1 79 79 | #: E225 @@ -137,7 +137,7 @@ E22.py:82:6: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 79 79 | #: E225 80 80 | i = 1and 1 81 81 | #: E225 @@ -158,7 +158,7 @@ E22.py:84:2: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 81 81 | #: E225 82 82 | i = 1or 0 83 83 | #: E225 @@ -179,7 +179,7 @@ E22.py:86:2: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 83 83 | #: E225 84 84 | 1is 1 85 85 | #: E225 @@ -200,7 +200,7 @@ E22.py:92:2: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 89 89 | #: E225 90 90 | i = 1@ 2 91 91 | #: E225 E226 @@ -221,7 +221,7 @@ E22.py:94:3: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 91 91 | #: E225 E226 92 92 | i=i+1 93 93 | #: E225 E226 @@ -242,7 +242,7 @@ E22.py:96:2: E225 [*] Missing whitespace around operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe 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 622a32ccd4..881986bcc5 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 -ℹ Fix +ℹ Safe fix 57 57 | #: E225 58 58 | c =-1 59 59 | #: E225 @@ -33,7 +33,7 @@ E22.py:62:11: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 59 59 | #: E225 60 60 | x = x /2 - 1 61 61 | #: E225 @@ -54,7 +54,7 @@ E22.py:64:10: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 61 61 | #: E225 62 62 | c = alpha -4 63 63 | #: E225 @@ -75,7 +75,7 @@ E22.py:66:7: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 63 63 | #: E225 64 64 | c = alpha- 4 65 65 | #: E225 @@ -96,7 +96,7 @@ E22.py:68:13: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 65 65 | #: E225 66 66 | z = x **y 67 67 | #: E225 @@ -117,7 +117,7 @@ E22.py:70:12: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 67 67 | #: E225 68 68 | z = (x + 1) **y 69 69 | #: E225 @@ -138,7 +138,7 @@ E22.py:76:4: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 73 73 | #: E225 74 74 | _1kB = _1MB>> 10 75 75 | #: E225 E225 @@ -159,7 +159,7 @@ E22.py:78:5: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 75 75 | #: E225 E225 76 76 | i=i+ 1 77 77 | #: E225 E225 @@ -180,7 +180,7 @@ E22.py:88:7: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 85 85 | #: E225 86 86 | 1in [] 87 87 | #: E225 @@ -201,7 +201,7 @@ E22.py:90:6: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 87 87 | #: E225 88 88 | i = 1 @2 89 89 | #: E225 @@ -222,7 +222,7 @@ E22.py:92:4: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 89 89 | #: E225 90 90 | i = 1@ 2 91 91 | #: E225 E226 @@ -243,7 +243,7 @@ E22.py:94:5: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 91 91 | #: E225 E226 92 92 | i=i+1 93 93 | #: E225 E226 @@ -264,7 +264,7 @@ E22.py:96:5: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 93 93 | #: E225 E226 94 94 | i =i+1 95 95 | #: E225 E226 @@ -285,7 +285,7 @@ E22.py:98:8: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 95 95 | #: E225 E226 96 96 | i= i+1 97 97 | #: E225 E226 @@ -306,7 +306,7 @@ E22.py:98:11: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 95 95 | #: E225 E226 96 96 | i= i+1 97 97 | #: E225 E226 @@ -326,7 +326,7 @@ E22.py:100:7: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 97 97 | #: E225 E226 98 98 | c = (a +b)*(a - b) 99 99 | #: E225 E226 @@ -346,7 +346,7 @@ E22.py:100:11: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 97 97 | #: E225 E226 98 98 | c = (a +b)*(a - b) 99 99 | #: E225 E226 @@ -366,7 +366,7 @@ E22.py:104:6: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 101 101 | #: 102 102 | 103 103 | #: E226 @@ -387,7 +387,7 @@ E22.py:106:7: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 103 103 | #: E226 104 104 | z = 2//30 105 105 | #: E226 E226 @@ -408,7 +408,7 @@ E22.py:106:15: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 103 103 | #: E226 104 104 | z = 2//30 105 105 | #: E226 E226 @@ -429,7 +429,7 @@ E22.py:110:6: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 107 107 | #: E226 108 108 | norman = True+False 109 109 | #: E226 @@ -450,7 +450,7 @@ E22.py:112:6: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 109 109 | #: E226 110 110 | x = x*2 - 1 111 111 | #: E226 @@ -471,7 +471,7 @@ E22.py:114:11: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 111 111 | #: E226 112 112 | x = x/2 - 1 113 113 | #: E226 E226 @@ -492,7 +492,7 @@ E22.py:114:17: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 111 111 | #: E226 112 112 | x = x/2 - 1 113 113 | #: E226 E226 @@ -513,7 +513,7 @@ E22.py:116:12: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 113 113 | #: E226 E226 114 114 | hypot2 = x*x + y*y 115 115 | #: E226 @@ -534,7 +534,7 @@ E22.py:119:14: E226 [*] Missing whitespace around arithmetic operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe 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 f736d1212c..8edf3984b3 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 -ℹ Fix +ℹ Safe fix 69 69 | #: E225 70 70 | z = (x + 1)** y 71 71 | #: E225 @@ -33,7 +33,7 @@ E22.py:74:12: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 71 71 | #: E225 72 72 | _1kB = _1MB >>10 73 73 | #: E225 @@ -54,7 +54,7 @@ E22.py:121:12: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 118 118 | def halves(n): 119 119 | return (i//2 for i in range(n)) 120 120 | #: E227 @@ -75,7 +75,7 @@ E22.py:123:12: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 120 120 | #: E227 121 121 | _1kB = _1MB>>10 122 122 | #: E227 @@ -96,7 +96,7 @@ E22.py:125:6: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 122 122 | #: E227 123 123 | _1MB = _1kB<<10 124 124 | #: E227 @@ -117,7 +117,7 @@ E22.py:127:6: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 124 124 | #: E227 125 125 | a = b|c 126 126 | #: E227 @@ -138,7 +138,7 @@ E22.py:129:6: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 126 126 | #: E227 127 127 | b = c&a 128 128 | #: E227 @@ -159,7 +159,7 @@ E22.py:154:11: E227 [*] Missing whitespace around bitwise or shift operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe 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 8876af22d4..fd9f368f63 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 -ℹ Fix +ℹ Safe fix 128 128 | #: E227 129 129 | c = b^a 130 130 | #: E228 @@ -33,7 +33,7 @@ E22.py:133:10: E228 [*] Missing whitespace around modulo operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 130 130 | #: E228 131 131 | a = b%c 132 132 | #: E228 @@ -53,7 +53,7 @@ E22.py:135:26: E228 [*] Missing whitespace around modulo operator | = help: Add missing whitespace -ℹ Fix +ℹ Safe 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 e8e3663c82..f6c0a3a4ae 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 -ℹ Fix +ℹ Safe fix 1 1 | #: E231 2 |-a = (1,2) 2 |+a = (1, 2) @@ -30,7 +30,7 @@ E23.py:4:5: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 1 1 | #: E231 2 2 | a = (1,2) 3 3 | #: E231 @@ -51,7 +51,7 @@ E23.py:6:10: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 3 3 | #: E231 4 4 | a[b1,:] 5 5 | #: E231 @@ -71,7 +71,7 @@ E23.py:19:10: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 16 16 | 17 17 | def foo() -> None: 18 18 | #: E231 @@ -91,7 +91,7 @@ E23.py:29:20: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 26 26 | #: E231:2:20 27 27 | mdtypes_template = { 28 28 | 'tag_full': [('mdtype', 'u4'), ('byte_count', 'u4')], @@ -111,7 +111,7 @@ E23.py:33:6: E231 [*] Missing whitespace after ',' | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 30 30 | } 31 31 | 32 32 | # E231 @@ -131,7 +131,7 @@ E23.py:47:37: E231 [*] Missing whitespace after ':' | = help: Add missing whitespace -ℹ Fix +ℹ Safe fix 44 44 | snapshot.file_uri[len(f's3://{self.s3_bucket_name}/'):] 45 45 | 46 46 | #: E231 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 3b2b21cbac..bf93c26308 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 -ℹ Fix +ℹ Safe 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__E252_E25.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E252_E25.py.snap index 5d27cb5025..54c1298114 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 -ℹ Fix +ℹ Safe 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 @@ -33,7 +33,7 @@ E25.py:46:15: E252 [*] Missing whitespace around parameter equals | = help: Add missing whitespace -ℹ Fix +ℹ Safe 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 @@ -54,7 +54,7 @@ E25.py:46:26: E252 [*] Missing whitespace around parameter equals | = help: Add missing whitespace -ℹ Fix +ℹ Safe 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 @@ -75,7 +75,7 @@ E25.py:46:36: E252 [*] Missing whitespace around parameter equals | = help: Add missing whitespace -ℹ Fix +ℹ Safe 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 f9a8790387..d9b8a7679c 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 -ℹ Fix +ℹ Safe 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__E273_E27.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E273_E27.py.snap index 672945a191..0923ce5e3f 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:10:9: E273 [*] Tab after keyword | = help: Replace with single space -ℹ Fix +ℹ Safe fix 7 7 | #: E271 8 8 | if 1: 9 9 | #: E273 @@ -33,7 +33,7 @@ E27.py:12:5: E273 [*] Tab after keyword | = help: Replace with single space -ℹ Fix +ℹ Safe fix 9 9 | #: E273 10 10 | True and False 11 11 | #: E273 E274 @@ -54,7 +54,7 @@ E27.py:12:10: E273 [*] Tab after keyword | = help: Replace with single space -ℹ Fix +ℹ Safe fix 9 9 | #: E273 10 10 | True and False 11 11 | #: E273 E274 @@ -75,7 +75,7 @@ E27.py:26:6: E273 [*] Tab after keyword | = help: Replace with single space -ℹ Fix +ℹ Safe fix 23 23 | #: E272 24 24 | this and False 25 25 | #: E273 @@ -96,7 +96,7 @@ E27.py:30:10: E273 [*] Tab after keyword | = help: Replace with single space -ℹ Fix +ℹ Safe fix 27 27 | #: E274 28 28 | a and b 29 29 | #: E273 E274 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 811e4fe703..b9ecc81a52 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:28:2: E274 [*] Tab before keyword | = help: Replace with single space -ℹ Fix +ℹ Safe fix 25 25 | #: E273 26 26 | a and b 27 27 | #: E274 @@ -33,7 +33,7 @@ E27.py:30:5: E274 [*] Tab before keyword | = help: Replace with single space -ℹ Fix +ℹ Safe fix 27 27 | #: E274 28 28 | a and b 29 29 | #: 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 8e4502513a..835d0d645f 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:37:8: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -ℹ Fix +ℹ Safe fix 34 34 | #: E271 35 35 | from w import (e, f) 36 36 | #: E275 @@ -33,7 +33,7 @@ E27.py:39:24: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -ℹ Fix +ℹ Safe fix 36 36 | #: E275 37 37 | from w import(e, f) 38 38 | #: E275 @@ -54,7 +54,7 @@ E27.py:42:28: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -ℹ Fix +ℹ Safe fix 39 39 | from importable.module import(e, f) 40 40 | #: E275 41 41 | try: @@ -75,7 +75,7 @@ E27.py:46:1: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -ℹ Fix +ℹ Safe fix 43 43 | except ImportError: 44 44 | pass 45 45 | #: E275 @@ -96,7 +96,7 @@ E27.py:54:5: E275 [*] Missing whitespace after keyword | = help: Added missing whitespace after keyword -ℹ Fix +ℹ Safe fix 51 51 | matched = {"true": True, "false": False} 52 52 | #: E275:2:11 53 53 | if True: 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 3d3c378dcc..712fd8e14b 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 -ℹ Fix +ℹ Safe 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 @@ -33,7 +33,7 @@ E70.py:12:23: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -ℹ Fix +ℹ Safe fix 9 9 | #: E703:1:13 10 10 | import shlex; 11 11 | #: E702:1:9 E703:1:23 @@ -54,7 +54,7 @@ E70.py:25:14: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -ℹ Fix +ℹ Safe 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 @@ -75,7 +75,7 @@ E70.py:68:1: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -ℹ Fix +ℹ Safe fix 64 64 | while 1: 65 65 | 1;... 66 66 | #: E703:2:1 @@ -97,7 +97,7 @@ E70.py:71:4: E703 [*] Statement ends with an unnecessary semicolon | = help: Remove unnecessary semicolon -ℹ Fix +ℹ Safe 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__E711_E711.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap index 0929543ee6..ebb91bb228 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` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | #: E711 2 |-if res == None: 2 |+if res is None: @@ -30,7 +30,7 @@ E711.py:5:11: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -ℹ Suggested fix +ℹ Unsafe fix 2 2 | if res == None: 3 3 | pass 4 4 | #: E711 @@ -51,7 +51,7 @@ E711.py:8:4: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -ℹ Suggested fix +ℹ Unsafe fix 5 5 | if res != None: 6 6 | pass 7 7 | #: E711 @@ -72,7 +72,7 @@ E711.py:11:4: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -ℹ Suggested fix +ℹ Unsafe fix 8 8 | if None == res: 9 9 | pass 10 10 | #: E711 @@ -93,7 +93,7 @@ E711.py:14:14: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -ℹ Suggested fix +ℹ Unsafe fix 11 11 | if None != res: 12 12 | pass 13 13 | #: E711 @@ -114,7 +114,7 @@ E711.py:17:14: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -ℹ Suggested fix +ℹ Unsafe fix 14 14 | if res[1] == None: 15 15 | pass 16 16 | #: E711 @@ -135,7 +135,7 @@ E711.py:20:4: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -ℹ Suggested fix +ℹ Unsafe fix 17 17 | if res[1] != None: 18 18 | pass 19 19 | #: E711 @@ -155,7 +155,7 @@ E711.py:23:4: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -ℹ Suggested fix +ℹ Unsafe fix 20 20 | if None != res[1]: 21 21 | pass 22 22 | #: E711 @@ -175,7 +175,7 @@ E711.py:26:9: E711 [*] Comparison to `None` should be `cond is None` | = help: Replace with `cond is None` -ℹ Suggested fix +ℹ Unsafe fix 23 23 | if None == res[1]: 24 24 | pass 25 25 | @@ -195,7 +195,7 @@ E711.py:26:17: E711 [*] Comparison to `None` should be `cond is not None` | = help: Replace with `cond is not None` -ℹ Suggested fix +ℹ Unsafe 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 6f4b23c2de..ba9a0861ce 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:11: E712 [*] Comparison to `True` should be `cond is True` or `if cond | = help: Replace with `cond is True` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | #: E712 2 |-if res == True: 2 |+if res is True: @@ -30,7 +30,7 @@ E712.py:5:11: E712 [*] Comparison to `False` should be `cond is not False` or `i | = help: Replace with `cond is not False` -ℹ Suggested fix +ℹ Unsafe fix 2 2 | if res == True: 3 3 | pass 4 4 | #: E712 @@ -51,7 +51,7 @@ E712.py:8:4: E712 [*] Comparison to `True` should be `cond is not True` or `if n | = help: Replace with `cond is not True` -ℹ Suggested fix +ℹ Unsafe fix 5 5 | if res != False: 6 6 | pass 7 7 | #: E712 @@ -72,7 +72,7 @@ E712.py:11:4: E712 [*] Comparison to `False` should be `cond is False` or `if no | = help: Replace with `cond is False` -ℹ Suggested fix +ℹ Unsafe fix 8 8 | if True != res: 9 9 | pass 10 10 | #: E712 @@ -93,7 +93,7 @@ E712.py:14:14: E712 [*] Comparison to `True` should be `cond is True` or `if con | = help: Replace with `cond is True` -ℹ Suggested fix +ℹ Unsafe fix 11 11 | if False == res: 12 12 | pass 13 13 | #: E712 @@ -114,7 +114,7 @@ E712.py:17:14: E712 [*] Comparison to `False` should be `cond is not False` or ` | = help: Replace with `cond is not False` -ℹ Suggested fix +ℹ Unsafe fix 14 14 | if res[1] == True: 15 15 | pass 16 16 | #: E712 @@ -135,7 +135,7 @@ E712.py:20:20: E712 [*] Comparison to `True` should be `cond is True` or `if con | = help: Replace with `cond is True` -ℹ Suggested fix +ℹ Unsafe fix 17 17 | if res[1] != False: 18 18 | pass 19 19 | #: E712 @@ -156,7 +156,7 @@ E712.py:20:44: E712 [*] Comparison to `False` should be `cond is False` or `if n | = help: Replace with `cond is False` -ℹ Suggested fix +ℹ Unsafe fix 17 17 | if res[1] != False: 18 18 | pass 19 19 | #: E712 @@ -176,7 +176,7 @@ E712.py:22:5: E712 [*] Comparison to `True` should be `cond is True` or `if cond | = help: Replace with `cond is True` -ℹ Suggested fix +ℹ Unsafe fix 19 19 | #: E712 20 20 | var = 1 if cond == True else -1 if cond == False else cond 21 21 | #: E712 @@ -196,7 +196,7 @@ E712.py:25:11: E712 [*] Comparison to `True` should be `cond is True` or `if con | = help: Replace with `cond is True` -ℹ Suggested fix +ℹ Unsafe fix 22 22 | if (True) == TrueElement or x == TrueElement: 23 23 | pass 24 24 | @@ -216,7 +216,7 @@ E712.py:25:19: E712 [*] Comparison to `False` should be `cond is not False` or ` | = help: Replace with `cond is not False` -ℹ Suggested fix +ℹ Unsafe fix 22 22 | if (True) == TrueElement or x == TrueElement: 23 23 | pass 24 24 | @@ -236,7 +236,7 @@ E712.py:28:4: E712 [*] Comparison to `True` should be `cond is True` or `if cond | = help: Replace with `cond is True` -ℹ Suggested fix +ℹ Unsafe fix 25 25 | if res == True != False: 26 26 | pass 27 27 | @@ -256,7 +256,7 @@ E712.py:31:17: E712 [*] Comparison to `True` should be `cond is True` or `if con | = help: Replace with `cond is True` -ℹ Suggested fix +ℹ Unsafe 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 b1055ba21e..44f8669d0f 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` -ℹ Fix +ℹ Safe fix 1 1 | #: E713 2 |-if not X in Y: 2 |+if X not in Y: @@ -30,7 +30,7 @@ E713.py:5:8: E713 [*] Test for membership should be `not in` | = help: Convert to `not in` -ℹ Fix +ℹ Safe fix 2 2 | if not X in Y: 3 3 | pass 4 4 | #: E713 @@ -51,7 +51,7 @@ E713.py:8:8: E713 [*] Test for membership should be `not in` | = help: Convert to `not in` -ℹ Fix +ℹ Safe fix 5 5 | if not X.B in Y: 6 6 | pass 7 7 | #: E713 @@ -72,7 +72,7 @@ E713.py:11:23: E713 [*] Test for membership should be `not in` | = help: Convert to `not in` -ℹ Fix +ℹ Safe fix 8 8 | if not X in Y and Z == "zero": 9 9 | pass 10 10 | #: E713 @@ -92,7 +92,7 @@ E713.py:14:9: E713 [*] Test for membership should be `not in` | = help: Convert to `not in` -ℹ Fix +ℹ Safe fix 11 11 | if X == "zero" or not Y in Z: 12 12 | pass 13 13 | #: E713 @@ -111,7 +111,7 @@ E713.py:40:12: E713 [*] Test for membership should be `not in` | = help: Convert to `not in` -ℹ Fix +ℹ Safe 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 7195ac921c..fb009a7585 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` -ℹ Fix +ℹ Safe fix 1 1 | #: E714 2 |-if not X is Y: 2 |+if X is not Y: @@ -29,7 +29,7 @@ E714.py:5:8: E714 [*] Test for object identity should be `is not` | = help: Convert to `is not` -ℹ Fix +ℹ Safe fix 2 2 | if not X is Y: 3 3 | pass 4 4 | #: E714 @@ -48,7 +48,7 @@ E714.py:39:13: E714 [*] Test for object identity should be `is not` | = help: Convert to `is not` -ℹ Fix +ℹ Safe 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 b8456517e9..9711dbafcd 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` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | def scope(): 2 2 | # E731 3 |- f = lambda x: 2 * x @@ -29,7 +29,7 @@ E731.py:8:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Suggested fix +ℹ Unsafe fix 5 5 | 6 6 | def scope(): 7 7 | # E731 @@ -49,7 +49,7 @@ E731.py:14:9: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `this` as a `def` -ℹ Suggested fix +ℹ Unsafe fix 11 11 | def scope(): 12 12 | # E731 13 13 | while False: @@ -69,7 +69,7 @@ E731.py:19:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Suggested fix +ℹ Unsafe fix 16 16 | 17 17 | def scope(): 18 18 | # E731 @@ -89,7 +89,7 @@ E731.py:24:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Suggested fix +ℹ Unsafe fix 21 21 | 22 22 | def scope(): 23 23 | # E731 @@ -109,7 +109,7 @@ E731.py:57:5: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Possible fix +ℹ Display-only fix 54 54 | 55 55 | class Scope: 56 56 | # E731 @@ -128,7 +128,7 @@ E731.py:64:5: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Possible fix +ℹ Display-only fix 61 61 | from typing import Callable 62 62 | 63 63 | # E731 @@ -150,7 +150,7 @@ E731.py:73:9: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `x` as a `def` -ℹ Possible fix +ℹ Display-only fix 70 70 | 71 71 | x: Callable[[int], int] 72 72 | if True: @@ -171,7 +171,7 @@ E731.py:75:9: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `x` as a `def` -ℹ Possible fix +ℹ Display-only fix 72 72 | if True: 73 73 | x = lambda: 1 74 74 | else: @@ -191,7 +191,7 @@ E731.py:86:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Suggested fix +ℹ Unsafe fix 83 83 | 84 84 | # ParamSpec cannot be used in this context, so do not preserve the annotation. 85 85 | P = ParamSpec("P") @@ -211,7 +211,7 @@ E731.py:94:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Suggested fix +ℹ Unsafe fix 91 91 | 92 92 | from typing import Callable 93 93 | @@ -231,7 +231,7 @@ E731.py:102:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Suggested fix +ℹ Unsafe fix 99 99 | 100 100 | from typing import Callable 101 101 | @@ -251,7 +251,7 @@ E731.py:110:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Suggested fix +ℹ Unsafe fix 107 107 | 108 108 | from typing import Callable 109 109 | @@ -271,7 +271,7 @@ E731.py:119:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Suggested fix +ℹ Unsafe fix 116 116 | 117 117 | from collections.abc import Callable 118 118 | @@ -291,7 +291,7 @@ E731.py:127:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Suggested fix +ℹ Unsafe fix 124 124 | 125 125 | from collections.abc import Callable 126 126 | @@ -311,7 +311,7 @@ E731.py:135:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Suggested fix +ℹ Unsafe fix 132 132 | 133 133 | from collections.abc import Callable 134 134 | @@ -331,7 +331,7 @@ E731.py:139:5: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `CELSIUS` as a `def` -ℹ Possible fix +ℹ Display-only fix 136 136 | 137 137 | 138 138 | class TemperatureScales(Enum): @@ -351,7 +351,7 @@ E731.py:140:5: E731 Do not assign a `lambda` expression, use a `def` | = help: Rewrite `FAHRENHEIT` as a `def` -ℹ Possible fix +ℹ Display-only fix 137 137 | 138 138 | class TemperatureScales(Enum): 139 139 | CELSIUS = (lambda deg_c: deg_c) @@ -374,7 +374,7 @@ E731.py:147:5: E731 [*] Do not assign a `lambda` expression, use a `def` | = help: Rewrite `f` as a `def` -ℹ Suggested fix +ℹ Unsafe 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 00770929a2..f2e3a64a92 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 -ℹ Fix +ℹ Safe fix 1 1 | #: Okay 2 2 | # 情 3 3 | #: W291:1:6 @@ -33,7 +33,7 @@ W29.py:11:35: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -ℹ Fix +ℹ Safe fix 8 8 | bang = 12 9 9 | #: W291:2:35 10 10 | '''multiline @@ -54,7 +54,7 @@ W29.py:13:6: W291 [*] Trailing whitespace | = help: Remove trailing whitespace -ℹ Fix +ℹ Safe 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__W292_W292_0.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W292_W292_0.py.snap index 2e1466e13a..efd7799b3a 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,7 @@ W292_0.py:2:9: W292 [*] No newline at end of file | = help: Add trailing newline -ℹ Fix +ℹ Safe 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 d13b051aed..7ff3115215 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 -ℹ Fix +ℹ Safe 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__W605_W605_0.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_0.py.snap index b61df343bd..98da5fff80 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 -ℹ Fix +ℹ Safe fix 1 1 | #: W605:1:10 2 |-regex = '\.png$' 2 |+regex = r'\.png$' @@ -29,7 +29,7 @@ W605_0.py:6:1: W605 [*] Invalid escape sequence: `\.` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 2 2 | regex = '\.png$' 3 3 | 4 4 | #: W605:2:1 @@ -49,7 +49,7 @@ W605_0.py:11:6: W605 [*] Invalid escape sequence: `\_` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 8 8 | 9 9 | #: W605:2:6 10 10 | f( @@ -70,7 +70,7 @@ W605_0.py:18:6: W605 [*] Invalid escape sequence: `\_` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 12 12 | ) 13 13 | 14 14 | #: W605:4:6 @@ -88,7 +88,7 @@ W605_0.py:23:39: W605 [*] Invalid escape sequence: `\_` | = help: Add backslash to escape sequence -ℹ Fix +ℹ Safe fix 20 20 | """ 21 21 | 22 22 | #: W605:1:38 @@ -109,7 +109,7 @@ W605_0.py:28:12: W605 [*] Invalid escape sequence: `\.` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 25 25 | 26 26 | def f(): 27 27 | #: W605:1:11 @@ -128,7 +128,7 @@ W605_0.py:45:12: W605 [*] Invalid escape sequence: `\_` | = help: Add backslash to escape sequence -ℹ Fix +ℹ Safe fix 42 42 | \w 43 43 | ''' # noqa 44 44 | 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 72749e97c1..2fee83a5fe 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:2:10: W605 [*] Invalid escape sequence: `\.` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 1 1 | #: W605:1:10 2 |-regex = '\.png$' 2 |+regex = r'\.png$' @@ -29,7 +29,7 @@ W605_1.py:6:1: W605 [*] Invalid escape sequence: `\.` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 2 2 | regex = '\.png$' 3 3 | 4 4 | #: W605:2:1 @@ -49,7 +49,7 @@ W605_1.py:11:6: W605 [*] Invalid escape sequence: `\_` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 8 8 | 9 9 | #: W605:2:6 10 10 | f( @@ -70,7 +70,7 @@ W605_1.py:18:6: W605 [*] Invalid escape sequence: `\_` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 12 12 | ) 13 13 | 14 14 | #: W605:4:6 @@ -91,7 +91,7 @@ W605_1.py:25:12: W605 [*] Invalid escape sequence: `\.` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 22 22 | 23 23 | def f(): 24 24 | #: W605:1:11 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_2.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_2.py.snap index 8d23dcae78..9f1016ae83 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_2.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__W605_W605_2.py.snap @@ -11,7 +11,7 @@ W605_2.py:4:11: W605 [*] Invalid escape sequence: `\.` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 1 1 | # Same as `W605_0.py` but using f-strings instead. 2 2 | 3 3 | #: W605:1:10 @@ -31,7 +31,7 @@ W605_2.py:8:1: W605 [*] Invalid escape sequence: `\.` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 4 4 | regex = f'\.png$' 5 5 | 6 6 | #: W605:2:1 @@ -51,7 +51,7 @@ W605_2.py:13:7: W605 [*] Invalid escape sequence: `\_` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 10 10 | 11 11 | #: W605:2:6 12 12 | f( @@ -72,7 +72,7 @@ W605_2.py:20:6: W605 [*] Invalid escape sequence: `\_` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 14 14 | ) 15 15 | 16 16 | #: W605:4:6 @@ -90,7 +90,7 @@ W605_2.py:25:40: W605 [*] Invalid escape sequence: `\_` | = help: Add backslash to escape sequence -ℹ Fix +ℹ Safe fix 22 22 | """ 23 23 | 24 24 | #: W605:1:38 @@ -111,7 +111,7 @@ W605_2.py:43:13: W605 [*] Invalid escape sequence: `\_` | = help: Add backslash to escape sequence -ℹ Fix +ℹ Safe fix 40 40 | \w 41 41 | ''' # noqa 42 42 | @@ -131,7 +131,7 @@ W605_2.py:44:11: W605 [*] Invalid escape sequence: `\{` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 41 41 | ''' # noqa 42 42 | 43 43 | regex = f'\\\_' @@ -152,7 +152,7 @@ W605_2.py:45:11: W605 [*] Invalid escape sequence: `\{` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 42 42 | 43 43 | regex = f'\\\_' 44 44 | value = f'\{{1}}' @@ -173,7 +173,7 @@ W605_2.py:46:14: W605 [*] Invalid escape sequence: `\}` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 43 43 | regex = f'\\\_' 44 44 | value = f'\{{1}}' 45 45 | value = f'\{1}' @@ -193,7 +193,7 @@ W605_2.py:47:14: W605 [*] Invalid escape sequence: `\{` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 44 44 | value = f'\{{1}}' 45 45 | value = f'\{1}' 46 46 | value = f'{1:\}' @@ -214,7 +214,7 @@ W605_2.py:48:15: W605 [*] Invalid escape sequence: `\{` | = help: Use a raw string literal -ℹ Fix +ℹ Safe fix 45 45 | value = f'\{1}' 46 46 | value = f'{1:\}' 47 47 | value = f"{f"\{1}"}" 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 e8a55ce2fb..cf0ce6195f 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 `==` -ℹ Fix +ℹ Safe fix 1 1 | ### 2 2 | # Errors 3 3 | ### @@ -33,7 +33,7 @@ constant_literals.py:6:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Fix +ℹ Safe fix 3 3 | ### 4 4 | if "abc" is "def": # F632 (fix) 5 5 | pass @@ -54,7 +54,7 @@ constant_literals.py:8:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Fix +ℹ Safe fix 5 5 | pass 6 6 | if "abc" is None: # F632 (fix, but leaves behind unfixable E711) 7 7 | pass @@ -75,7 +75,7 @@ constant_literals.py:10:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Fix +ℹ Safe fix 7 7 | pass 8 8 | if None is "abc": # F632 (fix, but leaves behind unfixable E711) 9 9 | pass @@ -96,7 +96,7 @@ constant_literals.py:12:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Fix +ℹ Safe fix 9 9 | pass 10 10 | if "abc" is False: # F632 (fix, but leaves behind unfixable E712) 11 11 | pass @@ -117,7 +117,7 @@ constant_literals.py:14:4: E712 [*] Comparison to `False` should be `cond is Fal | = help: Replace with `cond is False` -ℹ Suggested fix +ℹ Unsafe fix 11 11 | pass 12 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) 13 13 | pass @@ -138,7 +138,7 @@ constant_literals.py:14:13: E711 [*] Comparison to `None` should be `cond is Non | = help: Replace with `cond is None` -ℹ Suggested fix +ℹ Unsafe fix 11 11 | pass 12 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) 13 13 | pass @@ -158,7 +158,7 @@ constant_literals.py:16:4: E711 [*] Comparison to `None` should be `cond is None | = help: Replace with `cond is None` -ℹ Suggested fix +ℹ Unsafe fix 13 13 | pass 14 14 | if False == None: # E711, E712 (fix) 15 15 | pass @@ -178,7 +178,7 @@ constant_literals.py:16:12: E712 [*] Comparison to `False` should be `cond is Fa | = help: Replace with `cond is False` -ℹ Suggested fix +ℹ Unsafe fix 13 13 | pass 14 14 | if False == None: # E711, E712 (fix) 15 15 | pass 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 d9e030bca0..8761934c74 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,7 @@ W292_4.py:1:2: W292 [*] No newline at end of file | = help: Add trailing newline -ℹ Fix +ℹ Safe 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 2e9ab57a98..85ada6d00f 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 -ℹ Suggested fix +ℹ Unsafe fix 126 126 | '(found 3)') 127 127 | @expect('D212: Multi-line docstring summary should start at the first line') 128 128 | def asdlkfasd(): @@ -37,7 +37,7 @@ D.py:597:5: D200 [*] One-line docstring should fit on one line | = help: Reformat to one line -ℹ Suggested fix +ℹ Unsafe fix 594 594 | '(found 3)') 595 595 | @expect('D212: Multi-line docstring summary should start at the first line') 596 596 | def one_liner(): @@ -61,7 +61,7 @@ D.py:606:5: D200 [*] One-line docstring should fit on one line | = help: Reformat to one line -ℹ Suggested fix +ℹ Unsafe 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 d4f68ce602..9cae5fd5f9 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 -ℹ Suggested fix +ℹ Unsafe 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 b666e6fa3a..977ac47b9d 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 -ℹ Fix +ℹ Safe fix 133 133 | 134 134 | @expect('D201: No blank lines allowed before function docstring (found 1)') 135 135 | def leading_space(): @@ -30,7 +30,7 @@ D.py:151:5: D201 [*] No blank lines allowed before function docstring (found 1) | = help: Remove blank line(s) before function docstring -ℹ Fix +ℹ Safe 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(): @@ -52,7 +52,7 @@ D.py:546:5: D201 [*] No blank lines allowed before function docstring (found 1) | = help: Remove blank line(s) before function docstring -ℹ Fix +ℹ Safe 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(): @@ -76,7 +76,7 @@ D.py:568:5: D201 [*] No blank lines allowed before function docstring (found 1) | = help: Remove blank line(s) before function docstring -ℹ Fix +ℹ Safe 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 7fbb6cc885..8a67b2b176 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 -ℹ Fix +ℹ Safe fix 140 140 | @expect('D202: No blank lines allowed after function docstring (found 1)') 141 141 | def trailing_space(): 142 142 | """Leading space.""" @@ -32,7 +32,7 @@ D.py:151:5: D202 [*] No blank lines allowed after function docstring (found 1) | = help: Remove blank line(s) after function docstring -ℹ Fix +ℹ Safe fix 149 149 | def trailing_and_leading_space(): 150 150 | 151 151 | """Trailing and leading space.""" @@ -56,7 +56,7 @@ D.py:555:5: D202 [*] No blank lines allowed after function docstring (found 1) | = help: Remove blank line(s) after function docstring -ℹ Fix +ℹ Safe fix 556 556 | 557 557 | More content. 558 558 | """ @@ -80,7 +80,7 @@ D.py:568:5: D202 [*] No blank lines allowed after function docstring (found 1) | = help: Remove blank line(s) after function docstring -ℹ Fix +ℹ Safe 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 2a17a65416..90e915d102 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 -ℹ Fix +ℹ Safe fix 55 55 | # D202 56 56 | def outer(): 57 57 | """This is a docstring.""" @@ -29,7 +29,7 @@ D202.py:68:5: D202 [*] No blank lines allowed after function docstring (found 2) | = help: Remove blank line(s) after function docstring -ℹ Fix +ℹ Safe fix 66 66 | # D202 67 67 | def outer(): 68 68 | """This is a docstring.""" @@ -50,7 +50,7 @@ D202.py:80:5: D202 [*] No blank lines allowed after function docstring (found 1) | = help: Remove blank line(s) after function docstring -ℹ Fix +ℹ Safe 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 fe427f7d6c..3ef6f3205f 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 -ℹ Fix +ℹ Safe fix 158 158 | 159 159 | 160 160 | class LeadingSpaceMissing: @@ -27,7 +27,7 @@ D.py:192:5: D203 [*] 1 blank line required before class docstring | = help: Insert 1 blank line before class docstring -ℹ Fix +ℹ Safe fix 189 189 | 190 190 | 191 191 | class LeadingAndTrailingSpaceMissing: @@ -54,7 +54,7 @@ D.py:526:5: D203 [*] 1 blank line required before class docstring | = help: Insert 1 blank line before class docstring -ℹ Fix +ℹ Safe 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 @@ -73,7 +73,7 @@ D.py:649:5: D203 [*] 1 blank line required before class docstring | = help: Insert 1 blank line before class docstring -ℹ Fix +ℹ Safe fix 646 646 | " 647 647 | 648 648 | class StatementOnSameLineAsDocstring: @@ -90,7 +90,7 @@ D.py:654:5: D203 [*] 1 blank line required before class docstring | = help: Insert 1 blank line before class docstring -ℹ Fix +ℹ Safe fix 651 651 | pass 652 652 | 653 653 | class StatementOnSameLineAsDocstring: @@ -109,7 +109,7 @@ D.py:658:5: D203 [*] 1 blank line required before class docstring | = help: Insert 1 blank line before class docstring -ℹ Fix +ℹ Safe 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 f9a9ef76f8..425f22147b 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 -ℹ Fix +ℹ Safe fix 179 179 | class TrailingSpace: 180 180 | 181 181 | """TrailingSpace.""" @@ -29,7 +29,7 @@ D.py:192:5: D204 [*] 1 blank line required after class docstring | = help: Insert 1 blank line after class docstring -ℹ Fix +ℹ Safe fix 190 190 | 191 191 | class LeadingAndTrailingSpaceMissing: 192 192 | """Leading and trailing space missing.""" @@ -48,7 +48,7 @@ D.py:649:5: D204 [*] 1 blank line required after class docstring | = help: Insert 1 blank line after class docstring -ℹ Fix +ℹ Safe fix 646 646 | " 647 647 | 648 648 | class StatementOnSameLineAsDocstring: @@ -68,7 +68,7 @@ D.py:654:5: D204 [*] 1 blank line required after class docstring | = help: Insert 1 blank line after class docstring -ℹ Fix +ℹ Safe fix 651 651 | pass 652 652 | 653 653 | class StatementOnSameLineAsDocstring: @@ -90,7 +90,7 @@ D.py:658:5: D204 [*] 1 blank line required after class docstring | = help: Insert 1 blank line after class docstring -ℹ Fix +ℹ Safe 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 39f339c83f..290cd8a05f 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 -ℹ Fix +ℹ Safe 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 355d9c79d7..d70f30883a 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 -ℹ Fix +ℹ Safe fix 229 229 | def asdfsdf(): 230 230 | """Summary. 231 231 | @@ -31,7 +31,7 @@ D.py:244:1: D207 [*] Docstring is under-indented | = help: Increase indentation -ℹ Fix +ℹ Safe fix 241 241 | 242 242 | Description. 243 243 | @@ -51,7 +51,7 @@ D.py:440:1: D207 [*] Docstring is under-indented | = help: Increase indentation -ℹ Fix +ℹ Safe 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 | @@ -69,7 +69,7 @@ D.py:441:1: D207 [*] Docstring is under-indented | = help: Increase indentation -ℹ Fix +ℹ Safe 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 9a1338b023..0fb5028820 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 -ℹ Fix +ℹ Safe fix 249 249 | def asdfsdsdf24(): 250 250 | """Summary. 251 251 | @@ -31,7 +31,7 @@ D.py:264:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Fix +ℹ Safe fix 261 261 | 262 262 | Description. 263 263 | @@ -52,7 +52,7 @@ D.py:272:1: D208 [*] Docstring is over-indented | = help: Remove over-indentation -ℹ Fix +ℹ Safe fix 269 269 | def asdfsdfsdsdsdfsdf24(): 270 270 | """Summary. 271 271 | 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 a7339839f9..97495aa319 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 -ℹ Fix +ℹ Safe fix 280 280 | def asdfljdf24(): 281 281 | """Summary. 282 282 | @@ -36,7 +36,7 @@ D.py:588:5: D209 [*] Multi-line docstring closing quotes should be on a separate | = help: Move closing quotes to new line -ℹ Fix +ℹ Safe 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 538c0f34ba..29b6fe3160 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 -ℹ Fix +ℹ Safe fix 285 285 | 286 286 | @expect('D210: No whitespaces allowed surrounding docstring text') 287 287 | def endswith(): @@ -29,7 +29,7 @@ D.py:293:5: D210 [*] No whitespaces allowed surrounding docstring text | = help: Trim surrounding whitespace -ℹ Fix +ℹ Safe fix 290 290 | 291 291 | @expect('D210: No whitespaces allowed surrounding docstring text') 292 292 | def around(): @@ -52,7 +52,7 @@ D.py:299:5: D210 [*] No whitespaces allowed surrounding docstring text | = help: Trim surrounding whitespace -ℹ Fix +ℹ Safe 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 06819455f6..f89dc69584 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 -ℹ Fix +ℹ Safe fix 166 166 | 167 167 | 168 168 | class WithLeadingSpace: @@ -29,7 +29,7 @@ D.py:181:5: D211 [*] No blank lines allowed before class docstring | = help: Remove blank line(s) before class docstring -ℹ Fix +ℹ Safe 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 8ff4e77c75..c37abb9572 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 -ℹ Fix +ℹ Safe fix 126 126 | '(found 3)') 127 127 | @expect('D212: Multi-line docstring summary should start at the first line') 128 128 | def asdlkfasd(): @@ -36,7 +36,7 @@ D.py:597:5: D212 [*] Multi-line docstring summary should start at the first line | = help: Remove whitespace after opening quotes -ℹ Fix +ℹ Safe fix 594 594 | '(found 3)') 595 595 | @expect('D212: Multi-line docstring summary should start at the first line') 596 596 | def one_liner(): @@ -60,7 +60,7 @@ D.py:624:5: D212 [*] Multi-line docstring summary should start at the first line | = help: Remove whitespace after opening quotes -ℹ Fix +ℹ Safe 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 cf152b3416..c7d77c9218 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 -ℹ Fix +ℹ Safe 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(): @@ -40,7 +40,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 -ℹ Fix +ℹ Safe 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(): @@ -65,7 +65,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 -ℹ Fix +ℹ Safe 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(): @@ -90,7 +90,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 -ℹ Fix +ℹ Safe 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(): @@ -115,7 +115,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 -ℹ Fix +ℹ Safe 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(): @@ -140,7 +140,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 -ℹ Fix +ℹ Safe 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(): @@ -165,7 +165,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 -ℹ Fix +ℹ Safe 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(): @@ -190,7 +190,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 -ℹ Fix +ℹ Safe 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(): @@ -213,7 +213,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 -ℹ Fix +ℹ Safe fix 278 278 | 'line') 279 279 | @expect('D213: Multi-line docstring summary should start at the second line') 280 280 | def asdfljdf24(): @@ -237,7 +237,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 -ℹ Fix +ℹ Safe 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(): @@ -263,7 +263,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 -ℹ Fix +ℹ Safe fix 340 340 | 341 341 | @expect('D213: Multi-line docstring summary should start at the second line') 342 342 | def exceptions_of_D301(): @@ -288,7 +288,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 -ℹ Fix +ℹ Safe fix 380 380 | 381 381 | @expect('D213: Multi-line docstring summary should start at the second line') 382 382 | def new_209(): @@ -313,7 +313,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 -ℹ Fix +ℹ Safe fix 389 389 | 390 390 | @expect('D213: Multi-line docstring summary should start at the second line') 391 391 | def old_209(): @@ -337,7 +337,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 -ℹ Fix +ℹ Safe 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') @@ -362,7 +362,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 -ℹ Fix +ℹ Safe 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): @@ -391,7 +391,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 -ℹ Fix +ℹ Safe 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 @@ -415,7 +415,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 -ℹ Fix +ℹ Safe fix 543 543 | @expect('D213: Multi-line docstring summary should start at the second line') 544 544 | def multiline_leading_space(): 545 545 | @@ -441,7 +441,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 -ℹ Fix +ℹ Safe 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(): @@ -467,7 +467,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 -ℹ Fix +ℹ Safe 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 | @@ -490,7 +490,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 -ℹ Fix +ℹ Safe fix 585 585 | 'line') 586 586 | @expect('D213: Multi-line docstring summary should start at the second line') 587 587 | def asdfljdjgf24(): @@ -513,7 +513,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 -ℹ Fix +ℹ Safe fix 603 603 | '(found 3)') 604 604 | @expect('D212: Multi-line docstring summary should start at the first line') 605 605 | def one_liner(): @@ -536,7 +536,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 -ℹ Fix +ℹ Safe fix 612 612 | '(found 3)') 613 613 | @expect('D212: Multi-line docstring summary should start at the first line') 614 614 | def one_liner(): 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 1d4c284b9b..13c7174f43 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 @@ -19,7 +19,7 @@ D214_module.py:1:1: D214 [*] Section is over-indented ("Returns") | = help: Remove over-indentation from "Returns" -ℹ Fix +ℹ Safe fix 1 1 | """A module docstring with D214 violations 2 2 | 3 |- Returns @@ -46,7 +46,7 @@ D214_module.py:1:1: D214 [*] Section is over-indented ("Args") | = help: Remove over-indentation from "Args" -ℹ Fix +ℹ Safe 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 d9b922a8e0..3fb4608144 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 @@ -17,7 +17,7 @@ sections.py:144:5: D214 [*] Section is over-indented ("Returns") | = help: Remove over-indentation from "Returns" -ℹ Fix +ℹ Safe fix 143 143 | def section_overindented(): # noqa: D416 144 144 | """Toggle the gizmo. 145 145 | 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 9ac9a84da7..813615fb5e 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,7 @@ D215.py:1:1: D215 [*] Section underline is over-indented ("TODO") | = help: Remove over-indentation from "TODO" underline -ℹ Fix +ℹ Safe 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 ae6dc1dfed..7ff2484755 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 @@ -17,7 +17,7 @@ sections.py:156:5: D215 [*] Section underline is over-indented ("Returns") | = help: Remove over-indentation from "Returns" underline -ℹ Fix +ℹ Safe fix 156 156 | """Toggle the gizmo. 157 157 | 158 158 | Returns @@ -41,7 +41,7 @@ sections.py:170:5: D215 [*] Section underline is over-indented ("Returns") | = help: Remove over-indentation from "Returns" underline -ℹ Fix +ℹ Safe 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__D301_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.py.snap index 640d797182..8c21aeac86 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 -ℹ Suggested fix +ℹ Unsafe 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 9289200eea..efd485a81c 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 -ℹ Suggested fix +ℹ Unsafe fix 1 1 | def double_quotes_backslash(): 2 |- """Sum\\mary.""" 2 |+ r"""Sum\\mary.""" 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 7d0eafb11d..3bdb8fd614 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 -ℹ Suggested fix +ℹ Unsafe 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(): @@ -29,7 +29,7 @@ D.py:406:25: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe 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')") @@ -49,7 +49,7 @@ D.py:410:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 407 407 | 408 408 | 409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 @@ -69,7 +69,7 @@ D.py:416:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 413 413 | 414 414 | 415 415 | def decorator_for_test(func): # noqa: D400,D401,D415 @@ -87,7 +87,7 @@ D.py:422:35: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 419 419 | 420 420 | 421 421 | @ignored_decorator @@ -106,7 +106,7 @@ D.py:429:49: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe 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')") @@ -126,7 +126,7 @@ D.py:470:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe 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(): @@ -145,7 +145,7 @@ D.py:475:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 472 472 | 473 473 | 474 474 | def docstring_bad_ignore_all(): # noqa @@ -164,7 +164,7 @@ D.py:480:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 477 477 | 478 478 | 479 479 | def docstring_bad_ignore_one(): # noqa: D400,D401,D415 @@ -184,7 +184,7 @@ D.py:487:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe 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 @@ -202,7 +202,7 @@ D.py:514:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 511 511 | 512 512 | 513 513 | def valid_google_string(): # noqa: D400 @@ -221,7 +221,7 @@ D.py:520:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe 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 @@ -240,7 +240,7 @@ D.py:581:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe 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(): @@ -262,7 +262,7 @@ D.py:615:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 612 612 | '(found 3)') 613 613 | @expect('D212: Multi-line docstring summary should start at the first line') 614 614 | def one_liner(): @@ -281,7 +281,7 @@ D.py:639:17: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 636 636 | """ This is a docstring that starts with a space.""" # noqa: D210 637 637 | 638 638 | @@ -300,7 +300,7 @@ D.py:641:18: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 638 638 | 639 639 | class SameLine: """This is a docstring on the same line""" 640 640 | @@ -320,7 +320,7 @@ D.py:664:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe 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 4404e55641..6b522fd3e9 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 -ℹ Suggested fix +ℹ Unsafe fix 1 1 | def f(): 2 |- "Here's a line without a period" 2 |+ "Here's a line without a period." @@ -27,7 +27,7 @@ D400.py:7:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 4 4 | 5 5 | 6 6 | def f(): @@ -50,7 +50,7 @@ D400.py:12:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 11 11 | def f(): 12 12 | """ 13 13 | Here's a line without a period, @@ -69,7 +69,7 @@ D400.py:20:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 17 17 | 18 18 | 19 19 | def f(): @@ -91,7 +91,7 @@ D400.py:25:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 24 24 | def f(): 25 25 | """ 26 26 | Here's a line without a period, @@ -113,7 +113,7 @@ D400.py:32:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 31 31 | def f(): 32 32 | """ 33 33 | Here's a line without a period, @@ -132,7 +132,7 @@ D400.py:39:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 36 36 | 37 37 | 38 38 | def f(): @@ -151,7 +151,7 @@ D400.py:44:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 41 41 | 42 42 | 43 43 | def f(): @@ -174,7 +174,7 @@ D400.py:49:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 48 48 | def f(): 49 49 | r""" 50 50 | Here's a line without a period, @@ -193,7 +193,7 @@ D400.py:57:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 54 54 | 55 55 | 56 56 | def f(): @@ -215,7 +215,7 @@ D400.py:62:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 61 61 | def f(): 62 62 | r""" 63 63 | Here's a line without a period, @@ -237,7 +237,7 @@ D400.py:69:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe fix 68 68 | def f(): 69 69 | r""" 70 70 | Here's a line without a period, 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 9900625354..0ac0eed67f 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` -ℹ Fix +ℹ Safe fix 1 1 | def bad_function(): 2 |- """this docstring is not capitalized""" 2 |+ """This docstring is not capitalized""" 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 c0f88a68d6..3ad8fb7ea6 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 @@ -17,7 +17,7 @@ sections.py:17:5: D405 [*] Section name should be properly capitalized ("returns | = help: Capitalize "returns" -ℹ Fix +ℹ Safe fix 16 16 | def not_capitalized(): # noqa: D416 17 17 | """Toggle the gizmo. 18 18 | @@ -51,7 +51,7 @@ sections.py:216:5: D405 [*] Section name should be properly capitalized ("Short | = help: Capitalize "Short summary" -ℹ Fix +ℹ Safe 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 42113771b3..d996d6fe54 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 @@ -17,7 +17,7 @@ sections.py:30:5: D406 [*] Section name should end with a newline ("Returns") | = help: Add newline after "Returns" -ℹ Fix +ℹ Safe fix 29 29 | def superfluous_suffix(): # noqa: D416 30 30 | """Toggle the gizmo. 31 31 | @@ -51,7 +51,7 @@ sections.py:216:5: D406 [*] Section name should end with a newline ("Raises") | = help: Add newline after "Raises" -ℹ Fix +ℹ Safe 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__D407_sections.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D407_sections.py.snap index 634a74e621..6871d54cc6 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 @@ -16,7 +16,7 @@ sections.py:42:5: D407 [*] Missing dashed underline after section ("Returns") | = help: Add dashed line under "Returns" -ℹ Fix +ℹ Safe fix 42 42 | """Toggle the gizmo. 43 43 | 44 44 | Returns @@ -39,7 +39,7 @@ sections.py:54:5: D407 [*] Missing dashed underline after section ("Returns") | = help: Add dashed line under "Returns" -ℹ Fix +ℹ Safe fix 54 54 | """Toggle the gizmo. 55 55 | 56 56 | Returns @@ -60,7 +60,7 @@ sections.py:65:5: D407 [*] Missing dashed underline after section ("Returns") | = help: Add dashed line under "Returns" -ℹ Fix +ℹ Safe fix 64 64 | def no_underline_and_no_newline(): # noqa: D416 65 65 | """Toggle the gizmo. 66 66 | @@ -95,7 +95,7 @@ sections.py:216:5: D407 [*] Missing dashed underline after section ("Raises") | = help: Add dashed line under "Raises" -ℹ Fix +ℹ Safe fix 225 225 | ------ 226 226 | Many many wonderful things. 227 227 | Raises: @@ -124,7 +124,7 @@ sections.py:261:5: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Fix +ℹ Safe fix 261 261 | """Toggle the gizmo. 262 262 | 263 263 | Args: @@ -153,7 +153,7 @@ sections.py:261:5: D407 [*] Missing dashed underline after section ("Returns") | = help: Add dashed line under "Returns" -ℹ Fix +ℹ Safe fix 264 264 | note: A random string. 265 265 | 266 266 | Returns: @@ -182,7 +182,7 @@ sections.py:261:5: D407 [*] Missing dashed underline after section ("Raises") | = help: Add dashed line under "Raises" -ℹ Fix +ℹ Safe fix 266 266 | Returns: 267 267 | 268 268 | Raises: @@ -206,7 +206,7 @@ sections.py:278:5: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Fix +ℹ Safe fix 278 278 | """Toggle the gizmo. 279 279 | 280 280 | Args @@ -233,7 +233,7 @@ sections.py:293:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Fix +ℹ Safe fix 295 295 | Will this work when referencing x? 296 296 | 297 297 | Args: @@ -257,7 +257,7 @@ sections.py:310:5: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Fix +ℹ Safe fix 310 310 | """Toggle the gizmo. 311 311 | 312 312 | Args: @@ -283,7 +283,7 @@ sections.py:322:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Fix +ℹ Safe fix 322 322 | """Test a valid args section. 323 323 | 324 324 | Args: @@ -309,7 +309,7 @@ sections.py:334:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Fix +ℹ Safe fix 334 334 | """Test a valid args section. 335 335 | 336 336 | Args: @@ -336,7 +336,7 @@ sections.py:346:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Fix +ℹ Safe fix 346 346 | """Test a valid args section. 347 347 | 348 348 | Args: @@ -362,7 +362,7 @@ sections.py:359:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Fix +ℹ Safe fix 359 359 | """Test a valid args section. 360 360 | 361 361 | Args: @@ -388,7 +388,7 @@ sections.py:371:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Fix +ℹ Safe fix 371 371 | """Test a valid args section. 372 372 | 373 373 | Args: @@ -418,7 +418,7 @@ sections.py:380:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Fix +ℹ Safe fix 380 380 | """Do stuff. 381 381 | 382 382 | Args: @@ -444,7 +444,7 @@ sections.py:499:9: D407 [*] Missing dashed underline after section ("Args") | = help: Add dashed line under "Args" -ℹ Fix +ℹ Safe fix 501 501 | Testing this incorrectly indented docstring. 502 502 | 503 503 | Args: @@ -466,7 +466,7 @@ sections.py:519:5: D407 [*] Missing dashed underline after section ("Parameters" | = help: Add dashed line under "Parameters" -ℹ Fix +ℹ Safe fix 519 519 | """Equal length equals should be replaced with dashes. 520 520 | 521 521 | Parameters @@ -489,7 +489,7 @@ sections.py:527:5: D407 [*] Missing dashed underline after section ("Parameters" | = help: Add dashed line under "Parameters" -ℹ Fix +ℹ Safe fix 527 527 | """Here, the length of equals is not the same. 528 528 | 529 529 | 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 c40de2c794..8ee2ee3249 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 @@ -18,7 +18,7 @@ sections.py:94:5: D408 [*] Section underline should be in the line following the | = help: Add underline to "Returns" -ℹ Fix +ℹ Safe 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 331114ace5..ce559c70a0 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 @@ -17,7 +17,7 @@ sections.py:108:5: D409 [*] Section underline should match the length of its nam | = help: Adjust underline length to match "Returns" -ℹ Fix +ℹ Safe fix 108 108 | """Toggle the gizmo. 109 109 | 110 110 | Returns @@ -51,7 +51,7 @@ sections.py:216:5: D409 [*] Section underline should match the length of its nam | = help: Adjust underline length to match "Returns" -ℹ Fix +ℹ Safe fix 222 222 | returns. 223 223 | 224 224 | Returns 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 1c467c9960..7631ab8687 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 @@ -23,7 +23,7 @@ D410.py:2:5: D410 [*] Missing blank line after section ("Parameters") | = help: Add blank line after "Parameters" -ℹ Fix +ℹ Safe fix 7 7 | _description_ 8 8 | b : int 9 9 | _description_ @@ -47,7 +47,7 @@ D410.py:19:5: D410 [*] Missing blank line after section ("Parameters") | = help: Add blank line after "Parameters" -ℹ Fix +ℹ Safe 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 9a3f97dfb3..00d15acee3 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 @@ -22,7 +22,7 @@ sections.py:76:5: D410 [*] Missing blank line after section ("Returns") | = help: Add blank line after "Returns" -ℹ Fix +ℹ Safe fix 77 77 | 78 78 | Returns 79 79 | ------- @@ -55,7 +55,7 @@ sections.py:216:5: D410 [*] Missing blank line after section ("Returns") | = help: Add blank line after "Returns" -ℹ Fix +ℹ Safe 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 df08719209..f930546119 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 @@ -22,7 +22,7 @@ sections.py:76:5: D411 [*] Missing blank line before section ("Yields") | = help: Add blank line before "Yields" -ℹ Fix +ℹ Safe fix 77 77 | 78 78 | Returns 79 79 | ------- @@ -48,7 +48,7 @@ sections.py:131:5: D411 [*] Missing blank line before section ("Returns") | = help: Add blank line before "Returns" -ℹ Fix +ℹ Safe fix 131 131 | """Toggle the gizmo. 132 132 | 133 133 | The function's description. @@ -81,7 +81,7 @@ sections.py:216:5: D411 [*] Missing blank line before section ("Raises") | = help: Add blank line before "Raises" -ℹ Fix +ℹ Safe 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 6490ca9318..a3861a422e 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 @@ -25,7 +25,7 @@ sections.py:216:5: D412 [*] No blank lines allowed between a section header and | = help: Remove blank line(s) -ℹ Fix +ℹ Safe fix 217 217 | 218 218 | Short summary 219 219 | ------------- 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 2fa38b08c3..55af210426 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 @@ -13,7 +13,7 @@ sections.py:65:5: D413 [*] Missing blank line after last section ("Returns") | = help: Add blank line after "Returns" -ℹ Fix +ℹ Safe fix 64 64 | def no_underline_and_no_newline(): # noqa: D416 65 65 | """Toggle the gizmo. 66 66 | 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 3bdc949e58..c32b473f83 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 -ℹ Suggested fix +ℹ Unsafe 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(): @@ -29,7 +29,7 @@ D.py:406:25: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -ℹ Suggested fix +ℹ Unsafe 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')") @@ -49,7 +49,7 @@ D.py:410:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Suggested fix +ℹ Unsafe fix 407 407 | 408 408 | 409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 @@ -69,7 +69,7 @@ D.py:416:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Suggested fix +ℹ Unsafe fix 413 413 | 414 414 | 415 415 | def decorator_for_test(func): # noqa: D400,D401,D415 @@ -87,7 +87,7 @@ D.py:422:35: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -ℹ Suggested fix +ℹ Unsafe fix 419 419 | 420 420 | 421 421 | @ignored_decorator @@ -106,7 +106,7 @@ D.py:429:49: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -ℹ Suggested fix +ℹ Unsafe 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')") @@ -126,7 +126,7 @@ D.py:470:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Suggested fix +ℹ Unsafe 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(): @@ -145,7 +145,7 @@ D.py:475:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Suggested fix +ℹ Unsafe fix 472 472 | 473 473 | 474 474 | def docstring_bad_ignore_all(): # noqa @@ -164,7 +164,7 @@ D.py:480:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Suggested fix +ℹ Unsafe fix 477 477 | 478 478 | 479 479 | def docstring_bad_ignore_one(): # noqa: D400,D401,D415 @@ -184,7 +184,7 @@ D.py:487:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Suggested fix +ℹ Unsafe 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 @@ -203,7 +203,7 @@ D.py:520:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Suggested fix +ℹ Unsafe 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 @@ -222,7 +222,7 @@ D.py:581:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Suggested fix +ℹ Unsafe 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(): @@ -244,7 +244,7 @@ D.py:615:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Suggested fix +ℹ Unsafe fix 612 612 | '(found 3)') 613 613 | @expect('D212: Multi-line docstring summary should start at the first line') 614 614 | def one_liner(): @@ -263,7 +263,7 @@ D.py:639:17: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -ℹ Suggested fix +ℹ Unsafe fix 636 636 | """ This is a docstring that starts with a space.""" # noqa: D210 637 637 | 638 638 | @@ -282,7 +282,7 @@ D.py:641:18: D415 [*] First line should end with a period, question mark, or exc | = help: Add closing punctuation -ℹ Suggested fix +ℹ Unsafe fix 638 638 | 639 639 | class SameLine: """This is a docstring on the same line""" 640 640 | @@ -302,7 +302,7 @@ D.py:664:5: D415 [*] First line should end with a period, question mark, or excl | = help: Add closing punctuation -ℹ Suggested fix +ℹ Unsafe 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__d209_d400.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap index 17a4753d2b..02a19f057d 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,7 @@ D209_D400.py:2:5: D209 [*] Multi-line docstring closing quotes should be on a se | = help: Move closing quotes to new line -ℹ Fix +ℹ Safe 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""" @@ -28,7 +28,7 @@ D209_D400.py:2:5: D400 [*] First line should end with a period | = help: Add period -ℹ Suggested fix +ℹ Unsafe 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/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__preview__D300_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__preview__D300_D.py.snap index 419c4e237a..ee2c307aef 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__preview__D300_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__preview__D300_D.py.snap @@ -10,7 +10,7 @@ D.py:307:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Fix +ℹ Safe fix 304 304 | 305 305 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') 306 306 | def triple_single_quotes_raw(): @@ -29,7 +29,7 @@ D.py:312:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Fix +ℹ Safe fix 309 309 | 310 310 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') 311 311 | def triple_single_quotes_raw_uppercase(): @@ -48,7 +48,7 @@ D.py:317:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Fix +ℹ Safe fix 314 314 | 315 315 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') 316 316 | def single_quotes_raw(): @@ -67,7 +67,7 @@ D.py:322:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Fix +ℹ Safe fix 319 319 | 320 320 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') 321 321 | def single_quotes_raw_uppercase(): @@ -86,7 +86,7 @@ D.py:328:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Fix +ℹ Safe 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(): @@ -108,7 +108,7 @@ D.py:645:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Fix +ℹ Safe fix 642 642 | 643 643 | 644 644 | def single_line_docstring_with_an_escaped_backslash(): @@ -130,7 +130,7 @@ D.py:649:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Fix +ℹ Safe fix 646 646 | " 647 647 | 648 648 | class StatementOnSameLineAsDocstring: @@ -148,7 +148,7 @@ D.py:654:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Fix +ℹ Safe fix 651 651 | pass 652 652 | 653 653 | class StatementOnSameLineAsDocstring: @@ -168,7 +168,7 @@ D.py:658:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Fix +ℹ Safe fix 655 655 | 656 656 | 657 657 | class CommentAfterDocstring: @@ -188,7 +188,7 @@ D.py:664:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Fix +ℹ Safe 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__preview__D300_D300.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__preview__D300_D300.py.snap index 2be3a13bfa..2e3fedcf3d 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__preview__D300_D300.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__preview__D300_D300.py.snap @@ -1,6 +1,5 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs -assertion_line: 134 --- D300.py:6:5: D300 Use triple double quotes `"""` | @@ -18,7 +17,7 @@ D300.py:10:5: D300 [*] Use triple double quotes `"""` | = help: Convert to triple double quotes -ℹ Fix +ℹ Safe fix 7 7 | 8 8 | 9 9 | def contains_quote(): 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 cd39f357df..433865de23 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` -ℹ Fix +ℹ Safe fix 1 1 | from __future__ import all_feature_names 2 |-import functools, os 2 |+import os @@ -30,7 +30,7 @@ F401_0.py:6:5: F401 [*] `collections.OrderedDict` imported but unused | = help: Remove unused import: `collections.OrderedDict` -ℹ Fix +ℹ Safe fix 3 3 | from datetime import datetime 4 4 | from collections import ( 5 5 | Counter, @@ -50,7 +50,7 @@ F401_0.py:12:8: F401 [*] `logging.handlers` imported but unused | = help: Remove unused import: `logging.handlers` -ℹ Fix +ℹ Safe fix 9 9 | import multiprocessing.pool 10 10 | import multiprocessing.process 11 11 | import logging.config @@ -68,7 +68,7 @@ F401_0.py:32:12: F401 [*] `shelve` imported but unused | = help: Remove unused import: `shelve` -ℹ Fix +ℹ Safe fix 29 29 | from models import Fruit, Nut, Vegetable 30 30 | 31 31 | if TYPE_CHECKING: @@ -88,7 +88,7 @@ F401_0.py:33:12: F401 [*] `importlib` imported but unused | = help: Remove unused import: `importlib` -ℹ Fix +ℹ Safe fix 30 30 | 31 31 | if TYPE_CHECKING: 32 32 | import shelve @@ -108,7 +108,7 @@ F401_0.py:37:12: F401 [*] `pathlib` imported but unused | = help: Remove unused import: `pathlib` -ℹ Fix +ℹ Safe fix 34 34 | 35 35 | if TYPE_CHECKING: 36 36 | """Hello, world!""" @@ -125,7 +125,7 @@ F401_0.py:52:16: F401 [*] `pickle` imported but unused | = help: Remove unused import: `pickle` -ℹ Fix +ℹ Safe fix 49 49 | z = multiprocessing.pool.ThreadPool() 50 50 | 51 51 | def b(self) -> None: @@ -145,7 +145,7 @@ F401_0.py:93:16: F401 [*] `x` imported but unused | = help: Remove unused import: `x` -ℹ Fix +ℹ Safe fix 90 90 | # Test: match statements. 91 91 | match *0, 1, *2: 92 92 | case 0,: @@ -163,7 +163,7 @@ F401_0.py:94:16: F401 [*] `y` imported but unused | = help: Remove unused import: `y` -ℹ Fix +ℹ Safe fix 91 91 | match *0, 1, *2: 92 92 | case 0,: 93 93 | import x @@ -183,7 +183,7 @@ F401_0.py:99:8: F401 [*] `foo.bar.baz` imported but unused | = help: Remove unused import: `foo.bar.baz` -ℹ Fix +ℹ Safe fix 96 96 | 97 97 | # Test: access a sub-importation via an alias. 98 98 | import foo.bar as bop @@ -203,7 +203,7 @@ F401_0.py:105:12: F401 [*] `a1` imported but unused | = help: Remove unused import: `a1` -ℹ Fix +ℹ Safe fix 102 102 | 103 103 | # Test: isolated deletions. 104 104 | if TYPE_CHECKING: @@ -221,7 +221,7 @@ F401_0.py:107:12: F401 [*] `a2` imported but unused | = help: Remove unused import: `a2` -ℹ Fix +ℹ Safe fix 104 104 | if TYPE_CHECKING: 105 105 | import a1 106 106 | @@ -241,7 +241,7 @@ F401_0.py:112:16: F401 [*] `b1` imported but unused | = help: Remove unused import: `b1` -ℹ Fix +ℹ Safe fix 109 109 | 110 110 | match *0, 1, *2: 111 111 | case 0,: @@ -259,7 +259,7 @@ F401_0.py:114:16: F401 [*] `b2` imported but unused | = help: Remove unused import: `b2` -ℹ Fix +ℹ Safe fix 111 111 | case 0,: 112 112 | import b1 113 113 | @@ -276,7 +276,7 @@ F401_0.py:122:1: F401 [*] `datameta_client_lib.model_helpers.noqa` imported but | = help: Remove unused import: `datameta_client_lib.model_helpers.noqa` -ℹ Fix +ℹ Safe 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 c7b255b011..39c9b95a01 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` -ℹ Fix +ℹ Safe 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 abcc293126..cd5526e8f4 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` -ℹ Fix +ℹ Safe 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 82be7eb9c7..caf5d2c676 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` -ℹ Fix +ℹ Safe fix 9 9 | 10 10 | 11 11 | def fn(thread: Thread): @@ -30,7 +30,7 @@ F401_17.py:20:27: F401 [*] `threading.Thread` imported but unused | = help: Remove unused import: `threading.Thread` -ℹ Fix +ℹ Safe 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 e5952be0d5..f5e387c684 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` -ℹ Fix +ℹ Safe 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_5.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F401_F401_5.py.snap index b67b6c1222..e4317c5d19 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,7 @@ F401_5.py:2:17: F401 [*] `a.b.c` imported but unused | = help: Remove unused import: `a.b.c` -ℹ Fix +ℹ Safe 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 @@ -29,7 +29,7 @@ F401_5.py:3:22: F401 [*] `d.e.f` imported but unused | = help: Remove unused import: `d.e.f` -ℹ Fix +ℹ Safe 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 @@ -46,7 +46,7 @@ F401_5.py:4:8: F401 [*] `h.i` imported but unused | = help: Remove unused import: `h.i` -ℹ Fix +ℹ Safe 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 @@ -62,7 +62,7 @@ F401_5.py:5:15: F401 [*] `j.k` imported but unused | = help: Remove unused import: `j.k` -ℹ Fix +ℹ Safe 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 7bc4650a52..d0db5ee40d 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` -ℹ Fix +ℹ Safe fix 4 4 | from .applications import FastAPI as FastAPI 5 5 | 6 6 | # F401 `background.BackgroundTasks` imported but unused @@ -30,7 +30,7 @@ F401_6.py:10:43: F401 [*] `.datastructures.UploadFile` imported but unused | = help: Remove unused import: `.datastructures.UploadFile` -ℹ Fix +ℹ Safe fix 7 7 | from .background import BackgroundTasks 8 8 | 9 9 | # F401 `datastructures.UploadFile` imported but unused @@ -49,7 +49,7 @@ F401_6.py:16:8: F401 [*] `background` imported but unused | = help: Remove unused import: `background` -ℹ Fix +ℹ Safe fix 13 13 | import applications as applications 14 14 | 15 15 | # F401 `background` imported but unused @@ -66,7 +66,7 @@ F401_6.py:19:26: F401 [*] `datastructures` imported but unused | = help: Remove unused import: `datastructures` -ℹ Fix +ℹ Safe 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 2966e7a542..cb4ec75028 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` -ℹ Fix +ℹ Safe fix 27 27 | # This should ignore the first error. 28 28 | from typing import ( 29 29 | Mapping, # noqa: F401 @@ -30,7 +30,7 @@ F401_7.py:66:20: F401 [*] `typing.Awaitable` imported but unused | = help: Remove unused import -ℹ Fix +ℹ Safe fix 63 63 | from typing import AsyncIterable, AsyncGenerator # noqa 64 64 | 65 65 | # This should mark F501 as unused. @@ -44,7 +44,7 @@ F401_7.py:66:31: F401 [*] `typing.AwaitableGenerator` imported but unused | = help: Remove unused import -ℹ Fix +ℹ Safe 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 88e03d15c2..c7071cc24f 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,7 @@ F401_9.py:4:22: F401 [*] `foo.baz` imported but unused | = help: Remove unused import: `foo.baz` -ℹ Fix +ℹ Safe 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__F504_F504.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F504_F504.py.snap index 8af7d0e85c..a04af93d12 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 -ℹ Fix +ℹ Safe 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) @@ -31,7 +31,7 @@ F504.py:8:1: F504 [*] `%`-format string has unused named argument(s): b | = help: Remove extra named arguments: b -ℹ Fix +ℹ Safe fix 5 5 | hidden = {"a": "!"} 6 6 | "%(a)s %(c)s" % {"x": 1, **hidden} # Ok (cannot see through splat) 7 7 | @@ -51,7 +51,7 @@ F504.py:9:1: F504 [*] `%`-format string has unused named argument(s): b | = help: Remove extra named arguments: b -ℹ Fix +ℹ Safe 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) @@ -72,7 +72,7 @@ F504.py:11:1: F504 [*] `%`-format string has unused named argument(s): ab | = help: Remove extra named arguments: ab -ℹ Fix +ℹ Safe 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 | @@ -92,7 +92,7 @@ F504.py:14:1: F504 [*] `%`-format string has unused named argument(s): test1, te | = help: Remove extra named arguments: test1, test2 -ℹ Fix +ℹ Safe 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 317942fa7e..8bcd33a080 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 -ℹ Fix +ℹ Safe 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 63d372c753..5e33645d06 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,7 @@ F522.py:1:1: F522 [*] `.format` call has unused named argument(s): bar | = help: Remove extra named arguments: bar -ℹ Fix +ℹ Safe fix 1 |-"{}".format(1, bar=2) # F522 1 |+"{}".format(1, ) # F522 2 2 | "{bar}{}".format(1, bar=2, spam=3) # F522 @@ -27,7 +27,7 @@ F522.py:2:1: F522 [*] `.format` call has unused named argument(s): spam | = help: Remove extra named arguments: spam -ℹ Fix +ℹ Safe fix 1 1 | "{}".format(1, bar=2) # F522 2 |-"{bar}{}".format(1, bar=2, spam=3) # F522 2 |+"{bar}{}".format(1, bar=2, ) # F522 @@ -46,7 +46,7 @@ F522.py:4:1: F522 [*] `.format` call has unused named argument(s): eggs, ham | = help: Remove extra named arguments: eggs, ham -ℹ Fix +ℹ Safe 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 @@ -66,7 +66,7 @@ F522.py:5:2: F522 [*] `.format` call has unused named argument(s): x | = help: Remove extra named arguments: x -ℹ Fix +ℹ Safe 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 875812f357..48ecf84655 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 -ℹ Fix +ℹ Safe fix 1 1 | # With indexes 2 |-"{0}".format(1, 2) # F523 2 |+"{0}".format(1, ) # F523 @@ -41,7 +41,7 @@ F523.py:5:1: F523 [*] `.format` call has unused arguments at position(s): 2 | = help: Remove extra positional arguments at position(s): 2 -ℹ Fix +ℹ Safe 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 @@ -61,7 +61,7 @@ F523.py:6:1: F523 [*] `.format` call has unused arguments at position(s): 1 | = help: Remove extra positional arguments at position(s): 1 -ℹ Fix +ℹ Safe 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 @@ -92,7 +92,7 @@ F523.py:10:1: F523 [*] `.format` call has unused arguments at position(s): 1 | = help: Remove extra positional arguments at position(s): 1 -ℹ Fix +ℹ Safe fix 7 7 | "{1.arg[1]!r:0{2['arg']}{1}}".format(1, 2, 3, 4) # F523 8 8 | 9 9 | # With no indexes @@ -113,7 +113,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 -ℹ Fix +ℹ Safe fix 8 8 | 9 9 | # With no indexes 10 10 | "{}".format(1, 2) # F523 @@ -134,7 +134,7 @@ F523.py:13:1: F523 [*] `.format` call has unused arguments at position(s): 2 | = help: Remove extra positional arguments at position(s): 2 -ℹ Fix +ℹ Safe fix 10 10 | "{}".format(1, 2) # F523 11 11 | "{}".format(1, 2, 3) # F523 12 12 | "{:{}}".format(1, 2) # No issues @@ -165,7 +165,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 -ℹ Fix +ℹ Safe fix 19 19 | "{0}{1}".format(1, 2, 3, *args) # F523 20 20 | 21 21 | # With nested quotes @@ -185,7 +185,7 @@ F523.py:23:1: F523 [*] `.format` call has unused arguments at position(s): 2 | = help: Remove extra positional arguments at position(s): 2 -ℹ Fix +ℹ Safe fix 20 20 | 21 21 | # With nested quotes 22 22 | "''1{0}".format(1, 2, 3) # F523 @@ -206,7 +206,7 @@ F523.py:24:1: F523 [*] `.format` call has unused arguments at position(s): 2 | = help: Remove extra positional arguments at position(s): 2 -ℹ Fix +ℹ Safe fix 21 21 | # With nested quotes 22 22 | "''1{0}".format(1, 2, 3) # F523 23 23 | "\"\"{1}{0}".format(1, 2, 3) # F523 @@ -257,7 +257,7 @@ F523.py:32:2: F523 [*] `.format` call has unused arguments at position(s): 0 | = help: Remove extra positional arguments at position(s): 0 -ℹ Fix +ℹ Safe 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 3ebd045142..ab3ce59d46 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 -ℹ Fix +ℹ Safe fix 3 3 | b = f"ghi{'jkl'}" 4 4 | 5 5 | # Errors @@ -32,7 +32,7 @@ F541.py:7:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 4 4 | 5 5 | # Errors 6 6 | c = f"def" @@ -53,7 +53,7 @@ F541.py:9:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 6 6 | c = f"def" 7 7 | d = f"def" + "ghi" 8 8 | e = ( @@ -74,7 +74,7 @@ F541.py:13:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 10 10 | "ghi" 11 11 | ) 12 12 | f = ( @@ -95,7 +95,7 @@ F541.py:14:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 11 11 | ) 12 12 | f = ( 13 13 | f"a" @@ -116,7 +116,7 @@ F541.py:16:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 13 13 | f"a" 14 14 | F"b" 15 15 | "c" @@ -137,7 +137,7 @@ F541.py:17:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 14 14 | F"b" 15 15 | "c" 16 16 | rf"d" @@ -158,7 +158,7 @@ F541.py:19:5: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 16 16 | rf"d" 17 17 | fr"e" 18 18 | ) @@ -178,7 +178,7 @@ F541.py:25:13: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 22 22 | g = f"ghi{123:{45}}" 23 23 | 24 24 | # Error @@ -198,7 +198,7 @@ F541.py:34:7: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 31 31 | f"{f'{v:0.2f}'}" 32 32 | 33 33 | # Errors @@ -219,7 +219,7 @@ F541.py:35:4: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 32 32 | 33 33 | # Errors 34 34 | f"{v:{f'0.2f'}}" @@ -240,7 +240,7 @@ F541.py:36:1: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 33 33 | # Errors 34 34 | f"{v:{f'0.2f'}}" 35 35 | f"{f''}" @@ -261,7 +261,7 @@ F541.py:37:1: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 34 34 | f"{v:{f'0.2f'}}" 35 35 | f"{f''}" 36 36 | f"{{test}}" @@ -282,7 +282,7 @@ F541.py:38:1: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 35 35 | f"{f''}" 36 36 | f"{{test}}" 37 37 | f'{{ 40 }}' @@ -303,7 +303,7 @@ F541.py:39:1: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 36 36 | f"{{test}}" 37 37 | f'{{ 40 }}' 38 38 | f"{{a {{x}}" @@ -324,7 +324,7 @@ F541.py:40:3: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 37 37 | f'{{ 40 }}' 38 38 | f"{{a {{x}}" 39 39 | f"{{{{x}}}}" @@ -345,7 +345,7 @@ F541.py:41:3: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 38 38 | f"{{a {{x}}" 39 39 | f"{{{{x}}}}" 40 40 | ""f"" @@ -366,7 +366,7 @@ F541.py:42:4: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 39 39 | f"{{{{x}}}}" 40 40 | ""f"" 41 41 | ''f"" @@ -385,7 +385,7 @@ F541.py:43:7: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe fix 40 40 | ""f"" 41 41 | ''f"" 42 42 | (""f""r"") @@ -402,7 +402,7 @@ F541.py:44:1: F541 [*] f-string without any placeholders | = help: Remove extraneous `f` prefix -ℹ Fix +ℹ Safe 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 f1d52d7d34..ace4761b43 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"` -ℹ Suggested fix +ℹ Unsafe fix 15 15 | "a": 1, 16 16 | "a": 2, 17 17 | "a": 3, @@ -118,7 +118,7 @@ F601.py:25:5: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -ℹ Suggested fix +ℹ Unsafe fix 22 22 | "a": 1, 23 23 | "a": 2, 24 24 | "a": 3, @@ -148,7 +148,7 @@ F601.py:31:5: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -ℹ Suggested fix +ℹ Unsafe fix 28 28 | 29 29 | x = { 30 30 | "a": 1, @@ -222,7 +222,7 @@ F601.py:45:5: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -ℹ Suggested fix +ℹ Unsafe fix 42 42 | a: 2, 43 43 | "a": 3, 44 44 | a: 3, @@ -241,7 +241,7 @@ F601.py:49:14: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -ℹ Suggested fix +ℹ Unsafe fix 46 46 | a: 4, 47 47 | } 48 48 | @@ -261,7 +261,7 @@ F601.py:50:22: F601 [*] Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -ℹ Suggested fix +ℹ Unsafe fix 47 47 | } 48 48 | 49 49 | x = {"a": 1, "a": 1} @@ -291,7 +291,7 @@ F601.py:58:19: F601 [*] Dictionary key literal `"x"` repeated | = help: Remove repeated key literal `"x"` -ℹ Suggested fix +ℹ Unsafe fix 55 55 | } 56 56 | 57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/4897 @@ -309,7 +309,7 @@ F601.py:60:21: F601 [*] Dictionary key literal `"x"` repeated | = help: Remove repeated key literal `"x"` -ℹ Suggested fix +ℹ Unsafe 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 378346592a..c092beeb97 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` -ℹ Suggested fix +ℹ Unsafe fix 10 10 | a: 1, 11 11 | a: 2, 12 12 | a: 3, @@ -86,7 +86,7 @@ F602.py:20:5: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -ℹ Suggested fix +ℹ Unsafe fix 17 17 | a: 1, 18 18 | a: 2, 19 19 | a: 3, @@ -116,7 +116,7 @@ F602.py:26:5: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -ℹ Suggested fix +ℹ Unsafe fix 23 23 | 24 24 | x = { 25 25 | a: 1, @@ -168,7 +168,7 @@ F602.py:35:5: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -ℹ Suggested fix +ℹ Unsafe fix 32 32 | x = { 33 33 | a: 1, 34 34 | "a": 1, @@ -219,7 +219,7 @@ F602.py:44:12: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -ℹ Suggested fix +ℹ Unsafe fix 41 41 | a: 4, 42 42 | } 43 43 | @@ -235,7 +235,7 @@ F602.py:45:18: F602 [*] Dictionary key `a` repeated | = help: Remove repeated key `a` -ℹ Suggested fix +ℹ Unsafe 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 c1d0d79dd1..df64acc457 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,7 @@ F632.py:1:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Fix +ℹ Safe fix 1 |-if x is "abc": 1 |+if x == "abc": 2 2 | pass @@ -26,7 +26,7 @@ F632.py:4:4: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -ℹ Fix +ℹ Safe fix 1 1 | if x is "abc": 2 2 | pass 3 3 | @@ -48,7 +48,7 @@ F632.py:7:4: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -ℹ Fix +ℹ Safe fix 4 4 | if 123 is not y: 5 5 | pass 6 6 | @@ -69,7 +69,7 @@ F632.py:11:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Fix +ℹ Safe fix 8 8 | not y: 9 9 | pass 10 10 | @@ -89,7 +89,7 @@ F632.py:14:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Fix +ℹ Safe fix 11 11 | if "123" is x < 3: 12 12 | pass 13 13 | @@ -109,7 +109,7 @@ F632.py:17:4: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Fix +ℹ Safe fix 14 14 | if "123" != x is 3: 15 15 | pass 16 16 | @@ -129,7 +129,7 @@ F632.py:20:14: F632 [*] Use `==` to compare constant literals | = help: Replace `is` with `==` -ℹ Fix +ℹ Safe fix 17 17 | if ("123" != x) is 3: 18 18 | pass 19 19 | @@ -152,7 +152,7 @@ F632.py:23:2: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -ℹ Fix +ℹ Safe fix 20 20 | if "123" != (x is 3): 21 21 | pass 22 22 | @@ -176,7 +176,7 @@ F632.py:26:2: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -ℹ Fix +ℹ Safe fix 23 23 | {2 is 24 24 | not ''} 25 25 | @@ -196,7 +196,7 @@ F632.py:30:4: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -ℹ Fix +ℹ Safe fix 27 27 | not ''} 28 28 | 29 29 | # Regression test for @@ -213,7 +213,7 @@ F632.py:30:11: F632 [*] Use `!=` to compare constant literals | = help: Replace `is not` with `!=` -ℹ Fix +ℹ Safe fix 27 27 | not ''} 28 28 | 29 29 | # Regression test for 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 e3f2fc6d02..3fc06720a7 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` -ℹ Fix +ℹ Safe fix 1 1 | try: 2 2 | 1 / 0 3 |-except ValueError as e: @@ -29,7 +29,7 @@ F841_0.py:16:5: F841 [*] Local variable `z` is assigned to but never used | = help: Remove assignment to unused variable `z` -ℹ Suggested fix +ℹ Unsafe fix 13 13 | def f(): 14 14 | x = 1 15 15 | y = 2 @@ -48,7 +48,7 @@ F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used | = help: Remove assignment to unused variable `foo` -ℹ Suggested fix +ℹ Unsafe fix 17 17 | 18 18 | 19 19 | def f(): @@ -88,7 +88,7 @@ F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used | = help: Remove assignment to unused variable `baz` -ℹ Suggested fix +ℹ Unsafe fix 23 23 | bar = (1, 2) 24 24 | (c, d) = bar 25 25 | @@ -109,7 +109,7 @@ F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -ℹ Suggested fix +ℹ Unsafe fix 48 48 | 49 49 | def c(): 50 50 | # F841 @@ -128,7 +128,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` -ℹ Suggested fix +ℹ Unsafe fix 76 76 | 77 77 | 78 78 | def f(): @@ -149,7 +149,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` -ℹ Suggested fix +ℹ Unsafe fix 82 82 | 83 83 | def f(): 84 84 | with ( @@ -170,7 +170,7 @@ F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used | = help: Remove assignment to unused variable `msg3` -ℹ Suggested fix +ℹ Unsafe fix 99 99 | def f(x: int): 100 100 | msg1 = "Hello, world!" 101 101 | msg2 = "Hello, world!" @@ -190,7 +190,7 @@ F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used | = help: Remove assignment to unused variable `Baz` -ℹ Suggested fix +ℹ Unsafe 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 9ddfa6f5d0..7985de9913 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 @@ -25,7 +25,7 @@ F841_1.py:16:14: F841 [*] Local variable `coords` is assigned to but never used | = help: Remove assignment to unused variable `coords` -ℹ Suggested fix +ℹ Unsafe fix 13 13 | 14 14 | 15 15 | def f(): @@ -43,7 +43,7 @@ F841_1.py:20:5: F841 [*] Local variable `coords` is assigned to but never used | = help: Remove assignment to unused variable `coords` -ℹ Suggested fix +ℹ Unsafe fix 17 17 | 18 18 | 19 19 | 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 7527c4e2cd..9a29ab4098 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` -ℹ Suggested fix +ℹ Unsafe fix 2 2 | 3 3 | 4 4 | def f(): @@ -30,7 +30,7 @@ F841_3.py:6:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -ℹ Suggested fix +ℹ Unsafe fix 3 3 | 4 4 | def f(): 5 5 | x = 1 @@ -48,7 +48,7 @@ F841_3.py:13:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -ℹ Suggested fix +ℹ Unsafe fix 10 10 | 11 11 | 12 12 | def f(): @@ -68,7 +68,7 @@ F841_3.py:14:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -ℹ Suggested fix +ℹ Unsafe fix 11 11 | 12 12 | def f(): 13 13 | x: int = 1 @@ -86,7 +86,7 @@ F841_3.py:21:19: F841 [*] Local variable `x1` is assigned to but never used | = help: Remove assignment to unused variable `x1` -ℹ Suggested fix +ℹ Unsafe fix 18 18 | 19 19 | 20 20 | def f(): @@ -106,7 +106,7 @@ F841_3.py:27:20: F841 [*] Local variable `x3` is assigned to but never used | = help: Remove assignment to unused variable `x3` -ℹ Suggested fix +ℹ Unsafe fix 24 24 | with foo() as (x2, y2): 25 25 | pass 26 26 | @@ -126,7 +126,7 @@ F841_3.py:27:33: F841 [*] Local variable `y3` is assigned to but never used | = help: Remove assignment to unused variable `y3` -ℹ Suggested fix +ℹ Unsafe fix 24 24 | with foo() as (x2, y2): 25 25 | pass 26 26 | @@ -146,7 +146,7 @@ F841_3.py:27:46: F841 [*] Local variable `z3` is assigned to but never used | = help: Remove assignment to unused variable `z3` -ℹ Suggested fix +ℹ Unsafe fix 24 24 | with foo() as (x2, y2): 25 25 | pass 26 26 | @@ -186,7 +186,7 @@ F841_3.py:33:16: F841 [*] Local variable `coords2` is assigned to but never used | = help: Remove assignment to unused variable `coords2` -ℹ Suggested fix +ℹ Unsafe fix 30 30 | 31 31 | def f(): 32 32 | (x1, y1) = (1, 2) @@ -205,7 +205,7 @@ F841_3.py:34:5: F841 [*] Local variable `coords3` is assigned to but never used | = help: Remove assignment to unused variable `coords3` -ℹ Suggested fix +ℹ Unsafe fix 31 31 | def f(): 32 32 | (x1, y1) = (1, 2) 33 33 | (x2, y2) = coords2 = (1, 2) @@ -225,7 +225,7 @@ F841_3.py:40:26: F841 [*] Local variable `x1` is assigned to but never used | = help: Remove assignment to unused variable `x1` -ℹ Fix +ℹ Safe fix 37 37 | def f(): 38 38 | try: 39 39 | 1 / 0 @@ -245,7 +245,7 @@ F841_3.py:45:47: F841 [*] Local variable `x2` is assigned to but never used | = help: Remove assignment to unused variable `x2` -ℹ Fix +ℹ Safe fix 42 42 | 43 43 | try: 44 44 | 1 / 0 @@ -265,7 +265,7 @@ F841_3.py:50:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -ℹ Suggested fix +ℹ Unsafe fix 47 47 | 48 48 | 49 49 | def f(a, b): @@ -285,7 +285,7 @@ F841_3.py:56:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -ℹ Suggested fix +ℹ Unsafe fix 53 53 | else b 54 54 | ) 55 55 | @@ -306,7 +306,7 @@ F841_3.py:61:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -ℹ Suggested fix +ℹ Unsafe fix 58 58 | 59 59 | 60 60 | def f(a, b): @@ -329,7 +329,7 @@ F841_3.py:67:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -ℹ Suggested fix +ℹ Unsafe fix 64 64 | else b 65 65 | ) 66 66 | @@ -348,7 +348,7 @@ F841_3.py:72:24: F841 [*] Local variable `cm` is assigned to but never used | = help: Remove assignment to unused variable `cm` -ℹ Suggested fix +ℹ Unsafe fix 69 69 | 70 70 | 71 71 | def f(): @@ -367,7 +367,7 @@ F841_3.py:77:25: F841 [*] Local variable `cm` is assigned to but never used | = help: Remove assignment to unused variable `cm` -ℹ Suggested fix +ℹ Unsafe fix 74 74 | 75 75 | 76 76 | def f(): @@ -386,7 +386,7 @@ F841_3.py:87:26: F841 [*] Local variable `cm` is assigned to but never used | = help: Remove assignment to unused variable `cm` -ℹ Suggested fix +ℹ Unsafe fix 84 84 | 85 85 | 86 86 | def f(): @@ -406,7 +406,7 @@ F841_3.py:92:5: F841 [*] Local variable `toplevel` is assigned to but never used | = help: Remove assignment to unused variable `toplevel` -ℹ Suggested fix +ℹ Unsafe fix 89 89 | 90 90 | 91 91 | def f(): @@ -424,7 +424,7 @@ F841_3.py:98:5: F841 [*] Local variable `toplevel` is assigned to but never used | = help: Remove assignment to unused variable `toplevel` -ℹ Suggested fix +ℹ Unsafe fix 95 95 | 96 96 | 97 97 | def f(): @@ -442,7 +442,7 @@ F841_3.py:98:16: F841 [*] Local variable `tt` is assigned to but never used | = help: Remove assignment to unused variable `tt` -ℹ Suggested fix +ℹ Unsafe fix 95 95 | 96 96 | 97 97 | def f(): @@ -460,7 +460,7 @@ F841_3.py:102:5: F841 [*] Local variable `toplevel` is assigned to but never use | = help: Remove assignment to unused variable `toplevel` -ℹ Suggested fix +ℹ Unsafe fix 99 99 | 100 100 | 101 101 | def f(): @@ -478,7 +478,7 @@ F841_3.py:106:14: F841 [*] Local variable `toplevel` is assigned to but never us | = help: Remove assignment to unused variable `toplevel` -ℹ Suggested fix +ℹ Unsafe fix 103 103 | 104 104 | 105 105 | def f(): @@ -496,7 +496,7 @@ F841_3.py:110:5: F841 [*] Local variable `toplevel` is assigned to but never use | = help: Remove assignment to unused variable `toplevel` -ℹ Suggested fix +ℹ Unsafe fix 107 107 | 108 108 | 109 109 | def f(): @@ -514,7 +514,7 @@ F841_3.py:110:16: F841 [*] Local variable `tt` is assigned to but never used | = help: Remove assignment to unused variable `tt` -ℹ Suggested fix +ℹ Unsafe fix 107 107 | 108 108 | 109 109 | def f(): @@ -594,7 +594,7 @@ F841_3.py:155:17: F841 [*] Local variable `e` is assigned to but never used | = help: Remove assignment to unused variable `e` -ℹ Fix +ℹ Safe fix 152 152 | def f() -> None: 153 153 | try: 154 154 | print("hello") @@ -613,7 +613,7 @@ F841_3.py:160:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -ℹ Suggested fix +ℹ Unsafe fix 157 157 | 158 158 | 159 159 | def f(): @@ -631,7 +631,7 @@ F841_3.py:161:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -ℹ Suggested fix +ℹ Unsafe fix 158 158 | 159 159 | def f(): 160 160 | x = 1 @@ -650,7 +650,7 @@ F841_3.py:165:5: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -ℹ Suggested fix +ℹ Unsafe fix 162 162 | 163 163 | 164 164 | def f(): @@ -668,7 +668,7 @@ F841_3.py:167:5: F841 [*] Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -ℹ Suggested fix +ℹ Unsafe fix 164 164 | def f(): 165 165 | x = 1 166 166 | @@ -686,7 +686,7 @@ F841_3.py:173:6: F841 [*] Local variable `x` is assigned to but never used | = help: Remove assignment to unused variable `x` -ℹ Suggested fix +ℹ Unsafe 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 f11e0a7a6e..f5f7f03e01 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` -ℹ Suggested fix +ℹ Unsafe 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 1fdcc0fa9e..59889e1176 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` -ℹ Fix +ℹ Safe fix 1 1 | def f() -> None: 2 |- raise NotImplemented() 2 |+ raise NotImplementedError() @@ -25,7 +25,7 @@ F901.py:6:11: F901 [*] `raise NotImplemented` should be `raise NotImplementedErr | = help: Use `raise NotImplementedError` -ℹ Fix +ℹ Safe fix 3 3 | 4 4 | 5 5 | def g() -> None: 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 db057c4e41..2ac6d0d487 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` -ℹ Fix +ℹ Safe 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 b12f87c98f..85e1d7d06f 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,7 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove unused import: `os` -ℹ Fix +ℹ Safe 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_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 6a0b807ddc..8a7530cecd 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,7 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove unused import: `os` -ℹ Fix +ℹ Safe fix 1 1 | 2 |-import os 3 2 | 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 c117fdff6e..1d6434c4e2 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` -ℹ Fix +ℹ Safe fix 1 1 | try: 2 2 | 1 / 0 3 |-except ValueError as e: @@ -29,7 +29,7 @@ F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used | = help: Remove assignment to unused variable `foo` -ℹ Suggested fix +ℹ Unsafe fix 17 17 | 18 18 | 19 19 | def f(): @@ -69,7 +69,7 @@ F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used | = help: Remove assignment to unused variable `baz` -ℹ Suggested fix +ℹ Unsafe fix 23 23 | bar = (1, 2) 24 24 | (c, d) = bar 25 25 | @@ -89,7 +89,7 @@ F841_0.py:35:5: F841 [*] Local variable `_` is assigned to but never used | = help: Remove assignment to unused variable `_` -ℹ Suggested fix +ℹ Unsafe fix 32 32 | 33 33 | 34 34 | def f(): @@ -108,7 +108,7 @@ F841_0.py:36:5: F841 [*] Local variable `__` is assigned to but never used | = help: Remove assignment to unused variable `` -ℹ Suggested fix +ℹ Unsafe fix 33 33 | 34 34 | def f(): 35 35 | _ = 1 @@ -126,7 +126,7 @@ F841_0.py:37:5: F841 [*] Local variable `_discarded` is assigned to but never us | = help: Remove assignment to unused variable `_discarded` -ℹ Suggested fix +ℹ Unsafe fix 34 34 | def f(): 35 35 | _ = 1 36 36 | __ = 1 @@ -146,7 +146,7 @@ F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -ℹ Suggested fix +ℹ Unsafe fix 48 48 | 49 49 | def c(): 50 50 | # F841 @@ -165,7 +165,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` -ℹ Suggested fix +ℹ Unsafe fix 76 76 | 77 77 | 78 78 | def f(): @@ -186,7 +186,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` -ℹ Suggested fix +ℹ Unsafe fix 82 82 | 83 83 | def f(): 84 84 | with ( @@ -207,7 +207,7 @@ F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used | = help: Remove assignment to unused variable `msg3` -ℹ Suggested fix +ℹ Unsafe fix 99 99 | def f(x: int): 100 100 | msg1 = "Hello, world!" 101 101 | msg2 = "Hello, world!" @@ -227,7 +227,7 @@ F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used | = help: Remove assignment to unused variable `Baz` -ℹ Suggested fix +ℹ Unsafe fix 112 112 | 113 113 | Foo = enum.Enum("Foo", "A B") 114 114 | Bar = enum.Enum("Bar", "A B") @@ -266,7 +266,7 @@ F841_0.py:152:25: F841 [*] Local variable `_` is assigned to but never used | = help: Remove assignment to unused variable `_` -ℹ Fix +ℹ Safe 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 b2a263440e..5a15b08987 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` -ℹ Fix +ℹ Safe 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 9f47661f4a..8963cbc2ec 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` -ℹ Fix +ℹ Safe fix 4 4 | def f(): 5 5 | try: 6 6 | pass @@ -31,7 +31,7 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -ℹ Fix +ℹ Safe 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 9b02cf258f..30714ade29 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` -ℹ Fix +ℹ Safe 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 4cf6d6b2ae..1a45bebe8c 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` -ℹ Fix +ℹ Safe 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 9776a1ff88..f2885ba2b5 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` -ℹ Fix +ℹ Safe fix 4 4 | def f(): 5 5 | try: 6 6 | pass @@ -31,7 +31,7 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -ℹ Fix +ℹ Safe 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 2209227eb9..c2e289a7ef 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` -ℹ Fix +ℹ Safe fix 1 1 | if True: 2 |- import foo1; x = 1 2 |+ x = 1 @@ -29,7 +29,7 @@ multi_statement_lines.py:3:12: F401 [*] `foo2` imported but unused | = help: Remove unused import: `foo2` -ℹ Fix +ℹ Safe fix 1 1 | if True: 2 2 | import foo1; x = 1 3 |- import foo2; x = 1 @@ -47,7 +47,7 @@ multi_statement_lines.py:6:12: F401 [*] `foo3` imported but unused | = help: Remove unused import: `foo3` -ℹ Fix +ℹ Safe fix 3 3 | import foo2; x = 1 4 4 | 5 5 | if True: @@ -67,7 +67,7 @@ multi_statement_lines.py:10:12: F401 [*] `foo4` imported but unused | = help: Remove unused import: `foo4` -ℹ Fix +ℹ Safe fix 7 7 | x = 1 8 8 | 9 9 | if True: @@ -86,7 +86,7 @@ multi_statement_lines.py:14:19: F401 [*] `foo5` imported but unused | = help: Remove unused import: `foo5` -ℹ Fix +ℹ Safe fix 11 11 | ; x = 1 12 12 | 13 13 | if True: @@ -107,7 +107,7 @@ multi_statement_lines.py:19:17: F401 [*] `foo6` imported but unused | = help: Remove unused import: `foo6` -ℹ Fix +ℹ Safe fix 15 15 | 16 16 | 17 17 | if True: @@ -129,7 +129,7 @@ multi_statement_lines.py:23:18: F401 [*] `foo7` imported but unused | = help: Remove unused import: `foo7` -ℹ Fix +ℹ Safe fix 20 20 | 21 21 | if True: 22 22 | x = 1 \ @@ -148,7 +148,7 @@ multi_statement_lines.py:26:19: F401 [*] `foo8` imported but unused | = help: Remove unused import: `foo8` -ℹ Fix +ℹ Safe fix 23 23 | ; import foo7 24 24 | 25 25 | if True: @@ -169,7 +169,7 @@ multi_statement_lines.py:27:23: F401 [*] `foo9` imported but unused | = help: Remove unused import: `foo9` -ℹ Fix +ℹ Safe fix 24 24 | 25 25 | if True: 26 26 | x = 1; import foo8; x = 1 @@ -189,7 +189,7 @@ multi_statement_lines.py:31:16: F401 [*] `foo10` imported but unused | = help: Remove unused import: `foo10` -ℹ Fix +ℹ Safe fix 28 28 | 29 29 | if True: 30 30 | x = 1; \ @@ -210,7 +210,7 @@ multi_statement_lines.py:36:17: F401 [*] `foo11` imported but unused | = help: Remove unused import: `foo11` -ℹ Fix +ℹ Safe fix 33 33 | 34 34 | if True: 35 35 | x = 1 \ @@ -230,7 +230,7 @@ multi_statement_lines.py:42:16: F401 [*] `foo12` imported but unused | = help: Remove unused import: `foo12` -ℹ Fix +ℹ Safe fix 37 37 | ;x = 1 38 38 | 39 39 | if True: @@ -251,7 +251,7 @@ multi_statement_lines.py:47:12: F401 [*] `foo13` imported but unused | = help: Remove unused import: `foo13` -ℹ Fix +ℹ Safe fix 42 42 | import foo12 43 43 | 44 44 | if True: @@ -274,7 +274,7 @@ multi_statement_lines.py:53:12: F401 [*] `foo14` imported but unused | = help: Remove unused import: `foo14` -ℹ Fix +ℹ Safe fix 50 50 | if True: 51 51 | x = 1; \ 52 52 | # \ @@ -294,7 +294,7 @@ multi_statement_lines.py:57:8: F401 [*] `foo15` imported but unused | = help: Remove unused import: `foo15` -ℹ Fix +ℹ Safe fix 53 53 | import foo14 54 54 | 55 55 | # Continuation, but not as the last content in the file. @@ -314,7 +314,7 @@ multi_statement_lines.py:62:8: F401 [*] `foo16` imported but unused | = help: Remove unused import: `foo16` -ℹ Fix +ℹ Safe 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__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 1627e74b9a..f781c31d82 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` -ℹ Suggested fix +ℹ Unsafe fix 9 9 | 10 10 | 11 11 | def bar(): 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 9de966e2c5..45cdf09182 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` -ℹ Fix +ℹ Safe fix 4 4 | 5 5 | try: 6 6 | 1 / 0 @@ -32,7 +32,7 @@ source: crates/ruff_linter/src/rules/pyflakes/mod.rs | = help: Remove assignment to unused variable `x` -ℹ Fix +ℹ Safe 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 28c8c0638a..32d67c3669 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` -ℹ Fix +ℹ Safe fix 4 4 | 5 5 | try: 6 6 | 1 / 0 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 91fa2dc50a..68b9aa856d 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` -ℹ Fix +ℹ Safe fix 1 1 | # Errors 2 2 | 3 |-for item in {1}: @@ -30,7 +30,7 @@ iteration_over_set.py:6:13: PLC0208 [*] Use a sequence type instead of a `set` w | = help: Convert to `tuple` -ℹ Fix +ℹ Safe fix 3 3 | for item in {1}: 4 4 | print(f"I can count to {item}!") 5 5 | @@ -50,7 +50,7 @@ iteration_over_set.py:9:13: PLC0208 [*] Use a sequence type instead of a `set` w | = help: Convert to `tuple` -ℹ Fix +ℹ Safe fix 6 6 | for item in {"apples", "lemons", "water"}: # flags in-line set literals 7 7 | print(f"I like {item}.") 8 8 | @@ -73,7 +73,7 @@ iteration_over_set.py:12:13: PLC0208 [*] Use a sequence type instead of a `set` | = help: Convert to `tuple` -ℹ Fix +ℹ Safe fix 9 9 | for item in {1,}: 10 10 | print(f"I can count to {item}!") 11 11 | @@ -97,7 +97,7 @@ iteration_over_set.py:17:28: PLC0208 [*] Use a sequence type instead of a `set` | = help: Convert to `tuple` -ℹ Fix +ℹ Safe fix 14 14 | }: # flags in-line set literals 15 15 | print(f"I like {item}.") 16 16 | @@ -118,7 +118,7 @@ iteration_over_set.py:19:27: PLC0208 [*] Use a sequence type instead of a `set` | = help: Convert to `tuple` -ℹ Fix +ℹ Safe fix 16 16 | 17 17 | numbers_list = [i for i in {1, 2, 3}] # flags sets in list comprehensions 18 18 | @@ -139,7 +139,7 @@ iteration_over_set.py:21:36: PLC0208 [*] Use a sequence type instead of a `set` | = help: Convert to `tuple` -ℹ Fix +ℹ Safe fix 18 18 | 19 19 | numbers_set = {i for i in {1, 2, 3}} # flags sets in set comprehensions 20 20 | @@ -160,7 +160,7 @@ iteration_over_set.py:23:27: PLC0208 [*] Use a sequence type instead of a `set` | = help: Convert to `tuple` -ℹ Fix +ℹ Safe 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 800e9671d8..ac761dd336 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 -ℹ Suggested fix +ℹ Unsafe fix 3 3 | # 1. useless-import-alias 4 4 | # 2. consider-using-from-import 5 5 | @@ -32,7 +32,7 @@ import_aliasing.py:7:25: PLC0414 [*] Import alias does not rename original packa | = help: Remove import alias -ℹ Suggested fix +ℹ Unsafe fix 4 4 | # 2. consider-using-from-import 5 5 | 6 6 | import collections as collections # [useless-import-alias] @@ -53,7 +53,7 @@ import_aliasing.py:16:15: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -ℹ Suggested fix +ℹ Unsafe fix 13 13 | import os 14 14 | import os as OS 15 15 | from sys import version @@ -74,7 +74,7 @@ import_aliasing.py:19:19: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -ℹ Suggested fix +ℹ Unsafe fix 16 16 | from . import bar as bar # [useless-import-alias] 17 17 | from . import bar as Bar 18 18 | from . import bar @@ -95,7 +95,7 @@ import_aliasing.py:20:23: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -ℹ Suggested fix +ℹ Unsafe fix 17 17 | from . import bar as Bar 18 18 | from . import bar 19 19 | from ..foo import bar as bar # [useless-import-alias] @@ -116,7 +116,7 @@ import_aliasing.py:22:15: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -ℹ Suggested fix +ℹ Unsafe 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 @@ -137,7 +137,7 @@ import_aliasing.py:23:27: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -ℹ Suggested fix +ℹ Unsafe 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] @@ -158,7 +158,7 @@ import_aliasing.py:25:21: PLC0414 [*] Import alias does not rename original pack | = help: Remove import alias -ℹ Suggested fix +ℹ Unsafe 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__PLE2510_invalid_characters.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLE2510_invalid_characters.py.snap index b472b75871..707794f942 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 -ℹ Fix +ℹ Safe fix 12 12 | # (Pylint, "C0414") => Rule::UselessImportAlias, 13 13 | # (Pylint, "C3002") => Rule::UnnecessaryDirectLambdaCall, 14 14 | #foo = 'hi' @@ -32,7 +32,7 @@ invalid_characters.py:16:7: PLE2510 [*] Invalid unescaped character backspace, u | = help: Replace with escape sequence -ℹ Fix +ℹ Safe fix 13 13 | # (Pylint, "C3002") => Rule::UnnecessaryDirectLambdaCall, 14 14 | #foo = 'hi' 15 15 | b = '' @@ -53,7 +53,7 @@ invalid_characters.py:55:21: PLE2510 [*] Invalid unescaped character backspace, | = help: Replace with escape sequence -ℹ Fix +ℹ Safe 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 aca79fabc8..78d0e18d72 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 -ℹ Fix +ℹ Safe fix 21 21 | cr_ok = '\\r' 22 22 | cr_ok = f'\\r' 23 23 | @@ -31,7 +31,7 @@ invalid_characters.py:25:13: PLE2512 [*] Invalid unescaped character SUB, use "\ | = help: Replace with escape sequence -ℹ Fix +ℹ Safe fix 22 22 | cr_ok = f'\\r' 23 23 | 24 24 | sub = 'sub ' @@ -52,7 +52,7 @@ invalid_characters.py:55:25: PLE2512 [*] Invalid unescaped character SUB, use "\ | = help: Replace with escape sequence -ℹ Fix +ℹ Safe fix 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 54 54 | @@ -72,7 +72,7 @@ invalid_characters.py:58:12: PLE2512 [*] Invalid unescaped character SUB, use "\ | = help: Replace with escape sequence -ℹ Fix +ℹ Safe 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 87dd00ef51..2c684a1a77 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 -ℹ Fix +ℹ Safe fix 27 27 | sub_ok = '\x1a' 28 28 | sub_ok = f'\x1a' 29 29 | @@ -31,7 +31,7 @@ invalid_characters.py:31:17: PLE2513 [*] Invalid unescaped character ESC, use "\ | = help: Replace with escape sequence -ℹ Fix +ℹ Safe fix 28 28 | sub_ok = f'\x1a' 29 29 | 30 30 | esc = 'esc esc ' @@ -52,7 +52,7 @@ invalid_characters.py:55:29: PLE2513 [*] Invalid unescaped character ESC, use "\ | = help: Replace with escape sequence -ℹ Fix +ℹ Safe fix 52 52 | zwsp_after_multicharacter_grapheme_cluster = "ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 53 53 | zwsp_after_multicharacter_grapheme_cluster = f"ಫ್ರಾನ್ಸಿಸ್ಕೊ ​​" 54 54 | @@ -71,7 +71,7 @@ invalid_characters.py:60:12: PLE2513 [*] Invalid unescaped character ESC, use "\ | = help: Replace with escape sequence -ℹ Fix +ℹ Safe 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 0227171c311f933297bc3fe5571b41ba8fb98962..3ab1a52ec4958bb83546a3b43e2f688ca4a4c373 100644 GIT binary patch delta 36 ncmbQwwvugwBqLjJVp^&~+GZ)n0!9u9JF{Z49i!Of#Y{B-#moxx delta 20 acmZ3 bool: @@ -135,7 +135,7 @@ and_or_ternary.py:61:18: PLR1706 [*] Consider using if-else expression (`(b if a | = help: Convert to if-else expression -ℹ Suggested fix +ℹ Unsafe fix 58 58 | def has_oranges(oranges, apples=None) -> bool: 59 59 | return apples and False or oranges 60 60 | @@ -156,7 +156,7 @@ and_or_ternary.py:63:21: PLR1706 [*] Consider using if-else expression (`(b if a | = help: Convert to if-else expression -ℹ Suggested fix +ℹ Unsafe fix 60 60 | 61 61 | [x for x in l if a and b or c] 62 62 | @@ -177,7 +177,7 @@ and_or_ternary.py:65:18: PLR1706 [*] Consider using if-else expression (`(b if a | = help: Convert to if-else expression -ℹ Suggested fix +ℹ Unsafe fix 62 62 | 63 63 | {x: y for x in l if a and b or c} 64 64 | @@ -198,7 +198,7 @@ and_or_ternary.py:70:8: PLR1706 [*] Consider using if-else expression (`(b if a | = help: Convert to if-else expression -ℹ Suggested fix +ℹ Unsafe fix 67 67 | new_list = [ 68 68 | x 69 69 | for sublist in all_lists @@ -218,7 +218,7 @@ and_or_ternary.py:72:8: PLR1706 [*] Consider using if-else expression | = help: Convert to if-else expression -ℹ Suggested fix +ℹ Unsafe fix 69 69 | for sublist in all_lists 70 70 | if a and b or c 71 71 | for x in sublist 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 726973dc33..cf914458f4 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 -ℹ Fix +ℹ Safe fix 3 3 | 4 4 | def print_python_version(): 5 5 | print(sys.version) @@ -28,7 +28,7 @@ useless_return.py:11:5: PLR1711 [*] Useless `return` statement at end of functio | = help: Remove useless `return` statement -ℹ Fix +ℹ Safe fix 8 8 | 9 9 | def print_python_version(): 10 10 | print(sys.version) @@ -46,7 +46,7 @@ useless_return.py:16:5: PLR1711 [*] Useless `return` statement at end of functio | = help: Remove useless `return` statement -ℹ Fix +ℹ Safe fix 13 13 | 14 14 | def print_python_version(): 15 15 | print(sys.version) @@ -64,7 +64,7 @@ useless_return.py:22:9: PLR1711 [*] Useless `return` statement at end of functio | = help: Remove useless `return` statement -ℹ Fix +ℹ Safe fix 19 19 | class SomeClass: 20 20 | def print_python_version(self): 21 21 | print(sys.version) @@ -82,7 +82,7 @@ useless_return.py:50:5: PLR1711 [*] Useless `return` statement at end of functio | = help: Remove useless `return` statement -ℹ Fix +ℹ Safe fix 47 47 | def print_python_version(): 48 48 | """This function returns None.""" 49 49 | print(sys.version) @@ -100,7 +100,7 @@ useless_return.py:60:9: PLR1711 [*] Useless `return` statement at end of functio | = help: Remove useless `return` statement -ℹ Fix +ℹ Safe 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 6d7914a092..a8fdf5a6e0 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 -ℹ Suggested fix +ℹ Unsafe fix 1 1 | # Errors. 2 |-foo == "a" or foo == "b" 2 |+foo in ("a", "b") @@ -30,7 +30,7 @@ repeated_equality_comparison.py:4:1: PLR1714 [*] Consider merging multiple compa | = help: Merge multiple comparisons -ℹ Suggested fix +ℹ Unsafe fix 1 1 | # Errors. 2 2 | foo == "a" or foo == "b" 3 3 | @@ -51,7 +51,7 @@ repeated_equality_comparison.py:6:1: PLR1714 [*] Consider merging multiple compa | = help: Merge multiple comparisons -ℹ Suggested fix +ℹ Unsafe fix 3 3 | 4 4 | foo != "a" and foo != "b" 5 5 | @@ -72,7 +72,7 @@ repeated_equality_comparison.py:8:1: PLR1714 [*] Consider merging multiple compa | = help: Merge multiple comparisons -ℹ Suggested fix +ℹ Unsafe fix 5 5 | 6 6 | foo == "a" or foo == "b" or foo == "c" 7 7 | @@ -93,7 +93,7 @@ repeated_equality_comparison.py:10:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Suggested fix +ℹ Unsafe fix 7 7 | 8 8 | foo != "a" and foo != "b" and foo != "c" 9 9 | @@ -114,7 +114,7 @@ repeated_equality_comparison.py:12:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Suggested fix +ℹ Unsafe fix 9 9 | 10 10 | foo == a or foo == "b" or foo == 3 # Mixed types. 11 11 | @@ -135,7 +135,7 @@ repeated_equality_comparison.py:14:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Suggested fix +ℹ Unsafe fix 11 11 | 12 12 | "a" == foo or "b" == foo or "c" == foo 13 13 | @@ -156,7 +156,7 @@ repeated_equality_comparison.py:16:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Suggested fix +ℹ Unsafe fix 13 13 | 14 14 | "a" != foo and "b" != foo and "c" != foo 15 15 | @@ -177,7 +177,7 @@ repeated_equality_comparison.py:18:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Suggested fix +ℹ Unsafe fix 15 15 | 16 16 | "a" == foo or foo == "b" or "c" == foo 17 17 | @@ -198,7 +198,7 @@ repeated_equality_comparison.py:20:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Suggested fix +ℹ Unsafe fix 17 17 | 18 18 | foo == bar or baz == foo or qux == foo 19 19 | @@ -219,7 +219,7 @@ repeated_equality_comparison.py:22:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Suggested fix +ℹ Unsafe fix 19 19 | 20 20 | foo == "a" or "b" == foo or foo == "c" 21 21 | @@ -240,7 +240,7 @@ repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Suggested fix +ℹ Unsafe fix 21 21 | 22 22 | foo != "a" and "b" != foo and foo != "c" 23 23 | @@ -261,7 +261,7 @@ repeated_equality_comparison.py:24:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Suggested fix +ℹ Unsafe fix 21 21 | 22 22 | foo != "a" and "b" != foo and foo != "c" 23 23 | @@ -282,7 +282,7 @@ repeated_equality_comparison.py:26:1: PLR1714 [*] Consider merging multiple comp | = help: Merge multiple comparisons -ℹ Suggested fix +ℹ Unsafe fix 23 23 | 24 24 | foo == "a" or foo == "b" or "c" == bar or "d" == bar # Multiple targets 25 25 | 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 397b48cabc..290c2cc893 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()` -ℹ Suggested fix +ℹ Unsafe fix 1 |-exit(0) 1 |+import sys 2 |+sys.exit(0) @@ -25,7 +25,7 @@ sys_exit_alias_0.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe fix 1 |+import sys 1 2 | exit(0) 2 |-quit(0) @@ -43,7 +43,7 @@ sys_exit_alias_0.py:6:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe fix 1 |+import sys 1 2 | exit(0) 2 3 | quit(0) @@ -63,7 +63,7 @@ sys_exit_alias_0.py:7:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe 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 aa9c93714b..f2124e8ded 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()` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import sys 2 2 | 3 |-exit(0) @@ -28,7 +28,7 @@ sys_exit_alias_1.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import sys 2 2 | 3 3 | exit(0) @@ -47,7 +47,7 @@ sys_exit_alias_1.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe fix 5 5 | 6 6 | 7 7 | def main(): @@ -66,7 +66,7 @@ sys_exit_alias_1.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe 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 0fd61d5d82..4f537fcd13 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,7 @@ sys_exit_alias_11.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe 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 24108309b0..8221f82db5 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,7 @@ sys_exit_alias_12.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe 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 18c4cb9ace..d5faaa92da 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()` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import sys as sys2 2 2 | 3 |-exit(0) @@ -28,7 +28,7 @@ sys_exit_alias_2.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import sys as sys2 2 2 | 3 3 | exit(0) @@ -47,7 +47,7 @@ sys_exit_alias_2.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe fix 5 5 | 6 6 | 7 7 | def main(): @@ -64,7 +64,7 @@ sys_exit_alias_2.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe 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 183ad4c910..c7faa956b3 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()` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | from sys import exit 2 2 | 3 3 | exit(0) @@ -28,7 +28,7 @@ sys_exit_alias_3.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe 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 8b17e15119..9a41754444 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()` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | from sys import exit as exit2 2 2 | 3 |-exit(0) @@ -28,7 +28,7 @@ sys_exit_alias_4.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | from sys import exit as exit2 2 2 | 3 3 | exit(0) @@ -47,7 +47,7 @@ sys_exit_alias_4.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe fix 5 5 | 6 6 | 7 7 | def main(): @@ -64,7 +64,7 @@ sys_exit_alias_4.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe 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 80b8423a35..8a6bbc5f3e 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()` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | from sys import * 2 |+import sys 2 3 | @@ -29,7 +29,7 @@ sys_exit_alias_5.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | from sys import * 2 |+import sys 2 3 | @@ -49,7 +49,7 @@ sys_exit_alias_5.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | from sys import * 2 |+import sys 2 3 | @@ -71,7 +71,7 @@ sys_exit_alias_5.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe 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 b257b7b923..87119e0665 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()` -ℹ Suggested fix +ℹ Unsafe fix 1 |-exit(0) 1 |+import sys 2 |+sys.exit(0) @@ -25,7 +25,7 @@ sys_exit_alias_6.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | = help: Replace `quit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe 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 5d64c2ee63..4c32e7cc3a 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()` -ℹ Suggested fix +ℹ Unsafe 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 fa796c091f..1423a41dba 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,7 @@ sys_exit_alias_8.py:5:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | = help: Replace `exit` with `sys.exit()` -ℹ Suggested fix +ℹ Unsafe 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 99d5f3389f..23107f6066 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()` -ℹ Suggested fix +ℹ Unsafe 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__PLR6201_literal_membership.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR6201_literal_membership.py.snap index 94506940a6..fd156530a2 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 memb | = help: Convert to `set` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | # Errors 2 |-1 in [1, 2, 3] 2 |+1 in {1, 2, 3} @@ -30,7 +30,7 @@ literal_membership.py:3:6: PLR6201 [*] Use a `set` literal when testing for memb | = help: Convert to `set` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | # Errors 2 2 | 1 in [1, 2, 3] 3 |-1 in (1, 2, 3) @@ -53,7 +53,7 @@ literal_membership.py:4:6: PLR6201 [*] Use a `set` literal when testing for memb | = help: Convert to `set` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | # Errors 2 2 | 1 in [1, 2, 3] 3 3 | 1 in (1, 2, 3) 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 268f805ab8..399812b7d6 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 -ℹ Suggested fix +ℹ Unsafe fix 1 1 | min(1, 2, 3) 2 |-min(1, min(2, 3)) 2 |+min(1, 2, 3) @@ -30,7 +30,7 @@ nested_min_max.py:3:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -ℹ Suggested fix +ℹ Unsafe fix 1 1 | min(1, 2, 3) 2 2 | min(1, min(2, 3)) 3 |-min(1, min(2, min(3, 4))) @@ -50,7 +50,7 @@ nested_min_max.py:3:8: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -ℹ Suggested fix +ℹ Unsafe fix 1 1 | min(1, 2, 3) 2 2 | min(1, min(2, 3)) 3 |-min(1, min(2, min(3, 4))) @@ -70,7 +70,7 @@ nested_min_max.py:4:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -ℹ Suggested fix +ℹ Unsafe fix 1 1 | min(1, 2, 3) 2 2 | min(1, min(2, 3)) 3 3 | min(1, min(2, min(3, 4))) @@ -91,7 +91,7 @@ nested_min_max.py:7:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -ℹ Suggested fix +ℹ Unsafe fix 4 4 | min(1, foo("a", "b"), min(3, 4)) 5 5 | min(1, max(2, 3)) 6 6 | max(1, 2, 3) @@ -111,7 +111,7 @@ nested_min_max.py:8:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -ℹ Suggested fix +ℹ Unsafe fix 5 5 | min(1, max(2, 3)) 6 6 | max(1, 2, 3) 7 7 | max(1, max(2, 3)) @@ -131,7 +131,7 @@ nested_min_max.py:8:8: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -ℹ Suggested fix +ℹ Unsafe fix 5 5 | min(1, max(2, 3)) 6 6 | max(1, 2, 3) 7 7 | max(1, max(2, 3)) @@ -152,7 +152,7 @@ nested_min_max.py:9:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -ℹ Suggested fix +ℹ Unsafe fix 6 6 | max(1, 2, 3) 7 7 | max(1, max(2, 3)) 8 8 | max(1, max(2, max(3, 4))) @@ -173,7 +173,7 @@ nested_min_max.py:15:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -ℹ Suggested fix +ℹ Unsafe 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. @@ -206,7 +206,7 @@ nested_min_max.py:24:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -ℹ Suggested fix +ℹ Unsafe fix 21 21 | ) 22 22 | 23 23 | # Handle iterable expressions. @@ -227,7 +227,7 @@ nested_min_max.py:25:1: PLW3301 [*] Nested `min` calls can be flattened | = help: Flatten nested `min` calls -ℹ Suggested fix +ℹ Unsafe fix 22 22 | 23 23 | # Handle iterable expressions. 24 24 | min(1, min(a)) @@ -247,7 +247,7 @@ nested_min_max.py:26:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -ℹ Suggested fix +ℹ Unsafe fix 23 23 | # Handle iterable expressions. 24 24 | min(1, min(a)) 25 25 | min(1, min(i for i in range(10))) @@ -268,7 +268,7 @@ nested_min_max.py:27:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -ℹ Suggested fix +ℹ Unsafe fix 24 24 | min(1, min(a)) 25 25 | min(1, min(i for i in range(10))) 26 26 | max(1, max(a)) @@ -286,7 +286,7 @@ nested_min_max.py:41:1: PLW3301 [*] Nested `max` calls can be flattened | = help: Flatten nested `max` calls -ℹ Suggested fix +ℹ Unsafe fix 38 38 | max(max(tuples_list)) 39 39 | 40 40 | # Starred argument should be copied as it is. diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__repeated_isinstance_calls.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__repeated_isinstance_calls.snap index 230e00c609..0d9e88910b 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__repeated_isinstance_calls.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__repeated_isinstance_calls.snap @@ -11,7 +11,7 @@ repeated_isinstance_calls.py:15:8: PLR1701 [*] Merge `isinstance` calls: `isinst | = help: Replace with `isinstance(var[3], (float, int))` -ℹ Fix +ℹ Safe fix 12 12 | result = isinstance(var[2], (int, float)) 13 13 | 14 14 | # not merged @@ -32,7 +32,7 @@ repeated_isinstance_calls.py:17:14: PLR1701 [*] Merge `isinstance` calls: `isins | = help: Replace with `isinstance(var[4], (float, int))` -ℹ Fix +ℹ Safe fix 14 14 | # not merged 15 15 | if isinstance(var[3], int) or isinstance(var[3], float) or isinstance(var[3], list) and True: # [consider-merging-isinstance] 16 16 | pass @@ -53,7 +53,7 @@ repeated_isinstance_calls.py:19:14: PLR1701 [*] Merge `isinstance` calls: `isins | = help: Replace with `isinstance(var[5], (float, int))` -ℹ Fix +ℹ Safe fix 16 16 | pass 17 17 | result = isinstance(var[4], int) or isinstance(var[4], float) or isinstance(var[5], list) and False # [consider-merging-isinstance] 18 18 | @@ -73,7 +73,7 @@ repeated_isinstance_calls.py:23:14: PLR1701 [*] Merge `isinstance` calls: `isins | = help: Replace with `isinstance(var[10], (list, str))` -ℹ Fix +ℹ Safe fix 20 20 | 21 21 | inferred_isinstance = isinstance 22 22 | result = inferred_isinstance(var[6], int) or inferred_isinstance(var[6], float) or inferred_isinstance(var[6], list) and False # [consider-merging-isinstance] @@ -94,7 +94,7 @@ repeated_isinstance_calls.py:24:14: PLR1701 [*] Merge `isinstance` calls: `isins | = help: Replace with `isinstance(var[11], (float, int))` -ℹ Fix +ℹ Safe fix 21 21 | inferred_isinstance = isinstance 22 22 | result = inferred_isinstance(var[6], int) or inferred_isinstance(var[6], float) or inferred_isinstance(var[6], list) and False # [consider-merging-isinstance] 23 23 | result = isinstance(var[10], str) or isinstance(var[10], int) and var[8] * 14 or isinstance(var[10], float) and var[5] * 14.4 or isinstance(var[10], list) # [consider-merging-isinstance] @@ -114,7 +114,7 @@ repeated_isinstance_calls.py:30:14: PLR1701 [*] Merge `isinstance` calls: `isins | = help: Replace with `isinstance(var[12], (float, int, list))` -ℹ Fix +ℹ Safe fix 27 27 | result = isinstance() 28 28 | 29 29 | # Combination merged and not merged @@ -133,7 +133,7 @@ repeated_isinstance_calls.py:42:3: PLR1701 [*] Merge `isinstance` calls: `isinst | = help: Replace with `isinstance(self.k, (float, int))` -ℹ Fix +ℹ Safe fix 39 39 | 40 40 | 41 41 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722460483 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 f390514da7..8f24914ff8 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` -ℹ Fix +ℹ Safe fix 1 1 | class A: 2 |- __metaclass__ = type 2 |+ pass @@ -27,7 +27,7 @@ UP001.py:6:5: UP001 [*] `__metaclass__ = type` is implied | = help: Remove `metaclass = type` -ℹ Fix +ℹ Safe 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 652e4edab8..4ea8ce1491 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,7 @@ UP003.py:1:1: UP003 [*] Use `str` instead of `type(...)` | = help: Replace `type(...)` with `str` -ℹ Fix +ℹ Safe fix 1 |-type("") 1 |+str 2 2 | type(b"") @@ -27,7 +27,7 @@ UP003.py:2:1: UP003 [*] Use `bytes` instead of `type(...)` | = help: Replace `type(...)` with `bytes` -ℹ Fix +ℹ Safe fix 1 1 | type("") 2 |-type(b"") 2 |+bytes @@ -46,7 +46,7 @@ UP003.py:3:1: UP003 [*] Use `int` instead of `type(...)` | = help: Replace `type(...)` with `int` -ℹ Fix +ℹ Safe fix 1 1 | type("") 2 2 | type(b"") 3 |-type(0) @@ -65,7 +65,7 @@ UP003.py:4:1: UP003 [*] Use `float` instead of `type(...)` | = help: Replace `type(...)` with `float` -ℹ Fix +ℹ Safe fix 1 1 | type("") 2 2 | type(b"") 3 3 | type(0) @@ -86,7 +86,7 @@ UP003.py:5:1: UP003 [*] Use `complex` instead of `type(...)` | = help: Replace `type(...)` with `complex` -ℹ Fix +ℹ Safe fix 2 2 | type(b"") 3 3 | type(0) 4 4 | type(0.0) @@ -104,7 +104,7 @@ UP003.py:14:29: UP003 [*] Use `str` instead of `type(...)` | = help: Replace `type(...)` with `str` -ℹ Fix +ℹ Safe 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 65bd379d8b..ce91d7a5de 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 -ℹ Fix +ℹ Safe fix 2 2 | ... 3 3 | 4 4 | @@ -29,7 +29,7 @@ UP004.py:10:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 6 6 | ... 7 7 | 8 8 | @@ -51,7 +51,7 @@ UP004.py:16:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 12 12 | ... 13 13 | 14 14 | @@ -75,7 +75,7 @@ UP004.py:24:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 19 19 | ... 20 20 | 21 21 | @@ -99,7 +99,7 @@ UP004.py:31:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 26 26 | ... 27 27 | 28 28 | @@ -122,7 +122,7 @@ UP004.py:37:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 33 33 | ... 34 34 | 35 35 | @@ -146,7 +146,7 @@ UP004.py:45:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 40 40 | ... 41 41 | 42 42 | @@ -171,7 +171,7 @@ UP004.py:53:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 48 48 | ... 49 49 | 50 50 | @@ -196,7 +196,7 @@ UP004.py:61:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 56 56 | ... 57 57 | 58 58 | @@ -221,7 +221,7 @@ UP004.py:69:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 64 64 | ... 65 65 | 66 66 | @@ -243,7 +243,7 @@ UP004.py:75:12: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 72 72 | ... 73 73 | 74 74 | @@ -261,7 +261,7 @@ UP004.py:79:9: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 76 76 | ... 77 77 | 78 78 | @@ -281,7 +281,7 @@ UP004.py:84:5: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 81 81 | 82 82 | 83 83 | class B( @@ -301,7 +301,7 @@ UP004.py:92:5: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 89 89 | 90 90 | class B( 91 91 | A, @@ -320,7 +320,7 @@ UP004.py:98:5: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 95 95 | 96 96 | 97 97 | class B( @@ -340,7 +340,7 @@ UP004.py:108:5: UP004 [*] Class `B` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 105 105 | class B( 106 106 | # Comment on A. 107 107 | A, @@ -359,7 +359,7 @@ UP004.py:119:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 115 115 | ... 116 116 | 117 117 | @@ -381,7 +381,7 @@ UP004.py:125:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 121 121 | ... 122 122 | 123 123 | @@ -403,7 +403,7 @@ UP004.py:131:5: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 127 127 | ... 128 128 | 129 129 | @@ -424,7 +424,7 @@ UP004.py:137:9: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 134 134 | ... 135 135 | 136 136 | @@ -442,7 +442,7 @@ UP004.py:137:17: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 134 134 | ... 135 135 | 136 136 | @@ -461,7 +461,7 @@ UP004.py:142:9: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 139 139 | 140 140 | 141 141 | @decorator() @@ -480,7 +480,7 @@ UP004.py:146:9: UP004 [*] Class `A` inherits from `object` | = help: Remove `object` inheritance -ℹ Fix +ℹ Safe fix 143 143 | ... 144 144 | 145 145 | @decorator() # class A(object): 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 bd754f91c7..21d08d5d28 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` -ℹ Fix +ℹ Safe fix 3 3 | 4 4 | class Suite(unittest.TestCase): 5 5 | def test(self) -> None: @@ -33,7 +33,7 @@ UP005.py:7:9: UP005 [*] `assertEquals` is deprecated, use `assertEqual` | = help: Replace `assertEqual` with `assertEquals` -ℹ Fix +ℹ Safe fix 4 4 | class Suite(unittest.TestCase): 5 5 | def test(self) -> None: 6 6 | self.assertEquals (1, 2) @@ -53,7 +53,7 @@ UP005.py:9:9: UP005 [*] `failUnlessAlmostEqual` is deprecated, use `assertAlmost | = help: Replace `assertAlmostEqual` with `failUnlessAlmostEqual` -ℹ Fix +ℹ Safe fix 6 6 | self.assertEquals (1, 2) 7 7 | self.assertEquals(1, 2) 8 8 | self.assertEqual(3, 4) @@ -70,7 +70,7 @@ UP005.py:10:9: UP005 [*] `assertNotRegexpMatches` is deprecated, use `assertNotR | = help: Replace `assertNotRegex` with `assertNotRegexpMatches` -ℹ Fix +ℹ Safe 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 c102b6d608..dc09fa42bc 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` -ℹ Fix +ℹ Safe fix 1 1 | import typing 2 2 | 3 3 | @@ -27,7 +27,7 @@ UP006_0.py:11:10: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -ℹ Fix +ℹ Safe fix 8 8 | from typing import List 9 9 | 10 10 | @@ -45,7 +45,7 @@ UP006_0.py:18:10: UP006 [*] Use `list` instead of `t.List` for type annotation | = help: Replace with `list` -ℹ Fix +ℹ Safe fix 15 15 | import typing as t 16 16 | 17 17 | @@ -63,7 +63,7 @@ UP006_0.py:25:10: UP006 [*] Use `list` instead of `IList` for type annotation | = help: Replace with `list` -ℹ Fix +ℹ Safe fix 22 22 | from typing import List as IList 23 23 | 24 24 | @@ -81,7 +81,7 @@ UP006_0.py:29:11: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -ℹ Fix +ℹ Safe fix 26 26 | ... 27 27 | 28 28 | @@ -99,7 +99,7 @@ UP006_0.py:33:12: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -ℹ Fix +ℹ Safe fix 30 30 | ... 31 31 | 32 32 | @@ -117,7 +117,7 @@ UP006_0.py:37:11: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -ℹ Fix +ℹ Safe fix 34 34 | ... 35 35 | 36 36 | @@ -135,7 +135,7 @@ UP006_0.py:41:13: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -ℹ Fix +ℹ Safe fix 38 38 | ... 39 39 | 40 40 | @@ -161,7 +161,7 @@ UP006_0.py:49:11: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -ℹ Fix +ℹ Safe fix 46 46 | ... 47 47 | 48 48 | @@ -179,7 +179,7 @@ UP006_0.py:49:17: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -ℹ Fix +ℹ Safe fix 46 46 | ... 47 47 | 48 48 | @@ -197,7 +197,7 @@ UP006_0.py:53:11: UP006 [*] Use `list` instead of `List` for type annotation | = help: Replace with `list` -ℹ Fix +ℹ Safe fix 50 50 | ... 51 51 | 52 52 | @@ -239,7 +239,7 @@ UP006_0.py:61:10: UP006 [*] Use `collections.deque` instead of `typing.Deque` fo | = help: Replace with `collections.deque` -ℹ Suggested fix +ℹ Unsafe fix 20 20 | 21 21 | 22 22 | from typing import List as IList @@ -265,7 +265,7 @@ UP006_0.py:65:10: UP006 [*] Use `collections.defaultdict` instead of `typing.Def | = help: Replace with `collections.defaultdict` -ℹ Suggested fix +ℹ Unsafe 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 1cf1741128..e0b8c7f4d5 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` -ℹ Suggested fix +ℹ Unsafe 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 58ea6c2c8a..e3d7598176 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` -ℹ Suggested fix +ℹ Unsafe 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 9f97cb0632..4c8f7cc2c9 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` -ℹ Suggested fix +ℹ Unsafe fix 3 3 | from typing import Union 4 4 | 5 5 | @@ -27,7 +27,7 @@ UP007.py:10:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe fix 7 7 | ... 8 8 | 9 9 | @@ -45,7 +45,7 @@ UP007.py:14:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe fix 11 11 | ... 12 12 | 13 13 | @@ -63,7 +63,7 @@ UP007.py:14:26: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe fix 11 11 | ... 12 12 | 13 13 | @@ -81,7 +81,7 @@ UP007.py:18:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe fix 15 15 | ... 16 16 | 17 17 | @@ -99,7 +99,7 @@ UP007.py:22:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe fix 19 19 | ... 20 20 | 21 21 | @@ -117,7 +117,7 @@ UP007.py:26:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe fix 23 23 | ... 24 24 | 25 25 | @@ -135,7 +135,7 @@ UP007.py:30:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe fix 27 27 | ... 28 28 | 29 29 | @@ -153,7 +153,7 @@ UP007.py:34:10: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe fix 31 31 | ... 32 32 | 33 33 | @@ -171,7 +171,7 @@ UP007.py:38:11: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe fix 35 35 | ... 36 36 | 37 37 | @@ -189,7 +189,7 @@ UP007.py:38:27: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe fix 35 35 | ... 36 36 | 37 37 | @@ -207,7 +207,7 @@ UP007.py:42:11: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe fix 39 39 | ... 40 40 | 41 41 | @@ -226,7 +226,7 @@ UP007.py:55:8: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe fix 52 52 | 53 53 | 54 54 | def f() -> None: @@ -268,7 +268,7 @@ UP007.py:60:8: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe fix 57 57 | 58 58 | x = Union[str, int] 59 59 | x = Union["str", "int"] @@ -287,7 +287,7 @@ UP007.py:61:8: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe fix 58 58 | x = Union[str, int] 59 59 | x = Union["str", "int"] 60 60 | x: Union[str, int] @@ -382,7 +382,7 @@ UP007.py:102:28: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe fix 99 99 | 100 100 | # Regression test for: https://github.com/astral-sh/ruff/issues/7131 101 101 | class ServiceRefOrValue: @@ -404,7 +404,7 @@ UP007.py:110:28: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe fix 107 107 | 108 108 | # Regression test for: https://github.com/astral-sh/ruff/issues/7201 109 109 | class ServiceRefOrValue: 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 0ff5607820..a966350e32 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,7 @@ UP008.py:17:23: UP008 [*] Use `super()` instead of `super(__class__, self)` | = help: Remove `super` parameters -ℹ Suggested fix +ℹ Unsafe fix 14 14 | Parent.super(1, 2) # ok 15 15 | 16 16 | def wrong(self): @@ -32,7 +32,7 @@ UP008.py:18:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | = help: Remove `super` parameters -ℹ Suggested fix +ℹ Unsafe fix 15 15 | 16 16 | def wrong(self): 17 17 | parent = super(Child, self) # wrong @@ -55,7 +55,7 @@ UP008.py:19:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | = help: Remove `super` parameters -ℹ Suggested fix +ℹ Unsafe fix 16 16 | def wrong(self): 17 17 | parent = super(Child, self) # wrong 18 18 | super(Child, self).method # wrong @@ -78,7 +78,7 @@ UP008.py:36:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | = help: Remove `super` parameters -ℹ Suggested fix +ℹ Unsafe fix 33 33 | 34 34 | class MyClass(BaseClass): 35 35 | def normal(self): @@ -97,7 +97,7 @@ UP008.py:50:18: UP008 [*] Use `super()` instead of `super(__class__, self)` | = help: Remove `super` parameters -ℹ Suggested fix +ℹ Unsafe fix 47 47 | super(MyClass, self).f() # CANNOT use super() 48 48 | 49 49 | def inner_argument(self): 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 4111b57965..c4e69c7ea1 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,7 @@ UP009_0.py:1:1: UP009 [*] UTF-8 encoding declaration is unnecessary | = help: Remove unnecessary coding comment -ℹ Fix +ℹ Safe 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 322ccb1070..b1b25e0d32 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,7 @@ UP009_1.py:2:1: UP009 [*] UTF-8 encoding declaration is unnecessary | = help: Remove unnecessary coding comment -ℹ Fix +ℹ Safe 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 5901c6eb38..01bbf87c00 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,7 @@ UP009_6.py:1:2: UP009 [*] UTF-8 encoding declaration is unnecessary | = help: Remove unnecessary coding comment -ℹ Fix +ℹ Safe 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 990598993f..8439a0715c 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,7 @@ UP009_7.py:1:2: UP009 [*] UTF-8 encoding declaration is unnecessary | = help: Remove unnecessary coding comment -ℹ Fix +ℹ Safe 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 550b7a024b..457a9eb20d 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,7 @@ UP010.py:1:1: UP010 [*] Unnecessary `__future__` imports `generators`, `nested_s | = help: Remove unnecessary `future` import -ℹ Fix +ℹ Safe 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 @@ -26,7 +26,7 @@ UP010.py:2:1: UP010 [*] Unnecessary `__future__` imports `unicode_literals`, `wi | = help: Remove unnecessary `future` import -ℹ Fix +ℹ Safe 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 @@ -44,7 +44,7 @@ UP010.py:3:1: UP010 [*] Unnecessary `__future__` imports `absolute_import`, `div | = help: Remove unnecessary `future` import -ℹ Fix +ℹ Safe 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 @@ -63,7 +63,7 @@ UP010.py:4:1: UP010 [*] Unnecessary `__future__` import `generator_stop` for tar | = help: Remove unnecessary `future` import -ℹ Fix +ℹ Safe 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 @@ -82,7 +82,7 @@ UP010.py:5:1: UP010 [*] Unnecessary `__future__` imports `generator_stop`, `prin | = help: Remove unnecessary `future` import -ℹ Fix +ℹ Safe 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 @@ -102,7 +102,7 @@ UP010.py:6:1: UP010 [*] Unnecessary `__future__` import `generators` for target | = help: Remove unnecessary `future` import -ℹ Fix +ℹ Safe 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 @@ -121,7 +121,7 @@ UP010.py:9:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for tar | = help: Remove unnecessary `future` import -ℹ Fix +ℹ Safe fix 6 6 | from __future__ import invalid_module, generators 7 7 | 8 8 | if True: @@ -141,7 +141,7 @@ UP010.py:10:5: UP010 [*] Unnecessary `__future__` import `generators` for target | = help: Remove unnecessary `future` import -ℹ Fix +ℹ Safe fix 7 7 | 8 8 | if True: 9 9 | from __future__ import generator_stop @@ -159,7 +159,7 @@ UP010.py:13:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for ta | = help: Remove unnecessary `future` import -ℹ Fix +ℹ Safe fix 10 10 | from __future__ import generators 11 11 | 12 12 | if True: @@ -175,7 +175,7 @@ UP010.py:14:5: UP010 [*] Unnecessary `__future__` import `generators` for target | = help: Remove unnecessary `future` import -ℹ Fix +ℹ Safe 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 74e6ac8fba..e672749216 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 -ℹ Fix +ℹ Safe fix 2 2 | from functools import lru_cache 3 3 | 4 4 | @@ -29,7 +29,7 @@ UP011.py:10:11: UP011 [*] Unnecessary parentheses to `functools.lru_cache` | = help: Remove unnecessary parentheses -ℹ Fix +ℹ Safe fix 7 7 | pass 8 8 | 9 9 | @@ -49,7 +49,7 @@ UP011.py:16:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` | = help: Remove unnecessary parentheses -ℹ Fix +ℹ Safe fix 13 13 | 14 14 | 15 15 | @other_decorator @@ -68,7 +68,7 @@ UP011.py:21:21: UP011 [*] Unnecessary parentheses to `functools.lru_cache` | = help: Remove unnecessary parentheses -ℹ Fix +ℹ Safe 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 bf81c1e7b3..fda47ddec6 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 -ℹ Fix +ℹ Safe fix 1 1 | # ASCII literals should be replaced by a bytes literal 2 |-"foo".encode("utf-8") # b"foo" 2 |+b"foo" # b"foo" @@ -30,7 +30,7 @@ UP012.py:3:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Fix +ℹ Safe 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" @@ -50,7 +50,7 @@ UP012.py:4:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Fix +ℹ Safe 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" @@ -71,7 +71,7 @@ UP012.py:5:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Fix +ℹ Safe fix 2 2 | "foo".encode("utf-8") # b"foo" 3 3 | "foo".encode("u8") # b"foo" 4 4 | "foo".encode() # b"foo" @@ -92,7 +92,7 @@ UP012.py:6:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Fix +ℹ Safe fix 3 3 | "foo".encode("u8") # b"foo" 4 4 | "foo".encode() # b"foo" 5 5 | "foo".encode("UTF8") # b"foo" @@ -113,7 +113,7 @@ UP012.py:7:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Fix +ℹ Safe fix 4 4 | "foo".encode() # b"foo" 5 5 | "foo".encode("UTF8") # b"foo" 6 6 | U"foo".encode("utf-8") # b"foo" @@ -140,7 +140,7 @@ UP012.py:8:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Fix +ℹ Safe 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" @@ -170,7 +170,7 @@ UP012.py:16:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Fix +ℹ Safe fix 13 13 | "utf-8" 14 14 | ) 15 15 | ( @@ -195,7 +195,7 @@ UP012.py:20:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Fix +ℹ Safe fix 17 17 | "Ipsum".encode() 18 18 | ) 19 19 | ( @@ -217,7 +217,7 @@ UP012.py:24:5: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Fix +ℹ Safe fix 21 21 | "Ipsum".encode() # Comment 22 22 | ) 23 23 | ( @@ -237,7 +237,7 @@ UP012.py:32:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -ℹ Fix +ℹ Safe fix 29 29 | string.encode("utf-8") 30 30 | 31 31 | bar = "bar" @@ -260,7 +260,7 @@ UP012.py:36:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -ℹ Fix +ℹ Safe fix 33 33 | encoding = "latin" 34 34 | "foo".encode(encoding) 35 35 | f"foo{bar}".encode(encoding) @@ -282,7 +282,7 @@ UP012.py:53:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -ℹ Fix +ℹ Safe fix 50 50 | "unicode text©".encode(encoding="utf-8", errors="replace") 51 51 | 52 52 | # Unicode literals should only be stripped of default encoding. @@ -303,7 +303,7 @@ UP012.py:55:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -ℹ Fix +ℹ Safe 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() @@ -324,7 +324,7 @@ UP012.py:57:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Fix +ℹ Safe fix 54 54 | "unicode text©".encode() 55 55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode() 56 56 | @@ -344,7 +344,7 @@ UP012.py:58:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Fix +ℹ Safe fix 55 55 | "unicode text©".encode(encoding="UTF8") # "unicode text©".encode() 56 56 | 57 57 | r"foo\o".encode("utf-8") # br"foo\o" @@ -365,7 +365,7 @@ UP012.py:59:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Fix +ℹ Safe fix 56 56 | 57 57 | r"foo\o".encode("utf-8") # br"foo\o" 58 58 | u"foo".encode("utf-8") # b"foo" @@ -385,7 +385,7 @@ UP012.py:60:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Fix +ℹ Safe 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" @@ -406,7 +406,7 @@ UP012.py:61:7: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Fix +ℹ Safe 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" @@ -429,7 +429,7 @@ UP012.py:64:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Fix +ℹ Safe fix 62 62 | 63 63 | # `encode` on parenthesized strings. 64 64 | ( @@ -457,7 +457,7 @@ UP012.py:69:1: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Fix +ℹ Safe fix 67 67 | ).encode() 68 68 | 69 69 | (( @@ -482,7 +482,7 @@ UP012.py:74:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -ℹ Fix +ℹ Safe fix 71 71 | "def" 72 72 | )).encode() 73 73 | @@ -502,7 +502,7 @@ UP012.py:75:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -ℹ Fix +ℹ Safe fix 72 72 | )).encode() 73 73 | 74 74 | (f"foo{bar}").encode("utf-8") @@ -522,7 +522,7 @@ UP012.py:76:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -ℹ Fix +ℹ Safe fix 73 73 | 74 74 | (f"foo{bar}").encode("utf-8") 75 75 | (f"foo{bar}").encode(encoding="utf-8") @@ -541,7 +541,7 @@ UP012.py:77:1: UP012 [*] Unnecessary UTF-8 `encoding` argument to `encode` | = help: Remove unnecessary `encoding` argument -ℹ Fix +ℹ Safe 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") @@ -560,7 +560,7 @@ UP012.py:82:17: UP012 [*] Unnecessary call to `encode` as UTF-8 | = help: Rewrite as bytes literal -ℹ Fix +ℹ Safe fix 79 79 | 80 80 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459882 81 81 | def _match_ignore(line): 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 d7a6da0696..d03ec38c48 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 -ℹ Fix +ℹ Safe fix 2 2 | import typing 3 3 | 4 4 | # dict literal @@ -33,7 +33,7 @@ UP013.py:8:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class sy | = help: Convert `MyType` to class syntax -ℹ Fix +ℹ Safe fix 5 5 | MyType = TypedDict("MyType", {"a": int, "b": str}) 6 6 | 7 7 | # dict call @@ -55,7 +55,7 @@ UP013.py:11:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Fix +ℹ Safe fix 8 8 | MyType = TypedDict("MyType", dict(a=int, b=str)) 9 9 | 10 10 | # kwargs @@ -77,7 +77,7 @@ UP013.py:14:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Fix +ℹ Safe fix 11 11 | MyType = TypedDict("MyType", a=int, b=str) 12 12 | 13 13 | # Empty TypedDict @@ -97,7 +97,7 @@ UP013.py:17:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Fix +ℹ Safe fix 14 14 | MyType = TypedDict("MyType") 15 15 | 16 16 | # Literal values @@ -119,7 +119,7 @@ UP013.py:18:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Fix +ℹ Safe fix 15 15 | 16 16 | # Literal values 17 17 | MyType = TypedDict("MyType", {"a": "hello"}) @@ -140,7 +140,7 @@ UP013.py:21:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Fix +ℹ Safe fix 18 18 | MyType = TypedDict("MyType", a="hello") 19 19 | 20 20 | # NotRequired @@ -161,7 +161,7 @@ UP013.py:24:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Fix +ℹ Safe fix 21 21 | MyType = TypedDict("MyType", {"a": NotRequired[dict]}) 22 22 | 23 23 | # total @@ -183,7 +183,7 @@ UP013.py:27:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Fix +ℹ Safe fix 24 24 | MyType = TypedDict("MyType", {"x": int, "y": int}, total=False) 25 25 | 26 26 | # using Literal type @@ -204,7 +204,7 @@ UP013.py:30:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Fix +ℹ Safe fix 27 27 | MyType = TypedDict("MyType", {"key": Literal["value"]}) 28 28 | 29 29 | # using namespace TypedDict @@ -225,7 +225,7 @@ UP013.py:40:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Fix +ℹ Safe fix 37 37 | MyType = TypedDict("MyType", {"a": int, "b": str, **c}) 38 38 | 39 39 | # Empty dict literal @@ -244,7 +244,7 @@ UP013.py:43:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s | = help: Convert `MyType` to class syntax -ℹ Fix +ℹ Safe 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 a65fcacbad..71ce3308f5 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 -ℹ Fix +ℹ Safe fix 2 2 | import typing 3 3 | 4 4 | # with complex annotations @@ -33,7 +33,7 @@ UP014.py:8:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class s | = help: Convert `MyType` to class syntax -ℹ Fix +ℹ Safe fix 5 5 | MyType = NamedTuple("MyType", [("a", int), ("b", tuple[str, ...])]) 6 6 | 7 7 | # with namespace @@ -55,7 +55,7 @@ UP014.py:14:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class | = help: Convert `MyType` to class syntax -ℹ Fix +ℹ Safe fix 11 11 | MyType = NamedTuple("MyType", [("x-y", int), ("b", tuple[str, ...])]) 12 12 | 13 13 | # no fields @@ -76,7 +76,7 @@ UP014.py:17:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class | = help: Convert `MyType` to class syntax -ℹ Fix +ℹ Safe fix 14 14 | MyType = typing.NamedTuple("MyType") 15 15 | 16 16 | # empty fields @@ -97,7 +97,7 @@ UP014.py:20:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class | = help: Convert `MyType` to class syntax -ℹ Fix +ℹ Safe 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 44722257a9..d85977a74e 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,7 @@ UP015.py:1:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 1 |-open("foo", "U") 1 |+open("foo") 2 2 | open("foo", "Ur") @@ -27,7 +27,7 @@ UP015.py:2:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 1 1 | open("foo", "U") 2 |-open("foo", "Ur") 2 |+open("foo") @@ -46,7 +46,7 @@ UP015.py:3:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe fix 1 1 | open("foo", "U") 2 2 | open("foo", "Ur") 3 |-open("foo", "Ub") @@ -66,7 +66,7 @@ UP015.py:4:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe fix 1 1 | open("foo", "U") 2 2 | open("foo", "Ur") 3 3 | open("foo", "Ub") @@ -87,7 +87,7 @@ UP015.py:5:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 2 2 | open("foo", "Ur") 3 3 | open("foo", "Ub") 4 4 | open("foo", "rUb") @@ -108,7 +108,7 @@ UP015.py:6:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 3 3 | open("foo", "Ub") 4 4 | open("foo", "rUb") 5 5 | open("foo", "r") @@ -128,7 +128,7 @@ UP015.py:7:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 4 4 | open("foo", "rUb") 5 5 | open("foo", "r") 6 6 | open("foo", "rt") @@ -149,7 +149,7 @@ UP015.py:8:1: UP015 [*] Unnecessary open mode parameters, use ""w"" | = help: Replace with ""w"" -ℹ Fix +ℹ Safe fix 5 5 | open("foo", "r") 6 6 | open("foo", "rt") 7 7 | open("f", "r", encoding="UTF-8") @@ -170,7 +170,7 @@ UP015.py:10:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 7 7 | open("f", "r", encoding="UTF-8") 8 8 | open("f", "wt") 9 9 | @@ -191,7 +191,7 @@ UP015.py:12:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 9 9 | 10 10 | with open("foo", "U") as f: 11 11 | pass @@ -212,7 +212,7 @@ UP015.py:14:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe fix 11 11 | pass 12 12 | with open("foo", "Ur") as f: 13 13 | pass @@ -233,7 +233,7 @@ UP015.py:16:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe fix 13 13 | pass 14 14 | with open("foo", "Ub") as f: 15 15 | pass @@ -254,7 +254,7 @@ UP015.py:18:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 15 15 | pass 16 16 | with open("foo", "rUb") as f: 17 17 | pass @@ -275,7 +275,7 @@ UP015.py:20:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 17 17 | pass 18 18 | with open("foo", "r") as f: 19 19 | pass @@ -296,7 +296,7 @@ UP015.py:22:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 19 19 | pass 20 20 | with open("foo", "rt") as f: 21 21 | pass @@ -316,7 +316,7 @@ UP015.py:24:6: UP015 [*] Unnecessary open mode parameters, use ""w"" | = help: Replace with ""w"" -ℹ Fix +ℹ Safe fix 21 21 | pass 22 22 | with open("foo", "r", encoding="UTF-8") as f: 23 23 | pass @@ -336,7 +336,7 @@ UP015.py:27:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 24 24 | with open("foo", "wt") as f: 25 25 | pass 26 26 | @@ -356,7 +356,7 @@ UP015.py:28:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe fix 25 25 | pass 26 26 | 27 27 | open(f("a", "b", "c"), "U") @@ -377,7 +377,7 @@ UP015.py:30:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 27 27 | open(f("a", "b", "c"), "U") 28 28 | open(f("a", "b", "c"), "Ub") 29 29 | @@ -397,7 +397,7 @@ UP015.py:32:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe fix 29 29 | 30 30 | with open(f("a", "b", "c"), "U") as f: 31 31 | pass @@ -418,7 +418,7 @@ UP015.py:35:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 32 32 | with open(f("a", "b", "c"), "Ub") as f: 33 33 | pass 34 34 | @@ -439,7 +439,7 @@ UP015.py:35:30: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 32 32 | with open(f("a", "b", "c"), "Ub") as f: 33 33 | pass 34 34 | @@ -459,7 +459,7 @@ UP015.py:37:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe fix 34 34 | 35 35 | with open("foo", "U") as fa, open("bar", "U") as fb: 36 36 | pass @@ -479,7 +479,7 @@ UP015.py:37:31: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe fix 34 34 | 35 35 | with open("foo", "U") as fa, open("bar", "U") as fb: 36 36 | pass @@ -500,7 +500,7 @@ UP015.py:40:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 37 37 | with open("foo", "Ub") as fa, open("bar", "Ub") as fb: 38 38 | pass 39 39 | @@ -519,7 +519,7 @@ UP015.py:41:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 38 38 | pass 39 39 | 40 40 | open("foo", mode="U") @@ -540,7 +540,7 @@ UP015.py:42:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 39 39 | 40 40 | open("foo", mode="U") 41 41 | open(name="foo", mode="U") @@ -561,7 +561,7 @@ UP015.py:44:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 41 41 | open(name="foo", mode="U") 42 42 | open(mode="U", name="foo") 43 43 | @@ -582,7 +582,7 @@ UP015.py:46:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 43 43 | 44 44 | with open("foo", mode="U") as f: 45 45 | pass @@ -602,7 +602,7 @@ UP015.py:48:6: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 45 45 | pass 46 46 | with open(name="foo", mode="U") as f: 47 47 | pass @@ -623,7 +623,7 @@ UP015.py:51:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe fix 48 48 | with open(mode="U", name="foo") as f: 49 49 | pass 50 50 | @@ -642,7 +642,7 @@ UP015.py:52:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe fix 49 49 | pass 50 50 | 51 51 | open("foo", mode="Ub") @@ -663,7 +663,7 @@ UP015.py:53:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe fix 50 50 | 51 51 | open("foo", mode="Ub") 52 52 | open(name="foo", mode="Ub") @@ -684,7 +684,7 @@ UP015.py:55:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe fix 52 52 | open(name="foo", mode="Ub") 53 53 | open(mode="Ub", name="foo") 54 54 | @@ -705,7 +705,7 @@ UP015.py:57:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe fix 54 54 | 55 55 | with open("foo", mode="Ub") as f: 56 56 | pass @@ -725,7 +725,7 @@ UP015.py:59:6: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe fix 56 56 | pass 57 57 | with open(name="foo", mode="Ub") as f: 58 58 | pass @@ -746,7 +746,7 @@ UP015.py:62:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe fix 59 59 | with open(mode="Ub", name="foo") as f: 60 60 | pass 61 61 | @@ -766,7 +766,7 @@ UP015.py:63:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe 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) @@ -786,7 +786,7 @@ UP015.py:64:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe 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') @@ -807,7 +807,7 @@ UP015.py:65:1: UP015 [*] Unnecessary open mode parameters | = help: Remove open mode parameters -ℹ Fix +ℹ Safe 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) @@ -828,7 +828,7 @@ UP015.py:67:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe 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 | @@ -848,7 +848,7 @@ UP015.py:68:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe 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) @@ -868,7 +868,7 @@ UP015.py:69:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe 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') @@ -889,7 +889,7 @@ UP015.py:70:1: UP015 [*] Unnecessary open mode parameters, use ""rb"" | = help: Replace with ""rb"" -ℹ Fix +ℹ Safe 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__UP018.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP018.py.snap index cdd56ab5c1..46e6968df6 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 -ℹ Fix +ℹ Safe fix 34 34 | int().denominator 35 35 | 36 36 | # These become string or byte literals @@ -32,7 +32,7 @@ UP018.py:38:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) | = help: Replace with string literal -ℹ Fix +ℹ Safe fix 35 35 | 36 36 | # These become string or byte literals 37 37 | str() @@ -54,7 +54,7 @@ UP018.py:39:1: UP018 [*] Unnecessary `str` call (rewrite as a literal) | = help: Replace with string literal -ℹ Fix +ℹ Safe fix 36 36 | # These become string or byte literals 37 37 | str() 38 38 | str("foo") @@ -77,7 +77,7 @@ UP018.py:41:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) | = help: Replace with bytes literal -ℹ Fix +ℹ Safe fix 38 38 | str("foo") 39 39 | str(""" 40 40 | foo""") @@ -98,7 +98,7 @@ UP018.py:42:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) | = help: Replace with bytes literal -ℹ Fix +ℹ Safe fix 39 39 | str(""" 40 40 | foo""") 41 41 | bytes() @@ -120,7 +120,7 @@ UP018.py:43:1: UP018 [*] Unnecessary `bytes` call (rewrite as a literal) | = help: Replace with bytes literal -ℹ Fix +ℹ Safe fix 40 40 | foo""") 41 41 | bytes() 42 42 | bytes(b"foo") @@ -143,7 +143,7 @@ UP018.py:45:4: UP018 [*] Unnecessary `str` call (rewrite as a literal) | = help: Replace with string literal -ℹ Fix +ℹ Safe fix 42 42 | bytes(b"foo") 43 43 | bytes(b""" 44 44 | foo""") @@ -164,7 +164,7 @@ UP018.py:46:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | = help: Replace with integer literal -ℹ Fix +ℹ Safe fix 43 43 | bytes(b""" 44 44 | foo""") 45 45 | f"{str()}" @@ -185,7 +185,7 @@ UP018.py:47:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | = help: Replace with integer literal -ℹ Fix +ℹ Safe fix 44 44 | foo""") 45 45 | f"{str()}" 46 46 | int() @@ -206,7 +206,7 @@ UP018.py:48:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | = help: Replace with float literal -ℹ Fix +ℹ Safe fix 45 45 | f"{str()}" 46 46 | int() 47 47 | int(1) @@ -227,7 +227,7 @@ UP018.py:49:1: UP018 [*] Unnecessary `float` call (rewrite as a literal) | = help: Replace with float literal -ℹ Fix +ℹ Safe fix 46 46 | int() 47 47 | int(1) 48 48 | float() @@ -248,7 +248,7 @@ UP018.py:50:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) | = help: Replace with boolean literal -ℹ Fix +ℹ Safe fix 47 47 | int(1) 48 48 | float() 49 49 | float(1.0) @@ -268,7 +268,7 @@ UP018.py:51:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) | = help: Replace with boolean literal -ℹ Fix +ℹ Safe fix 48 48 | float() 49 49 | float(1.0) 50 50 | bool() @@ -289,7 +289,7 @@ UP018.py:52:1: UP018 [*] Unnecessary `bool` call (rewrite as a literal) | = help: Replace with boolean literal -ℹ Fix +ℹ Safe fix 49 49 | float(1.0) 50 50 | bool() 51 51 | bool(True) @@ -307,7 +307,7 @@ UP018.py:55:1: UP018 [*] Unnecessary `int` call (rewrite as a literal) | = help: Replace with integer literal -ℹ Fix +ℹ Safe fix 52 52 | bool(False) 53 53 | 54 54 | # These become a literal but retain parentheses 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 8bb3a507c1..389ee5e973 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` -ℹ Fix +ℹ Safe fix 4 4 | from typing import Text as Goodbye 5 5 | 6 6 | @@ -27,7 +27,7 @@ UP019.py:11:29: UP019 [*] `typing.Text` is deprecated, use `str` | = help: Replace with `str` -ℹ Fix +ℹ Safe fix 8 8 | print(word) 9 9 | 10 10 | @@ -45,7 +45,7 @@ UP019.py:15:28: UP019 [*] `typing.Text` is deprecated, use `str` | = help: Replace with `str` -ℹ Fix +ℹ Safe fix 12 12 | print(word) 13 13 | 14 14 | @@ -63,7 +63,7 @@ UP019.py:19:29: UP019 [*] `typing.Text` is deprecated, use `str` | = help: Replace with `str` -ℹ Fix +ℹ Safe 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 af6064528b..f6469321fc 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` -ℹ Fix +ℹ Safe fix 1 1 | import io 2 2 | 3 |-with io.open("f.txt", mode="r", buffering=-1, **kwargs) as f: 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 4b22f871e8..128a9c9d73 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 -ℹ Fix +ℹ Safe fix 2 2 | from subprocess import run 3 3 | 4 4 | # Errors @@ -31,7 +31,7 @@ UP021.py:6:25: UP021 [*] `universal_newlines` is deprecated, use `text` | = help: Replace with `text` keyword argument -ℹ Fix +ℹ Safe fix 3 3 | 4 4 | # Errors 5 5 | subprocess.run(["foo"], universal_newlines=True, check=True) @@ -52,7 +52,7 @@ UP021.py:7:14: UP021 [*] `universal_newlines` is deprecated, use `text` | = help: Replace with `text` keyword argument -ℹ Fix +ℹ Safe 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 186db76254..b183313442 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 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, | = help: Replace with `capture_output` keyword argument -ℹ Suggested fix +ℹ Unsafe fix 1 1 | from subprocess import run 2 2 | import subprocess 3 3 | @@ -33,7 +33,7 @@ UP022.py:6:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, | = help: Replace with `capture_output` keyword argument -ℹ Suggested fix +ℹ Unsafe fix 3 3 | 4 4 | output = run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 5 5 | @@ -54,7 +54,7 @@ UP022.py:8:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, | = help: Replace with `capture_output` keyword argument -ℹ Suggested fix +ℹ Unsafe fix 5 5 | 6 6 | output = subprocess.run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 7 7 | @@ -78,7 +78,7 @@ UP022.py:10:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, | = help: Replace with `capture_output` keyword argument -ℹ Suggested fix +ℹ Unsafe fix 8 8 | output = subprocess.run(stdout=subprocess.PIPE, args=["foo"], stderr=subprocess.PIPE) 9 9 | 10 10 | output = subprocess.run( @@ -102,7 +102,7 @@ UP022.py:14:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, | = help: Replace with `capture_output` keyword argument -ℹ Suggested fix +ℹ Unsafe fix 12 12 | ) 13 13 | 14 14 | output = subprocess.run( @@ -132,7 +132,7 @@ UP022.py:18:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, | = help: Replace with `capture_output` keyword argument -ℹ Suggested fix +ℹ Unsafe fix 17 17 | 18 18 | output = subprocess.run( 19 19 | ["foo"], @@ -162,7 +162,7 @@ UP022.py:29:14: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, | = help: Replace with `capture_output` keyword argument -ℹ Suggested fix +ℹ Unsafe 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 3fa00d5ac3..2f5d2cb75b 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` -ℹ Fix +ℹ Safe 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 @@ -29,7 +29,7 @@ UP023.py:3:8: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Fix +ℹ Safe 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 @@ -47,7 +47,7 @@ UP023.py:6:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Fix +ℹ Safe fix 3 3 | import xml.etree.cElementTree as ET 4 4 | 5 5 | # Weird spacing should not cause issues. @@ -68,7 +68,7 @@ UP023.py:7:11: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Fix +ℹ Safe fix 4 4 | 5 5 | # Weird spacing should not cause issues. 6 6 | from xml.etree.cElementTree import XML @@ -92,7 +92,7 @@ UP023.py:10:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Fix +ℹ Safe fix 7 7 | import xml.etree.cElementTree as ET 8 8 | 9 9 | # Multi line imports should also work fine. @@ -112,7 +112,7 @@ UP023.py:16:12: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Fix +ℹ Safe fix 13 13 | SubElement, 14 14 | ) 15 15 | if True: @@ -133,7 +133,7 @@ UP023.py:17:27: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Fix +ℹ Safe fix 14 14 | ) 15 15 | if True: 16 16 | import xml.etree.cElementTree as ET @@ -154,7 +154,7 @@ UP023.py:19:23: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Fix +ℹ Safe fix 16 16 | import xml.etree.cElementTree as ET 17 17 | from xml.etree import cElementTree as CET 18 18 | @@ -175,7 +175,7 @@ UP023.py:21:20: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Fix +ℹ Safe fix 18 18 | 19 19 | from xml.etree import cElementTree as ET 20 20 | @@ -195,7 +195,7 @@ UP023.py:24:32: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | = help: Replace with `ElementTree` -ℹ Fix +ℹ Safe 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 da339bd9bb..bb7879fbc7 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` -ℹ Fix +ℹ Safe fix 3 3 | # These should be fixed 4 4 | try: 5 5 | pass @@ -31,7 +31,7 @@ UP024_0.py:11:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `IOError` with builtin `OSError` -ℹ Fix +ℹ Safe fix 8 8 | 9 9 | try: 10 10 | pass @@ -51,7 +51,7 @@ UP024_0.py:16:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `WindowsError` with builtin `OSError` -ℹ Fix +ℹ Safe fix 13 13 | 14 14 | try: 15 15 | pass @@ -71,7 +71,7 @@ UP024_0.py:21:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `mmap.error` with builtin `OSError` -ℹ Fix +ℹ Safe fix 18 18 | 19 19 | try: 20 20 | pass @@ -91,7 +91,7 @@ UP024_0.py:26:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `select.error` with builtin `OSError` -ℹ Fix +ℹ Safe fix 23 23 | 24 24 | try: 25 25 | pass @@ -111,7 +111,7 @@ UP024_0.py:31:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `socket.error` with builtin `OSError` -ℹ Fix +ℹ Safe fix 28 28 | 29 29 | try: 30 30 | pass @@ -131,7 +131,7 @@ UP024_0.py:36:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `error` with builtin `OSError` -ℹ Fix +ℹ Safe fix 33 33 | 34 34 | try: 35 35 | pass @@ -152,7 +152,7 @@ UP024_0.py:43:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Fix +ℹ Safe fix 40 40 | 41 41 | try: 42 42 | pass @@ -173,7 +173,7 @@ UP024_0.py:47:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Fix +ℹ Safe fix 44 44 | pass 45 45 | try: 46 46 | pass @@ -193,7 +193,7 @@ UP024_0.py:51:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Fix +ℹ Safe fix 48 48 | pass 49 49 | try: 50 50 | pass @@ -213,7 +213,7 @@ UP024_0.py:58:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Fix +ℹ Safe fix 55 55 | 56 56 | try: 57 57 | pass @@ -234,7 +234,7 @@ UP024_0.py:65:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Fix +ℹ Safe fix 62 62 | from .mmap import error 63 63 | try: 64 64 | pass @@ -254,7 +254,7 @@ UP024_0.py:87:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `mmap.error` with builtin `OSError` -ℹ Fix +ℹ Safe fix 84 84 | pass 85 85 | try: 86 86 | pass @@ -274,7 +274,7 @@ UP024_0.py:105:11: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Fix +ℹ Safe fix 102 102 | def get_owner_id_from_mac_address(): 103 103 | try: 104 104 | mac_address = get_primary_mac_address() @@ -294,7 +294,7 @@ UP024_0.py:114:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `os.error` with builtin `OSError` -ℹ Fix +ℹ Safe 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 b72dbccc24..d0a723a1b9 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` -ℹ Fix +ℹ Safe fix 2 2 | 3 3 | try: 4 4 | pass @@ -32,7 +32,7 @@ UP024_1.py:7:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Fix +ℹ Safe fix 4 4 | pass 5 5 | except (OSError, mmap.error, IOError): 6 6 | pass @@ -57,7 +57,7 @@ UP024_1.py:12:8: UP024 [*] Replace aliased errors with `OSError` | = help: Replace with builtin `OSError` -ℹ Fix +ℹ Safe 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 27acf0fc06..eecdf5fea5 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` -ℹ Fix +ℹ Safe fix 7 7 | 8 8 | # Testing the modules 9 9 | import socket, mmap, select @@ -32,7 +32,7 @@ UP024_2.py:11:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `mmap.error` with builtin `OSError` -ℹ Fix +ℹ Safe fix 8 8 | # Testing the modules 9 9 | import socket, mmap, select 10 10 | raise socket.error @@ -53,7 +53,7 @@ UP024_2.py:12:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `select.error` with builtin `OSError` -ℹ Fix +ℹ Safe fix 9 9 | import socket, mmap, select 10 10 | raise socket.error 11 11 | raise mmap.error @@ -74,7 +74,7 @@ UP024_2.py:14:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `socket.error` with builtin `OSError` -ℹ Fix +ℹ Safe fix 11 11 | raise mmap.error 12 12 | raise select.error 13 13 | @@ -93,7 +93,7 @@ UP024_2.py:15:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `mmap.error` with builtin `OSError` -ℹ Fix +ℹ Safe fix 12 12 | raise select.error 13 13 | 14 14 | raise socket.error() @@ -114,7 +114,7 @@ UP024_2.py:16:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `select.error` with builtin `OSError` -ℹ Fix +ℹ Safe fix 13 13 | 14 14 | raise socket.error() 15 15 | raise mmap.error(1) @@ -135,7 +135,7 @@ UP024_2.py:18:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `socket.error` with builtin `OSError` -ℹ Fix +ℹ Safe fix 15 15 | raise mmap.error(1) 16 16 | raise select.error(1, 2) 17 17 | @@ -155,7 +155,7 @@ UP024_2.py:25:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `error` with builtin `OSError` -ℹ Fix +ℹ Safe fix 22 22 | ) 23 23 | 24 24 | from mmap import error @@ -175,7 +175,7 @@ UP024_2.py:28:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `error` with builtin `OSError` -ℹ Fix +ℹ Safe fix 25 25 | raise error 26 26 | 27 27 | from socket import error @@ -195,7 +195,7 @@ UP024_2.py:31:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `error` with builtin `OSError` -ℹ Fix +ℹ Safe fix 28 28 | raise error(1) 29 29 | 30 30 | from select import error @@ -215,7 +215,7 @@ UP024_2.py:34:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `EnvironmentError` with builtin `OSError` -ℹ Fix +ℹ Safe fix 31 31 | raise error(1, 2) 32 32 | 33 33 | # Testing the names @@ -235,7 +235,7 @@ UP024_2.py:35:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `IOError` with builtin `OSError` -ℹ Fix +ℹ Safe fix 32 32 | 33 33 | # Testing the names 34 34 | raise EnvironmentError @@ -256,7 +256,7 @@ UP024_2.py:36:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `WindowsError` with builtin `OSError` -ℹ Fix +ℹ Safe fix 33 33 | # Testing the names 34 34 | raise EnvironmentError 35 35 | raise IOError @@ -277,7 +277,7 @@ UP024_2.py:38:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `EnvironmentError` with builtin `OSError` -ℹ Fix +ℹ Safe fix 35 35 | raise IOError 36 36 | raise WindowsError 37 37 | @@ -296,7 +296,7 @@ UP024_2.py:39:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `IOError` with builtin `OSError` -ℹ Fix +ℹ Safe fix 36 36 | raise WindowsError 37 37 | 38 38 | raise EnvironmentError() @@ -317,7 +317,7 @@ UP024_2.py:40:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `WindowsError` with builtin `OSError` -ℹ Fix +ℹ Safe fix 37 37 | 38 38 | raise EnvironmentError() 39 39 | raise IOError(1) @@ -338,7 +338,7 @@ UP024_2.py:42:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `EnvironmentError` with builtin `OSError` -ℹ Fix +ℹ Safe fix 39 39 | raise IOError(1) 40 40 | raise WindowsError(1, 2) 41 41 | @@ -359,7 +359,7 @@ UP024_2.py:48:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `WindowsError` with builtin `OSError` -ℹ Fix +ℹ Safe fix 45 45 | 3, 46 46 | ) 47 47 | @@ -377,7 +377,7 @@ UP024_2.py:49:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `EnvironmentError` with builtin `OSError` -ℹ Fix +ℹ Safe fix 46 46 | ) 47 47 | 48 48 | raise WindowsError @@ -394,7 +394,7 @@ UP024_2.py:50:7: UP024 [*] Replace aliased errors with `OSError` | = help: Replace `IOError` with builtin `OSError` -ℹ Fix +ℹ Safe 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 59a38ba78a..40f6fbea4b 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` -ℹ Fix +ℹ Safe 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 e5e4024876..efa31f73cd 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 @@ -11,7 +11,7 @@ UP025.py:2:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Fix +ℹ Safe fix 1 1 | # These should change 2 |-x = u"Hello" 2 |+x = "Hello" @@ -30,7 +30,7 @@ UP025.py:4:1: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Fix +ℹ Safe fix 1 1 | # These should change 2 2 | x = u"Hello" 3 3 | @@ -51,7 +51,7 @@ UP025.py:6:7: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Fix +ℹ Safe fix 3 3 | 4 4 | u'world' 5 5 | @@ -72,7 +72,7 @@ UP025.py:8:7: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Fix +ℹ Safe fix 5 5 | 6 6 | print(u"Hello") 7 7 | @@ -93,7 +93,7 @@ UP025.py:12:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Fix +ℹ Safe fix 9 9 | 10 10 | import foo 11 11 | @@ -114,7 +114,7 @@ UP025.py:12:15: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Fix +ℹ Safe fix 9 9 | 10 10 | import foo 11 11 | @@ -135,7 +135,7 @@ UP025.py:12:27: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Fix +ℹ Safe fix 9 9 | 10 10 | import foo 11 11 | @@ -156,7 +156,7 @@ UP025.py:12:39: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Fix +ℹ Safe fix 9 9 | 10 10 | import foo 11 11 | @@ -177,7 +177,7 @@ UP025.py:16:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Fix +ℹ Safe fix 13 13 | 14 14 | # These should stay quoted they way they are 15 15 | @@ -197,7 +197,7 @@ UP025.py:17:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Fix +ℹ Safe fix 14 14 | # These should stay quoted they way they are 15 15 | 16 16 | x = u'hello' @@ -217,7 +217,7 @@ UP025.py:18:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Fix +ℹ Safe fix 15 15 | 16 16 | x = u'hello' 17 17 | x = u"""hello""" @@ -238,7 +238,7 @@ UP025.py:19:5: UP025 [*] Remove unicode literals from strings | = help: Remove unicode prefix -ℹ Fix +ℹ Safe fix 16 16 | x = u'hello' 17 17 | x = u"""hello""" 18 18 | x = u'''hello''' 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 ea0077ed90..56d9e70f2c 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 -ℹ Fix +ℹ Safe fix 1 1 | # Error (`from unittest import mock`) 2 2 | if True: 3 |- import mock @@ -32,7 +32,7 @@ UP026.py:7:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 4 4 | 5 5 | # Error (`from unittest import mock`) 6 6 | if True: @@ -54,7 +54,7 @@ UP026.py:11:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 8 8 | 9 9 | # Error (`from unittest.mock import *`) 10 10 | if True: @@ -74,7 +74,7 @@ UP026.py:14:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 11 11 | from mock import * 12 12 | 13 13 | # Error (`from unittest import mock`) @@ -94,7 +94,7 @@ UP026.py:17:20: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 14 14 | import mock.mock 15 15 | 16 16 | # Error (`from unittest import mock`) @@ -114,7 +114,7 @@ UP026.py:20:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 17 17 | import contextlib, mock, sys 18 18 | 19 19 | # Error (`from unittest import mock`) @@ -135,7 +135,7 @@ UP026.py:24:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 21 21 | x = "This code should be preserved one line below the mock" 22 22 | 23 23 | # Error (`from unittest import mock`) @@ -160,7 +160,7 @@ UP026.py:27:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 24 24 | from mock import mock 25 25 | 26 26 | # Error (keep trailing comma) @@ -192,7 +192,7 @@ UP026.py:33:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 30 30 | b, 31 31 | c, 32 32 | ) @@ -223,7 +223,7 @@ UP026.py:41:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 38 38 | ) 39 39 | 40 40 | # Error (avoid trailing comma) @@ -255,7 +255,7 @@ UP026.py:47:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 44 44 | b, 45 45 | c 46 46 | ) @@ -282,7 +282,7 @@ UP026.py:53:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 50 50 | c, 51 51 | mock 52 52 | ) @@ -304,7 +304,7 @@ UP026.py:54:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 51 51 | mock 52 52 | ) 53 53 | from mock import mock, a, b, c @@ -332,7 +332,7 @@ UP026.py:58:9: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 55 55 | 56 56 | if True: 57 57 | if False: @@ -358,7 +358,7 @@ UP026.py:69:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 66 66 | import os, io 67 67 | 68 68 | # Error (`from unittest import mock`) @@ -379,7 +379,7 @@ UP026.py:69:14: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 66 66 | import os, io 67 67 | 68 68 | # Error (`from unittest import mock`) @@ -400,7 +400,7 @@ UP026.py:72:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 69 69 | import mock, mock 70 70 | 71 71 | # Error (`from unittest import mock as foo`) @@ -420,7 +420,7 @@ UP026.py:75:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 72 72 | import mock as foo 73 73 | 74 74 | # Error (`from unittest import mock as foo`) @@ -441,7 +441,7 @@ UP026.py:79:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 76 76 | 77 77 | if True: 78 78 | # This should yield multiple, aliased imports. @@ -464,7 +464,7 @@ UP026.py:79:25: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 76 76 | 77 77 | if True: 78 78 | # This should yield multiple, aliased imports. @@ -487,7 +487,7 @@ UP026.py:79:38: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 76 76 | 77 77 | if True: 78 78 | # This should yield multiple, aliased imports. @@ -509,7 +509,7 @@ UP026.py:82:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 79 79 | import mock as foo, mock as bar, mock 80 80 | 81 81 | # This should yield multiple, aliased imports, and preserve `os`. @@ -532,7 +532,7 @@ UP026.py:82:25: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 79 79 | import mock as foo, mock as bar, mock 80 80 | 81 81 | # This should yield multiple, aliased imports, and preserve `os`. @@ -555,7 +555,7 @@ UP026.py:82:38: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 79 79 | import mock as foo, mock as bar, mock 80 80 | 81 81 | # This should yield multiple, aliased imports, and preserve `os`. @@ -577,7 +577,7 @@ UP026.py:86:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Import from `unittest.mock` instead -ℹ Fix +ℹ Safe fix 83 83 | 84 84 | if True: 85 85 | # This should yield multiple, aliased imports. @@ -597,7 +597,7 @@ UP026.py:93:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | = help: Replace `mock.mock` with `mock` -ℹ Fix +ℹ Safe 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 5d5bf30550..4d4a97f89a 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 -ℹ Fix +ℹ Safe 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) @@ -30,7 +30,7 @@ UP027.py:4:16: UP027 [*] Replace unpacked list comprehension with a generator ex | = help: Replace with generator expression -ℹ Fix +ℹ Safe fix 1 1 | # Should change 2 2 | foo, bar, baz = [fn(x) for x in items] 3 3 | @@ -51,7 +51,7 @@ UP027.py:6:26: UP027 [*] Replace unpacked list comprehension with a generator ex | = help: Replace with generator expression -ℹ Fix +ℹ Safe fix 3 3 | 4 4 | foo, bar, baz =[fn(x) for x in items] 5 5 | @@ -72,7 +72,7 @@ UP027.py:8:17: UP027 [*] Replace unpacked list comprehension with a generator ex | = help: Replace with generator expression -ℹ Fix +ℹ Safe fix 5 5 | 6 6 | foo, bar, baz = [fn(x) for x in items] 7 7 | @@ -97,7 +97,7 @@ UP027.py:10:17: UP027 [*] Replace unpacked list comprehension with a generator e | = help: Replace with generator expression -ℹ Fix +ℹ Safe 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 12c38221bf..8d5334bbd0 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` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | def f(): 2 |- for x in y: 3 |- yield x @@ -30,7 +30,7 @@ UP028_0.py:7:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Suggested fix +ℹ Unsafe fix 4 4 | 5 5 | 6 6 | def g(): @@ -51,7 +51,7 @@ UP028_0.py:12:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Suggested fix +ℹ Unsafe fix 9 9 | 10 10 | 11 11 | def h(): @@ -72,7 +72,7 @@ UP028_0.py:17:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Suggested fix +ℹ Unsafe fix 14 14 | 15 15 | 16 16 | def i(): @@ -93,7 +93,7 @@ UP028_0.py:22:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Suggested fix +ℹ Unsafe fix 19 19 | 20 20 | 21 21 | def j(): @@ -114,7 +114,7 @@ UP028_0.py:27:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Suggested fix +ℹ Unsafe fix 24 24 | 25 25 | 26 26 | def k(): @@ -142,7 +142,7 @@ UP028_0.py:33:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Suggested fix +ℹ Unsafe fix 30 30 | 31 31 | def f(): # Comment one\n' 32 32 | # Comment two\n' @@ -169,7 +169,7 @@ UP028_0.py:44:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Suggested fix +ℹ Unsafe fix 41 41 | 42 42 | 43 43 | def f(): @@ -192,7 +192,7 @@ UP028_0.py:49:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Suggested fix +ℹ Unsafe fix 46 46 | 47 47 | 48 48 | def f(): @@ -217,7 +217,7 @@ UP028_0.py:55:9: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Suggested fix +ℹ Unsafe fix 52 52 | def f(): 53 53 | def func(): 54 54 | # This comment is preserved\n' @@ -240,7 +240,7 @@ UP028_0.py:67:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Suggested fix +ℹ Unsafe fix 64 64 | def f(): 65 65 | for x in y: 66 66 | yield x @@ -262,7 +262,7 @@ UP028_0.py:72:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Suggested fix +ℹ Unsafe fix 69 69 | 70 70 | 71 71 | def f(): @@ -287,7 +287,7 @@ UP028_0.py:79:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | = help: Replace with `yield from` -ℹ Suggested fix +ℹ Unsafe 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 f094fbd50c..5dcbd5e6c9 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,7 @@ UP029.py:1:1: UP029 [*] Unnecessary builtin import: `*` | = help: Remove unnecessary builtin import -ℹ Suggested fix +ℹ Unsafe fix 1 |-from builtins import * 2 1 | from builtins import ascii, bytes, compile 3 2 | from builtins import str as _str @@ -26,7 +26,7 @@ UP029.py:2:1: UP029 [*] Unnecessary builtin imports: `ascii`, `bytes` | = help: Remove unnecessary builtin import -ℹ Suggested fix +ℹ Unsafe fix 1 1 | from builtins import * 2 |-from builtins import ascii, bytes, compile 2 |+from builtins import compile @@ -45,7 +45,7 @@ UP029.py:4:1: UP029 [*] Unnecessary builtin imports: `filter`, `zip` | = help: Remove unnecessary builtin import -ℹ Suggested fix +ℹ Unsafe fix 1 1 | from builtins import * 2 2 | from builtins import ascii, bytes, compile 3 3 | from builtins import str as _str @@ -66,7 +66,7 @@ UP029.py:5:1: UP029 [*] Unnecessary builtin import: `open` | = help: Remove unnecessary builtin import -ℹ Suggested fix +ℹ Unsafe 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 58595ab3a7..936bfd6887 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 -ℹ Suggested fix +ℹ Unsafe fix 1 1 | # Invalid calls; errors expected. 2 2 | 3 |-"{0}" "{1}" "{2}".format(1, 2, 3) @@ -34,7 +34,7 @@ UP030_0.py:5:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 2 2 | 3 3 | "{0}" "{1}" "{2}".format(1, 2, 3) 4 4 | @@ -57,7 +57,7 @@ UP030_0.py:9:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 6 6 | "first", "second", "third", "fourth" 7 7 | ) 8 8 | @@ -78,7 +78,7 @@ UP030_0.py:11:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 8 8 | 9 9 | '{0}'.format(1) 10 10 | @@ -99,7 +99,7 @@ UP030_0.py:13:5: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 10 10 | 11 11 | '{0:x}'.format(30) 12 12 | @@ -120,7 +120,7 @@ UP030_0.py:15:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 12 12 | 13 13 | x = '{0}'.format(1) 14 14 | @@ -143,7 +143,7 @@ UP030_0.py:17:5: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 14 14 | 15 15 | '''{0}\n{1}\n'''.format(1, 2) 16 16 | @@ -166,7 +166,7 @@ UP030_0.py:20:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 17 17 | x = "foo {0}" \ 18 18 | "bar {1}".format(1, 2) 19 19 | @@ -187,7 +187,7 @@ UP030_0.py:22:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 19 19 | 20 20 | ("{0}").format(1) 21 21 | @@ -208,7 +208,7 @@ UP030_0.py:25:5: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 22 22 | "\N{snowman} {0}".format(1) 23 23 | 24 24 | print( @@ -231,7 +231,7 @@ UP030_0.py:30:5: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 27 27 | ) 28 28 | 29 29 | print( @@ -265,7 +265,7 @@ UP030_0.py:39:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 36 36 | args = list(range(10)) 37 37 | kwargs = {x: x for x in range(10)} 38 38 | @@ -286,7 +286,7 @@ UP030_0.py:41:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 38 38 | 39 39 | "{0}".format(*args) 40 40 | @@ -307,7 +307,7 @@ UP030_0.py:43:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 40 40 | 41 41 | "{0}".format(**kwargs) 42 42 | @@ -328,7 +328,7 @@ UP030_0.py:45:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 42 42 | 43 43 | "{0}_{1}".format(*args) 44 44 | @@ -349,7 +349,7 @@ UP030_0.py:47:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 44 44 | 45 45 | "{0}_{1}".format(1, *args) 46 46 | @@ -370,7 +370,7 @@ UP030_0.py:49:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 46 46 | 47 47 | "{0}_{1}".format(1, 2, *args) 48 48 | @@ -391,7 +391,7 @@ UP030_0.py:51:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 48 48 | 49 49 | "{0}_{1}".format(*args, 1, 2) 50 50 | @@ -412,7 +412,7 @@ UP030_0.py:53:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 50 50 | 51 51 | "{0}_{1}_{2}".format(1, **kwargs) 52 52 | @@ -433,7 +433,7 @@ UP030_0.py:55:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 52 52 | 53 53 | "{0}_{1}_{2}".format(1, 2, **kwargs) 54 54 | @@ -454,7 +454,7 @@ UP030_0.py:57:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 54 54 | 55 55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs) 56 56 | @@ -475,7 +475,7 @@ UP030_0.py:59:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe fix 56 56 | 57 57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs) 58 58 | @@ -493,7 +493,7 @@ UP030_0.py:61:1: UP030 [*] Use implicit references for positional format fields | = help: Remove explicit positional indices -ℹ Suggested fix +ℹ Unsafe 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 45ed171e74..a06ca5060c 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,7 @@ UP031_0.py:4:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 1 1 | a, b, x, y = 1, 2, 3, 4 2 2 | 3 3 | # UP031 @@ -32,7 +32,7 @@ UP031_0.py:6:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 3 3 | # UP031 4 4 | print('%s %s' % (a, b)) 5 5 | @@ -53,7 +53,7 @@ UP031_0.py:8:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 5 5 | 6 6 | print('%s%s' % (a, b)) 7 7 | @@ -74,7 +74,7 @@ UP031_0.py:10:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 7 7 | 8 8 | print("trivial" % ()) 9 9 | @@ -95,7 +95,7 @@ UP031_0.py:12:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 9 9 | 10 10 | print("%s" % ("simple",)) 11 11 | @@ -116,7 +116,7 @@ UP031_0.py:12:15: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 9 9 | 10 10 | print("%s" % ("simple",)) 11 11 | @@ -137,7 +137,7 @@ UP031_0.py:14:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 11 11 | 12 12 | print("%s" % ("%s" % ("nested",),)) 13 13 | @@ -158,7 +158,7 @@ UP031_0.py:16:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 13 13 | 14 14 | print("%s%% percent" % (15,)) 15 15 | @@ -179,7 +179,7 @@ UP031_0.py:18:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 15 15 | 16 16 | print("%f" % (15,)) 17 17 | @@ -200,7 +200,7 @@ UP031_0.py:20:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 17 17 | 18 18 | print("%.f" % (15,)) 19 19 | @@ -221,7 +221,7 @@ UP031_0.py:22:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 19 19 | 20 20 | print("%.3f" % (15,)) 21 21 | @@ -242,7 +242,7 @@ UP031_0.py:24:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 21 21 | 22 22 | print("%3f" % (15,)) 23 23 | @@ -263,7 +263,7 @@ UP031_0.py:26:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 23 23 | 24 24 | print("%-5f" % (5,)) 25 25 | @@ -284,7 +284,7 @@ UP031_0.py:28:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 25 25 | 26 26 | print("%9f" % (5,)) 27 27 | @@ -305,7 +305,7 @@ UP031_0.py:30:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 27 27 | 28 28 | print("%#o" % (123,)) 29 29 | @@ -327,7 +327,7 @@ UP031_0.py:33:3: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 30 30 | print("brace {} %s" % (1,)) 31 31 | 32 32 | print( @@ -348,7 +348,7 @@ UP031_0.py:38:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 35 35 | ) 36 36 | ) 37 37 | @@ -369,7 +369,7 @@ UP031_0.py:40:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 37 37 | 38 38 | print("foo %s " % (x,)) 39 39 | @@ -394,7 +394,7 @@ UP031_0.py:42:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 39 39 | 40 40 | print("%(k)s" % {"k": "v"}) 41 41 | @@ -421,7 +421,7 @@ UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 44 44 | "i": "j" 45 45 | }) 46 46 | @@ -442,7 +442,7 @@ UP031_0.py:49:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 46 46 | 47 47 | print("%(to_list)s" % {"to_list": []}) 48 48 | @@ -463,7 +463,7 @@ UP031_0.py:51:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 48 48 | 49 49 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) 50 50 | @@ -484,7 +484,7 @@ UP031_0.py:53:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 50 50 | 51 51 | print("%(ab)s" % {"a" "b": 1}) 52 52 | @@ -505,7 +505,7 @@ UP031_0.py:56:5: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 53 53 | print("%(a)s" % {"a" : 1}) 54 54 | 55 55 | print(( @@ -528,7 +528,7 @@ UP031_0.py:61:5: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 58 58 | )) 59 59 | 60 60 | print( @@ -552,7 +552,7 @@ UP031_0.py:67:5: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 64 64 | 65 65 | bar = {"bar": y} 66 66 | print( @@ -575,7 +575,7 @@ UP031_0.py:71:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 68 68 | "bar %(bar)s" % {"foo": x, **bar} 69 69 | ) 70 70 | @@ -596,7 +596,7 @@ UP031_0.py:73:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 70 70 | 71 71 | print("%s \N{snowman}" % (a,)) 72 72 | @@ -617,7 +617,7 @@ UP031_0.py:75:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 72 72 | 73 73 | print("%(foo)s \N{snowman}" % {"foo": 1}) 74 74 | @@ -637,7 +637,7 @@ UP031_0.py:78:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 75 75 | print(("foo %s " "bar %s") % (x, y)) 76 76 | 77 77 | # Single-value expressions @@ -658,7 +658,7 @@ UP031_0.py:79:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 76 76 | 77 77 | # Single-value expressions 78 78 | print('Hello %s' % "World") @@ -679,7 +679,7 @@ UP031_0.py:80:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 77 77 | # Single-value expressions 78 78 | print('Hello %s' % "World") 79 79 | print('Hello %s' % f"World") @@ -700,7 +700,7 @@ UP031_0.py:81:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 78 78 | print('Hello %s' % "World") 79 79 | print('Hello %s' % f"World") 80 80 | print('Hello %s (%s)' % bar) @@ -721,7 +721,7 @@ UP031_0.py:82:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 79 79 | print('Hello %s' % f"World") 80 80 | print('Hello %s (%s)' % bar) 81 81 | print('Hello %s (%s)' % bar.baz) @@ -742,7 +742,7 @@ UP031_0.py:83:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 80 80 | print('Hello %s (%s)' % bar) 81 81 | print('Hello %s (%s)' % bar.baz) 82 82 | print('Hello %s (%s)' % bar['bop']) @@ -762,7 +762,7 @@ UP031_0.py:84:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 81 81 | print('Hello %s (%s)' % bar.baz) 82 82 | print('Hello %s (%s)' % bar['bop']) 83 83 | print('Hello %(arg)s' % bar) @@ -783,7 +783,7 @@ UP031_0.py:85:7: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 82 82 | print('Hello %s (%s)' % bar['bop']) 83 83 | print('Hello %(arg)s' % bar) 84 84 | print('Hello %(arg)s' % bar.baz) @@ -806,7 +806,7 @@ UP031_0.py:88:1: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 86 86 | 87 87 | # Hanging modulos 88 88 | ( @@ -834,7 +834,7 @@ UP031_0.py:93:1: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 91 91 | ) % (x, y) 92 92 | 93 93 | ( @@ -859,7 +859,7 @@ UP031_0.py:99:5: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 96 96 | ) % {"foo": x, "bar": y} 97 97 | 98 98 | ( @@ -883,7 +883,7 @@ UP031_0.py:104:5: UP031 [*] Use format specifiers instead of percent format | = help: Replace with format specifiers -ℹ Suggested fix +ℹ Unsafe fix 102 102 | 103 103 | ( 104 104 | """ 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 de1fccc802..b6849b082c 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 -ℹ Fix +ℹ Safe fix 2 2 | # Errors 3 3 | ### 4 4 | @@ -33,7 +33,7 @@ UP032_0.py:7:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 4 4 | 5 5 | "{} {}".format(a, b) 6 6 | @@ -54,7 +54,7 @@ UP032_0.py:9:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 6 6 | 7 7 | "{1} {0}".format(a, b) 8 8 | @@ -75,7 +75,7 @@ UP032_0.py:11:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 8 8 | 9 9 | "{0} {1} {0}".format(a, b) 10 10 | @@ -96,7 +96,7 @@ UP032_0.py:13:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 10 10 | 11 11 | "{x.y}".format(x=z) 12 12 | @@ -117,7 +117,7 @@ UP032_0.py:15:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 12 12 | 13 13 | "{x} {y} {x}".format(x=a, y=b) 14 14 | @@ -138,7 +138,7 @@ UP032_0.py:17:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 14 14 | 15 15 | "{.x} {.y}".format(a, b) 16 16 | @@ -159,7 +159,7 @@ UP032_0.py:19:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 16 16 | 17 17 | "{} {}".format(a.b, c.d) 18 18 | @@ -180,7 +180,7 @@ UP032_0.py:21:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 18 18 | 19 19 | "{}".format(a()) 20 20 | @@ -201,7 +201,7 @@ UP032_0.py:23:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 20 20 | 21 21 | "{}".format(a.b()) 22 22 | @@ -222,7 +222,7 @@ UP032_0.py:25:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 22 22 | 23 23 | "{}".format(a.b().c()) 24 24 | @@ -243,7 +243,7 @@ UP032_0.py:27:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 24 24 | 25 25 | "hello {}!".format(name) 26 26 | @@ -264,7 +264,7 @@ UP032_0.py:29:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 26 26 | 27 27 | "{}{b}{}".format(a, c, b=b) 28 28 | @@ -285,7 +285,7 @@ UP032_0.py:31:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 28 28 | 29 29 | "{}".format(0x0) 30 30 | @@ -306,7 +306,7 @@ UP032_0.py:33:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 30 30 | 31 31 | "{} {}".format(a, b) 32 32 | @@ -327,7 +327,7 @@ UP032_0.py:35:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 32 32 | 33 33 | """{} {}""".format(a, b) 34 34 | @@ -348,7 +348,7 @@ UP032_0.py:37:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 34 34 | 35 35 | "foo{}".format(1) 36 36 | @@ -369,7 +369,7 @@ UP032_0.py:39:5: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 36 36 | 37 37 | r"foo{}".format(1) 38 38 | @@ -390,7 +390,7 @@ UP032_0.py:41:7: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 38 38 | 39 39 | x = "{a}".format(a=1) 40 40 | @@ -411,7 +411,7 @@ UP032_0.py:43:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 40 40 | 41 41 | print("foo {} ".format(x)) 42 42 | @@ -432,7 +432,7 @@ UP032_0.py:45:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 42 42 | 43 43 | "{a[b]}".format(a=a) 44 44 | @@ -453,7 +453,7 @@ UP032_0.py:47:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 44 44 | 45 45 | "{a.a[b]}".format(a=a) 46 46 | @@ -474,7 +474,7 @@ UP032_0.py:49:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 46 46 | 47 47 | "{}{{}}{}".format(escaped, y) 48 48 | @@ -495,7 +495,7 @@ UP032_0.py:51:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 48 48 | 49 49 | "{}".format(a) 50 50 | @@ -516,7 +516,7 @@ UP032_0.py:53:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 50 50 | 51 51 | '({}={{0!e}})'.format(a) 52 52 | @@ -537,7 +537,7 @@ UP032_0.py:55:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 52 52 | 53 53 | "{[b]}".format(a) 54 54 | @@ -558,7 +558,7 @@ UP032_0.py:57:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 54 54 | 55 55 | '{[b]}'.format(a) 56 56 | @@ -579,7 +579,7 @@ UP032_0.py:59:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 56 56 | 57 57 | """{[b]}""".format(a) 58 58 | @@ -602,7 +602,7 @@ UP032_0.py:61:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 58 58 | 59 59 | '''{[b]}'''.format(a) 60 60 | @@ -627,7 +627,7 @@ UP032_0.py:65:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 62 62 | 1 63 63 | ) 64 64 | @@ -652,7 +652,7 @@ UP032_0.py:69:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 66 66 | 1111111111111111111111111111111111111111111111111111111111111111111111111, 67 67 | ) 68 68 | @@ -681,7 +681,7 @@ UP032_0.py:73:85: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 70 70 | {} 71 71 | """.format(1) 72 72 | @@ -708,7 +708,7 @@ UP032_0.py:79:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 76 76 | 111111 77 77 | ) 78 78 | @@ -732,7 +732,7 @@ UP032_0.py:81:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 79 79 | "{a}" "{b}".format(a=1, b=1) 80 80 | 81 81 | ( @@ -762,7 +762,7 @@ UP032_0.py:86:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 84 84 | ).format(a=1, b=1) 85 85 | 86 86 | ( @@ -795,7 +795,7 @@ UP032_0.py:94:5: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 93 93 | ( 94 94 | ( 95 95 | # comment @@ -824,7 +824,7 @@ UP032_0.py:104:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 102 102 | ) 103 103 | 104 104 | ( @@ -845,7 +845,7 @@ UP032_0.py:111:11: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 108 108 | 109 109 | 110 110 | def d(osname, version, release): @@ -863,7 +863,7 @@ UP032_0.py:115:10: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 112 112 | 113 113 | 114 114 | def e(): @@ -880,7 +880,7 @@ UP032_0.py:118:7: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 115 115 | yield"{}".format(1) 116 116 | 117 117 | @@ -898,7 +898,7 @@ UP032_0.py:122:12: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 119 119 | 120 120 | 121 121 | async def c(): @@ -916,7 +916,7 @@ UP032_0.py:126:12: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 123 123 | 124 124 | 125 125 | async def c(): @@ -935,7 +935,7 @@ UP032_0.py:129:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 126 126 | return "{}".format(1 + await 3) 127 127 | 128 128 | @@ -965,7 +965,7 @@ UP032_0.py:209:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe 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. 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 7e4e038825..59cb45d8e4 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,7 @@ UP032_1.py:1:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe 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 abbe906198..1a0736c7da 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 -ℹ Fix +ℹ Safe fix 1 1 | # Errors 2 |-"{.real}".format(1) 2 |+f"{(1).real}" @@ -29,7 +29,7 @@ UP032_2.py:3:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 1 1 | # Errors 2 2 | "{.real}".format(1) 3 |-"{0.real}".format(1) @@ -49,7 +49,7 @@ UP032_2.py:4:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 1 1 | # Errors 2 2 | "{.real}".format(1) 3 3 | "{0.real}".format(1) @@ -70,7 +70,7 @@ UP032_2.py:6:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 3 3 | "{0.real}".format(1) 4 4 | "{a.real}".format(a=1) 5 5 | @@ -89,7 +89,7 @@ UP032_2.py:7:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 4 4 | "{a.real}".format(a=1) 5 5 | 6 6 | "{.real}".format(1.0) @@ -110,7 +110,7 @@ UP032_2.py:8:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 5 5 | 6 6 | "{.real}".format(1.0) 7 7 | "{0.real}".format(1.0) @@ -131,7 +131,7 @@ UP032_2.py:10:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 7 7 | "{0.real}".format(1.0) 8 8 | "{a.real}".format(a=1.0) 9 9 | @@ -150,7 +150,7 @@ UP032_2.py:11:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 8 8 | "{a.real}".format(a=1.0) 9 9 | 10 10 | "{.real}".format(1j) @@ -171,7 +171,7 @@ UP032_2.py:12:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 9 9 | 10 10 | "{.real}".format(1j) 11 11 | "{0.real}".format(1j) @@ -192,7 +192,7 @@ UP032_2.py:14:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 11 11 | "{0.real}".format(1j) 12 12 | "{a.real}".format(a=1j) 13 13 | @@ -211,7 +211,7 @@ UP032_2.py:15:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 12 12 | "{a.real}".format(a=1j) 13 13 | 14 14 | "{.real}".format(0b01) @@ -232,7 +232,7 @@ UP032_2.py:16:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 13 13 | 14 14 | "{.real}".format(0b01) 15 15 | "{0.real}".format(0b01) @@ -253,7 +253,7 @@ UP032_2.py:18:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 15 15 | "{0.real}".format(0b01) 16 16 | "{a.real}".format(a=0b01) 17 17 | @@ -273,7 +273,7 @@ UP032_2.py:19:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 16 16 | "{a.real}".format(a=0b01) 17 17 | 18 18 | "{}".format(1 + 2) @@ -294,7 +294,7 @@ UP032_2.py:20:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 17 17 | 18 18 | "{}".format(1 + 2) 19 19 | "{}".format([1, 2]) @@ -314,7 +314,7 @@ UP032_2.py:21:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 18 18 | "{}".format(1 + 2) 19 19 | "{}".format([1, 2]) 20 20 | "{}".format({1, 2}) @@ -335,7 +335,7 @@ UP032_2.py:22:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 19 19 | "{}".format([1, 2]) 20 20 | "{}".format({1, 2}) 21 21 | "{}".format({1: 2, 3: 4}) @@ -356,7 +356,7 @@ UP032_2.py:24:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 21 21 | "{}".format({1: 2, 3: 4}) 22 22 | "{}".format((i for i in range(2))) 23 23 | @@ -376,7 +376,7 @@ UP032_2.py:25:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 22 22 | "{}".format((i for i in range(2))) 23 23 | 24 24 | "{.real}".format(1 + 2) @@ -397,7 +397,7 @@ UP032_2.py:26:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 23 23 | 24 24 | "{.real}".format(1 + 2) 25 25 | "{.real}".format([1, 2]) @@ -416,7 +416,7 @@ UP032_2.py:27:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe fix 24 24 | "{.real}".format(1 + 2) 25 25 | "{.real}".format([1, 2]) 26 26 | "{.real}".format({1, 2}) @@ -433,7 +433,7 @@ UP032_2.py:28:1: UP032 [*] Use f-string instead of `format` call | = help: Convert to f-string -ℹ Fix +ℹ Safe 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 48a3154a98..8d6d1475d2 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 -ℹ Fix +ℹ Safe fix 1 1 | import functools 2 2 | 3 3 | @@ -30,7 +30,7 @@ UP033_0.py:10:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca | = help: Rewrite with `@functools.cache -ℹ Fix +ℹ Safe fix 7 7 | 8 8 | 9 9 | @other_decorator @@ -49,7 +49,7 @@ UP033_0.py:15:21: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca | = help: Rewrite with `@functools.cache -ℹ Fix +ℹ Safe 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 5e4cfa4b7a..5b106d2541 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 -ℹ Fix +ℹ Safe fix 1 |-from functools import lru_cache 1 |+from functools import lru_cache, cache 2 2 | @@ -31,7 +31,7 @@ UP033_1.py:10:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca | = help: Rewrite with `@functools.cache -ℹ Fix +ℹ Safe fix 1 |-from functools import lru_cache 1 |+from functools import lru_cache, cache 2 2 | @@ -56,7 +56,7 @@ UP033_1.py:15:11: UP033 [*] Use `@functools.cache` instead of `@functools.lru_ca | = help: Rewrite with `@functools.cache -ℹ Fix +ℹ Safe 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 80779d2ad6..52e90884c1 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 -ℹ Fix +ℹ Safe fix 1 1 | # UP034 2 |-print(("foo")) 2 |+print("foo") @@ -29,7 +29,7 @@ UP034.py:5:7: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Fix +ℹ Safe fix 2 2 | print(("foo")) 3 3 | 4 4 | # UP034 @@ -49,7 +49,7 @@ UP034.py:8:7: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Fix +ℹ Safe fix 5 5 | print(("hell((goodybe))o")) 6 6 | 7 7 | # UP034 @@ -69,7 +69,7 @@ UP034.py:11:7: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Fix +ℹ Safe fix 8 8 | print((("foo"))) 9 9 | 10 10 | # UP034 @@ -89,7 +89,7 @@ UP034.py:14:7: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Fix +ℹ Safe fix 11 11 | print((((1)))) 12 12 | 13 13 | # UP034 @@ -109,7 +109,7 @@ UP034.py:18:5: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Fix +ℹ Safe fix 15 15 | 16 16 | # UP034 17 17 | print( @@ -132,7 +132,7 @@ UP034.py:23:5: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Fix +ℹ Safe fix 20 20 | 21 21 | # UP034 22 22 | print( @@ -156,7 +156,7 @@ UP034.py:30:13: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Fix +ℹ Safe fix 27 27 | 28 28 | # UP034 29 29 | def f(): @@ -176,7 +176,7 @@ UP034.py:35:9: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Fix +ℹ Safe fix 32 32 | # UP034 33 33 | if True: 34 34 | print( @@ -196,7 +196,7 @@ UP034.py:39:7: UP034 [*] Avoid extraneous parentheses | = help: Remove extraneous parentheses -ℹ Fix +ℹ Safe 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 ecbb716baf..654b5df7c8 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` -ℹ Fix +ℹ Safe fix 1 1 | # UP035 2 |-from collections import Mapping 2 |+from collections.abc import Mapping @@ -30,7 +30,7 @@ UP035.py:4:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 1 1 | # UP035 2 2 | from collections import Mapping 3 3 | @@ -51,7 +51,7 @@ UP035.py:6:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Seque | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 3 3 | 4 4 | from collections import Mapping as MAP 5 5 | @@ -72,7 +72,7 @@ UP035.py:8:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 5 5 | 6 6 | from collections import Mapping, Sequence 7 7 | @@ -94,7 +94,7 @@ UP035.py:10:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 7 7 | 8 8 | from collections import Counter, Mapping 9 9 | @@ -117,7 +117,7 @@ UP035.py:12:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 9 9 | 10 10 | from collections import (Counter, Mapping) 11 11 | @@ -141,7 +141,7 @@ UP035.py:15:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 12 12 | from collections import (Counter, 13 13 | Mapping) 14 14 | @@ -164,7 +164,7 @@ UP035.py:18:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequ | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 15 15 | from collections import Counter, \ 16 16 | Mapping 17 17 | @@ -186,7 +186,7 @@ UP035.py:20:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 17 17 | 18 18 | from collections import Counter, Mapping, Sequence 19 19 | @@ -207,7 +207,7 @@ UP035.py:23:5: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 20 20 | from collections import Mapping as mapping, Counter 21 21 | 22 22 | if True: @@ -229,7 +229,7 @@ UP035.py:28:5: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 25 25 | if True: 26 26 | if True: 27 27 | pass @@ -251,7 +251,7 @@ UP035.py:30:10: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 27 27 | pass 28 28 | from collections import Mapping, Counter 29 29 | @@ -270,7 +270,7 @@ UP035.py:33:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 30 30 | if True: from collections import Mapping 31 31 | 32 32 | import os @@ -297,7 +297,7 @@ UP035.py:37:5: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Call | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 35 35 | 36 36 | if True: 37 37 | from collections import ( @@ -322,7 +322,7 @@ UP035.py:44:1: UP035 [*] Import from `collections.abc` instead: `Callable` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 41 41 | Good, 42 42 | ) 43 43 | @@ -344,7 +344,7 @@ UP035.py:44:1: UP035 [*] Import from `collections` instead: `OrderedDict` | = help: Import from `collections` -ℹ Fix +ℹ Safe fix 41 41 | Good, 42 42 | ) 43 43 | @@ -366,7 +366,7 @@ UP035.py:44:1: UP035 [*] Import from `re` instead: `Match`, `Pattern` | = help: Import from `re` -ℹ Fix +ℹ Safe fix 41 41 | Good, 42 42 | ) 43 43 | @@ -440,7 +440,7 @@ UP035.py:51:1: UP035 [*] Import from `collections` instead: `OrderedDict` | = help: Import from `collections` -ℹ Fix +ℹ Safe fix 48 48 | 49 49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035) 50 50 | from typing import ContextManager @@ -461,7 +461,7 @@ UP035.py:52:1: UP035 [*] Import from `typing` instead: `OrderedDict` | = help: Import from `typing` -ℹ Fix +ℹ Safe 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 @@ -482,7 +482,7 @@ UP035.py:53:1: UP035 [*] Import from `collections.abc` instead: `Callable` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 50 50 | from typing import ContextManager 51 51 | from typing import OrderedDict 52 52 | from typing_extensions import OrderedDict @@ -503,7 +503,7 @@ UP035.py:54:1: UP035 [*] Import from `collections.abc` instead: `ByteString` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 51 51 | from typing import OrderedDict 52 52 | from typing_extensions import OrderedDict 53 53 | from typing import Callable @@ -524,7 +524,7 @@ UP035.py:55:1: UP035 [*] Import from `collections.abc` instead: `Container` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 52 52 | from typing_extensions import OrderedDict 53 53 | from typing import Callable 54 54 | from typing import ByteString @@ -545,7 +545,7 @@ UP035.py:56:1: UP035 [*] Import from `collections.abc` instead: `Hashable` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 53 53 | from typing import Callable 54 54 | from typing import ByteString 55 55 | from typing import Container @@ -566,7 +566,7 @@ UP035.py:57:1: UP035 [*] Import from `collections.abc` instead: `ItemsView` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 54 54 | from typing import ByteString 55 55 | from typing import Container 56 56 | from typing import Hashable @@ -587,7 +587,7 @@ UP035.py:58:1: UP035 [*] Import from `collections.abc` instead: `Iterable` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 55 55 | from typing import Container 56 56 | from typing import Hashable 57 57 | from typing import ItemsView @@ -608,7 +608,7 @@ UP035.py:59:1: UP035 [*] Import from `collections.abc` instead: `Iterator` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 56 56 | from typing import Hashable 57 57 | from typing import ItemsView 58 58 | from typing import Iterable @@ -629,7 +629,7 @@ UP035.py:60:1: UP035 [*] Import from `collections.abc` instead: `KeysView` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 57 57 | from typing import ItemsView 58 58 | from typing import Iterable 59 59 | from typing import Iterator @@ -650,7 +650,7 @@ UP035.py:61:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 58 58 | from typing import Iterable 59 59 | from typing import Iterator 60 60 | from typing import KeysView @@ -671,7 +671,7 @@ UP035.py:62:1: UP035 [*] Import from `collections.abc` instead: `MappingView` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 59 59 | from typing import Iterator 60 60 | from typing import KeysView 61 61 | from typing import Mapping @@ -692,7 +692,7 @@ UP035.py:63:1: UP035 [*] Import from `collections.abc` instead: `MutableMapping` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 60 60 | from typing import KeysView 61 61 | from typing import Mapping 62 62 | from typing import MappingView @@ -713,7 +713,7 @@ UP035.py:64:1: UP035 [*] Import from `collections.abc` instead: `MutableSequence | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 61 61 | from typing import Mapping 62 62 | from typing import MappingView 63 63 | from typing import MutableMapping @@ -734,7 +734,7 @@ UP035.py:65:1: UP035 [*] Import from `collections.abc` instead: `MutableSet` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 62 62 | from typing import MappingView 63 63 | from typing import MutableMapping 64 64 | from typing import MutableSequence @@ -755,7 +755,7 @@ UP035.py:66:1: UP035 [*] Import from `collections.abc` instead: `Sequence` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 63 63 | from typing import MutableMapping 64 64 | from typing import MutableSequence 65 65 | from typing import MutableSet @@ -776,7 +776,7 @@ UP035.py:67:1: UP035 [*] Import from `collections.abc` instead: `Sized` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 64 64 | from typing import MutableSequence 65 65 | from typing import MutableSet 66 66 | from typing import Sequence @@ -797,7 +797,7 @@ UP035.py:68:1: UP035 [*] Import from `collections.abc` instead: `ValuesView` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 65 65 | from typing import MutableSet 66 66 | from typing import Sequence 67 67 | from typing import Sized @@ -818,7 +818,7 @@ UP035.py:69:1: UP035 [*] Import from `collections.abc` instead: `Awaitable` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 66 66 | from typing import Sequence 67 67 | from typing import Sized 68 68 | from typing import ValuesView @@ -839,7 +839,7 @@ UP035.py:70:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterator` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 67 67 | from typing import Sized 68 68 | from typing import ValuesView 69 69 | from typing import Awaitable @@ -860,7 +860,7 @@ UP035.py:71:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterable` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 68 68 | from typing import ValuesView 69 69 | from typing import Awaitable 70 70 | from typing import AsyncIterator @@ -881,7 +881,7 @@ UP035.py:72:1: UP035 [*] Import from `collections.abc` instead: `Coroutine` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 69 69 | from typing import Awaitable 70 70 | from typing import AsyncIterator 71 71 | from typing import AsyncIterable @@ -902,7 +902,7 @@ UP035.py:73:1: UP035 [*] Import from `collections.abc` instead: `Collection` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 70 70 | from typing import AsyncIterator 71 71 | from typing import AsyncIterable 72 72 | from typing import Coroutine @@ -923,7 +923,7 @@ UP035.py:74:1: UP035 [*] Import from `collections.abc` instead: `AsyncGenerator` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 71 71 | from typing import AsyncIterable 72 72 | from typing import Coroutine 73 73 | from typing import Collection @@ -944,7 +944,7 @@ UP035.py:75:1: UP035 [*] Import from `collections.abc` instead: `Reversible` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 72 72 | from typing import Coroutine 73 73 | from typing import Collection 74 74 | from typing import AsyncGenerator @@ -965,7 +965,7 @@ UP035.py:76:1: UP035 [*] Import from `collections.abc` instead: `Generator` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 73 73 | from typing import Collection 74 74 | from typing import AsyncGenerator 75 75 | from typing import Reversible @@ -985,7 +985,7 @@ UP035.py:77:1: UP035 [*] Import from `collections.abc` instead: `Callable` | = help: Import from `collections.abc` -ℹ Fix +ℹ Safe fix 74 74 | from typing import AsyncGenerator 75 75 | from typing import Reversible 76 76 | from typing import Generator @@ -1005,7 +1005,7 @@ UP035.py:87:1: UP035 [*] Import from `typing` instead: `NamedTuple` | = help: Import from `typing` -ℹ Fix +ℹ Safe fix 84 84 | from typing_extensions import SupportsIndex 85 85 | 86 86 | # OK: `typing_extensions` contains backported improvements. @@ -1025,7 +1025,7 @@ UP035.py:90:1: UP035 [*] Import from `typing` instead: `dataclass_transform` | = help: Import from `typing` -ℹ Fix +ℹ Safe fix 87 87 | from typing_extensions import NamedTuple 88 88 | 89 89 | # OK: `typing_extensions` supports `frozen_default` (backported from 3.12). @@ -1043,7 +1043,7 @@ UP035.py:93:1: UP035 [*] Import from `enum` instead: `StrEnum` | = help: Import from `enum` -ℹ Fix +ℹ Safe fix 90 90 | from typing_extensions import dataclass_transform 91 91 | 92 92 | # UP035 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 19e79910ff..cce1e2f061 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 -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import sys 2 2 | 3 |-if sys.version_info < (3,0): @@ -35,7 +35,7 @@ UP036_0.py:8:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 5 5 | else: 6 6 | print("py3") 7 7 | @@ -61,7 +61,7 @@ UP036_0.py:16:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 13 13 | else: 14 14 | print("py3") 15 15 | @@ -82,7 +82,7 @@ UP036_0.py:20:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 17 17 | else: print("PY3!") 18 18 | 19 19 | if True: @@ -106,7 +106,7 @@ UP036_0.py:25:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 22 22 | else: 23 23 | print("PY3") 24 24 | @@ -129,7 +129,7 @@ UP036_0.py:29:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 26 26 | else: 27 27 | print("py3") 28 28 | @@ -158,7 +158,7 @@ UP036_0.py:37:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 34 34 | print("py3") 35 35 | print("This the next") 36 36 | @@ -182,7 +182,7 @@ UP036_0.py:45:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 42 42 | 43 43 | x = 1 44 44 | @@ -205,7 +205,7 @@ UP036_0.py:53:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 50 50 | 51 51 | x = 1 52 52 | @@ -227,7 +227,7 @@ UP036_0.py:56:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 53 53 | if sys.version_info > (3,0): print("py3") 54 54 | else: print("py2") 55 55 | @@ -250,7 +250,7 @@ UP036_0.py:62:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 59 59 | print("py2") 60 60 | 61 61 | if True: @@ -274,7 +274,7 @@ UP036_0.py:67:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 64 64 | else: 65 65 | print("py2") 66 66 | @@ -297,7 +297,7 @@ UP036_0.py:73:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 70 70 | print("py3") 71 71 | 72 72 | def f(): @@ -324,7 +324,7 @@ UP036_0.py:86:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 83 83 | def g(): 84 84 | pass 85 85 | @@ -350,7 +350,7 @@ UP036_0.py:97:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 94 94 | pass 95 95 | 96 96 | if True: @@ -374,7 +374,7 @@ UP036_0.py:104:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 101 101 | 102 102 | # comment 103 103 | @@ -406,7 +406,7 @@ UP036_0.py:116:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 113 113 | print("py3") 114 114 | 115 115 | if True: @@ -427,7 +427,7 @@ UP036_0.py:122:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 119 119 | print(2+3) 120 120 | 121 121 | if True: @@ -446,7 +446,7 @@ UP036_0.py:125:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 122 122 | if sys.version_info > (3,): print(3) 123 123 | 124 124 | if True: @@ -467,7 +467,7 @@ UP036_0.py:130:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 127 127 | 128 128 | 129 129 | if True: @@ -494,7 +494,7 @@ UP036_0.py:140:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 137 137 | ] 138 138 | 139 139 | @@ -521,7 +521,7 @@ UP036_0.py:150:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 147 147 | ] 148 148 | 149 149 | @@ -556,7 +556,7 @@ UP036_0.py:163:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 160 160 | ("so is" 161 161 | "this for some reason") 162 162 | @@ -577,7 +577,7 @@ UP036_0.py:166:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 163 163 | if sys.version_info > (3, 0): expected_error = \ 164 164 | [] 165 165 | @@ -597,7 +597,7 @@ UP036_0.py:168:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 165 165 | 166 166 | if sys.version_info > (3, 0): expected_error = [] 167 167 | @@ -617,7 +617,7 @@ UP036_0.py:172:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 169 169 | expected_error = [] 170 170 | 171 171 | if True: @@ -637,7 +637,7 @@ UP036_0.py:176:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 173 173 | [] 174 174 | 175 175 | if True: @@ -656,7 +656,7 @@ UP036_0.py:179:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 176 176 | if sys.version_info > (3, 0): expected_error = [] 177 177 | 178 178 | if True: @@ -675,7 +675,7 @@ UP036_0.py:182:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 179 179 | if sys.version_info > (3, 0): \ 180 180 | expected_error = [] 181 181 | @@ -722,7 +722,7 @@ UP036_0.py:203:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 200 200 | if sys.version_info > (3,12): 201 201 | print("py3") 202 202 | @@ -742,7 +742,7 @@ UP036_0.py:207:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 204 204 | print("py3") 205 205 | 206 206 | # Slices on `sys.version_info` should be treated equivalently. @@ -763,7 +763,7 @@ UP036_0.py:210:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 207 207 | if sys.version_info[:2] >= (3,0): 208 208 | print("py3") 209 209 | 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 2a585cc3f9..e89393c5a4 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 -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import sys 2 2 | 3 |-if sys.version_info == 2: @@ -35,7 +35,7 @@ UP036_1.py:8:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 5 5 | else: 6 6 | 3 7 7 | @@ -59,7 +59,7 @@ UP036_1.py:13:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 10 10 | else: 11 11 | 3 12 12 | @@ -83,7 +83,7 @@ UP036_1.py:18:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 15 15 | else: 16 16 | 3 17 17 | @@ -107,7 +107,7 @@ UP036_1.py:23:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 20 20 | else: 21 21 | 2 22 22 | @@ -131,7 +131,7 @@ UP036_1.py:28:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 25 25 | else: 26 26 | 2 27 27 | @@ -155,7 +155,7 @@ UP036_1.py:35:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 32 32 | 33 33 | from sys import version_info 34 34 | @@ -179,7 +179,7 @@ UP036_1.py:42:6: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 39 39 | 40 40 | if True: 41 41 | print(1) @@ -200,7 +200,7 @@ UP036_1.py:49:6: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 46 46 | 47 47 | if True: 48 48 | print(1) @@ -223,7 +223,7 @@ UP036_1.py:56:6: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 53 53 | 54 54 | if True: 55 55 | print(1) @@ -243,7 +243,7 @@ UP036_1.py:62:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 59 59 | def f(): 60 60 | if True: 61 61 | print(1) @@ -264,7 +264,7 @@ UP036_1.py:67:6: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 64 64 | 65 65 | if True: 66 66 | print(1) @@ -284,7 +284,7 @@ UP036_1.py:75:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe 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 8e8332bdd9..0a280dc505 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 -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import sys 2 2 | from sys import version_info 3 3 | @@ -36,7 +36,7 @@ UP036_2.py:9:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 6 6 | else: 7 7 | 3-5 8 8 | @@ -60,7 +60,7 @@ UP036_2.py:14:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 11 11 | else: 12 12 | 3-5 13 13 | @@ -84,7 +84,7 @@ UP036_2.py:19:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 16 16 | else: 17 17 | 3-5 18 18 | @@ -108,7 +108,7 @@ UP036_2.py:24:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 21 21 | else: 22 22 | 3-5 23 23 | @@ -132,7 +132,7 @@ UP036_2.py:29:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 26 26 | else: 27 27 | 3+6 28 28 | @@ -156,7 +156,7 @@ UP036_2.py:34:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 31 31 | else: 32 32 | 3+6 33 33 | @@ -179,7 +179,7 @@ UP036_2.py:39:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 36 36 | else: 37 37 | 3+6 38 38 | @@ -200,7 +200,7 @@ UP036_2.py:42:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 39 39 | if sys.version_info >= (3, 5): 40 40 | pass 41 41 | @@ -219,7 +219,7 @@ UP036_2.py:46:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 43 43 | pass 44 44 | 45 45 | if True: @@ -241,7 +241,7 @@ UP036_2.py:49:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 46 46 | if sys.version_info < (3,0): 47 47 | pass 48 48 | @@ -264,7 +264,7 @@ UP036_2.py:54:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe 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 d38cfd8b0b..d22d368074 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 -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import sys 2 2 | 3 |-if sys.version_info < (3,0): @@ -40,7 +40,7 @@ UP036_3.py:13:19: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 10 10 | print(f"PY3-{item}") 11 11 | 12 12 | if False: @@ -67,7 +67,7 @@ UP036_3.py:23:15: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe 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 28701a4d0a..db21eecad4 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 -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import sys 2 2 | 3 3 | if True: @@ -31,7 +31,7 @@ UP036_4.py:11:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 8 8 | if True: 9 9 | if foo: 10 10 | print() @@ -53,7 +53,7 @@ UP036_4.py:17:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 14 14 | if True: 15 15 | if foo: 16 16 | print() @@ -73,7 +73,7 @@ UP036_4.py:24:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 21 21 | 22 22 | if foo: 23 23 | print() @@ -94,7 +94,7 @@ UP036_4.py:27:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 24 24 | elif sys.version_info < (3, 3): 25 25 | cmd = [sys.executable, "-m", "test.regrtest"] 26 26 | @@ -115,7 +115,7 @@ UP036_4.py:32:10: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 29 29 | 30 30 | if foo: 31 31 | print() @@ -136,7 +136,7 @@ UP036_4.py:37:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe fix 34 34 | else: 35 35 | cmd = [sys.executable, "-m", "test", "-j0"] 36 36 | @@ -160,7 +160,7 @@ UP036_4.py:42:8: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe 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 f4a5ed2787..5a121f09e4 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 -ℹ Suggested fix +ℹ Unsafe fix 1 1 | import sys 2 2 | 3 |-if sys.version_info < (3, 8): @@ -41,7 +41,7 @@ UP036_5.py:18:4: UP036 [*] Version block is outdated for minimum Python version | = help: Remove outdated version block -ℹ Suggested fix +ℹ Unsafe 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.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037.py.snap index e934936c49..ba2b0900af 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP037.py.snap @@ -9,7 +9,7 @@ UP037.py:18:14: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 15 15 | from mypy_extensions import Arg, DefaultArg, DefaultNamedArg, NamedArg, VarArg 16 16 | 17 17 | @@ -27,7 +27,7 @@ UP037.py:18:28: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 15 15 | from mypy_extensions import Arg, DefaultArg, DefaultNamedArg, NamedArg, VarArg 16 16 | 17 17 | @@ -45,7 +45,7 @@ UP037.py:19:8: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 16 16 | 17 17 | 18 18 | def foo(var: "MyClass") -> "MyClass": @@ -63,7 +63,7 @@ UP037.py:22:21: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 19 19 | x: "MyClass" 20 20 | 21 21 | @@ -81,7 +81,7 @@ UP037.py:26:16: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 23 23 | pass 24 24 | 25 25 | @@ -99,7 +99,7 @@ UP037.py:26:33: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 23 23 | pass 24 24 | 25 25 | @@ -118,7 +118,7 @@ UP037.py:30:10: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 27 27 | pass 28 28 | 29 29 | @@ -137,7 +137,7 @@ UP037.py:32:14: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 29 29 | 30 30 | x: Tuple["MyClass"] 31 31 | @@ -155,7 +155,7 @@ UP037.py:36:8: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 33 33 | 34 34 | 35 35 | class Foo(NamedTuple): @@ -173,7 +173,7 @@ UP037.py:40:27: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 37 37 | 38 38 | 39 39 | class D(TypedDict): @@ -191,7 +191,7 @@ UP037.py:44:31: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 41 41 | 42 42 | 43 43 | class D(TypedDict): @@ -210,7 +210,7 @@ UP037.py:47:14: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 44 44 | E: TypedDict("E", {"foo": "int"}) 45 45 | 46 46 | @@ -231,7 +231,7 @@ UP037.py:49:8: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 46 46 | 47 47 | x: Annotated["str", "metadata"] 48 48 | @@ -252,7 +252,7 @@ UP037.py:51:15: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 48 48 | 49 49 | x: Arg("str", "name") 50 50 | @@ -273,7 +273,7 @@ UP037.py:53:13: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 50 50 | 51 51 | x: DefaultArg("str", "name") 52 52 | @@ -294,7 +294,7 @@ UP037.py:55:20: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 52 52 | 53 53 | x: NamedArg("str", "name") 54 54 | @@ -315,7 +315,7 @@ UP037.py:57:20: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 54 54 | 55 55 | x: DefaultNamedArg("str", "name") 56 56 | @@ -336,7 +336,7 @@ UP037.py:59:11: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 56 56 | 57 57 | x: DefaultNamedArg("str", name="name") 58 58 | @@ -357,7 +357,7 @@ UP037.py:61:19: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 58 58 | 59 59 | x: VarArg("str") 60 60 | @@ -378,7 +378,7 @@ UP037.py:63:29: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 60 60 | 61 61 | x: List[List[List["MyClass"]]] 62 62 | @@ -399,7 +399,7 @@ UP037.py:63:45: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 60 60 | 61 61 | x: List[List[List["MyClass"]]] 62 62 | @@ -420,7 +420,7 @@ UP037.py:65:29: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 62 62 | 63 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 64 | @@ -441,7 +441,7 @@ UP037.py:65:36: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 62 62 | 63 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 64 | @@ -462,7 +462,7 @@ UP037.py:65:45: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 62 62 | 63 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 64 | @@ -483,7 +483,7 @@ UP037.py:65:52: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 62 62 | 63 63 | x: NamedTuple("X", [("foo", "int"), ("bar", "str")]) 64 64 | @@ -504,7 +504,7 @@ UP037.py:67:24: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 64 64 | 65 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) 66 66 | @@ -525,7 +525,7 @@ UP037.py:67:38: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe fix 64 64 | 65 65 | x: NamedTuple("X", fields=[("foo", "int"), ("bar", "str")]) 66 66 | @@ -546,7 +546,7 @@ UP037.py:67:45: UP037 [*] Remove quotes from type annotation | = help: Remove quotes -ℹ Fix +ℹ Safe 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__UP038.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap index dcba7e8fcf..7a5117ab07 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,7 @@ UP038.py:1:1: UP038 [*] Use `X | Y` in `isinstance` call instead of `(X, Y)` | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe fix 1 |-isinstance(1, (int, float)) # UP038 1 |+isinstance(1, int | float) # UP038 2 2 | issubclass("yes", (int, float, str)) # UP038 @@ -26,7 +26,7 @@ UP038.py:2:1: UP038 [*] Use `X | Y` in `issubclass` call instead of `(X, Y)` | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe 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 3fc62823d0..ff6299b6e9 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 -ℹ Fix +ℹ Safe fix 1 1 | # Errors 2 |-class A(): 2 |+class A: @@ -27,7 +27,7 @@ UP039.py:6:8: UP039 [*] Unnecessary parentheses after class definition | = help: Remove parentheses -ℹ Fix +ℹ Safe fix 3 3 | pass 4 4 | 5 5 | @@ -46,7 +46,7 @@ UP039.py:12:9: UP039 [*] Unnecessary parentheses after class definition | = help: Remove parentheses -ℹ Fix +ℹ Safe fix 9 9 | 10 10 | 11 11 | class A \ @@ -65,7 +65,7 @@ UP039.py:17:8: UP039 [*] Unnecessary parentheses after class definition | = help: Remove parentheses -ℹ Fix +ℹ Safe fix 14 14 | 15 15 | 16 16 | @decorator() @@ -84,7 +84,7 @@ UP039.py:21:8: UP039 [*] Unnecessary parentheses after class definition | = help: Remove parentheses -ℹ Fix +ℹ Safe 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 d470fe80ff..f197bf7de7 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 -ℹ Suggested fix +ℹ Unsafe fix 2 2 | from typing import TypeAlias 3 3 | 4 4 | # UP040 @@ -31,7 +31,7 @@ UP040.py:6:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of th | = help: Use the `type` keyword -ℹ Suggested fix +ℹ Unsafe fix 3 3 | 4 4 | # UP040 5 5 | x: typing.TypeAlias = int @@ -52,7 +52,7 @@ UP040.py:10:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Suggested fix +ℹ Unsafe fix 7 7 | 8 8 | # UP040 simple generic 9 9 | T = typing.TypeVar["T"] @@ -73,7 +73,7 @@ UP040.py:14:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Suggested fix +ℹ Unsafe fix 11 11 | 12 12 | # UP040 call style generic 13 13 | T = typing.TypeVar("T") @@ -94,7 +94,7 @@ UP040.py:18:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Suggested fix +ℹ Unsafe fix 15 15 | 16 16 | # UP040 bounded generic 17 17 | T = typing.TypeVar("T", bound=int) @@ -115,7 +115,7 @@ UP040.py:22:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Suggested fix +ℹ Unsafe fix 19 19 | 20 20 | # UP040 constrained generic 21 21 | T = typing.TypeVar("T", int, str) @@ -136,7 +136,7 @@ UP040.py:26:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Suggested fix +ℹ Unsafe fix 23 23 | 24 24 | # UP040 contravariant generic 25 25 | T = typing.TypeVar("T", contravariant=True) @@ -157,7 +157,7 @@ UP040.py:30:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Suggested fix +ℹ Unsafe fix 27 27 | 28 28 | # UP040 covariant generic 29 29 | T = typing.TypeVar("T", covariant=True) @@ -178,7 +178,7 @@ UP040.py:36:5: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Suggested fix +ℹ Unsafe fix 33 33 | T = typing.TypeVar["T"] 34 34 | class Foo: 35 35 | # reference to global variable @@ -199,7 +199,7 @@ UP040.py:40:5: UP040 [*] Type alias `y` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Suggested fix +ℹ Unsafe fix 37 37 | 38 38 | # reference to class variable 39 39 | TCLS = typing.TypeVar["TCLS"] @@ -220,7 +220,7 @@ UP040.py:44:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Suggested fix +ℹ Unsafe fix 41 41 | 42 42 | # UP040 wont add generics in fix 43 43 | T = typing.TypeVar(*args) 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 cc46a87dbc..9615265f86 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 -ℹ Fix +ℹ Safe 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 @@ -28,7 +28,7 @@ UP040.pyi:7:1: UP040 [*] Type alias `x` uses `TypeAlias` annotation instead of t | = help: Use the `type` keyword -ℹ Fix +ℹ Safe 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 9c288554d2..8b0c7b90e2 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` -ℹ Fix +ℹ Safe fix 2 2 | # These should be fixed 3 3 | try: 4 4 | pass @@ -31,7 +31,7 @@ UP041.py:17:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -ℹ Fix +ℹ Safe fix 14 14 | 15 15 | try: 16 16 | pass @@ -51,7 +51,7 @@ UP041.py:27:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -ℹ Fix +ℹ Safe fix 24 24 | 25 25 | try: 26 26 | pass @@ -71,7 +71,7 @@ UP041.py:34:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -ℹ Fix +ℹ Safe fix 31 31 | 32 32 | try: 33 33 | pass @@ -91,7 +91,7 @@ UP041.py:42:8: UP041 [*] Replace aliased errors with `TimeoutError` | = help: Replace with builtin `TimeoutError` -ℹ Fix +ℹ Safe 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__datetime_utc_alias_py311.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap index d2c709fd20..02b0acb690 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:7:7: UP017 [*] Use `datetime.UTC` alias | = help: Convert to `datetime.UTC` alias -ℹ Fix +ℹ Safe fix 4 4 | from datetime import timezone as tz 5 5 | 6 6 | print(datetime.timezone(-1)) @@ -31,7 +31,7 @@ UP017.py:8:7: UP017 [*] Use `datetime.UTC` alias | = help: Convert to `datetime.UTC` alias -ℹ Fix +ℹ Safe fix 5 5 | 6 6 | print(datetime.timezone(-1)) 7 7 | print(timezone.utc) @@ -51,7 +51,7 @@ UP017.py:10:7: UP017 [*] Use `datetime.UTC` alias | = help: Convert to `datetime.UTC` alias -ℹ Fix +ℹ Safe fix 7 7 | print(timezone.utc) 8 8 | print(tz.utc) 9 9 | @@ -67,7 +67,7 @@ UP017.py:11:7: UP017 [*] Use `datetime.UTC` alias | = help: Convert to `datetime.UTC` alias -ℹ Fix +ℹ Safe fix 8 8 | print(tz.utc) 9 9 | 10 10 | print(datetime.timezone.utc) 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 93eff066ec..dc9d6c6a7f 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` -ℹ Fix +ℹ Safe fix 31 31 | return cls(x=0, y=0) 32 32 | 33 33 | @@ -30,7 +30,7 @@ future_annotations.py:35:9: UP006 [*] Use `list` instead of `List` for type anno | = help: Replace with `list` -ℹ Fix +ℹ Safe fix 32 32 | 33 33 | 34 34 | def f(x: int) -> List[int]: @@ -49,7 +49,7 @@ future_annotations.py:42:27: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -ℹ Fix +ℹ Safe fix 39 39 | 40 40 | x: Optional[int] = None 41 41 | @@ -65,7 +65,7 @@ future_annotations.py:42:38: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -ℹ Fix +ℹ Safe 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 3914eea5ed..4ba308e14a 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` -ℹ Fix +ℹ Safe 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 93eff066ec..dc9d6c6a7f 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` -ℹ Fix +ℹ Safe fix 31 31 | return cls(x=0, y=0) 32 32 | 33 33 | @@ -30,7 +30,7 @@ future_annotations.py:35:9: UP006 [*] Use `list` instead of `List` for type anno | = help: Replace with `list` -ℹ Fix +ℹ Safe fix 32 32 | 33 33 | 34 34 | def f(x: int) -> List[int]: @@ -49,7 +49,7 @@ future_annotations.py:42:27: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -ℹ Fix +ℹ Safe fix 39 39 | 40 40 | x: Optional[int] = None 41 41 | @@ -65,7 +65,7 @@ future_annotations.py:42:38: UP006 [*] Use `list` instead of `List` for type ann | = help: Replace with `list` -ℹ Fix +ℹ Safe 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 6c62e6ffb7..442d20f7a5 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` -ℹ Suggested fix +ℹ Unsafe 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 c9e4008d7a..39655b7cdf 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` -ℹ Suggested fix +ℹ Unsafe fix 37 37 | return y 38 38 | 39 39 | @@ -28,7 +28,7 @@ future_annotations.py:42:21: UP007 [*] Use `X | Y` for type annotations | = help: Convert to `X | Y` -ℹ Suggested fix +ℹ Unsafe 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 666614e28f..f37d6398a1 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 -ℹ Fix +ℹ Safe fix 1 1 | # Errors. 2 2 | 3 |-print("") @@ -31,7 +31,7 @@ FURB105.py:4:1: FURB105 [*] Unnecessary empty string and separator passed to `pr | = help: Remove empty string and separator -ℹ Fix +ℹ Safe fix 1 1 | # Errors. 2 2 | 3 3 | print("") @@ -52,7 +52,7 @@ FURB105.py:5:1: FURB105 [*] Unnecessary empty string passed to `print` | = help: Remove empty string -ℹ Fix +ℹ Safe fix 2 2 | 3 3 | print("") 4 4 | print("", sep=",") @@ -73,7 +73,7 @@ FURB105.py:6:1: FURB105 [*] Unnecessary empty string and separator passed to `pr | = help: Remove empty string and separator -ℹ Fix +ℹ Safe fix 3 3 | print("") 4 4 | print("", sep=",") 5 5 | print("", end="bar") @@ -94,7 +94,7 @@ FURB105.py:7:1: FURB105 [*] Unnecessary separator passed to `print` | = help: Remove separator -ℹ Fix +ℹ Safe fix 4 4 | print("", sep=",") 5 5 | print("", end="bar") 6 6 | print("", sep=",", end="bar") @@ -115,7 +115,7 @@ FURB105.py:8:1: FURB105 [*] Unnecessary empty string and separator passed to `pr | = help: Remove empty string and separator -ℹ Fix +ℹ Safe fix 5 5 | print("", end="bar") 6 6 | print("", sep=",", end="bar") 7 7 | print(sep="") @@ -136,7 +136,7 @@ FURB105.py:9:1: FURB105 [*] Unnecessary empty string and separator passed to `pr | = help: Remove empty string and separator -ℹ Fix +ℹ Safe fix 6 6 | print("", sep=",", end="bar") 7 7 | print(sep="") 8 8 | print("", sep="") @@ -157,7 +157,7 @@ FURB105.py:10:1: FURB105 [*] Unnecessary empty string and separator passed to `p | = help: Remove empty string and separator -ℹ Fix +ℹ Safe fix 7 7 | print(sep="") 8 8 | print("", sep="") 9 9 | print("", "", sep="") @@ -178,7 +178,7 @@ FURB105.py:11:1: FURB105 [*] Unnecessary empty string and separator passed to `p | = help: Remove empty string and separator -ℹ Fix +ℹ Safe fix 8 8 | print("", sep="") 9 9 | print("", "", sep="") 10 10 | print("", "", sep="", end="") @@ -199,7 +199,7 @@ FURB105.py:12:1: FURB105 [*] Unnecessary empty string and separator passed to `p | = help: Remove empty string and separator -ℹ Fix +ℹ Safe fix 9 9 | print("", "", sep="") 10 10 | print("", "", sep="", end="") 11 11 | print("", "", sep="", end="bar") @@ -220,7 +220,7 @@ FURB105.py:13:1: FURB105 [*] Unnecessary separator passed to `print` | = help: Remove separator -ℹ Fix +ℹ Safe fix 10 10 | print("", "", sep="", end="") 11 11 | print("", "", sep="", end="bar") 12 12 | print("", sep="", end="bar") @@ -241,7 +241,7 @@ FURB105.py:14:1: FURB105 [*] Unnecessary empty string and separator passed to `p | = help: Remove empty string and separator -ℹ Fix +ℹ Safe fix 11 11 | print("", "", sep="", end="bar") 12 12 | print("", sep="", end="bar") 13 13 | print(sep="", end="bar") @@ -262,7 +262,7 @@ FURB105.py:15:1: FURB105 [*] Unnecessary empty string and separator passed to `p | = help: Remove empty string and separator -ℹ Fix +ℹ Safe fix 12 12 | print("", sep="", end="bar") 13 13 | print(sep="", end="bar") 14 14 | print("", "foo", sep="") @@ -283,7 +283,7 @@ FURB105.py:16:1: FURB105 [*] Unnecessary empty string passed to `print` | = help: Remove empty string -ℹ Fix +ℹ Safe fix 13 13 | print(sep="", end="bar") 14 14 | print("", "foo", sep="") 15 15 | print("foo", "", sep="") @@ -304,7 +304,7 @@ FURB105.py:18:1: FURB105 [*] Unnecessary empty string passed to `print` | = help: Remove empty string -ℹ Fix +ℹ Safe fix 15 15 | print("foo", "", sep="") 16 16 | print("foo", "", "bar", sep="") 17 17 | print("", *args) @@ -324,7 +324,7 @@ FURB105.py:19:1: FURB105 [*] Unnecessary empty string passed to `print` | = help: Remove empty string -ℹ Fix +ℹ Safe fix 16 16 | print("foo", "", "bar", sep="") 17 17 | print("", *args) 18 18 | print("", *args, sep="") @@ -345,7 +345,7 @@ FURB105.py:20:1: FURB105 [*] Unnecessary separator passed to `print` | = help: Remove separator -ℹ Fix +ℹ Safe 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__FURB113_FURB113.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap index 4ce5ab6cd5..d96772e959 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))` -ℹ Suggested fix +ℹ Unsafe fix 20 20 | 21 21 | 22 22 | # FURB113 @@ -32,7 +32,7 @@ FURB113.py:29:1: FURB113 [*] Use `nums3.extend((1, 2))` instead of repeatedly ca | = help: Replace with `nums3.extend((1, 2))` -ℹ Suggested fix +ℹ Unsafe fix 26 26 | 27 27 | 28 28 | # FURB113 @@ -53,7 +53,7 @@ FURB113.py:35:1: FURB113 [*] Use `nums4.extend((1, 2))` instead of repeatedly ca | = help: Replace with `nums4.extend((1, 2))` -ℹ Suggested fix +ℹ Unsafe fix 32 32 | 33 33 | 34 34 | # FURB113 @@ -118,7 +118,7 @@ FURB113.py:56:1: FURB113 [*] Use `nums4.extend((1, 2))` instead of repeatedly ca | = help: Replace with `nums4.extend((1, 2))` -ℹ Suggested fix +ℹ Unsafe fix 53 53 | nums3.append(1) 54 54 | nums.append(3) 55 55 | # FURB113 @@ -139,7 +139,7 @@ FURB113.py:62:1: FURB113 [*] Use `nums.extend((1, 2, 3))` instead of repeatedly | = help: Replace with `nums.extend((1, 2, 3))` -ℹ Suggested fix +ℹ Unsafe fix 59 59 | pass 60 60 | 61 61 | # FURB113 @@ -162,7 +162,7 @@ FURB113.py:69:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal | = help: Replace with `nums.extend((1, 2))` -ℹ Suggested fix +ℹ Unsafe fix 66 66 | 67 67 | if True: 68 68 | # FURB113 @@ -185,7 +185,7 @@ FURB113.py:75:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal | = help: Replace with `nums.extend((1, 2))` -ℹ Suggested fix +ℹ Unsafe fix 72 72 | 73 73 | if True: 74 74 | # FURB113 @@ -220,7 +220,7 @@ FURB113.py:90:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly callin | = help: Replace with `x.extend((1, 2))` -ℹ Suggested fix +ℹ Unsafe fix 87 87 | 88 88 | def yes_one(x: list[int]): 89 89 | # FURB113 @@ -242,7 +242,7 @@ FURB113.py:96:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly callin | = help: Replace with `x.extend((1, 2))` -ℹ Suggested fix +ℹ Unsafe fix 93 93 | 94 94 | def yes_two(x: List[int]): 95 95 | # FURB113 @@ -264,7 +264,7 @@ FURB113.py:102:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli | = help: Replace with `x.extend((1, 2))` -ℹ Suggested fix +ℹ Unsafe fix 99 99 | 100 100 | def yes_three(*, x: list[int]): 101 101 | # FURB113 @@ -286,7 +286,7 @@ FURB113.py:108:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli | = help: Replace with `x.extend((1, 2))` -ℹ Suggested fix +ℹ Unsafe fix 105 105 | 106 106 | def yes_four(x: list[int], /): 107 107 | # FURB113 @@ -321,7 +321,7 @@ FURB113.py:122:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli | = help: Replace with `x.extend((1, 2))` -ℹ Suggested fix +ℹ Unsafe 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__FURB131_FURB131.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap index 1fc97fbc8a..aa5eb46521 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()` -ℹ Suggested fix +ℹ Unsafe fix 8 8 | # these should match 9 9 | 10 10 | # FURB131 @@ -27,7 +27,7 @@ FURB131.py:15:1: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -ℹ Suggested fix +ℹ Unsafe fix 12 12 | 13 13 | 14 14 | # FURB131 @@ -62,7 +62,7 @@ FURB131.py:28:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -ℹ Suggested fix +ℹ Unsafe fix 25 25 | 26 26 | def yes_one(x: list[int]): 27 27 | # FURB131 @@ -81,7 +81,7 @@ FURB131.py:33:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -ℹ Suggested fix +ℹ Unsafe fix 30 30 | 31 31 | def yes_two(x: dict[int, str]): 32 32 | # FURB131 @@ -100,7 +100,7 @@ FURB131.py:38:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -ℹ Suggested fix +ℹ Unsafe fix 35 35 | 36 36 | def yes_three(x: List[int]): 37 37 | # FURB131 @@ -119,7 +119,7 @@ FURB131.py:43:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -ℹ Suggested fix +ℹ Unsafe fix 40 40 | 41 41 | def yes_four(x: Dict[int, str]): 42 42 | # FURB131 @@ -140,7 +140,7 @@ FURB131.py:48:5: FURB131 [*] Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -ℹ Suggested fix +ℹ Unsafe fix 45 45 | 46 46 | def yes_five(x: Dict[int, str]): 47 47 | # 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 25c2e3746b..ac600b20be 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")` -ℹ Suggested fix +ℹ Unsafe fix 9 9 | # these should match 10 10 | 11 11 | # FURB132 @@ -30,7 +30,7 @@ FURB132.py:22:1: FURB132 [*] Use `s3.discard("x")` instead of check and `remove` | = help: Replace with `s3.discard("x")` -ℹ Suggested fix +ℹ Unsafe fix 19 19 | 20 20 | 21 21 | # FURB132 @@ -51,7 +51,7 @@ FURB132.py:28:1: FURB132 [*] Use `s.discard(var)` instead of check and `remove` | = help: Replace with `s.discard(var)` -ℹ Suggested fix +ℹ Unsafe fix 25 25 | 26 26 | var = "y" 27 27 | # FURB132 @@ -70,7 +70,7 @@ 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 +ℹ Unsafe 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__FURB140_FURB140.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap index 84f88f6d4d..5fc72a0bc0 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` -ℹ Fix +ℹ Safe fix 1 |+from itertools import starmap 1 2 | def zipped(): 2 3 | return zip([1, 2, 3], "ABC") @@ -35,7 +35,7 @@ FURB140.py:10:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -ℹ Fix +ℹ Safe fix 1 |+from itertools import starmap 1 2 | def zipped(): 2 3 | return zip([1, 2, 3], "ABC") @@ -58,7 +58,7 @@ FURB140.py:13:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -ℹ Fix +ℹ Safe fix 1 |+from itertools import starmap 1 2 | def zipped(): 2 3 | return zip([1, 2, 3], "ABC") @@ -83,7 +83,7 @@ FURB140.py:19:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -ℹ Fix +ℹ Safe fix 16 16 | from itertools import starmap as sm 17 17 | 18 18 | # FURB140 @@ -103,7 +103,7 @@ FURB140.py:22:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -ℹ Fix +ℹ Safe fix 19 19 | [print(x, y) for x, y in zipped()] 20 20 | 21 21 | # FURB140 @@ -123,7 +123,7 @@ FURB140.py:25:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -ℹ Fix +ℹ Safe fix 22 22 | (print(x, y) for x, y in zipped()) 23 23 | 24 24 | # FURB140 @@ -144,7 +144,7 @@ FURB140.py:29:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -ℹ Fix +ℹ Safe fix 26 26 | 27 27 | # FURB140 (check it still flags starred arguments). 28 28 | # See https://github.com/astral-sh/ruff/issues/7636 @@ -164,7 +164,7 @@ FURB140.py:30:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -ℹ Fix +ℹ Safe 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)]] @@ -185,7 +185,7 @@ FURB140.py:31:1: FURB140 [*] Use `itertools.starmap` instead of the generator | = help: Replace with `itertools.starmap` -ℹ Fix +ℹ Safe 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__FURB145_FURB145.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap index 58da9fd51a..388dfb2488 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()` -ℹ Fix +ℹ Safe fix 1 1 | l = [1, 2, 3, 4, 5] 2 2 | 3 3 | # Errors. @@ -32,7 +32,7 @@ FURB145.py:5:11: FURB145 [*] Prefer `copy` method over slicing | = help: Replace with `copy()` -ℹ Fix +ℹ Safe fix 2 2 | 3 3 | # Errors. 4 4 | a = l[:] @@ -53,7 +53,7 @@ FURB145.py:6:8: FURB145 [*] Prefer `copy` method over slicing | = help: Replace with `copy()` -ℹ Fix +ℹ Safe fix 3 3 | # Errors. 4 4 | a = l[:] 5 5 | b, c = 1, l[:] @@ -74,7 +74,7 @@ FURB145.py:7:5: FURB145 [*] Prefer `copy` method over slicing | = help: Replace with `copy()` -ℹ Fix +ℹ Safe fix 4 4 | a = l[:] 5 5 | b, c = 1, l[:] 6 6 | d, e = l[:], 1 @@ -94,7 +94,7 @@ FURB145.py:8:1: FURB145 [*] Prefer `copy` method over slicing | = help: Replace with `copy()` -ℹ Fix +ℹ Safe fix 5 5 | b, c = 1, l[:] 6 6 | d, e = l[:], 1 7 7 | m = l[::] @@ -115,7 +115,7 @@ FURB145.py:9:7: FURB145 [*] Prefer `copy` method over slicing | = help: Replace with `copy()` -ℹ Fix +ℹ Safe 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 a64560382b..3cb94bc16b 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(...))` -ℹ Suggested fix +ℹ Unsafe fix 11 11 | books_tuple = ("Dune", "Foundation", "Neuromancer") 12 12 | 13 13 | # Errors @@ -30,7 +30,7 @@ FURB148.py:17:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -ℹ Suggested fix +ℹ Unsafe fix 14 14 | for index, _ in enumerate(books): 15 15 | print(index) 16 16 | @@ -50,7 +50,7 @@ FURB148.py:20:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -ℹ Suggested fix +ℹ Unsafe fix 17 17 | for index, _ in enumerate(books, start=0): 18 18 | print(index) 19 19 | @@ -110,7 +110,7 @@ FURB148.py:35:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Suggested fix +ℹ Unsafe fix 32 32 | for index, _ in enumerate(books, x): 33 33 | print(book) 34 34 | @@ -130,7 +130,7 @@ FURB148.py:38:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Suggested fix +ℹ Unsafe fix 35 35 | for _, book in enumerate(books): 36 36 | print(book) 37 37 | @@ -150,7 +150,7 @@ FURB148.py:41:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Suggested fix +ℹ Unsafe fix 38 38 | for _, book in enumerate(books, start=0): 39 39 | print(book) 40 40 | @@ -170,7 +170,7 @@ FURB148.py:44:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Suggested fix +ℹ Unsafe fix 41 41 | for _, book in enumerate(books, 0): 42 42 | print(book) 43 43 | @@ -190,7 +190,7 @@ FURB148.py:47:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Suggested fix +ℹ Unsafe fix 44 44 | for _, book in enumerate(books, start=1): 45 45 | print(book) 46 46 | @@ -210,7 +210,7 @@ FURB148.py:50:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Suggested fix +ℹ Unsafe fix 47 47 | for _, book in enumerate(books, 1): 48 48 | print(book) 49 49 | @@ -230,7 +230,7 @@ FURB148.py:53:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Suggested fix +ℹ Unsafe fix 50 50 | for _, book in enumerate(books, start=x): 51 51 | print(book) 52 52 | @@ -250,7 +250,7 @@ FURB148.py:56:22: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -ℹ Suggested fix +ℹ Unsafe fix 53 53 | for _, book in enumerate(books, x): 54 54 | print(book) 55 55 | @@ -270,7 +270,7 @@ FURB148.py:59:21: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Suggested fix +ℹ Unsafe fix 56 56 | for index, (_, _) in enumerate(books): 57 57 | print(index) 58 58 | @@ -290,7 +290,7 @@ FURB148.py:62:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -ℹ Suggested fix +ℹ Unsafe fix 59 59 | for (_, _), book in enumerate(books): 60 60 | print(book) 61 61 | @@ -310,7 +310,7 @@ FURB148.py:65:18: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -ℹ Suggested fix +ℹ Unsafe fix 62 62 | for(index, _)in enumerate(books): 63 63 | print(index) 64 64 | @@ -330,7 +330,7 @@ FURB148.py:68:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -ℹ Suggested fix +ℹ Unsafe fix 65 65 | for(index), _ in enumerate(books): 66 66 | print(index) 67 67 | @@ -350,7 +350,7 @@ FURB148.py:71:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Suggested fix +ℹ Unsafe fix 68 68 | for index, _ in enumerate(books_and_authors): 69 69 | print(index) 70 70 | @@ -370,7 +370,7 @@ FURB148.py:74:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -ℹ Suggested fix +ℹ Unsafe fix 71 71 | for _, book in enumerate(books_and_authors): 72 72 | print(book) 73 73 | @@ -390,7 +390,7 @@ FURB148.py:77:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Suggested fix +ℹ Unsafe fix 74 74 | for index, _ in enumerate(books_set): 75 75 | print(index) 76 76 | @@ -410,7 +410,7 @@ FURB148.py:80:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l | = help: Replace with `range(len(...))` -ℹ Suggested fix +ℹ Unsafe fix 77 77 | for _, book in enumerate(books_set): 78 78 | print(book) 79 79 | @@ -430,7 +430,7 @@ FURB148.py:83:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst | = help: Remove `enumerate` -ℹ Suggested fix +ℹ Unsafe 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__FURB168_FURB168.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB168_FURB168.py.snap index 51505c574d..88aa3efb4e 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 -ℹ Fix +ℹ Safe fix 2 2 | 3 3 | # Errors. 4 4 | @@ -31,7 +31,7 @@ FURB168.py:8:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if a | = help: Replace with `is` operator -ℹ Fix +ℹ Safe fix 5 5 | if isinstance(foo, type(None)): 6 6 | pass 7 7 | @@ -51,7 +51,7 @@ FURB168.py:11:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -ℹ Fix +ℹ Safe fix 8 8 | if isinstance(foo, (type(None))): 9 9 | pass 10 10 | @@ -71,7 +71,7 @@ FURB168.py:14:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -ℹ Fix +ℹ Safe fix 11 11 | if isinstance(foo, (type(None), type(None), type(None))): 12 12 | pass 13 13 | @@ -91,7 +91,7 @@ FURB168.py:17:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -ℹ Fix +ℹ Safe fix 14 14 | if isinstance(foo, None | None): 15 15 | pass 16 16 | @@ -111,7 +111,7 @@ FURB168.py:20:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -ℹ Fix +ℹ Safe fix 17 17 | if isinstance(foo, (None | None)): 18 18 | pass 19 19 | @@ -131,7 +131,7 @@ FURB168.py:23:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -ℹ Fix +ℹ Safe fix 20 20 | if isinstance(foo, None | type(None)): 21 21 | pass 22 22 | @@ -150,7 +150,7 @@ FURB168.py:27:4: FURB168 [*] Prefer `is` operator over `isinstance` to check if | = help: Replace with `is` operator -ℹ Fix +ℹ Safe 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 b643992510..ee9ee14f36 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` -ℹ Fix +ℹ Safe fix 2 2 | 3 3 | # Error. 4 4 | @@ -33,7 +33,7 @@ FURB169.py:7:1: FURB169 [*] Compare the identities of `foo` and `None` instead o | = help: Replace with `foo is None` -ℹ Fix +ℹ Safe fix 4 4 | 5 5 | type(foo) is type(None) 6 6 | @@ -54,7 +54,7 @@ FURB169.py:9:1: FURB169 [*] Compare the identities of `None` and `None` instead | = help: Replace with `None is None` -ℹ Fix +ℹ Safe fix 6 6 | 7 7 | type(None) is type(foo) 8 8 | @@ -75,7 +75,7 @@ FURB169.py:11:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is not None` -ℹ Fix +ℹ Safe fix 8 8 | 9 9 | type(None) is type(None) 10 10 | @@ -96,7 +96,7 @@ FURB169.py:13:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is not None` -ℹ Fix +ℹ Safe fix 10 10 | 11 11 | type(foo) is not type(None) 12 12 | @@ -117,7 +117,7 @@ FURB169.py:15:1: FURB169 [*] Compare the identities of `None` and `None` instead | = help: Replace with `None is not None` -ℹ Fix +ℹ Safe fix 12 12 | 13 13 | type(None) is not type(foo) 14 14 | @@ -138,7 +138,7 @@ FURB169.py:17:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is None` -ℹ Fix +ℹ Safe fix 14 14 | 15 15 | type(None) is not type(None) 16 16 | @@ -159,7 +159,7 @@ FURB169.py:19:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is None` -ℹ Fix +ℹ Safe fix 16 16 | 17 17 | type(foo) == type(None) 18 18 | @@ -180,7 +180,7 @@ FURB169.py:21:1: FURB169 [*] Compare the identities of `None` and `None` instead | = help: Replace with `None is None` -ℹ Fix +ℹ Safe fix 18 18 | 19 19 | type(None) == type(foo) 20 20 | @@ -201,7 +201,7 @@ FURB169.py:23:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is not None` -ℹ Fix +ℹ Safe fix 20 20 | 21 21 | type(None) == type(None) 22 22 | @@ -222,7 +222,7 @@ FURB169.py:25:1: FURB169 [*] Compare the identities of `foo` and `None` instead | = help: Replace with `foo is not None` -ℹ Fix +ℹ Safe fix 22 22 | 23 23 | type(foo) != type(None) 24 24 | @@ -243,7 +243,7 @@ FURB169.py:27:1: FURB169 [*] Compare the identities of `None` and `None` instead | = help: Replace with `None is not None` -ℹ Fix +ℹ Safe 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 e1e847ad8d..2b29e1e40a 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 -ℹ Fix +ℹ Safe fix 1 1 | # Errors. 2 2 | 3 |-if 1 in (1,): @@ -30,7 +30,7 @@ FURB171.py:6:4: FURB171 [*] Membership test against single-item container | = help: Convert to equality test -ℹ Fix +ℹ Safe fix 3 3 | if 1 in (1,): 4 4 | print("Single-element tuple") 5 5 | @@ -50,7 +50,7 @@ FURB171.py:9:4: FURB171 [*] Membership test against single-item container | = help: Convert to equality test -ℹ Fix +ℹ Safe fix 6 6 | if 1 in [1]: 7 7 | print("Single-element list") 8 8 | @@ -70,7 +70,7 @@ FURB171.py:12:4: FURB171 [*] Membership test against single-item container | = help: Convert to equality test -ℹ Fix +ℹ Safe fix 9 9 | if 1 in {1}: 10 10 | print("Single-element set") 11 11 | @@ -90,7 +90,7 @@ FURB171.py:15:4: FURB171 [*] Membership test against single-item container | = help: Convert to inequality test -ℹ Fix +ℹ Safe fix 12 12 | if "a" in "a": 13 13 | print("Single-element string") 14 14 | @@ -110,7 +110,7 @@ FURB171.py:18:8: FURB171 [*] Membership test against single-item container | = help: Convert to equality test -ℹ Fix +ℹ Safe 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/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 f472f1f9f2..e648ad08f9 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:21:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 18 18 | pass 19 19 | 20 20 | @@ -27,7 +27,7 @@ RUF013_0.py:25:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 22 22 | pass 23 23 | 24 24 | @@ -45,7 +45,7 @@ RUF013_0.py:29:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 26 26 | pass 27 27 | 28 28 | @@ -63,7 +63,7 @@ RUF013_0.py:33:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 30 30 | pass 31 31 | 32 32 | @@ -81,7 +81,7 @@ RUF013_0.py:71:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 68 68 | pass 69 69 | 70 70 | @@ -99,7 +99,7 @@ RUF013_0.py:75:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 72 72 | pass 73 73 | 74 74 | @@ -117,7 +117,7 @@ RUF013_0.py:79:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 76 76 | pass 77 77 | 78 78 | @@ -135,7 +135,7 @@ RUF013_0.py:83:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 80 80 | pass 81 81 | 82 82 | @@ -153,7 +153,7 @@ RUF013_0.py:102:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 99 99 | pass 100 100 | 101 101 | @@ -171,7 +171,7 @@ RUF013_0.py:106:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 103 103 | pass 104 104 | 105 105 | @@ -189,7 +189,7 @@ RUF013_0.py:125:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 122 122 | pass 123 123 | 124 124 | @@ -207,7 +207,7 @@ RUF013_0.py:129:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 126 126 | pass 127 127 | 128 128 | @@ -225,7 +225,7 @@ RUF013_0.py:133:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 130 130 | pass 131 131 | 132 132 | @@ -243,7 +243,7 @@ RUF013_0.py:152:22: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 149 149 | pass 150 150 | 151 151 | @@ -261,7 +261,7 @@ RUF013_0.py:156:32: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 153 153 | pass 154 154 | 155 155 | @@ -281,7 +281,7 @@ RUF013_0.py:172:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 169 169 | 170 170 | 171 171 | def f( @@ -302,7 +302,7 @@ RUF013_0.py:173:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 170 170 | 171 171 | def f( 172 172 | arg1: int = None, # RUF013 @@ -323,7 +323,7 @@ RUF013_0.py:174:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 171 171 | def f( 172 172 | arg1: int = None, # RUF013 173 173 | arg2: Union[int, float] = None, # RUF013 @@ -341,7 +341,7 @@ RUF013_0.py:202:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 199 199 | pass 200 200 | 201 201 | @@ -359,7 +359,7 @@ RUF013_0.py:209:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 206 206 | # Quoted 207 207 | 208 208 | @@ -377,7 +377,7 @@ RUF013_0.py:213:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 210 210 | pass 211 211 | 212 212 | @@ -403,7 +403,7 @@ RUF013_0.py:225:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -ℹ Suggested fix +ℹ Unsafe fix 222 222 | pass 223 223 | 224 224 | 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 6647c65948..2fa0ca0d4d 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]` -ℹ Suggested fix +ℹ Unsafe 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 baf307a873..8e9c466eb6 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]` -ℹ Suggested fix +ℹ Unsafe fix 36 36 | yay = Fun().yay 37 37 | 38 38 | foo = [4, 5, 6] @@ -73,7 +73,7 @@ RUF005.py:41:8: RUF005 [*] Consider `(7, 8, 9, *zoob)` instead of concatenation | = help: Replace with `(7, 8, 9, *zoob)` -ℹ Suggested fix +ℹ Unsafe fix 38 38 | foo = [4, 5, 6] 39 39 | bar = [1, 2, 3] + foo 40 40 | zoob = tuple(bar) @@ -94,7 +94,7 @@ RUF005.py:42:8: RUF005 [*] Consider `(*quux, 10, 11, 12)` instead of concatenati | = help: Replace with `(*quux, 10, 11, 12)` -ℹ Suggested fix +ℹ Unsafe fix 39 39 | bar = [1, 2, 3] + foo 40 40 | zoob = tuple(bar) 41 41 | quux = (7, 8, 9) + zoob @@ -115,7 +115,7 @@ RUF005.py:44:8: RUF005 [*] Consider `[*spom, 13, 14, 15]` instead of concatenati | = help: Replace with `[*spom, 13, 14, 15]` -ℹ Suggested fix +ℹ Unsafe fix 41 41 | quux = (7, 8, 9) + zoob 42 42 | spam = quux + (10, 11, 12) 43 43 | spom = list(spam) @@ -136,7 +136,7 @@ RUF005.py:45:13: RUF005 [*] Consider `("we all say", *yay())` instead of concate | = help: Replace with `("we all say", *yay())` -ℹ Suggested fix +ℹ Unsafe fix 42 42 | spam = quux + (10, 11, 12) 43 43 | spom = list(spam) 44 44 | eggs = spom + [13, 14, 15] @@ -156,7 +156,7 @@ RUF005.py:46:14: RUF005 [*] Consider `("we all think", *Fun().yay())` instead of | = help: Replace with `("we all think", *Fun().yay())` -ℹ Suggested fix +ℹ Unsafe fix 43 43 | spom = list(spam) 44 44 | eggs = spom + [13, 14, 15] 45 45 | elatement = ("we all say",) + yay() @@ -177,7 +177,7 @@ RUF005.py:47:16: RUF005 [*] Consider `("we all feel", *Fun.words)` instead of co | = help: Replace with `("we all feel", *Fun.words)` -ℹ Suggested fix +ℹ Unsafe fix 44 44 | eggs = spom + [13, 14, 15] 45 45 | elatement = ("we all say",) + yay() 46 46 | excitement = ("we all think",) + Fun().yay() @@ -198,7 +198,7 @@ RUF005.py:49:9: RUF005 [*] Consider iterable unpacking instead of concatenation | = help: Replace with iterable unpacking -ℹ Suggested fix +ℹ Unsafe fix 46 46 | excitement = ("we all think",) + Fun().yay() 47 47 | astonishment = ("we all feel",) + Fun.words 48 48 | @@ -219,7 +219,7 @@ RUF005.py:49:39: RUF005 [*] Consider `("yes", "no", "pants", *zoob)` instead of | = help: Replace with `("yes", "no", "pants", *zoob)` -ℹ Suggested fix +ℹ Unsafe fix 46 46 | excitement = ("we all think",) + Fun().yay() 47 47 | astonishment = ("we all feel",) + Fun.words 48 48 | @@ -240,7 +240,7 @@ RUF005.py:51:7: RUF005 [*] Consider `(*zoob,)` instead of concatenation | = help: Replace with `(*zoob,)` -ℹ Suggested fix +ℹ Unsafe fix 48 48 | 49 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) 50 50 | @@ -262,7 +262,7 @@ RUF005.py:53:1: RUF005 [*] Consider `[*foo]` instead of concatenation | = help: Replace with `[*foo]` -ℹ Suggested fix +ℹ Unsafe fix 50 50 | 51 51 | baz = () + zoob 52 52 | @@ -284,7 +284,7 @@ RUF005.py:56:15: RUF005 [*] Consider `[sys.executable, "-m", "pylint", *args, pa | = help: Replace with `[sys.executable, "-m", "pylint", *args, path]` -ℹ Suggested fix +ℹ Unsafe fix 53 53 | [] + foo + [ 54 54 | ] 55 55 | @@ -303,7 +303,7 @@ RUF005.py:57:21: RUF005 [*] Consider iterable unpacking instead of concatenation | = help: Replace with iterable unpacking -ℹ Suggested fix +ℹ Unsafe fix 54 54 | ] 55 55 | 56 56 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] @@ -324,7 +324,7 @@ RUF005.py:58:5: RUF005 [*] Consider `[*a, 2, 3, 4]` instead of concatenation | = help: Replace with `[*a, 2, 3, 4]` -ℹ Suggested fix +ℹ Unsafe 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) @@ -344,7 +344,7 @@ RUF005.py:61:4: RUF005 [*] Consider `[*a(), 'b']` instead of concatenation | = help: Replace with `[*a(), 'b']` -ℹ Suggested fix +ℹ Unsafe 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 c9fac2091d..fe2e4e3c74 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 -ℹ Fix +ℹ Safe fix 6 6 | pass 7 7 | 8 8 | @@ -29,7 +29,7 @@ RUF010.py:9:16: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Fix +ℹ Safe fix 6 6 | pass 7 7 | 8 8 | @@ -48,7 +48,7 @@ RUF010.py:9:29: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Fix +ℹ Safe fix 6 6 | pass 7 7 | 8 8 | @@ -69,7 +69,7 @@ RUF010.py:11:4: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Fix +ℹ Safe fix 8 8 | 9 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 10 10 | @@ -90,7 +90,7 @@ RUF010.py:11:19: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Fix +ℹ Safe fix 8 8 | 9 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 10 10 | @@ -111,7 +111,7 @@ RUF010.py:11:35: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Fix +ℹ Safe fix 8 8 | 9 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}" # RUF010 10 10 | @@ -132,7 +132,7 @@ RUF010.py:13:5: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Fix +ℹ Safe fix 10 10 | 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | @@ -153,7 +153,7 @@ RUF010.py:13:19: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Fix +ℹ Safe fix 10 10 | 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | @@ -174,7 +174,7 @@ RUF010.py:13:34: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Fix +ℹ Safe fix 10 10 | 11 11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}" # RUF010 12 12 | @@ -195,7 +195,7 @@ RUF010.py:15:14: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Fix +ℹ Safe fix 12 12 | 13 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 14 14 | @@ -216,7 +216,7 @@ RUF010.py:15:29: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Fix +ℹ Safe fix 12 12 | 13 13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}" # RUF010 14 14 | @@ -236,7 +236,7 @@ RUF010.py:35:20: RUF010 [*] Use explicit conversion flag | = help: Replace with conversion flag -ℹ Fix +ℹ Safe 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 10634c0520..b6ca999a60 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:21:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 18 18 | pass 19 19 | 20 20 | @@ -27,7 +27,7 @@ RUF013_0.py:25:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 22 22 | pass 23 23 | 24 24 | @@ -45,7 +45,7 @@ RUF013_0.py:29:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 26 26 | pass 27 27 | 28 28 | @@ -63,7 +63,7 @@ RUF013_0.py:33:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 30 30 | pass 31 31 | 32 32 | @@ -81,7 +81,7 @@ RUF013_0.py:71:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 68 68 | pass 69 69 | 70 70 | @@ -99,7 +99,7 @@ RUF013_0.py:75:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 72 72 | pass 73 73 | 74 74 | @@ -117,7 +117,7 @@ RUF013_0.py:79:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 76 76 | pass 77 77 | 78 78 | @@ -135,7 +135,7 @@ RUF013_0.py:83:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 80 80 | pass 81 81 | 82 82 | @@ -153,7 +153,7 @@ RUF013_0.py:102:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 99 99 | pass 100 100 | 101 101 | @@ -171,7 +171,7 @@ RUF013_0.py:106:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 103 103 | pass 104 104 | 105 105 | @@ -189,7 +189,7 @@ RUF013_0.py:125:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 122 122 | pass 123 123 | 124 124 | @@ -207,7 +207,7 @@ RUF013_0.py:129:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 126 126 | pass 127 127 | 128 128 | @@ -225,7 +225,7 @@ RUF013_0.py:133:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 130 130 | pass 131 131 | 132 132 | @@ -243,7 +243,7 @@ RUF013_0.py:152:22: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 149 149 | pass 150 150 | 151 151 | @@ -261,7 +261,7 @@ RUF013_0.py:156:32: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 153 153 | pass 154 154 | 155 155 | @@ -281,7 +281,7 @@ RUF013_0.py:172:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 169 169 | 170 170 | 171 171 | def f( @@ -302,7 +302,7 @@ RUF013_0.py:173:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 170 170 | 171 171 | def f( 172 172 | arg1: int = None, # RUF013 @@ -323,7 +323,7 @@ RUF013_0.py:174:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 171 171 | def f( 172 172 | arg1: int = None, # RUF013 173 173 | arg2: Union[int, float] = None, # RUF013 @@ -341,7 +341,7 @@ RUF013_0.py:202:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 199 199 | pass 200 200 | 201 201 | @@ -359,7 +359,7 @@ RUF013_0.py:209:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 206 206 | # Quoted 207 207 | 208 208 | @@ -377,7 +377,7 @@ RUF013_0.py:213:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 210 210 | pass 211 211 | 212 212 | @@ -403,7 +403,7 @@ RUF013_0.py:225:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe fix 222 222 | pass 223 223 | 224 224 | 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 df81fc0f7f..a5b1f5991e 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,7 @@ RUF013_1.py:4:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -ℹ Suggested fix +ℹ Unsafe 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__RUF015_RUF015.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap index 81c22a35fe..016df57bdb 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))` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | x = range(10) 2 2 | 3 3 | # RUF015 @@ -32,7 +32,7 @@ RUF015.py:5:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -ℹ Suggested fix +ℹ Unsafe fix 2 2 | 3 3 | # RUF015 4 4 | list(x)[0] @@ -52,7 +52,7 @@ RUF015.py:6:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -ℹ Suggested fix +ℹ Unsafe fix 3 3 | # RUF015 4 4 | list(x)[0] 5 5 | tuple(x)[0] @@ -73,7 +73,7 @@ RUF015.py:7:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | = help: Replace with `next(iter(x))` -ℹ Suggested fix +ℹ Unsafe fix 4 4 | list(x)[0] 5 5 | tuple(x)[0] 6 6 | list(i for i in x)[0] @@ -93,7 +93,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)` -ℹ Suggested fix +ℹ Unsafe fix 26 26 | [i for i in x][::] 27 27 | 28 28 | # RUF015 (doesn't mirror the underlying list) @@ -113,7 +113,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)` -ℹ Suggested fix +ℹ Unsafe fix 27 27 | 28 28 | # RUF015 (doesn't mirror the underlying list) 29 29 | [i + 1 for i in x][0] @@ -134,7 +134,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)` -ℹ Suggested fix +ℹ Unsafe 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] @@ -155,7 +155,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)` -ℹ Suggested fix +ℹ Unsafe fix 32 32 | 33 33 | # RUF015 (multiple generators) 34 34 | y = range(10) @@ -175,7 +175,7 @@ RUF015.py:38:1: RUF015 [*] Prefer `next(iter(range(10)))` over single element sl | = help: Replace with `next(iter(range(10)))` -ℹ Suggested fix +ℹ Unsafe fix 35 35 | [i + j for i in x for j in y][0] 36 36 | 37 37 | # RUF015 @@ -196,7 +196,7 @@ RUF015.py:39:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | = help: Replace with `next(iter(x.y))` -ℹ Suggested fix +ℹ Unsafe fix 36 36 | 37 37 | # RUF015 38 38 | list(range(10))[0] @@ -217,7 +217,7 @@ RUF015.py:40:1: RUF015 [*] Prefer `next(iter(x["y"]))` over single element slice | = help: Replace with `next(iter(x["y"]))` -ℹ Suggested fix +ℹ Unsafe fix 37 37 | # RUF015 38 38 | list(range(10))[0] 39 39 | list(x.y)[0] @@ -238,7 +238,7 @@ RUF015.py:41:1: RUF015 [*] Prefer `next(iter(range(10)))` over single element sl | = help: Replace with `next(iter(range(10)))` -ℹ Suggested fix +ℹ Unsafe fix 38 38 | list(range(10))[0] 39 39 | list(x.y)[0] 40 40 | list(x["y"])[0] @@ -259,7 +259,7 @@ RUF015.py:42:1: RUF015 [*] Prefer `next(iter(x["y"]))` over single element slice | = help: Replace with `next(iter(x["y"]))` -ℹ Suggested fix +ℹ Unsafe fix 39 39 | list(x.y)[0] 40 40 | list(x["y"])[0] 41 41 | [*range(10)][0] @@ -280,7 +280,7 @@ RUF015.py:43:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | = help: Replace with `next(iter(x.y))` -ℹ Suggested fix +ℹ Unsafe fix 40 40 | list(x["y"])[0] 41 41 | [*range(10)][0] 42 42 | [*x["y"]][0] @@ -301,7 +301,7 @@ RUF015.py:44:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | = help: Replace with `next(iter(x.y))` -ℹ Suggested fix +ℹ Unsafe fix 41 41 | [*range(10)][0] 42 42 | [*x["y"]][0] 43 43 | [*x.y][0] @@ -324,7 +324,7 @@ RUF015.py:45:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | = help: Replace with `next(iter(x.y))` -ℹ Suggested fix +ℹ Unsafe fix 42 42 | [*x["y"]][0] 43 43 | [*x.y][0] 44 44 | [* x.y][0] @@ -351,7 +351,7 @@ RUF015.py:50:26: RUF015 [*] Prefer `next(...)` over single element slice | = help: Replace with `next(...)` -ℹ Suggested fix +ℹ Unsafe fix 47 47 | ][0] 48 48 | 49 49 | # RUF015 (multi-line) @@ -375,7 +375,7 @@ RUF015.py:57:1: RUF015 [*] Prefer `next(zip(x, y))` over single element slice | = help: Replace with `next(zip(x, y))` -ℹ Suggested fix +ℹ Unsafe fix 54 54 | ][0] 55 55 | 56 56 | # RUF015 (zip) @@ -394,7 +394,7 @@ RUF015.py:58:1: RUF015 [*] Prefer `next(zip(x, y))` over single element slice | = help: Replace with `next(zip(x, y))` -ℹ Suggested fix +ℹ Unsafe fix 55 55 | 56 56 | # RUF015 (zip) 57 57 | list(zip(x, y))[0] @@ -413,7 +413,7 @@ RUF015.py:63:5: RUF015 [*] Prefer `next(iter(zip(x, y)))` over single element sl | = help: Replace with `next(iter(zip(x, y)))` -ℹ Suggested fix +ℹ Unsafe fix 60 60 | 61 61 | def test(): 62 62 | 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 3d30ebbcbb..aad3c2fed9 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` -ℹ Suggested fix +ℹ Unsafe fix 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] @@ -35,7 +35,7 @@ RUF017_0.py:6:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -ℹ Suggested fix +ℹ Unsafe fix 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] @@ -60,7 +60,7 @@ RUF017_0.py:7:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -ℹ Suggested fix +ℹ Unsafe fix 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] @@ -86,7 +86,7 @@ RUF017_0.py:8:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -ℹ Suggested fix +ℹ Unsafe fix 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] @@ -114,7 +114,7 @@ RUF017_0.py:9:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -ℹ Suggested fix +ℹ Unsafe fix 1 |+import functools 2 |+import operator 1 3 | x = [1, 2, 3] @@ -140,7 +140,7 @@ RUF017_0.py:21:5: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -ℹ Suggested fix +ℹ Unsafe fix 18 18 | def func(): 19 19 | import functools, operator 20 20 | @@ -159,7 +159,7 @@ RUF017_0.py:26:5: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -ℹ Suggested fix +ℹ Unsafe 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 65bb00fdeb..ff3b145e56 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,7 @@ RUF017_1.py:1:1: RUF017 [*] Avoid quadratic list summation | = help: Replace with `functools.reduce` -ℹ Suggested fix +ℹ Unsafe 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 db7aa2a866..c8ab5a8af9 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` -ℹ Fix +ℹ Safe fix 1 1 | d = {} 2 2 | # RUF019 3 |-if "k" in d and d["k"]: @@ -29,7 +29,7 @@ RUF019.py:7:4: RUF019 [*] Unnecessary key check before dictionary access | = help: Replace with `dict.get` -ℹ Fix +ℹ Safe fix 4 4 | pass 5 5 | 6 6 | k = "k" @@ -49,7 +49,7 @@ RUF019.py:10:4: RUF019 [*] Unnecessary key check before dictionary access | = help: Replace with `dict.get` -ℹ Fix +ℹ Safe fix 7 7 | if k in d and d[k]: 8 8 | pass 9 9 | @@ -69,7 +69,7 @@ RUF019.py:13:4: RUF019 [*] Unnecessary key check before dictionary access | = help: Replace with `dict.get` -ℹ Fix +ℹ Safe fix 10 10 | if (k) in d and d[k]: 11 11 | pass 12 12 | 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 17d3c4a376..6736a8f1c5 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,7 @@ noqa.py:23:5: F841 [*] Local variable `I` is assigned to but never used | = help: Remove assignment to unused variable `I` -ℹ Suggested fix +ℹ Unsafe 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 911789f49f..a74de90091 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 -ℹ Fix +ℹ Safe fix 6 6 | b = 2 # noqa: F841 7 7 | 8 8 | # Invalid @@ -30,7 +30,7 @@ RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 10 10 | print(c) 11 11 | 12 12 | # Invalid @@ -50,7 +50,7 @@ RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 13 13 | d = 1 # noqa: E501 14 14 | 15 15 | # Invalid @@ -70,7 +70,7 @@ RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; n | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 16 16 | d = 1 # noqa: F841, E501 17 17 | 18 18 | # Invalid (and unimplemented or not enabled) @@ -90,7 +90,7 @@ RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 19 19 | d = 1 # noqa: F841, W191, F821 20 20 | 21 21 | # Invalid (but external) @@ -110,7 +110,7 @@ RUF100_0.py:25:12: RUF100 [*] Unused `noqa` directive (unknown: `V500`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 22 22 | d = 1 # noqa: F841, V101 23 23 | 24 24 | # Invalid (but external) @@ -131,7 +131,7 @@ RUF100_0.py:29:10: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 26 26 | 27 27 | # fmt: off 28 28 | # Invalid - no space before # @@ -150,7 +150,7 @@ RUF100_0.py:32:5: F841 [*] Local variable `d` is assigned to but never used | = help: Remove assignment to unused variable `d` -ℹ Suggested fix +ℹ Unsafe fix 29 29 | d = 1# noqa: E501 30 30 | 31 31 | # Invalid - many spaces before # @@ -168,7 +168,7 @@ RUF100_0.py:32:33: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 29 29 | d = 1# noqa: E501 30 30 | 31 31 | # Invalid - many spaces before # @@ -188,7 +188,7 @@ RUF100_0.py:58:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe 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. @@ -208,7 +208,7 @@ RUF100_0.py:66:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe 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 +228,7 @@ RUF100_0.py:74:6: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe 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. @@ -248,7 +248,7 @@ RUF100_0.py:88:8: F401 [*] `shelve` imported but unused | = help: Remove unused import: `shelve` -ℹ Fix +ℹ Safe fix 85 85 | 86 86 | import collections # noqa 87 87 | import os # noqa: F401, RUF100 @@ -274,7 +274,7 @@ RUF100_0.py:93:92: RUF100 [*] Unused `noqa` directive (unused: `F401`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 90 90 | 91 91 | print(sys.path) 92 92 | 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 926354aa43..30c6f8f501 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 -ℹ Fix +ℹ Safe fix 6 6 | b = 2 # noqa: F841 7 7 | 8 8 | # Invalid @@ -30,7 +30,7 @@ RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 10 10 | print(c) 11 11 | 12 12 | # Invalid @@ -50,7 +50,7 @@ RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 13 13 | d = 1 # noqa: E501 14 14 | 15 15 | # Invalid @@ -70,7 +70,7 @@ RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; n | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 16 16 | d = 1 # noqa: F841, E501 17 17 | 18 18 | # Invalid (and unimplemented or not enabled) @@ -90,7 +90,7 @@ RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 19 19 | d = 1 # noqa: F841, W191, F821 20 20 | 21 21 | # Invalid (but external) @@ -111,7 +111,7 @@ RUF100_0.py:29:10: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 26 26 | 27 27 | # fmt: off 28 28 | # Invalid - no space before # @@ -130,7 +130,7 @@ RUF100_0.py:32:5: F841 [*] Local variable `d` is assigned to but never used | = help: Remove assignment to unused variable `d` -ℹ Suggested fix +ℹ Unsafe fix 29 29 | d = 1# noqa: E501 30 30 | 31 31 | # Invalid - many spaces before # @@ -148,7 +148,7 @@ RUF100_0.py:32:33: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 29 29 | d = 1# noqa: E501 30 30 | 31 31 | # Invalid - many spaces before # @@ -168,7 +168,7 @@ RUF100_0.py:58:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe 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. @@ -188,7 +188,7 @@ RUF100_0.py:66:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe 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. @@ -208,7 +208,7 @@ RUF100_0.py:74:6: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe 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. @@ -228,7 +228,7 @@ RUF100_0.py:88:8: F401 [*] `shelve` imported but unused | = help: Remove unused import: `shelve` -ℹ Fix +ℹ Safe fix 85 85 | 86 86 | import collections # noqa 87 87 | import os # noqa: F401, RUF100 @@ -254,7 +254,7 @@ RUF100_0.py:93:92: RUF100 [*] Unused `noqa` directive (unused: `F401`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 90 90 | 91 91 | print(sys.path) 92 92 | 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 27bf0677ed..bd0aaf365a 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` -ℹ Fix +ℹ Safe fix 34 34 | # This should ignore the first error. 35 35 | from typing import ( 36 36 | Mapping, # noqa: F401 @@ -32,7 +32,7 @@ RUF100_1.py:52:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe 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 @@ -52,7 +52,7 @@ RUF100_1.py:59:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe 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 @@ -72,7 +72,7 @@ RUF100_1.py:66:16: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 63 63 | def f(): 64 64 | # This should ignore the error, but mark F501 as unused. 65 65 | from typing import ( # noqa: F401 @@ -93,7 +93,7 @@ RUF100_1.py:72:27: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 69 69 | 70 70 | def f(): 71 71 | # This should ignore the error, but mark F501 as unused. @@ -112,7 +112,7 @@ RUF100_1.py:89:24: F401 [*] `typing.Awaitable` imported but unused | = help: Remove unused import -ℹ Fix +ℹ Safe fix 86 86 | 87 87 | def f(): 88 88 | # This should mark F501 as unused. @@ -128,7 +128,7 @@ RUF100_1.py:89:35: F401 [*] `typing.AwaitableGenerator` imported but unused | = help: Remove unused import -ℹ Fix +ℹ Safe fix 86 86 | 87 87 | def f(): 88 88 | # This should mark F501 as unused. @@ -144,7 +144,7 @@ RUF100_1.py:89:55: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe 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 86c963c578..4eef8cdef3 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,7 @@ RUF100_2.py:1:19: RUF100 [*] Unused `noqa` directive (unused: `F401`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe 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 24844b54a9..019c140aec 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,7 @@ RUF100_3.py:1:1: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 1 |-# noqa 2 1 | # noqa # comment 3 2 | print() # noqa @@ -26,7 +26,7 @@ RUF100_3.py:2:1: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 1 1 | # noqa 2 |-# noqa # comment 2 |+# comment @@ -45,7 +45,7 @@ RUF100_3.py:3:10: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 1 1 | # noqa 2 2 | # noqa # comment 3 |-print() # noqa @@ -65,7 +65,7 @@ RUF100_3.py:4:10: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 1 1 | # noqa 2 2 | # noqa # comment 3 3 | print() # noqa @@ -86,7 +86,7 @@ RUF100_3.py:5:10: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 2 2 | # noqa # comment 3 3 | print() # noqa 4 4 | print() # noqa # comment @@ -107,7 +107,7 @@ RUF100_3.py:6:10: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 3 3 | print() # noqa 4 4 | print() # noqa # comment 5 5 | print() # noqa # comment @@ -128,7 +128,7 @@ RUF100_3.py:7:10: RUF100 [*] Unused blanket `noqa` directive | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 4 4 | print() # noqa # comment 5 5 | print() # noqa # comment 6 6 | print() # noqa comment @@ -149,7 +149,7 @@ RUF100_3.py:14:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 11 11 | print(a) # noqa comment 12 12 | print(a) # noqa comment 13 13 | @@ -168,7 +168,7 @@ RUF100_3.py:15:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 12 12 | print(a) # noqa comment 13 13 | 14 14 | # noqa: E501, F821 @@ -189,7 +189,7 @@ RUF100_3.py:16:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 13 13 | 14 14 | # noqa: E501, F821 15 15 | # noqa: E501, F821 # comment @@ -210,7 +210,7 @@ RUF100_3.py:17:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 14 14 | # noqa: E501, F821 15 15 | # noqa: E501, F821 # comment 16 16 | print() # noqa: E501, F821 @@ -231,7 +231,7 @@ RUF100_3.py:18:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 15 15 | # noqa: E501, F821 # comment 16 16 | print() # noqa: E501, F821 17 17 | print() # noqa: E501, F821 # comment @@ -252,7 +252,7 @@ RUF100_3.py:19:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 16 16 | print() # noqa: E501, F821 17 17 | print() # noqa: E501, F821 # comment 18 18 | print() # noqa: E501, F821 # comment @@ -273,7 +273,7 @@ RUF100_3.py:20:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 17 17 | print() # noqa: E501, F821 # comment 18 18 | print() # noqa: E501, F821 # comment 19 19 | print() # noqa: E501, F821 comment @@ -294,7 +294,7 @@ RUF100_3.py:21:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 18 18 | print() # noqa: E501, F821 # comment 19 19 | print() # noqa: E501, F821 comment 20 20 | print() # noqa: E501, F821 comment @@ -315,7 +315,7 @@ RUF100_3.py:22:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 19 19 | print() # noqa: E501, F821 comment 20 20 | print() # noqa: E501, F821 comment 21 21 | print(a) # noqa: E501, F821 @@ -336,7 +336,7 @@ RUF100_3.py:23:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 20 20 | print() # noqa: E501, F821 comment 21 21 | print(a) # noqa: E501, F821 22 22 | print(a) # noqa: E501, F821 # comment @@ -355,7 +355,7 @@ RUF100_3.py:24:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe fix 21 21 | print(a) # noqa: E501, F821 22 22 | print(a) # noqa: E501, F821 # comment 23 23 | print(a) # noqa: E501, F821 # comment @@ -372,7 +372,7 @@ RUF100_3.py:25:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe 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 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 f1fc6f88b7..a58ef10cb1 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 -ℹ Possible fix +ℹ Display-only fix 4 4 | dictionary = { 5 5 | # "key1": 123, # noqa: ERA001 6 6 | # "key2": 456, # noqa @@ -27,7 +27,7 @@ RUF100_5.py:11:1: ERA001 Found commented-out code | = help: Remove commented-out code -ℹ Possible fix +ℹ Display-only fix 8 8 | } 9 9 | 10 10 | @@ -40,7 +40,7 @@ RUF100_5.py:11:13: RUF100 [*] Unused `noqa` directive (unused: `E501`) | = help: Remove unused `noqa` directive -ℹ Fix +ℹ Safe 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 974eba08c4..3274417750 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,7 @@ 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 +ℹ Unsafe 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 c267b245b6..7161b11be3 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,7 @@ ruff_noqa_invalid.py:1:8: F401 [*] `os` imported but unused | = help: Remove unused import: `os` -ℹ Fix +ℹ Safe fix 1 |-import os # ruff: noqa: F401 2 1 | 3 2 | @@ -22,7 +22,7 @@ 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 +ℹ Unsafe fix 2 2 | 3 3 | 4 4 | def f(): 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 6a15b3815f..558c2c91ac 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 -ℹ Suggested fix +ℹ Unsafe fix 17 17 | process() 18 18 | except MyException as e: 19 19 | logger.exception("process failed") @@ -29,7 +29,7 @@ TRY201.py:63:19: TRY201 [*] Use `raise` without specifying exception name | = help: Remove exception name -ℹ Suggested fix +ℹ Unsafe fix 60 60 | except MyException as e: 61 61 | logger.exception("process failed") 62 62 | if True: @@ -47,7 +47,7 @@ TRY201.py:74:23: TRY201 [*] Use `raise` without specifying exception name | = help: Remove exception name -ℹ Suggested fix +ℹ Unsafe 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 60c9a48409..b0cc03fe75 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 -ℹ Fix +ℹ Safe fix 1 |+import math 2 |+import random 1 3 | from pathlib import Path @@ -34,7 +34,7 @@ isort.ipynb:cell 2:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Fix +ℹ Safe fix 1 1 | from pathlib import Path 2 2 | import random 3 3 | import math @@ -58,7 +58,7 @@ isort.ipynb:cell 3:1:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Fix +ℹ Safe fix 6 6 | # Newline should be added here 7 7 | def foo(): 8 8 | pass @@ -78,7 +78,7 @@ isort.ipynb:cell 3:7:1: I001 [*] Import block is un-sorted or un-formatted | = help: Organize imports -ℹ Fix +ℹ Safe 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 d90b6dbef4..58aa72d7da 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` -ℹ Fix +ℹ Safe fix 2 2 | 3 3 | %matplotlib inline 4 4 | 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 24253dc073..a610a9bb12 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` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | def f(): 2 |- foo1 = %matplotlib --list 2 |+ %matplotlib --list @@ -27,7 +27,7 @@ unused_variable.ipynb:cell 1:3:5: F841 [*] Local variable `foo2` is assigned to | = help: Remove assignment to unused variable `foo2` -ℹ Suggested fix +ℹ Unsafe fix 1 1 | def f(): 2 2 | foo1 = %matplotlib --list 3 |- foo2: list[str] = %matplotlib --list @@ -45,7 +45,7 @@ unused_variable.ipynb:cell 2:2:5: F841 [*] Local variable `bar1` is assigned to | = help: Remove assignment to unused variable `bar1` -ℹ Suggested fix +ℹ Unsafe fix 2 2 | foo1 = %matplotlib --list 3 3 | foo2: list[str] = %matplotlib --list 4 4 | def f(): @@ -62,7 +62,7 @@ unused_variable.ipynb:cell 2:3:5: F841 [*] Local variable `bar2` is assigned to | = help: Remove assignment to unused variable `bar2` -ℹ Suggested fix +ℹ Unsafe fix 3 3 | foo2: list[str] = %matplotlib --list 4 4 | def f(): 5 5 | bar1 = !pwd